UNPKG

airgap-coin-lib

Version:

The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.

32 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var bs58check = require("../../dependencies/src/bs58check-2.1.2/index"); var rlp = require("../../dependencies/src/rlp-2.2.3/index"); var message_1 = require("../message"); var FullPayload = /** @class */ (function () { function FullPayload(messages) { this.messages = messages; } FullPayload.fromDecoded = function (object) { return new FullPayload(object); }; FullPayload.fromEncoded = function (buf) { var messages = buf.map(function (buffer) { return message_1.Message.fromEncoded(buffer).asJson(); }); return new FullPayload(messages); }; FullPayload.prototype.asJson = function () { return this.messages; }; FullPayload.prototype.asArray = function () { return this.messages.map(function (message) { return message_1.Message.fromDecoded(message).asArray(); }); }; FullPayload.prototype.asBuffer = function () { return rlp.encode(this.asArray()); }; FullPayload.prototype.asString = function () { return bs58check.encode(this.asBuffer()); }; return FullPayload; }()); exports.FullPayload = FullPayload; //# sourceMappingURL=full-payload.js.map