AppDeployer
Defined in: src/app-deployer.ts:113
Allows management of deployment and deployment metadata of applications.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AppDeployer(
appManager,transactionSender,indexer?):AppDeployer
Defined in: src/app-deployer.ts:129
Creates an AppManager
Parameters
Section titled “Parameters”appManager
Section titled “appManager”An AppManager instance
transactionSender
Section titled “transactionSender”AlgorandClientTransactionSender
An AlgorandClientTransactionSender instance
indexer?
Section titled “indexer?”An optional indexer instance; supply if you want to indexer to look up app metadata
Returns
Section titled “Returns”AppDeployer
Example
Section titled “Example”const deployer = new AppDeployer(appManager, transactionSender, indexer)Methods
Section titled “Methods”deploy()
Section titled “deploy()”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.
Parameters
Section titled “Parameters”deployment
Section titled “deployment”The arguments to control the app deployment
coverAppCallInnerTransactionFees?
Section titled “coverAppCallInnerTransactionFees?”boolean
Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee
createParams
Section titled “createParams”{ 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
deleteParams
Section titled “deleteParams”{ 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
deployTimeParams?
Section titled “deployTimeParams?”Any deploy-time parameters to replace in the TEAL code before compiling it (used if teal code is passed in as a string)
existingDeployments?
Section titled “existingDeployments?”Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup
ignoreCache?
Section titled “ignoreCache?”boolean
Whether or not to ignore the app metadata cache and force a lookup, default: use the cache *
maxRoundsToWaitForConfirmation?
Section titled “maxRoundsToWaitForConfirmation?”number
The number of rounds to wait for confirmation. By default until the latest lastValid has past.
metadata
Section titled “metadata”The deployment metadata
onSchemaBreak?
Section titled “onSchemaBreak?”"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 oneappend- Deploy a new app and leave the old one as is
onUpdate?
Section titled “onUpdate?”"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 codereplace- Delete the old app and create a new oneappend- Deploy a new app and leave the old one as is
populateAppCallResources?
Section titled “populateAppCallResources?”boolean
Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to Config.populateAppCallResources.
suppressLog?
Section titled “suppressLog?”boolean
Whether to suppress log messages from transaction send, default: do not suppress.
updateParams
Section titled “updateParams”{ 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
Returns
Section titled “Returns”Promise<AppDeployResult>
The result of the deployment
Example
Section titled “Example”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()
Section titled “getCreatorAppsByName()”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.
Parameters
Section titled “Parameters”creator
Section titled “creator”The address of the account that is the creator of the apps you want to search for
ignoreCache?
Section titled “ignoreCache?”boolean
Whether or not to ignore the cache and force a lookup, default: use the cache
Returns
Section titled “Returns”Promise<AppLookup>
A name-based lookup of the app metadata
Example
Section titled “Example”const result = await deployer.getCreatorAppsByName(creator)