Documentation Index
Fetch the complete documentation index at: https://injectivelabs-mintlify-jp-developers-first-half-1777019423.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The distribution module is extended from the cosmos sdk distribution module, where delegator can withdraw their staking rewards from the validator.
Distribution -> MsgWithdrawValidatorCommission
MsgWithdrawDelegatorReward
This message is used to withdraw all available delegator staking rewards from the validator.
import { Network } from "@injectivelabs/networks";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
import { MsgWithdrawDelegatorReward } from "@injectivelabs/sdk-ts/core/modules";
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 { Network } from "@injectivelabs/networks";
import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts/core/tx";
import { MsgWithdrawValidatorCommission } from "@injectivelabs/sdk-ts/core/modules";
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);