airgap-coin-lib
Version:
The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
41 lines • 1.94 kB
JavaScript
;
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 hex_1 = require("../../../../../../../../utils/hex");
var SCALEDecoder_1 = require("../../../../scale/SCALEDecoder");
var SCALEClass_1 = require("../../../../scale/type/SCALEClass");
var MetadataV11StorageEntry_1 = require("./MetadataV11StorageEntry");
var MetadataV11Storage = /** @class */ (function (_super) {
__extends(MetadataV11Storage, _super);
function MetadataV11Storage(prefix, storageEntries) {
var _this = _super.call(this) || this;
_this.prefix = prefix;
_this.storageEntries = storageEntries;
_this.scaleFields = [_this.prefix];
return _this;
}
MetadataV11Storage.decode = function (network, raw) {
var decoder = new SCALEDecoder_1.SCALEDecoder(network, hex_1.stripHexPrefix(raw));
var prefix = decoder.decodeNextString();
var storageEntries = decoder.decodeNextArray(MetadataV11StorageEntry_1.MetadataV11StorageEntry.decode);
return {
bytesDecoded: prefix.bytesDecoded + storageEntries.bytesDecoded,
decoded: new MetadataV11Storage(prefix.decoded, storageEntries.decoded)
};
};
return MetadataV11Storage;
}(SCALEClass_1.SCALEClass));
exports.MetadataV11Storage = MetadataV11Storage;
//# sourceMappingURL=MetadataV11Storage.js.map