From f101a5ddf997b4f840aaca51f983ca897b6721c9 Mon Sep 17 00:00:00 2001 From: AricRedemption Date: Mon, 4 Mar 2024 16:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20VERSION:=202.4.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- package.json | 2 +- src/pages/settings/Index.vue | 11 +++ src/pages/settings/Toolkit.vue | 43 ++++++++++ src/pages/settings/components/SpaceMerge.vue | 86 ++++++++++++++++++++ src/pages/wallet/components/AssetItem.vue | 6 +- src/queries/utxos.ts | 12 ++- src/router.ts | 18 ++++ yarn.lock | 8 +- 9 files changed, 178 insertions(+), 10 deletions(-) create mode 100644 src/pages/settings/Toolkit.vue create mode 100644 src/pages/settings/components/SpaceMerge.vue diff --git a/README.md b/README.md index 4c7d3fc..f534438 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ The one-for-all transfer method. - `genesis?` - `string`, required when type is token - `codehash?` - `string`, required when type is token - `receivers` - `Reciever[]` - - `ammount` - `string`, do not pass numeric value here or Metalet will get upset. + - `amount` - `string`, do not pass numeric value here or Metalet will get upset. - `address` - `string` - `broadcast?` - `boolean`, default to `true` diff --git a/package.json b/package.json index 48b7209..aeba980 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "decimal.js": "^10.4.3", "ecpair": "^2.1.0", "memfs": "^4.5.0", - "meta-contract": "^0.4.0", + "meta-contract": "^0.4.2", "mvc-std-lib": "^1.1.4", "object-hash": "^3.0.0", "qrcode": "^1.5.3", diff --git a/src/pages/settings/Index.vue b/src/pages/settings/Index.vue index 986d1b7..05632fa 100644 --- a/src/pages/settings/Index.vue +++ b/src/pages/settings/Index.vue @@ -58,6 +58,10 @@ const toConnectedDapps = () => { router.push('/connected-dapps') } +const toToolkit = () => { + router.push('/settings/toolkit') +} + const showResetModal = ref(false) @@ -86,6 +90,13 @@ const showResetModal = ref(false) +
+
Toolkit
+
+ +
+
+
Open in Window Mode
diff --git a/src/pages/settings/Toolkit.vue b/src/pages/settings/Toolkit.vue new file mode 100644 index 0000000..1c37003 --- /dev/null +++ b/src/pages/settings/Toolkit.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/pages/settings/components/SpaceMerge.vue b/src/pages/settings/components/SpaceMerge.vue new file mode 100644 index 0000000..4e2a695 --- /dev/null +++ b/src/pages/settings/components/SpaceMerge.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/pages/wallet/components/AssetItem.vue b/src/pages/wallet/components/AssetItem.vue index 8e46979..949d6ca 100644 --- a/src/pages/wallet/components/AssetItem.vue +++ b/src/pages/wallet/components/AssetItem.vue @@ -110,15 +110,15 @@ watch(
Transferable: - {{ asset.balance?.transferBalance || '--' }} + {{ asset.balance?.transferBalance }}
Available: - {{ asset.balance?.availableBalanceSafe || '--' }} + {{ asset.balance?.availableBalanceSafe }}
Available(pending): - {{ asset.balance?.availableBalanceUnSafe || '--' }} + {{ asset.balance?.availableBalanceUnSafe }}
diff --git a/src/queries/utxos.ts b/src/queries/utxos.ts index 74b13c2..04879bc 100644 --- a/src/queries/utxos.ts +++ b/src/queries/utxos.ts @@ -1,5 +1,7 @@ import { Chain } from '@/lib/account' import { getNet } from '@/lib/network' +import { Ref, ComputedRef } from 'vue' +import { useQuery } from '@tanstack/vue-query' import { mvcApi, mempoolApi, metaletApiV3 } from './request' export interface UTXO { @@ -40,7 +42,7 @@ export type Utxo = { export const fetchUtxos = async (chain: Chain = 'mvc', address: string): Promise => { if (chain === 'mvc') { - return await fetchMVCUtxos(address) + return (await fetchMVCUtxos(address)) || [] } else { return (await getBtcUtxos(address)) || [] } @@ -116,3 +118,11 @@ export async function getUtxos(address: string): Promise { const utxos = await mempoolApi(`/address/${address}/utxo`).get() return utxos.map((utxo) => formatMempoolUTXO(utxo)) } + +export const useMVCUTXOQuery = (address: Ref, options: { enabled: ComputedRef }) => { + return useQuery({ + queryKey: ['MVCUTXOs', { address }], + queryFn: () => fetchMVCUtxos(address.value), + ...options, + }) +} diff --git a/src/router.ts b/src/router.ts index 4e88b5e..c219eb1 100644 --- a/src/router.ts +++ b/src/router.ts @@ -306,6 +306,24 @@ const routes = [ noFooter: true, }, }, + { + path: '/settings/toolkit', + component: () => import('./pages/settings/Toolkit.vue'), + meta: { + secondaryHeader: true, + headerTitle: 'Toolkit', + noFooter: false, + }, + }, + { + path: '/settings/toolkit/space-merge', + component: () => import('./pages/settings/components/SpaceMerge.vue'), + meta: { + secondaryHeader: true, + headerTitle: 'Space Merge', + noFooter: false, + }, + }, { path: '/tools/path-finder', diff --git a/yarn.lock b/yarn.lock index ec794ec..318f810 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2995,10 +2995,10 @@ merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -meta-contract@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/meta-contract/-/meta-contract-0.4.0.tgz#e2e28129874bb51bde6534dbb7ccf0afb4eb853b" - integrity sha512-bzRCiZEcs/exaMHMz86aYM5xNHO4b8f8BkNFGzAZYzQIEPg2dkb8w9tgfXytHKboBh4Lf4wqcMyIZHcIHDAxEw== +meta-contract@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/meta-contract/-/meta-contract-0.4.2.tgz#3f74fe1aaaa351a3b3c92746cd6af961a1e2fbb9" + integrity sha512-0aEoE8K5iUAQdCCqxjWoanIJJUnjSWjeCZ9lnKhviorU2Cq2cE/QHNCn3+yyxPrhsKPcFfJ84CXECveg0dpoMA== dependencies: mvc-scrypt "0.1.2" node-fetch "2"