Skip to content

TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:552

TransactionComposer helps you compose and execute transactions as a transaction group.

new TransactionComposer(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:613

Create a TransactionComposer.

TransactionComposerParams

The configuration for this composer

TransactionComposer

The TransactionComposer instance

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.

AppCallParams

The application call transaction parameters

TransactionComposer

The composer so you can chain method calls

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(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.

AppCallMethodCall

The ABI method application call transaction parameters

TransactionComposer

The composer so you can chain method calls

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(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.

The application create transaction parameters

ResourceReference[]

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.

(string | Address)[]

Any account addresses to add to the accounts array.

bigint[]

The ID of any apps to load to the foreign apps array.

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.

bigint[]

The ID of any assets to load to the foreign assets array.

(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.

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)).

AlgoAmount

The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.

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.

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.

bigint

The last round this transaction is valid. It is recommended to use validityWindow instead.

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).

AlgoAmount

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.

NoOpOC | OptInOC | CloseOutOC | UpdateApplicationOC | DeleteApplicationOC

The on-complete action of the call; defaults to no-op.

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.

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.

{ globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }

The state schema for the app. This is immutable once the app is created.

number

The number of byte slices saved in global state.

number

The number of integers saved in global state.

number

The number of byte slices saved in local state.

number

The number of integers saved in local state.

string | Address

The address of the account sending the transaction.

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).

AlgoAmount

The static transaction fee. In most cases you want to use extraFee unless setting the fee to 0 to be covered by another transaction.

number | bigint

How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used.

TransactionComposer

The composer so you can chain method calls

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(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.

AppCreateMethodCall

The ABI create method application call transaction parameters

TransactionComposer

The composer so you can chain method calls

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(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.

AppDeleteParams

The application delete transaction parameters

TransactionComposer

The composer so you can chain method calls

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(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.

AppDeleteMethodCall

The ABI delete method application call transaction parameters

TransactionComposer

The composer so you can chain method calls

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(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.

The application update transaction parameters

ResourceReference[]

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.

(string | Address)[]

Any account addresses to add to the accounts array.

bigint

ID of the application; 0 if the application is being created.

bigint[]

The ID of any apps to load to the foreign apps array.

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.

bigint[]

The ID of any assets to load to the foreign assets array.

(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.

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))

AlgoAmount

The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.

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.

bigint

The last round this transaction is valid. It is recommended to use validityWindow instead.

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).

AlgoAmount

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.

UpdateApplicationOC

The on-complete action of the call; defaults to no-op.

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.

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.

string | Address

The address of the account sending the transaction.

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).

AlgoAmount

The static transaction fee. In most cases you want to use extraFee unless setting the fee to 0 to be covered by another transaction.

number | bigint

How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used.

TransactionComposer

The composer so you can chain method calls

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(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.

AppUpdateMethodCall

The ABI update method application call transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:763

Add an asset config transaction to the transaction group.

AssetConfigParams

The asset config transaction parameters

TransactionComposer

The composer so you can chain method calls

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**
```typescript
composer.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**
```typescript
composer.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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:797

Add an asset freeze transaction to the transaction group.

AssetFreezeParams

The asset freeze transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:898

Add an asset opt-in transaction to the transaction group.

AssetOptInParams

The asset opt-in transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:936

Add an asset opt-out transaction to the transaction group.

AssetOptOutParams

The asset opt-out transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:866

Add an asset transfer transaction to the transaction group.

AssetTransferParams

The asset transfer transaction parameters

TransactionComposer

The composer so you can chain method calls

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(atc): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:1437

Add the transactions within an AtomicTransactionComposer to the transaction group.

AtomicTransactionComposer

The AtomicTransactionComposer to build transactions from and add to the group

TransactionComposer

The composer so you can chain method calls

const atc = new AtomicTransactionComposer()
.addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })
composer.addAtc(atc)

addOfflineKeyRegistration(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:1420

Add an offline key registration transaction to the transaction group.

OfflineKeyRegistrationParams

The offline key registration transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:1385

Add an online key registration transaction to the transaction group.

OnlineKeyRegistrationParams

The online key registration transaction parameters

TransactionComposer

The composer so you can chain method calls

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(params): TransactionComposer

Defined in: algokit-utils-ts/src/types/composer.ts:687

Add a payment transaction to the transaction group.

PaymentParams

The payment transaction parameters

TransactionComposer

The composer so you can chain method calls

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
```typescript
composer.addTransaction(txn)

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.

Promise<{ atc: AtomicTransactionComposer; methodCalls: any; transactions: TransactionWithSigner[]; }>

The built atomic transaction composer, the transactions and any corresponding method calls

const { atc, transactions, methodCalls } = await composer.build()

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.

Promise<BuiltTransactions>

The array of built transactions and any corresponding method calls

const { transactions, methodCalls, signers } = await composer.buildTransactions()

count(): Promise<number>

Defined in: algokit-utils-ts/src/types/composer.ts:1961

Get the number of transactions currently added to this composer.

Promise<number>

The number of transactions currently added to this composer


execute(params?): Promise<SendAtomicTransactionComposerResults>

Defined in: algokit-utils-ts/src/types/composer.ts:2077

SendParams

The parameters to control execution with

Promise<SendAtomicTransactionComposerResults>

The execution result


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.

Promise<{ atc: AtomicTransactionComposer; methodCalls: any; transactions: TransactionWithSigner[]; }>

The newly built atomic transaction composer and the transactions

const { atc, transactions, methodCalls } = await composer.rebuild()

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

ErrorTransformer

TransactionComposer

The composer so you can chain method calls


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.

SendParams

The parameters to control execution with

Promise<SendAtomicTransactionComposerResults>

The execution result

const result = await composer.send()

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

Promise<SendAtomicTransactionComposerResults & object>

The simulation result

const result = await composer.simulate()

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

boolean

boolean

SimulateTraceConfig

number | bigint

number | bigint

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.

Promise<SendAtomicTransactionComposerResults & object>

The simulation result

const result = await composer.simulate({
skipSignatures: true,
})

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

boolean

boolean

boolean

SimulateTraceConfig

number | bigint

boolean

number | bigint

Promise<SendAtomicTransactionComposerResults & object>

The simulation result

const result = await composer.simulate({
extraOpcodeBudget: 1000,
})

static arc2Note(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

Arc2TransactionNote

The ARC-2 transaction note data

Uint8Array

The binary encoded transaction note