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