UNPKG

dpos-offline

Version:

Offline Signing Transactions for DPOS Blockchains

52 lines (51 loc) 1.84 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var base_v2_1 = require("./base_v2"); var RiseSendV2TxCodec = /** @class */ (function (_super) { __extends(RiseSendV2TxCodec, _super); function RiseSendV2TxCodec() { return _super.call(this, 10, 'send-v2') || this; } RiseSendV2TxCodec.prototype.transform = function (from) { var s = _super.prototype.transform.call(this, from); s.amount = from.amount; if (from.memo) { s.asset = { data: from.memo, }; } s.recipientId = from.recipient; return s; }; RiseSendV2TxCodec.prototype.calcFees = function (tx) { var memoLength = (tx.memo || []).length; return 10000000 + 1000000 * memoLength; }; RiseSendV2TxCodec.prototype.assetBytes = function (tx) { if (tx.asset) { return tx.asset.data; } return Buffer.alloc(0); }; RiseSendV2TxCodec.prototype.assetFromBytes = function (buf) { if (buf.length === 0) { return null; } return { data: buf }; }; return RiseSendV2TxCodec; }(base_v2_1.BaseRiseV2Codec)); exports.RiseSendV2TxCodec = RiseSendV2TxCodec;