Wallet class

Thin Wallet built from Peer.getBalance, Peer.getTransactions, and Peer.filterAdd. We store Address and Account records. Transaction are dynamically loaded. Block storage isn't necessary if Peer.filterAdd correctly handles reorgs. See: undoneByReorg in updateTransaction.

Inheritance

Constructors

Wallet.fromFile(DatabaseFactory databaseFactory, List<PeerNetwork> networks, FileSystem fileSystem, String filename, Seed seed, [CruzawlPreferences preferences, StringCallback debugPrint, WalletCallback loaded])
Load arbitrary Wallet of arbitrary Currency.
Wallet.fromPrivateKeyList(DatabaseFactory databaseFactory, FileSystem fileSystem, String filename, String name, PeerNetwork network, Seed seed, List<PrivateKey> privateKeys, [CruzawlPreferences preferences, StringCallback debugPrint, WalletCallback loaded])
Create non-HD Wallet from private key list.
Wallet.fromPublicKeyList(DatabaseFactory databaseFactory, FileSystem fileSystem, String filename, String name, PeerNetwork network, Seed seed, List<PublicAddress> publicKeys, [CruzawlPreferences preferences, StringCallback debugPrint, WalletCallback loaded])
Create watch-only Wallet from public key list.
Wallet.fromSeed(DatabaseFactory databaseFactory, FileSystem fileSystem, String filename, String name, PeerNetwork network, Seed seed, [String seedPhrase, CruzawlPreferences preferences, StringCallback debugPrint, WalletCallback loaded])
Generate HD Wallet from SLIP-0010 seed.
Wallet.fromSeedPhrase(DatabaseFactory databaseFactory, FileSystem fileSystem, String filename, String name, PeerNetwork network, String seedPhrase, [CruzawlPreferences prefileSystem, StringCallback debug, WalletCallback loaded])
Generate HD Wallet from BIP-0039 mnemonic code.
Wallet.generate(DatabaseFactory databaseFactory, FileSystem fileSystem, String filename, String name, PeerNetwork network, [CruzawlPreferences prefileSystem, StringCallback debug, WalletCallback loaded])
Generate new HD Wallet.

Properties

account Account
The currently active Account
read-only
activeAccountId ↔ int
Active Account context for addAddress().
read / write
balanceChanged VoidCallback
Like notifyListeners but only called when balance changes.
read / write
debugPrint StringCallback
Debug logging hook.
read / write
fatal ErrorDetails
If something horrible happened, give some explanation.
read / write
hdWallet → bool
True if hierarchical deterministic wallet.
read-only
maturesBalance ↔ num
Maturing balance for this wallet.
read / write
maturesHeight ↔ int
Maturing balance height for this wallet.
read / write
maturing PriorityQueue<Transaction>
PriorityQueue of maturing Transaction involving addresses.
read / write
network PeerNetwork
The PeerNetwork to query for this wallet.
read / write
nextAddressIndex ↔ int
For non-HD wallets. Cycles through addresses.
read / write
notifyListeners VoidCallback
We imagine we're a ScopedModel. A pure Dart proto-ScopedModel.
read / write
opened ↔ bool
True if _openWalletStorage has completed and this Wallet is ready.
read / write
preferences CruzawlPreferences
e.g. CruzawlPreferences.verifyAddressEveryLoad.
read / write
receiveAddress Address
For HD wallets get next Account.reserveAddress. Otherwise loop nextAddressIndex.
read-only
transactionIds ↔ Map<String, Transaction>
Map of TransactionId.toJson() to transactions entry.
read / write
transactions SortedListSet<Transaction>
Transaction involving addresses.
read / write
accounts ↔ Map<int, Account>
Synchronized with accountStore.
read / write, inherited
accountStore ↔ dynamic
Holds Account summary of Address grouped by accountId.
read / write, inherited
addresses ↔ Map<String, Address>
Synchronized with addressStore.
read / write, inherited
addressStore ↔ dynamic
Holds every Address in Wallet.
read / write, inherited
balance ↔ num
Wallet balance is sum of accounts.Account.balance.
read / write, inherited
currency Currency
Type of currency for this wallet.
read / write, inherited
hashCode → int
The hash code for this object.
read-only, inherited
name ↔ String
Display name for this wallet.
read / write, inherited
pendingCount ↔ int
Synchronized with pendingStore.
read / write, inherited
pendingStore ↔ dynamic
Holds our recently sent Transaction.
read / write, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
seed Seed
The seed for HD wallets.
read / write, inherited
seedPhrase ↔ String
The seed phrase for HD wallets.
read / write, inherited
storage Database
sembast: Simple Embedded Application Store database.
read / write, inherited
walletStore ↔ dynamic
Holds "header" with Wallet vital information.
read / write, inherited

Methods

addAccount(Account x, {bool store: true}) → Future<Account>
Each Address in Wallet is associated with one Account.
override
addAddress(Address x, {bool store: true, bool load: true, Transaction txn}) → Future<Address>
Store Address and _filterNetworkFor it.
override
addNextAddress({bool load: true, Account account, Transaction txn}) → Future<Address>
Grow the pool of Address with Address.state equal AddressState.reserve by one.
addProvidedAddress(Address x, int index) → Future<Address>
Calls addAddress with settings for a user-provided address.
bip44Path(int index, int coinType, {int bip43Purpose: 44, int accountId: 0, int change: 0}) → String
Apostrophe in the path indicates that BIP32 hardened derivation is used.
completeMaturingTransactions(int height) → Future<void>
When a Transaction matures move the Transaction.amount from maturesBalance to balance.
createTransaction(Transaction transaction) → Future<Transaction>
Persist a new Transaction before sending it.
deriveAddress(int index, {int accountId: 0, int change: 0}) Address
Wallet should use deriveAddress instead of deriveAddressWithPath.
deriveAddressWithPath(String path) Address
Run Currency specific deriveAddress on path with seed.
expirePendingTransactions(int height) → void
If a pending Transaction expires, delete it and return the Transaction.amount.
getNextTransactions(Peer peer, Address x) → Future<TransactionIteratorResults>
Use Peer.getTransactions iterator to load x's Transactions by Transaction.height.
reload({bool initialLoad: false}) → void
Fully re-synchronize with the PeerNetwork.
updateAddressState(Address x, AddressState newState, {bool store: true}) → Future<void>
When an Address changes state, update Account.reserveAddress tracking.
updateTip() → void
When new Blocks come out, use their BlockHeader.height as a timer.
updateTransaction(Transaction transaction, {bool newTransaction: true}) → Future<void>
All Transaction updates go through updateTransaction. From either getNextTransactions, Peer.filterAdd results, or _readPendingTraRsactions. Balance changes only if transactionsChanged and newTransaction (or undoneByreorg).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited