hsd
hsd copied to clipboard
feature request: covenant library helper functions
Replaces https://github.com/handshake-org/hsd/issues/619
For library users I think we can make covenants easier to navigate. For example, we could add getters for all the covenant items:
nameHash
height
renewalBlock
resource
rawName
addressVersion
addressHash
Example:
// OPEN
const rawName = tx.output[0].covenant.rawName;
// "proofofconcept"
console.log(rawName)
Getter functions could throw or return null
if a datum is requested that is not part of that covenant's items. Setters could be interesting too, or even "options" functions like:
covenant.makeOpen({
nameHash,
height
})
This would be really useful. Currently I have to keep a tab open for https://github.com/namebasehq/handshake-types to look at indexes and figure out how to parse it every time.