sdkblockchainmoveaptos

Aptos SDK - multiple payloads in one transaction


Sending one payload is easy, for example:

let payload1 = txBuilder.buildTransactionPayload("0x1::aptos_account::transfer",[],[to.address(),100000])
  let raw = await client.generateRawTransaction(acc.address(),payload1)
  let signed = await client.signTransaction(acc,raw);
  let res = await client.submitTransaction(signed);
  console.log(res)
  let waiting = await client.waitForTransaction(res.hash); 

But how do I send more than one payload in a transaction? is it possible in Aptos?


Solution

  • This is not possible, you can only send one payload per transaction. However, if your goal is to do multiple things in a single transaction, that is possible with Move scripts. These posts explain that approach in more detail: