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?): DefaultElectrsClient

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")

Returns

DefaultElectrsClient

An instance of the DefaultElectrsClient configured for the specified network or URL.

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:165

Properties

basePath

Private basePath: string

Defined in

electrs.ts:147