MsgMultiSend
The following example shows how to use a multisend message. For more information on multisend messages, visit the Bank module spec.
_84import {_84  LCDClient,_84  MnemonicKey,_84  MsgMultiSend,_84  StdTx,_84  Account,_84} from '@terra-money/feather.js';_84_84const {_84  TESTNET_LCD_URL = 'http://localhost:1317',_84  TESTNET_CHAIN_ID = 'localterra',_84} = process.env;_84_84async function main() {_84const lcd = new LCDClient({_84  'pisco-1': {  // key must be the chainID_84    lcd: 'https://pisco-lcd.terra.dev',_84    chainID: 'pisco-1',_84    gasAdjustment: 1.75,_84    gasPrices: { uluna: 0.015 },_84    prefix: 'terra',  // bech32 prefix, used by the LCD to understand which is the right chain to query_84  },_84});_84_84  const keys = {_84    test1: new MnemonicKey({_84      mnemonic:_84        'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',_84    }),_84    test2: new MnemonicKey({_84      mnemonic:_84        'quality vacuum heart guard buzz spike sight swarm shove special gym robust assume sudden deposit grid alcohol choice devote leader tilt noodle tide penalty',_84    }),_84    test3: new MnemonicKey({_84      mnemonic:_84        'symbol force gallery make bulk round subway violin worry mixture penalty kingdom boring survey tool fringe patrol sausage hard admit remember broken alien absorb',_84    }),_84  };_84_84  const wallet = lcd.wallet(keys.test1);_84  const output = new MsgMultiSend.Output(_84    'terra199vw7724lzkwz6lf2hsx04lrxfkz09tg8dlp6r',_84    '1000000uluna'_84  );_84_84  const tx = await wallet.createTx({_84    msgs: [_84      new MsgMultiSend(_84        [_84          new MsgMultiSend.Input(keys.test1.accAddress('terra'), '1000000uluna'),_84          new MsgMultiSend.Input(keys.test2.accAddress('terra'), '1000000uluna'),_84          new MsgMultiSend.Input(keys.test3.accAddress('terra'), '1000000uluna'),_84        ],_84        [output, output, output]_84      ),_84    ],_84    chainID: 'pisco-1',_84  });_84_84  const signatures = await Promise.all(_84    ['test1', 'test2', 'test3'].map(async (keyName) => {_84      const key = keys[keyName] as MnemonicKey;_84      const acc = (await lcd.auth.accountInfo(key.accAddress('terra'))) as Account;_84_84      tx.account_number = acc.account_number;_84      tx.sequence = acc.sequence;_84_84      return key.createSignature(tx);_84    })_84  );_84_84  const stdTx = new StdTx(tx.msgs, tx.fee, signatures, tx.memo, chainId);_84_84  await lcd.tx_84    .broadcastSync(stdTx, 'pisco-1')_84    .then((result) => {_84      console.log(result);_84    })_84    .catch((err) => {_84      console.error(err.message);_84    });_84}_84_84main().catch(console.error);