Skip to main content

Class: DefaultElectrsClient

electrs.DefaultElectrsClient

The DefaultElectrsClient class provides a client for interacting with an Esplora API for Bitcoin network data retrieval.

Implements

Constructors

constructor

new DefaultElectrsClient(networkOrUrl?)

Create an instance of the DefaultElectrsClient with the specified network or URL. If the networkOrUrl parameter is omitted, it defaults to "mainnet."

Parameters

NameTypeDefault valueDescription
networkOrUrlstring"mainnet"The Bitcoin network (e.g., "mainnet," "testnet," "regtest")

Example

const BITCOIN_NETWORK = "regtest";
const electrsClient = new DefaultElectrsClient(BITCOIN_NETWORK);

Example

// Create a client for the mainnet using the default URL.
const electrsClientMainnet = new DefaultElectrsClient();

Defined in

electrs.ts:151

Properties

basePath

Private basePath: string

Defined in

electrs.ts:133