algokit_utils.applications.app_deployer ======================================= .. py:module:: algokit_utils.applications.app_deployer Attributes ---------- .. autoapisummary:: algokit_utils.applications.app_deployer.APP_DEPLOY_NOTE_DAPP Classes ------- .. autoapisummary:: algokit_utils.applications.app_deployer.AppDeploymentMetaData algokit_utils.applications.app_deployer.ApplicationReference algokit_utils.applications.app_deployer.ApplicationMetaData algokit_utils.applications.app_deployer.ApplicationLookup algokit_utils.applications.app_deployer.AppDeployParams algokit_utils.applications.app_deployer.AppDeployResult algokit_utils.applications.app_deployer.AppDeployer Module Contents --------------- .. py:data:: APP_DEPLOY_NOTE_DAPP :type: str :value: 'ALGOKIT_DEPLOYER' .. py:class:: AppDeploymentMetaData Metadata about an application stored in a transaction note during creation. .. py:attribute:: name :type: str .. py:attribute:: version :type: str .. py:attribute:: deletable :type: bool | None .. py:attribute:: updatable :type: bool | None .. py:method:: dictify() -> dict[str, str | bool] .. py:class:: ApplicationReference Information about an Algorand app .. py:attribute:: app_id :type: int .. py:attribute:: app_address :type: str .. py:class:: ApplicationMetaData Complete metadata about a deployed app .. py:attribute:: reference :type: ApplicationReference .. py:attribute:: deploy_metadata :type: AppDeploymentMetaData .. py:attribute:: created_round :type: int .. py:attribute:: updated_round :type: int .. py:attribute:: deleted :type: bool :value: False .. py:property:: app_id :type: int .. py:property:: app_address :type: str .. py:property:: name :type: str .. py:property:: version :type: str .. py:property:: deletable :type: bool | None .. py:property:: updatable :type: bool | None .. py:class:: ApplicationLookup Cache of {py:class}`ApplicationMetaData` for a specific `creator` Can be used as an argument to {py:class}`ApplicationClient` to reduce the number of calls when deploying multiple apps or discovering multiple app_ids .. py:attribute:: creator :type: str .. py:attribute:: apps :type: dict[str, ApplicationMetaData] .. py:class:: AppDeployParams Parameters for deploying an app .. py:attribute:: metadata :type: AppDeploymentMetaData The deployment metadata .. py:attribute:: deploy_time_params :type: algokit_utils.models.state.TealTemplateParams | None :value: None Optional template parameters to use during compilation .. py:attribute:: on_schema_break :type: Literal['replace', 'fail', 'append'] | algokit_utils.applications.enums.OnSchemaBreak | None :value: None Optional on schema break action .. py:attribute:: on_update :type: Literal['update', 'replace', 'fail', 'append'] | algokit_utils.applications.enums.OnUpdate | None :value: None Optional on update action .. py:attribute:: create_params :type: algokit_utils.transactions.transaction_composer.AppCreateParams | algokit_utils.transactions.transaction_composer.AppCreateMethodCallParams The creation parameters .. py:attribute:: update_params :type: algokit_utils.transactions.transaction_composer.AppUpdateParams | algokit_utils.transactions.transaction_composer.AppUpdateMethodCallParams The update parameters .. py:attribute:: delete_params :type: algokit_utils.transactions.transaction_composer.AppDeleteParams | algokit_utils.transactions.transaction_composer.AppDeleteMethodCallParams The deletion parameters .. py:attribute:: existing_deployments :type: ApplicationLookup | None :value: None Optional existing deployments .. py:attribute:: ignore_cache :type: bool :value: False Whether to ignore the cache .. py:attribute:: max_fee :type: int | None :value: None Optional maximum fee .. py:attribute:: send_params :type: algokit_utils.models.transaction.SendParams | None :value: None Optional send parameters .. py:class:: AppDeployResult The result of a deployment .. py:attribute:: app :type: ApplicationMetaData The application metadata .. py:attribute:: operation_performed :type: algokit_utils.applications.enums.OperationPerformed The operation performed .. py:attribute:: create_result :type: algokit_utils.transactions.transaction_sender.SendAppCreateTransactionResult[algokit_utils.applications.abi.ABIReturn] | None :value: None The create result .. py:attribute:: update_result :type: algokit_utils.transactions.transaction_sender.SendAppUpdateTransactionResult[algokit_utils.applications.abi.ABIReturn] | None :value: None The update result .. py:attribute:: delete_result :type: algokit_utils.transactions.transaction_sender.SendAppTransactionResult[algokit_utils.applications.abi.ABIReturn] | None :value: None The delete result .. py:class:: AppDeployer(app_manager: algokit_utils.applications.app_manager.AppManager, transaction_sender: algokit_utils.transactions.transaction_sender.AlgorandClientTransactionSender, indexer: algosdk.v2client.indexer.IndexerClient | None = None) Manages deployment and deployment metadata of applications :param app_manager: The app manager to use :param transaction_sender: The transaction sender to use :param indexer: The indexer to use :example: >>> deployer = AppDeployer(app_manager, transaction_sender, indexer) .. py:method:: deploy(deployment: AppDeployParams) -> AppDeployResult 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 `operation_performed` to get access to return properties like `transaction`, `confirmation` and `delete_result`. **Note:** if there is a breaking state schema change to an existing app (and `on_schema_break` 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 `on_update` is set to `'replace'`) the existing app will be deleted and re-created. :param deployment: The arguments to control the app deployment :returns: The result of the deployment :raises ValueError: If the app spec format is invalid :example: >>> deployer.deploy(AppDeployParams( ... create_params=AppCreateParams( ... sender='SENDER_ADDRESS', ... approval_program='APPROVAL PROGRAM', ... clear_state_program='CLEAR PROGRAM', ... schema={ ... 'global_byte_slices': 0, ... 'global_ints': 0, ... 'local_byte_slices': 0, ... 'local_ints': 0 ... } ... ), ... update_params=AppUpdateParams( ... sender='SENDER_ADDRESS' ... ), ... delete_params=AppDeleteParams( ... sender='SENDER_ADDRESS' ... ), ... metadata=AppDeploymentMetaData( ... name='my_app', ... version='2.0', ... updatable=False, ... deletable=False ... ), ... on_schema_break=OnSchemaBreak.AppendApp, ... on_update=OnUpdate.AppendApp ... ) ... ) .. py:method:: get_creator_apps_by_name(*, creator_address: str, ignore_cache: bool = False) -> ApplicationLookup Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) `AppDeployNote` as the transaction note of the app creation transaction. This function caches the result for the given creator account so that subsequent calls won't require an indexer lookup. If the `AppManager` instance wasn't created with an indexer client, this function will throw an error. :param creator_address: The address of the account that is the creator of the apps you want to search for :param ignore_cache: Whether or not to ignore the cache and force a lookup, default: use the cache :returns: A name-based lookup of the app metadata :raises ValueError: If the app spec format is invalid :example: >>> result = await deployer.get_creator_apps_by_name(creator)