Constructor
new WalletClient(optionsnullable)
Create a wallet client.
Extends:
- bcurl.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(account, key) → {Promise}
Add a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
key |
String | Account (bip44) key (base58). |
- Source:
Returns:
- Type
- Promise
all()
Join a wallet.
- 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(name, options) → {Promise}
Create account.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createAddress(options) → {Promise}
Create address.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
createAuctionTXs(options) → {Promise}
Create pre-signed bid and reveal txs, fill, and optionally sign and broadcast.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
createBid(id, options) → {Promise}
Create bid transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createCancel(id, options) → {Promise}
Create cancel transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createChange(options) → {Promise}
Create change address.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
createFinalize(id, options) → {Promise}
Create finalize transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createOpen(id, options) → {Promise}
Create open transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createRedeem(id, options) → {Promise}
Create redeem transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createRenewal(id, options) → {Promise}
Create renewal transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createReveal(id, options) → {Promise}
Create reveal transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createRevoke(id, options) → {Promise}
Create revoke transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createTransfer(id, options) → {Promise}
Create transfer transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createTX(options) → {Promise}
Create a transaction, fill.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
createUpdate(id, options) → {Promise}
Create update transaction.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
createWallet(options) → {Promise}
Create a wallet.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Promise
(private) dispatch()
Dispatch event.
- Source:
execute() → {Promise}
Make an RPC call.
- 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
getAuctionByName(id, name) → {Promise}
Get bids, reveals and name state for the given name. {@see hsd.NameState} {@see hsd.BlindBid} {@see hsd.BidReveal}
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
name |
String |
- Source:
Returns:
- Type
- Promise
getAuctions(id, options) → {Promise}
Get bids, reveals and name state for all names the wallet manages. {@see hsd.NameState} {@see hsd.BlindBid} {@see hsd.BidReveal}
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise
getBalance(account) → {Promise}
Calculate wallet balance.
Parameters:
Name | Type | Description |
---|---|---|
account |
String |
- Source:
Returns:
- Type
- Promise
getBids(id, optionsnullable) → {Promise}
Get bids for all names. the wallet manages. {@see hsd.BlindBid}
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | ||||||||||
options |
Object |
<nullable> |
Properties
|
- Source:
Returns:
- Type
- Promise
getBidsByName(id, namenullable, optionsnullable) → {Promise}
Get bids for a given name. {@see hsd.BlindBid}
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | ||||||||||
name |
String |
<nullable> |
|||||||||
options |
Object |
<nullable> |
Properties
|
- 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(id, options) → {Promise}
Get wallet transaction history.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | wallet id |
||||||||||||||||||||||||||||||
options |
Object |
Properties
|
- 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
getLocked() → {Promise}
Get locked coins.
- Source:
Returns:
- Type
- Promise
getMaster() → {Promise}
Get wallet master key.
- Source:
Returns:
- Type
- Promise
getName(id, name) → {Promise}
Get name state for the given name. {@see hsd.NameState}
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
name |
String |
- Source:
Returns:
- Type
- Promise
getNames(id, options) → {Promise}
Get name state for all names that the wallet is managing. {@see hsd.NameState}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
String | |||
options |
Object | |||
optoins.own |
Boolean |
<optional> |
false |
- Source:
Returns:
- Type
- Promise
getPending(id, options) → {Promise}
Get all unconfirmed transactions.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | wallet id |
||||||||||||||||||||||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Type
- Promise
getResource(id, name) → {Promise}
Get name resource. {@see hsd.Resource}
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
name |
String |
- Source:
Returns:
- Type
- Promise
getReveals(id, optionsnullable) → {Promise}
Get wallet reveals for all names the wallet manages. {@see hsd.BidReveal}
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | ||||||||||
options |
Object |
<nullable> |
Properties
|
- Source:
Returns:
- Type
- Promise
getRevealsByName(id, namenullable, optionsnullable) → {Promise}
Get wallet reveal for a given name. {@see hsd.BidReveal}
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
String | ||||||||||
name |
String |
<nullable> |
|||||||||
options |
Object |
<nullable> |
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
getWallets() → {Promise}
Get list of all wallet IDs.
- 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, key) → {Promise}
Import private key.
Parameters:
Name | Type | Description |
---|---|---|
account |
Number | String | |
key |
String |
- Source:
Returns:
- Type
- Promise
importPublic(account, key) → {Promise}
Import public key.
Parameters:
Name | Type | Description |
---|---|---|
account |
Number | String | |
key |
String |
- Source:
Returns:
- Type
- Promise
(private) init() → {Promise}
Open the client.
- Source:
Returns:
- Type
- Promise
join()
Join a wallet.
- Source:
leave()
Leave a wallet.
- Source:
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
modifyAccount(id, name, options) → {Promise.<Object>}
Modify account.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | |
name |
String | |
options |
Object |
- Source:
Returns:
- Type
- Promise.<Object>
none()
Leave a wallet.
- Source:
(async) open() → {Promise}
Open the client.
- Source:
Returns:
- Type
- Promise
removeSharedKey(account, key) → {Promise}
Remove a public account key to the wallet for multisig.
Parameters:
Name | Type | Description |
---|---|---|
account |
String | |
key |
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() → {Promise}
Resend wallet transactions.
- Source:
Returns:
- Type
- Promise
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
wallet(id, tokenopt) → {Wallet}
Create a wallet object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
String | ||
token |
String |
<optional> |
- Source:
Returns:
- Type
- Wallet
zap(now, age) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
now |
Number | Current time. |
age |
Number | Age delta. |
- Source:
Returns:
- Type
- Promise