cosmos-sdk
cosmos-sdk copied to clipboard
imp(bank): update MultiSendTxCmd logic
Description
This is the basic description of the function MsgMultiSend.
Send coins from one sender and to a series of different addresses. If any of the receiving addresses do not correspond to an existing account, a new account is created.
However, the CLI command implements the effect of evenly distributing the incoming amount of tokens to the receivers, or sending the amount of tokens to each receiver, which does not match the original design.
In addition, it cannot meet the requirements of certain scenarios, such as sending 10stake and 1testtoken to address A, and sending 1stake and 10testtoken to address B. So I have updated the implementation of NewMultiSendTxCmd, which can send any token to any address. For example, with the following command:
./simd tx bank multi-send cosmos1shlek07kh379w6hye8lxgy3nx58spnkhkjl8fp "cosmos1shlek07kh379w6hye8lxgy3nx58spnkhkjl8fp:10stake,1testtoken;cosmos1fqjltn3l7nxme663wz69g2zyd7ejs0gq4alrkn:1stake,10testtoken" --keyring-backend test --fees 2000000000000000stake --chain-id demo -y
It can successfully meet the requirements mentioned above.
Summary by CodeRabbit
-
New Features
- Enhanced multi-send functionality to allow sending any amount of tokens to multiple addresses using new syntax.
-
Bug Fixes
- Improved parsing and validation of multi-send command inputs.
-
Tests
- Updated end-to-end and unit tests to handle multiple coin amounts for transactions.
-
Documentation
- Updated examples and removed outdated flags in command descriptions.