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
| Name | Type | Default value | Description |
|---|---|---|---|
networkOrUrl | string | "mainnet" | The Bitcoin network (e.g., "mainnet," "testnet," "regtest") |
Returns
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:182
Properties
basePath
• Private basePath: string
Defined in
electrs.ts:164