new WalletDB(options)
WalletDB
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
loaded |
Boolean |
- Source:
Methods
(private) _getDB(id, callback)
Retrieve object from the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
callback |
function | Returns [Error, Object(nakedWallet)]. |
- Source:
(private) _removeDB(id, callback)
Remove object from the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
callback |
function | Returns [Error, Object]. |
- Source:
(private) _saveDB(id, json, callback)
Save object to the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
json |
Object | |
callback |
function | Returns [Error, nakedWallet]. |
- Source:
addKey(id, key, callback)
Add a public account/purpose key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
key |
HDPublicKey | Base58String | Account (bip44) or Purpose (bip45) key (can be in base58 form). |
callback |
function |
- Source:
addTX()
- Source:
- See:
close(callback)
Close the walletdb, wait for the database to close.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
- Source:
create(idnullable, options, callback)
Create a new wallet, save to database, setup provider.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
WalletID |
<nullable> |
|
options |
Object | See Wallet. |
|
callback |
function | Returns [Error, Wallet]. |
- Source:
dump(callback)
Dump database (for debugging).
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Returns [Error, Object]. |
- Source:
ensure(idnullable, options, callback)
Attempt to create wallet, return wallet if already exists.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
WalletID |
<nullable> |
|
options |
Object | See Wallet. |
|
callback |
function |
- Source:
fillCoins()
- Source:
- See:
fillHistory()
- Source:
- See:
get(id, passphrasenullable, callback)
Get a wallet from the database, instantiate, decrypt, and setup provider.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
WalletID | ||
passphrase |
String |
<nullable> |
|
callback |
function | Returns [Error, Wallet]. |
- Source:
getBalance()
- Source:
- See:
getCoin()
- Source:
- See:
getCoins()
- Source:
- See:
getHistory()
- Source:
- See:
getJSON(id, callback)
Retrieve wallet without instantiating it.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
callback |
function | Returns [Error, Object(nakedWallet)]. |
- Source:
getLast()
- Source:
- See:
getLastTime()
- Source:
- See:
getRange()
- Source:
- See:
getTX()
- Source:
- See:
getUnconfirmed()
- Source:
- See:
open(callback)
Open the walletdb, wait for the database to load.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
- Source:
provider() → {Provider}
Instantiate a Provider.
- Source:
Returns:
- Type
- Provider
remove(id, callback)
Remove wallet from the database. Destroy wallet if passed in.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | Wallet | |
callback |
function |
- Source:
removeBlock(block, callback)
Notify the database that a block has been removed (reorg). Unconfirms transactions.
Parameters:
Name | Type | Description |
---|---|---|
block |
Block | |
callback |
function |
- Source:
removeBlockSPV(block, callback)
Notify the database that a block has been removed (reorg). Unconfirms transactions by height.
Parameters:
Name | Type | Description |
---|---|---|
block |
MerkleBlock | Block | |
callback |
function |
- Source:
removeJSON(id, callback)
Remove wallet from the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
callback |
function | Returns [Error, Object]. |
- Source:
removeKey(id, key, callback)
Remove a public account/purpose key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
key |
HDPublicKey | Base58String | Account (bip44) or Purpose (bip45) key (can be in base58 form). |
callback |
function |
- Source:
save(idnullable, options, callback)
Save a wallet to the database (setup ida and encrypt).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
WalletID |
<nullable> |
|
options |
Wallet | ||
callback |
function |
- Source:
saveJSON(id, json, callback)
Save a "naked" (non-instantiated) wallet. Will also index the address table.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
json |
Object | "Naked" wallet. |
callback |
function | Returns [Error, Object]. |
- Source:
setDepth(id, receive, change, callback)
Set receiving/change depth (depth is the index of the next address). Allocate all addresses up to depth. Note that this also allocates new lookahead addresses.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
receive |
Number | Receive address depth. |
change |
Number | Change address depth. |
callback |
function |
- Source:
syncOutputDepth(id, tx, callback)
Sync address depths based on a transaction's outputs. This is used for deriving new addresses when a confirmed transaction is seen.
Parameters:
Name | Type | Description |
---|---|---|
id |
WalletID | |
tx |
TX | |
callback |
function |
- Source:
update(wallet, address)
Notify the database that a new address has been derived. Save to address table. Save wallet.
Parameters:
Name | Type | Description |
---|---|---|
wallet |
Wallet | |
address |
Address |
- Source:
zap()
Zap all walletdb transactions.
- Source:
- See:
zapWallet()
Zap transactions for wallet.
- Source:
- See: