Skip to content

AppFactory

Defined in: src/app-factory.ts:150

ARC-56/ARC-32 app factory that, for a given app spec, allows you to create and deploy one or more app instances and to create one or more app clients to interact with those (or other) app instances.

new AppFactory(params): AppFactory

Defined in: src/app-factory.ts:177

Create a new app factory.

AppFactoryParams

The parameters to create the app factory

AppFactory

The AppFactory instance

const appFactory = new AppFactory({
appSpec: appSpec,
algorand: AlgorandClient.mainNet(),
})
## Properties
### createTransaction
> `readonly` **createTransaction**: `object`
Defined in: [src/app-factory.ts:225](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-factory.ts#L225)
Create transactions for the current app
#### bare
> **bare**: `object`
Create bare (raw) transactions for the current app
##### bare.create()
> **create**: (`params?`) => `Promise`\<[`Transaction`](/algokit-utils-ts/api/subpaths/transact/classes/transaction/)\>
Create a create app call transaction using a bare (raw) create call.
Performs deploy-time TEAL template placeholder substitutions (if specified).
###### Parameters
###### params?
The parameters to create the create call transaction
###### accessReferences?
[`ResourceReference`](/algokit-utils-ts/api/subpaths/transact/type-aliases/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.
###### accountReferences?
[`ReadableAddress`](/algokit-utils-ts/api/algokit-utils/type-aliases/readableaddress/)[]
Any account addresses to add to the [accounts array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### appReferences?
`bigint`[]
The ID of any apps to load to the [foreign apps array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### args?
`Uint8Array`\<`ArrayBufferLike`\>[]
Any [arguments to pass to the smart contract call](/concepts/smart-contracts/languages/teal/#argument-passing).
###### assetReferences?
`bigint`[]
The ID of any assets to load to the [foreign assets array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### boxReferences?
([`BoxIdentifier`](/algokit-utils-ts/api/algokit-utils/type-aliases/boxidentifier/) \| [`BoxReference`](/algokit-utils-ts/api/algokit-utils/interfaces/boxreference/))[]
Any boxes to load to the [boxes array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
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.
###### deletable?
`boolean`
Whether or not the contract should have deploy-time permanence control set, undefined = ignore
###### deployTimeParams?
[`TealTemplateParams`](/algokit-utils-ts/api/algokit-utils/interfaces/tealtemplateparams/)
Any deploy-time parameters to replace in the TEAL code
###### extraFee?
[`AlgoAmount`](/algokit-utils-ts/api/algokit-utils/classes/algoamount/)
The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.
###### 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?
`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?
`bigint`
The last round this transaction is valid. It is recommended to use `validityWindow` instead.
###### lease?
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
Prevent multiple transactions with the same lease being included within the validity window.
A [lease](https://dev.algorand.co/concepts/transactions/leases)
enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).
###### maxFee?
[`AlgoAmount`](/algokit-utils-ts/api/algokit-utils/classes/algoamount/)
Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods.
###### note?
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
Note to attach to the transaction. Max of 1000 bytes.
###### onComplete?
[`NoOp`](/algokit-utils-ts/api/subpaths/transact/enumerations/onapplicationcomplete/#noop) \| [`OptIn`](/algokit-utils-ts/api/subpaths/transact/enumerations/onapplicationcomplete/#optin) \| [`CloseOut`](/algokit-utils-ts/api/subpaths/transact/enumerations/onapplicationcomplete/#closeout) \| [`UpdateApplication`](/algokit-utils-ts/api/subpaths/transact/enumerations/onapplicationcomplete/#updateapplication) \| [`DeleteApplication`](/algokit-utils-ts/api/subpaths/transact/enumerations/onapplicationcomplete/#deleteapplication)
###### 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?
[`ReadableAddress`](/algokit-utils-ts/api/algokit-utils/type-aliases/readableaddress/)
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](https://dev.algorand.co/concepts/accounts/rekeying).
###### schema?
\{ `globalByteSlices`: `number`; `globalInts`: `number`; `localByteSlices`: `number`; `localInts`: `number`; \}
The state schema for the app. This is immutable once the app is created. By default uses the ARC32/ARC-56 spec.
###### schema.globalByteSlices
`number`
The number of byte slices saved in global state.
###### schema.globalInts
`number`
The number of integers saved in global state.
###### schema.localByteSlices
`number`
The number of byte slices saved in local state.
###### schema.localInts
`number`
The number of integers saved in local state.
###### sender?
[`ReadableAddress`](/algokit-utils-ts/api/algokit-utils/type-aliases/readableaddress/)
The address of the account sending the transaction, if undefined then the app client's defaultSender is used.
###### signer?
[`AddressWithTransactionSigner`](/algokit-utils-ts/api/subpaths/transact/interfaces/addresswithtransactionsigner/) \| [`TransactionSigner`](/algokit-utils-ts/api/subpaths/transact/type-aliases/transactionsigner/)
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?
[`AlgoAmount`](/algokit-utils-ts/api/algokit-utils/classes/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.
###### updatable?
`boolean`
Whether or not the contract should have deploy-time immutability control set, undefined = ignore
###### 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
`Promise`\<[`Transaction`](/algokit-utils-ts/api/subpaths/transact/classes/transaction/)\>
The create call transaction
#### create()
> **create**: (`params`) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, [`ABIMethod`](/algokit-utils-ts/api/subpaths/abi/classes/abimethod/)\>; `signers`: `Map`\<`number`, [`TransactionSigner`](/algokit-utils-ts/api/subpaths/transact/type-aliases/transactionsigner/)\>; `transactions`: [`Transaction`](/algokit-utils-ts/api/subpaths/transact/classes/transaction/)[]; \}\>
Create a create app call transaction using an ABI create call.
Performs deploy-time TEAL template placeholder substitutions (if specified).
##### Parameters
###### params
The parameters to create the create call transaction
###### accessReferences?
[`ResourceReference`](/algokit-utils-ts/api/subpaths/transact/type-aliases/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.
###### accountReferences?
[`ReadableAddress`](/algokit-utils-ts/api/algokit-utils/type-aliases/readableaddress/)[]
Any account addresses to add to the [accounts array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### appReferences?
`bigint`[]
The ID of any apps to load to the [foreign apps array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### args?
([`ABIValue`](/algokit-utils-ts/api/subpaths/abi/type-aliases/abivalue/) \| `AppMethodCallTransactionArgument` \| `undefined`)[]
Arguments to the ABI method, either:
* An ABI value
* An ARC-56 struct
* A transaction with explicit signer
* A transaction (where the signer will be automatically assigned)
* An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
* Another method call (via method call params object)
* undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)
###### assetReferences?
`bigint`[]
The ID of any assets to load to the [foreign assets array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
###### boxReferences?
([`BoxIdentifier`](/algokit-utils-ts/api/algokit-utils/type-aliases/boxidentifier/) \| [`BoxReference`](/algokit-utils-ts/api/algokit-utils/interfaces/boxreference/))[]
Any boxes to load to the [boxes array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).
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.
###### deletable?
`boolean`
Whether or not the contract should have deploy-time permanence control set, undefined = ignore
###### deployTimeParams?
[`TealTemplateParams`](/algokit-utils-ts/api/algokit-utils/interfaces/tealtemplateparams/)
Any deploy-time parameters to replace in the TEAL code
###### extraFee?
[`AlgoAmount`](/algokit-utils-ts/api/algokit-utils/classes/algoamount/)
The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees.
###### 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?
`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?
`bigint`
The last round this transaction is valid. It is recommended to use `validityWindow` instead.
###### lease?
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
Prevent multiple transactions with the same lease being included within the validity window.
A [lease](https://dev.algorand.co/concepts/transactions/leases)
enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).
###### maxFee?
[`AlgoAmount`](/algokit-utils-ts/api/algokit-utils/classes/algoamount/)
Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods.
###### method
`string`
The method name or method signature to call if an ABI call is being emitted
**Examples**
```ts
Method name
`my_method`
Method signature
`my_method(unit64,string)bytes`

string | Uint8Array<ArrayBufferLike>

Note to attach to the transaction. Max of 1000 bytes.

NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication

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.

ReadableAddress

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. By default uses the ARC32/ARC-56 spec.

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

boolean

Whether or not the contract should have deploy-time immutability control set, undefined = ignore

number | bigint

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

Promise<{ methodCalls: Map<number, ABIMethod>; signers: Map<number, TransactionSigner>; transactions: Transaction[]; }>

The create call transaction


readonly send: object

Defined in: src/app-factory.ts:253

Send transactions to the current app

bare: object

Send bare (raw) transactions for the current app

create: (params?) => Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; groupId: string | undefined; return: undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; }; }>

Creates an instance of the app using a bare (raw) create call and returns the result of the creation transaction and an app client to interact with that app instance.

Performs deploy-time TEAL template placeholder substitutions (if specified).

object & SendParams

The parameters to create the app

Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; groupId: string | undefined; return: undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; }; }>

The app client and the result of the creation transaction

create: (params) => Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; groupId: string | undefined; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; }; }>

Creates an instance of the app and returns the result of the creation transaction and an app client to interact with that app instance.

Performs deploy-time TEAL template placeholder substitutions (if specified).

object & SendParams

The parameters to create the app

Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; groupId: string | undefined; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; }; }>

The app client and the result of the creation transaction

get algorand(): AlgorandClient

Defined in: src/app-factory.ts:201

Return the algorand client this factory is using.

AlgorandClient


get appName(): string

Defined in: src/app-factory.ts:191

The name of the app (from the ARC-32 / ARC-56 app spec or override).

string


get appSpec(): Arc56Contract

Defined in: src/app-factory.ts:196

The ARC-56 app spec being used

Arc56Contract


get params(): object

Defined in: src/app-factory.ts:220

Get parameters to create transactions (create and deploy related calls) for the current app.

A good mental model for this is that these parameters represent a deferred transaction creation.

const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
// ...
await algorand.send.AppCreateMethodCall(createAppParams)
const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
await appClient.send.call({method: 'my_method', args: [createAppParams]})

bare: object

create: (params?) => Promise<object & object>

Return params for a create bare call, including deploy-time TEAL template replacements and compilation if provided

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

Uint8Array<ArrayBufferLike>[]

Any arguments to pass to the smart contract call.

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

boolean

Whether or not the contract should have deploy-time permanence control set, undefined = ignore

TealTemplateParams

Any deploy-time parameters to replace in the TEAL code

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.

NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication

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.

ReadableAddress

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. By default uses the ARC32/ARC-56 spec.

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

boolean

Whether or not the contract should have deploy-time immutability control set, undefined = ignore

number | bigint

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

Promise<object & object>

deployDelete: (params?) => object & object

Return params for a deployment delete bare call

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

Uint8Array<ArrayBufferLike>[]

Any arguments to pass to the smart contract call.

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

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.

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.

ReadableAddress

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

deployUpdate: (params?) => object & object

Return params for a deployment update bare call

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

Uint8Array<ArrayBufferLike>[]

Any arguments to pass to the smart contract call.

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

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.

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.

ReadableAddress

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

create: (params) => Promise<object & object>

Return params for a create ABI call, including deploy-time TEAL template replacements and compilation if provided

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

(ABIValue | AppMethodCallTransactionArgument | undefined)[]

Arguments to the ABI method, either:

  • An ABI value
  • An ARC-56 struct
  • A transaction with explicit signer
  • A transaction (where the signer will be automatically assigned)
  • An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
  • Another method call (via method call params object)
  • undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

boolean

Whether or not the contract should have deploy-time permanence control set, undefined = ignore

TealTemplateParams

Any deploy-time parameters to replace in the TEAL code

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

The method name or method signature to call if an ABI call is being emitted

Examples

Method name
`my_method`
Method signature
`my_method(unit64,string)bytes`

string | Uint8Array<ArrayBufferLike>

Note to attach to the transaction. Max of 1000 bytes.

NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication

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.

ReadableAddress

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. By default uses the ARC32/ARC-56 spec.

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

boolean

Whether or not the contract should have deploy-time immutability control set, undefined = ignore

number | bigint

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

Promise<object & object>

deployDelete: (params) => object & object

Return params for a deployment delete ABI call

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

(ABIValue | AppMethodCallTransactionArgument | undefined)[]

Arguments to the ABI method, either:

  • An ABI value
  • An ARC-56 struct
  • A transaction with explicit signer
  • A transaction (where the signer will be automatically assigned)
  • An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
  • Another method call (via method call params object)
  • undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

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

The method name or method signature to call if an ABI call is being emitted

Examples

Method name
`my_method`
Method signature
`my_method(unit64,string)bytes`

string | Uint8Array<ArrayBufferLike>

Note to attach to the transaction. Max of 1000 bytes.

OnApplicationComplete

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.

ReadableAddress

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

deployUpdate: (params) => object & object

Return params for a deployment update ABI call

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.

ReadableAddress[]

Any account addresses to add to the accounts array.

bigint[]

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

(ABIValue | AppMethodCallTransactionArgument | undefined)[]

Arguments to the ABI method, either:

  • An ABI value
  • An ARC-56 struct
  • A transaction with explicit signer
  • A transaction (where the signer will be automatically assigned)
  • An unawaited transaction (e.g. from algorand.createTransaction.transactionType())
  • Another method call (via method call params object)
  • undefined (this represents a placeholder for either a default argument or a transaction argument that is fulfilled by another method call argument)

bigint[]

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

(BoxIdentifier | BoxReference)[]

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.

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

The method name or method signature to call if an ABI call is being emitted

Examples

Method name
`my_method`
Method signature
`my_method(unit64,string)bytes`

string | Uint8Array<ArrayBufferLike>

Note to attach to the transaction. Max of 1000 bytes.

OnApplicationComplete

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.

ReadableAddress

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.

ReadableAddress

The address of the account sending the transaction, if undefined then the app client’s defaultSender is used.

AddressWithTransactionSigner | TransactionSigner

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.

compile(compilation?): Promise<AppClientCompilationResult>

Defined in: src/app-factory.ts:600

Compiles the approval and clear state programs (if TEAL templates provided), performing any provided deploy-time parameter replacement and stores the source maps.

If no TEAL templates provided it will use any byte code provided in the app spec.

Will store any generated source maps for later use in debugging.

AppClientCompilationParams

Optional compilation parameters to use for the compilation

Promise<AppClientCompilationResult>

The compilation result

const result = await factory.compile()

deploy(params): Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "create"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "update"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteResult: ConfirmedTransactionResult; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "replace"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; name: string; operationPerformed: "nothing"; return: ABIValue | undefined; updatable?: boolean; updatedRound: bigint; version: string; }; }>

Defined in: src/app-factory.ts:354

Idempotently deploy (create if not exists, update if changed) an app against the given name for the given creator account, including deploy-time TEAL template placeholder substitutions (if specified).

Note: When using the return from this function be sure to check operationPerformed to get access to various return properties like transaction, confirmation and deleteResult.

Note: if there is a breaking state schema change to an existing app (and onSchemaBreak is set to 'replace') the existing app will be deleted and re-created.

Note: if there is an update (different TEAL code) to an existing app (and onUpdate is set to 'replace') the existing app will be deleted and re-created.

The arguments to control the app deployment

string

Override the app name for this deployment

boolean

Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee

{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: (ABIValue | AppMethodCallTransactionArgument | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; extraProgramPages?: number; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: string; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: Uint8Array<ArrayBufferLike>[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; extraProgramPages?: number; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

Create transaction parameters to use if a create needs to be issued as part of deployment

boolean

Whether or not the contract should have deploy-time permanence control set. undefined = use AppFactory constructor value if set or base it on the app spec.

{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: Uint8Array<ArrayBufferLike>[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; rejectVersion?: number; rekeyTo?: ReadableAddress; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: (ABIValue | AppMethodCallTransactionArgument | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: string; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: OnApplicationComplete; rejectVersion?: number; rekeyTo?: ReadableAddress; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

Delete transaction parameters to use if a create needs to be issued as part of deployment

TealTemplateParams

Any deploy-time parameters to replace in the TEAL code before compiling it (used if teal code is passed in as a string)

AppLookup

Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup

boolean

Whether or not to ignore the app metadata cache and force a lookup, default: use the cache *

number

The number of rounds to wait for confirmation. By default until the latest lastValid has past.

"replace" | OnSchemaBreak | "fail" | "append"

What action to perform if a schema break (storage schema or extra pages change) is detected:

  • fail - Fail the deployment (throw an error, default)
  • replace - Delete the old app and create a new one
  • append - Deploy a new app and leave the old one as is

"replace" | "update" | "fail" | "append" | OnUpdate

What action to perform if a TEAL code update is detected:

  • fail - Fail the deployment (throw an error, default)
  • update - Update the app with the new TEAL code
  • replace - Delete the old app and create a new one
  • append - Deploy a new app and leave the old one as is

boolean

Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to Config.populateAppCallResources.

boolean

Whether to suppress log messages from transaction send, default: do not suppress.

boolean

Whether or not the contract should have deploy-time immutability control set. undefined = use AppFactory constructor value if set or base it on the app spec.

{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: Uint8Array<ArrayBufferLike>[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; rejectVersion?: number; rekeyTo?: ReadableAddress; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: (ABIValue | AppMethodCallTransactionArgument | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: string; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: OnApplicationComplete; rejectVersion?: number; rekeyTo?: ReadableAddress; sender?: ReadableAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

Update transaction parameters to use if a create needs to be issued as part of deployment

Promise<{ appClient: AppClient; result: { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "create"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "update"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; confirmation: PendingTransactionResponse; confirmations: PendingTransactionResponse[]; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteResult: ConfirmedTransactionResult; deleteReturn: ABIValue | undefined; groupId: string | undefined; name: string; operationPerformed: "replace"; return: ABIValue | undefined; returns?: ABIReturn[]; transaction: Transaction; transactions: Transaction[]; txIds: string[]; updatable?: boolean; updatedRound: bigint; version: string; } | { appAddress: Address; appId: bigint; compiledApproval?: CompiledTeal; compiledClear?: CompiledTeal; createdMetadata: AppDeployMetadata; createdRound: bigint; deletable?: boolean; deleted: boolean; deleteReturn: ABIValue | undefined; name: string; operationPerformed: "nothing"; return: ABIValue | undefined; updatable?: boolean; updatedRound: bigint; version: string; }; }>

The app client and the result of the deployment

const { appClient, result } = await factory.deploy({
createParams: {
sender: 'SENDER_ADDRESS',
approvalProgram: 'APPROVAL PROGRAM',
clearStateProgram: 'CLEAR PROGRAM',
schema: {
globalByteSlices: 0,
globalInts: 0,
localByteSlices: 0,
localInts: 0
}
},
updateParams: {
sender: 'SENDER_ADDRESS'
},
deleteParams: {
sender: 'SENDER_ADDRESS'
},
onSchemaBreak: 'append',
onUpdate: 'append'
})

exportSourceMaps(): AppSourceMaps

Defined in: src/app-factory.ts:481

Export the current source maps for the app.

AppSourceMaps

The source maps


exposeLogicError(e, isClearStateProgram?): Error

Defined in: src/app-factory.ts:469

Takes an error that may include a logic error from a call to the current app and re-exposes the error to include source code information via the source map and ARC-56 spec.

Error

The error to parse

boolean

Whether or not the code was running the clear state program (defaults to approval program)

Error

The new error, or if there was no logic error or source map then the wrapped error with source details


getAppClientByCreatorAndName(params): Promise<AppClient>

Defined in: src/app-factory.ts:450

Returns a new AppClient client, resolving the app by creator address and name using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).

Automatically populates appName, defaultSender and source maps from the factory if not specified in the params.

The parameters to create the app client

AppLookup

An optional cached app lookup that matches a name to on-chain details; either this is needed or indexer is required to be passed in to this ClientManager on construction.

string

Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name

ProgramSourceMap

Optional source map for the approval program

ProgramSourceMap

Optional source map for the clear state program

ReadableAddress

The address of the creator account for the app

ReadableAddress

Optional address to use for the account to use as the default sender for calls.

TransactionSigner

Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).

boolean

Whether or not to ignore the AppDeployer lookup cache and force an on-chain lookup, default: use any cached value

Promise<AppClient>

The AppClient instance

const appClient = factory.getAppClientByCreatorAndName({ creatorAddress: 'CREATOR_ADDRESS', appName: 'my_app' })

getAppClientById(params): AppClient

Defined in: src/app-factory.ts:424

Returns a new AppClient client for an app instance of the given ID.

Automatically populates appName, defaultSender and source maps from the factory if not specified in the params.

The parameters to create the app client

bigint

The ID of the app instance this client should make calls against.

string

Optional override for the app name; used for on-chain metadata and lookups. Defaults to the ARC-32/ARC-56 app spec name

ProgramSourceMap

Optional source map for the approval program

ProgramSourceMap

Optional source map for the clear state program

ReadableAddress

Optional address to use for the account to use as the default sender for calls.

TransactionSigner

Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from AlgorandClient).

AppClient

The AppClient instance

const appClient = factory.getAppClientById({ appId: 12345n })

importSourceMaps(sourceMaps): void

Defined in: src/app-factory.ts:498

Import source maps for the app.

AppSourceMaps

The source maps to import

void