Constructor
new Wallet(optionsnullable)
Create a wallet client.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<nullable> |
- Source:
Extends
- EventEmitter
Methods
abandon(hash) → {Promise}
Used to remove a pending transaction from the wallet. That is likely the case if it has a policy or low fee that prevents it from proper network propagation.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Type
- Promise
addSharedKey(account, accountKey) → {Promise}
Add a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
accountKey |
String | Account (bip44) key (base58). |
- Source:
Returns:
- Type
- Promise
(async) close() → {Promise}
Close wallet.
- Source:
Returns:
- Type
- Promise
createAccount(name, options) → {Promise}
Create account.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createAddress(account) → {Promise}
Create address.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
createChange(account) → {Promise}
Create change address.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
createNested(account) → {Promise}
Create nested address.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
createTX(options) → {Promise}
Create a transaction, fill.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
getAccount(account) → {Promise}
Get wallet account.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getAccounts() → {Promise}
Get wallet accounts.
- Source:
Returns:
- Returns Array.
- Type
- Promise
getBalance(account) → {Promise}
Calculate wallet balance.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getBlock(height) → {Promise}
Get wallet block.
Parameters:
Name | Type | Description |
---|---|---|
height |
Number |
- Source:
Returns:
- Type
- Promise
getBlocks(height) → {Promise}
Get wallet blocks.
Parameters:
Name | Type | Description |
---|---|---|
height |
Number |
- Source:
Returns:
- Type
- Promise
getCoin(hash, index) → {Promise}
Get unspent coin (only possible if the transaction is available in the wallet history).
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
index |
Number |
- Source:
Returns:
- Type
- Promise
getCoins(account) → {Promise}
Get wallet coins.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getHistory(account) → {Promise}
Get wallet transaction history.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getInfo() → {Promise}
Get the raw wallet JSON.
- Source:
Returns:
- Type
- Promise
getKey(address) → {Promise}
Get wallet key.
Parameters:
Name | Type | Description |
---|---|---|
address |
String |
- Source:
Returns:
- Type
- Promise
getLast(account, limit) → {Promise}
Get last N wallet transactions.
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
limit |
Number | Max number of transactions. |
- Source:
Returns:
- Type
- Promise
getLocked() → {Promise}
Get locked coins.
- Source:
Returns:
- Type
- Promise
getMaster() → {Promise}
Get wallet master key.
- Source:
Returns:
- Type
- Promise
getPending(account) → {Promise}
Get all unconfirmed transactions.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getRange(account, options) → {Promise}
Get wallet transactions by timestamp range.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
account |
String | |||||||||||||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
getTX(hash) → {Promise}
Get transaction (only possible if the transaction is available in the wallet history).
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Type
- Promise
getWIF(address, passphrasenullable) → {Promise}
Get wallet key WIF dump.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
String | ||
passphrase |
String |
<nullable> |
- Source:
Returns:
- Type
- Promise
importAddress(account, address) → {Promise}
Import address.
Parameters:
Name | Type | Description |
---|---|---|
account |
Number | String | |
address |
String |
- Source:
Returns:
- Type
- Promise
importPrivate(account, privateKey, passphrase) → {Promise}
Import private key.
Parameters:
Name | Type | Description |
---|---|---|
account |
Number | String | |
privateKey |
String | |
passphrase |
String |
- Source:
Returns:
- Type
- Promise
importPublic(account, publicKey) → {Promise}
Import public key.
Parameters:
Name | Type | Description |
---|---|---|
account |
Number | String | |
publicKey |
String |
- Source:
Returns:
- Type
- Promise
lock() → {Promise}
Lock wallet.
- Source:
Returns:
- Type
- Promise
lockCoin(hash, index) → {Promise}
Lock a coin.
Parameters:
Name | Type | Description |
---|---|---|
hash |
String | |
index |
Number |
- Source:
Returns:
- Type
- Promise
(async) open() → {Promise}
Open wallet.
- Source:
Returns:
- Type
- Promise
removeSharedKey(account, accountKey) → {Promise}
Remove a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
accountKey |
String | Account (bip44) key (base58). |
- Source:
Returns:
- Type
- Promise
resend() → {Promise}
Resend wallet transactions.
- Source:
Returns:
- Type
- Promise
(async) retoken(passphrasenullable) → {Promise}
Generate a new token.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
String | Buffer |
<nullable> |
- Source:
Returns:
- Type
- Promise
send(options) → {Promise}
Create a transaction, fill, sign, and broadcast.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
setPassphrase(passphrase, oldnullable) → {Promise}
Change or set master key`s passphrase.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
passphrase |
String | Buffer | ||
old |
String | Buffer |
<nullable> |
- Source:
Returns:
- Type
- Promise
sign(options) → {Promise}
Sign a transaction.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
unlock(passphrase, timeout) → {Promise}
Unlock wallet.
Parameters:
Name | Type | Description |
---|---|---|
passphrase |
String | |
timeout |
Number |
- Source:
Returns:
- Type
- Promise
unlockCoin(hash, index) → {Promise}
Unlock a coin.
Parameters:
Name | Type | Description |
---|---|---|
hash |
String | |
index |
Number |
- Source:
Returns:
- Type
- Promise
zap(account, age) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
age |
Number | Age delta. |
- Source:
Returns:
- Type
- Promise