Skip to content

AppDeployer

Defined in: src/app-deployer.ts:113

Allows management of deployment and deployment metadata of applications.

new AppDeployer(appManager, transactionSender, indexer?): AppDeployer

Defined in: src/app-deployer.ts:129

Creates an AppManager

AppManager

An AppManager instance

AlgorandClientTransactionSender

An AlgorandClientTransactionSender instance

IndexerClient

An optional indexer instance; supply if you want to indexer to look up app metadata

AppDeployer

const deployer = new AppDeployer(appManager, transactionSender, indexer)

deploy(deployment): Promise<AppDeployResult>

Defined in: src/app-deployer.ts:173

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

To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md

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

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[]; appId?: 0; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<ArrayBufferLike>[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; 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: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId?: 0; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId?: 0; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; 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 | undefined; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId: bigint; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: UpdateApplication; rejectVersion?: number; rekeyTo?: ReadableAddress | undefined; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<AppMethodCallParams> | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; extraFee?: AlgoAmount; extraProgramPages?: number; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: ABIMethod; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: NoOp | OptIn | CloseOut | UpdateApplication | DeleteApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

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

{ 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>; onComplete?: DeleteApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId?: 0; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; 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 | undefined; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId: bigint; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: UpdateApplication; rejectVersion?: number; rekeyTo?: ReadableAddress | undefined; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<AppMethodCallParams> | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: ABIMethod; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: DeleteApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

Delete transaction parameters to use if a delete 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.

AppDeployMetadata

The deployment metadata

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

{ 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>; onComplete?: UpdateApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; } | { accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appReferences?: bigint[]; args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId?: 0; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; 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 | undefined; schema?: { globalByteSlices: number; globalInts: number; localByteSlices: number; localInts: number; }; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<{ accessReferences?: ResourceReference[]; accountReferences?: ReadableAddress[]; appId: bigint; appReferences?: bigint[]; approvalProgram: string | Uint8Array<ArrayBufferLike>; args?: Uint8Array<…>[]; assetReferences?: bigint[]; boxReferences?: BoxIdentifier | BoxReference[]; clearStateProgram: string | Uint8Array<ArrayBufferLike>; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: UpdateApplication; rejectVersion?: number; rekeyTo?: ReadableAddress | undefined; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }> | AppMethodCall<AppMethodCallParams> | undefined)[]; assetReferences?: bigint[]; boxReferences?: (BoxIdentifier | BoxReference)[]; extraFee?: AlgoAmount; firstValidRound?: bigint; lastValidRound?: bigint; lease?: string | Uint8Array<ArrayBufferLike>; maxFee?: AlgoAmount; method: ABIMethod; note?: string | Uint8Array<ArrayBufferLike>; onComplete?: UpdateApplication; rejectVersion?: number; rekeyTo?: ReadableAddress; sender: SendingAddress; signer?: AddressWithTransactionSigner | TransactionSigner; staticFee?: AlgoAmount; validityWindow?: number | bigint; }

Update transaction parameters to use if an update needs to be issued as part of deployment

Promise<AppDeployResult>

The result of the deployment

const deployResult = await deployer.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'
},
metadata: { name: 'my_app', version: '2.0', updatable: false, deletable: false },
onSchemaBreak: 'append',
onUpdate: 'append'
})

getCreatorAppsByName(creator, ignoreCache?): Promise<AppLookup>

Defined in: src/app-deployer.ts:496

Returns a lookup of name => app metadata (id, address, …metadata) for all apps created by the given account that have an ARC-2 AppDeployNote as the transaction note of the app creation transaction.

This function caches the result for the given creator account so that subsequent calls will not require an indexer lookup.

If the AppManager instance wasn’t created with an indexer client, this function will throw an error.

ReadableAddress

The address of the account that is the creator of the apps you want to search for

boolean

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

Promise<AppLookup>

A name-based lookup of the app metadata

const result = await deployer.getCreatorAppsByName(creator)