Class: CoinSelector

primitives.CoinSelector

new CoinSelector(tx, optionsnullable)

Coin Selector

Parameters:
Name Type Attributes Description
tx TX
options Object <nullable>
Source:

Members

(static, constant) FEE_RATE :Amount

Default fee rate for coin selection.

Type:
Default Value:
  • 10000
Source:

(static, constant) MAX_FEE :Amount

Maximum fee to allow after coin selection.

Type:
Source:

(static, constant) MIN_FEE :Amount

Minimum fee to start with during coin selection.

Type:
Default Value:
  • 10000
Source:

select

Initiate selection from coins.

Source:

selectEstimate

Initialize selection based on size estimate.

Source:

Methods

(private) fromOptions(options)

Initialize selector options.

Parameters:
Name Type Description
options Object
Source:

fund()

Fund the transaction with more coins if the output value + fee total was updated.

Source:

getFee(size) → {Amount}

Get the current fee based on a size.

Parameters:
Name Type Description
size Number
Source:
Returns:
Type
Amount

init(coins)

Initialize the selector with coins to select from.

Parameters:
Name Type Description
coins Array:.<Coin:>
Source:

isFull() → {Boolean}

Test whether the selector has completely funded the transaction.

Source:
Returns:
Type
Boolean

isSpendable(coin) → {Boolean}

Test whether a coin is spendable with regards to the options.

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

selectHard()

Initiate selection based on a hard fee.

Source:

total() → {Amount}

Calculate total value required.

Source:
Returns:
Type
Amount