Interface ElectrumClientInterface
-
- All Implemented Interfaces:
public interface ElectrumClientInterface
Wrapper around an electrum_client::ElectrumApi which includes an internal in-memory transaction cache to avoid re-fetching already downloaded transactions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
ElectrumClientInterface.Companion
-
Method Summary
Modifier and Type Method Description abstract HeaderNotification
blockHeadersSubscribe()
Subscribes to notifications for new block headers, by sending a blockchain.headers.subscribe call. abstract Double
estimateFee(ULong number)
Estimates the fee required in bitcoin per kilobyte to confirm a transaction in number
blocks.abstract Update
fullScan(FullScanRequest request, ULong stopGap, ULong batchSize, Boolean fetchPrevTxouts)
Full scan the keychain scripts specified with the blockchain (via an Electrum client) and returns updates for bdk_chain data structures. abstract Unit
ping()
Pings the server. abstract ServerFeaturesRes
serverFeatures()
Returns the capabilities of the server. abstract Update
sync(SyncRequest request, ULong batchSize, Boolean fetchPrevTxouts)
Sync a set of scripts with the blockchain (via an Electrum client) for the data specified and returns updates for bdk_chain data structures. abstract String
transactionBroadcast(Transaction tx)
Broadcasts a transaction to the network.
-
-
-
Method Detail
-
blockHeadersSubscribe
abstract HeaderNotification blockHeadersSubscribe()
Subscribes to notifications for new block headers, by sending a blockchain.headers.subscribe call.
-
estimateFee
abstract Double estimateFee(ULong number)
Estimates the fee required in bitcoin per kilobyte to confirm a transaction in
number
blocks.
-
fullScan
abstract Update fullScan(FullScanRequest request, ULong stopGap, ULong batchSize, Boolean fetchPrevTxouts)
Full scan the keychain scripts specified with the blockchain (via an Electrum client) and returns updates for bdk_chain data structures.
request
: struct with data required to perform a spk-based blockchain client full scan, seeFullScanRequest
.stop_gap
: the full scan for each keychain stops after a gap of script pubkeys with no associated transactions.batch_size
: specifies the max number of script pubkeys to request for in a single batch request.fetch_prev_txouts
: specifies whether we want previousTxOuts
for fee calculation. Note that this requires additional calls to the Electrum server, but is necessary for calculating the fee on a transaction if your wallet does not own the inputs. Methods likeWallet.calculate_fee
andWallet.calculate_fee_rate
will return aCalculateFeeError::MissingTxOut
error if those TxOuts are not present in the transaction graph.
-
serverFeatures
abstract ServerFeaturesRes serverFeatures()
Returns the capabilities of the server.
-
sync
abstract Update sync(SyncRequest request, ULong batchSize, Boolean fetchPrevTxouts)
Sync a set of scripts with the blockchain (via an Electrum client) for the data specified and returns updates for bdk_chain data structures.
request
: struct with data required to perform a spk-based blockchain client sync, seeSyncRequest
.batch_size
: specifies the max number of script pubkeys to request for in a single batch request.fetch_prev_txouts
: specifies whether we want previousTxOuts
for fee calculation. Note that this requires additional calls to the Electrum server, but is necessary for calculating the fee on a transaction if your wallet does not own the inputs. Methods likeWallet.calculate_fee
andWallet.calculate_fee_rate
will return aCalculateFeeError::MissingTxOut
error if those TxOuts are not present in the transaction graph.
If the scripts to sync are unknown, such as when restoring or importing a keychain that may include scripts that have been used, use full_scan with the keychain.
-
transactionBroadcast
abstract String transactionBroadcast(Transaction tx)
Broadcasts a transaction to the network.
-
-