Constructor
new Wallet(parent, id, tokenopt)
Create a wallet client.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
parent | 
            
            WalletClient | ||
id | 
            
            String | ||
token | 
            
            String | 
                
                    <optional> | 
            
            
            
- Source:
 
Extends
- EventEmitter
 
Members
client :WalletClient
Type:
- Source:
 
id :String
Type:
- String
 
- Source:
 
parent :WalletClient
Type:
- Source:
 
token :String
Type:
- String
 
- Source:
 
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, 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
 
(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(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(options) → {Promise}
Create bid transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createCancel(options) → {Promise}
Create cancel transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createChange(options) → {Promise}
Create change address.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createFinalize(options) → {Promise}
Create finalize transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createOpen(options) → {Promise}
Create open transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createRedeem(options) → {Promise}
Create redeem transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createRenewal(options) → {Promise}
Create renewal transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createReveal(options) → {Promise}
Create reveal transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createRevoke(options) → {Promise}
Create revoke transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createTransfer(options) → {Promise}
Create transfer transaction.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createTX(options) → {Promise}
Create a transaction, fill.
Parameters:
| Name | Type | Description | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
createUpdate(options) → {Promise}
Create update transaction.
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
 
getAuctionByName(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 | 
|---|---|---|
name | 
            
            String | 
- Source:
 
Returns:
- Type
 - Promise
 
getAuctions(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 | 
|---|---|---|
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise
 
getBalance(account) → {Promise}
Calculate wallet balance.
Parameters:
| Name | Type | Description | 
|---|---|---|
account | 
            
            String | 
- Source:
 
Returns:
- Type
 - Promise
 
getBids(optionsnullable) → {Promise}
Get bids for all names. the wallet manages. {@see hsd.BlindBid}
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            Object | 
                
                
                    <nullable> | 
            
            
            
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise
 
getBidsByName(namenullable, optionsnullable) → {Promise}
Get bids for a given name. {@see hsd.BlindBid}
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
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(options) → {Promise.<Array.<TX>>}
Get wallet transaction history.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            Object | 
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise.<Array.<TX>>
 
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(name, optionsopt) → {Promise}
Get name state for the given name. {@see hsd.NameState}
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name | 
            
            String | ||||||||||||
options | 
            
            Object | 
                
                    <optional> | 
            
            
            
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise
 
getNames(optionsopt) → {Promise}
Get name state for all names that the wallet is managing. {@see hsd.NameState}
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            Object | 
                
                    <optional> | 
            
            
            
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise
 
getPending(options) → {Promise}
Get all unconfirmed transactions.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            Object | 
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise
 
getResource(name) → {Promise}
Get name resource. {@see hsd.Resource}
Parameters:
| Name | Type | Description | 
|---|---|---|
name | 
            
            String | 
- Source:
 
Returns:
- Type
 - Promise
 
getReveals(optionsnullable) → {Promise}
Get wallet reveals for all names the wallet manages. {@see hsd.BidReveal}
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options | 
            
            Object | 
                
                
                    <nullable> | 
            
            
            
                Properties
  | 
        
- Source:
 
Returns:
- Type
 - Promise
 
getRevealsByName(namenullable, optionsnullable) → {Promise}
Get wallet reveal for a given name. {@see hsd.BidReveal}
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
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
 
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
 
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(name, options) → {Promise.<Object>}
Modify account.
Parameters:
| Name | Type | Description | 
|---|---|---|
name | 
            
            String | |
options | 
            
            Object | 
- Source:
 
Returns:
- Type
 - Promise.<Object>
 
(async) open() → {Promise}
Open wallet.
- 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
 
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(now, age) → {Promise}
Parameters:
| Name | Type | Description | 
|---|---|---|
now | 
            
            Number | Current time.  | 
        
age | 
            
            Number | Age delta.  | 
        
- Source:
 
Returns:
- Type
 - Promise