UNPKG

dpos-offline

Version:

Offline Signing Transactions for DPOS Blockchains

43 lines (42 loc) 1.6 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_lisk_1 = require("./base_lisk"); var LiskSendTxCodec = /** @class */ (function (_super) { __extends(LiskSendTxCodec, _super); function LiskSendTxCodec() { return _super.call(this, 0, 'send') || this; } LiskSendTxCodec.prototype.calcFees = function (tx) { return 10000000; }; LiskSendTxCodec.prototype.transform = function (from) { var s = _super.prototype.transform.call(this, from); s.amount = parseInt(from.amount, 10); s.recipientId = from.recipient; if (from.memo) { s.asset = { data: from.memo }; } return s; }; LiskSendTxCodec.prototype.assetBytes = function (tx) { if (tx.asset && tx.asset.data) { return Buffer.from(tx.asset.data, 'utf8'); } return Buffer.alloc(0); }; return LiskSendTxCodec; }(base_lisk_1.BaseLiskCodec)); exports.LiskSendTxCodec = LiskSendTxCodec;