diff --git a/src/block_explorer.test.ts b/src/block_explorer.test.ts index 9728986..2e5610b 100644 --- a/src/block_explorer.test.ts +++ b/src/block_explorer.test.ts @@ -10,7 +10,7 @@ describe("block_explorer", () => { describe("blockExplorerURL", () => { it("should properly return the base mainnet block explorer url for empty path", () => { expect(blockExplorerURL("", Network.MAINNET)).toBe( - "https://blockstream.info" + "https://mempool.space" ); }); @@ -18,13 +18,13 @@ describe("block_explorer", () => { const path = "/block/00000000000000000011341d69792271766e4683e29b3ea169eacc59bde10a57"; expect(blockExplorerURL(path, Network.MAINNET)).toBe( - `https://blockstream.info${path}` + `https://mempool.space${path}` ); }); it("should properly return the base testnet block explorer url for empty path", () => { expect(blockExplorerURL("", Network.TESTNET)).toBe( - "https://blockstream.info/testnet" + "https://mempool.space/testnet" ); }); @@ -32,7 +32,7 @@ describe("block_explorer", () => { const path = "/tx/4f0ef69f88829bd2f6b7793e32dd8bfcfbc87ddb9a2de3d8ef3f2aabbaff0be3"; expect(blockExplorerURL(path, Network.TESTNET)).toBe( - `https://blockstream.info/testnet${path}` + `https://mempool.space/testnet${path}` ); }); }); @@ -42,7 +42,7 @@ describe("block_explorer", () => { const path = "/tx/1814a10fb22e9551a17a94a1e68971e19b4f59eaf1689e0af85b97929b3b9ae0"; expect(blockExplorerAPIURL(path, Network.MAINNET)).toBe( - `https://blockstream.info/api${path}` + `https://mempool.space/api${path}` ); }); @@ -50,7 +50,7 @@ describe("block_explorer", () => { const path = "/tx/4f0ef69f88829bd2f6b7793e32dd8bfcfbc87ddb9a2de3d8ef3f2aabbaff0be3"; expect(blockExplorerAPIURL(path, Network.TESTNET)).toBe( - `https://blockstream.info/testnet/api${path}` + `https://mempool.space/testnet/api${path}` ); }); }); @@ -60,7 +60,7 @@ describe("block_explorer", () => { const path = "1814a10fb22e9551a17a94a1e68971e19b4f59eaf1689e0af85b97929b3b9ae0"; expect(blockExplorerTransactionURL(path, Network.MAINNET)).toBe( - `https://blockstream.info/tx/${path}` + `https://mempool.space/tx/${path}` ); }); @@ -68,7 +68,7 @@ describe("block_explorer", () => { const path = "4f0ef69f88829bd2f6b7793e32dd8bfcfbc87ddb9a2de3d8ef3f2aabbaff0be3"; expect(blockExplorerTransactionURL(path, Network.TESTNET)).toBe( - `https://blockstream.info/testnet/tx/${path}` + `https://mempool.space/testnet/tx/${path}` ); }); }); @@ -77,14 +77,14 @@ describe("block_explorer", () => { it("should properly return the mainnet block explorer address url for a given path", () => { const path = "39YqNoLULDpbjmeCTdGJ42DQhrQLzRcMdX"; expect(blockExplorerAddressURL(path, Network.MAINNET)).toBe( - `https://blockstream.info/address/${path}` + `https://mempool.space/address/${path}` ); }); it("should properly return the testnet block explorer address url for a given path", () => { const path = "2N16oE62ZjAPup985dFBQYAuy5zpDraH7Hk"; expect(blockExplorerAddressURL(path, Network.TESTNET)).toBe( - `https://blockstream.info/testnet/address/${path}` + `https://mempool.space/testnet/address/${path}` ); }); }); diff --git a/src/block_explorer.ts b/src/block_explorer.ts index 96a063e..ae80037 100644 --- a/src/block_explorer.ts +++ b/src/block_explorer.ts @@ -1,6 +1,6 @@ /** * This module provides functions for creating URLs for Blockstream's - * [block explorer]{@link https://blockstream.info}. + * [block explorer]{@link https://mempool.space}. * * This module does NOT provide implementations of HTTP requests which * fetch data from these URLs. @@ -8,8 +8,8 @@ import { Network } from "./networks"; -const BASE_URL_MAINNET = "https://blockstream.info"; -const BASE_URL_TESTNET = "https://blockstream.info/testnet"; +const BASE_URL_MAINNET = "https://mempool.space"; +const BASE_URL_TESTNET = "https://mempool.space/testnet"; function blockExplorerBaseURL(network: Network) { return network === Network.TESTNET ? BASE_URL_TESTNET : BASE_URL_MAINNET;