diff --git a/components.d.ts b/components.d.ts index f2ac9e1..d8e837d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -12,6 +12,7 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + Icon: typeof import('./src/components/Icon/index.vue')['default'] IIcBaselineDataSaverOff: typeof import('~icons/ic/baseline-data-saver-off')['default'] IIcBaselineDownloading: typeof import('~icons/ic/baseline-downloading')['default'] IIcBaselineInfo: typeof import('~icons/ic/baseline-info')['default'] @@ -69,6 +70,7 @@ declare module 'vue' { // For TSX support declare global { + const Icon: typeof import('./src/components/Icon/index.vue')['default'] const IIcBaselineDataSaverOff: typeof import('~icons/ic/baseline-data-saver-off')['default'] const IIcBaselineDownloading: typeof import('~icons/ic/baseline-downloading')['default'] const IIcBaselineInfo: typeof import('~icons/ic/baseline-info')['default'] diff --git a/package.json b/package.json index 705614c..39b6995 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@elysiajs/eden": "^1.4.5", "@ionic/vue": "^8.7.11", "@ionic/vue-router": "^8.7.11", - "@riwa/api-types": "http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz", + "@riwa/api-types": "http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz", "@tailwindcss/vite": "^4.1.18", "@vee-validate/yup": "^4.15.1", "@vueuse/core": "^14.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 46ef687..c1f4bac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ importers: specifier: ^8.7.11 version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3)) '@riwa/api-types': - specifier: http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz - version: http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))) + specifier: http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz + version: '@riwa/eden@http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))' '@tailwindcss/vite': specifier: ^4.1.18 version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2)) @@ -2453,9 +2453,9 @@ packages: '@remirror/core-constants@3.0.0': resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==} - '@riwa/api-types@http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz': - resolution: {tarball: http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz} - version: 0.0.75 + '@riwa/eden@http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz': + resolution: {tarball: http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz} + version: 0.0.78 peerDependencies: '@elysiajs/eden': ^1.4.5 @@ -11491,7 +11491,7 @@ snapshots: '@remirror/core-constants@3.0.0': {} - '@riwa/api-types@http://192.168.1.8:9527/api/riwa-api-types-0.0.75.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': + '@riwa/eden@http://192.168.1.6:9527/api/riwa-eden-0.0.78.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))': dependencies: '@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)) diff --git a/src/api/types.ts b/src/api/types.ts index 4ea3bff..38d1704 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -68,6 +68,10 @@ export type UserWithdrawOrderBody = TreatyQuery; export type MarketDataStreaming = ReturnType; +export type AssetRecordBody = TreatyQuery; + +export type AssetRecordData = Treaty.Data["data"][number]; + /** * 应用版本信息 */ diff --git a/src/components/Icon/index.vue b/src/components/Icon/index.vue new file mode 100644 index 0000000..18a5020 --- /dev/null +++ b/src/components/Icon/index.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index bb64eb6..0442d39 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -94,6 +94,22 @@ const routes: Array = [ component: () => import("@/views/wallet/transfer.vue"), meta: { requiresAuth: true }, }, + { + path: "/wallet/funding", + component: () => import("@/views/wallet/funding.vue"), + meta: { requiresAuth: true }, + }, + { + path: "/wallet/trading", + component: () => import("@/views/wallet/trading.vue"), + meta: { requiresAuth: true }, + }, + { + path: "/asset_record/:code", + props: true, + component: () => import("@/views/wallet/asset-record.vue"), + meta: { requiresAuth: true }, + }, { path: "/user/settings", component: () => import("@/views/user-settings/index.vue"), diff --git a/src/store/wallet.ts b/src/store/wallet.ts index 2fb60e3..9167985 100644 --- a/src/store/wallet.ts +++ b/src/store/wallet.ts @@ -4,6 +4,7 @@ import { client, safeClient } from "@/api"; interface State { totalAssetValue: TotalAssetValue; + balances: BalancesData; fundingBalances: BalancesData; tradingBalances: BalancesData; bankAccounts: BankAccountsData["data"]; @@ -17,6 +18,7 @@ export const useWalletStore = defineStore("wallet", () => { tradingValueUsd: "0", totalValueUsd: "0", }, + balances: [], fundingBalances: [], tradingBalances: [], bankAccounts: [], @@ -25,8 +27,7 @@ export const useWalletStore = defineStore("wallet", () => { async function initializeWallet() { syncTotalAssetValue(); - syncFundingBalances(); - syncTradingBalances(); + syncBalances(); syncBankAccounts(); syncSupportBanks(); } @@ -36,6 +37,12 @@ export const useWalletStore = defineStore("wallet", () => { if (data.value) state.totalAssetValue = data.value; } + + async function syncBalances() { + const { data: balances } = await safeClient(() => client.api.wallet.balances.get(), { silent: true }); + state.balances = balances.value || []; + } + async function syncFundingBalances() { const { data: balances } = await safeClient(() => client.api.wallet.balances.get({ query: { accountType: "funding" }, @@ -67,6 +74,7 @@ export const useWalletStore = defineStore("wallet", () => { return { ...toRefs(state), initializeWallet, + syncBalances, syncFundingBalances, syncTradingBalances, syncBankAccounts, diff --git a/src/views/user/components/asset.vue b/src/views/user/components/asset.vue index ee5fce4..e235cfb 100644 --- a/src/views/user/components/asset.vue +++ b/src/views/user/components/asset.vue @@ -4,59 +4,58 @@ import SolarRoundTransferHorizontalBoldDuotone from "~icons/solar/round-transfer import { getCryptoIcon } from "@/config/crypto"; const walletStore = useWalletStore(); -const { fundingBalances, totalAssetValue } = storeToRefs(walletStore); +const { balances, totalAssetValue } = storeToRefs(walletStore); diff --git a/src/views/wallet/funding.vue b/src/views/wallet/funding.vue new file mode 100644 index 0000000..6b1b8eb --- /dev/null +++ b/src/views/wallet/funding.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/views/wallet/trading.vue b/src/views/wallet/trading.vue new file mode 100644 index 0000000..06b112e --- /dev/null +++ b/src/views/wallet/trading.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/views/wallet/transfer.vue b/src/views/wallet/transfer.vue index 638c5d0..c1bda15 100644 --- a/src/views/wallet/transfer.vue +++ b/src/views/wallet/transfer.vue @@ -104,8 +104,7 @@ async function onSubmit(values: GenericObject) { await toast.present(); // 刷新余额 - walletStore.syncFundingBalances(); - walletStore.syncTradingBalances(); + walletStore.syncBalances(); router.back(); }