airgap-coin-lib
Version:
The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
44 lines • 2.06 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 SCALEDecoder_1 = require("../../../scale/SCALEDecoder");
var SCALEClass_1 = require("../../../scale/type/SCALEClass");
var SCALEString_1 = require("../../../scale/type/SCALEString");
var MetadataV11Constant = /** @class */ (function (_super) {
__extends(MetadataV11Constant, _super);
function MetadataV11Constant(name, type, value, docs) {
var _this = _super.call(this) || this;
_this.name = name;
_this.type = type;
_this.value = value;
_this.docs = docs;
_this.scaleFields = [_this.name, _this.type, _this.value, _this.docs];
return _this;
}
MetadataV11Constant.decode = function (network, raw) {
var decoder = new SCALEDecoder_1.SCALEDecoder(network, raw);
var name = decoder.decodeNextString();
var type = decoder.decodeNextString();
var value = decoder.decodeNextBytes();
var docs = decoder.decodeNextArray(function (_, hex) { return SCALEString_1.SCALEString.decode(hex); });
return {
bytesDecoded: name.bytesDecoded + type.bytesDecoded + value.bytesDecoded + docs.bytesDecoded,
decoded: new MetadataV11Constant(name.decoded, type.decoded, value.decoded, docs.decoded)
};
};
return MetadataV11Constant;
}(SCALEClass_1.SCALEClass));
exports.MetadataV11Constant = MetadataV11Constant;
//# sourceMappingURL=MetadataV11Constants.js.map