Constructor
new CoinSelector(mtx, source, optionsopt, nullable)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mtx |
MTX | ||
source |
AbstractCoinSource | ||
options |
CoinSelectorOptions |
<optional> <nullable> |
Properties:
Name | Type | Description |
---|---|---|
tx |
MTX | clone of the original mtx. |
view |
CoinView | reference to the original view. |
- Source:
Members
(static, constant) FEE_RATE :Amount
Default fee rate for coin selection.
Type:
- Default Value:
- 10000
- Source:
(static, constant) MIN_FEE :Amount
Minimum fee to start with during coin selection.
Type:
- Default Value:
- 10000
- Source:
chosen :Array.<Coin>
Type:
- Array.<Coin>
- Source:
inputs :BufferMap.<Number>
Type:
- BufferMap.<Number>
- Source:
tx :MTX
Type:
- MTX
- Source:
view :CoinView
Type:
- CoinView
- Source:
Methods
fromOptions(optionsopt) → {this}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
CoinSelectorOptions |
<optional> |
- Source:
Returns:
- Type
- this
(async) fund() → {Promise.<void>}
Fund the transaction with more
coins if the output value + fee
total was updated.
- Source:
Returns:
- Type
- Promise.<void>
getFee(size) → {AmountValue}
Get the current fee based on a size.
Parameters:
Name | Type | Description |
---|---|---|
size |
Number |
- Source:
Returns:
- Type
- AmountValue
init()
Initialize the selector with coins to select from.
- Source:
(private) injectInputs()
Attempt to inject existing inputs.
- Source:
isFull() → {Boolean}
Test whether filler 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
(async) select() → {Promise.<this>}
Fill the transaction with inputs.
- Source:
Returns:
- Type
- Promise.<this>
(async) selectEstimate()
Initialize selection based on size estimate.
- Source:
(async) selectHard() → {Promise.<void>}
Collect coins for the transaction.
- Source:
Returns:
- Type
- Promise.<void>
total() → {AmountValue}
Calculate total value required.
- Source:
Returns:
- Type
- AmountValue