Constructor
new Input(options)
Create transaction input.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
Properties:
Name | Type | Description |
---|---|---|
prevout |
Outpoint | Outpoint. |
script |
Script | Input script / scriptSig. |
sequence |
Number | nSequence. |
witness |
Witness | Witness (empty if not present). |
- Source:
Methods
(static) fromCoin(coin) → {Input}
Instantiate input from coin.
Parameters:
Name | Type | Description |
---|---|---|
coin |
Coin |
- Source:
Returns:
- Type
- Input
(static) fromJSON(json) → {Input}
Instantiate an Input from a jsonified input object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | The jsonified input object. |
- Source:
Returns:
- Type
- Input
(static) fromOptions(options) → {Input}
Instantiate an Input from options object.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- Input
(static) fromOutpoint(outpoint) → {Input}
Instantiate input from outpoint.
Parameters:
Name | Type | Description |
---|---|---|
outpoint |
Outpoint |
- Source:
Returns:
- Type
- Input
(static) fromRaw(data, encnullable) → {Input}
Instantiate an input from a serialized Buffer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
Buffer | ||
enc |
String |
<nullable> |
Encoding, can be |
- Source:
Returns:
- Type
- Input
(static) fromReader(br) → {Input}
Instantiate an input from a buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
Returns:
- Type
- Input
(static) fromTX(tx, index) → {Input}
Instantiate input from tx.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
index |
Number |
- Source:
Returns:
- Type
- Input
(static) isInput(obj) → {Boolean}
Test an object to see if it is an Input.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
clone() → {Input}
Clone the input.
- Source:
Returns:
- Type
- Input
compare(input) → {Number}
Compare against another input (BIP69).
Parameters:
Name | Type | Description |
---|---|---|
input |
Input |
- Source:
Returns:
- Type
- Number
equals(input) → {Boolean}
Test equality against another input.
Parameters:
Name | Type | Description |
---|---|---|
input |
Input |
- Source:
Returns:
- Type
- Boolean
format(coinnullable) → {Object}
Convert the input to a more user-friendly object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
- Source:
Returns:
- Type
- Object
(private) fromCoin(coin)
Inject properties from coin.
Parameters:
Name | Type | Description |
---|---|---|
coin |
Coin |
- Source:
(private) fromJSON(json)
Inject properties from a JSON object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
(private) fromOptions(options)
Inject properties from options object.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
(private) fromOutpoint(outpoint)
Inject properties from outpoint.
Parameters:
Name | Type | Description |
---|---|---|
outpoint |
Outpoint |
- Source:
fromRaw(data)
Inject properties from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
(private) fromReader(br)
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
(private) fromTX(tx, index)
Inject properties from transaction.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
index |
Number |
- Source:
getAddress(coinnullable) → (nullable) {Address}
Get the previous output script's address. Will "guess" based on the input script and/or witness if coin is not available.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
- Source:
Returns:
addr
- Type
- Address
getHash(coinnullable, encnullable) → {Hash}
Get the address hash.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
|
enc |
String |
<nullable> |
- Source:
Returns:
hash
- Type
- Hash
getJSON(network, coin) → {Object}
Convert the input to an object suitable for JSON serialization. Note that the hashes will be reversed to abide by bitcoind's legacy of little-endian uint256s.
Parameters:
Name | Type | Description |
---|---|---|
network |
Network | |
coin |
Coin |
- Source:
Returns:
- Type
- Object
getRedeem(coinnullable) → (nullable) {Script}
Get the redeem script. Will attempt to resolve nested redeem scripts if witnessscripthash is behind a scripthash.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
- Source:
Returns:
Redeem script.
- Type
- Script
getSize() → {Number}
Calculate size of serialized input.
- Source:
Returns:
- Type
- Number
getSubtype(coinnullable) → {String}
Get the redeem script type.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
- Source:
Returns:
subtype
- Type
- String
getType(coinnullable) → {ScriptType}
Get the previous output script type as a string. Will "guess" based on the input script and/or witness if coin is not available.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coin |
Coin |
<nullable> |
- Source:
Returns:
type
- Type
- ScriptType
inspectSymbol() → {Object}
Convert the input to a more user-friendly object.
- Source:
Returns:
- Type
- Object
isCoinbase() → {Boolean}
Test to see if outpoint is null.
- Source:
Returns:
- Type
- Boolean
isFinal() → {Boolean}
Test to see if nSequence is equal to uint32max.
- Source:
Returns:
- Type
- Boolean
isRBF() → {Boolean}
Test to see if nSequence is less than 0xfffffffe.
- Source:
Returns:
- Type
- Boolean
toJSON() → {Object}
Convert the input to an object suitable for JSON serialization.
- Source:
Returns:
- Type
- Object
toRaw(encnullable) → {Buffer|String}
Serialize the input.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
enc |
String |
<nullable> |
Encoding, can be |
- Source:
Returns:
- Type
- Buffer | String
toWriter(bw)
Write the input to a buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufferWriter |
- Source: