From 8b90d60b012dc324a911f4cba8b70297d7b8e24f Mon Sep 17 00:00:00 2001 From: Polybius93 <99192647+Polybius93@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:39:36 +0100 Subject: [PATCH] feat: updated endpoints (#53) --- .env template | 20 ++++++++++++++++++++ src/app/hooks/use-endpoints.ts | 14 ++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 .env template diff --git a/.env template b/.env template new file mode 100644 index 00000000..ce6eff6f --- /dev/null +++ b/.env template @@ -0,0 +1,20 @@ +# VITE_ATTESTOR_API_URLS_EXAMPLE: https://example/attestor-1,https://example/attestor-2,https://example/attestor-3 + +# Regtest + +VITE_ETHEREUM_DEPLOYMENT_BRANCH=dev +VITE_ETHEREUM_DEPLOYMENT_VERSION=1 +VITE_ENABLED_ETHEREUM_NETWORKS='11155111' +VITE_ATTESTOR_API_URLS= +VITE_BITCOIN_NETWORK=regtest +VITE_BITCOIN_EXPLORER_API_URL=https://devnet.dlc.link/electrs/tx/ +VITE_BITCOIN_BLOCKCHAIN_API_URL=https://devnet.dlc.link/electrs + +# # Testnet +# VITE_ETHEREUM_DEPLOYMENT_BRANCH=dev +# VITE_ETHEREUM_DEPLOYMENT_VERSION=1 +# VITE_ENABLED_ETHEREUM_NETWORKS='11155111' +# VITE_ATTESTOR_API_URLS= +# VITE_BITCOIN_NETWORK=testnet +# VITE_BITCOIN_EXPLORER_API_URL=https://mempool.space/testnet/tx/ +# VITE_BITCOIN_BLOCKCHAIN_API_URL=https://testnet.dlc.link/electrs diff --git a/src/app/hooks/use-endpoints.ts b/src/app/hooks/use-endpoints.ts index d587010f..09adf257 100644 --- a/src/app/hooks/use-endpoints.ts +++ b/src/app/hooks/use-endpoints.ts @@ -43,6 +43,8 @@ export function useEndpoints(): NetworkEndpoints { const attestorAPIURLs: string[] = import.meta.env.VITE_ATTESTOR_API_URLS.split(','); const bitcoinNetworkName = import.meta.env.VITE_BITCOIN_NETWORK; + const bitcoinBlockchainAPIURL = import.meta.env.VITE_BITCOIN_BLOCKCHAIN_API_URL; + const bitcoinExplorerAPIURL = import.meta.env.VITE_BITCOIN_EXPLORER_API_URL; let bitcoinNetwork; switch (bitcoinNetworkName) { @@ -61,24 +63,24 @@ export function useEndpoints(): NetworkEndpoints { return { attestorAPIURLs, ethereumExplorerAPIURL: 'https://sepolia.etherscan.io/tx/', - bitcoinExplorerAPIURL: 'http://devnet.dlc.link/electrs/tx/', - bitcoinBlockchainAPIURL: 'https://devnet.dlc.link/electrs', + bitcoinExplorerAPIURL, + bitcoinBlockchainAPIURL, bitcoinNetwork, }; case EthereumNetwork.Goerli: return { attestorAPIURLs, ethereumExplorerAPIURL: 'https://goerli.etherscan.io/tx/', - bitcoinExplorerAPIURL: 'https://blockstream.info/testnet/tx/', - bitcoinBlockchainAPIURL: 'https://devnet.dlc.link/electrs', + bitcoinExplorerAPIURL, + bitcoinBlockchainAPIURL, bitcoinNetwork, }; case EthereumNetwork.X1Testnet: return { attestorAPIURLs, ethereumExplorerAPIURL: 'https://www.oklink.com/x1-test/tx/', - bitcoinExplorerAPIURL: 'http://devnet.dlc.link/electrs/tx/', - bitcoinBlockchainAPIURL: 'https://devnet.dlc.link/electrs', + bitcoinExplorerAPIURL, + bitcoinBlockchainAPIURL, bitcoinNetwork, }; default: