@pokt-network/pocket-js
Version:
Pocket-js core package with the main functionalities to interact with the Pocket Network.
50 lines • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StdTx = void 0;
var amino_js_1 = require("@pokt-network/amino-js");
/**
* Represents a StdTx object to send a Transaction
*/
var StdTx = /** @class */ (function () {
/**
* @param stdSignDoc {StdSignDoc} The model form which the bytes for signature were produced
* @param signature {TxSignature} The signature for this transaction
*/
function StdTx(stdSignDoc, signature) {
this.AMINO_TYPE = "posmint/StdTx";
this.stdSignDoc = stdSignDoc;
this.signature = signature;
}
/**
* Marshal the StdTx class properties with amino
* @returns {Buffer} - Buffer representation of the marshal object.
* @memberof StdTx
*/
StdTx.prototype.marshalAmino = function () {
// Get the txMsg object
var txMsg = this.stdSignDoc.msg.toStdTxMsgObj();
// Get the signature object
var txSignature = this.signature.toPosmintStdSignature();
// Create StdTx object
var stdTx = {
msg: txMsg,
fee: [{
amount: this.stdSignDoc.fee,
denom: this.stdSignDoc.feeDenom.toLowerCase()
}],
signature: txSignature,
memo: this.stdSignDoc.memo,
entropy: this.stdSignDoc.entropy
};
// Marshal PosmintTx
var encodedPosmintTX = amino_js_1.marshalPosmintTx({
type: this.AMINO_TYPE,
value: stdTx
});
// Return buffer from marshaled PosmintTx
return Buffer.from(encodedPosmintTX);
};
return StdTx;
}());
exports.StdTx = StdTx;
//# sourceMappingURL=std-tx.js.map