diff --git a/config/wallet-config.json b/config/wallet-config.json index 93a77535644..59003569c28 100644 --- a/config/wallet-config.json +++ b/config/wallet-config.json @@ -88,5 +88,6 @@ "integrationEnabled": true, "mainnetApiUrl": "https://api2.ordinalsbot.com", "signetApiUrl": "https://signet.ordinalsbot.com" - } + }, + "recoverUninscribedTaprootUtxosFeatureEnabled": false } diff --git a/config/wallet-config.schema.json b/config/wallet-config.schema.json index 68e506e82d2..07f3a5ae28b 100644 --- a/config/wallet-config.schema.json +++ b/config/wallet-config.schema.json @@ -137,6 +137,10 @@ "mainnetApiUrl": { "type": "string" }, "signetApiUrl": { "type": "string" } } + }, + "recoverUninscribedTaprootUtxosFeatureEnabled": { + "type": "boolean", + "description": "Determines whether or not the recover uninscribed taproot utxos feature is enabled" } }, "$defs": { diff --git a/src/app/debug.ts b/src/app/debug.ts index eec3a7a9b07..04ef5d35621 100644 --- a/src/app/debug.ts +++ b/src/app/debug.ts @@ -5,6 +5,7 @@ import * as reduxPersist from 'redux-persist'; import { getLogsFromBrowserStorage } from '@shared/logger-storage'; import { persistConfig } from '@shared/storage/redux-pesist'; +import { queryClient } from './common/persistence'; import { store } from './store'; import { stxChainSlice } from './store/chains/stx-chain.slice'; import { settingsSlice } from './store/settings/settings.slice'; @@ -34,8 +35,11 @@ const debug = { resetMessages() { store.dispatch(settingsSlice.actions.resetMessages()); }, - resetHasApprovedNewBrand() { - store.dispatch(settingsSlice.actions.resetHasApprovedNewBrand()); + clearReactQueryCache() { + queryClient.clear(); + }, + clearChromeStorage() { + chrome.storage.local.clear(); }, }; diff --git a/src/app/features/collectibles/components/taproot-balance-displayer.tsx b/src/app/features/collectibles/components/taproot-balance-displayer.tsx index f42caa1882c..5ee6d482e0b 100644 --- a/src/app/features/collectibles/components/taproot-balance-displayer.tsx +++ b/src/app/features/collectibles/components/taproot-balance-displayer.tsx @@ -1,6 +1,7 @@ import { formatMoney } from '@app/common/money/format-money'; import { Tooltip } from '@app/components/tooltip'; import { useCurrentTaprootAccountBalance } from '@app/query/bitcoin/balance/btc-taproot-balance.hooks'; +import { useRecoverUninscribedTaprootUtxosFeatureEnabled } from '@app/query/common/remote-config/remote-config.query'; import { LeatherButton } from '@app/ui/components/button'; const taprootSpendNotSupportedYetMsg = ` @@ -13,6 +14,8 @@ interface TaprootBalanceDisplayerProps { } export function TaprootBalanceDisplayer({ onSelectRetrieveBalance }: TaprootBalanceDisplayerProps) { const balance = useCurrentTaprootAccountBalance(); + const isRecoverFeatureEnabled = useRecoverUninscribedTaprootUtxosFeatureEnabled(); + if (!isRecoverFeatureEnabled) return null; if (balance.amount.isLessThanOrEqualTo(0)) return null; return ( diff --git a/src/app/features/retrieve-taproot-to-native-segwit/retrieve-taproot-to-native-segwit.tsx b/src/app/features/retrieve-taproot-to-native-segwit/retrieve-taproot-to-native-segwit.tsx index 0b30c95d8c5..82b862cf530 100644 --- a/src/app/features/retrieve-taproot-to-native-segwit/retrieve-taproot-to-native-segwit.tsx +++ b/src/app/features/retrieve-taproot-to-native-segwit/retrieve-taproot-to-native-segwit.tsx @@ -66,9 +66,7 @@ export function RetrieveTaprootToNativeSegwit() { key={utxo.txid} title={`Uninscribed UTXO #${i}`} value={ - + {`${truncateMiddle(utxo.txid, 4)}:${utxo.vout}`} ↗ } diff --git a/src/app/query/bitcoin/address/utxos-by-address.query.ts b/src/app/query/bitcoin/address/utxos-by-address.query.ts index 61ac9a4da4d..d20f2d6577d 100644 --- a/src/app/query/bitcoin/address/utxos-by-address.query.ts +++ b/src/app/query/bitcoin/address/utxos-by-address.query.ts @@ -31,7 +31,7 @@ export function useGetUtxosByAddressQuery { - let currentNumberOfAddressesWithoutOrdinals = 0; + let currentNumberOfAddressesWithoutUtxos = 0; const addressIndexCounter = createCounter(0); let foundUnspentTransactions: TaprootUtxo[] = []; - while ( - currentNumberOfAddressesWithoutOrdinals < stopSearchAfterNumberAddressesWithoutOrdinals - ) { + while (currentNumberOfAddressesWithoutUtxos < stopSearchAfterNumberAddressesWithoutUtxos) { const address = getTaprootAddress({ index: addressIndexCounter.getValue(), keychain: account?.keychain, @@ -63,7 +61,7 @@ export function useTaprootAccountUtxosQuery() { const unspentTransactions = await client.addressApi.getUtxosByAddress(address); if (!hasInscriptions(unspentTransactions)) { - currentNumberOfAddressesWithoutOrdinals += 1; + currentNumberOfAddressesWithoutUtxos += 1; addressIndexCounter.increment(); continue; } @@ -77,7 +75,7 @@ export function useTaprootAccountUtxosQuery() { ...foundUnspentTransactions, ]; - currentNumberOfAddressesWithoutOrdinals = 0; + currentNumberOfAddressesWithoutUtxos = 0; addressIndexCounter.increment(); } return foundUnspentTransactions; diff --git a/src/app/query/bitcoin/balance/btc-taproot-balance.hooks.ts b/src/app/query/bitcoin/balance/btc-taproot-balance.hooks.ts index 9453ee5dde2..6210775f3ed 100644 --- a/src/app/query/bitcoin/balance/btc-taproot-balance.hooks.ts +++ b/src/app/query/bitcoin/balance/btc-taproot-balance.hooks.ts @@ -11,6 +11,7 @@ import { useGetInscriptionsInfiniteQuery } from '../ordinals/inscriptions.query' export function useCurrentTaprootAccountUninscribedUtxos() { const { data: utxos = [] } = useTaprootAccountUtxosQuery(); + const query = useGetInscriptionsInfiniteQuery(); return useMemo(() => { diff --git a/src/app/query/common/remote-config/remote-config.query.ts b/src/app/query/common/remote-config/remote-config.query.ts index f17993f0acb..48cac341073 100644 --- a/src/app/query/common/remote-config/remote-config.query.ts +++ b/src/app/query/common/remote-config/remote-config.query.ts @@ -128,6 +128,11 @@ export function useConfigBitcoinSendEnabled() { }); } +export function useRecoverUninscribedTaprootUtxosFeatureEnabled() { + const config = useRemoteConfig(); + return get(config, 'recoverUninscribedTaprootUtxosFeatureEnabled', false); +} + export function useConfigFeeEstimationsMaxEnabled() { const config = useRemoteConfig(); if (isUndefined(config) || isUndefined(config?.feeEstimationsMinMax)) return;