Constructor
new Covenant(typeopt, itemsopt)
Create a covenant.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
rules.types | Object |
<optional> |
|
items |
Array.<Buffer> |
<optional> |
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:
fromJSON(json) → {this}
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
CovenantJSON |
- Source:
Returns:
- Type
- this
fromOptions(typeopt, itemsopt) → {this}
Inject properties from options object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
rules.types | Object |
<optional> |
|
items |
Array.<Buffer> |
<optional> |
- Source:
Returns:
- Type
- this
fromString(items) → {this}
Inject items from string.
Parameters:
Name | Type | Description |
---|---|---|
items |
String | Array.<String> |
- Source:
Returns:
- Type
- this
get(index) → {Buffer}
Get an item.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number |
- Source:
Returns:
- Type
- Buffer
getHash(index) → {Hash}
Get a hash.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number |
- Source:
Returns:
- Type
- Hash
getJSON()
Convert covenant to a hex string.
- Source:
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
inject(covenant) → {this}
Inject properties from covenant. Used for cloning.
Parameters:
Name | Type | Description |
---|---|---|
covenant |
this |
- Source:
Returns:
- Type
- this
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) → {this}
Push an item.
Parameters:
Name | Type | Description |
---|---|---|
item |
Buffer |
- Source:
Returns:
- Type
- this
pushHash(hash) → {Covenant}
Push a hash.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Type
- Covenant
pushString(str) → {Covenant}
Push a string.
Parameters:
Name | Type | Description |
---|---|---|
str |
String |
- Source:
Returns:
- Type
- Covenant
pushU8(num) → {Covenant}
Push a uint8.
Parameters:
Name | Type | Description |
---|---|---|
num |
Number |
- Source:
Returns:
- Type
- Covenant
pushU32(num) → {Covenant}
Push a uint32.
Parameters:
Name | Type | Description |
---|---|---|
num |
Number |
- Source:
Returns:
- Type
- Covenant
read(br) → {this}
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
bio.BufferReader |
- Source:
Returns:
- Type
- this
set(index, item) → {Covenant}
Set an item.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | |
item |
Buffer |
- Source:
Returns:
- Type
- Covenant
setBid(nameHash, start, rawName, blind) → {Covenant}
Set covenant to BID.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
start |
Number | |
rawName |
Buffer | |
blind |
Hash |
- Source:
Returns:
- Type
- Covenant
setClaim(nameHash, height, rawName, flags, commitHash, commitHeight) → {Covenant}
Set covenant to CLAIM.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
rawName |
Buffer | |
flags |
Number | |
commitHash |
Hash | |
commitHeight |
Number |
- Source:
Returns:
- Type
- Covenant
setFinalize(nameHash, height, rawName, flags, claimed, renewals, blockHash) → {Covenant}
Set covenant to REVOKE.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
rawName |
Buffer | |
flags |
Number | |
claimed |
Number | |
renewals |
Number | |
blockHash |
Hash |
- Source:
Returns:
- Type
- Covenant
setNone() → {Covenant}
Set covenant to NONE.
- Source:
Returns:
- Type
- Covenant
setOpen(nameHash, rawName) → {Covenant}
Set covenant to OPEN.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
rawName |
Buffer |
- Source:
Returns:
- Type
- Covenant
setRedeem(nameHash, height) → {Covenant}
Set covenant to REDEEM.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number |
- Source:
Returns:
- Type
- Covenant
setRegister(nameHash, height, record, blockHash) → {Covenant}
Set covenant to REGISTER.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
record |
Buffer | |
blockHash |
Hash |
- Source:
Returns:
- Type
- Covenant
setRenew(nameHash, height, blockHash) → {Covenant}
Set covenant to RENEW.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
blockHash |
Hash |
- Source:
Returns:
- Type
- Covenant
setReveal(nameHash, height, nonce) → {Covenant}
Set covenant to REVEAL.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
nonce |
Hash |
- Source:
Returns:
- Type
- Covenant
setRevoke(nameHash, height) → {Covenant}
Set covenant to REVOKE.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number |
- Source:
Returns:
- Type
- Covenant
setTransfer(nameHash, height, address) → {Covenant}
Set covenant to TRANSFER.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
address |
Address |
- Source:
Returns:
- Type
- Covenant
setUpdate(nameHash, height, resource) → {Covenant}
Set covenant to UPDATE.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Hash | |
height |
Number | |
resource |
Buffer |
- Source:
Returns:
- Type
- Covenant
test(filter) → {Boolean}
Test the covenant against a bloom filter.
Parameters:
Name | Type | Description |
---|---|---|
filter |
BloomFilter |
- 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) → {BufioWriter}
Write covenant to a buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufioWriter |
- Source:
Returns:
- Type
- BufioWriter