From c5a25bb865248a824831816ce3b488a5c4ca86d5 Mon Sep 17 00:00:00 2001 From: AricRedemption Date: Mon, 9 Sep 2024 10:24:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20VERSION:=203.2.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/wallet/Asset.vue | 12 +----------- src/queries/utxos.ts | 28 ++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/pages/wallet/Asset.vue b/src/pages/wallet/Asset.vue index 3f7b3d2..21f1cab 100644 --- a/src/pages/wallet/Asset.vue +++ b/src/pages/wallet/Asset.vue @@ -235,17 +235,7 @@ const toReceive = () => {
{{ currentMVCWallet?.getAddressType() }}
{{ currentMVCWallet?.getAddress() }}
- +
diff --git a/src/queries/utxos.ts b/src/queries/utxos.ts index df82b29..d524785 100644 --- a/src/queries/utxos.ts +++ b/src/queries/utxos.ts @@ -32,15 +32,27 @@ export type MvcUtxo = { const fetchMVCUtxos = async (address: string, useUnconfirmed = true): Promise => { const net = getNet() - let { list = [] } = await metaletApiV4<{ list: MvcUtxo[] }>('/mvc/address/utxo-list').get({ - address, - net, - }) - list = list.filter((utxo) => utxo.value >= 600) - if (!useUnconfirmed) { - list = list.filter((utxo) => utxo.height > 0) + let allUtxos: MvcUtxo[] = [] + let page = 1 + let hasMore = true + + while (hasMore) { + const { list = [] } = await metaletApiV4<{ list: MvcUtxo[] }>('/mvc/address/utxo-list').get({ + address, + net, + page, + }) + let filteredList = list.filter((utxo) => utxo.value >= 600) + if (!useUnconfirmed) { + filteredList = filteredList.filter((utxo) => utxo.height > 0) + } + + allUtxos = [...allUtxos, ...filteredList] + hasMore = list.length > 0 + page += 1 } - return list + + return allUtxos } export type Utxo = {