Wallet class

The Wallet acts as a way of coherently interfacing with output descriptors and related transactions. Its main components are:

  1. Output descriptors from which it can derive addresses.
  2. A Database where it tracks transactions and utxos related to the descriptors.
  3. Signers that can contribute signatures to addresses instantiated from the descriptors.

Properties

hashCode int
The hash code for this object.
no setterinherited
ptr → MutexWalletAnyDatabase
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAddress({required AddressIndex addressIndex, dynamic hint}) AddressInfo
Return a derived address using the external descriptor, see AddressIndex for available address index selection strategies. If none of the keys in the descriptor are derivable (i.e. the descriptor does not end with a * character) then the same address will always be returned for any AddressIndex.
getBalance({dynamic hint}) Balance
Return the balance, meaning the sum of this wallet’s unspent outputs’ values. Note that this method only operates on the internal database, which first needs to be Wallet.sync manually.
getDescriptorForKeychain({required KeychainKind keychain, dynamic hint}) Future<Descriptor>
Returns the descriptor used to create addresses for a particular keychain.
getInternalAddress({required AddressIndex addressIndex, dynamic hint}) AddressInfo
Return a derived address using the internal (change) descriptor.
getPsbtInput({required LocalUtxo utxo, required bool onlyWitnessUtxo, PsbtSigHashType? sighashType, dynamic hint}) Input
get the corresponding PSBT Input for a LocalUtxo
isMine({required ScriptBuf script}) bool
Return whether or not a script is part of this wallet (either internal or external).
listTransactions({required bool includeRaw, dynamic hint}) List<TransactionDetails>
Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be Wallet.sync manually.
listUnspent({dynamic hint}) List<LocalUtxo>
Return the list of unspent outputs of this wallet. Note that this method only operates on the internal database, which first needs to be Wallet.sync manually.
network({dynamic hint}) Network
Get the Bitcoin network the wallet is using.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
policies(KeychainKind keychain) Policy?
Return the spending policies for the wallet's descriptor
sign({required PartiallySignedTransaction psbt, SignOptions? signOptions, dynamic hint}) bool
Sign a transaction with all the wallet's signers. This function returns an encapsulated bool that has the value true if the PSBT was finalized, or false otherwise.
sync({required Blockchain blockchain, dynamic hint}) Future<void>
Sync the internal database with the blockchain.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create({required Descriptor descriptor, Descriptor? changeDescriptor, required Network network, required DatabaseConfig databaseConfig}) Future<Wallet>
Wallet constructor Create a wallet.