UNPKG

airgap-coin-lib

Version:

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

53 lines 3 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 SCALEDecoder_1 = require("../../../scale/SCALEDecoder"); var SCALEArray_1 = require("../../../scale/type/SCALEArray"); var SCALEClass_1 = require("../../../scale/type/SCALEClass"); var MetadataV11Call_1 = require("./MetadataV11Call"); var MetadataV11Constants_1 = require("./MetadataV11Constants"); var MetadataV11Error_1 = require("./MetadataV11Error"); var MetadataV11Event_1 = require("./MetadataV11Event"); var MetadataV11Storage_1 = require("./storage/MetadataV11Storage"); var MetadataV11Module = /** @class */ (function (_super) { __extends(MetadataV11Module, _super); function MetadataV11Module(name, storage, calls, events, constants, errors) { var _this = _super.call(this) || this; _this.name = name; _this.storage = storage; _this.calls = calls; _this.events = events; _this.constants = constants; _this.errors = errors; _this.scaleFields = [_this.name, _this.storage, _this.calls, _this.events, _this.constants, _this.errors]; return _this; } MetadataV11Module.decode = function (network, raw) { var decoder = new SCALEDecoder_1.SCALEDecoder(network, raw); var name = decoder.decodeNextString(); var storage = decoder.decodeNextOptional(MetadataV11Storage_1.MetadataV11Storage.decode); var calls = decoder.decodeNextOptional(function (network, hex) { return SCALEArray_1.SCALEArray.decode(network, hex, MetadataV11Call_1.MetadataV11Call.decode); }); var events = decoder.decodeNextOptional(function (network, hex) { return SCALEArray_1.SCALEArray.decode(network, hex, MetadataV11Event_1.MetadataV11Event.decode); }); var constants = decoder.decodeNextArray(MetadataV11Constants_1.MetadataV11Constant.decode); var errors = decoder.decodeNextArray(MetadataV11Error_1.MetadataV11Error.decode); return { bytesDecoded: name.bytesDecoded + storage.bytesDecoded + calls.bytesDecoded + events.bytesDecoded + constants.bytesDecoded + errors.bytesDecoded, decoded: new MetadataV11Module(name.decoded, storage.decoded, calls.decoded, events.decoded, constants.decoded, errors.decoded) }; }; return MetadataV11Module; }(SCALEClass_1.SCALEClass)); exports.MetadataV11Module = MetadataV11Module; //# sourceMappingURL=MetadataV11Module.js.map