Class: Wallet

wallet.Wallet(wdb, options)

Wallet

Constructor

new Wallet(wdb, options)

Create a wallet.

Extends:
  • EventEmitter
Parameters:
Name Type Description
wdb WalletDB
options Object
Source:

Extends

  • EventEmitter

Members

id :String|null

Type:
  • String | null
Source:

Methods

(static) decode(wdb, data) → {Wallet}

Instantiate a wallet from serialized data.

Parameters:
Name Type Description
wdb WalletDB
data Buffer
Source:
Returns:
Type
Wallet

(static) fromOptions(wdb, options) → {Wallet}

Instantiate wallet from options.

Parameters:
Name Type Description
wdb WalletDB
options Object
Source:
Returns:
Type
Wallet

(static) isWallet(obj) → {Boolean}

Test an object to see if it is a Wallet.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Boolean

(private) _abandon(hash) → {Promise.<Details>}

Abandon transaction without a lock.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
  • removed tx details.
Type
Promise.<Details>

(async, private) _add(tx, blockopt, extraopt) → {Promise.<?AddResult>}

Add a transaction to the wallet without a lock. Potentially resolves orphans.

Parameters:
Name Type Attributes Description
tx TX
block BlockMeta <optional>
extra BlockExtraInfo <optional>
Source:
Returns:
Type
Promise.<?AddResult>

(async, private) _addSharedKey(acct, key) → {Promise.<Boolean>}

Add a public account key to the wallet without a lock.

Parameters:
Name Type Description
acct Number | String
key HDPublicKey
Source:
Returns:
Type
Promise.<Boolean>

(async) _createAccount(options, passphraseopt, nullable) → {Promise.<Account>}

Create an account without a lock.

Parameters:
Name Type Attributes Description
options Object

See Account options.

passphrase String | Buffer <optional>
<nullable>
Source:
Returns:
Type
Promise.<Account>

(async) _createAuctionTXs(name, value, lockup, options) → {Promise.<CreateAuctionResults>}

Create and finalize a bid & a reveal (in advance) MTX without a lock.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:
Returns:
Type
Promise.<CreateAuctionResults>

(async) _createBatch(actions, options) → {Promise.<MTX>}

Make a batch transaction with multiple actions.

Parameters:
Name Type Description
actions Array
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createBid(name, value, lockup, options) → {Promise.<MTX>}

Create and finalize a bid MTX without a lock.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createCancel(name, options) → {Promise.<MTX>}

Create and finalize a cancel MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createClaim(name, optionsopt, nullable) → {Promise.<Object>}

Make a claim MTX.

Parameters:
Name Type Attributes Description
name String
options Object <optional>
<nullable>
Source:
Returns:
Type
Promise.<Object>

(async) _createFinalize(name, options) → {Promise.<MTX>}

Create and finalize a finalize MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async, private) _createKey(acctnullable, branch) → {Promise.<WalletKey>}

Create a new address (increments depth) without a lock.

Parameters:
Name Type Attributes Description
acct Number | String <nullable>
branch Number
Source:
Returns:
Type
Promise.<WalletKey>

(async) _createOpen(name, options) → {Promise.<MTX>}

Create and finalize an open MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createRedeem(name, options) → {Promise.<MTX>}

Create and finalize a redeem MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createRedeemAll(options) → {Promise.<MTX>}

Create and finalize a redeem all MTX without a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createRenewal(name, options) → {Promise.<MTX>}

Create and finalize a renewal MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createReveal(name, options) → {Promise.<MTX>}

Create and finalize a reveal MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createRevealAll(options) → {Promise.<MTX>}

Create and finalize a reveal all MTX without a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createRevoke(name, options) → {Promise.<MTX>}

Create and finalize a revoke MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createTransfer(name, address, options) → {Promise.<MTX>}

Create and finalize a transfer MTX without a lock.

Parameters:
Name Type Description
name String
address Address
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) _createTX(options) → {Promise.<MTX>}

Build a transaction, fill and finalize without a lock.

Parameters:
Name Type Description
options Object

See options.

Properties
Name Type Description
outputs Array.<Object>

See MTX#addOutput.

Source:
Returns:
  • MTX with populated inputs and outputs.
Type
Promise.<MTX>

(async) _createUpdate(name, resource, options) → {Promise.<MTX>}

Create and finalize an update MTX without a lock.

Parameters:
Name Type Description
name String
resource Resource
options Object
Source:
Returns:
Type
Promise.<MTX>

(async, private) _decrypt(passphrase) → {Promise}

Decrypt the wallet permanently, without a lock.

Parameters:
Name Type Description
passphrase String | Buffer
Source:
Returns:
Type
Promise

(async, private) _encrypt(passphrase) → {Promise}

Encrypt the wallet permanently, without a lock.

Parameters:
Name Type Description
passphrase String | Buffer
Source:
Returns:
Type
Promise

(async) _getNoncePublicKeys(address, value) → {Promise.<Array.<Buffer>>}

Get public keys at index based on address and value for nonce generation

Parameters:
Name Type Description
address Address
value Amount
Source:
Returns:

public keys

Type
Promise.<Array.<Buffer>>

(async) _getPendingAncestors(tx, set) → {Promise.<BufferSet>}

Get pending ancestors up to the policy limit.

Parameters:
Name Type Description
tx TX
set BufferSet
Source:
Returns:
Type
Promise.<BufferSet>

(async, private) _importAddress(acctnullable, address) → {Promise}

Import a keyring (will not exist on derivation chain) without a lock.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
address Address
Source:
Returns:
Type
Promise

(async, private) _importKey(acctnullable, ring, passphrasenullable) → {Promise}

Import a keyring (will not exist on derivation chain) without a lock.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
ring WalletKey
passphrase String | Buffer <nullable>
Source:
Returns:
Type
Promise

(async, private) _importName(name) → {Promise}

Import a name without a lock.

Parameters:
Name Type Description
name String
Source:
Returns:
Type
Promise

(async, private) _makeRegister(name, resourcenullable, mtxopt, nullable) → {Promise.<MTX>}

Make a register MTX.

Parameters:
Name Type Attributes Description
name String
resource Resource <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) _modifyAccount(acct, options, passphraseopt, nullable) → {Promise.<Account>}

Create an account without a lock.

Parameters:
Name Type Attributes Description
acct String | Number
options Object
passphrase String | Buffer <optional>
<nullable>
Source:
Returns:
Type
Promise.<Account>

(async, private) _removeSharedKey(acct, key) → {Promise.<Boolean>}

Remove a public account key from the wallet (multisig).

Parameters:
Name Type Description
acct Number | String
key HDPublicKey
Source:
Returns:
Type
Promise.<Boolean>

(async, private) _renameAccount(acct, name) → {Promise}

Rename account without a lock.

Parameters:
Name Type Description
acct String
name String
Source:
Returns:
Type
Promise

(async, private) _retoken(passphrasenullable) → {Promise.<Buffer>}

Generate a new token without a lock.

Parameters:
Name Type Attributes Description
passphrase String | Buffer <nullable>
Source:
Returns:
Type
Promise.<Buffer>

(async, private) _send(options) → {Promise.<TX>}

Build and send a transaction without a lock.

Parameters:
Name Type Description
options Object

See options.

Properties
Name Type Description
outputs Array.<Object>

See MTX#addOutput.

passphrase String
Source:
Returns:
Type
Promise.<TX>

(async) _sendBatch(actions, options) → {Promise.<TX>}

Create and send a batch transaction with multiple actions.

Parameters:
Name Type Description
actions Array
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendBid(name, value, lockup, options)

Create and send a bid MTX.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:

(async) _sendCancel(name, options) → {Promise.<TX>}

Create and send a cancel MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendClaim(name, options) → {Promise.<Claim>}

Create and send a claim proof.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<Claim>

(async) _sendFakeClaim(name, options)

Create and send a claim proof.

Parameters:
Name Type Description
name String
options Object
Source:

(async) _sendFinalize(name, options) → {Promise.<TX>}

Create and send a finalize MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendOpen(name, options) → {Promise.<TX>}

Create and send an open MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendRedeem(name, options) → {Promise.<TX>}

Create and send a redeem MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendRedeemAll(options) → {Promise.<TX>}

Create and send a redeem all MTX without a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendRenewal(name, options) → {Promise.<TX>}

Create and send a renewal MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendReveal(name, options) → {Promise.<TX>}

Create and send a reveal MTX.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendRevealAll(options) → {Promise.<TX>}

Create and send a reveal all MTX.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendRevoke(name, options) → {Promise.<TX>}

Create and send a revoke MTX without a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendTransfer(name, address, options) → {Promise.<TX>}

Create and send a transfer MTX without a lock.

Parameters:
Name Type Description
name String
address Address
options Object
Source:
Returns:
Type
Promise.<TX>

(async) _sendUpdate(name, resource, options) → {Promise.<TX>}

Create and send an update MTX without a lock.

Parameters:
Name Type Description
name String
resource Resource
options Object
Source:
Returns:
Type
Promise.<TX>

(async, private) _zap(acctnullable, age) → {Promise.<Number>}

Zap stale TXs from wallet without a lock.

Parameters:
Name Type Attributes Description
acct Number | String <nullable>
age Number
Source:
Returns:
Type
Promise.<Number>

(async) abandon(hash) → {Promise.<Details>}

Abandon transaction.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
  • removed tx details.
Type
Promise.<Details>

(async) accountKey(acctopt) → {Promise.<HDPublicKey>}

Get account key.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<HDPublicKey>

(async) add(tx, blockopt, extraopt) → {Promise.<?AddResult>}

Add a transaction to the wallets TX history.

Parameters:
Name Type Attributes Description
tx TX
block BlockMeta <optional>
extra BlockExtraInfo <optional>
Source:
Returns:
Type
Promise.<?AddResult>

(async) addSharedKey(acct, key) → {Promise.<Boolean>}

Add a public account key to the wallet (multisig). Saves the key in the wallet database.

Parameters:
Name Type Description
acct Number | String
key HDPublicKey
Source:
Returns:
Type
Promise.<Boolean>

(async) changeAddress(acctopt) → {Promise.<Address>}

Get current change address.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<Address>

(async) changeDepth(acctopt) → {Promise.<Number>}

Get current change depth.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<Number>

(async) changeKey(acctopt) → {Promise.<WalletKey>}

Get current change key.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<WalletKey>

(async) createAccount(options, passphraseopt, nullable) → {Promise.<Account>}

Create an account. Requires passphrase if master key is encrypted.

Parameters:
Name Type Attributes Description
options Object

See Account options.

passphrase String | Buffer <optional>
<nullable>
Source:
Returns:
Type
Promise.<Account>

(async) createAuctionTXs(name, value, lockup, options) → {Promise.<CreateAuctionResults>}

Create and finalize a bid & a reveal (in advance) MTX with a lock.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:
Returns:
Type
Promise.<CreateAuctionResults>

(async) createBatch(actions, options) → {Promise.<MTX>}

Make a batch transaction with multiple actions.

Parameters:
Name Type Description
actions Array
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createBid(name, value, lockup, options) → {Promise.<MTX>}

Create and finalize a bid MTX with a lock.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createCancel(name, options) → {Promise.<MTX>}

Create and finalize a cancel MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

createChange(acctnullable) → {Promise.<WalletKey>}

Create a new change address (increments changeDepth).

Parameters:
Name Type Attributes Default Description
acct Number | String <nullable>
0
Source:
Returns:
Type
Promise.<WalletKey>

(async) createClaim(name, options) → {Promise.<Object>}

Create and send a claim MTX.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<Object>

(async) createFinalize(name, options) → {Promise.<MTX>}

Create and finalize a finalize MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createKey(acctnullable, branch) → {Promise.<WalletKey>}

Create a new address (increments depth).

Parameters:
Name Type Attributes Description
acct Number | String <nullable>
branch Number
Source:
Returns:
Type
Promise.<WalletKey>

(async) createOpen(name, options) → {Promise.<MTX>}

Create and finalize an open MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

createReceive(acctnullable) → {Promise.<WalletKey>}

Create a new receiving address (increments receiveDepth).

Parameters:
Name Type Attributes Default Description
acct Number | String <nullable>
0
Source:
Returns:
Type
Promise.<WalletKey>

(async) createRedeem(name, options) → {Promise.<MTX>}

Create and finalize a redeem MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createRedeemAll(options) → {Promise.<MTX>}

Create and finalize a redeem all MTX with a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createRenewal(name, options) → {Promise.<MTX>}

Create and finalize a renewal MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createReveal(name, options) → {Promise.<MTX>}

Create and finalize a reveal MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createRevealAll(options) → {Promise.<MTX>}

Create and finalize a reveal all MTX with a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createRevoke(name, options) → {Promise.<MTX>}

Create and finalize a revoke MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createTransfer(name, address, options) → {Promise.<MTX>}

Create and finalize a transfer MTX with a lock.

Parameters:
Name Type Description
name String
address Address
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) createTX(options) → {Promise}

Build a transaction, fill and finalize with a lock.

Parameters:
Name Type Description
options Object

See options.

Properties
Name Type Description
outputs Array.<Object>

See MTX#addOutput.

Source:
Returns:
  • Returns MTX.
Type
Promise

(async) createUpdate(name, resource, options) → {Promise.<MTX>}

Create and finalize an update MTX with a lock.

Parameters:
Name Type Description
name String
resource Resource
options Object
Source:
Returns:
Type
Promise.<MTX>

decode(data) → {this}

Inject properties from serialized data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
this

(async) decrypt(passphrase) → {Promise}

Decrypt the wallet permanently.

Parameters:
Name Type Description
passphrase String | Buffer
Source:
Returns:
Type
Promise

(async) deriveInputs(mtx) → {Promise.<Array.<WalletKey>>}

Derive necessary addresses for signing a transaction.

Parameters:
Name Type Description
mtx MTX
Source:
Returns:
Type
Promise.<Array.<WalletKey>>

(async) destroy() → {Promise}

Close the wallet, unregister with the database.

Source:
Returns:
Type
Promise

encode() → {Buffer}

Serialize the wallet.

Source:
Returns:
Type
Buffer

(async) encrypt(passphrase) → {Promise}

Encrypt the wallet permanently.

Parameters:
Name Type Description
passphrase String | Buffer
Source:
Returns:
Type
Promise

(async) ensureAccount(options, passphraseopt, nullable) → {Promise.<Account>}

Ensure an account. Requires passphrase if master key is encrypted.

Parameters:
Name Type Attributes Description
options Object

See Account options.

passphrase String | Buffer <optional>
<nullable>
Source:
Returns:
Type
Promise.<Account>

(async) ensureIndex(acctopt, nullable) → {Promise.<Number>}

Lookup the corresponding account name's index.

Parameters:
Name Type Attributes Description
acct String | Number <optional>
<nullable>

Account name/index.

Source:
Throws:

on non-existent account

Returns:
Type
Promise.<Number>

(async) estimateSize(addr) → {Promise.<Number>}

Estimate witness size given output address. Unlike Bitcoin, our signatures are always 65 bytes. However, we still assume that the witness varInt size is only one byte. In short, this estimate may be off by 2 (at most) but only if a witness has > 253 items. Also note we are only processing the witness data here, which will be scaled down by WITNESS_SCALE_FACTOR to compute vsize. Input data like prevout and sequence count as base data and must be added in outside this function.

Parameters:
Name Type Description
addr Address
Source:
Returns:
Type
Promise.<Number>

(async) fill(mtx, optionsopt) → {Promise}

Fill a transaction with inputs without a lock.

Parameters:
Name Type Attributes Description
mtx MTX
options Object <optional>
Source:
Returns:
Type
Promise

(async) finalize(mtx, options) → {Promise.<MTX>}

Finalize and template an MTX.

Parameters:
Name Type Description
mtx MTX
options Object
Source:
Returns:
Type
Promise.<MTX>

format() → {Object}

Convert the wallet to a more inspection-friendly object.

Source:
Returns:
Type
Object

fromOptions(options)

Inject properties from options object.

Parameters:
Name Type Description
options Object
Source:

(async) fund(mtx, optionsopt, forceopt)

Fill a transaction with inputs, estimate transaction size, calculate fee, and add a change output.

Parameters:
Name Type Attributes Description
mtx MTX

Must be a mutable transaction.

options Object <optional>
Properties
Name Type Attributes Default Description
account String | Number <nullable>

If no account is specified, coins from the entire wallet will be filled.

selection String <nullable>

Coin selection priority. Can be random, age, db-age, value, db-value, all, db-all or db-sweepdust (default=db-value)

round Boolean

Whether to round to the nearest kilobyte for fee calculation. See TX#getMinFee vs. TX#getRoundFee.

rate Rate

Rate used for fee calculation.

confirmed Boolean

Select only confirmed coins.

free Boolean

Do not apply a fee if the transaction priority is high enough to be considered free.

hardFee Amount <nullable>

Use a hard fee rather than calculating one.

subtractFee Number | Boolean

Whether to subtract the fee from existing outputs rather than adding more inputs.

sweepdustMinValue Number <optional>
1

Minimum value for sweepdust value.

force Boolean <optional>
Source:
See:
  • MTX#selectCoins
  • MTX#fill

(async) generateBlind(nameHash, address, value) → {Promise.<Buffer>}

Generate nonce & blind, save nonce.

Parameters:
Name Type Description
nameHash Buffer
address Address
value Amount
Source:
Returns:
Type
Promise.<Buffer>

(async) generateBlinds(nameHash, address, value) → {Promise.<Array.<Buffer>>}

Generate all nonces & blinds, save nonces.

Parameters:
Name Type Description
nameHash Buffer
address Address
value Amount
Source:
Returns:
Type
Promise.<Array.<Buffer>>

(async) generateNonce(nameHash, address, value) → {Promise.<Buffer>}

Generate nonce deterministically based on address (smallest pubkey), name hash, and bid value.

Parameters:
Name Type Description
nameHash Buffer
address Address
value Amount
Source:
Returns:
Type
Promise.<Buffer>

(async) generateNonces(nameHash, address, value) → {Promise.<Array.<Buffer>>}

Generate nonces deterministically for all keys (in multisig).

Parameters:
Name Type Description
nameHash Buffer
address Address
value Amount
Source:
Returns:
Type
Promise.<Array.<Buffer>>

(async) getAccount(acct) → {Promise.<(Account|null)>}

Retrieve an account from the database.

Parameters:
Name Type Description
acct Number | String
Source:
Returns:
Type
Promise.<(Account|null)>

(async) getAccountByAddress(address) → {Promise.<?Account>}

Get account by address.

Parameters:
Name Type Description
address Address
Source:
Returns:
Type
Promise.<?Account>

getAccountCreditIterByHeight(acct, optionsopt) → {AsyncGenerator.<Credit>}

Get credits iterator sorted by height.

Parameters:
Name Type Attributes Description
acct Number
options Object <optional>
Properties
Name Type Attributes Default Description
minHeight Number <optional>
0
maxHeight Number <optional>
UNCONFIRMED_HEIGHT
limit Number <optional>
-1
reverse Boolean <optional>
false
Source:
Returns:
Type
AsyncGenerator.<Credit>

getAccountCreditIterByValue(acct, optionsopt) → {AsyncGenerator.<Credit>}

Get credits iterator sorted by value.

Parameters:
Name Type Attributes Description
acct Number
options Object <optional>
Properties
Name Type Attributes Default Description
minValue Number <optional>
0
maxValue Number <optional>
MAX_MONEY
limit Number <optional>
-1
reverse Boolean <optional>
false
Source:
Returns:
Type
AsyncGenerator.<Credit>

(async) getAccountHashes(acct) → {Promise.<Array.<Hash>>}

Get all account address hashes.

Parameters:
Name Type Description
acct String | Number
Source:
Throws:

on non-existent account

Returns:
  • Returns Array.
Type
Promise.<Array.<Hash>>

(async) getAccountIndex(acct) → {Promise.<Number>}

Lookup the corresponding account name's index.

Parameters:
Name Type Description
acct String | Number

Account name/index.

Source:
Returns:
Type
Promise.<Number>

(async) getAccountName(index) → {Promise.<(String|null)>}

Lookup the corresponding account index's name.

Parameters:
Name Type Description
index String | Number

Account index.

Source:
Returns:
Type
Promise.<(String|null)>

(async) getAccountPaths(acct) → {Promise.<Array.<Path>>}

Get all account paths.

Parameters:
Name Type Description
acct String | Number
Source:
Returns:
Type
Promise.<Array.<Path>>

getAccounts() → {Promise.<Array.<String>>}

List account names and indexes from the db.

Source:
Returns:
  • Returns Array.
Type
Promise.<Array.<String>>

getAddressHashes(acctnullable) → {Promise.<Array.<Hash>>}

Get all wallet address hashes.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
Source:
Returns:
Type
Promise.<Array.<Hash>>

(async) getBalance(acctopt, nullable) → {Promise.<Balance>}

Get wallet balance.

Parameters:
Name Type Attributes Description
acct String | Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<Balance>

(async) getBid(nameHash, outpoint) → {Promise.<?BlindBid>}

Get bid

Parameters:
Name Type Description
nameHash Buffer
outpoint Outpoint
Source:
Returns:
Type
Promise.<?BlindBid>

(async) getBidByReveal(nameHash, outpoint) → {Promise.<?BlindBid>}

Get bid by reveal.

Parameters:
Name Type Description
nameHash Buffer
outpoint Outpoint

reveal outpoint

Source:
Returns:
Type
Promise.<?BlindBid>

(async) getBids(nameHashopt) → {Promise.<Array.<BlindBid>>}

Get all bids for name.

Parameters:
Name Type Attributes Description
nameHash Buffer <optional>
Source:
Returns:
Type
Promise.<Array.<BlindBid>>

(async) getBidsByName(nameopt) → {Promise.<Array.<BlindBid>>}

Get all bids for name.

Parameters:
Name Type Attributes Description
name String | Buffer <optional>
Source:
Returns:
Type
Promise.<Array.<BlindBid>>

(async) getBlind(blind) → {Promise.<BlindValue>}

Get a blind value if present.

Parameters:
Name Type Description
blind Buffer

Blind hash.

Source:
Returns:
Type
Promise.<BlindValue>

getBlock(height) → {Promise}

Get a block from the wallet.

Parameters:
Name Type Description
height Number
Source:
Returns:
  • Returns BlockRecord.
Type
Promise

getBlocks() → {Promise.<Array.<BlockRecord>>}

List blocks for the wallet.

Source:
Returns:
Type
Promise.<Array.<BlockRecord>>

getCoin(hash, index) → {Promise.<Coin>}

Get a coin from the wallet.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Promise.<Coin>

(async) getCoins(acctopt, nullable) → {Promise.<Array.<Coin>>}

Get all available coins.

Parameters:
Name Type Attributes Description
acct String | Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<Array.<Coin>>

getCoinView(tx) → {Promise.<CoinView>}

Get a coin viewpoint.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise.<CoinView>

getCredit(hash, index) → {Promise.<Credit>}

Get credit from the wallet.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Promise.<Credit>

(async) getCredits(acctopt, nullable) → {Promise.<Array.<Credit>>}

Get all available credits.

Parameters:
Name Type Attributes Description
acct String | Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<Array.<Credit>>

getDetails(hash) → {Promise.<Details>}

Get transaction details.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise.<Details>

(private) getID() → {Base58String}

Generate the wallet ID if none was passed in. It is represented as BLAKE2b(m/44->public|magic, 20) converted to an "address" with a prefix of 0x03be04 (WLT in base58).

Source:
Returns:
Type
Base58String

(async) getInputPaths(mtx) → {Promise}

Map input addresses to paths.

Parameters:
Name Type Description
mtx MTX
Source:
Returns:
  • Returns Path[].
Type
Promise

getJSON(unsafeopt, nullable, balanceopt, nullable) → {Object}

Convert the wallet to an object suitable for serialization.

Parameters:
Name Type Attributes Description
unsafe Boolean <optional>
<nullable>

Whether to include the master key in the JSON.

balance Balance <optional>
<nullable>
Source:
Returns:
Type
Object

(async) getKey(address) → {Promise}

Retrieve a single keyring by address.

Parameters:
Name Type Description
address Address | Hash
Source:
Returns:
Type
Promise

getLocked() → {Array.<Outpoint>}

Return an array of all locked outpoints.

Source:
Returns:
Type
Array.<Outpoint>

(async) getNames() → {Promise.<Array.<NameState>>}

Get all names.

Source:
Returns:
Type
Promise.<Array.<NameState>>

(async) getNameState(nameHash) → {Promise.<NameState>}

Get a name if present.

Parameters:
Name Type Description
nameHash Buffer
Source:
Returns:
Type
Promise.<NameState>

(async) getNameStateByName(name) → {Promise.<NameState>}

Get a name if present.

Parameters:
Name Type Description
name String | Buffer
Source:
Returns:
Type
Promise.<NameState>

(async) getOutputPaths(tx) → {Promise.<Array.<Path>>}

Map output addresses to paths.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise.<Array.<Path>>

(async) getPath(address) → {Promise.<(Path|null)>}

Get path by address hash.

Parameters:
Name Type Description
address Address | Hash
Source:
Returns:
Type
Promise.<(Path|null)>

(async) getPaths(acctnullable) → {Promise.<Array.<Path>>}

Get all wallet paths.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
Source:
Returns:
Type
Promise.<Array.<Path>>

(async) getPending(acctopt, nullable) → {Promise.<Array.<TXRecord>>}

Get all pending/unconfirmed transactions.

Parameters:
Name Type Attributes Description
acct String | Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) getPendingAncestors(tx) → {Promise.<BufferSet>}

Get pending ancestors up to the policy limit

Parameters:
Name Type Description
tx TX
Source:
Returns:
  • Returns {BufferSet} with Hash
Type
Promise.<BufferSet>

(async) getPrivateKey(address, passphrasenullable) → {Promise}

Retrieve a single keyring by address (with the private key reference).

Parameters:
Name Type Attributes Description
address Address | Hash
passphrase Buffer | String <nullable>
Source:
Returns:
Type
Promise

(async) getReveal(nameHash, outpoint) → {Promise.<?BidReveal>}

Get reveal.

Parameters:
Name Type Description
nameHash Buffer
outpoint Outpoint
Source:
Returns:
Type
Promise.<?BidReveal>

(async) getRevealByBid(nameHash, outpoint) → {Promise.<?BidReveal>}

Get reveal for bid.

Parameters:
Name Type Description
nameHash Buffer
outpoint Outpoint

bid outpoint

Source:
Returns:
Type
Promise.<?BidReveal>

(async) getReveals(nameHash) → {Promise.<Array.<BidReveal>>}

Get all reveals by name.

Parameters:
Name Type Description
nameHash Buffer
Source:
Returns:
Type
Promise.<Array.<BidReveal>>

(async) getRevealsByName(name) → {Promise.<Array.<BidReveal>>}

Get all reveals by name.

Parameters:
Name Type Description
name String | Buffer
Source:
Returns:
Type
Promise.<Array.<BidReveal>>

getSize() → {Number}

Calculate serialization size.

Source:
Returns:
Type
Number

(async) getSmartCoins(acctnullable) → {Promise.<Array.<Coin>>}

Get "smart" coins.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
Source:
Returns:
Type
Promise.<Array.<Coin>>

getSpentView(tx) → {Promise.<CoinView>}

Get a historical coin viewpoint.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise.<CoinView>

(private) getToken(nonce) → {Buffer}

Generate the wallet api key if none was passed in. It is represented as BLAKE2b(m/44'->private|nonce).

Parameters:
Name Type Description
nonce Number
Source:
Returns:
Type
Buffer

getTX(hash) → {Promise.<TXRecord>}

Get a transaction from the wallet.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise.<TXRecord>

(async) getUnspentCoin(hash, index) → {Promise.<Coin>}

Get an unspent coin from the wallet.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Promise.<Coin>

(async) getWalletCoinView(tx, viewopt, nullable) → {Promise.<WalletCoinView>}

Get a wallet coin viewpoint with HD paths.

Parameters:
Name Type Attributes Description
tx TX
view CoinView <optional>
<nullable>

Coins to be used in wallet coin viewpoint.

Source:
Returns:
Type
Promise.<WalletCoinView>

(async) hasAccount(acct) → {Promise.<Boolean>}

Test whether an account exists.

Parameters:
Name Type Description
acct Number | String
Source:
Returns:
Type
Promise.<Boolean>

(async) hasAddress(address) → {Promise.<Boolean>}

Test whether the wallet possesses an address.

Parameters:
Name Type Description
address Address | Hash
Source:
Returns:
Type
Promise.<Boolean>

(async) hasPath(address) → {Promise.<Boolean>}

Test whether the wallet contains a path.

Parameters:
Name Type Description
address Address | Hash
Source:
Returns:
Type
Promise.<Boolean>

hasPending(hash) → {Promise.<Boolean>}

Test whether the database has a pending transaction.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise.<Boolean>

(async) importAddress(acctnullable, address) → {Promise}

Import a keyring (will not exist on derivation chain). Rescanning must be invoked manually.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
address Address
Source:
Returns:
Type
Promise

(async) importKey(acctnullable, ring, passphrasenullable) → {Promise}

Import a keyring (will not exist on derivation chain). Rescanning must be invoked manually.

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
ring WalletKey
passphrase String | Buffer <nullable>
Source:
Returns:
Type
Promise

(async) importName(name) → {Promise}

Import a name. Rescanning must be invoked manually.

Parameters:
Name Type Description
name String
Source:
Returns:
Type
Promise

(async) increaseFee(hash, rate, passphrasenullable) → {Promise.<TX>}

Intentionally double-spend outputs by increasing fee for an existing transaction.

Parameters:
Name Type Attributes Description
hash Hash
rate Rate
passphrase String | Buffer <nullable>
Source:
Returns:
Type
Promise.<TX>

increment(b) → {void}

Increment the wid depth.

Parameters:
Name Type Description
b Batch
Source:
Returns:
Type
void

(async) init(options, passphraseopt, nullable) → {Promise}

Attempt to intialize the wallet (generating the first addresses along with the lookahead addresses). Called automatically from the walletdb.

Parameters:
Name Type Attributes Description
options Object
passphrase String | Buffer <optional>
<nullable>
Source:
Returns:
Type
Promise

inspect() → {Object}

Convert the wallet to a more inspection-friendly object.

Source:
Returns:
Type
Object

isLocked(coin) → {Boolean}

Test locked status of a single coin.

Parameters:
Name Type Description
coin Coin | Outpoint
Source:
Returns:
Type
Boolean

isOversizedBatch(mtx, witnessSize) → {Boolean}

Check batch MTX for excessive size

Parameters:
Name Type Description
mtx MTX
witnessSize Number
Source:
Returns:
Type
Boolean

(async) listHistory(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listHistoryAfter(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
hash Buffer
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listHistoryByTime(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
time Number

Time in seconds.

limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listHistoryFrom(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
hash Buffer
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listUnconfirmed(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listUnconfirmedAfter(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
hash Buffer
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listUnconfirmedByTime(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
time Number

Time in seconds.

limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) listUnconfirmedFrom(acctnullable, options) → {Promise.<Array.<TXRecord>>}

Parameters:
Name Type Attributes Description
acct String | Number <nullable>
options Object
Properties
Name Type Description
hash Buffer
limit Number
reverse Boolean
Source:
Returns:
Type
Promise.<Array.<TXRecord>>

(async) lock()

Lock the wallet, destroy decrypted key.

Source:

lockCoin(coin)

Lock a single coin.

Parameters:
Name Type Description
coin Coin | Outpoint
Source:

(async) makeBatch(actions, options) → {Promise.<MTX>}

Make a batch transaction with multiple actions.

Parameters:
Name Type Description
actions Array
options Object
Source:
Returns:
Type
Promise.<MTX>

(async) makeBid(name, value, lockup, acct, mtxopt, nullable, addropt, nullable) → {Promise.<MTX>}

Make a bid MTX.

Parameters:
Name Type Attributes Description
name String
value Number
lockup Number
acct Number | String
mtx MTX <optional>
<nullable>
addr Address <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async, private) makeCancel(name, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make a transfer-cancelling MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeClaim(name, options) → {Promise.<Claim>}

Make a claim proof.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<Claim>

(async) makeFakeClaim(name, optionsopt, nullable) → {Promise.<Claim>}

Make a claim proof.

Parameters:
Name Type Attributes Description
name String
options Object <optional>
<nullable>
Source:
Returns:
Type
Promise.<Claim>

(async, private) makeFinalize(name, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make a transfer-finalizing MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async, private) makeFinalizeAll(mtxnullable, witnessSizenullable) → {Promise.<MTX>}

Make a finazling MTX for all transferring names

Parameters:
Name Type Attributes Description
mtx MTX <nullable>
witnessSize Number <nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeOpen(name, acct, mtxopt, nullable) → {Promise.<MTX>}

Make a open MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeRedeem(name, acctopt, nullable, mtxopt, nullable) → {Promise.<MTX>}

Make a redeem MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <optional>
<nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeRedeemAll(mtxopt, nullable, witnessSizeopt, nullable) → {Promise.<MTX>}

Make a redeem MTX.

Parameters:
Name Type Attributes Description
mtx MTX <optional>
<nullable>
witnessSize Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async, private) makeRenewal(name, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make a renewal MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeRenewalAll(mtxnullable, witnessSizenullable) → {Promise.<MTX>}

Make a renewal MTX for all expiring names.

Parameters:
Name Type Attributes Description
mtx MTX <nullable>
witnessSize Number <nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeReveal(name, acctopt, nullable, mtxopt, nullable) → {Promise.<MTX>}

Make a reveal MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <optional>
<nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeRevealAll(mtxopt, nullable, witnessSizeopt, nullable) → {Promise.<MTX>}

Make a reveal MTX.

Parameters:
Name Type Attributes Description
mtx MTX <optional>
<nullable>
witnessSize Number <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeRevoke(name, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make a revoke MTX.

Parameters:
Name Type Attributes Description
name String
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) makeTransfer(name, address, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make a transfer MTX.

Parameters:
Name Type Attributes Description
name String
address Address
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

makeTX(outputs, mtxopt, nullable) → {MTX}

Make a transaction with normal outputs.

Parameters:
Name Type Attributes Description
outputs Array.<Object>

See MTX#addOutput

mtx MTX <optional>
<nullable>

MTX to modify instead of new one.

Source:
Returns:
  • MTX with populated outputs.
Type
MTX

(async) makeUpdate(name, resource, acctnullable, mtxopt, nullable) → {Promise.<MTX>}

Make an update MTX.

Parameters:
Name Type Attributes Description
name String
resource Resource
acct Number | String <nullable>
mtx MTX <optional>
<nullable>
Source:
Returns:
Type
Promise.<MTX>

(async) modifyAccount(acct, options, passphraseopt) → {Promise.<Account>}

Modify an account. Requires passphrase if master key is encrypted.

Parameters:
Name Type Attributes Description
acct String | Number
options Object
passphrase String <optional>
Source:
Returns:
Type
Promise.<Account>

(async) open() → {Promise}

Open wallet (done after retrieval).

Source:
Returns:
Type
Promise

(async, private) readPath(address) → {Promise.<(Path|null)>}

Get path by address hash (without account name).

Parameters:
Name Type Description
address Address | Hash
Source:
Returns:
Type
Promise.<(Path|null)>

(async) recalculateBalances() → {Promise}

Recalculate balances

Source:
Returns:
Type
Promise

(async) receiveAddress(acctopt) → {Promise.<Address>}

Get current receive address.

Parameters:
Name Type Attributes Default Description
acct String | Number <optional>
0
Source:
Returns:
Type
Promise.<Address>

(async) receiveDepth(acctopt) → {Promise.<Number>}

Get current receive depth.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<Number>

(async) receiveKey(acctopt) → {Promise.<WalletKey>}

Get current receive key.

Parameters:
Name Type Attributes Default Description
acct Number <optional>
0
Source:
Returns:
Type
Promise.<WalletKey>

(async) remove(hash) → {Promise.<?Details>}

Remove a wallet transaction.

Parameters:
Name Type Description
hash Hash
Source:
Returns:
Type
Promise.<?Details>

(async) removeSharedKey(acct, key) → {Promise.<Boolean>}

Remove a public account key from the wallet (multisig).

Parameters:
Name Type Description
acct Number | String
key HDPublicKey
Source:
Returns:
Type
Promise.<Boolean>

(async) rename(id) → {Promise}

Rename the wallet.

Parameters:
Name Type Description
id String
Source:
Returns:
Type
Promise

(async) renameAccount(acct, name) → {Promise}

Rename account.

Parameters:
Name Type Description
acct String
name String
Source:
Returns:
Type
Promise

(async) resend() → {Promise}

Resend pending wallet transactions.

Source:
Returns:
Type
Promise

(async) retoken(passphrasenullable) → {Promise.<Buffer>}

Generate a new token.

Parameters:
Name Type Attributes Description
passphrase String | Buffer <nullable>
Source:
Returns:
Type
Promise.<Buffer>

(async) revert(height) → {Promise.<Number>}

Revert a block.

Parameters:
Name Type Description
height Number
Source:
Returns:
  • number of txs removed.
Type
Promise.<Number>

save(b) → {void}

Save the wallet to the database. Necessary when address depth and keys change.

Parameters:
Name Type Description
b Batch
Source:
Returns:
Type
void

(async) select(mtx, optionsopt) → {Promise.<CoinSelector>}

Select coins for the transaction.

Parameters:
Name Type Attributes Description
mtx MTX
options Object <optional>
Source:
Returns:
Type
Promise.<CoinSelector>

(async) send(options) → {Promise.<TX>}

Build a transaction, fill it with outputs and inputs, sort the members according to BIP69, set locktime, sign and broadcast. Doing this all in one go prevents coins from being double spent.

Parameters:
Name Type Description
options Object

See options.

Properties
Name Type Description
outputs Array.<Object>

See MTX#addOutput.

passphrase String
Source:
Returns:
Type
Promise.<TX>

(async) sendBatch(actions, options) → {Promise.<TX>}

Create and send a batch transaction with multiple actions.

Parameters:
Name Type Description
actions Array
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendBid(name, value, lockup, options) → {Promise.<TX>}

Create and send a bid MTX.

Parameters:
Name Type Description
name String
value Number
lockup Number
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendCancel(name, options) → {Promise.<TX>}

Create and send a cancel MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendClaim(name, options) → {Promise.<Claim>}

Create and send a claim proof.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<Claim>

(async) sendFakeClaim(name, options)

Create and send a claim proof.

Parameters:
Name Type Description
name String
options Object
Source:

(async) sendFinalize(name, options) → {Promise.<TX>}

Create and send a finalize MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendMTX(mtx, passphrase) → {Promise.<TX>}

Sign and send a (templated) mutable transaction.

Parameters:
Name Type Description
mtx MTX
passphrase String
Source:
Returns:
Type
Promise.<TX>

(async) sendOpen(name, options) → {Promise.<TX>}

Create and send an open MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendRedeem(name, options) → {Promise.<TX>}

Create and send a redeem MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendRedeemAll(options) → {Promise.<TX>}

Create and send a redeem all MTX with a lock.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendRenewal(name, options) → {Promise.<TX>}

Create and send a renewal MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendReveal(name, options) → {Promise.<TX>}

Create and send a bid MTX.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendRevealAll(options) → {Promise.<TX>}

Create and send a bid MTX.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendRevoke(name, options) → {Promise.<TX>}

Create and send a revoke MTX with a lock.

Parameters:
Name Type Description
name String
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendTransfer(name, address, options) → {Promise.<TX>}

Create and send a transfer MTX with a lock.

Parameters:
Name Type Description
name String
address Address
options Object
Source:
Returns:
Type
Promise.<TX>

(async) sendUpdate(name, resource, options) → {Promise.<TX>}

Create and send an update MTX with a lock.

Parameters:
Name Type Description
name String
resource Resource
options Object
Source:
Returns:
Type
Promise.<TX>

(async) setPassphrase(passphrase, old) → {Promise}

Change or set master key's passphrase.

Parameters:
Name Type Description
passphrase String | Buffer
old String | Buffer
Source:
Returns:
Type
Promise

(async) sign(mtx, passphrase) → {Promise}

Build input scripts and sign inputs for a transaction. Only attempts to build/sign inputs that are redeemable by this wallet.

Parameters:
Name Type Description
mtx MTX
passphrase String | Buffer
Source:
Returns:
  • Returns Number (total number of inputs scripts built and signed).
Type
Promise

(async) syncOutputDepth(tx) → {Promise.<Array.<WalletKey>>}

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
tx TX
Source:
Returns:
  • derived rings.
Type
Promise.<Array.<WalletKey>>

(async) template(mtx) → {Promise.<Number>}

Build input scripts templates for a transaction (does not sign, only creates signature slots). Only builds scripts for inputs that are redeemable by this wallet.

Parameters:
Name Type Description
mtx MTX
Source:
Returns:
  • total number of scripts built.
Type
Promise.<Number>

toDetails(wtx) → {Promise.<Details>}

Convert transaction to transaction details.

Parameters:
Name Type Description
wtx TXRecord
Source:
Returns:
Type
Promise.<Details>

toJSON() → {Object}

Convert the wallet to an object suitable for serialization.

Source:
Returns:
Type
Object

unlock(passphrase, timeoutopt, nullable)

Unlock the key for timeout seconds.

Parameters:
Name Type Attributes Default Description
passphrase Buffer | String
timeout Number <optional>
<nullable>
60
Source:

unlockCoin(coin) → {Boolean}

Unlock a single coin.

Parameters:
Name Type Description
coin Coin | Outpoint
Source:
Returns:
Type
Boolean

unlockCoins()

Unlock all locked coins.

Source:

(async) zap(acctnullable, age) → {Promise.<Number>}

Zap stale TXs from wallet.

Parameters:
Name Type Attributes Description
acct Number | String <nullable>
age Number

Age threshold (unix time, default=72 hours).

Source:
Returns:
Type
Promise.<Number>