Constructor
new WalletClient(optionsnullable)
Create a wallet client.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<nullable> |
- Source:
Extends
- bcurl.Client
Methods
abandon(id, hash) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
hash |
Hash |
- Source:
Returns:
- Type
- Promise
addSharedKey(id, account, key) → {Promise}
Add a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
key |
String | Account (bip44) key (base58). |
- Source:
Returns:
- Type
- Promise
all(token)
Join a wallet.
Parameters:
Name | Type | Description |
---|---|---|
token |
String |
- Source:
(async) auth() → {Promise}
Auth with server.
- Source:
Returns:
- Type
- Promise
backup(path) → {Promise}
Backup the walletdb.
Parameters:
Name | Type | Description |
---|---|---|
path |
String |
- Source:
Returns:
- Type
- Promise
(async) close() → {Promise}
Close the client.
- Source:
Returns:
- Type
- Promise
createAccount(id, name, options) → {Promise}
Create account.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
name |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createAddress(id, options) → {Promise}
Create address.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createChange(id, options) → {Promise}
Create change address.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createNested(id, account) → {Promise}
Create nested address.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
createTX(id, options) → {Promise}
Create a transaction, fill.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createWallet(id, options) → {Promise}
Create a wallet.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
options |
Object |
- Source:
Returns:
- Type
- Promise
(private) dispatch(id, event)
Dispatch event.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
event |
String |
- Source:
execute() → {Promise}
Make an RPC call.
- Source:
Returns:
- Type
- Promise
getAccount(id, account) → {Promise}
Get wallet account.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
getAccounts(id) → {Promise}
Get wallet accounts.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Returns Array.
- Type
- Promise
getBalance(id, account) → {Promise}
Calculate wallet balance.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
getBlock(id, height) → {Promise}
Get wallet block.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
height |
Number |
- Source:
Returns:
- Type
- Promise
getBlocks(id) → {Promise}
Get wallet blocks.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
getCoin(id, hash, index) → {Promise}
Get unspent coin (only possible if the transaction is available in the wallet history).
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
hash |
Hash | |
index |
Number |
- Source:
Returns:
- Type
- Promise
getCoins(id, account) → {Promise}
Get wallet coins.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
getHistory(id, account) → {Promise}
Get wallet transaction history.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
getInfo(id) → {Promise}
Get the raw wallet JSON.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
getKey(id, address) → {Promise}
Get wallet key.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
address |
String |
- Source:
Returns:
- Type
- Promise
getLast(id, account, limit) → {Promise}
Get last N wallet transactions.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
limit |
Number | Max number of transactions. |
- Source:
Returns:
- Type
- Promise
getLocked(id) → {Promise}
Get locked coins.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
getMaster(id) → {Promise}
Get wallet master key.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
getPending(id, account) → {Promise}
Get all unconfirmed transactions.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String |
- Source:
Returns:
- Type
- Promise
getRange(id, account, options) → {Promise}
Get wallet transactions by timestamp range.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
Number | |||||||||||||||||||||
account |
String | |||||||||||||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
getTX(id, hash) → {Promise}
Get transaction (only possible if the transaction is available in the wallet history).
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
hash |
Hash |
- Source:
Returns:
- Type
- Promise
getWallets() → {Promise}
Get list of all wallet IDs.
- Source:
Returns:
- Type
- Promise
getWIF(id, address, passphrasenullable) → {Promise}
Get wallet key WIF dump.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
Number | ||
address |
String | ||
passphrase |
String |
<nullable> |
- Source:
Returns:
- Type
- Promise
importAddress(id, account, address) → {Promise}
Import address.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
address |
String |
- Source:
Returns:
- Type
- Promise
importPrivate(id, account, key) → {Promise}
Import private key.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
key |
String |
- Source:
Returns:
- Type
- Promise
importPublic(id, account, publicKey) → {Promise}
Import public key.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
Number | String | |
publicKey |
String |
- Source:
Returns:
- Type
- Promise
(private) init() → {Promise}
Open the client.
- Source:
Returns:
- Type
- Promise
join(id, token)
Join a wallet.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
token |
String |
- Source:
leave(id)
Leave a wallet.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
lock(id) → {Promise}
Lock wallet.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
lockCoin(hash, index) → {Promise}
Lock a coin.
Parameters:
Name | Type | Description |
---|---|---|
hash |
String | |
index |
Number |
- Source:
Returns:
- Type
- Promise
none()
Leave a wallet.
- Source:
(async) open() → {Promise}
Open the client.
- Source:
Returns:
- Type
- Promise
removeSharedKey(id, account, accountKey) → {Promise}
Remove a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
accountKey |
String | Account (bip44) key (base58). |
- Source:
Returns:
- Type
- Promise
rescan(height) → {Promise}
Rescan the chain.
Parameters:
Name | Type | Description |
---|---|---|
height |
Number |
- Source:
Returns:
- Type
- Promise
resend() → {Promise}
Resend pending transactions.
- Source:
Returns:
- Type
- Promise
resendWallet(id) → {Promise}
Resend wallet transactions.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number |
- Source:
Returns:
- Type
- Promise
retoken(id, passphrasenullable) → {Promise}
Generate a new token.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
Number | ||
passphrase |
String | Buffer |
<nullable> |
- Source:
Returns:
- Type
- Promise
send(id, options) → {Promise}
Create a transaction, fill, sign, and broadcast.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
Number | ||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
setPassphrase(id, passphrase, oldnullable) → {Promise}
Change or set master key`s passphrase.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
Number | ||
passphrase |
String | Buffer | ||
old |
String | Buffer |
<nullable> |
- Source:
Returns:
- Type
- Promise
sign(id, options) → {Promise}
Sign a transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
options |
Object |
- Source:
Returns:
- Type
- Promise
unlock(id, passphrase, timeout) → {Promise}
Unlock wallet.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
passphrase |
String | |
timeout |
Number |
- Source:
Returns:
- Type
- Promise
unlockCoin(id, hash, index) → {Promise}
Unlock a coin.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
hash |
String | |
index |
Number |
- Source:
Returns:
- Type
- Promise
wallet(id, token)
Create a wallet object.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
token |
String |
- Source:
zap(id, account, age) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | |
account |
String | |
age |
Number | Age delta. |
- Source:
Returns:
- Type
- Promise