/
...
/
/
šŸš§
Transfers & balances
Search
Duplicate
Try Notion
šŸš§šŸš§

Transfers & balances

Concept

Terra's bank module inherits from the Cosmos SDK'sĀ bankĀ module. This document is a stub and mainly covers important Terra-specific notes on how it is used.
The bank module is the base transactional layer of the Terra blockchain. This module allows assets to be sent from oneĀ AccountĀ to another. The bank module defines the following types of send transactions:Ā MsgSendĀ andĀ MsgMultiSend.

Message types

MsgSend

MsgSendĀ transfers funds from a source account to a destination account.
1// MsgSend - high level transaction of the coin module2type MsgSend struct {3 FromAddress sdk.AccAddress `json:"from_address"`4 ToAddress sdk.AccAddress `json:"to_address"`5 Amount sdk.Coins `json:"amount"`6}
The Bank module is used to send coins from one Terra account to another.Ā MsgSendĀ is constructed to facilitate the transfer. If the balance of coins in the senderĀ AccountĀ is insufficient or the recipientĀ AccountĀ is unable to receive the funds via the bank module, the transaction fails. Fees already paid through failed transactions are not refunded.

MsgMultiSend

1// MsgMultiSend - high level transaction of the coin module2type Input struct {3 Address sdk.AccAddress `json:"address" yaml:"address"`4 Coins sdk.Coins `json:"coins" yaml:"coins"`5}67type Output struct {8 Address sdk.AccAddress `json:"address" yaml:"address"`9 Coins sdk.Coins `json:"coins" yaml:"coins"`10}1112type MsgMultiSend struct {13 Inputs []Input `json:"inputs" yaml:"inputs"`14 Outputs []Output `json:"outputs" yaml:"outputs"`15}
To send multiple transactions at once, useĀ MsgMultiSend. For each transaction,Ā InputsĀ contains the incoming transactions, andĀ OutputsĀ contains the outgoing transactions. TheĀ InputsĀ coin balance must match theĀ OutputsĀ coin balance exactly. Batching transactions viaĀ MsgMultiSendĀ conserves gas fees and network bandwidth. Fees already paid through failed transactions are not refunded.

Parameters

CLI syntax & examples

Callout icon
Each CLI command and proposal process in KIRA requires specific permissions. These permissions must be added to the account's whitelist or obtained as sudo permissions for direct changes. Refer to the Roles & Permissions documentation for more details. $SIGNER represents the transaction signer's account name or address. For instructions on setting common flags as environment variables, such as $FLAGS_TX and $FLAGS_QR, see the CLI flags configuration section

CLI functions description

x/x
query/x

XXX

Queries

XXX

Transfering Tokens

Bash
Copy
# CLI sekaid tx bank send $ACCOUNT $DESTINATION "${AMOUNT}${DENOM}" --keyring-backend=test --home=$SEKAID_HOME --chain-id=$NETWORK_NAME --fees "${FEE_AMOUNT}${FEE_DENOM}" --output=json --yes # KM # e.g: sendTokens <source-account> <destination-account/address> <amount> <denom> <fee-amount> <fee-denom> sendTokens validator test 1 ukex sendTokens validator "kiraXXX...XXX" 1 ukex sendTokens validator test 1 ukex 50 lol
ā€‹

Query Token Balances

Bash
Copy
# CLI sekaid query bank balances "$ADDR" --output=json --home=$SEKAID_HOME | jq # KM # e.g: showBalance <account/address> showBalance validator showBalance "kiraXXX...XXX"
ā€‹

Query Transactions

Bash
Copy
# CLI sekaid query tx "$TX_HASH" --output=json --home=$SEKAID_HOME | jq # KM # e.g: txQuery <hash> txQuery "YYY...YYY"
ā€‹