Injective | TS & dApps Docs
DocumentationInjective TS
  • Overview
  • Getting Started
    • Technical Concepts
    • Application Concepts
      • Calculations
        • Min Price Tick Size
        • Min Quantity Tick Size
      • Networks
      • CosmJs Support
    • Assets
      • Creating Tokens
      • Denom Client (deprecated)
      • Injective Lists
    • Running examples
  • Wallets
    • Getting Started
    • Accounts
    • Wallet Connections
    • Wallet Strategy
    • Offchain (Arbitrary) Data
  • Querying
    • Getting Started
    • Chain
      • Auction
      • Auth
      • Bank
      • Distribution
      • Exchange
      • Governance
      • IBC
      • Mint
      • Insurance Funds
      • Oracle
      • Peggy
      • Permissions
      • Staking
      • Tendermint
      • Wasm
      • WasmX
      • Token Factory
    • Indexer
      • Account
      • Auction
      • Derivatives
      • Explorer
      • Insurance Funds
      • Markets
      • Leaderboard
      • Mito
      • Oracle
      • Portfolio
      • Spot
      • Web3Gw Transactions
      • Streaming
        • Account
        • Auction
        • Derivatives
        • Oracle
        • Portfolio
        • Spot
        • Explorer
    • Ethereum (GraphQL)
  • Transactions
    • Getting Started
    • Cosmos
      • Ledger through Keplr Wallet
    • Ethereum
      • Ethereum Ledger
    • MsgBroadcaster
    • Private Key
    • Web3 Gateway
  • Core Modules (& examples)
    • Getting Started
    • Auction
    • AuthZ
    • Bank
    • Distribution
    • Exchange
    • Feegrant
    • Governance
    • IBC
    • Insurance
    • Peggy
    • Permissions
    • Staking
    • Tokenfactory
    • Wasm
  • Smart Contracts
    • Cosmwasm
      • Injective Name Service
      • Neptune Service
      • CW20 to Bank & Market Order in One Transaction
  • Bridges
    • Getting Started
    • Ethereum
    • IBC
    • Wormhole
  • Building Dapps
    • Getting Started
    • Configuring Nuxt
    • Configuring React
    • dApps Examples
      • Smart Contract
      • DEX
      • Bridge
      • Simple HTML example with Webpack
Powered by GitBook
On this page
  • MsgWithdrawDelegatorReward
  • MsgWithdrawValidatorCommission
  1. Core Modules (& examples)

Distribution

PreviousBankNextExchange

Last updated 1 year ago

The distribution module is extended from the cosmos sdk , 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 {
  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);
distribution module