Skip to content

Commit 0c5d34b

Browse files
authored
Merge pull request #4878 from leather-wallet/release/monday
Release/monday
2 parents d556f70 + 68c557f commit 0c5d34b

File tree

19 files changed

+149
-123
lines changed

19 files changed

+149
-123
lines changed

config/wallet-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"activeFiatProviders": {
77
"coinbase": {
8-
"availableRegions": "inside-usa-only",
8+
"availableRegions": "global",
99
"enabled": true,
1010
"hasFastCheckoutProcess": true,
1111
"hasTradingFees": true,

src/app/common/api/fetch-wrapper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { analytics } from '@shared/utils/analytics';
44

55
const leatherHeaders: HeadersInit = {
66
'x-leather-version': VERSION,
7+
'x-hiro-product': 'leather',
78
};
89

910
function isErrorCode(statusCode: number) {
@@ -30,6 +31,13 @@ export async function wrappedFetch(input: RequestInfo, init: RequestInit = {}) {
3031
return resp;
3132
}
3233

34+
axios.interceptors.request.use(request => {
35+
if (request.url?.includes('hiro.so'))
36+
Object.entries(leatherHeaders).forEach(([key, value]) => request.headers.set(key, value));
37+
38+
return request;
39+
});
40+
3341
axios.interceptors.response.use(response => {
3442
if (isErrorCode(response.status)) trackApiError(response.config.url ?? '', response.status);
3543
return response;
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
import { useMemo } from 'react';
22

3-
import BigNumber from 'bignumber.js';
4-
5-
import { createMoney } from '@shared/models/money.model';
6-
7-
import { baseCurrencyAmountInQuote, subtractMoney } from '@app/common/money/calculate-money';
3+
import { baseCurrencyAmountInQuote } from '@app/common/money/calculate-money';
84
import { i18nFormatCurrency } from '@app/common/money/format-money';
95
import { createBitcoinCryptoCurrencyAssetTypeWrapper } from '@app/query/bitcoin/address/address.utils';
10-
import { useBitcoinPendingTransactionsBalance } from '@app/query/bitcoin/address/transactions-by-address.hooks';
116
import { useNativeSegwitBalance } from '@app/query/bitcoin/balance/btc-native-segwit-balance.hooks';
127
import { useCryptoCurrencyMarketData } from '@app/query/common/market-data/market-data.hooks';
138

149
export function useBtcAssetBalance(btcAddress: string) {
1510
const btcMarketData = useCryptoCurrencyMarketData('BTC');
1611
const btcAssetBalance = useNativeSegwitBalance(btcAddress);
17-
const { data: pendingBalance } = useBitcoinPendingTransactionsBalance(btcAddress);
18-
const availableBalance = subtractMoney(
19-
btcAssetBalance.balance,
20-
pendingBalance ?? createMoney(new BigNumber(0), 'BTC')
21-
);
2212

2313
return useMemo(
2414
() => ({
@@ -27,11 +17,13 @@ export function useBtcAssetBalance(btcAddress: string) {
2717
btcUsdBalance: i18nFormatCurrency(
2818
baseCurrencyAmountInQuote(btcAssetBalance.balance, btcMarketData)
2919
),
30-
btcAvailableAssetBalance: createBitcoinCryptoCurrencyAssetTypeWrapper(availableBalance),
20+
btcAvailableAssetBalance: createBitcoinCryptoCurrencyAssetTypeWrapper(
21+
btcAssetBalance.balance
22+
),
3123
btcAvailableUsdBalance: i18nFormatCurrency(
32-
baseCurrencyAmountInQuote(availableBalance, btcMarketData)
24+
baseCurrencyAmountInQuote(btcAssetBalance.balance, btcMarketData)
3325
),
3426
}),
35-
[btcAddress, btcAssetBalance, btcMarketData, availableBalance]
27+
[btcAddress, btcAssetBalance, btcMarketData]
3628
);
3729
}

src/app/common/hooks/use-transferable-asset-balances.hooks.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ import { useMemo } from 'react';
22

33
import type { AllTransferableCryptoAssetBalances } from '@shared/models/crypto-asset-balance.model';
44

5-
import { useNativeSegwitBalance } from '@app/query/bitcoin/balance/btc-native-segwit-balance.hooks';
65
import { useTransferableStacksFungibleTokenAssetBalances } from '@app/query/stacks/balance/stacks-ft-balances.hooks';
76
import { createStacksCryptoCurrencyAssetTypeWrapper } from '@app/query/stacks/balance/stacks-ft-balances.utils';
8-
import { useCurrentAccountNativeSegwitAddressIndexZero } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
97
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
108

119
import { useStxBalance } from './balance/stx/use-stx-balance';
1210

1311
export function useAllTransferableCryptoAssetBalances(): AllTransferableCryptoAssetBalances[] {
1412
const account = useCurrentStacksAccount();
15-
const currentBtcAddress = useCurrentAccountNativeSegwitAddressIndexZero();
16-
const btcCryptoCurrencyAssetBalance = useNativeSegwitBalance(currentBtcAddress);
1713

1814
const { availableBalance: availableStxBalance } = useStxBalance();
1915
const stxCryptoCurrencyAssetBalance = createStacksCryptoCurrencyAssetTypeWrapper(
@@ -24,6 +20,6 @@ export function useAllTransferableCryptoAssetBalances(): AllTransferableCryptoAs
2420
);
2521

2622
return useMemo(() => {
27-
return [btcCryptoCurrencyAssetBalance, stxCryptoCurrencyAssetBalance, ...stacksFtAssetBalances];
28-
}, [btcCryptoCurrencyAssetBalance, stacksFtAssetBalances, stxCryptoCurrencyAssetBalance]);
23+
return [stxCryptoCurrencyAssetBalance, ...stacksFtAssetBalances];
24+
}, [stacksFtAssetBalances, stxCryptoCurrencyAssetBalance]);
2925
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { BitcoinCryptoCurrencyAssetBalance } from '@shared/models/crypto-asset-balance.model';
2+
3+
import { useNativeSegwitBalance } from '@app/query/bitcoin/balance/btc-native-segwit-balance.hooks';
4+
5+
interface BitcoinBalanceLoaderProps {
6+
address: string;
7+
children(balance: BitcoinCryptoCurrencyAssetBalance): React.ReactNode;
8+
}
9+
10+
export function BitcoinBalanceLoader({ address, children }: BitcoinBalanceLoaderProps) {
11+
const btcCryptoCurrencyAssetBalance = useNativeSegwitBalance(address);
12+
return children(btcCryptoCurrencyAssetBalance);
13+
}

src/app/components/bitcoin-custom-fee/hooks/use-bitcoin-custom-fee.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
determineUtxosForSpend,
99
determineUtxosForSpendAll,
1010
} from '@app/common/transactions/bitcoin/coinselect/local-coin-selection';
11-
import { useCurrentNativeSegwitAccountSpendableUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
11+
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
1212
import { useCurrentNativeSegwitAddressBalance } from '@app/query/bitcoin/balance/btc-native-segwit-balance.hooks';
1313
import { useCryptoCurrencyMarketData } from '@app/query/common/market-data/market-data.hooks';
1414

@@ -21,7 +21,7 @@ interface UseBitcoinCustomFeeArgs {
2121
}
2222
export function useBitcoinCustomFee({ amount, isSendingMax, recipient }: UseBitcoinCustomFeeArgs) {
2323
const balance = useCurrentNativeSegwitAddressBalance();
24-
const { data: utxos = [] } = useCurrentNativeSegwitAccountSpendableUtxos();
24+
const { data: utxos = [] } = useCurrentNativeSegwitUtxos();
2525
const btcMarketData = useCryptoCurrencyMarketData('BTC');
2626

2727
return useCallback(

src/app/components/crypto-assets/choose-crypto-asset/crypto-asset-list.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,39 @@ import type { AllTransferableCryptoAssetBalances } from '@shared/models/crypto-a
22
import { StacksFungibleTokenAsset } from '@shared/models/crypto-asset.model';
33

44
import { useWalletType } from '@app/common/use-wallet-type';
5+
import { BitcoinNativeSegwitAccountLoader } from '@app/components/account/bitcoin-account-loader';
6+
import { BitcoinBalanceLoader } from '@app/components/balance/bitcoin-balance-loader';
7+
import { Brc20TokensLoader } from '@app/components/brc20-tokens-loader';
58
import { Brc20TokenAssetList } from '@app/components/crypto-assets/bitcoin/brc20-token-asset-list/brc20-token-asset-list';
6-
import { Brc20Token } from '@app/query/bitcoin/ordinals/brc20/brc20-tokens.query';
9+
import { BtcIcon } from '@app/ui/components/icons/btc-icon';
710

11+
import { CryptoCurrencyAssetItem } from '../crypto-currency-asset/crypto-currency-asset-item';
812
import { CryptoAssetListItem } from './crypto-asset-list-item';
913
import { CryptoAssetListLayout } from './crypto-asset-list.layout';
1014

1115
interface CryptoAssetListProps {
1216
cryptoAssetBalances: AllTransferableCryptoAssetBalances[];
1317
onItemClick(cryptoAssetBalance: AllTransferableCryptoAssetBalances): void;
14-
brc20Tokens?: Brc20Token[];
1518
}
16-
export function CryptoAssetList({
17-
cryptoAssetBalances,
18-
onItemClick,
19-
brc20Tokens,
20-
}: CryptoAssetListProps) {
19+
export function CryptoAssetList({ cryptoAssetBalances, onItemClick }: CryptoAssetListProps) {
2120
const { whenWallet } = useWalletType();
2221

2322
return (
2423
<CryptoAssetListLayout>
24+
<BitcoinNativeSegwitAccountLoader current>
25+
{signer => (
26+
<BitcoinBalanceLoader address={signer.address}>
27+
{balance => (
28+
<CryptoCurrencyAssetItem
29+
assetBalance={balance}
30+
icon={<BtcIcon />}
31+
onClick={() => onItemClick(balance)}
32+
isPressable
33+
/>
34+
)}
35+
</BitcoinBalanceLoader>
36+
)}
37+
</BitcoinNativeSegwitAccountLoader>
2538
{cryptoAssetBalances.map(cryptoAssetBalance => (
2639
<CryptoAssetListItem
2740
onClick={() => onItemClick(cryptoAssetBalance)}
@@ -32,12 +45,18 @@ export function CryptoAssetList({
3245
}
3346
/>
3447
))}
35-
{brc20Tokens
36-
? whenWallet({
37-
software: <Brc20TokenAssetList brc20Tokens={brc20Tokens} />,
38-
ledger: null,
39-
})
40-
: null}
48+
{whenWallet({
49+
software: (
50+
<BitcoinNativeSegwitAccountLoader current>
51+
{() => (
52+
<Brc20TokensLoader>
53+
{brc20Tokens => <Brc20TokenAssetList brc20Tokens={brc20Tokens} />}
54+
</Brc20TokensLoader>
55+
)}
56+
</BitcoinNativeSegwitAccountLoader>
57+
),
58+
ledger: null,
59+
})}
4160
</CryptoAssetListLayout>
4261
);
4362
}

src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { AllTransferableCryptoAssetBalances } from '@shared/models/crypto-asset-
55
import { RouteUrls } from '@shared/route-urls';
66
import { isDefined } from '@shared/utils';
77

8-
import { useBtcCryptoCurrencyAssetBalance } from '@app/common/hooks/balance/btc/use-btc-crypto-currency-asset-balance';
98
import { useStxCryptoCurrencyAssetBalance } from '@app/common/hooks/balance/stx/use-stx-crypto-currency-asset-balance';
109
import { useRouteHeader } from '@app/common/hooks/use-route-header';
1110
import { useWalletType } from '@app/common/use-wallet-type';
@@ -16,28 +15,22 @@ import { ModalHeader } from '@app/components/modal-header';
1615
import { useCheckLedgerBlockchainAvailable } from '@app/store/accounts/blockchain/utils';
1716

1817
export function ChooseCryptoAssetToFund() {
19-
const btcCryptoCurrencyAssetBalance = useBtcCryptoCurrencyAssetBalance();
2018
const stxCryptoCurrencyAssetBalance = useStxCryptoCurrencyAssetBalance();
2119

22-
const cryptoCurrencyAssetBalances = useMemo(
23-
() => [btcCryptoCurrencyAssetBalance, stxCryptoCurrencyAssetBalance],
24-
[btcCryptoCurrencyAssetBalance, stxCryptoCurrencyAssetBalance]
25-
);
26-
2720
const { whenWallet } = useWalletType();
2821
const navigate = useNavigate();
2922

3023
const checkBlockchainAvailable = useCheckLedgerBlockchainAvailable();
3124

3225
const filteredCryptoAssetBalances = useMemo(
3326
() =>
34-
cryptoCurrencyAssetBalances.filter(isDefined).filter(assetBalance =>
27+
[stxCryptoCurrencyAssetBalance].filter(isDefined).filter(assetBalance =>
3528
whenWallet({
3629
ledger: checkBlockchainAvailable(assetBalance?.blockchain),
3730
software: true,
3831
})
3932
),
40-
[cryptoCurrencyAssetBalances, checkBlockchainAvailable, whenWallet]
33+
[stxCryptoCurrencyAssetBalance, checkBlockchainAvailable, whenWallet]
4134
);
4235

4336
useRouteHeader(<ModalHeader hideActions onGoBack={() => navigate(RouteUrls.Home)} title=" " />);

src/app/pages/rpc-send-transfer/use-rpc-send-transfer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { RouteUrls } from '@shared/route-urls';
66
import { useDefaultRequestParams } from '@app/common/hooks/use-default-request-search-params';
77
import { useOnMount } from '@app/common/hooks/use-on-mount';
88
import { initialSearchParams } from '@app/common/initial-search-params';
9-
import { useCurrentNativeSegwitAccountSpendableUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
9+
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
1010

1111
export function useRpcSendTransferRequestParams() {
1212
const defaultParams = useDefaultRequestParams();
@@ -24,7 +24,7 @@ export function useRpcSendTransferRequestParams() {
2424
export function useRpcSendTransfer() {
2525
const navigate = useNavigate();
2626
const { address, amount, origin } = useRpcSendTransferRequestParams();
27-
const { data: utxos = [], refetch } = useCurrentNativeSegwitAccountSpendableUtxos();
27+
const { data: utxos = [], refetch } = useCurrentNativeSegwitUtxos();
2828

2929
// Forcing a refetch to ensure UTXOs are fresh
3030
useOnMount(() => refetch());

src/app/pages/send/choose-crypto-asset/choose-crypto-asset.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useNavigate } from 'react-router-dom';
44
import { AllTransferableCryptoAssetBalances } from '@shared/models/crypto-asset-balance.model';
55
import { RouteUrls } from '@shared/route-urls';
66

7-
import { useBrc20Tokens } from '@app/common/hooks/use-brc20-tokens';
87
import { useRouteHeader } from '@app/common/hooks/use-route-header';
98
import { useAllTransferableCryptoAssetBalances } from '@app/common/hooks/use-transferable-asset-balances.hooks';
109
import { useWalletType } from '@app/common/use-wallet-type';
@@ -16,7 +15,6 @@ import { useCheckLedgerBlockchainAvailable } from '@app/store/accounts/blockchai
1615

1716
export function ChooseCryptoAsset() {
1817
const allTransferableCryptoAssetBalances = useAllTransferableCryptoAssetBalances();
19-
const brc20Tokens = useBrc20Tokens();
2018

2119
const { whenWallet } = useWalletType();
2220
const navigate = useNavigate();
@@ -49,7 +47,6 @@ export function ChooseCryptoAsset() {
4947
<ChooseCryptoAssetLayout title="choose asset to send">
5048
<CryptoAssetList
5149
onItemClick={cryptoAssetBalance => navigateToSendForm(cryptoAssetBalance)}
52-
brc20Tokens={brc20Tokens}
5350
cryptoAssetBalances={allTransferableCryptoAssetBalances.filter(asset =>
5451
whenWallet({
5552
ledger: checkBlockchainAvailable(asset.blockchain),

src/app/pages/send/ordinal-inscription/hooks/use-generate-ordinal-tx.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { OrdinalSendFormValues } from '@shared/models/form.model';
88

99
import { determineUtxosForSpend } from '@app/common/transactions/bitcoin/coinselect/local-coin-selection';
1010
import { createCounter } from '@app/common/utils/counter';
11-
import { useCurrentNativeSegwitAccountSpendableUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
11+
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
1212
import { UtxoWithDerivationPath } from '@app/query/bitcoin/bitcoin-client';
1313
import { useBitcoinScureLibNetworkConfig } from '@app/store/accounts/blockchain/bitcoin/bitcoin-keychain';
1414
import { useCurrentAccountNativeSegwitSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
@@ -20,7 +20,7 @@ export function useGenerateUnsignedOrdinalTx(inscriptionInput: UtxoWithDerivatio
2020
const createTaprootSigner = useCurrentAccountTaprootSigner();
2121
const createNativeSegwitSigner = useCurrentAccountNativeSegwitSigner();
2222
const networkMode = useBitcoinScureLibNetworkConfig();
23-
const { data: nativeSegwitUtxos } = useCurrentNativeSegwitAccountSpendableUtxos();
23+
const { data: nativeSegwitUtxos } = useCurrentNativeSegwitUtxos();
2424

2525
function coverFeeFromAdditionalUtxos(values: OrdinalSendFormValues) {
2626
if (getAddressInfo(values.inscription.address).type === AddressType.p2wpkh) {

src/app/pages/send/send-crypto-asset-form/form/brc-20/use-brc20-send-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import { tokenAmountValidator } from '@app/common/validation/forms/amount-validators';
2121
import { currencyAmountValidator } from '@app/common/validation/forms/currency-validators';
2222
import { useUpdatePersistedSendFormValues } from '@app/features/popup-send-form-restoration/use-update-persisted-send-form-values';
23-
import { useCurrentNativeSegwitAccountSpendableUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
23+
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
2424
import { useCurrentAccountNativeSegwitIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
2525
import { useCurrentNetwork } from '@app/store/networks/networks.selectors';
2626

@@ -44,7 +44,7 @@ export function useBrc20SendForm({ balance, tick, decimals }: UseBrc20SendFormAr
4444
const navigate = useNavigate();
4545
const currentNetwork = useCurrentNetwork();
4646
const nativeSegwitSigner = useCurrentAccountNativeSegwitIndexZeroSigner();
47-
const { data: utxos = [], refetch } = useCurrentNativeSegwitAccountSpendableUtxos();
47+
const { data: utxos = [], refetch } = useCurrentNativeSegwitUtxos();
4848

4949
// Forcing a refetch to ensure UTXOs are fresh
5050
useOnMount(() => refetch());

src/app/pages/send/send-crypto-asset-form/form/btc/use-btc-send-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
currencyAmountValidator,
2222
} from '@app/common/validation/forms/currency-validators';
2323
import { useUpdatePersistedSendFormValues } from '@app/features/popup-send-form-restoration/use-update-persisted-send-form-values';
24-
import { useCurrentNativeSegwitAccountSpendableUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
24+
import { useCurrentNativeSegwitUtxos } from '@app/query/bitcoin/address/utxos-by-address.hooks';
2525
import { useNativeSegwitBalance } from '@app/query/bitcoin/balance/btc-native-segwit-balance.hooks';
2626
import { useCurrentAccountNativeSegwitIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
2727
import { useCurrentNetwork } from '@app/store/networks/networks.selectors';
@@ -34,7 +34,7 @@ export function useBtcSendForm() {
3434
const formRef = useRef<FormikProps<BitcoinSendFormValues>>(null);
3535
const currentNetwork = useCurrentNetwork();
3636
const nativeSegwitSigner = useCurrentAccountNativeSegwitIndexZeroSigner();
37-
const { data: utxos = [], refetch } = useCurrentNativeSegwitAccountSpendableUtxos();
37+
const { data: utxos = [], refetch } = useCurrentNativeSegwitUtxos();
3838
const btcCryptoCurrencyAssetBalance = useNativeSegwitBalance(nativeSegwitSigner.address);
3939
const sendFormNavigate = useSendFormNavigate();
4040
const calcMaxSpend = useCalculateMaxBitcoinSpend();

src/app/query/bitcoin/address/transactions-by-address.hooks.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { useCallback } from 'react';
22

3-
import { createMoney } from '@shared/models/money.model';
43
import { BitcoinTx } from '@shared/models/transactions/bitcoin-transaction.model';
54

65
import { sumNumbers } from '@app/common/math/helpers';
76

8-
import { UtxoResponseItem } from '../bitcoin-client';
97
import {
108
useGetBitcoinTransactionsByAddressQuery,
119
useGetBitcoinTransactionsByAddressesQuery,
1210
} from './transactions-by-address.query';
13-
import { useAllSpendableUtxosByAddress } from './utxos-by-address.hooks';
1411

1512
function useFilterAddressPendingTransactions() {
1613
return useCallback((txs: BitcoinTx[]) => {
@@ -53,32 +50,3 @@ export function calculateOutboundPendingTxsValue(pendingTxs: BitcoinTx[], addres
5350

5451
return sumInputs.minus(sumOutputs).toNumber();
5552
}
56-
57-
// filter out pending txs that have inputs that are not in the utxos list to prevent double extraction
58-
function filterMissingUtxosPendingTxs(
59-
pendingTxs: BitcoinTx[],
60-
utxos: UtxoResponseItem[],
61-
address: string
62-
) {
63-
return pendingTxs.filter(tx => {
64-
return tx.vin.every(input => {
65-
return (
66-
utxos.some(utxo => utxo.txid === input.txid) &&
67-
address === input.prevout.scriptpubkey_address
68-
);
69-
});
70-
});
71-
}
72-
73-
export function useBitcoinPendingTransactionsBalance(address: string) {
74-
const filterPendingTransactions = useFilterAddressPendingTransactions();
75-
const { data: utxos } = useAllSpendableUtxosByAddress(address);
76-
77-
return useGetBitcoinTransactionsByAddressQuery(address, {
78-
select(txs) {
79-
const pendingTxs = filterPendingTransactions(txs);
80-
const filteredTxs = filterMissingUtxosPendingTxs(pendingTxs, utxos || [], address);
81-
return createMoney(calculateOutboundPendingTxsValue(filteredTxs, address), 'BTC');
82-
},
83-
});
84-
}

0 commit comments

Comments
 (0)