airgap-coin-lib
Version:
The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
25 lines • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var SCALEDecoder_1 = require("../scale/SCALEDecoder");
var SCALEAccountId_1 = require("../scale/type/SCALEAccountId");
var SCALECompactInt_1 = require("../scale/type/SCALECompactInt");
var SCALETuple_1 = require("../scale/type/SCALETuple");
var SubstrateExposure = /** @class */ (function () {
function SubstrateExposure(total, own, others) {
this.total = total;
this.own = own;
this.others = others;
}
SubstrateExposure.decode = function (network, runtimeVersion, raw) {
var decoder = new SCALEDecoder_1.SCALEDecoder(network, raw);
var total = decoder.decodeNextCompactInt();
var own = decoder.decodeNextCompactInt();
var others = decoder.decodeNextArray(function (network, hex) {
return SCALETuple_1.SCALETuple.decode(network, hex, SCALEAccountId_1.SCALEAccountId.decode, function (_, second) { return SCALECompactInt_1.SCALECompactInt.decode(second); });
});
return new SubstrateExposure(total.decoded, own.decoded, others.decoded);
};
return SubstrateExposure;
}());
exports.SubstrateExposure = SubstrateExposure;
//# sourceMappingURL=SubstrateExposure.js.map