-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
362 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,109 @@ | ||
export interface GetRulesResponse { | ||
import { useData } from "../hooks/useData"; | ||
|
||
interface GetRulesResponse { | ||
isOpen: boolean; | ||
buyOrderMinimumPrice: number; | ||
sellOrderMinimumPrice: number; | ||
FTNOrderFee: number; | ||
goodsOrderFee: number; | ||
} | ||
export function useRules() { | ||
return useData<Record<string, never>, GetRulesResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/rules", | ||
}); | ||
} | ||
|
||
export interface GetCurrentPriceResponse { | ||
interface GetCurrentPriceResponse { | ||
buyPrice: number; | ||
sellPrice: number; | ||
} | ||
export interface GetCurrentAmountResponse { | ||
export function useCurrentPrice() { | ||
return useData<Record<string, never>, GetCurrentPriceResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/current-price", | ||
}); | ||
} | ||
|
||
interface GetCurrentAmountResponse { | ||
buyAmount: number; | ||
sellAmount: number; | ||
} | ||
export function useCurrentAmount() { | ||
return useData<Record<string, never>, GetCurrentAmountResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/current-amount", | ||
}); | ||
} | ||
|
||
export interface GetPriceHistoryRequest { | ||
interface GetCurrentAmountDistributionRequest { | ||
type: "buy" | "sell"; | ||
range: "24h" | "7d" | "15d" | "30d"; | ||
resolution: "5m" | "1h" | "1d"; | ||
limit?: number; | ||
} | ||
|
||
export interface GetPriceHistoryResponse { | ||
history: Record<number, number>; | ||
interface GetCurrentAmountDistributionResponse { | ||
amountDistribution: Record<number, number>; | ||
} | ||
export function useCurrentAmountDistribution({ | ||
type, | ||
limit, | ||
}: GetCurrentAmountDistributionRequest) { | ||
return useData< | ||
GetCurrentAmountDistributionRequest, | ||
GetCurrentAmountDistributionResponse | ||
>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/current-amount-distribution", | ||
queryArgs: { | ||
type, | ||
limit, | ||
}, | ||
}); | ||
} | ||
|
||
export interface GetAmountHistoryRequest { | ||
interface GetPriceHistoryRequest { | ||
type: "buy" | "sell"; | ||
range: "24h" | "7d" | "15d" | "30d"; | ||
resolution: "5m" | "1h" | "1d"; | ||
} | ||
|
||
export interface GetAmountHistoryResponse { | ||
interface GetPriceHistoryResponse { | ||
history: Record<number, number>; | ||
} | ||
export function usePriceHistory({ | ||
type, | ||
range, | ||
resolution, | ||
}: GetPriceHistoryRequest) { | ||
return useData<GetPriceHistoryRequest, GetPriceHistoryResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/price-history", | ||
queryArgs: { | ||
type, | ||
range, | ||
resolution, | ||
}, | ||
}); | ||
} | ||
|
||
export interface GetCurrentAmountDistributionRequest { | ||
interface GetAmountHistoryRequest { | ||
type: "buy" | "sell"; | ||
limit?: number; | ||
range: "24h" | "7d" | "15d" | "30d"; | ||
resolution: "5m" | "1h" | "1d"; | ||
} | ||
|
||
export interface GetCurrentAmountDistributionResponse { | ||
amountDistribution: Record<number, number>; | ||
interface GetAmountHistoryResponse { | ||
history: Record<number, number>; | ||
} | ||
export function useAmountHistory({ | ||
type, | ||
range, | ||
resolution, | ||
}: GetAmountHistoryRequest) { | ||
return useData<GetAmountHistoryRequest, GetAmountHistoryResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/jpep/ftn-macket/amount-history", | ||
queryArgs: { | ||
type, | ||
range, | ||
resolution, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
import { useDataTrigger } from "../hooks/useData"; | ||
|
||
export interface GetWordFreqResponse { | ||
title: string; | ||
wordFreq: Record<string, number>; | ||
} | ||
export function useWordFreq({ articleSlug }: { articleSlug: string }) { | ||
return useDataTrigger<Record<string, never>, GetWordFreqResponse>({ | ||
method: "GET", | ||
endpoint: `/v1/articles/${articleSlug}/word-freq`, | ||
}); | ||
} | ||
|
||
export interface GetLPRecommendCheckResponse { | ||
articleTitle: string; | ||
canRecommendNow: boolean; | ||
FPReward: number; | ||
nextCanRecommendDate: number; | ||
} | ||
export function useLPRecommendCheck({ articleSlug }: { articleSlug: string }) { | ||
return useDataTrigger<Record<string, never>, GetLPRecommendCheckResponse>({ | ||
method: "GET", | ||
endpoint: `/v1/articles/${articleSlug}/lp-recommend-check`, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,86 @@ | ||
export interface GetRewardsResponse { | ||
import { useData } from "../hooks/useData"; | ||
|
||
interface GetRewardsResponse { | ||
rewards: string[]; | ||
} | ||
export function useRewards() { | ||
return useData<Record<string, never>, GetRewardsResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/lottery/rewards", | ||
}); | ||
} | ||
|
||
export interface GetRecordsRequest { | ||
interface GetRecordsRequest { | ||
offset?: number; | ||
limit?: number; | ||
excluded_awards?: string[]; | ||
} | ||
|
||
export interface GetRecordsItem { | ||
interface GetRecordsItem { | ||
time: number; | ||
rewardName: string; | ||
userName: string; | ||
userUrl: string; | ||
} | ||
|
||
export interface GetRecordsResponse { | ||
interface GetRecordsResponse { | ||
records: GetRecordsItem[]; | ||
} | ||
export function useRecords({ | ||
offset, | ||
limit, | ||
excluded_awards, | ||
}: GetRecordsRequest) { | ||
return useData<GetRecordsRequest, GetRecordsResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/lottery/records", | ||
queryArgs: { | ||
offset, | ||
limit, | ||
excluded_awards, | ||
}, | ||
}); | ||
} | ||
|
||
export interface GetSummaryRewardItem { | ||
interface GetSummaryRequest { | ||
range: "1d" | "7d" | "30d" | "all"; | ||
} | ||
interface GetSummaryRewardItem { | ||
rewardName: string; | ||
winsCount: number; | ||
winnersCount: number; | ||
averageWinsCountPerWinner: number; | ||
winningRate: number; | ||
rarity: number; | ||
} | ||
|
||
export interface GetSummaryRequest { | ||
range: "1d" | "7d" | "30d" | "all"; | ||
} | ||
|
||
export interface GetSummaryResponse { | ||
rewards: GetSummaryRewardItem[]; | ||
} | ||
export function useSummary({ range }: GetSummaryRequest) { | ||
return useData<GetSummaryRequest, GetSummaryResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/lottery/summary", | ||
queryArgs: { | ||
range, | ||
}, | ||
}); | ||
} | ||
|
||
export interface GetRewardWinsHistoryRequest { | ||
interface GetRewardWinsHistoryRequest { | ||
range: "1d" | "30d" | "60d"; | ||
resolution: "1h" | "1d"; | ||
} | ||
|
||
export interface GetRewardWinsHistoryResponse { | ||
interface GetRewardWinsHistoryResponse { | ||
history: Record<number, number>; | ||
} | ||
export function useRewardWinsHistory({ | ||
range, | ||
resolution, | ||
}: GetRewardWinsHistoryRequest) { | ||
return useData<GetRewardWinsHistoryRequest, GetRewardWinsHistoryResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/lottery/reward-wins-history", | ||
queryArgs: { | ||
range, | ||
resolution, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
export interface GetResponse { | ||
import { useData } from "../hooks/useData"; | ||
|
||
interface GetResponse { | ||
version: string; | ||
downgradedTools: string[]; | ||
unavaliableTools: string[]; | ||
} | ||
|
||
export enum ToolStatusEnum { | ||
NORMAL = "NORMAL", | ||
UNAVALIABLE = "UNAVAILABLE", | ||
DOWNGRADED = "DOWNGRADED", | ||
export function useStatus() { | ||
return useData<Record<string, never>, GetResponse>({ | ||
method: "GET", | ||
endpoint: "/v1/status", | ||
}); | ||
} | ||
|
||
export interface GetToolStatusResponse { | ||
status: ToolStatusEnum; | ||
interface GetToolStatusResponse { | ||
status: "NORMAL" | "UNAVAILABLE" | "DOWNGRADED"; | ||
reason: string | null; | ||
lastUpdateTime: number | null; | ||
dataUpdateFreq: string | null; | ||
dataCount: number | null; | ||
dataSource: Record<string, string> | null; | ||
} | ||
export function useToolStatus({ toolSlug }: { toolSlug: string }) { | ||
return useData<Record<string, never>, GetToolStatusResponse>({ | ||
method: "GET", | ||
endpoint: `/v1/status/${toolSlug}`, | ||
}); | ||
} |
Oops, something went wrong.