Skip to content

Commit

Permalink
feat: enable btc retrieval, closes #5067
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed May 14, 2024
1 parent 61b8171 commit 92d9603
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/wallet-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@
"mainnetApiUrl": "https://api2.ordinalsbot.com",
"signetApiUrl": "https://signet.ordinalsbot.com"
},
"recoverUninscribedTaprootUtxosFeatureEnabled": false,
"recoverUninscribedTaprootUtxosFeatureEnabled": true,
"runesEnabled": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function CollectiblesLayout({
}: CollectiblesLayoutProps) {
return (
<>
<Flex flexDirection="row" justifyContent="space-between" flex={1}>
<Flex flexDirection="row" justifyContent="space-between" alignItems="center" flex={1}>
<HStack columnGap="space.02">
<styled.span textStyle="label.01" paddingY="space.05">
{title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function RetrieveTaprootToNativeSegwitLayout(
As we don't support tranferring from Taproot addresses yet, you can retrieve funds to
your account's main Native SegWit balance here.
</styled.span>
<styled.span mt="space.04" textStyle="body.02">
<styled.span my="space.04" textStyle="body.02">
This transaction may take upwards of 30 minutes to confirm.
</styled.span>
{children}
Expand Down
12 changes: 8 additions & 4 deletions src/app/query/bitcoin/balance/btc-taproot-balance.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ import { useTaprootAccountUtxosQuery } from '../address/utxos-by-address.query';
import { UtxoWithDerivationPath } from '../bitcoin-client';
import { useGetInscriptionsInfiniteQuery } from '../ordinals/inscriptions.query';

const RETRIEVE_UTXO_DUST_AMOUNT = 10000;

export function useCurrentTaprootAccountUninscribedUtxos() {
const { data: utxos = [] } = useTaprootAccountUtxosQuery();

const query = useGetInscriptionsInfiniteQuery();

return useMemo(() => {
const inscriptions = query.data?.pages?.flatMap(page => page.inscriptions) ?? [];
return filterUtxosWithInscriptions(
inscriptions,
utxos.filter(utxo => utxo.status.confirmed)
) as UtxoWithDerivationPath[];

const filteredUtxosList = utxos
.filter(utxo => utxo.status.confirmed)
.filter(utxo => utxo.value > RETRIEVE_UTXO_DUST_AMOUNT);

return filterUtxosWithInscriptions(inscriptions, filteredUtxosList) as UtxoWithDerivationPath[];
}, [query.data?.pages, utxos]);
}

Expand Down

0 comments on commit 92d9603

Please sign in to comment.