Class LightClientBuilder
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
,org.bitcoindevkit.Disposable
,org.bitcoindevkit.LightClientBuilderInterface
public class LightClientBuilder implements Disposable, AutoCloseable, LightClientBuilderInterface
Build a BIP 157/158 light client to fetch transactions for a
Wallet
.Options:
List of
Peer
: Bitcoin full-nodes for the light client to connect to. May be empty.connections
: The number of connections for the light client to maintain.scan_type
: Sync, recover, or start a new wallet. For more information see `ScanType`.data_dir
: Optional directory to store block headers and peers.
A note on recovering wallets. Developers should allow users to provide an approximate recovery height and an estimated number of transactions for the wallet. When determining how many scripts to check filters for, the
Wallet
lookahead
value will be used. To ensure all transactions are recovered, thelookahead
should be roughly the number of transactions in the wallet history.
-
-
Constructor Summary
Constructors Constructor Description LightClientBuilder(Pointer pointer)
LightClientBuilder(NoPointer noPointer)
This constructor can be used to instantiate a fake object. LightClientBuilder()
Start a new `LightClientBuilder`
-
Method Summary
Modifier and Type Method Description Unit
destroy()
Unit
close()
final Pointer
uniffiClonePointer()
LightClient
build(Wallet wallet)
Construct a `LightClient` for a `Wallet`. LightClientBuilder
connections(UByte connections)
The number of connections for the light client to maintain. LightClientBuilder
dataDir(String dataDir)
Directory to store block headers and peers. LightClientBuilder
peers(List<Peer> peers)
Bitcoin full-nodes to attempt a connection with. LightClientBuilder
scanType(ScanType scanType)
Select between syncing, recovering, or scanning for new wallets.
-
-
-
Method Detail
-
uniffiClonePointer
final Pointer uniffiClonePointer()
-
build
LightClient build(Wallet wallet)
Construct a `LightClient` for a `Wallet`.
-
connections
LightClientBuilder connections(UByte connections)
The number of connections for the light client to maintain. Default is two.
-
dataDir
LightClientBuilder dataDir(String dataDir)
Directory to store block headers and peers. If none is provided, the current working directory will be used.
-
peers
LightClientBuilder peers(List<Peer> peers)
Bitcoin full-nodes to attempt a connection with.
-
scanType
LightClientBuilder scanType(ScanType scanType)
Select between syncing, recovering, or scanning for new wallets.
-
-