diff --git a/src/app/query/bitcoin/bitcoin-client.ts b/src/app/query/bitcoin/bitcoin-client.ts index aee6896925b..dc729f086f5 100644 --- a/src/app/query/bitcoin/bitcoin-client.ts +++ b/src/app/query/bitcoin/bitcoin-client.ts @@ -172,6 +172,7 @@ interface RunesOutputsByAddressArgs { order?: 'asc' | 'desc'; offset?: number; count?: number; + signal?: AbortSignal; } interface RunesOutputsByAddressResponse { @@ -272,6 +273,7 @@ class BestinSlotApi { order = 'asc', offset = 0, count = 100, + signal, }: RunesOutputsByAddressArgs) { const baseUrl = network === 'mainnet' ? this.url : this.testnetUrl; const queryParams = new URLSearchParams({ @@ -284,7 +286,7 @@ class BestinSlotApi { const resp = await axios.get( `${baseUrl}/runes/wallet_valid_outputs?${queryParams}`, - { ...this.defaultOptions } + { ...this.defaultOptions, signal } ); return resp.data.data; } @@ -298,7 +300,10 @@ class AddressApi { async getTransactionsByAddress(address: string, signal?: AbortSignal) { const resp = await this.rateLimiter.add( - () => axios.get(`${this.configuration.baseUrl}/address/${address}/txs`), + () => + axios.get(`${this.configuration.baseUrl}/address/${address}/txs`, { + signal, + }), { signal, throwOnTimeout: true } ); return resp.data; @@ -306,7 +311,10 @@ class AddressApi { async getUtxosByAddress(address: string, signal?: AbortSignal): Promise { const resp = await this.rateLimiter.add( - () => axios.get(`${this.configuration.baseUrl}/address/${address}/utxo`), + () => + axios.get(`${this.configuration.baseUrl}/address/${address}/utxo`, { + signal, + }), { signal, priority: 1, throwOnTimeout: true } ); return resp.data.sort((a, b) => a.vout - b.vout); diff --git a/src/app/query/bitcoin/runes/runes-outputs-by-address.query.ts b/src/app/query/bitcoin/runes/runes-outputs-by-address.query.ts index a38fa9425bc..4290192b97c 100644 --- a/src/app/query/bitcoin/runes/runes-outputs-by-address.query.ts +++ b/src/app/query/bitcoin/runes/runes-outputs-by-address.query.ts @@ -20,10 +20,11 @@ export function useGetRunesOutputsByAddressQuery + queryFn: ({ signal }) => client.bestinSlotApi.getRunesOutputsByAddress({ address, network: network.chain.bitcoin.bitcoinNetwork, + signal, }), ...queryOptions, ...options,