feat: 更新 '@capp/eden' 依赖至 0.0.9,添加资产中心页面,优化钱包相关逻辑
This commit is contained in:
@@ -5,21 +5,20 @@ export type Wallet = Treaty.Data<typeof client.api.wallet.wallets.get>[number];
|
||||
|
||||
export const useWalletStore = defineStore("wallet", () => {
|
||||
const wallets = ref<Wallet[]>([]);
|
||||
const balanceWallet = ref<Wallet | null>(null);
|
||||
|
||||
async function syncWallets() {
|
||||
const { data } = await safeClient(client.api.wallet.wallets.get(), { silent: true });
|
||||
wallets.value = data.value || [];
|
||||
}
|
||||
async function syncBalanceWallet() {
|
||||
const { data } = await safeClient(client.api.wallet.wallet_by_code({ walletTypeCode: "balance" }).get(), { silent: true });
|
||||
balanceWallet.value = data.value || null;
|
||||
async function getWalletByType(type: Wallet["walletType"]["code"]) {
|
||||
const { data } = await safeClient(client.api.wallet.wallet_by_code({ walletTypeCode: type }).get(), { silent: true });
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
return {
|
||||
wallets,
|
||||
balanceWallet,
|
||||
syncWallets,
|
||||
syncBalanceWallet,
|
||||
getWalletByType,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user