122 lines
4.8 KiB
TypeScript
122 lines
4.8 KiB
TypeScript
import type { Treaty } from "@elysiajs/eden";
|
||
import type { client } from ".";
|
||
import type { AssetCodeEnum, WithdrawMethodEnum } from "./enum";
|
||
import type { authClient } from "@/auth";
|
||
|
||
export type TreatyQuery<T> = T extends (...args: any[]) => any
|
||
? NonNullable<NonNullable<Parameters<T>[0]>["query"]>
|
||
: never;
|
||
|
||
export type TreatyBody<T> = T extends (...args: any[]) => any
|
||
? NonNullable<Parameters<T>[0]>
|
||
: never;
|
||
|
||
export type DepositFiatData = Treaty.Data<typeof client.api.deposit.fiat.post>;
|
||
|
||
export type BalancesData = Treaty.Data<typeof client.api.wallet.balances.get>;
|
||
|
||
export type BalancesSummaryData = Treaty.Data<typeof client.api.wallet.balances.summary.get>;
|
||
|
||
export type TotalAssetValue = Treaty.Data<typeof client.api.wallet.total_value.get>;
|
||
|
||
export type WithdrawBody = Omit<Parameters<typeof client.api.withdraw.post>[0], "assetCode" | "withdrawMethod"> & {
|
||
assetCode: AssetCodeEnum;
|
||
withdrawMethod: WithdrawMethodEnum;
|
||
};
|
||
|
||
export type DepositFiatBody = TreatyBody<typeof client.api.deposit.fiat.post>;
|
||
|
||
export type UserProfileData = Treaty.Data<typeof client.api.user.profile.get>;
|
||
|
||
export type UpdateUserProfileBody = TreatyBody<typeof client.api.user.profile.put>;
|
||
|
||
export type RwaIssuanceProductsData = Treaty.Data<typeof client.api.rwa.issuance.products.bundle.post>;
|
||
|
||
export type RwaIssuanceProductBody = TreatyBody<typeof client.api.rwa.issuance.products.bundle.post>;
|
||
|
||
export type RwaIssuanceCategoriesData = Treaty.Data<typeof client.api.rwa.category.categories.get>;
|
||
|
||
export type BankAccountsData = Treaty.Data<typeof client.api.bank_account.get>["data"][number];
|
||
|
||
export type BankAccountBody = TreatyBody<typeof client.api.bank_account.post>;
|
||
|
||
export type BankAccountData = Treaty.Data<typeof client.api.bank_account.post>;
|
||
|
||
export type SupportBanksData = Treaty.Data<typeof client.api.bank_account.banks.get>;
|
||
|
||
export type AvailableSubscriptionBody = TreatyQuery<typeof client.api.rwa.subscription.available_editions.get>;
|
||
|
||
export type RwaData = Treaty.Data<typeof client.api.rwa.subscription.available_editions.get>["data"][number];
|
||
|
||
export type MyIssueRwaData = Treaty.Data<typeof client.api.rwa.issuance.products.get>["data"][number];
|
||
|
||
export type MySubscribeRwaData = Treaty.Data<typeof client.api.rwa.subscription.my_subscriptions.get>["data"][number];
|
||
|
||
export type MySubscribeRwaBody = TreatyQuery<typeof client.api.rwa.subscription.my_subscriptions.get>;
|
||
|
||
export type PhoneNumberVerifyClient = TreatyBody<typeof authClient.phoneNumber.verify>;
|
||
|
||
export type UsernameClient = TreatyBody<typeof authClient.signIn.username>;
|
||
|
||
export type EmailVerifyClient = TreatyBody<typeof authClient.emailOtp.verifyEmail>;
|
||
|
||
export type UserDepositOrderData = Treaty.Data<typeof client.api.deposit.orders.get>["data"][number];
|
||
|
||
export type UserDepositOrderBody = TreatyQuery<typeof client.api.deposit.orders.get>;
|
||
|
||
export type UserWithdrawOrderData = Treaty.Data<typeof client.api.withdraw.get>["data"][number];
|
||
|
||
export type UserWithdrawOrderBody = TreatyQuery<typeof client.api.withdraw.get>;
|
||
|
||
export type MarketDataStreaming = ReturnType<typeof client.api.market_data.streaming.subscribe>;
|
||
|
||
export type AssetRecordBody = TreatyQuery<typeof client.api.ledger.entries.get>;
|
||
|
||
export type AssetRecordData = Treaty.Data<typeof client.api.ledger.entries.get>["data"][number];
|
||
|
||
export type TradableData = Treaty.Data<typeof client.api.rwa.tokenization.tradable_products.get>["data"][number];
|
||
|
||
export type TradableBody = TreatyQuery<typeof client.api.rwa.tokenization.tradable_products.get>;
|
||
|
||
export type HoldingsData = Treaty.Data<typeof client.api.rwa.holdings.get>;
|
||
|
||
export type HoldingItem = HoldingsData extends { data: Array<infer T> } ? T : HoldingsData extends Array<infer T> ? T : never;
|
||
|
||
export type NotificationData = Treaty.Data<typeof client.api.notifications.get>["data"][number];
|
||
|
||
export type NotificationBody = TreatyQuery<typeof client.api.notifications.get>;
|
||
|
||
export type NewBody = TreatyQuery<typeof client.api.news.get>;
|
||
|
||
export type NewData = Treaty.Data<typeof client.api.news.get>["data"][number];
|
||
|
||
export type EaringsSummaryData = Treaty.Data<typeof client.api.earnings.summary.post>;
|
||
|
||
export type EaringsDetailData = Treaty.Data<typeof client.api.earnings.details.post>["data"][number];
|
||
|
||
export type EaringsDetailBody = TreatyBody<typeof client.api.earnings.details.post>;
|
||
|
||
export type SpotOrderBody = TreatyBody<typeof client.api.spot_order.create.post>;
|
||
|
||
/**
|
||
* 应用版本信息
|
||
*/
|
||
export interface VersionInfo {
|
||
/** 最新版本号,如 "1.2.3" */
|
||
version: string;
|
||
/** 构建号 */
|
||
buildNumber?: number;
|
||
/** 是否强制更新 */
|
||
forceUpdate: boolean;
|
||
/** 更新提示信息 */
|
||
updateMessage?: string;
|
||
/** 更新下载链接(App Store / Google Play) */
|
||
updateUrl?: string;
|
||
/** 最低支持版本,低于此版本必须更新 */
|
||
minSupportVersion?: string;
|
||
/** 发布时间 */
|
||
releaseDate?: string;
|
||
/** 更新内容 */
|
||
releaseNotes?: string[];
|
||
}
|