airgap-coin-lib
Version:
The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
48 lines • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var CosmosMessage_1 = require("./CosmosMessage");
var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
function CosmosWithdrawDelegationRewardMessage(delegatorAddress, validatorAddress) {
this.type = CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward;
this.delegatorAddress = delegatorAddress;
this.validatorAddress = validatorAddress;
}
CosmosWithdrawDelegationRewardMessage.prototype.toAirGapTransaction = function (protocol, fee) {
return {
from: [this.delegatorAddress],
to: [this.validatorAddress],
amount: '0',
isInbound: false,
fee: fee,
protocolIdentifier: protocol.identifier,
network: protocol.options.network,
transactionDetails: this.toRPCBody()
};
};
CosmosWithdrawDelegationRewardMessage.prototype.toJSON = function () {
return {
type: this.type.index,
amount: [{ denom: '', amount: '' }],
fromAddress: this.delegatorAddress,
toAddress: this.validatorAddress
};
};
CosmosWithdrawDelegationRewardMessage.fromJSON = function (json) {
return new CosmosWithdrawDelegationRewardMessage(json.fromAddress, json.toAddress);
};
CosmosWithdrawDelegationRewardMessage.prototype.toRPCBody = function () {
return {
type: this.type.value,
value: {
delegator_address: this.delegatorAddress,
validator_address: this.validatorAddress
}
};
};
CosmosWithdrawDelegationRewardMessage.fromRPCBody = function (json) {
return new CosmosWithdrawDelegationRewardMessage(json.value.delegator_address, json.value.validator_address);
};
return CosmosWithdrawDelegationRewardMessage;
}());
exports.CosmosWithdrawDelegationRewardMessage = CosmosWithdrawDelegationRewardMessage;
//# sourceMappingURL=CosmosWithdrawDelegationRewardMessage.js.map