EsploraClient
Defined in: wallet-btc/src/esplora.ts:19
Esplora REST transport — the API served by mempool.space (https://mempool.space/api)
and Blockstream (https://blockstream.info/api). Public instances exist, so it is
the natural fallback behind a self-hosted Blockbook.
Balance semantics: unconfirmedOutgoing is the mempool net outflow
(spent − funded, clamped at 0), a conservative stand-in for Bitcoin Core’s
trusted-change rule that Blockbook’s richer address record allows.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EsploraClient(
config,fetchFn?,timeoutMs?):EsploraClient
Defined in: wallet-btc/src/esplora.ts:24
Parameters
Section titled “Parameters”config
Section titled “config”string
fetchFn?
Section titled “fetchFn?”{(input, init?): Promise<Response>; (input, init?): Promise<Response>; }
timeoutMs?
Section titled “timeoutMs?”number = DEFAULT_TIMEOUT_MS
Returns
Section titled “Returns”EsploraClient
Methods
Section titled “Methods”broadcast()
Section titled “broadcast()”broadcast(
rawTx):Promise<string>
Defined in: wallet-btc/src/esplora.ts:108
Broadcast raw hex; returns the txid.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”close()
Section titled “close()”close():
Promise<void>
Defined in: wallet-btc/src/esplora.ts:32
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”connect()
Section titled “connect()”connect():
Promise<void>
Defined in: wallet-btc/src/esplora.ts:31
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”estimateFee()
Section titled “estimateFee()”estimateFee(
blocks):Promise<number>
Defined in: wallet-btc/src/esplora.ts:115
/fee-estimates → { “1”: sat/vB, “2”: …, “25”: …, “144”: … }; picks the nearest target ≥ blocks.
Parameters
Section titled “Parameters”blocks
Section titled “blocks”number
Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”getBalance()
Section titled “getBalance()”getBalance(
address):Promise<{confirmed:bigint;unconfirmed:bigint;unconfirmedOutgoing:bigint; }>
Defined in: wallet-btc/src/esplora.ts:58
Parameters
Section titled “Parameters”address
Section titled “address”string
Returns
Section titled “Returns”Promise<{ confirmed: bigint; unconfirmed: bigint; unconfirmedOutgoing: bigint; }>
Implementation of
Section titled “Implementation of”getBlockHeight()
Section titled “getBlockHeight()”getBlockHeight():
Promise<number>
Defined in: wallet-btc/src/esplora.ts:124
Current chain tip height (anti-fee-sniping locktime). Optional.
Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”getHistory()
Section titled “getHistory()”getHistory(
address):Promise<object[]>
Defined in: wallet-btc/src/esplora.ts:74
Esplora pages 25 (mempool.space: up to 50) txs per call; walk /txs/chain/<last> until a short page.
Parameters
Section titled “Parameters”address
Section titled “address”string
Returns
Section titled “Returns”Promise<object[]>
Implementation of
Section titled “Implementation of”getTransaction()
Section titled “getTransaction()”getTransaction(
txid):Promise<string>
Defined in: wallet-btc/src/esplora.ts:102
Raw transaction hex.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”getTransactionInfo()
Section titled “getTransactionInfo()”getTransactionInfo(
txid):Promise<BlockbookTx|undefined>
Defined in: wallet-btc/src/esplora.ts:89
Full tx record (used for receipts).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<BlockbookTx | undefined>
Implementation of
Section titled “Implementation of”listUnspent()
Section titled “listUnspent()”listUnspent(
address):Promise<Utxo[]>
Defined in: wallet-btc/src/esplora.ts:67
Parameters
Section titled “Parameters”address
Section titled “address”string
Returns
Section titled “Returns”Promise<Utxo[]>