Skip to content

TransactionComposer

Builds and sends atomic transaction groups with automatic resource population and fee handling.

const composer = algorand.newGroup();

Adds a payment transaction.

ParameterTypeDescription
params.senderTransactionSignerAccountSender
params.receiverstringReceiver address
params.amountAlgoAmountPayment amount
params.notestring | Uint8ArrayOptional note
composer.addPayment({
sender: alice,
receiver: bob.addr,
amount: (1).algo(),
});

Adds an asset transfer transaction.

ParameterTypeDescription
params.senderTransactionSignerAccountSender
params.receiverstringReceiver address
params.assetIdbigintAsset ID
params.amountbigintTransfer amount

Adds an ABI method call to an application.

Sends all transactions in the group atomically.

const result = await algorand
.newGroup()
.addPayment({ sender: alice, receiver: bob.addr, amount: (1).algo() })
.addPayment({ sender: alice, receiver: charlie.addr, amount: (2).algo() })
.send();
console.log(result.txIds); // ['TX1...', 'TX2...']

Simulates the transaction group without submitting.

const simResult = await composer.simulate();

Builds the transaction group without sending.

const txns = await composer.buildGroup();