Class: Covenant

primitives.Covenant()

Covenant

Constructor

new Covenant()

Create a covenant.

Properties:
Name Type Description
type Number
items Array.<Buffer>
length Number
Source:

Methods

(static) fromArray(items) → {Covenant}

Insantiate covenant from an array of buffers.

Parameters:
Name Type Description
items Array.<Buffer>
Source:
Returns:
Type
Covenant

(static) isCovenant(obj) → {Boolean}

Test an object to see if it is a covenant.

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

encode() → {Buffer}

Encode covenant.

Source:
Returns:
Type
Buffer

format() → {String}

Inspect a covenant object.

Source:
Returns:
Type
String

(private) fromArray(items)

Inject properties from an array of buffers.

Parameters:
Name Type Description
items Array.<Buffer>
Source:

(private) fromJSON(json)

Inject properties from json object.

Parameters:
Name Type Description
json String
Source:

(private) fromOptions(options)

Inject properties from options object.

Parameters:
Name Type Description
options Object
Source:

(private) fromString(items)

Inject items from string.

Parameters:
Name Type Description
items String | Array.<String>
Source:

get(index) → {Buffer}

Get an item.

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

getHash(index) → {Buffer}

Get a hash.

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

getJSON() → {String}

Convert covenant to a hex string.

Source:
Returns:
Type
String

getSize() → {Number}

Calculate size of the covenant excluding the varint size bytes.

Source:
Returns:
Type
Number

getString(index) → {String}

Get a string.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
String

getU8(index) → {Number}

Get a uint8.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Number

getU32(index) → {Number}

Get a uint32.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Number

getVarSize() → {Number}

Calculate size of the covenant including the varint size bytes.

Source:
Returns:
Type
Number

indexOf(data) → {Number}

Find a data element in a covenant.

Parameters:
Name Type Description
data Buffer

Data element to match against.

Source:
Returns:

Index (-1 if not present).

Type
Number

(private) inject(covenant) → {Covenant}

Inject properties from covenant. Used for cloning.

Parameters:
Name Type Description
covenant Covenant
Source:
Returns:
Type
Covenant

isBid() → {Boolean}

Test whether the covenant is a bid.

Source:
Returns:
Type
Boolean

isClaim() → {Boolean}

Test whether the covenant is a claim.

Source:
Returns:
Type
Boolean

isDustworthy() → {Boolean}

Test whether a covenant type should be considered subject to the dust policy rule.

Source:
Returns:
Type
Boolean

isFinalize() → {Boolean}

Test whether the covenant is a finalize.

Source:
Returns:
Type
Boolean

isKnown() → {Boolean}

Test whether the covenant is known.

Source:
Returns:
Type
Boolean

isLinked() → {Boolean}

Test whether a covenant should be considered "linked".

Source:
Returns:
Type
Boolean

isName() → {Boolean}

Test whether the covenant is name-related.

Source:
Returns:
Type
Boolean

isNone() → {Boolean}

Test whether the covenant is a payment.

Source:
Returns:
Type
Boolean

isNonspendable() → {Boolean}

Test whether a coin should be considered unspendable in the coin selector.

Source:
Returns:
Type
Boolean

isOpen() → {Boolean}

Test whether the covenant is an open.

Source:
Returns:
Type
Boolean

isRedeem() → {Boolean}

Test whether the covenant is a redeem.

Source:
Returns:
Type
Boolean

isRegister() → {Boolean}

Test whether the covenant is a register.

Source:
Returns:
Type
Boolean

isRenew() → {Boolean}

Test whether the covenant is a renewal.

Source:
Returns:
Type
Boolean

isReveal() → {Boolean}

Test whether the covenant is a reveal.

Source:
Returns:
Type
Boolean

isRevoke() → {Boolean}

Test whether the covenant is a revocation.

Source:
Returns:
Type
Boolean

isTransfer() → {Boolean}

Test whether the covenant is a transfer.

Source:
Returns:
Type
Boolean

isUnknown() → {Boolean}

Test whether the covenant is unknown.

Source:
Returns:
Type
Boolean

isUnspendable() → {Boolean}

Test whether the covenant is unspendable.

Source:
Returns:
Type
Boolean

isUpdate() → {Boolean}

Test whether the covenant is an update.

Source:
Returns:
Type
Boolean

push(item)

Push an item.

Parameters:
Name Type Description
item Buffer
Source:

pushHash(hash)

Push a hash.

Parameters:
Name Type Description
hash Buffer
Source:

pushString(str)

Push a string.

Parameters:
Name Type Description
str String
Source:

pushU8(num)

Push a uint8.

Parameters:
Name Type Description
num Number
Source:

pushU32(num)

Push a uint32.

Parameters:
Name Type Description
num Number
Source:

(private) read(br)

Inject properties from buffer reader.

Parameters:
Name Type Description
br BufferReader
Source:

set(index, item) → {Buffer}

Set an item.

Parameters:
Name Type Description
index Number
item Buffer
Source:
Returns:
Type
Buffer

test(filter) → {Boolean}

Test the covenant against a bloom filter.

Parameters:
Name Type Description
filter Bloom
Source:
Returns:
Type
Boolean

toArray() → {Array.<Buffer>}

Convert covenant to an array of buffers.

Source:
Returns:
Type
Array.<Buffer>

toString() → {String}

Convert the covenant to a string.

Source:
Returns:
Type
String

write(bw)

Write covenant to a buffer writer.

Parameters:
Name Type Description
bw BufferWriter
Source: