MsgWithdrawDelegatorReward
This message is used to withdraw all available delegator staking rewards from the validator.
import {
MsgBroadcasterWithPk,
MsgWithdrawDelegatorReward,
} from "@injectivelabs/sdk-ts";
import { Network } from "@injectivelabs/networks";
const injectiveAddress = "inj1...";
const validatorAddress = "inj1...";
/* create message in proto format */
const msg = MsgWithdrawDelegatorReward.fromJSON({
validatorAddress,
delegatorAddress: injectiveAddress,
});
const privateKey = "0x...";
/* broadcast transaction */
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Mainnet
}).broadcast({
msgs: msg
});
console.log(txHash);
MsgWithdrawValidatorCommission
This message is used by the validator to withdraw the commission earned.
import {
MsgBroadcasterWithPk,
MsgWithdrawValidatorCommission,
} from "@injectivelabs/sdk-ts";
import { Network } from "@injectivelabs/networks";
const injectiveAddress = "inj1...";
const validatorAddress = "inj1...";
/* create message in proto format */
const msg = MsgWithdrawValidatorCommission.fromJSON({
validatorAddress,
});
const privateKey = "0x...";
/* broadcast transaction */
const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet
}).broadcast({
msgs: msg
});
console.log(txHash);