TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:552
TransactionComposer helps you compose and execute transactions as a transaction group.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TransactionComposer(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:613
Create a TransactionComposer.
Parameters
Section titled “Parameters”params
Section titled “params”The configuration for this composer
Returns
Section titled “Returns”TransactionComposer
The TransactionComposer instance
Methods
Section titled “Methods”addAppCall()
Section titled “addAppCall()”addAppCall(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1119
Add an application call transaction to the transaction group.
If you want to create or update an app use addAppCreate or addAppUpdate.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The application call transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAppCall({ sender: 'CREATORADDRESS' })Advanced example
composer.addAppCall({ sender: 'CREATORADDRESS', onComplete: algosdk.OnApplicationComplete.OptInOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppCallMethodCall()
Section titled “addAppCallMethodCall()”addAppCallMethodCall(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1339
Add a non-create/non-update ABI method application call transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The ABI method application call transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })Advanced example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"], onComplete: algosdk.OnApplicationComplete.OptInOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppCreate()
Section titled “addAppCreate()”addAppCreate(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:992
Add an application create transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The application create transaction parameters
accessReferences?
Section titled “accessReferences?”Access references unifies accountReferences, appReferences, assetReferences, and boxReferences under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty.
accountReferences?
Section titled “accountReferences?”(string | Address)[]
Any account addresses to add to the accounts array.
appReferences?
Section titled “appReferences?”bigint[]
The ID of any apps to load to the foreign apps array.
approvalProgram
Section titled “approvalProgram”string | Uint8Array<ArrayBufferLike>
The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)).
Uint8Array<ArrayBufferLike>[]
Any arguments to pass to the smart contract call.
assetReferences?
Section titled “assetReferences?”bigint[]
The ID of any assets to load to the foreign assets array.
boxReferences?
Section titled “boxReferences?”(BoxReference | BoxIdentifier)[]
Any boxes to load to the boxes array.
Either the name identifier (which will be set against app ID of 0 i.e.
the current app), or a box identifier with the name identifier and app ID.
clearStateProgram
Section titled “clearStateProgram”string | Uint8Array<ArrayBufferLike>
The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)).
extraFee?
Section titled “extraFee?”The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.
extraProgramPages?
Section titled “extraProgramPages?”number
Number of extra pages required for the programs. Defaults to the number needed for the programs in this call if not specified. This is immutable once the app is created.
firstValidRound?
Section titled “firstValidRound?”bigint
Set the first round this transaction is valid. If left undefined, the value from algod will be used.
We recommend you only set this when you intentionally want this to be some time in the future.
lastValidRound?
Section titled “lastValidRound?”bigint
The last round this transaction is valid. It is recommended to use validityWindow instead.
lease?
Section titled “lease?”string | Uint8Array<ArrayBufferLike>
Prevent multiple transactions with the same lease being included within the validity window.
A lease enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).
maxFee?
Section titled “maxFee?”Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods.
string | Uint8Array<ArrayBufferLike>
Note to attach to the transaction. Max of 1000 bytes.
onComplete?
Section titled “onComplete?”NoOpOC | OptInOC | CloseOutOC | UpdateApplicationOC | DeleteApplicationOC
The on-complete action of the call; defaults to no-op.
rejectVersion?
Section titled “rejectVersion?”number
If set, the transaction will be rejected when the app’s version is greater than or equal to this value. This can be used to prevent calling an app after it has been updated. Set to 0 or leave undefined to skip the version check.
rekeyTo?
Section titled “rekeyTo?”string | Address
Change the signing key of the sender to the given address.
Warning: Please be careful with this parameter and be sure to read the official rekey guidance.
schema?
Section titled “schema?”{ globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }
The state schema for the app. This is immutable once the app is created.
schema.globalByteSlices
Section titled “schema.globalByteSlices”number
The number of byte slices saved in global state.
schema.globalInts
Section titled “schema.globalInts”number
The number of integers saved in global state.
schema.localByteSlices
Section titled “schema.localByteSlices”number
The number of byte slices saved in local state.
schema.localInts
Section titled “schema.localInts”number
The number of integers saved in local state.
sender
Section titled “sender”string | Address
The address of the account sending the transaction.
signer?
Section titled “signer?”TransactionSigner | TransactionSignerAccount
The function used to sign transaction(s); if not specified then
an attempt will be made to find a registered signer for the
given sender or use a default signer (if configured).
staticFee?
Section titled “staticFee?”The static transaction fee. In most cases you want to use extraFee unless setting the fee to 0 to be covered by another transaction.
validityWindow?
Section titled “validityWindow?”number | bigint
How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used.
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })Advanced example
composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: "TEALCODE", clearStateProgram: "TEALCODE", schema: { globalInts: 1, globalByteSlices: 2, localInts: 3, localByteSlices: 4 }, extraProgramPages: 1, onComplete: algosdk.OnApplicationComplete.OptInOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1, // Signer only needed if you want to provide one, // generally you'd register it with AlgorandClient // against the sender and not need to pass it in signer: transactionSigner, maxRoundsToWaitForConfirmation: 5, suppressLog: true,})addAppCreateMethodCall()
Section titled “addAppCreateMethodCall()”addAppCreateMethodCall(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1181
Add an ABI method create application call transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The ABI create method application call transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })Advanced example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"], approvalProgram: "TEALCODE", clearStateProgram: "TEALCODE", schema: { globalInts: 1, globalByteSlices: 2, localInts: 3, localByteSlices: 4 }, extraProgramPages: 1, onComplete: algosdk.OnApplicationComplete.OptInOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppDelete()
Section titled “addAppDelete()”addAppDelete(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1076
Add an application delete transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The application delete transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAppDelete({ sender: 'CREATORADDRESS' })Advanced example
composer.addAppDelete({ sender: 'CREATORADDRESS', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppDeleteMethodCall()
Section titled “addAppDeleteMethodCall()”addAppDeleteMethodCall(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1287
Add an ABI method delete application call transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The ABI delete method application call transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })Advanced example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"], onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppUpdate()
Section titled “addAppUpdate()”addAppUpdate(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1035
Add an application update transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The application update transaction parameters
accessReferences?
Section titled “accessReferences?”Access references unifies accountReferences, appReferences, assetReferences, and boxReferences under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty.
accountReferences?
Section titled “accountReferences?”(string | Address)[]
Any account addresses to add to the accounts array.
bigint
ID of the application; 0 if the application is being created.
appReferences?
Section titled “appReferences?”bigint[]
The ID of any apps to load to the foreign apps array.
approvalProgram
Section titled “approvalProgram”string | Uint8Array<ArrayBufferLike>
The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array))
Uint8Array<ArrayBufferLike>[]
Any arguments to pass to the smart contract call.
assetReferences?
Section titled “assetReferences?”bigint[]
The ID of any assets to load to the foreign assets array.
boxReferences?
Section titled “boxReferences?”(BoxReference | BoxIdentifier)[]
Any boxes to load to the boxes array.
Either the name identifier (which will be set against app ID of 0 i.e.
the current app), or a box identifier with the name identifier and app ID.
clearStateProgram
Section titled “clearStateProgram”string | Uint8Array<ArrayBufferLike>
The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array))
extraFee?
Section titled “extraFee?”The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.
firstValidRound?
Section titled “firstValidRound?”bigint
Set the first round this transaction is valid. If left undefined, the value from algod will be used.
We recommend you only set this when you intentionally want this to be some time in the future.
lastValidRound?
Section titled “lastValidRound?”bigint
The last round this transaction is valid. It is recommended to use validityWindow instead.
lease?
Section titled “lease?”string | Uint8Array<ArrayBufferLike>
Prevent multiple transactions with the same lease being included within the validity window.
A lease enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).
maxFee?
Section titled “maxFee?”Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods.
string | Uint8Array<ArrayBufferLike>
Note to attach to the transaction. Max of 1000 bytes.
onComplete?
Section titled “onComplete?”UpdateApplicationOC
The on-complete action of the call; defaults to no-op.
rejectVersion?
Section titled “rejectVersion?”number
If set, the transaction will be rejected when the app’s version is greater than or equal to this value. This can be used to prevent calling an app after it has been updated. Set to 0 or leave undefined to skip the version check.
rekeyTo?
Section titled “rekeyTo?”string | Address
Change the signing key of the sender to the given address.
Warning: Please be careful with this parameter and be sure to read the official rekey guidance.
sender
Section titled “sender”string | Address
The address of the account sending the transaction.
signer?
Section titled “signer?”TransactionSigner | TransactionSignerAccount
The function used to sign transaction(s); if not specified then
an attempt will be made to find a registered signer for the
given sender or use a default signer (if configured).
staticFee?
Section titled “staticFee?”The static transaction fee. In most cases you want to use extraFee unless setting the fee to 0 to be covered by another transaction.
validityWindow?
Section titled “validityWindow?”number | bigint
How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used.
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })Advanced example
composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: "TEALCODE", clearStateProgram: "TEALCODE", onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAppUpdateMethodCall()
Section titled “addAppUpdateMethodCall()”addAppUpdateMethodCall(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1235
Add an ABI method update application call transaction to the transaction group.
Note: we recommend using app clients to make it easier to make app calls.
Parameters
Section titled “Parameters”params
Section titled “params”The ABI update method application call transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })Advanced example
const method = new ABIMethod({ name: 'method', args: [{ name: 'arg1', type: 'string' }], returns: { type: 'string' },})composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"], approvalProgram: "TEALCODE", clearStateProgram: "TEALCODE", onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, args: [new Uint8Array(1, 2, 3, 4)] accountReferences: ["ACCOUNT_1"] appReferences: [123n, 1234n] assetReferences: [12345n] boxReferences: ["box1", {appId: 1234n, name: "box2"}] accessReferences: [{ appId: 1234n }] lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(), rejectVersion: 1,})addAssetConfig()
Section titled “addAssetConfig()”addAssetConfig(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:763
Add an asset config transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The asset config transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAssetConfig({ sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })Advanced example
composer.addAssetConfig({ sender: 'MANAGERADDRESS', assetId: 123456n, manager: 'MANAGERADDRESS', reserve: 'RESERVEADDRESS', freeze: 'FREEZEADDRESS', clawback: 'CLAWBACKADDRESS', lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})
***
### addAssetCreate()
> **addAssetCreate**(`params`): `TransactionComposer`
Defined in: [algokit-utils-ts/src/types/composer.ts:728](https://github.com/algorandfoundation/algokit-ts/blob/main/algokit-utils-ts/src/types/composer.ts#L728)
Add an asset create transaction to the transaction group.
#### Parameters
##### params
[`AssetCreateParams`](/algokit-ts/utils/api/types/composer/type-aliases/assetcreateparams/)
The asset create transaction parameters
#### Returns
`TransactionComposer`
The composer so you can chain method calls
#### Examples
**Basic example**
```typescriptcomposer.addAssetCreate({ sender: "CREATORADDRESS", total: 100n})Advanced example
composer.addAssetCreate({ sender: 'CREATORADDRESS', total: 100n, decimals: 2, assetName: 'asset', unitName: 'unit', url: 'url', metadataHash: 'metadataHash', defaultFrozen: false, manager: 'MANAGERADDRESS', reserve: 'RESERVEADDRESS', freeze: 'FREEZEADDRESS', clawback: 'CLAWBACKADDRESS', lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})
***
### addAssetDestroy()
> **addAssetDestroy**(`params`): `TransactionComposer`
Defined in: [algokit-utils-ts/src/types/composer.ts:829](https://github.com/algorandfoundation/algokit-ts/blob/main/algokit-utils-ts/src/types/composer.ts#L829)
Add an asset destroy transaction to the transaction group.
#### Parameters
##### params
[`AssetDestroyParams`](/algokit-ts/utils/api/types/composer/type-aliases/assetdestroyparams/)
The asset destroy transaction parameters
#### Returns
`TransactionComposer`
The composer so you can chain method calls
#### Examples
**Basic example**
```typescriptcomposer.addAssetDestroy({ sender: "MANAGERADDRESS", assetId: 123456n })Advanced example
composer.addAssetDestroy({ sender: 'MANAGERADDRESS', assetId: 123456n, lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addAssetFreeze()
Section titled “addAssetFreeze()”addAssetFreeze(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:797
Add an asset freeze transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The asset freeze transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAssetFreeze({ sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })Advanced example
composer.addAssetFreeze({ sender: 'MANAGERADDRESS', assetId: 123456n, account: 'ACCOUNTADDRESS', frozen: true, lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addAssetOptIn()
Section titled “addAssetOptIn()”addAssetOptIn(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:898
Add an asset opt-in transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The asset opt-in transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAssetOptIn({ sender: "SENDERADDRESS", assetId: 123456n })Advanced example
composer.addAssetOptIn({ sender: 'SENDERADDRESS', assetId: 123456n, lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addAssetOptOut()
Section titled “addAssetOptOut()”addAssetOptOut(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:936
Add an asset opt-out transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The asset opt-out transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example (without creator, will be retrieved from algod)
composer.addAssetOptOut({ sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })Basic example (with creator)
composer.addAssetOptOut({ sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n, ensureZeroBalance: true })Advanced example
composer.addAssetOptOut({ sender: 'SENDERADDRESS', assetId: 123456n, creator: 'CREATORADDRESS', ensureZeroBalance: true, lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addAssetTransfer()
Section titled “addAssetTransfer()”addAssetTransfer(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:866
Add an asset transfer transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The asset transfer transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addAssetTransfer({ sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })Advanced example (with clawback)
composer.addAssetTransfer({ sender: 'CLAWBACKADDRESS', assetId: 123456n, amount: 1n, receiver: 'RECEIVERADDRESS', clawbackTarget: 'HOLDERADDRESS', // This field needs to be used with caution closeAssetTo: 'ADDRESSTOCLOSETO' lease: 'lease', note: 'note', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addAtc()
Section titled “addAtc()”addAtc(
atc):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1437
Add the transactions within an AtomicTransactionComposer to the transaction group.
Parameters
Section titled “Parameters”AtomicTransactionComposer
The AtomicTransactionComposer to build transactions from and add to the group
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Example
Section titled “Example”const atc = new AtomicTransactionComposer() .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })composer.addAtc(atc)addOfflineKeyRegistration()
Section titled “addOfflineKeyRegistration()”addOfflineKeyRegistration(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1420
Add an offline key registration transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The offline key registration transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addOfflineKeyRegistration({ sender: 'SENDERADDRESS',})Advanced example
composer.addOfflineKeyRegistration({ sender: 'SENDERADDRESS', lease: 'lease', note: 'note', // Use this with caution, it's generally better to use algorand.account.rekeyAccount rekeyTo: 'REKEYTOADDRESS', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addOnlineKeyRegistration()
Section titled “addOnlineKeyRegistration()”addOnlineKeyRegistration(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:1385
Add an online key registration transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The online key registration transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addOnlineKeyRegistration({ sender: 'SENDERADDRESS', voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')), selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')), stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')), voteFirst: 1n, voteLast: 1000n, voteKeyDilution: 1n,})Advanced example
composer.addOnlineKeyRegistration({ sender: 'SENDERADDRESS', voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')), selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')), stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')), voteFirst: 1n, voteLast: 1000n, voteKeyDilution: 1n, lease: 'lease', note: 'note', // Use this with caution, it's generally better to use algorand.account.rekeyAccount rekeyTo: 'REKEYTOADDRESS', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})addPayment()
Section titled “addPayment()”addPayment(
params):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:687
Add a payment transaction to the transaction group.
Parameters
Section titled “Parameters”params
Section titled “params”The payment transaction parameters
Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
Examples
Section titled “Examples”Basic example
composer.addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: (4).algo(),})Advanced example
composer.addPayment({ amount: (4).algo(), receiver: 'RECEIVERADDRESS', sender: 'SENDERADDRESS', closeRemainderTo: 'CLOSEREMAINDERTOADDRESS', lease: 'lease', note: 'note', // Use this with caution, it's generally better to use algorand.account.rekeyAccount rekeyTo: 'REKEYTOADDRESS', // You wouldn't normally set this field firstValidRound: 1000n, validityWindow: 10, extraFee: (1000).microAlgo(), staticFee: (1000).microAlgo(), // Max fee doesn't make sense with extraFee AND staticFee // already specified, but here for completeness maxFee: (3000).microAlgo(),})
***
### addTransaction()
> **addTransaction**(`transaction`, `signer?`): `TransactionComposer`
Defined in: [algokit-utils-ts/src/types/composer.ts:644](https://github.com/algorandfoundation/algokit-ts/blob/main/algokit-utils-ts/src/types/composer.ts#L644)
Add a pre-built transaction to the transaction group.
#### Parameters
##### transaction
`Transaction`
The pre-built transaction
##### signer?
`TransactionSigner`
Optional signer override for the transaction
#### Returns
`TransactionComposer`
The composer so you can chain method calls
#### Example
```typescriptcomposer.addTransaction(txn)build()
Section titled “build()”build():
Promise<{atc:AtomicTransactionComposer;methodCalls:any;transactions:TransactionWithSigner[]; }>
Defined in: algokit-utils-ts/src/types/composer.ts:1978
Compose all of the transactions in a single atomic transaction group and an atomic transaction composer.
You can then use the transactions standalone, or use the composer to execute or simulate the transactions.
Once this method is called, no further transactions will be able to be added. You can safely call this method multiple times to get the same result.
Returns
Section titled “Returns”Promise<{ atc: AtomicTransactionComposer; methodCalls: any; transactions: TransactionWithSigner[]; }>
The built atomic transaction composer, the transactions and any corresponding method calls
Example
Section titled “Example”const { atc, transactions, methodCalls } = await composer.build()buildTransactions()
Section titled “buildTransactions()”buildTransactions():
Promise<BuiltTransactions>
Defined in: algokit-utils-ts/src/types/composer.ts:1920
Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.
Returns
Section titled “Returns”Promise<BuiltTransactions>
The array of built transactions and any corresponding method calls
Example
Section titled “Example”const { transactions, methodCalls, signers } = await composer.buildTransactions()count()
Section titled “count()”count():
Promise<number>
Defined in: algokit-utils-ts/src/types/composer.ts:1961
Get the number of transactions currently added to this composer.
Returns
Section titled “Returns”Promise<number>
The number of transactions currently added to this composer
execute()
Section titled “execute()”execute(
params?):Promise<SendAtomicTransactionComposerResults>
Defined in: algokit-utils-ts/src/types/composer.ts:2077
Parameters
Section titled “Parameters”params?
Section titled “params?”The parameters to control execution with
Returns
Section titled “Returns”Promise<SendAtomicTransactionComposerResults>
The execution result
rebuild()
Section titled “rebuild()”rebuild():
Promise<{atc:AtomicTransactionComposer;methodCalls:any;transactions:TransactionWithSigner[]; }>
Defined in: algokit-utils-ts/src/types/composer.ts:2018
Rebuild the group, discarding any previously built transactions. This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.
Returns
Section titled “Returns”Promise<{ atc: AtomicTransactionComposer; methodCalls: any; transactions: TransactionWithSigner[]; }>
The newly built atomic transaction composer and the transactions
Example
Section titled “Example”const { atc, transactions, methodCalls } = await composer.rebuild()registerErrorTransformer()
Section titled “registerErrorTransformer()”registerErrorTransformer(
transformer):TransactionComposer
Defined in: algokit-utils-ts/src/types/composer.ts:629
Register a function that will be used to transform an error caught when simulating or executing
Parameters
Section titled “Parameters”transformer
Section titled “transformer”Returns
Section titled “Returns”TransactionComposer
The composer so you can chain method calls
send()
Section titled “send()”send(
params?):Promise<SendAtomicTransactionComposerResults>
Defined in: algokit-utils-ts/src/types/composer.ts:2032
Compose the atomic transaction group and send it to the network.
Parameters
Section titled “Parameters”params?
Section titled “params?”The parameters to control execution with
Returns
Section titled “Returns”Promise<SendAtomicTransactionComposerResults>
The execution result
Example
Section titled “Example”const result = await composer.send()simulate()
Section titled “simulate()”Call Signature
Section titled “Call Signature”simulate():
Promise<SendAtomicTransactionComposerResults&object>
Defined in: algokit-utils-ts/src/types/composer.ts:2089
Compose the atomic transaction group and simulate sending it to the network
Returns
Section titled “Returns”Promise<SendAtomicTransactionComposerResults & object>
The simulation result
Example
Section titled “Example”const result = await composer.simulate()Call Signature
Section titled “Call Signature”simulate(
options):Promise<SendAtomicTransactionComposerResults&object>
Defined in: algokit-utils-ts/src/types/composer.ts:2100
Compose the atomic transaction group and simulate sending it to the network
Parameters
Section titled “Parameters”options
Section titled “options”allowMoreLogging?
Section titled “allowMoreLogging?”boolean
allowUnnamedResources?
Section titled “allowUnnamedResources?”boolean
execTraceConfig?
Section titled “execTraceConfig?”SimulateTraceConfig
extraOpcodeBudget?
Section titled “extraOpcodeBudget?”number | bigint
round?
Section titled “round?”number | bigint
skipSignatures
Section titled “skipSignatures”boolean
Whether or not to skip signatures for all built transactions and use an empty signer instead.
This will set fixSigners and allowEmptySignatures when sending the request to the algod API.
Returns
Section titled “Returns”Promise<SendAtomicTransactionComposerResults & object>
The simulation result
Example
Section titled “Example”const result = await composer.simulate({ skipSignatures: true,})Call Signature
Section titled “Call Signature”simulate(
options):Promise<SendAtomicTransactionComposerResults&object>
Defined in: algokit-utils-ts/src/types/composer.ts:2113
Compose the atomic transaction group and simulate sending it to the network
Parameters
Section titled “Parameters”options
Section titled “options”allowEmptySignatures?
Section titled “allowEmptySignatures?”boolean
allowMoreLogging?
Section titled “allowMoreLogging?”boolean
allowUnnamedResources?
Section titled “allowUnnamedResources?”boolean
execTraceConfig?
Section titled “execTraceConfig?”SimulateTraceConfig
extraOpcodeBudget?
Section titled “extraOpcodeBudget?”number | bigint
fixSigners?
Section titled “fixSigners?”boolean
round?
Section titled “round?”number | bigint
Returns
Section titled “Returns”Promise<SendAtomicTransactionComposerResults & object>
The simulation result
Example
Section titled “Example”const result = await composer.simulate({ extraOpcodeBudget: 1000,})arc2Note()
Section titled “arc2Note()”
staticarc2Note(note):Uint8Array
Defined in: algokit-utils-ts/src/types/composer.ts:2195
Create an encoded transaction note that follows the ARC-2 spec.
https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md
Parameters
Section titled “Parameters”The ARC-2 transaction note data
Returns
Section titled “Returns”Uint8Array
The binary encoded transaction note