Class: Output

primitives~Output(optionsnullable)

Represents a transaction output.

Constructor

new Output(optionsnullable)

Create an output.

Parameters:
Name Type Attributes Description
options Object <nullable>
Properties:
Name Type Description
value Amount
script Script
Source:

Methods

(static) fromJSON(json) → {Output}

Instantiate an Output from a jsonified output object.

Parameters:
Name Type Description
json Object

The jsonified output object.

Source:
Returns:
Type
Output

(static) fromOptions(options) → {Output}

Instantiate output from options object.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
Output

(static) fromRaw(data, encnullable) → {Output}

Instantiate an output from a serialized Buffer.

Parameters:
Name Type Attributes Description
data Buffer
enc String <nullable>

Encoding, can be 'hex' or null.

Source:
Returns:
Type
Output

(static) fromReader(br) → {Output}

Instantiate an output from a buffer reader.

Parameters:
Name Type Description
br BufferReader
Source:
Returns:
Type
Output

(static) fromScript(script, value) → {Output}

Instantiate output from script/value pair.

Parameters:
Name Type Description
script Script | Address
value Amount
Source:
Returns:
Type
Output

(static) isOutput(obj) → {Boolean}

Test an object to see if it is an Output.

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

clone() → {Output}

Clone the output.

Source:
Returns:
Type
Output

compare(output) → {Number}

Compare against another output (BIP69).

Parameters:
Name Type Description
output Output
Source:
Returns:
Type
Number

equals(output) → {Boolean}

Test equality against another output.

Parameters:
Name Type Description
output Output
Source:
Returns:
Type
Boolean

(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) 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) fromScript(script, value) → {Output}

Inject properties from script/value pair.

Parameters:
Name Type Description
script Script | Address
value Amount
Source:
Returns:
Type
Output

getAddress() → {Address}

Get the address.

Source:
Returns:

address

Type
Address

getDustThreshold(ratenullable) → {Amount}

Calculate the dust threshold for this output, based on serialize size and rate.

Parameters:
Name Type Attributes Description
rate Rate <nullable>
Source:
Returns:
Type
Amount

getHash(encnullable) → {Hash}

Get the address hash.

Parameters:
Name Type Attributes Description
enc String <nullable>
Source:
Returns:

hash

Type
Hash

getJSON(network) → {Object}

Convert the output to an object suitable for JSON serialization.

Parameters:
Name Type Description
network Network
Source:
Returns:
Type
Object

getSize() → {Number}

Calculate size of serialized output.

Source:
Returns:
Type
Number

getType() → {ScriptType}

Get the script type as a string.

Source:
Returns:

type

Type
ScriptType

inspectSymbol() → {Object}

Convert the input to a more user-friendly object.

Source:
Returns:
Type
Object

isDust(ratenullable) → {Boolean}

Test whether the output should be considered dust.

Parameters:
Name Type Attributes Description
rate Rate <nullable>
Source:
Returns:
Type
Boolean

toJSON() → {Object}

Convert the output to an object suitable for JSON serialization.

Source:
Returns:
Type
Object

toRaw(encnullable) → {Buffer|String}

Serialize the output.

Parameters:
Name Type Attributes Description
enc String <nullable>

Encoding, can be 'hex' or null.

Source:
Returns:
Type
Buffer | String

toWriter(bw)

Write the output to a buffer writer.

Parameters:
Name Type Description
bw BufferWriter
Source: