airgap-coin-lib
Version:
The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
29 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var SCALEDecoder_1 = require("../scale/SCALEDecoder");
var SCALECompactInt_1 = require("../scale/type/SCALECompactInt");
var SCALEInt_1 = require("../scale/type/SCALEInt");
var SCALETuple_1 = require("../scale/type/SCALETuple");
var SubstrateStakingLedger = /** @class */ (function () {
function SubstrateStakingLedger(stash, total, active, unlocking, claimedRewards) {
this.stash = stash;
this.total = total;
this.active = active;
this.unlocking = unlocking;
this.claimedRewards = claimedRewards;
}
SubstrateStakingLedger.decode = function (network, runtimeVersion, raw) {
var decoder = new SCALEDecoder_1.SCALEDecoder(network, raw);
var stash = decoder.decodeNextAccountId();
var total = decoder.decodeNextCompactInt();
var active = decoder.decodeNextCompactInt();
var unlocking = decoder.decodeNextArray(function (network, hex) {
return SCALETuple_1.SCALETuple.decode(network, hex, function (_, first) { return SCALECompactInt_1.SCALECompactInt.decode(first); }, function (_, second) { return SCALECompactInt_1.SCALECompactInt.decode(second); });
});
var claimedRewards = decoder.decodeNextArray(function (_, hex) { return SCALEInt_1.SCALEInt.decode(hex, 32); });
return new SubstrateStakingLedger(stash.decoded, total.decoded, active.decoded, unlocking.decoded, claimedRewards.decoded);
};
return SubstrateStakingLedger;
}());
exports.SubstrateStakingLedger = SubstrateStakingLedger;
//# sourceMappingURL=SubstrateStakingLedger.js.map