UNPKG

navio-blsct

Version:

TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.

48 lines (47 loc) 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CTxIn = void 0; const blsct_1 = require("./blsct"); const managedObj_1 = require("./managedObj"); const script_1 = require("./script"); const ctxId_1 = require("./ctxId"); class CTxIn extends managedObj_1.ManagedObj { constructor(obj) { super(obj); } value() { return (0, blsct_1.castToCTxIn)(this.obj); } getPrevOutHash() { const obj = (0, blsct_1.getCTxInPrevOutHash)(this.value()); return ctxId_1.CTxId.fromObj(obj); } getPrevOutN() { return (0, blsct_1.getCTxInPrevOutN)(this.value()); } getScriptsig() { const obj = (0, blsct_1.getCTxInScriptSig)(this.value()); return script_1.Script.fromObj(obj); } getSequence() { return (0, blsct_1.getCTxInSequence)(this.value()); } getScriptWitness() { const obj = (0, blsct_1.getCTxInScriptWitness)(this.value()); return script_1.Script.fromObj(obj); } serialize() { const buf = (0, blsct_1.castToUint8_tPtr)(this.value()); return (0, blsct_1.toHex)(buf, this.size()); } static deserialize(hex) { if (hex.length % 2 !== 0) { hex = `0${hex}`; } const obj = (0, blsct_1.hexToMallocedBuf)(hex); const x = new CTxIn(obj); x.objSize = hex.length / 2; return x; } } exports.CTxIn = CTxIn;