From 4d39d97d10a08468686900e7bc349aaa9961d08c Mon Sep 17 00:00:00 2001 From: friedger Date: Tue, 17 Oct 2023 13:13:19 +0200 Subject: [PATCH] fix: use network.chain.bitcoin.url in api hooks (#4330) --- src/app/store/common/api-clients.hooks.ts | 20 +++----------------- src/shared/constants.ts | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/app/store/common/api-clients.hooks.ts b/src/app/store/common/api-clients.hooks.ts index 4940fcde950..cb0dc96414a 100644 --- a/src/app/store/common/api-clients.hooks.ts +++ b/src/app/store/common/api-clients.hooks.ts @@ -2,15 +2,9 @@ import { useMemo } from 'react'; import { ChainID } from '@stacks/transactions'; -import { - BITCOIN_API_BASE_URL_MAINNET, - BITCOIN_API_BASE_URL_SIGNET, - BITCOIN_API_BASE_URL_TESTNET, - HIRO_API_BASE_URL_MAINNET, - HIRO_API_BASE_URL_TESTNET, -} from '@shared/constants'; +import { HIRO_API_BASE_URL_MAINNET, HIRO_API_BASE_URL_TESTNET } from '@shared/constants'; -import { whenBitcoinNetwork, whenStacksChainId } from '@app/common/utils'; +import { whenStacksChainId } from '@app/common/utils'; import { BitcoinClient } from '@app/query/bitcoin/bitcoin-client'; import { StacksClient } from '@app/query/stacks/stacks-client'; import { TokenMetadataClient } from '@app/query/stacks/token-metadata-client'; @@ -24,15 +18,7 @@ import { useCurrentNetworkState } from '../networks/networks.hooks'; export function useBitcoinClient() { const network = useCurrentNetworkState(); - - const baseUrl = whenBitcoinNetwork(network.chain.bitcoin.network)({ - mainnet: BITCOIN_API_BASE_URL_MAINNET, - testnet: BITCOIN_API_BASE_URL_TESTNET, - regtest: BITCOIN_API_BASE_URL_TESTNET, - signet: BITCOIN_API_BASE_URL_SIGNET, - }); - - return new BitcoinClient(baseUrl); + return new BitcoinClient(network.chain.bitcoin.url); } // Unanchored by default (microblocks) diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 320012157f9..86372f61577 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -150,7 +150,7 @@ const networkSbtcDevenv: NetworkConfiguration = { bitcoin: { blockchain: 'bitcoin', network: 'regtest', - url: 'http://localhost:8999/api', + url: 'http://localhost:3002', }, }, };