diff --git a/docs/capabilities/account.md b/docs/capabilities/account.md index 11fbd9f4..688051db 100644 --- a/docs/capabilities/account.md +++ b/docs/capabilities/account.md @@ -6,7 +6,7 @@ Account management is one of the core capabilities provided by AlgoKit Utils. It The [`AccountManager`](../code/classes/types_account_manager.AccountManager.md) is a class that is used to get, create, and fund accounts and perform account-related actions such as funding. The `AccountManager` also keeps track of signers for each address so when using the [`AlgoKitComposer`](./algokit-composer.md) to send transactions, a signer function does not need to manually be specified for each transaction - instead it can be inferred from the sender address automatically! -To get an instance of `AccountManager`, you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.account` or instantiate it directly (passing in a [`ClientManager`](./client.md)): +To get an instance of `AccountManager`, you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.account` or instantiate it directly: ```typescript import { AccountManager } from '@algorandfoundation/algokit-utils/types/account-manager' diff --git a/docs/capabilities/algorand-client.md b/docs/capabilities/algorand-client.md index 2cf1d320..f154143d 100644 --- a/docs/capabilities/algorand-client.md +++ b/docs/capabilities/algorand-client.md @@ -54,11 +54,11 @@ The `AlgorandClient` has a number of manager class instances that help you quick ### Creating single transactions -You can compose a single transaction via `algorand.transaction...`. Intellisense will guide you on the different options. +You can compose a single transaction via `algorand.transactions...`, which gives you an instance of the [`AlgorandClientTransactionCreator`](../code/classes/types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md) class. Intellisense will guide you on the different options. The signature for the calls to send a single transaction usually look like: -`algorand.transaction.{method}(params: {ComposerTransactionTypeParams} & CommonTransactionParams): Transaction` +`algorand.transactions.{method}(params: {ComposerTransactionTypeParams} & CommonTransactionParams): Transaction` - To get intellisense on the params, open an object parenthesis (`{`) and use your IDE's intellisense keyboard shortcut (e.g. ctrl+space). - `{ComposerTransactionTypeParams}` will be the parameters that are specific to that transaction type e.g. `PaymentParams`, [see the full list](../code/modules/types_composer.md#type-aliases) @@ -67,7 +67,7 @@ The signature for the calls to send a single transaction usually look like: ### Sending a single transaction -You can compose a single transaction via `algorand.send...`. Intellisense will guide you on the different options. +You can compose a single transaction via `algorand.send...`, which gives you an instance of the [`AlgorandClientTransactionSender`](../code/classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) class. Intellisense will guide you on the different options. Further documentation is present in the related capabilities: diff --git a/docs/capabilities/app-client.md b/docs/capabilities/app-client.md index 277f536f..34086e42 100644 --- a/docs/capabilities/app-client.md +++ b/docs/capabilities/app-client.md @@ -117,7 +117,7 @@ These calls will only work if the Application Client knows the ID of the app, wh The input payload for all of these calls is the same as `delete`; [`AppClientCallParams`](#appclientcallparams). -The return payload for all of these is the same as [`callApp`](./app.md#calling-an-app). +The return payload for all of these is the same as [`callApp`](./app.md#calling). ## Getting a reference to the app diff --git a/docs/capabilities/app-deploy.md b/docs/capabilities/app-deploy.md index af4e5c09..c86492f2 100644 --- a/docs/capabilities/app-deploy.md +++ b/docs/capabilities/app-deploy.md @@ -1,14 +1,16 @@ # App deployment -Idempotent (safely retryable) deployment of an app, including deploy-time immutability and permanence control and TEAL template substitution +AlgoKit contains advanced smart contract deployment capabilities that allow you to have idempotent (safely retryable) deployment of a named app, including deploy-time immutability and permanence control and TEAL template substitution. This allows you to control the smart contract development lifecycle of a single-instance app across multiple environments (e.g. LocalNet, TestNet, MainNet). -App deployment is a higher-order use case capability provided by AlgoKit Utils that builds on top of the core capabilities, particularly [App management](./app.md). It allows you to idempotently (with safe retryability) deploy an app, including deploy-time immutability and permanence control and TEAL template substitution. +It's optional to use this functionality, since you can construct your own deployment logic using create / update / delete calls and your own mechanism to maintaining app metadata (like app IDs etc.), but this capability is an opinionated out-of-the-box solution that takes care of the heavy lifting for you. + +App deployment is a higher-order use case capability provided by AlgoKit Utils that builds on top of the core capabilities, particularly [App management](./app.md). To see some usage examples check out the [automated tests](../../src/app-deploy.spec.ts). -## Design +## Smart contract development lifecycle -The architecture design behind app deployment is articulated in an [architecture decision record](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md). While the implementation will naturally evolve over time and diverge from this record, the principles and design goals behind the design are comprehensively explained. +The design behind the deployment capability is unique. The architecture design behind app deployment is articulated in an [architecture decision record](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md). While the implementation will naturally evolve over time and diverge from this record, the principles and design goals behind the design are comprehensively explained. Namely, it described the concept of a smart contract development lifecycle: @@ -35,18 +37,87 @@ Furthermore, the implementation contains the following implementation characteri - There is explicit control of the immutability (updatability / upgradeability) and permanence (deletability) of the smart contract, which can be varied per environment to allow for easier development and testing in non-MainNet environments (by replacing `TMPL_UPDATABLE` and `TMPL_DELETABLE` at deploy-time by convention, if present) - Contracts are resolvable by a string "name" for a given creator to allow automated determination of whether that contract had been deployed previously or not, but can also be resolved by ID instead -## `getCreatorAppsByName` +This design allows you to have the same deployment code across environments without having to specify an ID for each environment. This makes it really easy to apply [continuous delivery](https://continuousdelivery.com/) practices to your smart contract deployment and make the deployment process completely automated. + +## `AppDeployer` -> [!NOTE] -> This method requires the [legacy AlgoKit Utils import method to access it](../README.md#usage). +The [`AppDeployer`](../code/classes/types_app_deployer.AppDeployer.md) is a class that is used to manage app deployments and deployment metadata. -There is a method `algokit.getCreatorAppsByName(creatorAccount, indexer)`, which performs a series of indexer lookups that return all apps created by the given creator (as a [`SendTransactionFrom`](account.md#sendtransactionfrom), or the encoded string representation of the public key of the account) indexed by the name it was deployed under if the creation transaction contained the following payload in the transaction note field: +To get an instance of `AppDeployer` you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.appDeployer` or instantiate it directly (passing in an [`AppManager`](./app.md#appmanager), [`AlgorandClientTransactionSender`](./algorand-client.md#sending-a-single-transaction) and optionally an indexer client instance): +```typescript +import { AppDeployer } from '@algorandfoundation/algokit-utils/types/app-deployer' + +const appDeployer = new AppDeployer(appManager, transactionSender, indexer) ``` -ALGOKIT_DEPLOYER:j{name:string, version:string, updatable?:boolean, deletable?:boolean} + +## Deployment metadata + +When AlgoKit performs a deployment of an app it creates metadata to describe that deployment and includes this metadata in an [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note on any creation and update transactions. + +The deployment metadata is defined in [`AppDeployMetadata`](../code/interfaces/types_app.AppDeployMetadata.md), which is an object with: + +- `name: string` - The unique name identifier of the app within the creator account +- `version: string` - The version of app that is / will be deployed; can be an arbitrary string, but we recommend using [semver](https://semver.org/) +- `deletable?: boolean` - Whether or not the app is deletable (`true`) / permanent (`false`) / unspecified (`undefined`) +- `updatable?: boolean` - Whether or not the app is updatable (`true`) / immutable (`false`) / unspecified (`undefined`) + +An example of the ARC-2 transaction note that is attached as an app creation / update transaction note to specify this metadata is: + +``` +ALGOKIT_DEPLOYER:j{name:"MyApp",version:"1.0",updatable:true,deletable:false} ``` -Any creation transactions or update transactions are then retrieved and processed in chronological order to result in an `AppLookup` object which has the following shape (each app is keyed by name and has the [`AppMetadata`](../code/interfaces/types_app.AppMetadata.md) fields): +## Lookup deployed apps by name + +In order to resolve what apps have been previously deployed and their metadata, AlgoKit provides a method that does a series of indexer lookups and returns a map of name to app metadata via `algorand.appDeployer.getCreatorAppsByName(creatorAddress)`. + +```typescript +const appLookup = algorand.appDeployer.getCreatorAppsByName('CREATORADDRESS') +const app1Metadata = appLookup['app1'] +``` + +This method caches the result of the lookup, since it's a reasonably heavyweight call (N+1 indexer calls for N deployed apps by the creator). If you want to skip the cache to get a fresh version then you can pass in a second parameter `ignoreCache?: boolean`. This should only be needed if you are performing parallel deployments outside of the current `AppDeployer` instance, since it will keep its cache updated based on its own deployments. + +The return type of `getCreatorAppsByName` is [`AppLookup`](../code/interfaces/types_app_deployer.AppLookup.md): + +```typescript +export interface AppLookup { + creator: Readonly + apps: { + [name: string]: AppMetadata + } +} +``` + +The `apps` property contains a lookup by app name that resolves to the current [`AppMetadata`](../code/interfaces/types_app_deployer.AppMetadata.md) value: + +```typescript +interface AppMetadata { + /** The id of the app */ + appId: bigint + /** The Algorand address of the account associated with the app */ + appAddress: string + /** The unique name identifier of the app within the creator account */ + name: string + /** The version of app that is / will be deployed */ + version: string + /** Whether or not the app is deletable / permanent / unspecified */ + deletable?: boolean + /** Whether or not the app is updatable / immutable / unspecified */ + updatable?: boolean + /** The round the app was created */ + createdRound: bigint + /** The last round that the app was updated */ + updatedRound: bigint + /** The metadata when the app was created */ + createdMetadata: AppDeployMetadata + /** Whether or not the app is deleted */ + deleted: boolean +} +``` + +An example `AppLookup` might look like this: ```json { @@ -60,15 +131,15 @@ Any creation transactions or update transactions are then retrieved and processe /** The unique name identifier of the app within the creator account */ "name": "", /** The version of app that is / will be deployed */ - "version": "1.0.0", + "version": "2.0.0", /** Whether or not the app is deletable / permanent / unspecified */ - "deletable": true, + "deletable": false, /** Whether or not the app is updatable / immutable / unspecified */ - "updatable": true, + "updatable": false, /** The round the app was created */ "createdRound": 1, /** The last round that the app was updated */ - "updatedRound": 1, + "updatedRound": 2, /** Whether or not the app is deleted */ "deleted": false, /** The metadata when the app was created */ @@ -88,82 +159,122 @@ Any creation transactions or update transactions are then retrieved and processe } ``` -Given there are a number of indexer calls to retrieve this data it's a non-trivial object to create and it's recommended that for the duration you are performing a single deployment you hold a value of it rather than recalculating it. Most AlgoKit Utils functions that need it will also take an optional value of it that will be used in preference to retrieving a fresh version. - -## `deployApp` - -> [!NOTE] -> This method requires the [legacy AlgoKit Utils import method to access it](../README.md#usage). +## Performing a deployment + +In order to perform a deployment, AlgoKit provides the `algorand.appDeployer.deploy(deployment)` method. + +For example: + +```typescript +const deploymentResult = algorand.appDeployer.deploy({ + metadata: { + name: 'MyApp', + version: '1.0.0', + deletable: false, + updatable: false, + }, + createParams: { + sender: 'CREATORADDRESS', + approvalProgram: approvalTealTemplateOrByteCode, + clearStateProgram: clearStateTealTemplateOrByteCode, + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4, + }, + // Other parameters if a create call is made... + }, + updateParams: { + sender: 'SENDERADDRESS', + // Other parameters if an update call is made... + }, + deleteParams: { + sender: 'SENDERADDRESS', + // Other parameters if a delete call is made... + }, + deployTimeParams: { + // Key => value of any TEAL template variables to replace before compilation + VALUE: 1, + }, + // How to handle a schema break + onSchemaBreak: OnSchemaBreak.Append, + // How to handle a contract code update + onUpdate: OnUpdate.Update, + // Optional execution control parameters + executeParams: { + populateAppCallResources: true, + }, +}) +``` -The method that performs the deployment logic is `algokit.deployApp(deployment, algod, indexer?)`. It performs an idempotent (safely retryable) deployment. It will detect if the app already exists and if it doesn't it will create it. If the app does already exist then it will: +This method performs an idempotent (safely retryable) deployment. It will detect if the app already exists and if it doesn't it will create it. If the app does already exist then it will: -- Detect if the app has been updated (i.e. the logic has changed) and either fail or perform either an update or a replacement based on the deployment configuration. -- Detect if the app has a breaking schema change (i.e. more global or local storage is needed than was originally requested) and either fail or perform a replacement based on the deployment configuration. +- Detect if the app has been updated (i.e. the program logic has changed) and either fail, perform an update, deploy a new version or perform a replacement (delete old app and create new app) based on the deployment configuration. +- Detect if the app has a breaking schema change (i.e. more global or local storage is needed than were originally requested) and either fail, deploy a new version or perform a replacement (delete old app and create new app) based on the deployment configuration. -It will automatically add metadata to the transaction note of the create or update calls that indicates the name, version, updatability and deletability of the contract. This metadata works in concert with [`getCreatorAppsByName`](#getcreatorappsbyname) to allow the app to be reliably retrieved against that creator in it's currently deployed state. +It will automatically [add metadata to the transaction note of the create or update transactions](#deployment-metadata) that indicates the name, version, updatability and deletability of the contract. This metadata works in concert with [`appDeployer.getCreatorAppsByName`](#lookup-deployed-apps-by-name) to allow the app to be reliably retrieved against that creator in it's currently deployed state. It will automatically update it's lookup cache so subsequent calls to `getCreatorAppsByName` or `deploy` will use the latest metadata without needing to call indexer again. -`deployApp` automatically executes [template substitution](#compilation-and-template-substitution) including deploy-time control of permanence and immutability. +`deploy` also automatically executes [template substitution](#compilation-and-template-substitution) including deploy-time control of permanence and immutability if the requisite template parameters are specified in the provided TEAL template. ### Input parameters -The first parameter `deployment` is an [`AppDeploymentParams`](../code/interfaces/types_app.AppDeploymentParams.md) object, that consists of the same parameters as [creating an app](app.md#createapp) with the following differences: - -- `args` is replaced with three parameters: - - `createArgs` - The [args](./app.md#appcallargs) to use if a create is needed - - `updateArgs` - The [args](./app.md#appcallargs) to use if an update is needed - - `deleteArgs` - The [args](./app.md#appcallargs) to use if a delete is needed -- `onCompleteAction` is replaced with `createOnCompleteAction` - Override the on-completion action for the create call; defaults to NoOp -- `note` is excluded since deployment must add a `ALGOKIT_DEPLOYER:j{...}` note for the [name lookup](#getcreatorappsbyname) to work -- `skipSending`, `skipWaiting` and `atc` are excluded because `deployApp` needs to control the deployment and actually send to the network to function correctly -- `metadata: AppDeployMetadata` is added to allow the [deployment metadata](../code/interfaces/types_app.AppDeployMetadata.md) to be provided (`name`, `version`, `updatable` and `deletable`) -- `deployTimeParams: TealTemplateParams` is added to allow automatic substitution of [deploy-time parameter values](#design) +The first parameter `deployment` is an [`AppDeployParams`](../code/interfaces/types_app_deployer.AppDeployParams.md), which is an object with: + +- `metadata: AppDeployMetadata` - determines the [deployment metadata](#deployment-metadata) of the deployment +- `createParams: AppCreateParams | AppCreateMethodCall` - the parameters for an [app creation call](./app.md#creation) (raw or ABI method call) +- `updateParams: Omit` - the parameters for an [app update call](./app.md#updating) (raw or ABI method call) without the `appId`, `approvalProgram` or `clearStateProgram`, since these are calculated by the `deploy` method +- `deleteParams: Omit` - the parameters for an [app delete call](./app.md#deleting) (raw or ABI method call) without the `appId`, since this is calculated by the `deploy` method +- `deployTimeParams?: TealTemplateParams` - allows automatic substitution of [deploy-time TEAL template variables](#compilation-and-template-substitution) - [`TealTemplateParams`](../code/interfaces/types_app.TealTemplateParams.md) is a `key => value` object that will result in `TMPL_{key}` being replaced with `value` (where a string or `Uint8Array` will be appropriately encoded as bytes within the TEAL code) -- `onSchemaBreak?: 'replace' | 'fail' | OnSchemaBreak` determines what should happen if a breaking change to the schema is detected (e.g. if you need more global or local state that was previously requested when the contract was originally created) -- `onUpdate?: 'update' | 'replace' | 'fail' | OnUpdate` determines what should happen if an update to the smart contract is detected (e.g. the TEAL code has changed since last deployment) -- `existingDeployments?: AppLookup` optionally allows the [app lookup](#getcreatorappsbyname) to be skipped if it's already been retrieved +- `onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak` - determines [what should happen](../code/enums/types_app.OnSchemaBreak.md) if a breaking change to the schema is detected (e.g. if you need more global or local state that was previously requested when the contract was originally created) +- `onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate` - determines [what should happen](../code/enums/types_app.OnUpdate.md) if an update to the smart contract is detected (e.g. the TEAL code has changed since last deployment) +- `executeParams?: ExecuteParams` - [transaction execution control parameters](./algorand-client.md#transaction-parameters) +- `existingDeployments?: AppLookup` - optionally allows the [app lookup retrieval](#lookup-deployed-apps-by-name) to be skipped if it's already been retrieved outside of this `AppDeployer` instance +- `ignoreCache?: boolean` - optionally allows the [lookup cache](#lookup-deployed-apps-by-name) to be ignored and force retrieval of fresh deployment metadata from indexer ### Idempotency -`deployApp` is idempotent which means you can safely call it again multiple times and it will only apply any changes it detects. If you call it again straight after calling it then it will do nothing. +`deploy` is idempotent which means you can safely call it again multiple times and it will only apply any changes it detects. If you call it again straight after calling it then it will do nothing. ### Compilation and template substitution -> [!NOTE] -> These methods require the [legacy AlgoKit Utils import method to access them](../README.md#usage). - -When compiling TEAL template code, the capabilities described in the [design above](#design) are present, namely the ability to supply deploy-time parameters and the ability to control immutability and permanence of the smart contract at deploy-time. +When compiling TEAL template code, the capabilities described in the [above design](#design) are present, namely the ability to supply deploy-time parameters and the ability to control immutability and permanence of the smart contract at deploy-time. -In order for a smart contract to be able to use this functionality, it must have a TEAL Template that contains the following: +In order for a smart contract to opt-in to use this functionality, it must have a TEAL Template that contains the following: -- `TMPL_{key}` - Which can be replaced with a number or a string / byte array which wil be automatically hexadecimal encoded +- `TMPL_{key}` - Which can be replaced with a number or a string / byte array which wil be automatically hexadecimal encoded (for any number of `{key}` => `{value}` pairs) - `TMPL_UPDATABLE` - Which will be replaced with a `1` if an app should be updatable and `0` if it shouldn't (immutable) - `TMPL_DELETABLE` - Which will be replaced with a `1` if an app should be deletable and `0` if it shouldn't (permanent) -If you are building a smart contract using the [beaker_production AlgoKit template](https://github.com/algorandfoundation/algokit-beaker-default-template) if provides a reference implementation out of the box for the deploy-time immutability and permanence control. +If you are building a smart contract using the production [AlgoKit init templates](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/init.md) provide a reference implementation out of the box for the deploy-time immutability and permanence control. -If you passed in a TEAL template for the approvalProgram or clearProgram (i.e. a `string` rather than a `Uint8Array`) then `deployApp` will return the [compilation result](../code/interfaces/types_app.CompiledTeal.md) of substituting then compiling the TEAL template(s) in the following properties of the return value: +If you passed in a TEAL template for the approvalProgram or clearStateProgram (i.e. a `string` rather than a `Uint8Array`) then `deploy` will return the [compilation result](../code/interfaces/types_app.CompiledTeal.md) of substituting then compiling the TEAL template(s) in the following properties of the return value: - `compiledApproval?: CompiledTeal` - `compiledClear?: CompiledTeal` -Template substitution is done by executing `algokit.performTemplateSubstitutionAndCompile(tealCode, algod, templateParams?, deploymentMetadata?)`, which in turn calls the following in order: +Template substitution is done by executing `algorand.app.compileTealTemplate(tealTemplateCode, templateParams?, deploymentMetadata?)`, which in turn calls the following in order and returns the compilation result per above (all of which can also be invoked directly): -- `algokit.performTemplateSubstitution(tealCode, templateParams)` - Replaces the `templateParams` by looking for `TMPL_{key}` -- `algokit.replaceDeployTimeControlParams(tealCode, deploymentMetadata)` - If `deploymentMetadata` is provided, it allows for deploy-time immutability and permanence control by replacing `TMPL_UPDATABLE` with `deploymentMetadata.updatable` if it's not `undefined` and replacing `TMPL_DELETABLE` with `deploymentMetadata.deletable` if it's not `undefined` -- `algokit.compileTeal(tealCode, algod)` - Sends the final TEAL to algod for compilation and returns the result including the source map +- `AppManager.stripTealComments(tealCode)` - Strips out any TEAL comments to reduce the payload that is sent to algod and reduce the likelihood of hitting the max payload limit +- `AppManager.replaceTealTemplateParams(tealTemplateCode, templateParams)` - Replaces the `templateParams` by looking for `TMPL_{key}` +- `AppManager.replaceTealTemplateDeployTimeControlParams(tealTemplateCode, deploymentMetadata)` - If `deploymentMetadata` is provided, it allows for deploy-time immutability and permanence control by replacing `TMPL_UPDATABLE` with `deploymentMetadata.updatable` if it's not `undefined` and replacing `TMPL_DELETABLE` with `deploymentMetadata.deletable` if it's not `undefined` +- `algorand.app.compileTeal(tealCode)` - Sends the final TEAL to algod for compilation and returns the result including the source map and caches the compilation result within the `AppManager` instance ### Return value -When `deployApp` executes it may do one of the following (which you can determine by looking at the `operationPerformed` field on the return value from the function): +When `deploy` executes it will return a [comprehensive result](../code/modules/types_app_deployer.md#appdeployresult) object that describes exactly what it did and has comprehensive metadata to describe the end result of the deployed app. + +The `deploy` call itself may do one of the following (which you can determine by looking at the `operationPerformed` field on the return value from the function): -- `create` - The smart contract app is created -- `update` - The smart contract app is updated +- `create` - The smart contract app was created +- `update` - The smart contract app was updated - `replace` - The smart contract app was deleted and created again (in an atomic transaction) - `nothing` - Nothing was done since it was detected the existing smart contract app deployment was up to date -As well as the `operationPerformed` parameter and the [optional compilation result](#compilation-and-template-substitution), the return value will have the [`AppMetadata`](../code/interfaces/types_app.AppMetadata.md) [fields](#getcreatorappsbyname) present. +As well as the `operationPerformed` parameter and the [optional compilation result](#compilation-and-template-substitution), the return value will have the [`AppMetadata`](../code/interfaces/types_app_deployer.AppMetadata.md) [fields](#deployment-metadata) present. Based on the value of `operationPerformed` there will be other data available in the return value: -- If `create`, `update` or `replace` then it will have [`ConfirmedTransactionResults`](transaction.md#sendtransactionresult) and `{return?: ABIReturn}` (which will be populated if an ABI method was executed) -- If `replace` then it will also have `{deleteReturn?: ABIReturn, deleteResult: ConfirmedTransactionResult}` to capture the result of the deletion of the existing app +- If `create`, `update` or `replace` then it will have the relevant [`SendAppTransactionResult`](./app.md#calling-an-app) values +- If `replace` then it will also have `{deleteReturn?: ABIReturn, deleteResult: ConfirmedTransactionResult}` to capture the [result](./algorand-client.md#sending-a-single-transaction) of the deletion of the existing app diff --git a/docs/capabilities/app.md b/docs/capabilities/app.md index b18c4a07..5f4d714c 100644 --- a/docs/capabilities/app.md +++ b/docs/capabilities/app.md @@ -2,174 +2,440 @@ App management is a higher-order use case capability provided by AlgoKit Utils that builds on top of the core capabilities. It allows you to create, update, delete, call (ABI and otherwise) smart contract apps and the metadata associated with them (including state and boxes). -## `AppCallArgs` +## `AppManager` + +The [`AppManager`](../code/classes/types_app_manager.AppManager.md) is a class that is used to manage app information. + +To get an instance of `AppManager` you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.app` or instantiate it directly (passing in an algod client instance): + +```typescript +import { AppManager } from '@algorandfoundation/algokit-utils/types/app-manager' + +const appManager = new AppManager(algod) +``` + +## Calling apps + +### App Clients + +The recommended way of interacting with apps is via [Typed app clients](./typed-app-clients.md). The methods shown on this page are the underlying mechanisms that app clients use and are for advanced use cases when you want more control. + +### Calling an app + +When calling an app there are two types of transactions: + +- Raw app transactions - Constructing a raw Algorand transaction to call the method; you have full control and are dealing with binary values directly +- ABI method calls - Constructing a call to an [ABI method](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/ABI) + +Calling an app involves providing some [common parameters](#common-app-parameters) and some parameters that will depend on the type of app call (create vs update vs other) per below sections. + +When [sending transactions directly via AlgorandClient](./algorand-client.md#sending-a-single-transaction) the `SingleSendTransactionResult` return value is expanded with extra fields depending on the type of app call: + +- All app calls extend [`SendAppTransactionResult`](../code/modules/types_transaction.md#sendapptransactionresult), which has: + - `return?: ABIReturn` - Which will contain an ABI return value if a non-void ABI method was called: + - `rawReturnValue: Uint8Array` - The raw binary of the return value + - `returnValue: ABIValue` - The decoded value in the appropriate JavaScript object + - `decodeError: Error` - If there was a decoding error the above 2 values will be `undefined` and this will have the error +- Update and create calls extend [`SendAppUpdateTransactionResult`](../code/modules/types_transaction.md#sendappupdatetransactionresult), which has: + - `compiledApproval: CompiledTeal | undefined` - The compilation result of approval, if approval program was supplied as a string and thus compiled by algod + - `compiledClear: CompiledTeal | undefined` - The compilation result of clear state, if clear state program was supplied as a string and thus compiled by algod +- Create calls extend [`SendAppCreateTransactionResult`](../code/modules/types_transaction.md#sendappcreatetransactionresult), which has: + - `appId: bigint` - The id of the created app + - `appAddress: string` - The Algorand address of the account associated with the app + +There is a static method on [`AppManager`](#appmanager) that allows you to parse an ABI return value from an algod transaction confirmation: + +```typescript +const confirmation = modelsv2.PendingTransactionResponse.from_obj_for_encoding( + await algod.pendingTransactionInformation(transactionId).do(), +) + +const abiReturn = AppManager.getABIReturn(confirmation, abiMethod) +``` + +### Creation + +To create an app via a raw app transaction you can use `algorand.send.appCreate(params)` (immediately send a single app creation transaction), `algorand.transactions.appCreate(params)` (construct an app creation transaction), or `algorand.newGroup().addAppCreate(params)` (add app creation to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). + +To create an app via an ABI method call you can use `algorand.send.appCreateMethodCall(params)` (immediately send a single app creation transaction), `algorand.transactions.appCreateMethodCall(params)` (construct an app creation transaction), or `algorand.newGroup().addAppCreateMethodCall(params)` (add app creation to a group of transactions). + +The base type for specifying an app creation transaction is [`AppCreateParams`](../code/modules/types_composer.md#appcreateparams) (extended as [`AppCreateMethodCall`](../code/modules/types_composer.md#appcreatemethodcall) for ABI method call version), which has the following parameters in addition to the [common parameters](#common-app-parameters): + +- `onComplete?: Exclude` - The on-completion action to specify for the call; defaults to NoOp and allows any on-completion apart from clear state. +- `approvalProgram: Uint8Array | string` - The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). +- `clearStateProgram: Uint8Array | string` - The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). +- `schema?` - The storage schema to request for the created app. This is immutable once the app is created. It is an object with: + - `globalInts: number` - The number of integers saved in global state. + - `globalByteSlices: number` - The number of byte slices saved in global state. + - `localInts: number` - The number of integers saved in local state. + - `localByteSlices: number` - The number of byte slices saved in local state. +- `extraProgramPages?: number` - Number of extra pages required for the programs. This is immutable once the app is created. + +If you pass in `approvalProgram` or `clearStateProgram` as a string then it will automatically be compiled using Algod and the compilation result will be available via [`appManager.getCompilationResult`](../code/classes/types_app_manager.AppManager.md#getcompilationresult) (including the source map). To skip this behaviour you can pass in the compiled TEAL as `Uint8Array`. + +```typescript +// Basic raw example +const result = await algorand.send.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) +const createdAppId = result.appId + +// Advanced raw example +await algorand.send.appCreate({ + sender: 'CREATORADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4 + }, + extraProgramPages: 1, + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) + +// Basic ABI call example +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +const result = await algorand.send.appCreateMethodCall({ + sender: 'CREATORADDRESS', + approvalProgram: 'TEALCODE', + clearStateProgram: 'TEALCODE', + method: method, + args: ["arg1_value"] +}) +const createdAppId = result.appId +``` + +### Updating + +To update an app via a raw app transaction you can use `algorand.send.appUpdate(params)` (immediately send a single app update transaction), `algorand.transactions.appUpdate(params)` (construct an app update transaction), or `algorand.newGroup().addAppUpdate(params)` (add app update to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). + +To create an app via an ABI method call you can use `algorand.send.appUpdateMethodCall(params)` (immediately send a single app update transaction), `algorand.transactions.appUpdateMethodCall(params)` (construct an app update transaction), or `algorand.newGroup().addAppUpdateMethodCall(params)` (add app update to a group of transactions). + +The base type for specifying an app update transaction is [`AppUpdateParams`](../code/modules/types_composer.md#appupdateparams) (extended as [`AppUpdateMethodCall`](../code/modules/types_composer.md#appupdatemethodcall) for ABI method call version), which has the following parameters in addition to the [common parameters](#common-app-parameters): + +- `onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC` - On Complete can either be omitted or set to update +- `approvalProgram: Uint8Array | string` - The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). +- `clearStateProgram: Uint8Array | string` - The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). + +If you pass in `approvalProgram` or `clearStateProgram` as a string then it will automatically be compiled using Algod and the compilation result will be available via [`appManager.getCompilationResult`](../code/classes/types_app_manager.AppManager.md#getcompilationresult) (including the source map). To skip this behaviour you can pass in the compiled TEAL as `Uint8Array`. + +```typescript +// Basic raw example +await algorand.send.appUpdate({ sender: 'SENDERADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) + +// Advanced raw example +await algorand.send.appUpdate({ + sender: 'SENDERADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) + +// Basic ABI call example +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appUpdateMethodCall({ + sender: 'SENDERADDRESS', + approvalProgram: 'TEALCODE', + clearStateProgram: 'TEALCODE', + method: method, + args: ["arg1_value"] +}) +``` + +### Deleting + +To delete an app via a raw app transaction you can use `algorand.send.appDelete(params)` (immediately send a single app deletion transaction), `algorand.transactions.appDelete(params)` (construct an app deletion transaction), or `algorand.newGroup().addAppDelete(params)` (add app deletion to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). + +To delete an app via an ABI method call you can use `algorand.send.appDeleteMethodCall(params)` (immediately send a single app deletion transaction), `algorand.transactions.appDeleteMethodCall(params)` (construct an app deletion transaction), or `algorand.newGroup().addAppDeleteMethodCall(params)` (add app deletion to a group of transactions). + +The base type for specifying an app deletion transaction is [`AppDeleteParams`](../code/modules/types_composer.md#appdeleteparams) (extended as [`AppDeleteMethodCall`](../code/modules/types_composer.md#appdeletemethodcall) for ABI method call version), which has the following parameters in addition to the [common parameters](#common-app-parameters): + +- `onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC` - On Complete can either be omitted or set to delete + +```typescript +// Basic raw example +await algorand.send.appDelete({ sender: 'SENDERADDRESS' }) + +// Advanced raw example +await algorand.send.appDelete({ + sender: 'SENDERADDRESS', + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) + +// Basic ABI call example +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appDeleteMethodCall({ + sender: 'SENDERADDRESS', + method: method, + args: ["arg1_value"] +}) +``` + +## Calling + +To call an app via a raw app transaction you can use `algorand.send.appCall(params)` (immediately send a single app call transaction), `algorand.transactions.appCall(params)` (construct an app call transaction), or `algorand.newGroup().addAppCall(params)` (add app deletion to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). + +To call an app via an ABI method call you can use `algorand.send.appCallMethodCall(params)` (immediately send a single app call transaction), `algorand.transactions.appCallMethodCall(params)` (construct an app call transaction), or `algorand.newGroup().addAppCallMethodCall(params)` (add app call to a group of transactions). + +The base type for specifying an app call transaction is [`AppCallParams`](../code/modules/types_composer.md#appcallparams) (extended as [`AppCallMethodCall`](../code/modules/types_composer.md#appcallmethodcall) for ABI method call version), which has the following parameters in addition to the [common parameters](#common-app-parameters): + +- `onComplete?: Exclude` - On Complete can either be omitted (which will result in no-op) or set to any on-complete apart from update + +```typescript +// Basic raw example +await algorand.send.appCall({ sender: 'SENDERADDRESS' }) + +// Advanced raw example +await algorand.send.appCall({ + sender: 'SENDERADDRESS', + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) + +// Basic ABI call example +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appCallMethodCall({ + sender: 'SENDERADDRESS', + method: method, + args: ["arg1_value"] +}) +``` -All calls to smart contracts will allow you to optionally specify the arguments you want to pass in to the call. - -This [type](../code/modules/types_app.md#appcallargs) is a union of two types: `RawAppCallArgs` and `ABIAppCallArgs`. - -### `RawAppCallArgs` - -[`RawAppCallArgs`](../code/interfaces/types_app.RawAppCallArgs.md) allows you to explicitly specify all of the arguments and has the following properties (all of which are optional): - -- `accounts: (string | algosdk.Address)[]` - Any accounts to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) either as the `string` or `algosdk.Address` representation of the public address of the account(s) -- `appArgs: (Uint8Array | string)[]` - Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays), either as the binary representation or a string (that will be encoded to binary using `TextEncoder`) -- `boxes: (BoxReference | BoxIdentifier | algosdk.BoxReference)[]` - Any [boxes](#referencing-boxes) to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) -- `apps: number[]`: The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) -- `assets: number[]`: The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) -- `lease: string | Uint8Array`: A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) to assign to the transaction to enforce a mutually exclusive transaction (useful to prevent double-posting and other scenarios) -- `rekeyTo: string | SendTransactionFrom`: An account or account address that should be authorised to transact on behalf of the account the app call is sent from after the app transaction is processed; **note:** use with extreme caution and review the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/) first - -### `ABIAppCallArgs` - -[`ABIAppCallArgs`](../code/modules/types_app.md#abiappcallargs) allows you to specify an [ARC-0004 ABI call](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/ABI/) - -- `method: algosdk.ABIMethodParams | algosdk.ABIMethod` - The ABI method to call -- `methodArgs: ABIAppCallArg[]` - The arguments to pass to the ABI call, which can be one of: - - `algosdk.ABIArgument` - Which can be one of: - - `boolean` - - `number` - - `bigint` - - `string` - - `Uint8Array` - - An array of one of the above types - - `algosdk.TransactionWithSigner` - - [`TransactionToSign`](transaction.md#signing) - - `algosdk.Transaction` - - `Promise` - which allows you to use an AlgoKit Utils method call that [returns a transaction](transaction.md#sendtransactionresult) without needing to await the call and extract the transaction, if you do this be sure to use `skipWaiting: true` when specifying the [sending parameters](transaction.md#sendtransactionparams) so you get the transaction without sending it to the network -- `boxes: (BoxReference | BoxIdentifier | algosdk.BoxReference)[]` - Any [boxes](#referencing-boxes) to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) -- `lease: string | Uint8Array`: A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) to assign to the transaction to enforce a mutually exclusive transaction (useful to prevent double-posting and other scenarios) -- `rekeyTo: string | SendTransactionFrom`: An account or account address that should be authorised to transact on behalf of the account the app call is sent from after the app transaction is processed; **note:** use with extreme caution and review the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/) first - -### Utility methods - -> [!NOTE] -> These methods require the [legacy AlgoKit Utils import method to access them](../README.md#usage). - -If you want to manually construct a transaction, but use these types to specify the arguments then you can use the following methods: - -- [`algokit.getAppArgsForTransaction`](../code/modules/index.md#getappargsfortransaction) - Takes a `RawAppCallArgs` object and returns the corresponding fields ready to set onto an `algosdk.Transaction` -- [`algokit.getAppArgsForABICall`](../code/modules/index.md#getappargsforabicall) - Takes a `ABIAppCallArgs` object and returns the corresponding fields ready to pass into `addMethodCall` on `AtomicTransactionComposer` - -## Referencing boxes - -To reference a box in a transaction using AlgoKit Utils, you can specify one of the following types: - -- `BoxIdentifier` - Which can be one of: - - `string` - Which will be encoded as a box name using `TextEncoder` - - `Uint8Array` - Which will be used directly - - `SendTransactionFrom` - Which will be converted into the public address of the [sender corresponding to the account](account.md) and the public key encoded to binary - - This type of encoding is compatible with directly referencing an account address within the smart contract (e.g. `(address := pt.abi.Address()).set(pt.Txn.sender())` in PyTEAL) -- `BoxReference` - Which is an interface that has two fields: - - `appId: number` - The app ID - - `name: BoxIdentifier` - The name, per the above type -- `algosdk.BoxReference` - The in-built algosdk `BoxReference` type, which has two properties: - - `appIndex: number` - - `name: UInt8Array` - The name in binary - -If you specify a `BoxIdentifier` directly outside of the `BoxReference` type then the behaviour is to load the box from the current app the transaction that box identifier appears in. To see more about how box references work consult the [official documentation](https://developer.algorand.org/articles/smart-contract-storage-boxes/). - -### `BoxName` - -To get a box reference when reading box state there is a helpful [`BoxName`](../code/interfaces/types_app.BoxName.md) type that is exposed, which provides the following properties: - -- `name: string` -- `nameBase64: string` -- `nameRaw: Uint8Array` - -## Creating and updating apps - -> [!NOTE] -> These methods require the [legacy AlgoKit Utils import method to access them](../README.md#usage). - -### `createApp` - -To create an app you can call [`algokit.createApp(createPayload, algod)`](../code/modules/index.md#createapp). See the tests for an [example](../../src/app.spec.ts). - -The payload to configure an app consists of a union of [`SendTransactionParams`](transaction.md#sendtransactionparams) and the [following properties](../code/interfaces/types_app.CreateAppParams.md): - -- Required - - `from: SendTransactionFrom` - The [account](account.md) (with private key loaded) that will send the transaction - - `approvalProgram: Uint8Array | string` - The approval program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) - - `clearStateProgram: Uint8Array | string` - The clear state program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) - - `schema: AppStorageSchema` - The storage schema to request for the created app - - `onCompleteAction?: algosdk.OnApplicationComplete` - The on-completion action to specify for the call; defaults to NoOp -- Optional: - - `transactionParams: SuggestedParams` - Any [transaction parameters](transaction.md#transaction-params) - - `note: TransactionNote` - A [transaction note](transaction.md#transaction-notes) - - `args: AppCallArgs` - Any [arguments](#appcallargs) passed in to the app call - -If you pass in `approvalProgram` or `clearProgram` as a string then it will automatically be compiled using Algod and the compilation result will be returned from the function (including the source map). To skip this behaviour you can pass in the compiled TEAL as `Uint8Array`. - -If you pass in args that represent an ABI then it will use an `AtomicTransactionComposer` to construct and send the transaction(s). Because it's possible that other transactions may be present as ABI arguments, the full set of transactions that were sent are returned in `transactions` and the primary transaction for the create call will also be available in `transaction`. If you pass in the `atc` or `skipSending: true` then it won't execute the transaction and will simply return the transaction(s). The `return` value will have any ABI return value within it. - -### `updateApp` - -To update an app you can call [`algokit.updateApp(updatePayload, algod)`](../code/modules/index.md#updateapp). - -The update payload and behaviour is the same as `createApp` with two payload differences: +## Accessing state -- `schema` is not present, since it can only be set when creating a smart contract -- `appId: number` is present (required), which specifies the ID of the app to update +### Global state -## Calling an app +To access and parse global state you can use the following static method from [`AppManager`](#appmanager): -> [!NOTE] -> This method requires the [legacy AlgoKit Utils import method to access it](../README.md#usage). +- [`AppManager.decodeAppState(state)`](../code/classes/types_app_manager.AppManager.md#decodeappstate) - Takes the raw response from the algod API for global state and returns a friendly generic object keyed by the UTF-8 value of the key -To call an app outside of creation or update you can call [`algokit.callApp(callPayload, algod)`](../code/modules/index.md#callapp). +```typescript +const globalAppState = /* value from algod */ +const appState = AppManager.decodeAppState(globalAppState) -The payload to configure an app call consists of a union of [`SendTransactionParams`](transaction.md#sendtransactionparams) and the [following properties](../code/interfaces/types_app.AppCallParams.md): +const keyAsBinary = appState['value1'].keyRaw +const keyAsBase64 = appState['value1'].keyBase64 +if (typeof appState['value1'].value === 'string') { + const valueAsString = appState['value1'].value + const valueAsBinary = appState['value1'].valueRaw + const valueAsBase64 = appState['value1'].valueBase64 +} else { + const valueAsNumberOrBigInt = appState['value1'].value +} +``` -- Required: +The easiest way to access a decoded global state is via the `getById` method in an [`AppManager`](#appmanager) instance: - - `appId: number` - The ID of the app to call - - `callType: AppCallType | algosdk.OnApplicationComplete` - The [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for the call (either as an `algosdk.OnApplicationComplete` enum or a [string enum](../code/modules/types_app.md#appcalltype)) - - `from: SendTransactionFrom` - The [account](account.md) (with private key loaded) that will send the transaction +```typescript +const appData = await appManager.getById(12345n) +const appState = appData.globalState +``` -- Optional: - - `transactionParams: SuggestedParams` - Any [transaction parameters](transaction.md#transaction-params) - - `note: TransactionNote` - A [transaction note](transaction.md#transaction-notes) - - `args: AppCallArgs` - Any [arguments](#appcallargs) passed in to the app call +### Local state -If you pass in args that represent an ABI then it will use an `AtomicTransactionComposer` to construct and send the transaction(s). Because it's possible that other transactions may be present as ABI arguments, the full set of transactions that were sent are returned in `transactions` and the primary transaction for the create call will also be available in `transaction`. If you pass in the `atc` or `skipSending: true` then it won't execute the transaction and will simply return the transaction(s). The `return` value will have any ABI return value within it. +To access local state you can use the following method from an [`AppManager`](#appmanager) instance: -## Accessing state +- [`appManager.getLocalState(appId, address)`](../code/classes/types_app_manager.AppManager.md#getlocalstate) - Returns the current local state for the given app ID and account address decoded into an object keyed by the UTF-8 representation of the state key with various parsed versions of the value (base64, UTF-8 and raw binary) -> [!NOTE] -> These methods require the [legacy AlgoKit Utils import method to access them](../README.md#usage). +```typescript +const localState = await appManager.getLocalState(12345n, 'ACCOUNTADDRESS') +``` -### Global state +### Boxes -To access and parse global state you can use the following methods: +To access and parse box values and names for an app you can use the following methods from an [`AppManager`](#appmanager) instance: -- [`algokit.getAppGlobalState(appId, algod)`](../code/modules/index.md#getappglobalstate) - Returns the current global state for the given app ID decoded into an object keyed by the UTF-8 representation of the state key with various parsed versions of the value (base64, UTF-8 and raw binary) -- [`decodeAppState(state)`](../code/modules/index.md#decodeappstate) - Takes the raw response from algod API for global state and returned a friendly decoded object (this is automatically used by `getAppGlobalState`) +- [`appManager.getBoxNames(appId: bigint)`](../code/modules/index.md#getboxnames) - Returns the current [box names](#boxname) for the given app ID +- [`appManager.getBoxValue(appId: bigint, boxName: BoxIdentifier)`](../code/modules/index.md#getboxvalue) - Returns the binary value of the given box name for the given app ID +- [`appManager.getBoxValues(appId: bigint, boxNames: BoxIdentifier[])`](../code/modules/index.md#getboxvalues) - Returns the binary values of the given box names for the given app ID +- [`appManager.getBoxValueFromABIType(request: {appId: bigint, boxName: BoxIdentifier, type: algosdk.ABIType}})`](../code/modules/index.md#getboxvaluefromabitype) - Returns the parsed ABI value of the given box name for the given app ID for the provided ABI type +- [`appManager.getBoxValuesFromABIType(request: {appId: bigint, boxNames: BoxIdentifier[], type: algosdk.ABIType})`](../code/modules/index.md#getboxvaluesfromabitype) - Returns the parsed ABI values of the given box names for the given app ID for the provided ABI type +- [`AppManager.getBoxReference(boxId)`](../code/modules/index.md#getboxreference) - Returns a `algosdk.BoxReference` representation of the given [box identifier / reference](#box-references), which is useful when constructing a raw `algosdk.Transaction` -### Local state +```typescript +const appId = 12345n +const boxName: BoxReference = 'my-box' +const boxName2: BoxReference = 'my-box' -To access and parse local state you can use the following methods: +const boxNames = appManager.getBoxNames(appId) +const boxValue = appManager.getBoxValue(appId, boxName) +const boxValues = appManager.getBoxValues(appId, [boxName, boxName2]) +const boxABIValue = appManager.getBoxValueFromABIType(appId, boxName, algosdk.ABIStringType) +const boxABIValues = appManager.getBoxValuesFromABIType(appId, [boxName, boxName2], algosdk.ABIStringType) +``` -- [`algokit.getAppLocalState(appId, algod)`](../code/modules/index.md#getapplocalstate) - Returns the current local state for the given app ID decoded into an object keyed by the UTF-8 representation of the state key with various parsed versions of the value (base64, UTF-8 and raw binary) -- [`decodeAppState(state)`](../code/modules/index.md#decodeappstate) - Takes the raw response from algod API for local state and returned a friendly decoded object (this is automatically used by `getAppLocalState`) +## Getting app information -### Boxes +To get reference information and metadata about an existing app you can use the following methods: -To access and parse box values and names for an app you can use the following methods: +- [`appManager.getById(appId)`](../code/classes/types_app_manager.AppManager.md#getbyid) - Returns current app information by app ID from an [`AppManager`](#appmanager) instance +- [`indexer.lookupAccountCreatedApplicationByAddress(indexer, address, getAll?, paginationLimit?)`](../code/modules/index.indexer.md#lookupaccountcreatedapplicationbyaddress) - Returns all apps created by a given account from [indexer](./indexer.md) -- [`algokit.getAppBoxNames(appId, algod)`](../code/modules/index.md#getappboxnames) - Returns the current [box names](#boxname) for the given app ID -- [`algokit.getAppBoxValue(appId, boxName, algod)`](../code/modules/index.md#getappboxvalue) - Returns the binary value of the given box name for the given app ID -- [`algokit.getAppBoxValues(appId, boxNames, algod)`](../code/modules/index.md#getappboxvalues) - Returns the binary values of the given box names for the given app ID -- [`algokit.getAppBoxValueFromABIType(request, algod)`](../code/modules/index.md#getappboxvaluefromabitype) - Returns the parsed ABI value of the given box name for the given app ID for the provided ABI type -- [`algokit.getAppBoxValuesFromABIType(request, algod)`](../code/modules/index.md#getappboxvaluesfromabitype) - Returns the parsed ABI values of the given box names for the given app ID for the provided ABI type -- [`algokit.getBoxReference(box)`](../code/modules/index.md#getboxreference) - Returns an `algosdk.BoxReference` representation of the given [box identifier](#referencing-boxes), which is useful when constructing a raw `algosdk.Transaction` +## Common app parameters -## Getting an app reference +When interacting with apps (creating, updating, deleting, calling), there are some [`CommonAppCallParams`](../code/modules/types_composer.md#commonappcallparams) that you will be able to pass in to all calls in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): -> [!NOTE] -> These methods require the [legacy AlgoKit Utils import method to access them](../README.md#usage). +- `appId: bigint` - ID of the application; only specified if the application is not being created. +- `onComplete?: algosdk.OnApplicationComplete` - The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call (noting each call type will have restrictions that affect this value). +- `args?: Uint8Array[]` - Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). +- `accountReferences?: string[]` - Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). +- `appReferences?: bigint[]` - The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). +- `assetReferences?: bigint[]` - The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). +- `boxReferences?: (BoxReference | BoxIdentifier)[]` - Any [boxes](#box-references) to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays) -To get reference information and metadata about an existing app you can use the following methods: +When making an ABI call, the `args` parameter is replaced with a different type and there is also a `method` parameter per the [`AppMethodCall`](../code/modules/types_composer.md#appmethodcall) type: -- [`algokit.getAppById(appId, algod)`](../code/modules/index.md#getappbyindex) - Returns an app reference by ID from algod -- [`algokit.lookupAccountCreatedApplicationByAddress(indexer, address, getAll?, paginationLimit?)`](../code/modules/index.md#lookupaccountcreatedapplicationbyaddress) - Returns all apps created by a given account from indexer +- `method: algosdk.ABIMethod` +- `args: ABIArgument[]` The arguments to pass to the ABI call, which can be one of: + - `algosdk.ABIValue` - Which can be one of: + - `boolean` + - `number` + - `bigint` + - `string` + - `Uint8Array` + - An array of one of the above types + - `algosdk.TransactionWithSigner` + - `algosdk.Transaction` + - `Promise` - which allows you to use an AlgorandClient call that [returns a transaction](./algorand-client.md#creating-single-transactions) without needing to await the call + - `AppMethodCall` - parameters that define another (nested) ABI method call, which will in turn get resolved to one or more transactions + +## Box references + +Referencing boxes can by done by either `BoxIdentifier` (which identifies the name of the box and app ID `0` will be used (i.e. the current app)) or `BoxReference`: + +```typescript +/** + * Something that identifies an app box name - either a: + * * `Uint8Array` (the actual binary of the box name) + * * `string` (that will be encoded to a `Uint8Array`) + * * `TransactionSignerAccount` (that will be encoded into the + * public key address of the corresponding account) + */ +export type BoxIdentifier = string | Uint8Array | TransactionSignerAccount + +/** + * A grouping of the app ID and name identifier to reference an app box. + */ +export interface BoxReference { + /** + * A unique application id + */ + appId: bigint + /** + * Identifier for a box name + */ + name: BoxIdentifier +} +``` + +## Compilation + +The [`AppManager`](#appmanager) class allows you to compile TEAL code with caching semantics that allows you to avoid duplicate compilation and keep track of source maps from compiled code. + +If you call `appManager.compileTeal(tealCode)` then the compilation result will be stored and retrievable from `appManager.getCompilationResult(tealCode)`. + +```typescript +const tealCode = 'return 1' +const compilationResult = await appManager.compileTeal(tealCode) +// ... +const previousCompilationResult = appManager.getCompilationResult(tealCode) +``` diff --git a/docs/capabilities/asset.md b/docs/capabilities/asset.md index 5df19607..768e9eec 100644 --- a/docs/capabilities/asset.md +++ b/docs/capabilities/asset.md @@ -8,17 +8,18 @@ To see some usage examples check out the [automated tests](../../src/types/algor The [`AssetManager`](../code/classes/types_asset_manager.AssetManager.md) is a class that is used to manage asset information. -To get an instance of `AssetManager`, you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.asset` or instantiate it directly (passing in a [`ClientManager`](./client.md)): +To get an instance of `AssetManager`, you can use either [`AlgorandClient`](./algorand-client.md) via `algorand.asset` or instantiate it directly: ```typescript import { AssetManager } from '@algorandfoundation/algokit-utils/types/asset-manager' +import { AlgoKitComposer } from '@algorandfoundation/algokit-utils/types/composer' -const assetManager = new AssetManager(clientManager) +const assetManager = new AssetManager(algod, () => new AlgoKitComposer({algod, () => signer, () => suggestedParams})) ``` ## Creation -To create an asset you can use `algorand.send.assetCreate(params)` (immediately send a single asset creation transaction), `algorand.transaction.assetCreate(params)` (construct an asset creation transaction), or `algorand.newGroup().addAssetCreate(params)` (add asset creation to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +To create an asset you can use `algorand.send.assetCreate(params)` (immediately send a single asset creation transaction), `algorand.transactions.assetCreate(params)` (construct an asset creation transaction), or `algorand.newGroup().addAssetCreate(params)` (add asset creation to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). The base type for specifying an asset creation transaction is [`AssetCreateParams`](../code/modules/types_composer.md#assetcreateparams), which has the following parameters in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): @@ -81,7 +82,7 @@ If you have a `manager` address set on an asset, that address can send a reconfi > [!WARNING] > If you issue a reconfigure transaction and don't set the _existing_ values for any of the below fields then that field will be permanently set to empty. -To reconfigure an asset you can use `algorand.send.assetConfig(params)` (immediately send a single asset config transaction), `algorand.transaction.assetConfig(params)` (construct an asset config transaction), or `algorand.newGroup().addAssetConfig(params)` (add asset config to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +To reconfigure an asset you can use `algorand.send.assetConfig(params)` (immediately send a single asset config transaction), `algorand.transactions.assetConfig(params)` (construct an asset config transaction), or `algorand.newGroup().addAssetConfig(params)` (add asset config to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). The base type for specifying an asset creation transaction is [`AssetConfigParams`](../code/modules/types_composer.md#assetconfigparams), which has the following parameters in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): @@ -128,7 +129,7 @@ await algorand.send.assetConfig({ ## Transfer -To transfer unit(s) of an asset between accounts you can use `algorand.send.assetTransfer(params)` (immediately send a single asset transfer transaction), `algorand.transaction.assetTransfer(params)` (construct an asset transfer transaction), or `algorand.newGroup().addAssetTransfer(params)` (add asset transfer to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +To transfer unit(s) of an asset between accounts you can use `algorand.send.assetTransfer(params)` (immediately send a single asset transfer transaction), `algorand.transactions.assetTransfer(params)` (construct an asset transfer transaction), or `algorand.newGroup().addAssetTransfer(params)` (add asset transfer to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). **Note:** For an account to receive an asset it needs to have [opted-in](#opt-inout). @@ -188,7 +189,7 @@ AlgoKit Utils gives you functions that allow you to do opt-ins and opt-outs in b ### `assetOptIn` -To opt-in to an asset you can use `algorand.send.assetOptIn(params)` (immediately send a single asset opt-in transaction), `algorand.transaction.assetOptIn(params)` (construct an asset opt-in transaction), or `algorand.newGroup().addAssetOptIn(params)` (add asset opt-in to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +To opt-in to an asset you can use `algorand.send.assetOptIn(params)` (immediately send a single asset opt-in transaction), `algorand.transactions.assetOptIn(params)` (construct an asset opt-in transaction), or `algorand.newGroup().addAssetOptIn(params)` (add asset opt-in to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). The base type for specifying an asset opt-in transaction is [`AssetOptInParams`](../code/modules/types_composer.md#assetoptinparams), which has the following parameters in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): @@ -225,7 +226,7 @@ await algorand.send.assetOptIn({ ### `assetOptOut` -To opt-out to an asset you can use `algorand.send.assetOptOut(params)` (immediately send a single asset opt-out transaction), `algorand.transaction.assetOptOut(params)` (construct an asset opt-out transaction), or `algorand.newGroup().addAssetOptOut(params)` (add asset opt-out to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +To opt-out to an asset you can use `algorand.send.assetOptOut(params)` (immediately send a single asset opt-out transaction), `algorand.transactions.assetOptOut(params)` (construct an asset opt-out transaction), or `algorand.newGroup().addAssetOptOut(params)` (add asset opt-out to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). The base type for specifying an asset opt-out transaction is [`AssetOptOutParams`](../code/modules/types_composer.md#assetoptoutparams), which has the following parameters in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): diff --git a/docs/capabilities/transfer.md b/docs/capabilities/transfer.md index 9d6685f5..74c6707b 100644 --- a/docs/capabilities/transfer.md +++ b/docs/capabilities/transfer.md @@ -6,7 +6,7 @@ To see some usage examples check out the [automated tests](../../src/types/algor ## `payment` -The key function to facilitate Algo transfers is `algorand.send.payment(params)` (immediately send a single payment transaction), `algorand.transaction.payment(params)` (construct a payment transaction), or `algorand.newGroup().addPayment(params)` (add payment to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). +The key function to facilitate Algo transfers is `algorand.send.payment(params)` (immediately send a single payment transaction), `algorand.transactions.payment(params)` (construct a payment transaction), or `algorand.newGroup().addPayment(params)` (add payment to a group of transactions) per [`AlgorandClient`](./algorand-client.md) [transaction semantics](./algorand-client.md#creating-and-issuing-transactions). The base type for specifying a payment transaction is [`PaymentParams`](../code/modules/types_composer.md#paymentparams), which has the following parameters in addition to the [common transaction parameters](./algorand-client.md#transaction-parameters): diff --git a/docs/code/README.md b/docs/code/README.md index f07fa41d..05cc26d5 100644 --- a/docs/code/README.md +++ b/docs/code/README.md @@ -23,6 +23,8 @@ - [types/app](modules/types_app.md) - [types/app-client](modules/types_app_client.md) - [types/app-client.spec](modules/types_app_client_spec.md) +- [types/app-deployer](modules/types_app_deployer.md) +- [types/app-manager](modules/types_app_manager.md) - [types/app-spec](modules/types_app_spec.md) - [types/asset](modules/types_asset.md) - [types/asset-manager](modules/types_asset_manager.md) @@ -33,6 +35,7 @@ - [types/debugging](modules/types_debugging.md) - [types/dispenser-client](modules/types_dispenser_client.md) - [types/dispenser-client.spec](modules/types_dispenser_client_spec.md) +- [types/expand](modules/types_expand.md) - [types/indexer](modules/types_indexer.md) - [types/kmd-account-manager](modules/types_kmd_account_manager.md) - [types/logging](modules/types_logging.md) diff --git a/docs/code/classes/types_account_manager.AccountManager.md b/docs/code/classes/types_account_manager.AccountManager.md index 25ac4e9b..95e1574f 100644 --- a/docs/code/classes/types_account_manager.AccountManager.md +++ b/docs/code/classes/types_account_manager.AccountManager.md @@ -212,7 +212,7 @@ ___ ### ensureFunded -▸ **ensureFunded**(`accountToFund`, `dispenserAccount`, `minSpendingBalance`, `options?`): `Promise`\<`undefined` \| [`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> +▸ **ensureFunded**(`accountToFund`, `dispenserAccount`, `minSpendingBalance`, `options?`): `Promise`\<`undefined` \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> Funds a given account using a dispenser account as a funding source such that the given account has a certain amount of Algo free to spend (accounting for @@ -231,7 +231,7 @@ https://developer.algorand.org/docs/get-details/accounts/#minimum-balance #### Returns -`Promise`\<`undefined` \| [`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> +`Promise`\<`undefined` \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> - The result of executing the dispensing transaction and the `amountFunded` if funds were needed. - `undefined` if no funds were needed. @@ -255,7 +255,7 @@ ___ ### ensureFundedFromEnvironment -▸ **ensureFundedFromEnvironment**(`accountToFund`, `minSpendingBalance`, `options?`): `Promise`\<`undefined` \| [`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> +▸ **ensureFundedFromEnvironment**(`accountToFund`, `minSpendingBalance`, `options?`): `Promise`\<`undefined` \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> Funds a given account using a dispenser account retrieved from the environment, per the `dispenserFromEnvironment` method, as a funding source such that @@ -280,7 +280,7 @@ https://developer.algorand.org/docs/get-details/accounts/#minimum-balance #### Returns -`Promise`\<`undefined` \| [`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> +`Promise`\<`undefined` \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & [`EnsureFundedResult`](../interfaces/types_account_manager.EnsureFundedResult.md)\> - The result of executing the dispensing transaction and the `amountFunded` if funds were needed. - `undefined` if no funds were needed. @@ -671,7 +671,7 @@ ___ ### rekeyAccount -▸ **rekeyAccount**(`account`, `rekeyTo`, `options?`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ **rekeyAccount**(`account`, `rekeyTo`, `options?`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Rekey an account to a new address. @@ -687,7 +687,7 @@ Rekey an account to a new address. #### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> The result of the transaction and the transaction that was sent diff --git a/docs/code/classes/types_algorand_client.AlgorandClient.md b/docs/code/classes/types_algorand_client.AlgorandClient.md index 3a9df0a9..a90009e1 100644 --- a/docs/code/classes/types_algorand_client.AlgorandClient.md +++ b/docs/code/classes/types_algorand_client.AlgorandClient.md @@ -15,6 +15,8 @@ A client that brokers easy access to Algorand functionality. ### Properties - [\_accountManager](types_algorand_client.AlgorandClient.md#_accountmanager) +- [\_appDeployer](types_algorand_client.AlgorandClient.md#_appdeployer) +- [\_appManager](types_algorand_client.AlgorandClient.md#_appmanager) - [\_assetManager](types_algorand_client.AlgorandClient.md#_assetmanager) - [\_cachedSuggestedParams](types_algorand_client.AlgorandClient.md#_cachedsuggestedparams) - [\_cachedSuggestedParamsExpiry](types_algorand_client.AlgorandClient.md#_cachedsuggestedparamsexpiry) @@ -27,6 +29,8 @@ A client that brokers easy access to Algorand functionality. ### Accessors - [account](types_algorand_client.AlgorandClient.md#account) +- [app](types_algorand_client.AlgorandClient.md#app) +- [appDeployer](types_algorand_client.AlgorandClient.md#appdeployer) - [asset](types_algorand_client.AlgorandClient.md#asset) - [client](types_algorand_client.AlgorandClient.md#client) - [send](types_algorand_client.AlgorandClient.md#send) @@ -67,7 +71,7 @@ A client that brokers easy access to Algorand functionality. #### Defined in -[src/types/algorand-client.ts:29](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L29) +[src/types/algorand-client.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L33) ## Properties @@ -77,7 +81,27 @@ A client that brokers easy access to Algorand functionality. #### Defined in -[src/types/algorand-client.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L18) +[src/types/algorand-client.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L20) + +___ + +### \_appDeployer + +• `Private` **\_appDeployer**: [`AppDeployer`](types_app_deployer.AppDeployer.md) + +#### Defined in + +[src/types/algorand-client.ts:22](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L22) + +___ + +### \_appManager + +• `Private` **\_appManager**: [`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/algorand-client.ts:21](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L21) ___ @@ -87,7 +111,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:19](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L19) +[src/types/algorand-client.ts:23](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L23) ___ @@ -97,7 +121,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:23](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L23) +[src/types/algorand-client.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L27) ___ @@ -107,7 +131,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L24) +[src/types/algorand-client.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L28) ___ @@ -117,7 +141,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L25) +[src/types/algorand-client.ts:29](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L29) ___ @@ -127,7 +151,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:17](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L17) +[src/types/algorand-client.ts:19](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L19) ___ @@ -137,7 +161,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L27) +[src/types/algorand-client.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L31) ___ @@ -147,7 +171,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:21](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L21) +[src/types/algorand-client.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L25) ___ @@ -157,7 +181,7 @@ ___ #### Defined in -[src/types/algorand-client.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L20) +[src/types/algorand-client.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L24) ## Accessors @@ -173,7 +197,39 @@ Get or create accounts that can sign transactions. #### Defined in -[src/types/algorand-client.ts:134](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L134) +[src/types/algorand-client.ts:140](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L140) + +___ + +### app + +• `get` **app**(): [`AppManager`](types_app_manager.AppManager.md) + +Methods for interacting with apps. + +#### Returns + +[`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/algorand-client.ts:150](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L150) + +___ + +### appDeployer + +• `get` **appDeployer**(): [`AppDeployer`](types_app_deployer.AppDeployer.md) + +Methods for deploying apps and managing app deployment metadata. + +#### Returns + +[`AppDeployer`](types_app_deployer.AppDeployer.md) + +#### Defined in + +[src/types/algorand-client.ts:155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L155) ___ @@ -189,7 +245,7 @@ Methods for interacting with assets. #### Defined in -[src/types/algorand-client.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L139) +[src/types/algorand-client.ts:145](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L145) ___ @@ -205,7 +261,7 @@ Get clients, including algosdk clients and app clients. #### Defined in -[src/types/algorand-client.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L129) +[src/types/algorand-client.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L135) ___ @@ -221,7 +277,7 @@ Methods for sending a single transaction. #### Defined in -[src/types/algorand-client.ts:156](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L156) +[src/types/algorand-client.ts:173](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L173) ___ @@ -237,7 +293,7 @@ Methods for building transactions #### Defined in -[src/types/algorand-client.ts:163](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L163) +[src/types/algorand-client.ts:180](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L180) ## Methods @@ -253,7 +309,7 @@ Get suggested params for a transaction (either cached or from algod if the cache #### Defined in -[src/types/algorand-client.ts:113](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L113) +[src/types/algorand-client.ts:119](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L119) ___ @@ -269,7 +325,7 @@ Start a new `AlgoKitComposer` transaction group #### Defined in -[src/types/algorand-client.ts:144](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L144) +[src/types/algorand-client.ts:160](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L160) ___ @@ -293,7 +349,7 @@ The `AlgorandClient` so method calls can be chained #### Defined in -[src/types/algorand-client.ts:52](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L52) +[src/types/algorand-client.ts:58](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L58) ___ @@ -317,7 +373,7 @@ The `AlgorandClient` so method calls can be chained #### Defined in -[src/types/algorand-client.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L42) +[src/types/algorand-client.ts:48](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L48) ___ @@ -342,7 +398,7 @@ The `AlgorandClient` so method calls can be chained #### Defined in -[src/types/algorand-client.ts:85](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L85) +[src/types/algorand-client.ts:91](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L91) ___ @@ -377,7 +433,7 @@ const accountManager = AlgorandClient.mainnet() #### Defined in -[src/types/algorand-client.ts:72](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L72) +[src/types/algorand-client.ts:78](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L78) ___ @@ -402,7 +458,7 @@ The `AlgorandClient` so method calls can be chained #### Defined in -[src/types/algorand-client.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L96) +[src/types/algorand-client.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L102) ___ @@ -426,7 +482,7 @@ The `AlgorandClient` so method calls can be chained #### Defined in -[src/types/algorand-client.ts:107](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L107) +[src/types/algorand-client.ts:113](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L113) ___ @@ -444,7 +500,7 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:173](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L173) +[src/types/algorand-client.ts:190](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L190) ___ @@ -468,7 +524,7 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:210](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L210) +[src/types/algorand-client.ts:227](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L227) ___ @@ -492,7 +548,7 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:240](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L240) +[src/types/algorand-client.ts:257](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L257) ___ @@ -523,7 +579,7 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:231](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L231) +[src/types/algorand-client.ts:248](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L248) ___ @@ -541,7 +597,7 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:197](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L197) +[src/types/algorand-client.ts:214](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L214) ___ @@ -559,4 +615,4 @@ The `AlgorandClient` #### Defined in -[src/types/algorand-client.ts:185](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L185) +[src/types/algorand-client.ts:202](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client.ts#L202) diff --git a/docs/code/classes/types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md b/docs/code/classes/types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md index a71fa3eb..f6c913de 100644 --- a/docs/code/classes/types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md +++ b/docs/code/classes/types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md @@ -16,6 +16,13 @@ Orchestrates creating transactions for `AlgorandClient`. - [\_newGroup](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#_newgroup) - [appCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appcall) +- [appCallMethodCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appcallmethodcall) +- [appCreate](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appcreate) +- [appCreateMethodCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appcreatemethodcall) +- [appDelete](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appdelete) +- [appDeleteMethodCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appdeletemethodcall) +- [appUpdate](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appupdate) +- [appUpdateMethodCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#appupdatemethodcall) - [assetConfig](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#assetconfig) - [assetCreate](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#assetcreate) - [assetDestroy](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#assetdestroy) @@ -29,7 +36,7 @@ Orchestrates creating transactions for `AlgorandClient`. ### Methods - [\_transaction](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#_transaction) -- [methodCall](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#methodcall) +- [\_transactions](types_algorand_client_transaction_creator.AlgorandClientTransactionCreator.md#_transactions) ## Constructors @@ -51,7 +58,7 @@ Creates a new `AlgorandClientTransactionCreator` #### Defined in -[src/types/algorand-client-transaction-creator.ts:14](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L14) +[src/types/algorand-client-transaction-creator.ts:15](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L15) ## Properties @@ -69,7 +76,7 @@ Creates a new `AlgorandClientTransactionCreator` #### Defined in -[src/types/algorand-client-transaction-creator.ts:8](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L8) +[src/types/algorand-client-transaction-creator.ts:9](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L9) ___ @@ -79,15 +86,540 @@ ___ Create an application call transaction. +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.transactions.appCall({ sender: 'CREATORADDRESS' }) +``` + +**`Example`** + +```typescript +await algorand.transactions.appCall({ + sender: 'CREATORADDRESS', + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + #### Type declaration ▸ (`params`): `Promise`\<`Transaction`\> ##### Parameters -| Name | Type | -| :------ | :------ | -| `params` | [`AppCallParams`](../modules/types_composer.md#appcallparams) | +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCallParams`](../modules/types_composer.md#appcallparams) | The parameters for the app call transaction | + +##### Returns + +`Promise`\<`Transaction`\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:470](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L470) + +___ + +### appCallMethodCall + +• **appCallMethodCall**: (`params`: [`AppCallMethodCall`](../modules/types_composer.md#appcallmethodcall)) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +Create an application call with ABI method call transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appCallMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCallMethodCall`](../modules/types_composer.md#appcallmethodcall) | The parameters for the app call transaction | + +##### Returns + +`Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:686](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L686) + +___ + +### appCreate + +• **appCreate**: (`params`: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }) => `Promise`\<`Transaction`\> + +Create an application create transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const result = await algorand.transactions.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) +const createdAppId = result.appId +``` + +**`Example`** + +```typescript +await algorand.transactions.appCreate({ + sender: 'CREATORADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4 + }, + extraProgramPages: 1, + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<`Transaction`\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | `Object` | The parameters for the app creation transaction | +| `params.accountReferences?` | `string`[] | Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.appReferences?` | `bigint`[] | The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.approvalProgram` | `string` \| `Uint8Array` | The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). | +| `params.args?` | `Uint8Array`[] | Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). | +| `params.assetReferences?` | `bigint`[] | The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.boxReferences?` | ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] | Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#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. | +| `params.clearStateProgram` | `string` \| `Uint8Array` | The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). | +| `params.extraFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The fee to pay IN ADDITION to the suggested fee. Useful for covering inner transaction fees. | +| `params.extraProgramPages?` | `number` | Number of extra pages required for the programs. This is immutable once the app is created. | +| `params.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. | +| `params.lastValidRound?` | `bigint` | The last round this transaction is valid. It is recommended to use `validityWindow` instead. | +| `params.lease?` | `string` \| `Uint8Array` | Prevent multiple transactions with the same lease being included within the validity window. A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios). | +| `params.maxFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. | +| `params.note?` | `string` \| `Uint8Array` | Note to attach to the transaction. Max of 1000 bytes. | +| `params.onComplete?` | `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` | The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. | +| `params.rekeyTo?` | `string` | 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://developer.algorand.org/docs/get-details/accounts/rekey/). | +| `params.schema?` | `Object` | The state schema for the app. This is immutable once the app is created. | +| `params.schema.globalByteSlices` | `number` | The number of byte slices saved in global state. | +| `params.schema.globalInts` | `number` | The number of integers saved in global state. | +| `params.schema.localByteSlices` | `number` | The number of byte slices saved in local state. | +| `params.schema.localInts` | `number` | The number of integers saved in local state. | +| `params.sender` | `string` | The address of the account sending the transaction. | +| `params.signer?` | `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | 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). | +| `params.staticFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. | +| `params.validityWindow?` | `number` | How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. | + +##### Returns + +`Promise`\<`Transaction`\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:351](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L351) + +___ + +### appCreateMethodCall + +• **appCreateMethodCall**: (`params`: [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall)) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +Create an application create call with ABI method call transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +const result = await algorand.transactions.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) +const createdAppId = result.appId +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appCreate({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4 + }, + extraProgramPages: 1, + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) | The parameters for the app creation transaction | + +##### Returns + +`Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:531](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L531) + +___ + +### appDelete + +• **appDelete**: (`params`: [`AppDeleteParams`](../modules/types_composer.md#appdeleteparams)) => `Promise`\<`Transaction`\> + +Create an application delete transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.transactions.appDelete({ sender: 'CREATORADDRESS' }) +``` + +**`Example`** + +```typescript +await algorand.transactions.appDelete({ + sender: 'CREATORADDRESS', + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<`Transaction`\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppDeleteParams`](../modules/types_composer.md#appdeleteparams) | The parameters for the app deletion transaction | + +##### Returns + +`Promise`\<`Transaction`\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:431](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L431) + +___ + +### appDeleteMethodCall + +• **appDeleteMethodCall**: (`params`: [`AppDeleteMethodCall`](../modules/types_composer.md#appdeletemethodcall)) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +Create an application delete call with ABI method call transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appDeleteMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppDeleteMethodCall`](../modules/types_composer.md#appdeletemethodcall) | The parameters for the app deletion transaction | + +##### Returns + +`Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:635](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L635) + +___ + +### appUpdate + +• **appUpdate**: (`params`: \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }) => `Promise`\<`Transaction`\> + +Create an application update transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.transactions.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) +``` + +**`Example`** + +```typescript +await algorand.transactions.appUpdate({ + sender: 'CREATORADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<`Transaction`\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | `Object` | The parameters for the app update transaction | +| `params.accountReferences?` | `string`[] | Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.appId` | `bigint` | ID of the application; 0 if the application is being created. | +| `params.appReferences?` | `bigint`[] | The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.approvalProgram` | `string` \| `Uint8Array` | The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) | +| `params.args?` | `Uint8Array`[] | Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). | +| `params.assetReferences?` | `bigint`[] | The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.boxReferences?` | ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] | Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#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. | +| `params.clearStateProgram` | `string` \| `Uint8Array` | The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) | +| `params.extraFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The fee to pay IN ADDITION to the suggested fee. Useful for covering inner transaction fees. | +| `params.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. | +| `params.lastValidRound?` | `bigint` | The last round this transaction is valid. It is recommended to use `validityWindow` instead. | +| `params.lease?` | `string` \| `Uint8Array` | Prevent multiple transactions with the same lease being included within the validity window. A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios). | +| `params.maxFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. | +| `params.note?` | `string` \| `Uint8Array` | Note to attach to the transaction. Max of 1000 bytes. | +| `params.onComplete?` | `UpdateApplicationOC` | The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. | +| `params.rekeyTo?` | `string` | 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://developer.algorand.org/docs/get-details/accounts/rekey/). | +| `params.sender` | `string` | The address of the account sending the transaction. | +| `params.signer?` | `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | 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). | +| `params.staticFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. | +| `params.validityWindow?` | `number` | How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. | ##### Returns @@ -95,7 +627,85 @@ Create an application call transaction. #### Defined in -[src/types/algorand-client-transaction-creator.ts:296](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L296) +[src/types/algorand-client-transaction-creator.ts:392](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L392) + +___ + +### appUpdateMethodCall + +• **appUpdateMethodCall**: (`params`: [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall)) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +Create an application update call with ABI method call transaction. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.transactions.appUpdateMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall) | The parameters for the app update transaction | + +##### Returns + +`Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-creator.ts:584](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L584) ___ @@ -112,13 +722,13 @@ all fields are immutable from that point forward. **`Example`** ```typescript -await algorand.transaction.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" }) +await algorand.transactions.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" }) ``` **`Example`** ```typescript -await algorand.transaction.assetConfig({ +await algorand.transactions.assetConfig({ sender: 'MANAGERADDRESS', assetId: 123456n, manager: 'MANAGERADDRESS', @@ -154,7 +764,7 @@ await algorand.transaction.assetConfig({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:138](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L138) +[src/types/algorand-client-transaction-creator.ts:146](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L146) ___ @@ -170,13 +780,13 @@ opted in to the asset and will hold all units after creation. **`Example`** ```typescript -await algorand.transaction.assetCreate({sender: "CREATORADDRESS", total: 100n}) +await algorand.transactions.assetCreate({sender: "CREATORADDRESS", total: 100n}) ``` **`Example`** ```typescript -await algorand.transaction.assetCreate({ +await algorand.transactions.assetCreate({ sender: 'CREATORADDRESS', total: 100n, decimals: 2, @@ -218,7 +828,7 @@ await algorand.transaction.assetCreate({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L102) +[src/types/algorand-client-transaction-creator.ts:110](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L110) ___ @@ -235,13 +845,13 @@ the asset can be deleted. **`Example`** ```typescript -await algorand.transaction.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n }) +await algorand.transactions.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n }) ``` **`Example`** ```typescript -await algorand.transaction.assetDestroy({ +await algorand.transactions.assetDestroy({ sender: 'MANAGERADDRESS', assetId: 123456n, lease: 'lease', @@ -273,7 +883,7 @@ await algorand.transaction.assetDestroy({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:200](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L200) +[src/types/algorand-client-transaction-creator.ts:208](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L208) ___ @@ -286,13 +896,13 @@ Create an Algorand Standard Asset freeze transaction. **`Example`** ```typescript -await algorand.transaction.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true }) +await algorand.transactions.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true }) ``` **`Example`** ```typescript -await algorand.transaction.assetFreeze({ +await algorand.transactions.assetFreeze({ sender: 'MANAGERADDRESS', assetId: 123456n, account: 'ACCOUNTADDRESS', @@ -326,7 +936,7 @@ await algorand.transaction.assetFreeze({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:168](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L168) +[src/types/algorand-client-transaction-creator.ts:176](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L176) ___ @@ -339,13 +949,13 @@ Create an Algorand Standard Asset opt-in transaction. **`Example`** ```typescript -await algorand.transaction.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n }) +await algorand.transactions.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n }) ``` **`Example`** ```typescript -await algorand.transaction.assetOptIn({ +await algorand.transactions.assetOptIn({ sender: 'SENDERADDRESS', assetId: 123456n, lease: 'lease', @@ -377,7 +987,7 @@ await algorand.transaction.assetOptIn({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:261](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L261) +[src/types/algorand-client-transaction-creator.ts:269](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L269) ___ @@ -393,13 +1003,13 @@ it will lose those assets **`Example`** ```typescript -await algorand.transaction.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n }) +await algorand.transactions.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n }) ``` **`Example`** ```typescript -await algorand.transaction.assetOptIn({ +await algorand.transactions.assetOptIn({ sender: 'SENDERADDRESS', assetId: 123456n, creator: 'CREATORADDRESS', @@ -433,7 +1043,7 @@ await algorand.transaction.assetOptIn({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:294](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L294) +[src/types/algorand-client-transaction-creator.ts:302](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L302) ___ @@ -446,13 +1056,13 @@ Create an Algorand Standard Asset transfer transaction. **`Example`** ```typescript -await algorand.transaction.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" }) +await algorand.transactions.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" }) ``` **`Example`** ```typescript -await algorand.transaction.assetTransfer({ +await algorand.transactions.assetTransfer({ sender: 'CLAWBACKADDRESS', assetId: 123456n, amount: 1n, @@ -489,7 +1099,7 @@ await algorand.transaction.assetTransfer({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:233](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L233) +[src/types/algorand-client-transaction-creator.ts:241](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L241) ___ @@ -515,7 +1125,7 @@ Create an online key registration transaction. #### Defined in -[src/types/algorand-client-transaction-creator.ts:302](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L302) +[src/types/algorand-client-transaction-creator.ts:688](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L688) ___ @@ -528,7 +1138,7 @@ Create a payment transaction to transfer Algo between accounts. **`Example`** ```typescript -const result = await algorandClient.send.payment({ +const result = await algorand.send.payment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: (4).algo(), @@ -538,7 +1148,7 @@ const result = await algorandClient.send.payment({ **`Example`** ```typescript -const result = await algorandClient.send.payment({ +const result = await algorand.send.payment({ amount: (4).algo(), receiver: 'RECEIVERADDRESS', sender: 'SENDERADDRESS', @@ -574,7 +1184,7 @@ const result = await algorandClient.send.payment({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:61](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L61) +[src/types/algorand-client-transaction-creator.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L69) ## Methods @@ -612,26 +1222,42 @@ const result = await algorandClient.send.payment({ #### Defined in -[src/types/algorand-client-transaction-creator.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L18) +[src/types/algorand-client-transaction-creator.ts:19](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L19) ___ -### methodCall +### \_transactions -▸ **methodCall**(`params`): `Promise`\<`Transaction`[]\> +▸ **_transactions**\<`T`\>(`c`): (`params`: `T`) => `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> -Create an application call with ABI method call transaction. +#### Type parameters + +| Name | +| :------ | +| `T` | #### Parameters | Name | Type | | :------ | :------ | -| `params` | [`MethodCallParams`](../modules/types_composer.md#methodcallparams) | +| `c` | (`c`: [`default`](types_composer.default.md)) => (`params`: `T`) => [`default`](types_composer.default.md) | #### Returns -`Promise`\<`Transaction`[]\> +`fn` + +▸ (`params`): `Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | `T` | + +##### Returns + +`Promise`\<\{ `methodCalls`: `Map`\<`number`, `ABIMethod`\> ; `signers`: `Map`\<`number`, `TransactionSigner`\> ; `transactions`: `Transaction`[] }\> #### Defined in -[src/types/algorand-client-transaction-creator.ts:298](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L298) +[src/types/algorand-client-transaction-creator.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-creator.ts#L27) diff --git a/docs/code/classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md b/docs/code/classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md index 05ea5455..c4055fbd 100644 --- a/docs/code/classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md +++ b/docs/code/classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md @@ -14,29 +14,40 @@ Orchestrates sending transactions for `AlgorandClient`. ### Properties +- [\_appManager](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_appmanager) - [\_assetManager](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_assetmanager) - [\_newGroup](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_newgroup) - [appCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appcall) +- [appCallMethodCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appcallmethodcall) +- [appCreate](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appcreate) +- [appCreateMethodCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appcreatemethodcall) +- [appDelete](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appdelete) +- [appDeleteMethodCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appdeletemethodcall) +- [appUpdate](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appupdate) +- [appUpdateMethodCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#appupdatemethodcall) - [assetConfig](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetconfig) - [assetDestroy](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetdestroy) - [assetFreeze](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetfreeze) - [assetOptIn](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetoptin) - [assetTransfer](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assettransfer) -- [methodCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#methodcall) - [onlineKeyRegistration](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#onlinekeyregistration) - [payment](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#payment) ### Methods - [\_send](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_send) +- [\_sendAppCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_sendappcall) +- [\_sendAppCreateCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_sendappcreatecall) +- [\_sendAppUpdateCall](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#_sendappupdatecall) - [assetCreate](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetcreate) - [assetOptOut](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#assetoptout) +- [newGroup](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md#newgroup) ## Constructors ### constructor -• **new AlgorandClientTransactionSender**(`newGroup`, `assetManager`): [`AlgorandClientTransactionSender`](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) +• **new AlgorandClientTransactionSender**(`newGroup`, `assetManager`, `appManager`): [`AlgorandClientTransactionSender`](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) Creates a new `AlgorandClientSender` @@ -46,6 +57,7 @@ Creates a new `AlgorandClientSender` | :------ | :------ | :------ | | `newGroup` | () => [`default`](types_composer.default.md) | A lambda that starts a new `AlgoKitComposer` transaction group | | `assetManager` | [`AssetManager`](types_asset_manager.AssetManager.md) | An `AssetManager` instance | +| `appManager` | [`AppManager`](types_app_manager.AppManager.md) | - | #### Returns @@ -53,17 +65,27 @@ Creates a new `AlgorandClientSender` #### Defined in -[src/types/algorand-client-transaction-sender.ts:22](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L22) +[src/types/algorand-client-transaction-sender.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L33) ## Properties +### \_appManager + +• `Private` **\_appManager**: [`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:26](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L26) + +___ + ### \_assetManager • `Private` **\_assetManager**: [`AssetManager`](types_asset_manager.AssetManager.md) #### Defined in -[src/types/algorand-client-transaction-sender.ts:15](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L15) +[src/types/algorand-client-transaction-sender.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L25) ___ @@ -81,41 +103,597 @@ ___ #### Defined in -[src/types/algorand-client-transaction-sender.ts:14](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L14) +[src/types/algorand-client-transaction-sender.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L24) ___ ### appCall -• **appCall**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId?`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram?`: `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: `BoxReference`[] ; `clearProgram?`: `Uint8Array` ; `extraPages?`: `number` ; `onComplete?`: `OnApplicationComplete` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalUints`: `number` ; `localByteSlices`: `number` ; `localUints`: `number` } } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **appCall**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `onComplete?`: `OnApplicationComplete` } & \{ `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `ClearStateOC` \| `DeleteApplicationOC` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Call a smart contract. -Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality. +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.send.appCall({ sender: 'CREATORADDRESS' }) +``` + +**`Example`** + +```typescript +await algorand.send.appCall({ + sender: 'CREATORADDRESS', + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters -| Name | Type | -| :------ | :------ | -| `params` | [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId?`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram?`: `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: `BoxReference`[] ; `clearProgram?`: `Uint8Array` ; `extraPages?`: `number` ; `onComplete?`: `OnApplicationComplete` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalUints`: `number` ; `localByteSlices`: `number` ; `localUints`: `number` } } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `onComplete?`: `OnApplicationComplete` } & \{ `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `ClearStateOC` \| `DeleteApplicationOC` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app call transaction | + +##### Returns + +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:697](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L697) + +___ + +### appCallMethodCall + +• **appCallMethodCall**: (`params`: \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `ClearStateOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Call a smart contract via an ABI method. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appCallMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `ClearStateOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app call transaction | + +##### Returns + +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:924](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L924) + +___ + +### appCreate + +• **appCreate**: (`params`: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Create a smart contract. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const result = await algorand.send.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) +const createdAppId = result.appId +``` + +**`Example`** + +```typescript +await algorand.send.appCreate({ + sender: 'CREATORADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4 + }, + extraProgramPages: 1, + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app creation transaction | + +##### Returns + +`Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:569](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L569) + +___ + +### appCreateMethodCall + +• **appCreateMethodCall**: (`params`: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Create a smart contract via an ABI method. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +const result = await algorand.send.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) +const createdAppId = result.appId +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appCreate({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + schema: { + globalInts: 1, + globalByteSlices: 2, + localInts: 3, + localByteSlices: 4 + }, + extraProgramPages: 1, + onComplete: algosdk.OnApplicationComplete.OptInOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app creation transaction | + +##### Returns + +`Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:760](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L760) + +___ + +### appDelete + +• **appDelete**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `onComplete?`: `OnApplicationComplete` } & \{ `onComplete?`: `DeleteApplicationOC` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Delete a smart contract. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.send.appDelete({ sender: 'CREATORADDRESS' }) +``` + +**`Example`** + +```typescript +await algorand.send.appDelete({ + sender: 'CREATORADDRESS', + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `onComplete?`: `OnApplicationComplete` } & \{ `onComplete?`: `DeleteApplicationOC` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app deletion transaction | + +##### Returns + +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:656](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L656) + +___ + +### appDeleteMethodCall + +• **appDeleteMethodCall**: (`params`: \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Delete a smart contract via an ABI method. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appDeleteMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app deletion transaction | + +##### Returns + +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:871](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L871) + +___ + +### appUpdate + +• **appUpdate**: (`params`: \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Update a smart contract. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +await algorand.send.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) +``` + +**`Example`** + +```typescript +await algorand.send.appUpdate({ + sender: 'CREATORADDRESS', + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app update transaction | ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:448](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L448) +[src/types/algorand-client-transaction-sender.ts:615](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L615) + +___ + +### appUpdateMethodCall + +• **appUpdateMethodCall**: (`params`: \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +Update a smart contract via an ABI method. + +Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) +``` + +**`Example`** + +```typescript +const method = new ABIMethod({ + name: 'method', + args: [{ name: 'arg1', type: 'string' }], + returns: { type: 'string' }, +}) +await algorand.send.appUpdateMethodCall({ + sender: 'CREATORADDRESS', + method: method, + args: ["arg1_value"], + approvalProgram: "TEALCODE", + clearStateProgram: "TEALCODE", + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + args: [new Uint8Array(1, 2, 3, 4)] + accountReferences: ["ACCOUNT_1"] + appReferences: [123n, 1234n] + assetReferences: [12345n] + boxReferences: ["box1", {appId: 1234n, name: "box2"}] + lease: 'lease', + note: 'note', + // You wouldn't normally set this field + firstValidRound: 1000n, + validityWindow: 10, + extraFee: (1000).microAlgo(), + staticFee: (1000).microAlgo(), + // Max fee doesn't make sense with extraFee AND staticFee + // already specified, but here for completeness + maxFee: (3000).microAlgo(), + // Signer only needed if you want to provide one, + // generally you'd register it with AlgorandClient + // against the sender and not need to pass it in + signer: transactionSigner, + maxRoundsToWaitForConfirmation: 5, + suppressLog: true, +}) +``` + +#### Type declaration + +▸ (`params`): `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } & \{ `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | The parameters for the app update transaction | + +##### Returns + +`Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:818](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L818) ___ ### assetConfig -• **assetConfig**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` ; `clawback?`: `string` ; `freeze?`: `string` ; `manager`: `undefined` \| `string` ; `reserve?`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **assetConfig**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` ; `clawback?`: `string` ; `freeze?`: `string` ; `manager`: `undefined` \| `string` ; `reserve?`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Configure an existing Algorand Standard Asset. @@ -160,7 +738,7 @@ await algorand.send.assetConfig({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -170,17 +748,17 @@ await algorand.send.assetConfig({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:203](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L203) +[src/types/algorand-client-transaction-sender.ts:280](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L280) ___ ### assetDestroy -• **assetDestroy**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **assetDestroy**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Destroys an Algorand Standard Asset. @@ -221,7 +799,7 @@ await algorand.send.assetDestroy({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -231,17 +809,17 @@ await algorand.send.assetDestroy({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L283) +[src/types/algorand-client-transaction-sender.ts:360](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L360) ___ ### assetFreeze -• **assetFreeze**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `account`: `string` ; `assetId`: `bigint` ; `frozen`: `boolean` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **assetFreeze**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `account`: `string` ; `assetId`: `bigint` ; `frozen`: `boolean` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Freeze or unfreeze an Algorand Standard Asset for an account. @@ -280,7 +858,7 @@ await algorand.send.assetFreeze({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -290,17 +868,17 @@ await algorand.send.assetFreeze({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:242](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L242) +[src/types/algorand-client-transaction-sender.ts:319](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L319) ___ ### assetOptIn -• **assetOptIn**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **assetOptIn**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `assetId`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Opt an account into an Algorand Standard Asset. @@ -337,7 +915,7 @@ await algorand.send.assetOptIn({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -347,17 +925,17 @@ await algorand.send.assetOptIn({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:363](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L363) +[src/types/algorand-client-transaction-sender.ts:440](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L440) ___ ### assetTransfer -• **assetTransfer**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `amount`: `bigint` ; `assetId`: `bigint` ; `clawbackTarget?`: `string` ; `closeAssetTo?`: `string` ; `receiver`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **assetTransfer**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `amount`: `bigint` ; `assetId`: `bigint` ; `clawbackTarget?`: `string` ; `closeAssetTo?`: `string` ; `receiver`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Transfer an Algorand Standard Asset. @@ -399,7 +977,7 @@ await algorand.send.assetTransfer({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -409,51 +987,23 @@ await algorand.send.assetTransfer({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:325](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L325) - -___ - -### methodCall - -• **methodCall**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & `Omit`\<[`AppCallParams`](../modules/types_composer.md#appcallparams), ``"args"``\> & \{ `appId`: `bigint` ; `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`MethodCallParams`](../modules/types_composer.md#methodcallparams))[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> - -Call a smart contract ABI method. - -Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality. - -#### Type declaration - -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `params` | [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & `Omit`\<[`AppCallParams`](../modules/types_composer.md#appcallparams), ``"args"``\> & \{ `appId`: `bigint` ; `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`MethodCallParams`](../modules/types_composer.md#methodcallparams))[] ; `method`: `ABIMethod` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | - -##### Returns - -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> - -#### Defined in - -[src/types/algorand-client-transaction-sender.ts:454](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L454) +[src/types/algorand-client-transaction-sender.ts:402](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L402) ___ ### onlineKeyRegistration -• **onlineKeyRegistration**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `selectionKey`: `Uint8Array` ; `stateProofKey?`: `Uint8Array` ; `voteFirst`: `bigint` ; `voteKey`: `Uint8Array` ; `voteKeyDilution`: `bigint` ; `voteLast`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **onlineKeyRegistration**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `selectionKey`: `Uint8Array` ; `stateProofKey?`: `Uint8Array` ; `voteFirst`: `bigint` ; `voteKey`: `Uint8Array` ; `voteKeyDilution`: `bigint` ; `voteLast`: `bigint` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Register an online key. #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -463,24 +1013,24 @@ Register an online key. ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:456](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L456) +[src/types/algorand-client-transaction-sender.ts:927](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L927) ___ ### payment -• **payment**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `amount`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `closeRemainderTo?`: `string` ; `receiver`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +• **payment**: (`params`: [`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams) & \{ `amount`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `closeRemainderTo?`: `string` ; `receiver`: `string` } & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Send a payment transaction to transfer Algo between accounts. **`Example`** ```typescript -const result = await algorandClient.send.payment({ +const result = await algorand.send.payment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: (4).algo(), @@ -490,7 +1040,7 @@ const result = await algorandClient.send.payment({ **`Example`** ```typescript -const result = await algorandClient.send.payment({ +const result = await algorand.send.payment({ amount: (4).algo(), receiver: 'RECEIVERADDRESS', sender: 'SENDERADDRESS', @@ -518,7 +1068,7 @@ const result = await algorandClient.send.payment({ #### Type declaration -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -528,17 +1078,17 @@ const result = await algorandClient.send.payment({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:103](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L103) +[src/types/algorand-client-transaction-sender.ts:180](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L180) ## Methods ### \_send -▸ **_send**\<`T`\>(`c`, `log?`): (`params`: `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ **_send**\<`T`\>(`c`, `log?`): (`params`: `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Type parameters @@ -552,14 +1102,55 @@ const result = await algorandClient.send.payment({ | :------ | :------ | | `c` | (`c`: [`default`](types_composer.default.md)) => (`params`: `T`) => [`default`](types_composer.default.md) | | `log?` | `Object` | -| `log.postLog?` | (`params`: `T`, `result`: [`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)) => `string` | +| `log.postLog?` | (`params`: `T`, `result`: \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }) => `string` | +| `log.preLog?` | (`params`: `T`, `transaction`: `Transaction`) => `string` | + +#### Returns + +`fn` + +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | + +##### Returns + +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L43) + +___ + +### \_sendAppCall + +▸ **_sendAppCall**\<`T`\>(`c`, `log?`): (`params`: `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| [`AppCallParams`](../modules/types_composer.md#appcallparams) \| [`AppDeleteParams`](../modules/types_composer.md#appdeleteparams) \| [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) \| [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall) \| [`AppDeleteMethodCall`](../modules/types_composer.md#appdeletemethodcall) \| [`AppCallMethodCall`](../modules/types_composer.md#appcallmethodcall) | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `c` | (`c`: [`default`](types_composer.default.md)) => (`params`: `T`) => [`default`](types_composer.default.md) | +| `log?` | `Object` | +| `log.postLog?` | (`params`: `T`, `result`: \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }) => `string` | | `log.preLog?` | (`params`: `T`, `transaction`: `Transaction`) => `string` | #### Returns `fn` -▸ (`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ (`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> ##### Parameters @@ -569,11 +1160,93 @@ const result = await algorandClient.send.payment({ ##### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> #### Defined in -[src/types/algorand-client-transaction-sender.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L27) +[src/types/algorand-client-transaction-sender.ts:78](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L78) + +___ + +### \_sendAppCreateCall + +▸ **_sendAppCreateCall**\<`T`\>(`c`, `log?`): (`params`: `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `c` | (`c`: [`default`](types_composer.default.md)) => (`params`: `T`) => [`default`](types_composer.default.md) | +| `log?` | `Object` | +| `log.postLog?` | (`params`: `T`, `result`: \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }) => `string` | +| `log.preLog?` | (`params`: `T`, `transaction`: `Transaction`) => `string` | + +#### Returns + +`fn` + +▸ (`params`): `Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | + +##### Returns + +`Promise`\<\{ `appAddress`: `string` ; `appId`: `bigint` ; `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:121](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L121) + +___ + +### \_sendAppUpdateCall + +▸ **_sendAppUpdateCall**\<`T`\>(`c`, `log?`): (`params`: `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md)) => `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) \| [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall) | + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `c` | (`c`: [`default`](types_composer.default.md)) => (`params`: `T`) => [`default`](types_composer.default.md) | +| `log?` | `Object` | +| `log.postLog?` | (`params`: `T`, `result`: \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }) => `string` | +| `log.preLog?` | (`params`: `T`, `transaction`: `Transaction`) => `string` | + +#### Returns + +`fn` + +▸ (`params`): `Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | `T` & [`ExecuteParams`](../interfaces/types_composer.ExecuteParams.md) | + +##### Returns + +`Promise`\<\{ `compiledApproval?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `compiledClear?`: [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) ; `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `return?`: [`ABIReturn`](../modules/types_app.md#abireturn) ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L102) ___ @@ -641,13 +1314,13 @@ await algorand.send.assetCreate({ #### Defined in -[src/types/algorand-client-transaction-sender.ts:154](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L154) +[src/types/algorand-client-transaction-sender.ts:231](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L231) ___ ### assetOptOut -▸ **assetOptOut**(`params`): `Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +▸ **assetOptOut**(`params`): `Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> Opt an account out of an Algorand Standard Asset. @@ -663,7 +1336,7 @@ is set to `false` (but then the account will lose the assets). #### Returns -`Promise`\<[`SendSingleTransactionResult`](../modules/types_algorand_client_transaction_sender.md#sendsingletransactionresult)\> +`Promise`\<\{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] }\> The result of the transaction and the transaction that was sent @@ -708,4 +1381,18 @@ await algorand.send.assetOptOut({ #### Defined in -[src/types/algorand-client-transaction-sender.ts:410](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L410) +[src/types/algorand-client-transaction-sender.ts:487](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L487) + +___ + +### newGroup + +▸ **newGroup**(): [`default`](types_composer.default.md) + +#### Returns + +[`default`](types_composer.default.md) + +#### Defined in + +[src/types/algorand-client-transaction-sender.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L39) diff --git a/docs/code/classes/types_app_client.ApplicationClient.md b/docs/code/classes/types_app_client.ApplicationClient.md index 8434f26b..e17e3e8f 100644 --- a/docs/code/classes/types_app_client.ApplicationClient.md +++ b/docs/code/classes/types_app_client.ApplicationClient.md @@ -43,6 +43,7 @@ Application client - a class that wraps an ARC-0032 app spec and provides high p - [fundAppAccount](types_app_client.ApplicationClient.md#fundappaccount) - [getABIMethod](types_app_client.ApplicationClient.md#getabimethod) - [getABIMethodParams](types_app_client.ApplicationClient.md#getabimethodparams) +- [getABIMethodSignature](types_app_client.ApplicationClient.md#getabimethodsignature) - [getAppReference](types_app_client.ApplicationClient.md#getappreference) - [getBoxNames](types_app_client.ApplicationClient.md#getboxnames) - [getBoxValue](types_app_client.ApplicationClient.md#getboxvalue) @@ -77,7 +78,7 @@ Create a new ApplicationClient instance #### Defined in -[src/types/app-client.ts:300](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L300) +[src/types/app-client.ts:299](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L299) ## Properties @@ -87,7 +88,7 @@ Create a new ApplicationClient instance #### Defined in -[src/types/app-client.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L283) +[src/types/app-client.ts:282](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L282) ___ @@ -97,7 +98,7 @@ ___ #### Defined in -[src/types/app-client.ts:282](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L282) +[src/types/app-client.ts:281](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L281) ___ @@ -107,7 +108,7 @@ ___ #### Defined in -[src/types/app-client.ts:285](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L285) +[src/types/app-client.ts:284](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L284) ___ @@ -117,7 +118,7 @@ ___ #### Defined in -[src/types/app-client.ts:287](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L287) +[src/types/app-client.ts:286](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L286) ___ @@ -127,7 +128,7 @@ ___ #### Defined in -[src/types/app-client.ts:288](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L288) +[src/types/app-client.ts:287](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L287) ___ @@ -137,7 +138,7 @@ ___ #### Defined in -[src/types/app-client.ts:284](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L284) +[src/types/app-client.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L283) ___ @@ -147,7 +148,7 @@ ___ #### Defined in -[src/types/app-client.ts:274](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L274) +[src/types/app-client.ts:273](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L273) ___ @@ -157,7 +158,7 @@ ___ #### Defined in -[src/types/app-client.ts:276](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L276) +[src/types/app-client.ts:275](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L275) ___ @@ -167,7 +168,7 @@ ___ #### Defined in -[src/types/app-client.ts:280](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L280) +[src/types/app-client.ts:279](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L279) ___ @@ -177,7 +178,7 @@ ___ #### Defined in -[src/types/app-client.ts:279](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L279) +[src/types/app-client.ts:278](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L278) ___ @@ -187,7 +188,7 @@ ___ #### Defined in -[src/types/app-client.ts:275](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L275) +[src/types/app-client.ts:274](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L274) ___ @@ -197,7 +198,7 @@ ___ #### Defined in -[src/types/app-client.ts:278](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L278) +[src/types/app-client.ts:277](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L277) ___ @@ -207,7 +208,7 @@ ___ #### Defined in -[src/types/app-client.ts:277](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L277) +[src/types/app-client.ts:276](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L276) ## Methods @@ -231,7 +232,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:618](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L618) +[src/types/app-client.ts:617](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L617) ___ @@ -256,7 +257,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:691](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L691) +[src/types/app-client.ts:690](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L690) ___ @@ -280,7 +281,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:672](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L672) +[src/types/app-client.ts:671](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L671) ___ @@ -304,7 +305,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:663](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L663) +[src/types/app-client.ts:662](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L662) ___ @@ -328,7 +329,7 @@ The compiled approval and clear programs #### Defined in -[src/types/app-client.ts:337](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L337) +[src/types/app-client.ts:336](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L336) ___ @@ -352,7 +353,7 @@ The details of the created app, or the transaction to create it if `skipSending` #### Defined in -[src/types/app-client.ts:516](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L516) +[src/types/app-client.ts:515](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L515) ___ @@ -376,7 +377,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:681](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L681) +[src/types/app-client.ts:680](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L680) ___ @@ -406,7 +407,7 @@ The metadata and transaction result(s) of the deployment, or just the metadata i #### Defined in -[src/types/app-client.ts:406](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L406) +[src/types/app-client.ts:405](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L405) ___ @@ -424,7 +425,7 @@ The source maps #### Defined in -[src/types/app-client.ts:373](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L373) +[src/types/app-client.ts:372](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L372) ___ @@ -451,13 +452,13 @@ The new error, or if there was no logic error or source map then the wrapped err #### Defined in -[src/types/app-client.ts:1009](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L1009) +[src/types/app-client.ts:1008](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L1008) ___ ### fundAppAccount -▸ **fundAppAccount**(`fund`): `Promise`\<[`SendTransactionResult`](../interfaces/types_transaction.SendTransactionResult.md)\> +▸ **fundAppAccount**(`fund`): `Promise`\<[`SendTransactionResult`](../interfaces/types_transaction.SendTransactionResult.md) \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & \{ `transactions`: `Transaction`[] }\> Funds Algo into the app account for this app. @@ -469,13 +470,13 @@ Funds Algo into the app account for this app. #### Returns -`Promise`\<[`SendTransactionResult`](../interfaces/types_transaction.SendTransactionResult.md)\> +`Promise`\<[`SendTransactionResult`](../interfaces/types_transaction.SendTransactionResult.md) \| \{ `confirmation`: `PendingTransactionResponse` ; `confirmations`: `PendingTransactionResponse`[] ; `groupId`: `string` ; `returns?`: [`ABIReturn`](../modules/types_app.md#abireturn)[] ; `transaction`: `Transaction` ; `transactions`: `Transaction`[] ; `txIds`: `string`[] } & \{ `transactions`: `Transaction`[] }\> The result of the funding #### Defined in -[src/types/app-client.ts:731](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L731) +[src/types/app-client.ts:730](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L730) ___ @@ -499,7 +500,7 @@ The ABI method for the given method #### Defined in -[src/types/app-client.ts:968](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L968) +[src/types/app-client.ts:967](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L967) ___ @@ -523,7 +524,27 @@ The ABI method params for the given method #### Defined in -[src/types/app-client.ts:946](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L946) +[src/types/app-client.ts:945](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L945) + +___ + +### getABIMethodSignature + +▸ **getABIMethodSignature**(`method`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `method` | `ABIMethodParams` \| `ABIMethod` | + +#### Returns + +`string` + +#### Defined in + +[src/types/app-client.ts:1025](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L1025) ___ @@ -542,7 +563,7 @@ The app reference, or if deployed using the `deploy` method, the app metadata to #### Defined in -[src/types/app-client.ts:978](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L978) +[src/types/app-client.ts:977](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L977) ___ @@ -560,7 +581,7 @@ The names of the boxes #### Defined in -[src/types/app-client.ts:787](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L787) +[src/types/app-client.ts:786](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L786) ___ @@ -584,7 +605,7 @@ The current box value as a byte array #### Defined in -[src/types/app-client.ts:802](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L802) +[src/types/app-client.ts:801](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L801) ___ @@ -609,7 +630,7 @@ The current box value as a byte array #### Defined in -[src/types/app-client.ts:818](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L818) +[src/types/app-client.ts:817](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L817) ___ @@ -634,7 +655,7 @@ The (name, value) pair of the boxes with values as raw byte arrays #### Defined in -[src/types/app-client.ts:834](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L834) +[src/types/app-client.ts:833](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L833) ___ @@ -660,7 +681,7 @@ The (name, value) pair of the boxes with values as the ABI Value #### Defined in -[src/types/app-client.ts:856](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L856) +[src/types/app-client.ts:855](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L855) ___ @@ -685,7 +706,7 @@ The call args ready to pass into an app call #### Defined in -[src/types/app-client.ts:878](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L878) +[src/types/app-client.ts:877](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L877) ___ @@ -703,7 +724,7 @@ The global state #### Defined in -[src/types/app-client.ts:759](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L759) +[src/types/app-client.ts:758](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L758) ___ @@ -727,7 +748,7 @@ The global state #### Defined in -[src/types/app-client.ts:773](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L773) +[src/types/app-client.ts:772](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L772) ___ @@ -749,7 +770,7 @@ Import source maps for the app. #### Defined in -[src/types/app-client.ts:390](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L390) +[src/types/app-client.ts:389](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L389) ___ @@ -773,7 +794,7 @@ The result of the call #### Defined in -[src/types/app-client.ts:654](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L654) +[src/types/app-client.ts:653](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L653) ___ @@ -797,4 +818,4 @@ The transaction send result and the compilation result #### Defined in -[src/types/app-client.ts:579](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L579) +[src/types/app-client.ts:578](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L578) diff --git a/docs/code/classes/types_app_deployer.AppDeployer.md b/docs/code/classes/types_app_deployer.AppDeployer.md new file mode 100644 index 00000000..aa429e6a --- /dev/null +++ b/docs/code/classes/types_app_deployer.AppDeployer.md @@ -0,0 +1,174 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-deployer](../modules/types_app_deployer.md) / AppDeployer + +# Class: AppDeployer + +[types/app-deployer](../modules/types_app_deployer.md).AppDeployer + +Allows management of deployment and deployment metadata of applications. + +## Table of contents + +### Constructors + +- [constructor](types_app_deployer.AppDeployer.md#constructor) + +### Properties + +- [\_appLookups](types_app_deployer.AppDeployer.md#_applookups) +- [\_appManager](types_app_deployer.AppDeployer.md#_appmanager) +- [\_indexer](types_app_deployer.AppDeployer.md#_indexer) +- [\_transactionSender](types_app_deployer.AppDeployer.md#_transactionsender) + +### Methods + +- [deploy](types_app_deployer.AppDeployer.md#deploy) +- [getCreatorAppsByName](types_app_deployer.AppDeployer.md#getcreatorappsbyname) +- [updateAppLookup](types_app_deployer.AppDeployer.md#updateapplookup) + +## Constructors + +### constructor + +• **new AppDeployer**(`appManager`, `transactionSender`, `indexer?`): [`AppDeployer`](types_app_deployer.AppDeployer.md) + +Creates an `AppManager` + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appManager` | [`AppManager`](types_app_manager.AppManager.md) | An `AppManager` instance | +| `transactionSender` | [`AlgorandClientTransactionSender`](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) | An `AlgorandClientTransactionSender` instance | +| `indexer?` | `default` | An optional indexer instance; supply if you want to indexer to look up app metadata | + +#### Returns + +[`AppDeployer`](types_app_deployer.AppDeployer.md) + +#### Defined in + +[src/types/app-deployer.ts:116](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L116) + +## Properties + +### \_appLookups + +• `Private` **\_appLookups**: `Map`\<`string`, [`AppLookup`](../interfaces/types_app_deployer.AppLookup.md)\> + +#### Defined in + +[src/types/app-deployer.ts:108](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L108) + +___ + +### \_appManager + +• `Private` **\_appManager**: [`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/app-deployer.ts:105](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L105) + +___ + +### \_indexer + +• `Private` `Optional` **\_indexer**: `default` + +#### Defined in + +[src/types/app-deployer.ts:107](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L107) + +___ + +### \_transactionSender + +• `Private` **\_transactionSender**: [`AlgorandClientTransactionSender`](types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) + +#### Defined in + +[src/types/app-deployer.ts:106](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L106) + +## Methods + +### deploy + +▸ **deploy**(`deployment`): `Promise`\<[`AppDeployResult`](../modules/types_app_deployer.md#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 `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 + +| Name | Type | Description | +| :------ | :------ | :------ | +| `deployment` | [`AppDeployParams`](../interfaces/types_app_deployer.AppDeployParams.md) | The arguments to control the app deployment | + +#### Returns + +`Promise`\<[`AppDeployResult`](../modules/types_app_deployer.md#appdeployresult)\> + +The app reference of the new/existing app + +#### Defined in + +[src/types/app-deployer.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L135) + +___ + +### getCreatorAppsByName + +▸ **getCreatorAppsByName**(`creatorAddress`, `ignoreCache?`): `Promise`\<[`AppLookup`](../interfaces/types_app_deployer.AppLookup.md)\> + +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 will not require an indexer lookup. + +If the `AppManager` instance wasn't created with an indexer client, this function will throw an error. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `creatorAddress` | `string` | The address of the account that is the creator of the apps you want to search for | +| `ignoreCache?` | `boolean` | Whether ot not to ignore the cache and force a lookup, default: use the cache | + +#### Returns + +`Promise`\<[`AppLookup`](../interfaces/types_app_deployer.AppLookup.md)\> + +A name-based lookup of the app metadata + +#### Defined in + +[src/types/app-deployer.ts:448](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L448) + +___ + +### updateAppLookup + +▸ **updateAppLookup**(`sender`, `appMetadata`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `sender` | `string` | +| `appMetadata` | [`AppMetadata`](../interfaces/types_app_deployer.AppMetadata.md) | + +#### Returns + +`void` + +#### Defined in + +[src/types/app-deployer.ts:426](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L426) diff --git a/docs/code/classes/types_app_manager.AppManager.md b/docs/code/classes/types_app_manager.AppManager.md new file mode 100644 index 00000000..f7ff5808 --- /dev/null +++ b/docs/code/classes/types_app_manager.AppManager.md @@ -0,0 +1,500 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-manager](../modules/types_app_manager.md) / AppManager + +# Class: AppManager + +[types/app-manager](../modules/types_app_manager.md).AppManager + +Allows management of application information. + +## Table of contents + +### Constructors + +- [constructor](types_app_manager.AppManager.md#constructor) + +### Properties + +- [\_algod](types_app_manager.AppManager.md#_algod) +- [\_compilationResults](types_app_manager.AppManager.md#_compilationresults) + +### Methods + +- [compileTeal](types_app_manager.AppManager.md#compileteal) +- [compileTealTemplate](types_app_manager.AppManager.md#compiletealtemplate) +- [getBoxNames](types_app_manager.AppManager.md#getboxnames) +- [getBoxValue](types_app_manager.AppManager.md#getboxvalue) +- [getBoxValueFromABIType](types_app_manager.AppManager.md#getboxvaluefromabitype) +- [getBoxValues](types_app_manager.AppManager.md#getboxvalues) +- [getBoxValuesFromABIType](types_app_manager.AppManager.md#getboxvaluesfromabitype) +- [getById](types_app_manager.AppManager.md#getbyid) +- [getCompilationResult](types_app_manager.AppManager.md#getcompilationresult) +- [getLocalState](types_app_manager.AppManager.md#getlocalstate) +- [decodeAppState](types_app_manager.AppManager.md#decodeappstate) +- [getABIReturn](types_app_manager.AppManager.md#getabireturn) +- [getBoxReference](types_app_manager.AppManager.md#getboxreference) +- [replaceTealTemplateDeployTimeControlParams](types_app_manager.AppManager.md#replacetealtemplatedeploytimecontrolparams) +- [replaceTealTemplateParams](types_app_manager.AppManager.md#replacetealtemplateparams) +- [stripTealComments](types_app_manager.AppManager.md#striptealcomments) + +## Constructors + +### constructor + +• **new AppManager**(`algod`): [`AppManager`](types_app_manager.AppManager.md) + +Creates an `AppManager` + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `algod` | `default` | An algod instance | + +#### Returns + +[`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/app-manager.ts:106](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L106) + +## Properties + +### \_algod + +• `Private` **\_algod**: `default` + +#### Defined in + +[src/types/app-manager.ts:99](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L99) + +___ + +### \_compilationResults + +• `Private` **\_compilationResults**: `Record`\<`string`, [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> = `{}` + +#### Defined in + +[src/types/app-manager.ts:100](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L100) + +## Methods + +### compileTeal + +▸ **compileTeal**(`tealCode`): `Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> + +Compiles the given TEAL using algod and returns the result, including source map. + +The result of this compilation is also cached keyed by the TEAL + code so it can be retrieved via `getCompilationResult`. + +This function is re-entrant; it will only compile the same code once. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealCode` | `string` | The TEAL code | + +#### Returns + +`Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> + +The information about the compiled file + +#### Defined in + +[src/types/app-manager.ts:121](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L121) + +___ + +### compileTealTemplate + +▸ **compileTealTemplate**(`tealTemplateCode`, `templateParams?`, `deploymentMetadata?`): `Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> + +Performs template substitution of a teal template and compiles it, returning the compiled result. + +Looks for `TMPL_{parameter}` for template replacements and replaces AlgoKit deploy-time control parameters +if deployment metadata is specified. + +* `TMPL_UPDATABLE` for updatability / immutability control +* `TMPL_DELETABLE` for deletability / permanence control + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealTemplateCode` | `string` | The TEAL logic to compile | +| `templateParams?` | [`TealTemplateParams`](../interfaces/types_app.TealTemplateParams.md) | Any parameters to replace in the .teal file before compiling | +| `deploymentMetadata?` | [`AppDeployMetadata`](../interfaces/types_app.AppDeployMetadata.md) | The deployment metadata the app will be deployed with | + +#### Returns + +`Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> + +The information about the compiled code + +#### Defined in + +[src/types/app-manager.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L152) + +___ + +### getBoxNames + +▸ **getBoxNames**(`appId`): `Promise`\<[`BoxName`](../interfaces/types_app.BoxName.md)[]\> + +Returns the names of the current boxes for the given app. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appId` | `bigint` | The ID of the app return box names for | + +#### Returns + +`Promise`\<[`BoxName`](../interfaces/types_app.BoxName.md)[]\> + +The current box names + +#### Defined in + +[src/types/app-manager.ts:230](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L230) + +___ + +### getBoxValue + +▸ **getBoxValue**(`appId`, `boxName`): `Promise`\<`Uint8Array`\> + +Returns the value of the given box name for the given app. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appId` | `bigint` | The ID of the app return box names for | +| `boxName` | [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) | The name of the box to return either as a string, binary array or `BoxName` | + +#### Returns + +`Promise`\<`Uint8Array`\> + +The current box value as a byte array + +#### Defined in + +[src/types/app-manager.ts:247](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L247) + +___ + +### getBoxValueFromABIType + +▸ **getBoxValueFromABIType**(`request`): `Promise`\<`ABIValue`\> + +Returns the value of the given box name for the given app decoded based on the given ABI type. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `request` | [`BoxValueRequestParams`](../interfaces/types_app_manager.BoxValueRequestParams.md) | The parameters for the box value request | + +#### Returns + +`Promise`\<`ABIValue`\> + +The current box value as an ABI value + +#### Defined in + +[src/types/app-manager.ts:268](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L268) + +___ + +### getBoxValues + +▸ **getBoxValues**(`appId`, `boxNames`): `Promise`\<`Uint8Array`[]\> + +Returns the value of the given box names for the given app. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appId` | `bigint` | The ID of the app return box names for | +| `boxNames` | [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier)[] | The names of the boxes to return either as a string, binary array or `BoxName` | + +#### Returns + +`Promise`\<`Uint8Array`[]\> + +The current box values as a byte array in the same order as the passed in box names + +#### Defined in + +[src/types/app-manager.ts:259](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L259) + +___ + +### getBoxValuesFromABIType + +▸ **getBoxValuesFromABIType**(`request`): `Promise`\<`ABIValue`[]\> + +Returns the value of the given box names for the given app decoded based on the given ABI type. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `request` | [`BoxValuesRequestParams`](../interfaces/types_app_manager.BoxValuesRequestParams.md) | The parameters for the box value request | + +#### Returns + +`Promise`\<`ABIValue`[]\> + +The current box values as an ABI value in the same order as the passed in box names + +#### Defined in + +[src/types/app-manager.ts:279](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L279) + +___ + +### getById + +▸ **getById**(`appId`): `Promise`\<[`AppInformation`](../interfaces/types_app_manager.AppInformation.md)\> + +Returns the current app information for the app with the given ID. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appId` | `bigint` | The ID of the app | + +#### Returns + +`Promise`\<[`AppInformation`](../interfaces/types_app_manager.AppInformation.md)\> + +The app information + +**`Example`** + +```typescript +const appInfo = await appManager.getById(12353n); +``` + +#### Defined in + +[src/types/app-manager.ts:189](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L189) + +___ + +### getCompilationResult + +▸ **getCompilationResult**(`tealCode`): `undefined` \| [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) + +Returns a previous compilation result. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealCode` | `string` | The TEAL code | + +#### Returns + +`undefined` \| [`CompiledTeal`](../interfaces/types_app.CompiledTeal.md) + +The information about the previously compiled file + or `undefined` if that TEAL code wasn't previously compiled + +#### Defined in + +[src/types/app-manager.ts:174](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L174) + +___ + +### getLocalState + +▸ **getLocalState**(`appId`, `address`): `Promise`\<[`AppState`](../interfaces/types_app.AppState.md)\> + +Returns the current local state values for the given app ID and account address + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `appId` | `bigint` | The ID of the app to return local state for | +| `address` | `string` | The string address of the account to get local state for the given app | + +#### Returns + +`Promise`\<[`AppState`](../interfaces/types_app.AppState.md)\> + +The current local state for the given (app, account) combination + +#### Defined in + +[src/types/app-manager.ts:213](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L213) + +___ + +### decodeAppState + +▸ **decodeAppState**(`state`): [`AppState`](../interfaces/types_app.AppState.md) + +Converts an array of global/local state values from the algod api to a more friendly +generic object keyed by the UTF-8 value of the key. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `state` | \{ `key`: `string` ; `value`: `TealValue` \| `EvalDelta` }[] | A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas` | + +#### Returns + +[`AppState`](../interfaces/types_app.AppState.md) + +An object keyeed by the UTF-8 representation of the key with various parsings of the values + +#### Defined in + +[src/types/app-manager.ts:308](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L308) + +___ + +### getABIReturn + +▸ **getABIReturn**(`confirmation`, `method`): `undefined` \| [`ABIReturn`](../modules/types_app.md#abireturn) + +Returns any ABI return values for the given app call arguments and transaction confirmation. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `confirmation` | `undefined` \| `PendingTransactionResponse` | The transaction confirmation from algod | +| `method` | `undefined` \| `ABIMethod` | The ABI method | + +#### Returns + +`undefined` \| [`ABIReturn`](../modules/types_app.md#abireturn) + +The return value for the method call + +#### Defined in + +[src/types/app-manager.ts:356](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L356) + +___ + +### getBoxReference + +▸ **getBoxReference**(`boxId`): `BoxReference` + +Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `boxId` | [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md) | The box to return a reference for | + +#### Returns + +`BoxReference` + +The box reference ready to pass into a `algosdk.Transaction` + +#### Defined in + +[src/types/app-manager.ts:289](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L289) + +___ + +### replaceTealTemplateDeployTimeControlParams + +▸ **replaceTealTemplateDeployTimeControlParams**(`tealTemplateCode`, `params`): `string` + +Replaces AlgoKit deploy-time deployment control parameters within the given TEAL template code. + +* `TMPL_UPDATABLE` for updatability / immutability control +* `TMPL_DELETABLE` for deletability / permanence control + +Note: If these values are defined, but the corresponding `TMPL_*` value + isn't in the teal code it will throw an exception. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealTemplateCode` | `string` | The TEAL template code to substitute | +| `params` | `Object` | The deploy-time deployment control parameter value to replace | +| `params.deletable?` | `boolean` | - | +| `params.updatable?` | `boolean` | - | + +#### Returns + +`string` + +The replaced TEAL code + +#### Defined in + +[src/types/app-manager.ts:398](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L398) + +___ + +### replaceTealTemplateParams + +▸ **replaceTealTemplateParams**(`tealTemplateCode`, `templateParams?`): `string` + +Performs template substitution of a teal file. + +Looks for `TMPL_{parameter}` for template replacements. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealTemplateCode` | `string` | The TEAL template code to make parameter replacements in | +| `templateParams?` | [`TealTemplateParams`](../interfaces/types_app.TealTemplateParams.md) | Any parameters to replace in the teal code | + +#### Returns + +`string` + +The TEAL code with replacements + +#### Defined in + +[src/types/app-manager.ts:429](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L429) + +___ + +### stripTealComments + +▸ **stripTealComments**(`tealCode`): `string` + +Remove comments from TEAL code (useful to reduce code size before compilation). + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `tealCode` | `string` | The TEAL logic to strip | + +#### Returns + +`string` + +The TEAL without comments + +#### Defined in + +[src/types/app-manager.ts:463](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L463) diff --git a/docs/code/classes/types_client_manager.ClientManager.md b/docs/code/classes/types_client_manager.ClientManager.md index b52c1e61..0303b1d4 100644 --- a/docs/code/classes/types_client_manager.ClientManager.md +++ b/docs/code/classes/types_client_manager.ClientManager.md @@ -23,6 +23,7 @@ Exposes access to various API clients. - [algod](types_client_manager.ClientManager.md#algod) - [indexer](types_client_manager.ClientManager.md#indexer) +- [indexerIfPresent](types_client_manager.ClientManager.md#indexerifpresent) - [kmd](types_client_manager.ClientManager.md#kmd) ### Methods @@ -114,7 +115,7 @@ ___ #### Defined in -[src/types/client-manager.ts:101](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L101) +[src/types/client-manager.ts:106](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L106) ___ @@ -170,6 +171,22 @@ Returns an algosdk Indexer API client or throws an error if it's not been provid ___ +### indexerIfPresent + +• `get` **indexerIfPresent**(): `undefined` \| `default` + +Returns an algosdk Indexer API client or `undefined` if it's not been provided. + +#### Returns + +`undefined` \| `default` + +#### Defined in + +[src/types/client-manager.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L96) + +___ + ### kmd • `get` **kmd**(): `default` @@ -182,7 +199,7 @@ Returns an algosdk KMD API client or throws an error if it's not been provided. #### Defined in -[src/types/client-manager.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L96) +[src/types/client-manager.ts:101](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L101) ## Methods @@ -207,7 +224,7 @@ The `ApplicationClient` #### Defined in -[src/types/client-manager.ts:204](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L204) +[src/types/client-manager.ts:209](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L209) ___ @@ -231,7 +248,7 @@ The `ApplicationClient` #### Defined in -[src/types/client-manager.ts:216](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L216) +[src/types/client-manager.ts:221](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L221) ___ @@ -268,7 +285,7 @@ const client = clientManager.getTestNetDispenser( #### Defined in -[src/types/client-manager.ts:175](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L175) +[src/types/client-manager.ts:180](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L180) ___ @@ -304,7 +321,7 @@ const client = clientManager.getTestNetDispenserFromEnvironment( #### Defined in -[src/types/client-manager.ts:194](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L194) +[src/types/client-manager.ts:199](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L199) ___ @@ -355,7 +372,7 @@ const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractCl #### Defined in -[src/types/client-manager.ts:242](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L242) +[src/types/client-manager.ts:247](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L247) ___ @@ -395,7 +412,7 @@ const appClient = algorand.client.getTypedAppClientById(MyContractClient, { #### Defined in -[src/types/client-manager.ts:263](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L263) +[src/types/client-manager.ts:268](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L268) ___ @@ -413,7 +430,7 @@ True if the current network is LocalNet. #### Defined in -[src/types/client-manager.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L139) +[src/types/client-manager.ts:144](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L144) ___ @@ -431,7 +448,7 @@ True if the current network is MainNet. #### Defined in -[src/types/client-manager.ts:155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L155) +[src/types/client-manager.ts:160](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L160) ___ @@ -449,7 +466,7 @@ True if the current network is TestNet. #### Defined in -[src/types/client-manager.ts:147](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L147) +[src/types/client-manager.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L152) ___ @@ -474,7 +491,7 @@ const genesisId = network.genesisId #### Defined in -[src/types/client-manager.ts:111](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L111) +[src/types/client-manager.ts:116](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L116) ___ @@ -498,7 +515,7 @@ Whether the given genesis ID is associated with a LocalNet network #### Defined in -[src/types/client-manager.ts:131](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L131) +[src/types/client-manager.ts:136](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L136) ___ @@ -521,7 +538,7 @@ Returns the Algorand configuration to point to the free tier of the AlgoNode ser #### Defined in -[src/types/client-manager.ts:355](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L355) +[src/types/client-manager.ts:360](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L360) ___ @@ -564,7 +581,7 @@ Returns an algod SDK client that automatically retries on idempotent calls. #### Defined in -[src/types/client-manager.ts:394](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L394) +[src/types/client-manager.ts:399](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L399) ___ @@ -588,7 +605,7 @@ Returns an algod SDK client that automatically retries on idempotent calls loade #### Defined in -[src/types/client-manager.ts:411](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L411) +[src/types/client-manager.ts:416](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L416) ___ @@ -606,7 +623,7 @@ Expects `process.env.ALGOD_SERVER` to be defined, and you can also specify `proc #### Defined in -[src/types/client-manager.ts:313](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L313) +[src/types/client-manager.ts:318](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L318) ___ @@ -639,7 +656,7 @@ const config = ClientManager.getConfigFromEnvironmentOrLocalNet() #### Defined in -[src/types/client-manager.ts:284](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L284) +[src/types/client-manager.ts:289](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L289) ___ @@ -661,7 +678,7 @@ Returns the Algorand configuration to point to the default LocalNet. #### Defined in -[src/types/client-manager.ts:366](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L366) +[src/types/client-manager.ts:371](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L371) ___ @@ -711,7 +728,7 @@ Returns an indexer SDK client that automatically retries on idempotent calls #### Defined in -[src/types/client-manager.ts:440](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L440) +[src/types/client-manager.ts:445](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L445) ___ @@ -741,7 +758,7 @@ Returns an indexer SDK client that automatically retries on idempotent calls loa #### Defined in -[src/types/client-manager.ts:462](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L462) +[src/types/client-manager.ts:467](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L467) ___ @@ -759,7 +776,7 @@ Expects `process.env.INDEXER_SERVER` to be defined, and you can also specify `pr #### Defined in -[src/types/client-manager.ts:334](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L334) +[src/types/client-manager.ts:339](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L339) ___ @@ -789,7 +806,7 @@ KMD client allows you to export private keys, which is useful to (for instance) #### Defined in -[src/types/client-manager.ts:477](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L477) +[src/types/client-manager.ts:482](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L482) ___ @@ -812,4 +829,4 @@ Returns a KMD SDK client that automatically retries on idempotent calls loaded f #### Defined in -[src/types/client-manager.ts:491](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L491) +[src/types/client-manager.ts:496](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L496) diff --git a/docs/code/classes/types_composer.default.md b/docs/code/classes/types_composer.default.md index 2af765c5..55712539 100644 --- a/docs/code/classes/types_composer.default.md +++ b/docs/code/classes/types_composer.default.md @@ -15,6 +15,7 @@ AlgoKit Composer helps you compose and execute transactions as a transaction gro ### Properties - [algod](types_composer.default.md#algod) +- [appManager](types_composer.default.md#appmanager) - [atc](types_composer.default.md#atc) - [defaultValidityWindow](types_composer.default.md#defaultvaliditywindow) - [defaultValidityWindowIsExplicit](types_composer.default.md#defaultvaliditywindowisexplicit) @@ -22,10 +23,18 @@ AlgoKit Composer helps you compose and execute transactions as a transaction gro - [getSuggestedParams](types_composer.default.md#getsuggestedparams) - [txnMethodMap](types_composer.default.md#txnmethodmap) - [txns](types_composer.default.md#txns) +- [NULL\_SIGNER](types_composer.default.md#null_signer) ### Methods - [addAppCall](types_composer.default.md#addappcall) +- [addAppCallMethodCall](types_composer.default.md#addappcallmethodcall) +- [addAppCreate](types_composer.default.md#addappcreate) +- [addAppCreateMethodCall](types_composer.default.md#addappcreatemethodcall) +- [addAppDelete](types_composer.default.md#addappdelete) +- [addAppDeleteMethodCall](types_composer.default.md#addappdeletemethodcall) +- [addAppUpdate](types_composer.default.md#addappupdate) +- [addAppUpdateMethodCall](types_composer.default.md#addappupdatemethodcall) - [addAssetConfig](types_composer.default.md#addassetconfig) - [addAssetCreate](types_composer.default.md#addassetcreate) - [addAssetDestroy](types_composer.default.md#addassetdestroy) @@ -34,7 +43,6 @@ AlgoKit Composer helps you compose and execute transactions as a transaction gro - [addAssetOptOut](types_composer.default.md#addassetoptout) - [addAssetTransfer](types_composer.default.md#addassettransfer) - [addAtc](types_composer.default.md#addatc) -- [addMethodCall](types_composer.default.md#addmethodcall) - [addOnlineKeyRegistration](types_composer.default.md#addonlinekeyregistration) - [addPayment](types_composer.default.md#addpayment) - [build](types_composer.default.md#build) @@ -52,8 +60,10 @@ AlgoKit Composer helps you compose and execute transactions as a transaction gro - [buildTxn](types_composer.default.md#buildtxn) - [buildTxnWithSigner](types_composer.default.md#buildtxnwithsigner) - [commonTxnBuildStep](types_composer.default.md#commontxnbuildstep) +- [count](types_composer.default.md#count) - [execute](types_composer.default.md#execute) - [rebuild](types_composer.default.md#rebuild) +- [arc2Note](types_composer.default.md#arc2note) ## Constructors @@ -75,7 +85,7 @@ Create an `AlgoKitComposer`. #### Defined in -[src/types/composer.ts:431](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L431) +[src/types/composer.ts:495](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L495) ## Properties @@ -87,7 +97,17 @@ The algod client used by the composer. #### Defined in -[src/types/composer.ts:413](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L413) +[src/types/composer.ts:475](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L475) + +___ + +### appManager + +• `Private` **appManager**: [`AppManager`](types_app_manager.AppManager.md) + +#### Defined in + +[src/types/composer.ts:489](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L489) ___ @@ -99,7 +119,7 @@ The ATC used to compose the group #### Defined in -[src/types/composer.ts:404](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L404) +[src/types/composer.ts:466](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L466) ___ @@ -111,7 +131,7 @@ The default transaction validity window #### Defined in -[src/types/composer.ts:422](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L422) +[src/types/composer.ts:484](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L484) ___ @@ -123,7 +143,7 @@ Whether the validity window was explicitly set on construction #### Defined in -[src/types/composer.ts:425](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L425) +[src/types/composer.ts:487](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L487) ___ @@ -149,7 +169,7 @@ A function that takes in an address and return a signer function for that addres #### Defined in -[src/types/composer.ts:419](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L419) +[src/types/composer.ts:481](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L481) ___ @@ -169,7 +189,7 @@ An async function that will return suggested params for the transaction. #### Defined in -[src/types/composer.ts:416](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L416) +[src/types/composer.ts:478](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L478) ___ @@ -181,7 +201,7 @@ Map of txid to ABI method #### Defined in -[src/types/composer.ts:407](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L407) +[src/types/composer.ts:469](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L469) ___ @@ -193,7 +213,19 @@ Transactions that have not yet been composed #### Defined in -[src/types/composer.ts:410](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L410) +[src/types/composer.ts:472](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L472) + +___ + +### NULL\_SIGNER + +▪ `Static` `Private` **NULL\_SIGNER**: `TransactionSigner` + +Signer used to represent a lack of signer + +#### Defined in + +[src/types/composer.ts:463](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L463) ## Methods @@ -203,6 +235,8 @@ Transactions that have not yet been composed Add an application call transaction to the transaction group. +If you want to create or update an app use `addAppCreate` or `addAppUpdate`. + Note: we recommend using app clients to make it easier to make app calls. #### Parameters @@ -219,7 +253,234 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:535](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L535) +[src/types/composer.ts:641](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L641) + +___ + +### addAppCallMethodCall + +▸ **addAppCallMethodCall**(`params`): [`default`](types_composer.default.md) + +Add a non-create/non-update ABI method application call transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCallMethodCall`](../modules/types_composer.md#appcallmethodcall) | The ABI method application call transaction parameters | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:690](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L690) + +___ + +### addAppCreate + +▸ **addAppCreate**(`params`): [`default`](types_composer.default.md) + +Add an application create transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | `Object` | The application create transaction parameters | +| `params.accountReferences?` | `string`[] | Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.appReferences?` | `bigint`[] | The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.approvalProgram` | `string` \| `Uint8Array` | The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). | +| `params.args?` | `Uint8Array`[] | Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). | +| `params.assetReferences?` | `bigint`[] | The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.boxReferences?` | ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] | Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#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. | +| `params.clearStateProgram` | `string` \| `Uint8Array` | The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). | +| `params.extraFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The fee to pay IN ADDITION to the suggested fee. Useful for covering inner transaction fees. | +| `params.extraProgramPages?` | `number` | Number of extra pages required for the programs. This is immutable once the app is created. | +| `params.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. | +| `params.lastValidRound?` | `bigint` | The last round this transaction is valid. It is recommended to use `validityWindow` instead. | +| `params.lease?` | `string` \| `Uint8Array` | Prevent multiple transactions with the same lease being included within the validity window. A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios). | +| `params.maxFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. | +| `params.note?` | `string` \| `Uint8Array` | Note to attach to the transaction. Max of 1000 bytes. | +| `params.onComplete?` | `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` | The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. | +| `params.rekeyTo?` | `string` | 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://developer.algorand.org/docs/get-details/accounts/rekey/). | +| `params.schema?` | `Object` | The state schema for the app. This is immutable once the app is created. | +| `params.schema.globalByteSlices` | `number` | The number of byte slices saved in global state. | +| `params.schema.globalInts` | `number` | The number of integers saved in global state. | +| `params.schema.localByteSlices` | `number` | The number of byte slices saved in local state. | +| `params.schema.localInts` | `number` | The number of integers saved in local state. | +| `params.sender` | `string` | The address of the account sending the transaction. | +| `params.signer?` | `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | 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). | +| `params.staticFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. | +| `params.validityWindow?` | `number` | How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:600](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L600) + +___ + +### addAppCreateMethodCall + +▸ **addAppCreateMethodCall**(`params`): [`default`](types_composer.default.md) + +Add an ABI method create application call transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) | The ABI create method application call transaction parameters | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:654](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L654) + +___ + +### addAppDelete + +▸ **addAppDelete**(`params`): [`default`](types_composer.default.md) + +Add an application delete transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppDeleteParams`](../modules/types_composer.md#appdeleteparams) | The application delete transaction parameters | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:626](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L626) + +___ + +### addAppDeleteMethodCall + +▸ **addAppDeleteMethodCall**(`params`): [`default`](types_composer.default.md) + +Add an ABI method delete application call transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppDeleteMethodCall`](../modules/types_composer.md#appdeletemethodcall) | The ABI delete method application call transaction parameters | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:678](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L678) + +___ + +### addAppUpdate + +▸ **addAppUpdate**(`params`): [`default`](types_composer.default.md) + +Add an application update transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | `Object` | The application update transaction parameters | +| `params.accountReferences?` | `string`[] | Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.appId` | `bigint` | ID of the application; 0 if the application is being created. | +| `params.appReferences?` | `bigint`[] | The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.approvalProgram` | `string` \| `Uint8Array` | The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) | +| `params.args?` | `Uint8Array`[] | Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). | +| `params.assetReferences?` | `bigint`[] | The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). | +| `params.boxReferences?` | ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] | Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#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. | +| `params.clearStateProgram` | `string` \| `Uint8Array` | The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) | +| `params.extraFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The fee to pay IN ADDITION to the suggested fee. Useful for covering inner transaction fees. | +| `params.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. | +| `params.lastValidRound?` | `bigint` | The last round this transaction is valid. It is recommended to use `validityWindow` instead. | +| `params.lease?` | `string` \| `Uint8Array` | Prevent multiple transactions with the same lease being included within the validity window. A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/) enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios). | +| `params.maxFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. | +| `params.note?` | `string` \| `Uint8Array` | Note to attach to the transaction. Max of 1000 bytes. | +| `params.onComplete?` | `UpdateApplicationOC` | The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. | +| `params.rekeyTo?` | `string` | 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://developer.algorand.org/docs/get-details/accounts/rekey/). | +| `params.sender` | `string` | The address of the account sending the transaction. | +| `params.signer?` | `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | 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). | +| `params.staticFee?` | [`AlgoAmount`](types_amount.AlgoAmount.md) | The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. | +| `params.validityWindow?` | `number` | How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:613](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L613) + +___ + +### addAppUpdateMethodCall + +▸ **addAppUpdateMethodCall**(`params`): [`default`](types_composer.default.md) + +Add an ABI method update application call transaction to the transaction group. + +Note: we recommend using app clients to make it easier to make app calls. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall) | The ABI update method application call transaction parameters | + +#### Returns + +[`default`](types_composer.default.md) + +The composer so you can chain method calls + +#### Defined in + +[src/types/composer.ts:666](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L666) ___ @@ -243,7 +504,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:467](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L467) +[src/types/composer.ts:532](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L532) ___ @@ -267,7 +528,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:456](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L456) +[src/types/composer.ts:521](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L521) ___ @@ -291,7 +552,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:489](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L489) +[src/types/composer.ts:554](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L554) ___ @@ -315,7 +576,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:478](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L478) +[src/types/composer.ts:543](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L543) ___ @@ -339,7 +600,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:511](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L511) +[src/types/composer.ts:576](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L576) ___ @@ -363,7 +624,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:522](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L522) +[src/types/composer.ts:587](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L587) ___ @@ -387,7 +648,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:500](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L500) +[src/types/composer.ts:565](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L565) ___ @@ -411,33 +672,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:569](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L569) - -___ - -### addMethodCall - -▸ **addMethodCall**(`params`): [`default`](types_composer.default.md) - -Add an ABI method application call transaction to the transaction group. - -Note: we recommend using app clients to make it easier to make app calls. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `params` | [`MethodCallParams`](../modules/types_composer.md#methodcallparams) | The ABI method application call transaction parameters | - -#### Returns - -[`default`](types_composer.default.md) - -The composer so you can chain method calls - -#### Defined in - -[src/types/composer.ts:548](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L548) +[src/types/composer.ts:711](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L711) ___ @@ -461,7 +696,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:558](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L558) +[src/types/composer.ts:700](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L700) ___ @@ -485,48 +720,51 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:445](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L445) +[src/types/composer.ts:510](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L510) ___ ### build -▸ **build**(): `Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `transactions`: `TransactionWithSigner`[] }\> +▸ **build**(): `Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `methodCalls`: `any` ; `transactions`: `TransactionWithSigner`[] }\> Compose all of the transactions in a single atomic transaction group and an atomic transaction composer. You can then use the transactions standalone, or use the composer to execute or simulate the transactions. +Once this method is called, no further transactions will be able to be added. +You can safely call this method multiple times to get the same result. + #### Returns -`Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `transactions`: `TransactionWithSigner`[] }\> +`Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `methodCalls`: `any` ; `transactions`: `TransactionWithSigner`[] }\> The built atomic transaction composer and the transactions #### Defined in -[src/types/composer.ts:919](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L919) +[src/types/composer.ts:1145](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1145) ___ ### buildAppCall -▸ **buildAppCall**(`params`, `suggestedParams`): `Transaction` +▸ **buildAppCall**(`params`, `suggestedParams`): `Promise`\<`Transaction`\> #### Parameters | Name | Type | | :------ | :------ | -| `params` | [`AppCallParams`](../modules/types_composer.md#appcallparams) | +| `params` | \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](../interfaces/types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| [`AppCallParams`](../modules/types_composer.md#appcallparams) | | `suggestedParams` | `SuggestedParams` | #### Returns -`Transaction` +`Promise`\<`Transaction`\> #### Defined in -[src/types/composer.ts:787](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L787) +[src/types/composer.ts:968](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L968) ___ @@ -547,7 +785,7 @@ ___ #### Defined in -[src/types/composer.ts:736](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L736) +[src/types/composer.ts:917](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L917) ___ @@ -568,7 +806,7 @@ ___ #### Defined in -[src/types/composer.ts:716](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L716) +[src/types/composer.ts:897](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L897) ___ @@ -589,7 +827,7 @@ ___ #### Defined in -[src/types/composer.ts:751](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L751) +[src/types/composer.ts:932](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L932) ___ @@ -610,7 +848,7 @@ ___ #### Defined in -[src/types/composer.ts:761](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L761) +[src/types/composer.ts:942](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L942) ___ @@ -631,19 +869,22 @@ ___ #### Defined in -[src/types/composer.ts:773](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L773) +[src/types/composer.ts:954](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L954) ___ ### buildAtc -▸ **buildAtc**(`atc`): `TransactionWithSigner`[] +▸ **buildAtc**(`atc`, `processTransaction?`): `TransactionWithSigner`[] + +Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing #### Parameters | Name | Type | | :------ | :------ | | `atc` | `AtomicTransactionComposer` | +| `processTransaction?` | (`txn`: `Transaction`, `index`: `number`) => `Transaction` | #### Returns @@ -651,7 +892,7 @@ ___ #### Defined in -[src/types/composer.ts:574](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L574) +[src/types/composer.ts:717](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L717) ___ @@ -672,7 +913,7 @@ ___ #### Defined in -[src/types/composer.ts:827](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L827) +[src/types/composer.ts:1023](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1023) ___ @@ -680,13 +921,15 @@ ___ ▸ **buildMethodCall**(`params`, `suggestedParams`, `includeSigner`): `Promise`\<`TransactionWithSigner`[]\> +Builds an ABI method call transaction and any other associated transactions represented in the ABI args. + #### Parameters -| Name | Type | -| :------ | :------ | -| `params` | [`MethodCallParams`](../modules/types_composer.md#methodcallparams) | -| `suggestedParams` | `SuggestedParams` | -| `includeSigner` | `boolean` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `params` | [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) \| [`AppUpdateMethodCall`](../modules/types_composer.md#appupdatemethodcall) \| [`AppCallMethodCall`](../modules/types_composer.md#appcallmethodcall) | - | +| `suggestedParams` | `SuggestedParams` | - | +| `includeSigner` | `boolean` | Whether to include the actual signer for the transactions. If you are just building transactions without signers yet then set this to `false`. | #### Returns @@ -694,7 +937,7 @@ ___ #### Defined in -[src/types/composer.ts:627](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L627) +[src/types/composer.ts:782](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L782) ___ @@ -715,25 +958,25 @@ ___ #### Defined in -[src/types/composer.ts:704](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L704) +[src/types/composer.ts:885](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L885) ___ ### buildTransactions -▸ **buildTransactions**(): `Promise`\<`Transaction`[]\> +▸ **buildTransactions**(): `Promise`\<[`BuiltTransactions`](../interfaces/types_composer.BuiltTransactions.md)\> -Compose all of the transactions without signers and return the transaction objects directly. +Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls. #### Returns -`Promise`\<`Transaction`[]\> +`Promise`\<[`BuiltTransactions`](../interfaces/types_composer.BuiltTransactions.md)\> -The array of built transactions +The array of built transactions and any corresponding method calls #### Defined in -[src/types/composer.ts:901](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L901) +[src/types/composer.ts:1092](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1092) ___ @@ -741,6 +984,8 @@ ___ ▸ **buildTxn**(`txn`, `suggestedParams`): `Promise`\<`Transaction`[]\> +Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. + #### Parameters | Name | Type | @@ -754,7 +999,7 @@ ___ #### Defined in -[src/types/composer.ts:845](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L845) +[src/types/composer.ts:1042](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1042) ___ @@ -775,7 +1020,7 @@ ___ #### Defined in -[src/types/composer.ts:878](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L878) +[src/types/composer.ts:1069](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1069) ___ @@ -797,7 +1042,23 @@ ___ #### Defined in -[src/types/composer.ts:588](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L588) +[src/types/composer.ts:738](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L738) + +___ + +### count + +▸ **count**(): `Promise`\<`number`\> + +Get the number of transactions currently added to this composer. + +#### Returns + +`Promise`\<`number`\> + +#### Defined in + +[src/types/composer.ts:1132](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1132) ___ @@ -821,23 +1082,43 @@ The execution result #### Defined in -[src/types/composer.ts:961](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L961) +[src/types/composer.ts:1184](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1184) ___ ### rebuild -▸ **rebuild**(): `Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `transactions`: `TransactionWithSigner`[] }\> +▸ **rebuild**(): `Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `methodCalls`: `any` ; `transactions`: `TransactionWithSigner`[] }\> Rebuild the group, discarding any previously built transactions. This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build. #### Returns -`Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `transactions`: `TransactionWithSigner`[] }\> +`Promise`\<\{ `atc`: `AtomicTransactionComposer` ; `methodCalls`: `any` ; `transactions`: `TransactionWithSigner`[] }\> The newly built atomic transaction composer and the transactions #### Defined in -[src/types/composer.ts:951](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L951) +[src/types/composer.ts:1174](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1174) + +___ + +### arc2Note + +▸ **arc2Note**(`note`): `Uint8Array` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `note` | [`Arc2TransactionNote`](../modules/types_transaction.md#arc2transactionnote) | + +#### Returns + +`Uint8Array` + +#### Defined in + +[src/types/composer.ts:1207](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1207) diff --git a/docs/code/enums/types_app.OnSchemaBreak.md b/docs/code/enums/types_app.OnSchemaBreak.md index 649ea374..a8ede69e 100644 --- a/docs/code/enums/types_app.OnSchemaBreak.md +++ b/docs/code/enums/types_app.OnSchemaBreak.md @@ -24,7 +24,7 @@ Create a new app #### Defined in -[src/types/app.ts:287](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L287) +[src/types/app.ts:306](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L306) ___ @@ -36,7 +36,7 @@ Fail the deployment #### Defined in -[src/types/app.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L283) +[src/types/app.ts:302](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L302) ___ @@ -48,4 +48,4 @@ Delete the app and create a new one in its place #### Defined in -[src/types/app.ts:285](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L285) +[src/types/app.ts:304](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L304) diff --git a/docs/code/enums/types_app.OnUpdate.md b/docs/code/enums/types_app.OnUpdate.md index 3e5109a0..88a32ca2 100644 --- a/docs/code/enums/types_app.OnUpdate.md +++ b/docs/code/enums/types_app.OnUpdate.md @@ -25,7 +25,7 @@ Create a new app #### Defined in -[src/types/app.ts:277](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L277) +[src/types/app.ts:296](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L296) ___ @@ -37,7 +37,7 @@ Fail the deployment #### Defined in -[src/types/app.ts:271](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L271) +[src/types/app.ts:290](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L290) ___ @@ -49,7 +49,7 @@ Delete the app and create a new one in its place #### Defined in -[src/types/app.ts:275](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L275) +[src/types/app.ts:294](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L294) ___ @@ -61,4 +61,4 @@ Update the app #### Defined in -[src/types/app.ts:273](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L273) +[src/types/app.ts:292](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L292) diff --git a/docs/code/interfaces/types_app.AppCallParams.md b/docs/code/interfaces/types_app.AppCallParams.md index 9ac5dd71..4ef81b16 100644 --- a/docs/code/interfaces/types_app.AppCallParams.md +++ b/docs/code/interfaces/types_app.AppCallParams.md @@ -41,7 +41,7 @@ The id of the app to call #### Defined in -[src/types/app.ts:166](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L166) +[src/types/app.ts:185](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L185) ___ @@ -53,7 +53,7 @@ The arguments passed in to the app call #### Defined in -[src/types/app.ts:176](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L176) +[src/types/app.ts:195](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L195) ___ @@ -69,7 +69,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -81,7 +81,7 @@ The type of call, everything except create (see `createApp`) and update (see `up #### Defined in -[src/types/app.ts:168](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L168) +[src/types/app.ts:187](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L187) ___ @@ -97,7 +97,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -109,7 +109,7 @@ The account to make the call from #### Defined in -[src/types/app.ts:170](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L170) +[src/types/app.ts:189](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L189) ___ @@ -125,7 +125,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -141,7 +141,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -153,7 +153,7 @@ The (optional) transaction note #### Defined in -[src/types/app.ts:174](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L174) +[src/types/app.ts:193](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L193) ___ @@ -169,7 +169,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -186,7 +186,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -202,7 +202,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -218,7 +218,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ @@ -230,4 +230,4 @@ Optional transaction parameters #### Defined in -[src/types/app.ts:172](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L172) +[src/types/app.ts:191](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L191) diff --git a/docs/code/interfaces/types_app.AppCallTransactionResult.md b/docs/code/interfaces/types_app.AppCallTransactionResult.md index 7281375c..5c67836e 100644 --- a/docs/code/interfaces/types_app.AppCallTransactionResult.md +++ b/docs/code/interfaces/types_app.AppCallTransactionResult.md @@ -36,7 +36,7 @@ The response if the transaction was sent and waited for #### Defined in -[src/types/transaction.ts:53](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L53) +[src/types/transaction.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L57) ___ @@ -53,7 +53,7 @@ the index of the confirmation will match the index of the underlying transaction #### Defined in -[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) +[src/types/transaction.ts:67](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L67) ___ @@ -69,7 +69,7 @@ If an ABI method was called the processed return value #### Defined in -[src/types/app.ts:209](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L209) +[src/types/app.ts:228](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L228) ___ @@ -85,7 +85,7 @@ The transaction #### Defined in -[src/types/transaction.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L51) +[src/types/transaction.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L55) ___ @@ -101,4 +101,4 @@ The transactions that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L59) +[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) diff --git a/docs/code/interfaces/types_app.AppCallTransactionResultOfType.md b/docs/code/interfaces/types_app.AppCallTransactionResultOfType.md index daced681..4f5fe02c 100644 --- a/docs/code/interfaces/types_app.AppCallTransactionResultOfType.md +++ b/docs/code/interfaces/types_app.AppCallTransactionResultOfType.md @@ -46,7 +46,7 @@ The response if the transaction was sent and waited for #### Defined in -[src/types/transaction.ts:53](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L53) +[src/types/transaction.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L57) ___ @@ -63,7 +63,7 @@ the index of the confirmation will match the index of the underlying transaction #### Defined in -[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) +[src/types/transaction.ts:67](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L67) ___ @@ -75,7 +75,7 @@ If an ABI method was called the processed return value #### Defined in -[src/types/app.ts:209](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L209) +[src/types/app.ts:228](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L228) ___ @@ -91,7 +91,7 @@ The transaction #### Defined in -[src/types/transaction.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L51) +[src/types/transaction.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L55) ___ @@ -107,4 +107,4 @@ The transactions that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L59) +[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) diff --git a/docs/code/interfaces/types_app.AppCompilationResult.md b/docs/code/interfaces/types_app.AppCompilationResult.md index 3b4de7b9..53a01a0c 100644 --- a/docs/code/interfaces/types_app.AppCompilationResult.md +++ b/docs/code/interfaces/types_app.AppCompilationResult.md @@ -23,7 +23,7 @@ The compilation result of approval #### Defined in -[src/types/app.ts:316](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L316) +[src/types/app.ts:335](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L335) ___ @@ -35,4 +35,4 @@ The compilation result of clear #### Defined in -[src/types/app.ts:318](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L318) +[src/types/app.ts:337](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L337) diff --git a/docs/code/interfaces/types_app.AppDeployMetadata.md b/docs/code/interfaces/types_app.AppDeployMetadata.md index bbddcdec..97f2a0b0 100644 --- a/docs/code/interfaces/types_app.AppDeployMetadata.md +++ b/docs/code/interfaces/types_app.AppDeployMetadata.md @@ -10,6 +10,8 @@ The payload of the metadata to add to the transaction note when deploying an app - **`AppDeployMetadata`** + ↳ [`AppMetadata`](types_app_deployer.AppMetadata.md) + ↳ [`AppMetadata`](types_app.AppMetadata.md) ## Table of contents @@ -31,7 +33,7 @@ Whether or not the app is deletable / permanent / unspecified #### Defined in -[src/types/app.ts:234](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L234) +[src/types/app.ts:253](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L253) ___ @@ -43,7 +45,7 @@ The unique name identifier of the app within the creator account #### Defined in -[src/types/app.ts:230](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L230) +[src/types/app.ts:249](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L249) ___ @@ -55,7 +57,7 @@ Whether or not the app is updatable / immutable / unspecified #### Defined in -[src/types/app.ts:236](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L236) +[src/types/app.ts:255](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L255) ___ @@ -67,4 +69,4 @@ The version of app that is / will be deployed #### Defined in -[src/types/app.ts:232](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L232) +[src/types/app.ts:251](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L251) diff --git a/docs/code/interfaces/types_app.AppDeploymentParams.md b/docs/code/interfaces/types_app.AppDeploymentParams.md index 903652dc..19247b01 100644 --- a/docs/code/interfaces/types_app.AppDeploymentParams.md +++ b/docs/code/interfaces/types_app.AppDeploymentParams.md @@ -50,7 +50,7 @@ Omit.approvalProgram #### Defined in -[src/types/app.ts:125](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L125) +[src/types/app.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L135) ___ @@ -66,7 +66,7 @@ Omit.clearStateProgram #### Defined in -[src/types/app.ts:127](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L127) +[src/types/app.ts:137](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L137) ___ @@ -78,7 +78,7 @@ Any args to pass to any create transaction that is issued as part of deployment #### Defined in -[src/types/app.ts:304](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L304) +[src/types/app.ts:323](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L323) ___ @@ -90,7 +90,7 @@ Override the on-completion action for the create call; defaults to NoOp #### Defined in -[src/types/app.ts:306](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L306) +[src/types/app.ts:325](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L325) ___ @@ -102,7 +102,7 @@ Any args to pass to any delete transaction that is issued as part of deployment #### Defined in -[src/types/app.ts:310](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L310) +[src/types/app.ts:329](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L329) ___ @@ -114,7 +114,7 @@ Any deploy-time parameters to replace in the TEAL code #### Defined in -[src/types/app.ts:296](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L296) +[src/types/app.ts:315](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L315) ___ @@ -126,7 +126,7 @@ Optional cached value of the existing apps for the given creator #### Defined in -[src/types/app.ts:302](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L302) +[src/types/app.ts:321](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L321) ___ @@ -142,7 +142,7 @@ Omit.fee #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -158,7 +158,7 @@ Omit.from #### Defined in -[src/types/app.ts:123](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L123) +[src/types/app.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L133) ___ @@ -174,7 +174,7 @@ Omit.maxFee #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -190,7 +190,7 @@ Omit.maxRoundsToWaitForConfirmation #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -202,7 +202,7 @@ The deployment metadata #### Defined in -[src/types/app.ts:294](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L294) +[src/types/app.ts:313](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L313) ___ @@ -214,7 +214,7 @@ What action to perform if a schema break is detected #### Defined in -[src/types/app.ts:298](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L298) +[src/types/app.ts:317](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L317) ___ @@ -226,7 +226,7 @@ What action to perform if a TEAL update is detected #### Defined in -[src/types/app.ts:300](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L300) +[src/types/app.ts:319](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L319) ___ @@ -242,7 +242,7 @@ Omit.populateAppCallResources #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -258,7 +258,7 @@ Omit.schema #### Defined in -[src/types/app.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L139) +[src/types/app.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L152) ___ @@ -274,7 +274,7 @@ Omit.suppressLog #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ @@ -290,7 +290,7 @@ Omit.transactionParams #### Defined in -[src/types/app.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L129) +[src/types/app.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L139) ___ @@ -302,4 +302,4 @@ Any args to pass to any update transaction that is issued as part of deployment #### Defined in -[src/types/app.ts:308](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L308) +[src/types/app.ts:327](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L327) diff --git a/docs/code/interfaces/types_app.AppLookup.md b/docs/code/interfaces/types_app.AppLookup.md index ab6ff939..cdfe0176 100644 --- a/docs/code/interfaces/types_app.AppLookup.md +++ b/docs/code/interfaces/types_app.AppLookup.md @@ -21,7 +21,7 @@ A lookup of name -> Algorand app for a creator #### Defined in -[src/types/app.ts:254](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L254) +[src/types/app.ts:273](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L273) ___ @@ -31,4 +31,4 @@ ___ #### Defined in -[src/types/app.ts:253](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L253) +[src/types/app.ts:272](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L272) diff --git a/docs/code/interfaces/types_app.AppMetadata.md b/docs/code/interfaces/types_app.AppMetadata.md index 01d94da8..104f4f04 100644 --- a/docs/code/interfaces/types_app.AppMetadata.md +++ b/docs/code/interfaces/types_app.AppMetadata.md @@ -43,7 +43,7 @@ The Algorand address of the account associated with the app #### Defined in -[src/types/app.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L41) +[src/types/app.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L43) ___ @@ -59,7 +59,7 @@ The id of the app #### Defined in -[src/types/app.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L39) +[src/types/app.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L41) ___ @@ -71,7 +71,7 @@ The metadata when the app was created #### Defined in -[src/types/app.ts:246](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L246) +[src/types/app.ts:265](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L265) ___ @@ -83,7 +83,7 @@ The round the app was created #### Defined in -[src/types/app.ts:242](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L242) +[src/types/app.ts:261](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L261) ___ @@ -99,7 +99,7 @@ Whether or not the app is deletable / permanent / unspecified #### Defined in -[src/types/app.ts:234](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L234) +[src/types/app.ts:253](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L253) ___ @@ -111,7 +111,7 @@ Whether or not the app is deleted #### Defined in -[src/types/app.ts:248](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L248) +[src/types/app.ts:267](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L267) ___ @@ -127,7 +127,7 @@ The unique name identifier of the app within the creator account #### Defined in -[src/types/app.ts:230](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L230) +[src/types/app.ts:249](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L249) ___ @@ -143,7 +143,7 @@ Whether or not the app is updatable / immutable / unspecified #### Defined in -[src/types/app.ts:236](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L236) +[src/types/app.ts:255](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L255) ___ @@ -155,7 +155,7 @@ The last round that the app was updated #### Defined in -[src/types/app.ts:244](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L244) +[src/types/app.ts:263](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L263) ___ @@ -171,4 +171,4 @@ The version of app that is / will be deployed #### Defined in -[src/types/app.ts:232](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L232) +[src/types/app.ts:251](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L251) diff --git a/docs/code/interfaces/types_app.AppReference.md b/docs/code/interfaces/types_app.AppReference.md index b32e0d33..90633cd7 100644 --- a/docs/code/interfaces/types_app.AppReference.md +++ b/docs/code/interfaces/types_app.AppReference.md @@ -29,7 +29,7 @@ The Algorand address of the account associated with the app #### Defined in -[src/types/app.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L41) +[src/types/app.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L43) ___ @@ -41,4 +41,4 @@ The id of the app #### Defined in -[src/types/app.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L39) +[src/types/app.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L41) diff --git a/docs/code/interfaces/types_app.AppStorageSchema.md b/docs/code/interfaces/types_app.AppStorageSchema.md index 36a3b327..1280c927 100644 --- a/docs/code/interfaces/types_app.AppStorageSchema.md +++ b/docs/code/interfaces/types_app.AppStorageSchema.md @@ -26,7 +26,7 @@ Any extra pages that are needed for the smart contract; if left blank then the r #### Defined in -[src/types/app.ts:190](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L190) +[src/types/app.ts:209](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L209) ___ @@ -38,7 +38,7 @@ Restricts number of byte slices in global state #### Defined in -[src/types/app.ts:188](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L188) +[src/types/app.ts:207](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L207) ___ @@ -50,7 +50,7 @@ Restricts number of ints in global state #### Defined in -[src/types/app.ts:186](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L186) +[src/types/app.ts:205](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L205) ___ @@ -62,7 +62,7 @@ Restricts number of byte slices in per-user local state #### Defined in -[src/types/app.ts:184](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L184) +[src/types/app.ts:203](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L203) ___ @@ -74,4 +74,4 @@ Restricts number of ints in per-user local state #### Defined in -[src/types/app.ts:182](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L182) +[src/types/app.ts:201](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L201) diff --git a/docs/code/interfaces/types_app.BoxName.md b/docs/code/interfaces/types_app.BoxName.md index 08f65714..edbb0e9b 100644 --- a/docs/code/interfaces/types_app.BoxName.md +++ b/docs/code/interfaces/types_app.BoxName.md @@ -24,7 +24,7 @@ Name in UTF-8 #### Defined in -[src/types/app.ts:341](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L341) +[src/types/app.ts:382](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L382) ___ @@ -36,7 +36,7 @@ Name in Base64 #### Defined in -[src/types/app.ts:345](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L345) +[src/types/app.ts:386](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L386) ___ @@ -48,4 +48,4 @@ Name in binary bytes #### Defined in -[src/types/app.ts:343](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L343) +[src/types/app.ts:384](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L384) diff --git a/docs/code/interfaces/types_app.BoxReference.md b/docs/code/interfaces/types_app.BoxReference.md index e909d903..af39545f 100644 --- a/docs/code/interfaces/types_app.BoxReference.md +++ b/docs/code/interfaces/types_app.BoxReference.md @@ -4,6 +4,10 @@ [types/app](../modules/types_app.md).BoxReference +**`Deprecated`** + +Use `types/app-manager/BoxReference` instead. + A grouping of the app ID and name of the box in an Uint8Array ## Table of contents @@ -23,7 +27,7 @@ A unique application id #### Defined in -[src/types/app.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L51) +[src/types/app.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L55) ___ @@ -35,4 +39,4 @@ Name of box to reference #### Defined in -[src/types/app.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L55) +[src/types/app.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L59) diff --git a/docs/code/interfaces/types_app.BoxValueRequestParams.md b/docs/code/interfaces/types_app.BoxValueRequestParams.md index 85198f9e..18cc9669 100644 --- a/docs/code/interfaces/types_app.BoxValueRequestParams.md +++ b/docs/code/interfaces/types_app.BoxValueRequestParams.md @@ -4,6 +4,9 @@ [types/app](../modules/types_app.md).BoxValueRequestParams +**`Deprecated`** + +Use `types/app-manager/BoxValueRequestParams` instead. Parameters to get and decode a box value as an ABI type. ## Table of contents @@ -24,7 +27,7 @@ The ID of the app return box names for #### Defined in -[src/types/app.ts:353](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L353) +[src/types/app.ts:395](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L395) ___ @@ -36,7 +39,7 @@ The name of the box to return either as a string, binary array or `BoxName` #### Defined in -[src/types/app.ts:355](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L355) +[src/types/app.ts:397](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L397) ___ @@ -48,4 +51,4 @@ The ABI type to decode the value using #### Defined in -[src/types/app.ts:357](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L357) +[src/types/app.ts:399](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L399) diff --git a/docs/code/interfaces/types_app.BoxValuesRequestParams.md b/docs/code/interfaces/types_app.BoxValuesRequestParams.md index 7866ef0b..ede1f3e5 100644 --- a/docs/code/interfaces/types_app.BoxValuesRequestParams.md +++ b/docs/code/interfaces/types_app.BoxValuesRequestParams.md @@ -4,6 +4,9 @@ [types/app](../modules/types_app.md).BoxValuesRequestParams +**`Deprecated`** + +Use `types/app-manager/BoxValuesRequestParams` instead. Parameters to get and decode a box value as an ABI type. ## Table of contents @@ -24,7 +27,7 @@ The ID of the app return box names for #### Defined in -[src/types/app.ts:365](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L365) +[src/types/app.ts:408](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L408) ___ @@ -36,7 +39,7 @@ The names of the boxes to return either as a string, binary array or BoxName` #### Defined in -[src/types/app.ts:367](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L367) +[src/types/app.ts:410](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L410) ___ @@ -48,4 +51,4 @@ The ABI type to decode the value using #### Defined in -[src/types/app.ts:369](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L369) +[src/types/app.ts:412](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L412) diff --git a/docs/code/interfaces/types_app.CompiledTeal.md b/docs/code/interfaces/types_app.CompiledTeal.md index 5ff9c6a7..e4148282 100644 --- a/docs/code/interfaces/types_app.CompiledTeal.md +++ b/docs/code/interfaces/types_app.CompiledTeal.md @@ -26,7 +26,7 @@ The compiled code #### Defined in -[src/types/app.ts:198](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L198) +[src/types/app.ts:217](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L217) ___ @@ -38,7 +38,7 @@ The base64 encoded code as a byte array #### Defined in -[src/types/app.ts:202](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L202) +[src/types/app.ts:221](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L221) ___ @@ -50,7 +50,7 @@ The has returned by the compiler #### Defined in -[src/types/app.ts:200](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L200) +[src/types/app.ts:219](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L219) ___ @@ -62,7 +62,7 @@ Source map from the compilation #### Defined in -[src/types/app.ts:204](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L204) +[src/types/app.ts:223](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L223) ___ @@ -74,4 +74,4 @@ Original TEAL code #### Defined in -[src/types/app.ts:196](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L196) +[src/types/app.ts:215](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L215) diff --git a/docs/code/interfaces/types_app.CoreAppCallArgs.md b/docs/code/interfaces/types_app.CoreAppCallArgs.md index 0ea409c6..789530c2 100644 --- a/docs/code/interfaces/types_app.CoreAppCallArgs.md +++ b/docs/code/interfaces/types_app.CoreAppCallArgs.md @@ -33,7 +33,7 @@ The address of any accounts to load in #### Defined in -[src/types/app.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L73) +[src/types/app.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L79) ___ @@ -45,7 +45,7 @@ IDs of any apps to load into the foreignApps array #### Defined in -[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) +[src/types/app.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L81) ___ @@ -57,7 +57,7 @@ IDs of any assets to load into the foreignAssets array #### Defined in -[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) +[src/types/app.ts:83](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L83) ___ @@ -69,7 +69,7 @@ Any box references to load #### Defined in -[src/types/app.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L71) +[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) ___ @@ -81,7 +81,7 @@ The optional lease for the transaction #### Defined in -[src/types/app.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L69) +[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) ___ @@ -95,4 +95,4 @@ Optional account / account address that should be authorised to transact on beha #### Defined in -[src/types/app.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L82) +[src/types/app.ts:88](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L88) diff --git a/docs/code/interfaces/types_app.CreateAppParams.md b/docs/code/interfaces/types_app.CreateAppParams.md index 4a1c2cbf..41dc5e12 100644 --- a/docs/code/interfaces/types_app.CreateAppParams.md +++ b/docs/code/interfaces/types_app.CreateAppParams.md @@ -4,6 +4,10 @@ [types/app](../modules/types_app.md).CreateAppParams +**`Deprecated`** + +Use `AlgoKitComposer` to construct create app transactions instead. + Parameters that are passed in when creating an app. ## Hierarchy @@ -47,7 +51,7 @@ CreateOrUpdateAppParams.approvalProgram #### Defined in -[src/types/app.ts:125](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L125) +[src/types/app.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L135) ___ @@ -63,7 +67,7 @@ CreateOrUpdateAppParams.args #### Defined in -[src/types/app.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L133) +[src/types/app.ts:143](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L143) ___ @@ -79,7 +83,7 @@ CreateOrUpdateAppParams.atc #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -95,7 +99,7 @@ CreateOrUpdateAppParams.clearStateProgram #### Defined in -[src/types/app.ts:127](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L127) +[src/types/app.ts:137](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L137) ___ @@ -111,7 +115,7 @@ CreateOrUpdateAppParams.fee #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -127,7 +131,7 @@ CreateOrUpdateAppParams.from #### Defined in -[src/types/app.ts:123](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L123) +[src/types/app.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L133) ___ @@ -143,7 +147,7 @@ CreateOrUpdateAppParams.maxFee #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -159,7 +163,7 @@ CreateOrUpdateAppParams.maxRoundsToWaitForConfirmation #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -175,7 +179,7 @@ CreateOrUpdateAppParams.note #### Defined in -[src/types/app.ts:131](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L131) +[src/types/app.ts:141](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L141) ___ @@ -187,7 +191,7 @@ Override the on-completion action for the create call; defaults to NoOp #### Defined in -[src/types/app.ts:141](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L141) +[src/types/app.ts:154](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L154) ___ @@ -203,7 +207,7 @@ CreateOrUpdateAppParams.populateAppCallResources #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -215,7 +219,7 @@ The storage schema to request for the created app #### Defined in -[src/types/app.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L139) +[src/types/app.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L152) ___ @@ -232,7 +236,7 @@ CreateOrUpdateAppParams.skipSending #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -248,7 +252,7 @@ CreateOrUpdateAppParams.skipWaiting #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -264,7 +268,7 @@ CreateOrUpdateAppParams.suppressLog #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ @@ -280,4 +284,4 @@ CreateOrUpdateAppParams.transactionParams #### Defined in -[src/types/app.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L129) +[src/types/app.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L139) diff --git a/docs/code/interfaces/types_app.RawAppCallArgs.md b/docs/code/interfaces/types_app.RawAppCallArgs.md index 0545b4ea..b83ab613 100644 --- a/docs/code/interfaces/types_app.RawAppCallArgs.md +++ b/docs/code/interfaces/types_app.RawAppCallArgs.md @@ -41,7 +41,7 @@ The address of any accounts to load in #### Defined in -[src/types/app.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L73) +[src/types/app.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L79) ___ @@ -53,7 +53,7 @@ Any application arguments to pass through #### Defined in -[src/types/app.ts:90](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L90) +[src/types/app.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L96) ___ @@ -69,7 +69,7 @@ IDs of any apps to load into the foreignApps array #### Defined in -[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) +[src/types/app.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L81) ___ @@ -85,7 +85,7 @@ IDs of any assets to load into the foreignAssets array #### Defined in -[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) +[src/types/app.ts:83](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L83) ___ @@ -101,7 +101,7 @@ Any box references to load #### Defined in -[src/types/app.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L71) +[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) ___ @@ -117,7 +117,7 @@ The optional lease for the transaction #### Defined in -[src/types/app.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L69) +[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) ___ @@ -129,7 +129,7 @@ Property to aid intellisense #### Defined in -[src/types/app.ts:92](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L92) +[src/types/app.ts:98](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L98) ___ @@ -147,4 +147,4 @@ Optional account / account address that should be authorised to transact on beha #### Defined in -[src/types/app.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L82) +[src/types/app.ts:88](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L88) diff --git a/docs/code/interfaces/types_app.UpdateAppParams.md b/docs/code/interfaces/types_app.UpdateAppParams.md index 09bbb2b4..2a3277e3 100644 --- a/docs/code/interfaces/types_app.UpdateAppParams.md +++ b/docs/code/interfaces/types_app.UpdateAppParams.md @@ -4,6 +4,10 @@ [types/app](../modules/types_app.md).UpdateAppParams +**`Deprecated`** + +Use `AlgoKitComposer` to construct update app transactions instead. + Parameters that are passed in when updating an app. ## Hierarchy @@ -42,7 +46,7 @@ The id of the app to update #### Defined in -[src/types/app.ts:147](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L147) +[src/types/app.ts:163](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L163) ___ @@ -58,7 +62,7 @@ CreateOrUpdateAppParams.approvalProgram #### Defined in -[src/types/app.ts:125](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L125) +[src/types/app.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L135) ___ @@ -74,7 +78,7 @@ CreateOrUpdateAppParams.args #### Defined in -[src/types/app.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L133) +[src/types/app.ts:143](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L143) ___ @@ -90,7 +94,7 @@ CreateOrUpdateAppParams.atc #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -106,7 +110,7 @@ CreateOrUpdateAppParams.clearStateProgram #### Defined in -[src/types/app.ts:127](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L127) +[src/types/app.ts:137](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L137) ___ @@ -122,7 +126,7 @@ CreateOrUpdateAppParams.fee #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -138,7 +142,7 @@ CreateOrUpdateAppParams.from #### Defined in -[src/types/app.ts:123](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L123) +[src/types/app.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L133) ___ @@ -154,7 +158,7 @@ CreateOrUpdateAppParams.maxFee #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -170,7 +174,7 @@ CreateOrUpdateAppParams.maxRoundsToWaitForConfirmation #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -186,7 +190,7 @@ CreateOrUpdateAppParams.note #### Defined in -[src/types/app.ts:131](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L131) +[src/types/app.ts:141](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L141) ___ @@ -202,7 +206,7 @@ CreateOrUpdateAppParams.populateAppCallResources #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -219,7 +223,7 @@ CreateOrUpdateAppParams.skipSending #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -235,7 +239,7 @@ CreateOrUpdateAppParams.skipWaiting #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -251,7 +255,7 @@ CreateOrUpdateAppParams.suppressLog #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ @@ -267,4 +271,4 @@ CreateOrUpdateAppParams.transactionParams #### Defined in -[src/types/app.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L129) +[src/types/app.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L139) diff --git a/docs/code/interfaces/types_app_client.AppClientCallABIArgs.md b/docs/code/interfaces/types_app_client.AppClientCallABIArgs.md index 5c928c86..2343d88c 100644 --- a/docs/code/interfaces/types_app_client.AppClientCallABIArgs.md +++ b/docs/code/interfaces/types_app_client.AppClientCallABIArgs.md @@ -37,7 +37,7 @@ Omit.accounts #### Defined in -[src/types/app.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L73) +[src/types/app.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L79) ___ @@ -53,7 +53,7 @@ Omit.apps #### Defined in -[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) +[src/types/app.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L81) ___ @@ -69,7 +69,7 @@ Omit.assets #### Defined in -[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) +[src/types/app.ts:83](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L83) ___ @@ -85,7 +85,7 @@ Omit.boxes #### Defined in -[src/types/app.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L71) +[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) ___ @@ -101,7 +101,7 @@ Omit.lease #### Defined in -[src/types/app.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L69) +[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) ___ @@ -113,7 +113,7 @@ If calling an ABI method then either the name of the method, or the ABI signatur #### Defined in -[src/types/app-client.ts:170](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L170) +[src/types/app-client.ts:169](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L169) ___ @@ -129,7 +129,7 @@ Omit.methodArgs #### Defined in -[src/types/app.ts:111](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L111) +[src/types/app.ts:117](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L117) ___ @@ -147,4 +147,4 @@ Omit.rekeyTo #### Defined in -[src/types/app.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L82) +[src/types/app.ts:88](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L88) diff --git a/docs/code/interfaces/types_app_client.AppClientCallCoreParams.md b/docs/code/interfaces/types_app_client.AppClientCallCoreParams.md index d709b7ac..8b7649b5 100644 --- a/docs/code/interfaces/types_app_client.AppClientCallCoreParams.md +++ b/docs/code/interfaces/types_app_client.AppClientCallCoreParams.md @@ -24,7 +24,7 @@ The transaction note for the smart contract call #### Defined in -[src/types/app-client.ts:181](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L181) +[src/types/app-client.ts:180](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L180) ___ @@ -36,7 +36,7 @@ Parameters to control transaction sending #### Defined in -[src/types/app-client.ts:183](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L183) +[src/types/app-client.ts:182](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L182) ___ @@ -48,4 +48,4 @@ The optional sender to send the transaction from, will use the application clien #### Defined in -[src/types/app-client.ts:179](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L179) +[src/types/app-client.ts:178](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L178) diff --git a/docs/code/interfaces/types_app_client.AppClientCallRawArgs.md b/docs/code/interfaces/types_app_client.AppClientCallRawArgs.md index 7f3a15d2..0a183289 100644 --- a/docs/code/interfaces/types_app_client.AppClientCallRawArgs.md +++ b/docs/code/interfaces/types_app_client.AppClientCallRawArgs.md @@ -39,7 +39,7 @@ The address of any accounts to load in #### Defined in -[src/types/app.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L73) +[src/types/app.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L79) ___ @@ -55,7 +55,7 @@ Any application arguments to pass through #### Defined in -[src/types/app.ts:90](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L90) +[src/types/app.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L96) ___ @@ -71,7 +71,7 @@ IDs of any apps to load into the foreignApps array #### Defined in -[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) +[src/types/app.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L81) ___ @@ -87,7 +87,7 @@ IDs of any assets to load into the foreignAssets array #### Defined in -[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) +[src/types/app.ts:83](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L83) ___ @@ -103,7 +103,7 @@ Any box references to load #### Defined in -[src/types/app.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L71) +[src/types/app.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L77) ___ @@ -119,7 +119,7 @@ The optional lease for the transaction #### Defined in -[src/types/app.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L69) +[src/types/app.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L75) ___ @@ -135,7 +135,7 @@ Property to aid intellisense #### Defined in -[src/types/app.ts:92](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L92) +[src/types/app.ts:98](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L98) ___ @@ -153,4 +153,4 @@ Optional account / account address that should be authorised to transact on beha #### Defined in -[src/types/app.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L82) +[src/types/app.ts:88](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L88) diff --git a/docs/code/interfaces/types_app_client.AppClientCompilationParams.md b/docs/code/interfaces/types_app_client.AppClientCompilationParams.md index 73e26280..3b44839e 100644 --- a/docs/code/interfaces/types_app_client.AppClientCompilationParams.md +++ b/docs/code/interfaces/types_app_client.AppClientCompilationParams.md @@ -20,7 +20,7 @@ #### Defined in -[src/types/app-client.ts:198](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L198) +[src/types/app-client.ts:197](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L197) ___ @@ -32,7 +32,7 @@ Any deploy-time parameters to replace in the TEAL code #### Defined in -[src/types/app-client.ts:194](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L194) +[src/types/app-client.ts:193](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L193) ___ @@ -42,4 +42,4 @@ ___ #### Defined in -[src/types/app-client.ts:196](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L196) +[src/types/app-client.ts:195](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L195) diff --git a/docs/code/interfaces/types_app_client.AppClientDeployCallInterfaceParams.md b/docs/code/interfaces/types_app_client.AppClientDeployCallInterfaceParams.md index 66358f64..419d6d1b 100644 --- a/docs/code/interfaces/types_app_client.AppClientDeployCallInterfaceParams.md +++ b/docs/code/interfaces/types_app_client.AppClientDeployCallInterfaceParams.md @@ -32,7 +32,7 @@ Any args to pass to any create transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:150](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L150) +[src/types/app-client.ts:149](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L149) ___ @@ -44,7 +44,7 @@ Override the on-completion action for the create call; defaults to NoOp #### Defined in -[src/types/app-client.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L152) +[src/types/app-client.ts:151](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L151) ___ @@ -56,7 +56,7 @@ Any args to pass to any delete transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:156](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L156) +[src/types/app-client.ts:155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L155) ___ @@ -68,7 +68,7 @@ Any deploy-time parameters to replace in the TEAL code #### Defined in -[src/types/app-client.ts:148](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L148) +[src/types/app-client.ts:147](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L147) ___ @@ -80,4 +80,4 @@ Any args to pass to any update transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:154](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L154) +[src/types/app-client.ts:153](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L153) diff --git a/docs/code/interfaces/types_app_client.AppClientDeployCoreParams.md b/docs/code/interfaces/types_app_client.AppClientDeployCoreParams.md index dd892e8b..ce6c23d8 100644 --- a/docs/code/interfaces/types_app_client.AppClientDeployCoreParams.md +++ b/docs/code/interfaces/types_app_client.AppClientDeployCoreParams.md @@ -35,7 +35,7 @@ If this is not specified then it will automatically be determined based on the A #### Defined in -[src/types/app-client.ts:138](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L138) +[src/types/app-client.ts:137](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L137) ___ @@ -48,7 +48,7 @@ If this is not specified then it will automatically be determined based on the A #### Defined in -[src/types/app-client.ts:134](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L134) +[src/types/app-client.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L133) ___ @@ -60,7 +60,7 @@ What action to perform if a schema break is detected #### Defined in -[src/types/app-client.ts:140](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L140) +[src/types/app-client.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L139) ___ @@ -72,7 +72,7 @@ What action to perform if a TEAL update is detected #### Defined in -[src/types/app-client.ts:142](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L142) +[src/types/app-client.ts:141](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L141) ___ @@ -84,7 +84,7 @@ Parameters to control transaction sending #### Defined in -[src/types/app-client.ts:130](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L130) +[src/types/app-client.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L129) ___ @@ -96,7 +96,7 @@ The optional sender to send the transaction from, will use the application clien #### Defined in -[src/types/app-client.ts:128](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L128) +[src/types/app-client.ts:127](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L127) ___ @@ -108,4 +108,4 @@ The version of the contract, uses "1.0" by default #### Defined in -[src/types/app-client.ts:126](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L126) +[src/types/app-client.ts:125](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L125) diff --git a/docs/code/interfaces/types_app_client.AppClientDeployParams.md b/docs/code/interfaces/types_app_client.AppClientDeployParams.md index bb24f775..a7bff6cc 100644 --- a/docs/code/interfaces/types_app_client.AppClientDeployParams.md +++ b/docs/code/interfaces/types_app_client.AppClientDeployParams.md @@ -47,7 +47,7 @@ If this is not specified then it will automatically be determined based on the A #### Defined in -[src/types/app-client.ts:138](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L138) +[src/types/app-client.ts:137](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L137) ___ @@ -64,7 +64,7 @@ If this is not specified then it will automatically be determined based on the A #### Defined in -[src/types/app-client.ts:134](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L134) +[src/types/app-client.ts:133](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L133) ___ @@ -80,7 +80,7 @@ Any args to pass to any create transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:150](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L150) +[src/types/app-client.ts:149](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L149) ___ @@ -96,7 +96,7 @@ Override the on-completion action for the create call; defaults to NoOp #### Defined in -[src/types/app-client.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L152) +[src/types/app-client.ts:151](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L151) ___ @@ -112,7 +112,7 @@ Any args to pass to any delete transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:156](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L156) +[src/types/app-client.ts:155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L155) ___ @@ -128,7 +128,7 @@ Any deploy-time parameters to replace in the TEAL code #### Defined in -[src/types/app-client.ts:148](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L148) +[src/types/app-client.ts:147](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L147) ___ @@ -144,7 +144,7 @@ What action to perform if a schema break is detected #### Defined in -[src/types/app-client.ts:140](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L140) +[src/types/app-client.ts:139](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L139) ___ @@ -160,7 +160,7 @@ What action to perform if a TEAL update is detected #### Defined in -[src/types/app-client.ts:142](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L142) +[src/types/app-client.ts:141](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L141) ___ @@ -172,7 +172,7 @@ Any overrides for the storage schema to request for the created app; by default #### Defined in -[src/types/app-client.ts:162](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L162) +[src/types/app-client.ts:161](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L161) ___ @@ -188,7 +188,7 @@ Parameters to control transaction sending #### Defined in -[src/types/app-client.ts:130](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L130) +[src/types/app-client.ts:129](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L129) ___ @@ -204,7 +204,7 @@ The optional sender to send the transaction from, will use the application clien #### Defined in -[src/types/app-client.ts:128](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L128) +[src/types/app-client.ts:127](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L127) ___ @@ -220,7 +220,7 @@ Any args to pass to any update transaction that is issued as part of deployment #### Defined in -[src/types/app-client.ts:154](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L154) +[src/types/app-client.ts:153](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L153) ___ @@ -236,4 +236,4 @@ The version of the contract, uses "1.0" by default #### Defined in -[src/types/app-client.ts:126](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L126) +[src/types/app-client.ts:125](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L125) diff --git a/docs/code/interfaces/types_app_client.AppSourceMaps.md b/docs/code/interfaces/types_app_client.AppSourceMaps.md index 9333076d..66662f7b 100644 --- a/docs/code/interfaces/types_app_client.AppSourceMaps.md +++ b/docs/code/interfaces/types_app_client.AppSourceMaps.md @@ -23,7 +23,7 @@ The source map of the approval program #### Defined in -[src/types/app-client.ts:232](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L232) +[src/types/app-client.ts:231](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L231) ___ @@ -35,4 +35,4 @@ The source map of the clear program #### Defined in -[src/types/app-client.ts:234](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L234) +[src/types/app-client.ts:233](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L233) diff --git a/docs/code/interfaces/types_app_client.FundAppAccountParams.md b/docs/code/interfaces/types_app_client.FundAppAccountParams.md index f58f2ec4..b5d01b22 100644 --- a/docs/code/interfaces/types_app_client.FundAppAccountParams.md +++ b/docs/code/interfaces/types_app_client.FundAppAccountParams.md @@ -23,7 +23,7 @@ Parameters for funding an app account #### Defined in -[src/types/app-client.ts:220](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L220) +[src/types/app-client.ts:219](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L219) ___ @@ -35,7 +35,7 @@ The transaction note for the smart contract call #### Defined in -[src/types/app-client.ts:224](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L224) +[src/types/app-client.ts:223](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L223) ___ @@ -47,7 +47,7 @@ Parameters to control transaction sending #### Defined in -[src/types/app-client.ts:226](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L226) +[src/types/app-client.ts:225](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L225) ___ @@ -59,4 +59,4 @@ The optional sender to send the transaction from, will use the application clien #### Defined in -[src/types/app-client.ts:222](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L222) +[src/types/app-client.ts:221](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L221) diff --git a/docs/code/interfaces/types_app_client.ResolveAppById.md b/docs/code/interfaces/types_app_client.ResolveAppById.md index 5d4d664f..654dd522 100644 --- a/docs/code/interfaces/types_app_client.ResolveAppById.md +++ b/docs/code/interfaces/types_app_client.ResolveAppById.md @@ -34,7 +34,7 @@ The id of an existing app to call using this client, or 0 if the app hasn't been #### Defined in -[src/types/app-client.ts:80](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L80) +[src/types/app-client.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L79) ___ @@ -50,7 +50,7 @@ The optional name to use to mark the app when deploying `ApplicationClient.deplo #### Defined in -[src/types/app-client.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L82) +[src/types/app-client.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L81) ___ @@ -62,4 +62,4 @@ How the app ID is resolved, either by `'id'` or `'creatorAndName'`; must be `'cr #### Defined in -[src/types/app-client.ts:87](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L87) +[src/types/app-client.ts:86](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L86) diff --git a/docs/code/interfaces/types_app_client.ResolveAppByIdBase.md b/docs/code/interfaces/types_app_client.ResolveAppByIdBase.md index f9b5564e..9ddb2acb 100644 --- a/docs/code/interfaces/types_app_client.ResolveAppByIdBase.md +++ b/docs/code/interfaces/types_app_client.ResolveAppByIdBase.md @@ -29,7 +29,7 @@ The id of an existing app to call using this client, or 0 if the app hasn't been #### Defined in -[src/types/app-client.ts:80](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L80) +[src/types/app-client.ts:79](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L79) ___ @@ -41,4 +41,4 @@ The optional name to use to mark the app when deploying `ApplicationClient.deplo #### Defined in -[src/types/app-client.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L82) +[src/types/app-client.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L81) diff --git a/docs/code/interfaces/types_app_client.SourceMapExport.md b/docs/code/interfaces/types_app_client.SourceMapExport.md index 7bbe0822..f53aaf64 100644 --- a/docs/code/interfaces/types_app_client.SourceMapExport.md +++ b/docs/code/interfaces/types_app_client.SourceMapExport.md @@ -21,7 +21,7 @@ #### Defined in -[src/types/app-client.ts:241](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L241) +[src/types/app-client.ts:240](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L240) ___ @@ -31,7 +31,7 @@ ___ #### Defined in -[src/types/app-client.ts:240](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L240) +[src/types/app-client.ts:239](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L239) ___ @@ -41,7 +41,7 @@ ___ #### Defined in -[src/types/app-client.ts:239](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L239) +[src/types/app-client.ts:238](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L238) ___ @@ -51,4 +51,4 @@ ___ #### Defined in -[src/types/app-client.ts:238](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L238) +[src/types/app-client.ts:237](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L237) diff --git a/docs/code/interfaces/types_app_deployer.AppDeployParams.md b/docs/code/interfaces/types_app_deployer.AppDeployParams.md new file mode 100644 index 00000000..eda3ee9d --- /dev/null +++ b/docs/code/interfaces/types_app_deployer.AppDeployParams.md @@ -0,0 +1,151 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-deployer](../modules/types_app_deployer.md) / AppDeployParams + +# Interface: AppDeployParams + +[types/app-deployer](../modules/types_app_deployer.md).AppDeployParams + +The parameters to idempotently deploy an app + +## Table of contents + +### Properties + +- [createParams](types_app_deployer.AppDeployParams.md#createparams) +- [deleteParams](types_app_deployer.AppDeployParams.md#deleteparams) +- [deployTimeParams](types_app_deployer.AppDeployParams.md#deploytimeparams) +- [executeParams](types_app_deployer.AppDeployParams.md#executeparams) +- [existingDeployments](types_app_deployer.AppDeployParams.md#existingdeployments) +- [ignoreCache](types_app_deployer.AppDeployParams.md#ignorecache) +- [metadata](types_app_deployer.AppDeployParams.md#metadata) +- [onSchemaBreak](types_app_deployer.AppDeployParams.md#onschemabreak) +- [onUpdate](types_app_deployer.AppDeployParams.md#onupdate) +- [updateParams](types_app_deployer.AppDeployParams.md#updateparams) + +## Properties + +### createParams + +• **createParams**: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](types_app_manager.BoxReference.md))[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| [`AppCreateMethodCall`](../modules/types_composer.md#appcreatemethodcall) + +Create transaction parameters to use if a create needs to be issued as part of deployment + +#### Defined in + +[src/types/app-deployer.ts:50](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L50) + +___ + +### deleteParams + +• **deleteParams**: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `method`: `ABIMethod` ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } + +Delete transaction parameters to use if a delete needs to be issued as part of deployment + +#### Defined in + +[src/types/app-deployer.ts:56](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L56) + +___ + +### deployTimeParams + +• `Optional` **deployTimeParams**: [`TealTemplateParams`](types_app.TealTemplateParams.md) + +Any deploy-time parameters to replace in the TEAL code before compiling it (used if teal code is passed in as a string) + +#### Defined in + +[src/types/app-deployer.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L33) + +___ + +### executeParams + +• `Optional` **executeParams**: [`ExecuteParams`](types_composer.ExecuteParams.md) + +Parameters to use for transaction execution + +#### Defined in + +[src/types/app-deployer.ts:58](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L58) + +___ + +### existingDeployments + +• `Optional` **existingDeployments**: [`AppLookup`](types_app_deployer.AppLookup.md) + +Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup + +#### Defined in + +[src/types/app-deployer.ts:60](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L60) + +___ + +### ignoreCache + +• `Optional` **ignoreCache**: `boolean` + +Whether or not to ignore the app metadata cache and force a lookup, default: use the cache * + +#### Defined in + +[src/types/app-deployer.ts:62](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L62) + +___ + +### metadata + +• **metadata**: [`AppDeployMetadata`](types_app.AppDeployMetadata.md) + +The deployment metadata + +#### Defined in + +[src/types/app-deployer.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L31) + +___ + +### onSchemaBreak + +• `Optional` **onSchemaBreak**: [`OnSchemaBreak`](../enums/types_app.OnSchemaBreak.md) \| ``"replace"`` \| ``"fail"`` \| ``"append"`` + +What action to perform if a schema break (storage schema or extra pages change) is detected: + +* `replace` - Delete the old app and create a new one +* `fail` - Fail the deployment (throw an error) +* `append` - Deploy a new app and leave the old one as is + +#### Defined in + +[src/types/app-deployer.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L40) + +___ + +### onUpdate + +• `Optional` **onUpdate**: ``"replace"`` \| ``"fail"`` \| ``"append"`` \| [`OnUpdate`](../enums/types_app.OnUpdate.md) \| ``"update"`` + +What action to perform if a TEAL code update is detected: + +* `update` - Update the app with the new TEAL code +* `replace` - Delete the old app and create a new one +* `fail` - Fail the deployment (throw an error) +* `append` - Deploy a new app and leave the old one as is + +#### Defined in + +[src/types/app-deployer.ts:48](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L48) + +___ + +### updateParams + +• **updateParams**: \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } \| \{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `args?`: (`TransactionWithSigner` \| `Transaction` \| `ABIValue` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `extraProgramPages?`: `number` ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `NoOpOC` \| `OptInOC` \| `CloseOutOC` \| `UpdateApplicationOC` \| `DeleteApplicationOC` ; `rekeyTo?`: `string` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<\{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram`: `string` \| `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: BoxIdentifier \| BoxReference[] ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` }\> \| [`AppMethodCall`](../modules/types_composer.md#appmethodcall)\<[`AppCallParams`](../modules/types_composer.md#appcallparams)\>)[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) \| [`BoxReference`](types_app_manager.BoxReference.md))[] ; `extraFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `firstValidRound?`: `bigint` ; `lastValidRound?`: `bigint` ; `lease?`: `string` \| `Uint8Array` ; `maxFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `method`: `ABIMethod` ; `note?`: `string` \| `Uint8Array` ; `onComplete?`: `UpdateApplicationOC` ; `rekeyTo?`: `string` ; `sender`: `string` ; `signer?`: `TransactionSigner` \| [`TransactionSignerAccount`](types_account.TransactionSignerAccount.md) ; `staticFee?`: [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) ; `validityWindow?`: `number` } + +Update transaction parameters to use if an update needs to be issued as part of deployment + +#### Defined in + +[src/types/app-deployer.ts:52](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L52) diff --git a/docs/code/interfaces/types_app_deployer.AppLookup.md b/docs/code/interfaces/types_app_deployer.AppLookup.md new file mode 100644 index 00000000..1a31776e --- /dev/null +++ b/docs/code/interfaces/types_app_deployer.AppLookup.md @@ -0,0 +1,42 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-deployer](../modules/types_app_deployer.md) / AppLookup + +# Interface: AppLookup + +[types/app-deployer](../modules/types_app_deployer.md).AppLookup + +A lookup of name -> Algorand app for a creator + +## Table of contents + +### Properties + +- [apps](types_app_deployer.AppLookup.md#apps) +- [creator](types_app_deployer.AppLookup.md#creator) + +## Properties + +### apps + +• **apps**: `Object` + +A hash map of app name to app metadata + +#### Index signature + +▪ [name: `string`]: [`AppMetadata`](types_app_deployer.AppMetadata.md) + +#### Defined in + +[src/types/app-deployer.ts:86](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L86) + +___ + +### creator + +• **creator**: `string` + +The address of the creator associated with this lookup + +#### Defined in + +[src/types/app-deployer.ts:84](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L84) diff --git a/docs/code/interfaces/types_app_deployer.AppMetadata.md b/docs/code/interfaces/types_app_deployer.AppMetadata.md new file mode 100644 index 00000000..2f9039e4 --- /dev/null +++ b/docs/code/interfaces/types_app_deployer.AppMetadata.md @@ -0,0 +1,164 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-deployer](../modules/types_app_deployer.md) / AppMetadata + +# Interface: AppMetadata + +[types/app-deployer](../modules/types_app_deployer.md).AppMetadata + +The metadata that can be collected about a deployed app + +## Hierarchy + +- [`AppDeployMetadata`](types_app.AppDeployMetadata.md) + + ↳ **`AppMetadata`** + +## Table of contents + +### Properties + +- [appAddress](types_app_deployer.AppMetadata.md#appaddress) +- [appId](types_app_deployer.AppMetadata.md#appid) +- [createdMetadata](types_app_deployer.AppMetadata.md#createdmetadata) +- [createdRound](types_app_deployer.AppMetadata.md#createdround) +- [deletable](types_app_deployer.AppMetadata.md#deletable) +- [deleted](types_app_deployer.AppMetadata.md#deleted) +- [name](types_app_deployer.AppMetadata.md#name) +- [updatable](types_app_deployer.AppMetadata.md#updatable) +- [updatedRound](types_app_deployer.AppMetadata.md#updatedround) +- [version](types_app_deployer.AppMetadata.md#version) + +## Properties + +### appAddress + +• **appAddress**: `string` + +The Algorand address of the account associated with the app + +#### Defined in + +[src/types/app-deployer.ts:70](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L70) + +___ + +### appId + +• **appId**: `bigint` + +The id of the app + +#### Defined in + +[src/types/app-deployer.ts:68](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L68) + +___ + +### createdMetadata + +• **createdMetadata**: [`AppDeployMetadata`](types_app.AppDeployMetadata.md) + +The metadata when the app was created + +#### Defined in + +[src/types/app-deployer.ts:76](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L76) + +___ + +### createdRound + +• **createdRound**: `bigint` + +The round the app was created + +#### Defined in + +[src/types/app-deployer.ts:72](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L72) + +___ + +### deletable + +• `Optional` **deletable**: `boolean` + +Whether or not the app is deletable / permanent / unspecified + +#### Inherited from + +[AppDeployMetadata](types_app.AppDeployMetadata.md).[deletable](types_app.AppDeployMetadata.md#deletable) + +#### Defined in + +[src/types/app.ts:253](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L253) + +___ + +### deleted + +• **deleted**: `boolean` + +Whether or not the app is deleted + +#### Defined in + +[src/types/app-deployer.ts:78](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L78) + +___ + +### name + +• **name**: `string` + +The unique name identifier of the app within the creator account + +#### Inherited from + +[AppDeployMetadata](types_app.AppDeployMetadata.md).[name](types_app.AppDeployMetadata.md#name) + +#### Defined in + +[src/types/app.ts:249](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L249) + +___ + +### updatable + +• `Optional` **updatable**: `boolean` + +Whether or not the app is updatable / immutable / unspecified + +#### Inherited from + +[AppDeployMetadata](types_app.AppDeployMetadata.md).[updatable](types_app.AppDeployMetadata.md#updatable) + +#### Defined in + +[src/types/app.ts:255](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L255) + +___ + +### updatedRound + +• **updatedRound**: `bigint` + +The last round that the app was updated + +#### Defined in + +[src/types/app-deployer.ts:74](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L74) + +___ + +### version + +• **version**: `string` + +The version of app that is / will be deployed + +#### Inherited from + +[AppDeployMetadata](types_app.AppDeployMetadata.md).[version](types_app.AppDeployMetadata.md#version) + +#### Defined in + +[src/types/app.ts:251](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L251) diff --git a/docs/code/interfaces/types_app_manager.AppInformation.md b/docs/code/interfaces/types_app_manager.AppInformation.md new file mode 100644 index 00000000..f55849d1 --- /dev/null +++ b/docs/code/interfaces/types_app_manager.AppInformation.md @@ -0,0 +1,156 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-manager](../modules/types_app_manager.md) / AppInformation + +# Interface: AppInformation + +[types/app-manager](../modules/types_app_manager.md).AppInformation + +Information about an app. + +## Table of contents + +### Properties + +- [appAddress](types_app_manager.AppInformation.md#appaddress) +- [appId](types_app_manager.AppInformation.md#appid) +- [approvalProgram](types_app_manager.AppInformation.md#approvalprogram) +- [clearStateProgram](types_app_manager.AppInformation.md#clearstateprogram) +- [creator](types_app_manager.AppInformation.md#creator) +- [extraProgramPages](types_app_manager.AppInformation.md#extraprogrampages) +- [globalByteSlices](types_app_manager.AppInformation.md#globalbyteslices) +- [globalInts](types_app_manager.AppInformation.md#globalints) +- [globalState](types_app_manager.AppInformation.md#globalstate) +- [localByteSlices](types_app_manager.AppInformation.md#localbyteslices) +- [localInts](types_app_manager.AppInformation.md#localints) + +## Properties + +### appAddress + +• **appAddress**: `string` + +The escrow address that the app operates with. + +#### Defined in + +[src/types/app-manager.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L20) + +___ + +### appId + +• **appId**: `bigint` + +The ID of the app. + +#### Defined in + +[src/types/app-manager.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L18) + +___ + +### approvalProgram + +• **approvalProgram**: `Uint8Array` + +Approval program. + +#### Defined in + +[src/types/app-manager.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L24) + +___ + +### clearStateProgram + +• **clearStateProgram**: `Uint8Array` + +Clear state program. + +#### Defined in + +[src/types/app-manager.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L28) + +___ + +### creator + +• **creator**: `string` + +The address that created this application. This is the address where the +parameters and global state for this application can be found. + +#### Defined in + +[src/types/app-manager.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L33) + +___ + +### extraProgramPages + +• `Optional` **extraProgramPages**: `number` + +Any extra pages that are needed for the smart contract. + +#### Defined in + +[src/types/app-manager.ts:47](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L47) + +___ + +### globalByteSlices + +• **globalByteSlices**: `number` + +The number of allocated byte slices in global state. + +#### Defined in + +[src/types/app-manager.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L45) + +___ + +### globalInts + +• **globalInts**: `number` + +The number of allocated ints in global state. + +#### Defined in + +[src/types/app-manager.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L43) + +___ + +### globalState + +• **globalState**: [`AppState`](types_app.AppState.md) + +Current global state values. + +#### Defined in + +[src/types/app-manager.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L37) + +___ + +### localByteSlices + +• **localByteSlices**: `number` + +The number of allocated byte slices in per-user local state. + +#### Defined in + +[src/types/app-manager.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L41) + +___ + +### localInts + +• **localInts**: `number` + +The number of allocated ints in per-user local state. + +#### Defined in + +[src/types/app-manager.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L39) diff --git a/docs/code/interfaces/types_app_manager.BoxReference.md b/docs/code/interfaces/types_app_manager.BoxReference.md new file mode 100644 index 00000000..d9e83a41 --- /dev/null +++ b/docs/code/interfaces/types_app_manager.BoxReference.md @@ -0,0 +1,38 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-manager](../modules/types_app_manager.md) / BoxReference + +# Interface: BoxReference + +[types/app-manager](../modules/types_app_manager.md).BoxReference + +A grouping of the app ID and name identifier to reference an app box. + +## Table of contents + +### Properties + +- [appId](types_app_manager.BoxReference.md#appid) +- [name](types_app_manager.BoxReference.md#name) + +## Properties + +### appId + +• **appId**: `bigint` + +A unique application id + +#### Defined in + +[src/types/app-manager.ts:66](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L66) + +___ + +### name + +• **name**: [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) + +Identifier for a box name + +#### Defined in + +[src/types/app-manager.ts:70](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L70) diff --git a/docs/code/interfaces/types_app_manager.BoxValueRequestParams.md b/docs/code/interfaces/types_app_manager.BoxValueRequestParams.md new file mode 100644 index 00000000..c9ef2c00 --- /dev/null +++ b/docs/code/interfaces/types_app_manager.BoxValueRequestParams.md @@ -0,0 +1,51 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-manager](../modules/types_app_manager.md) / BoxValueRequestParams + +# Interface: BoxValueRequestParams + +[types/app-manager](../modules/types_app_manager.md).BoxValueRequestParams + +Parameters to get and decode a box value as an ABI type. + +## Table of contents + +### Properties + +- [appId](types_app_manager.BoxValueRequestParams.md#appid) +- [boxName](types_app_manager.BoxValueRequestParams.md#boxname) +- [type](types_app_manager.BoxValueRequestParams.md#type) + +## Properties + +### appId + +• **appId**: `bigint` + +The ID of the app return box names for + +#### Defined in + +[src/types/app-manager.ts:78](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L78) + +___ + +### boxName + +• **boxName**: [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier) + +The name of the box to return either as a string, binary array or `BoxName` + +#### Defined in + +[src/types/app-manager.ts:80](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L80) + +___ + +### type + +• **type**: `ABIType` + +The ABI type to decode the value using + +#### Defined in + +[src/types/app-manager.ts:82](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L82) diff --git a/docs/code/interfaces/types_app_manager.BoxValuesRequestParams.md b/docs/code/interfaces/types_app_manager.BoxValuesRequestParams.md new file mode 100644 index 00000000..7e20dc0d --- /dev/null +++ b/docs/code/interfaces/types_app_manager.BoxValuesRequestParams.md @@ -0,0 +1,51 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/app-manager](../modules/types_app_manager.md) / BoxValuesRequestParams + +# Interface: BoxValuesRequestParams + +[types/app-manager](../modules/types_app_manager.md).BoxValuesRequestParams + +Parameters to get and decode a box value as an ABI type. + +## Table of contents + +### Properties + +- [appId](types_app_manager.BoxValuesRequestParams.md#appid) +- [boxNames](types_app_manager.BoxValuesRequestParams.md#boxnames) +- [type](types_app_manager.BoxValuesRequestParams.md#type) + +## Properties + +### appId + +• **appId**: `bigint` + +The ID of the app return box names for + +#### Defined in + +[src/types/app-manager.ts:90](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L90) + +___ + +### boxNames + +• **boxNames**: [`BoxIdentifier`](../modules/types_app_manager.md#boxidentifier)[] + +The names of the boxes to return either as a string, binary array or BoxName` + +#### Defined in + +[src/types/app-manager.ts:92](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L92) + +___ + +### type + +• **type**: `ABIType` + +The ABI type to decode the value using + +#### Defined in + +[src/types/app-manager.ts:94](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L94) diff --git a/docs/code/interfaces/types_asset.AssetOptInParams.md b/docs/code/interfaces/types_asset.AssetOptInParams.md index 1c72d40b..073cc39a 100644 --- a/docs/code/interfaces/types_asset.AssetOptInParams.md +++ b/docs/code/interfaces/types_asset.AssetOptInParams.md @@ -72,7 +72,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -88,7 +88,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -116,7 +116,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -132,7 +132,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -160,7 +160,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -177,7 +177,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -193,7 +193,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -209,7 +209,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_asset.AssetOptOutParams.md b/docs/code/interfaces/types_asset.AssetOptOutParams.md index 550a3e01..93485e00 100644 --- a/docs/code/interfaces/types_asset.AssetOptOutParams.md +++ b/docs/code/interfaces/types_asset.AssetOptOutParams.md @@ -92,7 +92,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -120,7 +120,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -152,7 +152,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -168,7 +168,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -200,7 +200,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -217,7 +217,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -233,7 +233,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -249,7 +249,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_asset.CreateAssetParams.md b/docs/code/interfaces/types_asset.CreateAssetParams.md index 75436a7f..48061950 100644 --- a/docs/code/interfaces/types_asset.CreateAssetParams.md +++ b/docs/code/interfaces/types_asset.CreateAssetParams.md @@ -56,7 +56,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -116,7 +116,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -182,7 +182,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -198,7 +198,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -251,7 +251,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -283,7 +283,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -299,7 +299,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -315,7 +315,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_client_manager.TypedAppClient.md b/docs/code/interfaces/types_client_manager.TypedAppClient.md index 5eedb0cf..ee54c56e 100644 --- a/docs/code/interfaces/types_client_manager.TypedAppClient.md +++ b/docs/code/interfaces/types_client_manager.TypedAppClient.md @@ -37,4 +37,4 @@ Interface to identify a typed client that can be used to interact with an applic #### Defined in -[src/types/client-manager.ts:502](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L502) +[src/types/client-manager.ts:507](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L507) diff --git a/docs/code/interfaces/types_composer.BuiltTransactions.md b/docs/code/interfaces/types_composer.BuiltTransactions.md new file mode 100644 index 00000000..f337f389 --- /dev/null +++ b/docs/code/interfaces/types_composer.BuiltTransactions.md @@ -0,0 +1,51 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/composer](../modules/types_composer.md) / BuiltTransactions + +# Interface: BuiltTransactions + +[types/composer](../modules/types_composer.md).BuiltTransactions + +Set of transactions built by `AlgoKitComposer`. + +## Table of contents + +### Properties + +- [methodCalls](types_composer.BuiltTransactions.md#methodcalls) +- [signers](types_composer.BuiltTransactions.md#signers) +- [transactions](types_composer.BuiltTransactions.md#transactions) + +## Properties + +### methodCalls + +• **methodCalls**: `Map`\<`number`, `ABIMethod`\> + +Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. + +#### Defined in + +[src/types/composer.ts:455](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L455) + +___ + +### signers + +• **signers**: `Map`\<`number`, `TransactionSigner`\> + +Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. + +#### Defined in + +[src/types/composer.ts:457](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L457) + +___ + +### transactions + +• **transactions**: `Transaction`[] + +The built transactions + +#### Defined in + +[src/types/composer.ts:453](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L453) diff --git a/docs/code/interfaces/types_composer.ExecuteParams.md b/docs/code/interfaces/types_composer.ExecuteParams.md index e5e65478..fcf90804 100644 --- a/docs/code/interfaces/types_composer.ExecuteParams.md +++ b/docs/code/interfaces/types_composer.ExecuteParams.md @@ -11,6 +11,7 @@ Parameters to configure transaction execution. ### Properties - [maxRoundsToWaitForConfirmation](types_composer.ExecuteParams.md#maxroundstowaitforconfirmation) +- [populateAppCallResources](types_composer.ExecuteParams.md#populateappcallresources) - [suppressLog](types_composer.ExecuteParams.md#suppresslog) ## Properties @@ -23,7 +24,19 @@ The number of rounds to wait for confirmation. By default until the latest lastV #### Defined in -[src/types/composer.ts:382](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L382) +[src/types/composer.ts:424](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L424) + +___ + +### populateAppCallResources + +• `Optional` **populateAppCallResources**: `boolean` + +Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. + +#### Defined in + +[src/types/composer.ts:428](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L428) ___ @@ -35,4 +48,4 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/composer.ts:384](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L384) +[src/types/composer.ts:426](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L426) diff --git a/docs/code/interfaces/types_transaction.AtomicTransactionComposerToSend.md b/docs/code/interfaces/types_transaction.AtomicTransactionComposerToSend.md index b791dec7..9f0c79f5 100644 --- a/docs/code/interfaces/types_transaction.AtomicTransactionComposerToSend.md +++ b/docs/code/interfaces/types_transaction.AtomicTransactionComposerToSend.md @@ -23,7 +23,7 @@ The `AtomicTransactionComposer` with transactions loaded to send #### Defined in -[src/types/transaction.ts:132](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L132) +[src/types/transaction.ts:136](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L136) ___ @@ -35,4 +35,4 @@ Any parameters to control the semantics of the send to the network #### Defined in -[src/types/transaction.ts:134](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L134) +[src/types/transaction.ts:138](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L138) diff --git a/docs/code/interfaces/types_transaction.ConfirmedTransactionResult.md b/docs/code/interfaces/types_transaction.ConfirmedTransactionResult.md index 4b5ad2b2..259c670a 100644 --- a/docs/code/interfaces/types_transaction.ConfirmedTransactionResult.md +++ b/docs/code/interfaces/types_transaction.ConfirmedTransactionResult.md @@ -33,7 +33,7 @@ The response from sending and waiting for the transaction #### Defined in -[src/types/transaction.ts:83](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L83) +[src/types/transaction.ts:87](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L87) ___ @@ -49,4 +49,4 @@ The transaction #### Defined in -[src/types/transaction.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L51) +[src/types/transaction.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L55) diff --git a/docs/code/interfaces/types_transaction.ConfirmedTransactionResults.md b/docs/code/interfaces/types_transaction.ConfirmedTransactionResults.md index be464e70..cc46e3ce 100644 --- a/docs/code/interfaces/types_transaction.ConfirmedTransactionResults.md +++ b/docs/code/interfaces/types_transaction.ConfirmedTransactionResults.md @@ -37,7 +37,7 @@ The response from sending and waiting for the primary transaction #### Defined in -[src/types/transaction.ts:89](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L89) +[src/types/transaction.ts:93](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L93) ___ @@ -53,7 +53,7 @@ The response from sending and waiting for the transactions #### Defined in -[src/types/transaction.ts:91](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L91) +[src/types/transaction.ts:95](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L95) ___ @@ -69,7 +69,7 @@ The transaction #### Defined in -[src/types/transaction.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L51) +[src/types/transaction.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L55) ___ @@ -85,4 +85,4 @@ The transactions that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L59) +[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) diff --git a/docs/code/interfaces/types_transaction.SendAtomicTransactionComposerResults.md b/docs/code/interfaces/types_transaction.SendAtomicTransactionComposerResults.md index 584c6af4..a6a0afe9 100644 --- a/docs/code/interfaces/types_transaction.SendAtomicTransactionComposerResults.md +++ b/docs/code/interfaces/types_transaction.SendAtomicTransactionComposerResults.md @@ -37,7 +37,7 @@ the index of the confirmation will match the index of the underlying transaction #### Defined in -[src/types/transaction.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L77) +[src/types/transaction.ts:81](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L81) ___ @@ -49,7 +49,7 @@ base64 encoded representation of the group ID of the atomic group #### Defined in -[src/types/transaction.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L69) +[src/types/transaction.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L73) ___ @@ -61,7 +61,7 @@ If ABI method(s) were called the processed return values #### Defined in -[src/types/transaction.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L73) +[src/types/transaction.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L77) ___ @@ -77,7 +77,7 @@ The transactions that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L59) +[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) ___ @@ -89,4 +89,4 @@ The transaction IDs that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L71) +[src/types/transaction.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L75) diff --git a/docs/code/interfaces/types_transaction.SendTransactionParams.md b/docs/code/interfaces/types_transaction.SendTransactionParams.md index 7d321cd5..e4056b94 100644 --- a/docs/code/interfaces/types_transaction.SendTransactionParams.md +++ b/docs/code/interfaces/types_transaction.SendTransactionParams.md @@ -47,7 +47,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -59,7 +59,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -71,7 +71,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -83,7 +83,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -95,7 +95,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -108,7 +108,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -120,7 +120,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -132,4 +132,4 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) diff --git a/docs/code/interfaces/types_transaction.SendTransactionResult.md b/docs/code/interfaces/types_transaction.SendTransactionResult.md index f6772f6f..58470c14 100644 --- a/docs/code/interfaces/types_transaction.SendTransactionResult.md +++ b/docs/code/interfaces/types_transaction.SendTransactionResult.md @@ -33,7 +33,7 @@ The response if the transaction was sent and waited for #### Defined in -[src/types/transaction.ts:53](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L53) +[src/types/transaction.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L57) ___ @@ -45,4 +45,4 @@ The transaction #### Defined in -[src/types/transaction.ts:51](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L51) +[src/types/transaction.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L55) diff --git a/docs/code/interfaces/types_transaction.SendTransactionResults.md b/docs/code/interfaces/types_transaction.SendTransactionResults.md index ffa5c9e9..12e5e9b4 100644 --- a/docs/code/interfaces/types_transaction.SendTransactionResults.md +++ b/docs/code/interfaces/types_transaction.SendTransactionResults.md @@ -34,7 +34,7 @@ the index of the confirmation will match the index of the underlying transaction #### Defined in -[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) +[src/types/transaction.ts:67](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L67) ___ @@ -46,4 +46,4 @@ The transactions that have been prepared and/or sent #### Defined in -[src/types/transaction.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L59) +[src/types/transaction.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L63) diff --git a/docs/code/interfaces/types_transaction.TransactionGroupToSend.md b/docs/code/interfaces/types_transaction.TransactionGroupToSend.md index 3841e720..7e281f35 100644 --- a/docs/code/interfaces/types_transaction.TransactionGroupToSend.md +++ b/docs/code/interfaces/types_transaction.TransactionGroupToSend.md @@ -25,7 +25,7 @@ Any parameters to control the semantics of the send to the network #### Defined in -[src/types/transaction.ts:119](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L119) +[src/types/transaction.ts:123](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L123) ___ @@ -37,7 +37,7 @@ Optional signer to pass in, required if at least one transaction provided is jus #### Defined in -[src/types/transaction.ts:126](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L126) +[src/types/transaction.ts:130](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L130) ___ @@ -51,4 +51,4 @@ The list of transactions to send, which can either be a raw transaction (in whic #### Defined in -[src/types/transaction.ts:124](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L124) +[src/types/transaction.ts:128](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L128) diff --git a/docs/code/interfaces/types_transaction.TransactionToSign.md b/docs/code/interfaces/types_transaction.TransactionToSign.md index c28fa19f..70ad95ed 100644 --- a/docs/code/interfaces/types_transaction.TransactionToSign.md +++ b/docs/code/interfaces/types_transaction.TransactionToSign.md @@ -23,7 +23,7 @@ The account to use to sign the transaction, either an account (with private key #### Defined in -[src/types/transaction.ts:111](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L111) +[src/types/transaction.ts:115](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L115) ___ @@ -35,4 +35,4 @@ The unsigned transaction to sign and send #### Defined in -[src/types/transaction.ts:109](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L109) +[src/types/transaction.ts:113](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L113) diff --git a/docs/code/interfaces/types_transfer.AlgoRekeyParams.md b/docs/code/interfaces/types_transfer.AlgoRekeyParams.md index 473f5dce..ffcc3f7e 100644 --- a/docs/code/interfaces/types_transfer.AlgoRekeyParams.md +++ b/docs/code/interfaces/types_transfer.AlgoRekeyParams.md @@ -46,7 +46,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -62,7 +62,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -102,7 +102,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -118,7 +118,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -146,7 +146,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -175,7 +175,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -191,7 +191,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -207,7 +207,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_transfer.AlgoTransferParams.md b/docs/code/interfaces/types_transfer.AlgoTransferParams.md index 482a80ed..bd46dc04 100644 --- a/docs/code/interfaces/types_transfer.AlgoTransferParams.md +++ b/docs/code/interfaces/types_transfer.AlgoTransferParams.md @@ -59,7 +59,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -75,7 +75,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -115,7 +115,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -131,7 +131,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -159,7 +159,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -176,7 +176,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -192,7 +192,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -208,7 +208,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_transfer.EnsureFundedParams.md b/docs/code/interfaces/types_transfer.EnsureFundedParams.md index 77204c36..16c43768 100644 --- a/docs/code/interfaces/types_transfer.EnsureFundedParams.md +++ b/docs/code/interfaces/types_transfer.EnsureFundedParams.md @@ -60,7 +60,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -76,7 +76,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -116,7 +116,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -132,7 +132,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -201,7 +201,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -217,7 +217,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -233,7 +233,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/interfaces/types_transfer.TransferAssetParams.md b/docs/code/interfaces/types_transfer.TransferAssetParams.md index b202fda4..21629744 100644 --- a/docs/code/interfaces/types_transfer.TransferAssetParams.md +++ b/docs/code/interfaces/types_transfer.TransferAssetParams.md @@ -73,7 +73,7 @@ An optional `AtomicTransactionComposer` to add the transaction to, if specified #### Defined in -[src/types/transaction.ts:35](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L35) +[src/types/transaction.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L36) ___ @@ -101,7 +101,7 @@ The flat fee you want to pay, useful for covering extra fees in a transaction gr #### Defined in -[src/types/transaction.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L39) +[src/types/transaction.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L40) ___ @@ -141,7 +141,7 @@ The maximum fee that you are happy to pay (default: unbounded) - if this is set #### Defined in -[src/types/transaction.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L41) +[src/types/transaction.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L42) ___ @@ -157,7 +157,7 @@ The maximum number of rounds to wait for confirmation, only applies if `skipWait #### Defined in -[src/types/transaction.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L43) +[src/types/transaction.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L44) ___ @@ -185,7 +185,7 @@ ___ #### Defined in -[src/types/transaction.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L45) +[src/types/transaction.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L46) ___ @@ -202,7 +202,7 @@ and instead just return the raw transaction, e.g. so you can add it to a group o #### Defined in -[src/types/transaction.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L31) +[src/types/transaction.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L32) ___ @@ -218,7 +218,7 @@ Whether to skip waiting for the submitted transaction (only relevant if `skipSen #### Defined in -[src/types/transaction.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L33) +[src/types/transaction.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L34) ___ @@ -234,7 +234,7 @@ Whether to suppress log messages from transaction send, default: do not suppress #### Defined in -[src/types/transaction.ts:37](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L37) +[src/types/transaction.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L38) ___ diff --git a/docs/code/modules/index.md b/docs/code/modules/index.md index 9e6b6aae..08032575 100644 --- a/docs/code/modules/index.md +++ b/docs/code/modules/index.md @@ -286,7 +286,7 @@ A record object where the keys are the asset IDs and the values are the correspo **`Deprecated`** -use `algorandClient.asset.bulkOptIn()` instead +use `algorand.asset.bulkOptIn()` instead Opt in to a list of assets on the Algorand blockchain. @@ -325,7 +325,7 @@ A record object containing asset IDs as keys and their corresponding transaction **`Deprecated`** -use `algorandClient.asset.bulkOptOut()` instead +use `algorand.asset.bulkOptOut()` instead Opt out of multiple assets in Algorand blockchain. @@ -364,7 +364,7 @@ The transaction object and optionally the confirmation if it was sent to the cha **`Deprecated`** -use `algorandClient.send.assetOptIn()` / `algorandClient.transaction.assetOptIn()` instead +use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead Opt-in an account to an asset. @@ -399,7 +399,7 @@ The transaction object and optionally the confirmation if it was sent to the cha **`Deprecated`** -use `algorandClient.send.assetOptOut()` / `algorandClient.transaction.assetOptOut()` instead +use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead Opt-out an account from an asset. @@ -419,8 +419,6 @@ ___ ▸ **callApp**(`call`, `algod`): `Promise`\<[`AppCallTransactionResult`](../interfaces/types_app.AppCallTransactionResult.md)\> -Issues a call to a given app. - #### Parameters | Name | Type | Description | @@ -434,9 +432,16 @@ Issues a call to a given app. The result of the call +**`Deprecated`** + +Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` +/ `algorand.transactions.appUpdateMethodCall()` instead + +Issues a call to a given app. + #### Defined in -[src/app.ts:305](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L305) +[src/app.ts:185](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L185) ___ @@ -469,8 +474,6 @@ ___ ▸ **compileTeal**(`tealCode`, `algod`): `Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> -Compiles the given TEAL using algod and returns the result, including source map. - #### Parameters | Name | Type | Description | @@ -484,9 +487,15 @@ Compiles the given TEAL using algod and returns the result, including source map The information about the compiled file +**`Deprecated`** + +Use `algorand.app.compileTeal` instead. + +Compiles the given TEAL using algod and returns the result, including source map. + #### Defined in -[src/app.ts:671](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L671) +[src/app.ts:413](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L413) ___ @@ -525,8 +534,6 @@ ___ ▸ **createApp**(`create`, `algod`): `Promise`\<`Partial`\<[`AppCompilationResult`](../interfaces/types_app.AppCompilationResult.md)\> & [`AppCallTransactionResult`](../interfaces/types_app.AppCallTransactionResult.md) & [`AppReference`](../interfaces/types_app.AppReference.md)\> -Creates a smart contract app, returns the details of the created app. - #### Parameters | Name | Type | Description | @@ -540,9 +547,16 @@ Creates a smart contract app, returns the details of the created app. The details of the created app, or the transaction to create it if `skipSending` and the compilation result +**`Deprecated`** + +Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()` +/ `algorand.transactions.appCreateMethodCall()` instead + +Creates a smart contract app, returns the details of the created app. + #### Defined in -[src/app.ts:56](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L56) +[src/app.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L46) ___ @@ -565,7 +579,7 @@ The transaction object and optionally the confirmation if it was sent to the cha **`Deprecated`** -use `algorandClient.send.assetCreate()` / `algorandClient.transaction.assetCreate()` instead +use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead Create an Algorand Standard Asset (ASA). @@ -585,9 +599,6 @@ ___ ▸ **decodeAppState**(`state`): [`AppState`](../interfaces/types_app.AppState.md) -Converts an array of global/local state values from the algod api to a more friendly -generic object keyed by the UTF-8 value of the key. - #### Parameters | Name | Type | Description | @@ -600,9 +611,16 @@ generic object keyed by the UTF-8 value of the key. An object keyeed by the UTF-8 representation of the key with various parsings of the values +**`Deprecated`** + +Use `AppManager.decodeAppState` instead. + +Converts an array of global/local state values from the algod api to a more friendly +generic object keyed by the UTF-8 value of the key. + #### Defined in -[src/app.ts:522](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L522) +[src/app.ts:339](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L339) ___ @@ -610,16 +628,6 @@ ___ ▸ **deployApp**(`deployment`, `algod`, `indexer?`): `Promise`\<`Partial`\<[`AppCompilationResult`](../interfaces/types_app.AppCompilationResult.md)\> & [`ConfirmedTransactionResults`](../interfaces/types_transaction.ConfirmedTransactionResults.md) & [`AppMetadata`](../interfaces/types_app.AppMetadata.md) & \{ `operationPerformed`: ``"create"`` \| ``"update"`` ; `return?`: [`ABIReturn`](types_app.md#abireturn) } \| [`ConfirmedTransactionResults`](../interfaces/types_transaction.ConfirmedTransactionResults.md) & [`AppMetadata`](../interfaces/types_app.AppMetadata.md) & \{ `deleteResult`: [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) ; `deleteReturn?`: [`ABIReturn`](types_app.md#abireturn) ; `operationPerformed`: ``"replace"`` ; `return?`: [`ABIReturn`](types_app.md#abireturn) } \| [`AppMetadata`](../interfaces/types_app.AppMetadata.md) & \{ `operationPerformed`: ``"nothing"`` }\> -Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions. - -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 | Name | Type | Description | @@ -634,9 +642,23 @@ To understand the architecture decisions behind this functionality please see ht The app reference of the new/existing app +**`Deprecated`** + +Use `algorand.appDeployer.deploy` instead. + +Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions. + +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. + #### Defined in -[src/app-deploy.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L44) +[src/app-deploy.ts:50](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L50) ___ @@ -755,8 +777,6 @@ ___ ▸ **getABIMethodSignature**(`method`): `string` -Returns the encoded ABI spec for a given ABI Method - #### Parameters | Name | Type | Description | @@ -769,9 +789,15 @@ Returns the encoded ABI spec for a given ABI Method The encoded ABI method spec e.g. `method_name(uint64,string)string` +**`Deprecated`** + +Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead. + +Returns the encoded ABI spec for a given ABI Method + #### Defined in -[src/app.ts:687](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L687) +[src/app.ts:424](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L424) ___ @@ -779,8 +805,6 @@ ___ ▸ **getABIReturn**(`args?`, `confirmation?`): [`ABIReturn`](types_app.md#abireturn) \| `undefined` -Returns any ABI return values for the given app call arguments and transaction confirmation. - #### Parameters | Name | Type | Description | @@ -794,9 +818,15 @@ Returns any ABI return values for the given app call arguments and transaction c The return value for the method call +**`Deprecated`** + +Use `AppManager.getABIReturn` instead. + +Returns any ABI return values for the given app call arguments and transaction confirmation. + #### Defined in -[src/app.ts:386](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L386) +[src/app.ts:229](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L229) ___ @@ -820,7 +850,7 @@ The requested account with private key loaded from the environment variables or **`Deprecated`** -use `algorandClient.account.fromEnvironment()` instead +use `algorand.account.fromEnvironment()` instead Returns an Algorand account with private key loaded by convention based on the given name identifier. @@ -867,7 +897,7 @@ The requested account with private key loaded from the environment variables or **`Deprecated`** -use `algorandClient.account.fromEnvironment()` instead +use `algorand.account.fromEnvironment()` instead Returns an Algorand account with private key loaded by convention based on the given name identifier. Note: This function expects to run in a Node.js environment. @@ -959,7 +989,7 @@ The account asset holding information **`Deprecated`** -Use `algorandClient.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead. +Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead. Returns the given sender account's asset holding for a given asset. @@ -1031,7 +1061,7 @@ The account information **`Deprecated`** -Use `algorandClient.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead. +Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead. Returns the given sender account's current status, balance and spendable amounts. @@ -1260,8 +1290,6 @@ ___ ▸ **getAppArgsForABICall**(`args`, `from`): `Promise`\<\{ `appAccounts`: `undefined` \| `string`[] ; `appForeignApps`: `undefined` \| `number`[] = args.apps; `appForeignAssets`: `undefined` \| `number`[] = args.assets; `boxes`: `undefined` \| `BoxReference`[] ; `lease`: `undefined` \| `Uint8Array` ; `method`: `ABIMethod` ; `methodArgs`: (`string` \| `number` \| `bigint` \| `boolean` \| `TransactionWithSigner` \| `Uint8Array` \| `ABIValue`[])[] = methodArgs; `rekeyTo`: `undefined` \| `string` ; `sender`: `string` ; `signer`: `TransactionSigner` = signer }\> -Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer` - #### Parameters | Name | Type | Description | @@ -1275,9 +1303,15 @@ Returns the app args ready to load onto an ABI method call in `AtomicTransaction The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer +**`Deprecated`** + +Use `AlgoKitComposer` methods to construct transactions instead. + +Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer` + #### Defined in -[src/app.ts:589](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L589) +[src/app.ts:372](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L372) ___ @@ -1285,8 +1319,6 @@ ___ ▸ **getAppArgsForTransaction**(`args?`): `undefined` \| \{ `accounts`: `undefined` \| `string`[] ; `appArgs`: `undefined` \| `Uint8Array`[] ; `boxes`: `undefined` \| `BoxReference`[] ; `foreignApps`: `undefined` \| `number`[] = args.apps; `foreignAssets`: `undefined` \| `number`[] = args.assets; `lease`: `undefined` \| `Uint8Array` } -Returns the app args ready to load onto an app `Transaction` object - #### Parameters | Name | Type | Description | @@ -1299,9 +1331,15 @@ Returns the app args ready to load onto an app `Transaction` object The args ready to load into a `Transaction` +**`Deprecated`** + +Use `AlgoKitComposer` methods to construct transactions instead. + +Returns the app args ready to load onto an app `Transaction` object + #### Defined in -[src/app.ts:569](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L569) +[src/app.ts:350](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L350) ___ @@ -1309,8 +1347,6 @@ ___ ▸ **getAppBoxNames**(`appId`, `algod`): `Promise`\<[`BoxName`](../interfaces/types_app.BoxName.md)[]\> -Returns the names of the boxes for the given app. - #### Parameters | Name | Type | Description | @@ -1324,9 +1360,14 @@ Returns the names of the boxes for the given app. The current box names +**`Deprecated`** + +Use `algorand.app.getBoxNames` instead. +Returns the names of the boxes for the given app. + #### Defined in -[src/app.ts:458](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L458) +[src/app.ts:270](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L270) ___ @@ -1334,8 +1375,6 @@ ___ ▸ **getAppBoxValue**(`appId`, `boxName`, `algod`): `Promise`\<`Uint8Array`\> -Returns the value of the given box name for the given app. - #### Parameters | Name | Type | Description | @@ -1350,9 +1389,14 @@ Returns the value of the given box name for the given app. The current box value as a byte array +**`Deprecated`** + +Use `algorand.app.getBoxValue` instead. +Returns the value of the given box name for the given app. + #### Defined in -[src/app.ts:476](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L476) +[src/app.ts:282](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L282) ___ @@ -1360,8 +1404,6 @@ ___ ▸ **getAppBoxValueFromABIType**(`request`, `algod`): `Promise`\<`ABIValue`\> -Returns the value of the given box name for the given app decoded based on the given ABI type. - #### Parameters | Name | Type | Description | @@ -1375,9 +1417,14 @@ Returns the value of the given box name for the given app decoded based on the g The current box value as an ABI value +**`Deprecated`** + +Use `algorand.app.getBoxValueFromABIType` instead. +Returns the value of the given box name for the given app decoded based on the given ABI type. + #### Defined in -[src/app.ts:499](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L499) +[src/app.ts:308](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L308) ___ @@ -1385,8 +1432,6 @@ ___ ▸ **getAppBoxValues**(`appId`, `boxNames`, `algod`): `Promise`\<`Uint8Array`[]\> -Returns the value of the given box names for the given app. - #### Parameters | Name | Type | Description | @@ -1401,9 +1446,14 @@ Returns the value of the given box names for the given app. The current box values as a byte array in the same order as the passed in box names +**`Deprecated`** + +Use `algorand.app.getBoxValues` instead. +Returns the value of the given box names for the given app. + #### Defined in -[src/app.ts:489](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L489) +[src/app.ts:294](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L294) ___ @@ -1411,8 +1461,6 @@ ___ ▸ **getAppBoxValuesFromABIType**(`request`, `algod`): `Promise`\<`ABIValue`[]\> -Returns the value of the given box names for the given app decoded based on the given ABI type. - #### Parameters | Name | Type | Description | @@ -1426,9 +1474,14 @@ Returns the value of the given box names for the given app decoded based on the The current box values as an ABI value in the same order as the passed in box names +**`Deprecated`** + +Use `algorand.app.getBoxValuesFromABIType` instead. +Returns the value of the given box names for the given app decoded based on the given ABI type. + #### Defined in -[src/app.ts:511](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L511) +[src/app.ts:323](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L323) ___ @@ -1436,8 +1489,6 @@ ___ ▸ **getAppById**(`appId`, `algod`): `Promise`\<`Application`\> -Gets the current data for the given app from algod. - #### Parameters | Name | Type | Description | @@ -1451,9 +1502,15 @@ Gets the current data for the given app from algod. The data about the app +**`Deprecated`** + +Use `algorand.app.getById` instead. + +Gets the current data for the given app from algod. + #### Defined in -[src/app.ts:660](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L660) +[src/app.ts:400](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L400) ___ @@ -1594,8 +1651,6 @@ ___ ▸ **getAppDeploymentTransactionNote**(`metadata`): [`Arc2TransactionNote`](types_transaction.md#arc2transactionnote) -Return the transaction note for an app deployment. - #### Parameters | Name | Type | Description | @@ -1608,9 +1663,15 @@ Return the transaction note for an app deployment. The transaction note as a utf-8 string +**`Deprecated`** + +Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead. + +Return the transaction note for an app deployment. + #### Defined in -[src/app-deploy.ts:534](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L534) +[src/app-deploy.ts:253](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L253) ___ @@ -1618,8 +1679,6 @@ ___ ▸ **getAppGlobalState**(`appId`, `algod`): `Promise`\<[`AppState`](../interfaces/types_app.AppState.md)\> -Returns the current global state values for the given app ID - #### Parameters | Name | Type | Description | @@ -1633,9 +1692,15 @@ Returns the current global state values for the given app ID The current global state +**`Deprecated`** + +Use `(await appManager.getById(appId)).globalState` instead. + +Returns the current global state values for the given app ID + #### Defined in -[src/app.ts:422](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L422) +[src/app.ts:246](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L246) ___ @@ -1643,8 +1708,6 @@ ___ ▸ **getAppLocalState**(`appId`, `account`, `algod`): `Promise`\<[`AppState`](../interfaces/types_app.AppState.md)\> -Returns the current global state values for the given app ID and account - #### Parameters | Name | Type | Description | @@ -1659,9 +1722,15 @@ Returns the current global state values for the given app ID and account The current local state for the given (app, account) combination +**`Deprecated`** + +Use `algorand.app.getLocalState` instead. + +Returns the current global state values for the given app ID and account + #### Defined in -[src/app.ts:439](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L439) +[src/app.ts:259](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L259) ___ @@ -1669,12 +1738,6 @@ ___ ▸ **getAppOnCompleteAction**(`onCompletionAction?`): `OnApplicationComplete` -Returns an `algosdk.OnApplicationComplete` for the given onCompleteAction. - -If given `undefined` will return `OnApplicationComplete.NoOpOC`. - -If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`. - #### Parameters | Name | Type | Description | @@ -1687,9 +1750,19 @@ If given an `AppCallType` will convert the string enum to the correct underlying The `algosdk.OnApplicationComplete` +**`Deprecated`** + +Use `algosdk.OnApplicationComplete` directly instead. + +Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction. + +If given `undefined` will return `OnApplicationComplete.NoOpOC`. + +If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`. + #### Defined in -[src/app.ts:275](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L275) +[src/app.ts:152](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L152) ___ @@ -1721,8 +1794,6 @@ ___ ▸ **getBoxReference**(`box`): `algosdk.BoxReference` -Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. - #### Parameters | Name | Type | Description | @@ -1735,9 +1806,15 @@ Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. The box reference ready to pass into a `Transaction` +**`Deprecated`** + +Use `AppManager.getBoxReference()` instead. + +Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. + #### Defined in -[src/app.ts:630](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L630) +[src/app.ts:383](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L383) ___ @@ -1765,10 +1842,6 @@ ___ ▸ **getCreatorAppsByName**(`creatorAccount`, `indexer`): `Promise`\<[`AppLookup`](../interfaces/types_app.AppLookup.md)\> -Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction. - -**Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls). - #### Parameters | Name | Type | Description | @@ -1782,9 +1855,17 @@ Returns a lookup of name => app metadata (id, address, ...metadata) for all apps A name-based lookup of the app information (id, address) +**`Deprecated`** + +Use `algorand.appDeployer.getCreatorAppsByName` instead. + +Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction. + +**Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls). + #### Defined in -[src/app-deploy.ts:427](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L427) +[src/app-deploy.ts:232](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L232) ___ @@ -1831,7 +1912,7 @@ ___ **`Deprecated`** -Use `algorandClient.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead +Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead Returns an account (with private key loaded) that can act as a dispenser @@ -1884,7 +1965,7 @@ ___ **`Deprecated`** -use `algorandClient.account.kmd.getWalletAccount(name, predicate)` or `new KMDAccountManager(clientManager).getWalletAccount(name, predicate)` instead. +use `algorand.account.kmd.getWalletAccount(name, predicate)` or `new KMDAccountManager(clientManager).getWalletAccount(name, predicate)` instead. Returns an Algorand account with private key loaded from the given KMD wallet (identified by name). @@ -1920,7 +2001,7 @@ ___ **`Deprecated`** -Use `algorandClient.account.kmd.getLocalNetDispenserAccount()` instead. +Use `algorand.account.kmd.getLocalNetDispenserAccount()` instead. Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts) @@ -1952,7 +2033,7 @@ An Algorand account with private key loaded - either one that already existed in **`Deprecated`** -use `algorandClient.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead. +use `algorand.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead. Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name. @@ -2124,7 +2205,7 @@ ___ **`Deprecated`** -Use `await algorandClient.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead. +Use `await algorand.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead. Returns true if the algod client is pointing to a LocalNet Algorand network @@ -2150,7 +2231,7 @@ ___ **`Deprecated`** -Use `await algorandClient.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. +Use `await algorand.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. #### Defined in @@ -2162,10 +2243,6 @@ ___ ▸ **isSchemaIsBroken**(`before`, `after`): `boolean` -Returns true is there is a breaking change in the application state schema from before to after. - i.e. if the schema becomes larger, since applications can't ask for more schema after creation. - Otherwise, there is no error, the app just doesn't store data in the extra schema :( - #### Parameters | Name | Type | Description | @@ -2179,9 +2256,17 @@ Returns true is there is a breaking change in the application state schema from Whether or not there is a breaking change +**`Deprecated`** + +Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead. + +Returns true is there is a breaking change in the application state schema from before to after. + i.e. if the schema becomes larger, since applications can't ask for more schema after creation. + Otherwise, there is no error, the app just doesn't store data in the extra schema :( + #### Defined in -[src/app-deploy.ts:414](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L414) +[src/app-deploy.ts:217](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L217) ___ @@ -2201,7 +2286,7 @@ ___ **`Deprecated`** -Use `await algorandClient.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. +Use `await algorand.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. #### Defined in @@ -2269,7 +2354,7 @@ ___ **`Deprecated`** -Use `algorandClient.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead. +Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead. Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret. @@ -2301,7 +2386,7 @@ The requested account with private key loaded from the environment variables or **`Deprecated`** -Use `algorandClient.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead. +Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead. Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier. @@ -2350,7 +2435,7 @@ A multisig account wrapper **`Deprecated`** -Use `algorandClient.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead. +Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead. Returns an account wrapper that supports partial or full multisig signing. @@ -2415,10 +2500,6 @@ ___ ▸ **performTemplateSubstitution**(`tealCode`, `templateParams?`): `string` -Performs template substitution of a teal file. - -Looks for `TMPL_{parameter}` for template replacements. - #### Parameters | Name | Type | Description | @@ -2432,9 +2513,17 @@ Looks for `TMPL_{parameter}` for template replacements. The TEAL code with replacements +**`Deprecated`** + +Use `AppManager.replaceTealTemplateParams` instead + +Performs template substitution of a teal file. + +Looks for `TMPL_{parameter}` for template replacements. + #### Defined in -[src/app-deploy.ts:586](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L586) +[src/app-deploy.ts:291](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L291) ___ @@ -2442,10 +2531,6 @@ ___ ▸ **performTemplateSubstitutionAndCompile**(`tealCode`, `algod`, `templateParams?`, `deploymentMetadata?`): `Promise`\<[`CompiledTeal`](../interfaces/types_app.CompiledTeal.md)\> -Performs template substitution of a teal file and compiles it, returning the compiled result. - -Looks for `TMPL_{parameter}` for template replacements. - #### Parameters | Name | Type | Description | @@ -2461,9 +2546,17 @@ Looks for `TMPL_{parameter}` for template replacements. The information about the compiled code +**`Deprecated`** + +Use `algorand.appManager.compileTealTemplate` instead. + +Performs template substitution of a teal file and compiles it, returning the compiled result. + +Looks for `TMPL_{parameter}` for template replacements. + #### Defined in -[src/app-deploy.ts:625](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L625) +[src/app-deploy.ts:308](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L308) ___ @@ -2527,7 +2620,7 @@ ___ **`Deprecated`** -Use `algorandClient.account.random()` or `algosdk.generateAccount()` instead. +Use `algorand.account.random()` or `algosdk.generateAccount()` instead. Returns a new, random Algorand account with secret key loaded. @@ -2595,7 +2688,7 @@ The SigningAccount wrapper **`Deprecated`** -Use `algorandClient.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead. +Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead. Returns an account wrapper that supports a rekeyed account. @@ -2609,14 +2702,6 @@ ___ ▸ **replaceDeployTimeControlParams**(`tealCode`, `params`): `string` -Replaces deploy-time deployment control parameters within the given teal code. - -* `TMPL_UPDATABLE` for updatability / immutability control -* `TMPL_DELETABLE` for deletability / permanence control - -Note: If these values are not undefined, but the corresponding `TMPL_*` value - isn't in the teal code it will throw an exception. - #### Parameters | Name | Type | Description | @@ -2632,9 +2717,21 @@ Note: If these values are not undefined, but the corresponding `TMPL_*` value The replaced TEAL code +**`Deprecated`** + +Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead + +Replaces deploy-time deployment control parameters within the given teal code. + +* `TMPL_UPDATABLE` for updatability / immutability control +* `TMPL_DELETABLE` for deletability / permanence control + +Note: If these values are not undefined, but the corresponding `TMPL_*` value + isn't in the teal code it will throw an exception. + #### Defined in -[src/app-deploy.ts:555](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L555) +[src/app-deploy.ts:276](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L276) ___ @@ -2782,8 +2879,6 @@ ___ ▸ **stripTealComments**(`tealCode`): `string` -Remove comments from TEAL Code - #### Parameters | Name | Type | Description | @@ -2796,9 +2891,15 @@ Remove comments from TEAL Code The TEAL without comments +**`Deprecated`** + +Use `AppManager.stripTealComments` instead. + +Remove comments from TEAL Code + #### Defined in -[src/app-deploy.ts:648](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L648) +[src/app-deploy.ts:333](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-deploy.ts#L333) ___ @@ -2843,7 +2944,7 @@ The SigningAccount wrapper **`Deprecated`** -Use `algorandClient.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead. +Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead. Returns an account wrapper that supports a transaction signer with associated sender address. @@ -2872,7 +2973,7 @@ The transaction object and optionally the confirmation if it was sent to the cha **`Deprecated`** -Use `algorand.send.payment()` / `algorand.transaction.payment()` instead +Use `algorand.send.payment()` / `algorand.transactions.payment()` instead Transfer Algo between two accounts. @@ -2907,7 +3008,7 @@ The transaction object and optionally the confirmation if it was sent to the cha **`Deprecated`** -Use `algorand.send.assetTransfer()` / `algorand.transaction.assetTransfer()` instead +Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead Transfer asset between two accounts. @@ -2927,8 +3028,6 @@ ___ ▸ **updateApp**(`update`, `algod`): `Promise`\<`Partial`\<[`AppCompilationResult`](../interfaces/types_app.AppCompilationResult.md)\> & [`AppCallTransactionResult`](../interfaces/types_app.AppCallTransactionResult.md)\> -Updates a smart contract app. - #### Parameters | Name | Type | Description | @@ -2942,9 +3041,16 @@ Updates a smart contract app. The transaction send result and the compilation result +**`Deprecated`** + +Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` +/ `algorand.transactions.appUpdateMethodCall()` instead + +Updates a smart contract app. + #### Defined in -[src/app.ts:188](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L188) +[src/app.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app.ts#L102) ___ diff --git a/docs/code/modules/types_algorand_client_transaction_sender.md b/docs/code/modules/types_algorand_client_transaction_sender.md index 7afee355..92412c20 100644 --- a/docs/code/modules/types_algorand_client_transaction_sender.md +++ b/docs/code/modules/types_algorand_client_transaction_sender.md @@ -7,19 +7,3 @@ ### Classes - [AlgorandClientTransactionSender](../classes/types_algorand_client_transaction_sender.AlgorandClientTransactionSender.md) - -### Type Aliases - -- [SendSingleTransactionResult](types_algorand_client_transaction_sender.md#sendsingletransactionresult) - -## Type Aliases - -### SendSingleTransactionResult - -Ƭ **SendSingleTransactionResult**: [`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) - -Result from sending a single transaction. - -#### Defined in - -[src/types/algorand-client-transaction-sender.ts:10](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algorand-client-transaction-sender.ts#L10) diff --git a/docs/code/modules/types_app.md b/docs/code/modules/types_app.md index 8a0b82ee..82b40bdc 100644 --- a/docs/code/modules/types_app.md +++ b/docs/code/modules/types_app.md @@ -41,6 +41,9 @@ - [AppCallArgs](types_app.md#appcallargs) - [AppCallType](types_app.md#appcalltype) - [BoxIdentifier](types_app.md#boxidentifier) +- [SendAppCreateTransactionResult](types_app.md#sendappcreatetransactionresult) +- [SendAppTransactionResult](types_app.md#sendapptransactionresult) +- [SendAppUpdateTransactionResult](types_app.md#sendappupdatetransactionresult) ### Variables @@ -60,7 +63,7 @@ An argument for an ABI method, either a primitive value, or a transaction with o #### Defined in -[src/types/app.ts:96](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L96) +[src/types/app.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L102) ___ @@ -72,7 +75,7 @@ App call args for an ABI call #### Defined in -[src/types/app.ts:107](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L107) +[src/types/app.ts:113](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L113) ___ @@ -84,7 +87,7 @@ The return value of an ABI method call #### Defined in -[src/types/app.ts:217](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L217) +[src/types/app.ts:236](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L236) ___ @@ -98,7 +101,7 @@ Arguments to pass to an app call either: #### Defined in -[src/types/app.ts:118](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L118) +[src/types/app.ts:124](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L124) ___ @@ -106,6 +109,10 @@ ___ Ƭ **AppCallType**: ``"no_op"`` \| ``"opt_in"`` \| ``"close_out"`` \| ``"clear_state"`` \| ``"update_application"`` \| ``"delete_application"`` +**`Deprecated`** + +Use `algosdk.OnApplicationComplete` directly instead. + The type of call / [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for a smart contract call. Equivalent of `algosdk.OnApplicationComplete`, but as a more convenient string enum. @@ -119,7 +126,7 @@ Equivalent of `algosdk.OnApplicationComplete`, but as a more convenient string e #### Defined in -[src/types/app.ts:161](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L161) +[src/types/app.ts:180](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L180) ___ @@ -127,6 +134,10 @@ ___ Ƭ **BoxIdentifier**: `string` \| `Uint8Array` \| [`SendTransactionFrom`](types_transaction.md#sendtransactionfrom) +**`Deprecated`** + +Use `types/app-manager/BoxIdentifier` instead. + Something that identifies a box name - either a: * `Uint8Array` * `string` (that will be encoded to a Uint8Array) @@ -134,7 +145,43 @@ Something that identifies a box name - either a: #### Defined in -[src/types/app.ts:64](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L64) +[src/types/app.ts:70](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L70) + +___ + +### SendAppCreateTransactionResult + +Ƭ **SendAppCreateTransactionResult**: [`Expand`](types_expand.md#expand)\<[`SendAppUpdateTransactionResult`](types_app.md#sendappupdatetransactionresult) & \{ `appAddress`: `string` ; `appId`: `bigint` }\> + +Result from sending a single app transaction. + +#### Defined in + +[src/types/app.ts:352](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L352) + +___ + +### SendAppTransactionResult + +Ƭ **SendAppTransactionResult**: [`Expand`](types_expand.md#expand)\<[`SendSingleTransactionResult`](types_transaction.md#sendsingletransactionresult) & \{ `return?`: [`ABIReturn`](types_app.md#abireturn) }\> + +Result from sending a single app transaction. + +#### Defined in + +[src/types/app.ts:341](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L341) + +___ + +### SendAppUpdateTransactionResult + +Ƭ **SendAppUpdateTransactionResult**: [`Expand`](types_expand.md#expand)\<[`SendAppTransactionResult`](types_app.md#sendapptransactionresult) & `Partial`\<[`AppCompilationResult`](../interfaces/types_app.AppCompilationResult.md)\>\> + +Result from sending a single app transaction. + +#### Defined in + +[src/types/app.ts:349](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L349) ## Variables @@ -146,7 +193,7 @@ First 4 bytes of SHA-512/256 hash of "return" for retrieving ABI return values #### Defined in -[src/types/app.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L34) +[src/types/app.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L36) ___ @@ -154,11 +201,11 @@ ___ • `Const` **APP\_DEPLOY\_NOTE\_DAPP**: ``"ALGOKIT_DEPLOYER"`` -The app create/update ARC-2 transaction note prefix +The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix #### Defined in -[src/types/app.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L28) +[src/types/app.ts:30](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L30) ___ @@ -170,7 +217,7 @@ The maximum number of bytes in a single app code page #### Defined in -[src/types/app.ts:31](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L31) +[src/types/app.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L33) ___ @@ -182,7 +229,7 @@ The name of the TEAL template variable for deploy-time permanence control #### Defined in -[src/types/app.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L25) +[src/types/app.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L27) ___ @@ -194,4 +241,4 @@ The name of the TEAL template variable for deploy-time immutability control #### Defined in -[src/types/app.ts:22](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L22) +[src/types/app.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app.ts#L24) diff --git a/docs/code/modules/types_app_client.md b/docs/code/modules/types_app_client.md index c37cf0bb..9987d9db 100644 --- a/docs/code/modules/types_app_client.md +++ b/docs/code/modules/types_app_client.md @@ -50,7 +50,7 @@ The arguments to pass to an Application Client smart contract call #### Defined in -[src/types/app-client.ts:174](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L174) +[src/types/app-client.ts:173](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L173) ___ @@ -62,7 +62,7 @@ Parameters to construct a ApplicationClient contract call #### Defined in -[src/types/app-client.ts:187](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L187) +[src/types/app-client.ts:186](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L186) ___ @@ -74,7 +74,7 @@ Parameters to construct a ApplicationClient clear state contract call #### Defined in -[src/types/app-client.ts:190](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L190) +[src/types/app-client.ts:189](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L189) ___ @@ -92,7 +92,7 @@ On-complete action parameter for creating a contract using ApplicationClient #### Defined in -[src/types/app-client.ts:202](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L202) +[src/types/app-client.ts:201](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L201) ___ @@ -104,7 +104,7 @@ Parameters for creating a contract using ApplicationClient #### Defined in -[src/types/app-client.ts:208](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L208) +[src/types/app-client.ts:207](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L207) ___ @@ -116,7 +116,7 @@ Parameters for updating a contract using ApplicationClient #### Defined in -[src/types/app-client.ts:216](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L216) +[src/types/app-client.ts:215](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L215) ___ @@ -128,7 +128,7 @@ The details of an AlgoKit Utils deployed app #### Defined in -[src/types/app-client.ts:103](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L103) +[src/types/app-client.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L102) ___ @@ -148,7 +148,7 @@ The details of an AlgoKit Utils deployed app #### Defined in -[src/types/app-client.ts:91](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L91) +[src/types/app-client.ts:90](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L90) ___ @@ -160,7 +160,7 @@ The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app #### Defined in -[src/types/app-client.ts:121](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L121) +[src/types/app-client.ts:120](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L120) ___ @@ -178,7 +178,7 @@ The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app #### Defined in -[src/types/app-client.ts:106](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L106) +[src/types/app-client.ts:105](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L105) ___ @@ -190,7 +190,7 @@ The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app by cre #### Defined in -[src/types/app-client.ts:118](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L118) +[src/types/app-client.ts:117](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L117) ___ @@ -202,7 +202,7 @@ The details of an ARC-0032 app spec specified, AlgoKit Utils deployed app by id #### Defined in -[src/types/app-client.ts:115](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L115) +[src/types/app-client.ts:114](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L114) ___ @@ -214,7 +214,7 @@ Configuration to resolve app by creator and name `getCreatorAppsByName` #### Defined in -[src/types/app-client.ts:72](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L72) +[src/types/app-client.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L71) ___ @@ -234,4 +234,4 @@ Configuration to resolve app by creator and name `getCreatorAppsByName` #### Defined in -[src/types/app-client.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L59) +[src/types/app-client.ts:58](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-client.ts#L58) diff --git a/docs/code/modules/types_app_deployer.md b/docs/code/modules/types_app_deployer.md new file mode 100644 index 00000000..ebe31dcd --- /dev/null +++ b/docs/code/modules/types_app_deployer.md @@ -0,0 +1,29 @@ +[@algorandfoundation/algokit-utils](../README.md) / types/app-deployer + +# Module: types/app-deployer + +## Table of contents + +### Classes + +- [AppDeployer](../classes/types_app_deployer.AppDeployer.md) + +### Interfaces + +- [AppDeployParams](../interfaces/types_app_deployer.AppDeployParams.md) +- [AppLookup](../interfaces/types_app_deployer.AppLookup.md) +- [AppMetadata](../interfaces/types_app_deployer.AppMetadata.md) + +### Type Aliases + +- [AppDeployResult](types_app_deployer.md#appdeployresult) + +## Type Aliases + +### AppDeployResult + +Ƭ **AppDeployResult**: [`Expand`](types_expand.md#expand)\<\{ `operationPerformed`: ``"create"`` } & [`AppMetadata`](../interfaces/types_app_deployer.AppMetadata.md) & [`SendAppCreateTransactionResult`](types_app.md#sendappcreatetransactionresult)\> \| [`Expand`](types_expand.md#expand)\<\{ `operationPerformed`: ``"update"`` } & [`AppMetadata`](../interfaces/types_app_deployer.AppMetadata.md) & [`SendAppUpdateTransactionResult`](types_app.md#sendappupdatetransactionresult)\> \| [`Expand`](types_expand.md#expand)\<\{ `operationPerformed`: ``"replace"`` } & [`AppMetadata`](../interfaces/types_app_deployer.AppMetadata.md) & [`SendAppCreateTransactionResult`](types_app.md#sendappcreatetransactionresult) & \{ `deleteResult`: [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md) ; `deleteReturn?`: [`ABIReturn`](types_app.md#abireturn) }\> \| [`Expand`](types_expand.md#expand)\<\{ `operationPerformed`: ``"nothing"`` } & [`AppMetadata`](../interfaces/types_app_deployer.AppMetadata.md)\> + +#### Defined in + +[src/types/app-deployer.ts:91](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-deployer.ts#L91) diff --git a/docs/code/modules/types_app_manager.md b/docs/code/modules/types_app_manager.md new file mode 100644 index 00000000..fa8b9f9d --- /dev/null +++ b/docs/code/modules/types_app_manager.md @@ -0,0 +1,36 @@ +[@algorandfoundation/algokit-utils](../README.md) / types/app-manager + +# Module: types/app-manager + +## Table of contents + +### Classes + +- [AppManager](../classes/types_app_manager.AppManager.md) + +### Interfaces + +- [AppInformation](../interfaces/types_app_manager.AppInformation.md) +- [BoxReference](../interfaces/types_app_manager.BoxReference.md) +- [BoxValueRequestParams](../interfaces/types_app_manager.BoxValueRequestParams.md) +- [BoxValuesRequestParams](../interfaces/types_app_manager.BoxValuesRequestParams.md) + +### Type Aliases + +- [BoxIdentifier](types_app_manager.md#boxidentifier) + +## Type Aliases + +### BoxIdentifier + +Ƭ **BoxIdentifier**: `string` \| `Uint8Array` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) + +Something that identifies an app box name - either a: + * `Uint8Array` (the actual binary of the box name) + * `string` (that will be encoded to a `Uint8Array`) + * `TransactionSignerAccount` (that will be encoded into the + public key address of the corresponding account) + +#### Defined in + +[src/types/app-manager.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/app-manager.ts#L57) diff --git a/docs/code/modules/types_client_manager.md b/docs/code/modules/types_client_manager.md index f6bd4f29..fdcba192 100644 --- a/docs/code/modules/types_client_manager.md +++ b/docs/code/modules/types_client_manager.md @@ -31,7 +31,7 @@ Details to resolve an app client by creator address and name. #### Defined in -[src/types/client-manager.ts:508](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L508) +[src/types/client-manager.ts:513](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L513) ___ @@ -43,7 +43,7 @@ Details to resolve an app client by app ID. #### Defined in -[src/types/client-manager.ts:520](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L520) +[src/types/client-manager.ts:525](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L525) ___ @@ -55,7 +55,7 @@ Details to resolve a typed app creator address and name. #### Defined in -[src/types/client-manager.ts:515](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L515) +[src/types/client-manager.ts:520](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L520) ___ @@ -67,4 +67,4 @@ Details to resolve a typed app by app ID. #### Defined in -[src/types/client-manager.ts:525](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L525) +[src/types/client-manager.ts:530](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/client-manager.ts#L530) diff --git a/docs/code/modules/types_composer.md b/docs/code/modules/types_composer.md index 6859c969..cf96b843 100644 --- a/docs/code/modules/types_composer.md +++ b/docs/code/modules/types_composer.md @@ -10,12 +10,21 @@ ### Interfaces +- [BuiltTransactions](../interfaces/types_composer.BuiltTransactions.md) - [ExecuteParams](../interfaces/types_composer.ExecuteParams.md) ### Type Aliases - [AlgoKitComposerParams](types_composer.md#algokitcomposerparams) +- [AppCallMethodCall](types_composer.md#appcallmethodcall) - [AppCallParams](types_composer.md#appcallparams) +- [AppCreateMethodCall](types_composer.md#appcreatemethodcall) +- [AppCreateParams](types_composer.md#appcreateparams) +- [AppDeleteMethodCall](types_composer.md#appdeletemethodcall) +- [AppDeleteParams](types_composer.md#appdeleteparams) +- [AppMethodCall](types_composer.md#appmethodcall) +- [AppUpdateMethodCall](types_composer.md#appupdatemethodcall) +- [AppUpdateParams](types_composer.md#appupdateparams) - [AssetConfigParams](types_composer.md#assetconfigparams) - [AssetCreateParams](types_composer.md#assetcreateparams) - [AssetDestroyParams](types_composer.md#assetdestroyparams) @@ -23,8 +32,8 @@ - [AssetOptInParams](types_composer.md#assetoptinparams) - [AssetOptOutParams](types_composer.md#assetoptoutparams) - [AssetTransferParams](types_composer.md#assettransferparams) +- [CommonAppCallParams](types_composer.md#commonappcallparams) - [CommonTransactionParams](types_composer.md#commontransactionparams) -- [MethodCallParams](types_composer.md#methodcallparams) - [OnlineKeyRegistrationParams](types_composer.md#onlinekeyregistrationparams) - [PaymentParams](types_composer.md#paymentparams) @@ -45,25 +54,114 @@ Parameters to create an `AlgoKitComposer`. | Name | Type | Description | | :------ | :------ | :------ | | `algod` | `algosdk.Algodv2` | The algod client to use to get suggestedParams and send the transaction group | +| `appManager?` | [`AppManager`](../classes/types_app_manager.AppManager.md) | An existing `AppManager` to use to manage app compilation and cache compilation results. If not specified than an ephemeral one will be created. | | `defaultValidityWindow?` | `number` | How many rounds a transaction should be valid for by default; if not specified then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet). | | `getSigner` | (`address`: `string`) => `algosdk.TransactionSigner` | - | | `getSuggestedParams?` | () => `Promise`\<`algosdk.SuggestedParams`\> | - | #### Defined in -[src/types/composer.ts:388](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L388) +[src/types/composer.ts:432](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L432) + +___ + +### AppCallMethodCall + +Ƭ **AppCallMethodCall**: [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppCallParams`](types_composer.md#appcallparams)\> + +#### Defined in + +[src/types/composer.ts:383](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L383) ___ ### AppCallParams -Ƭ **AppCallParams**: [`CommonTransactionParams`](types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId?`: `bigint` ; `appReferences?`: `bigint`[] ; `approvalProgram?`: `Uint8Array` ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: `algosdk.BoxReference`[] ; `clearProgram?`: `Uint8Array` ; `extraPages?`: `number` ; `onComplete?`: `algosdk.OnApplicationComplete` ; `schema?`: \{ `globalByteSlices`: `number` ; `globalUints`: `number` ; `localByteSlices`: `number` ; `localUints`: `number` } } +Ƭ **AppCallParams**: [`CommonAppCallParams`](types_composer.md#commonappcallparams) & \{ `onComplete?`: `Exclude`\<`algosdk.OnApplicationComplete`, `algosdk.OnApplicationComplete.UpdateApplicationOC`\> } Parameters to define an application call transaction. #### Defined in -[src/types/composer.ts:313](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L313) +[src/types/composer.ts:371](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L371) + +___ + +### AppCreateMethodCall + +Ƭ **AppCreateMethodCall**: [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppCreateParams`](types_composer.md#appcreateparams)\> + +#### Defined in + +[src/types/composer.ts:380](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L380) + +___ + +### AppCreateParams + +Ƭ **AppCreateParams**: [`Expand`](types_expand.md#expand)\<`Omit`\<[`CommonAppCallParams`](types_composer.md#commonappcallparams), ``"appId"``\> & \{ `approvalProgram`: `string` \| `Uint8Array` ; `clearStateProgram`: `string` \| `Uint8Array` ; `extraProgramPages?`: `number` ; `onComplete?`: `Exclude`\<`algosdk.OnApplicationComplete`, `algosdk.OnApplicationComplete.ClearStateOC`\> ; `schema?`: \{ `globalByteSlices`: `number` ; `globalInts`: `number` ; `localByteSlices`: `number` ; `localInts`: `number` } }\> + +#### Defined in + +[src/types/composer.ts:337](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L337) + +___ + +### AppDeleteMethodCall + +Ƭ **AppDeleteMethodCall**: [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppDeleteParams`](types_composer.md#appdeleteparams)\> + +#### Defined in + +[src/types/composer.ts:382](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L382) + +___ + +### AppDeleteParams + +Ƭ **AppDeleteParams**: [`CommonAppCallParams`](types_composer.md#commonappcallparams) & \{ `onComplete?`: `algosdk.OnApplicationComplete.DeleteApplicationOC` } + +Parameters to define an application delete call transaction. + +#### Defined in + +[src/types/composer.ts:376](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L376) + +___ + +### AppMethodCall + +Ƭ **AppMethodCall**\<`T`\>: [`Expand`](types_expand.md#expand)\<`Omit`\<`T`, ``"args"``\>\> & \{ `args?`: (`algosdk.ABIValue` \| `TransactionWithSigner` \| `Transaction` \| `Promise`\<`Transaction`\> \| [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppCreateParams`](types_composer.md#appcreateparams)\> \| [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppUpdateParams`](types_composer.md#appupdateparams)\> \| [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppCallParams`](types_composer.md#appcallparams)\>)[] ; `method`: `algosdk.ABIMethod` } + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Defined in + +[src/types/composer.ts:385](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L385) + +___ + +### AppUpdateMethodCall + +Ƭ **AppUpdateMethodCall**: [`AppMethodCall`](types_composer.md#appmethodcall)\<[`AppUpdateParams`](types_composer.md#appupdateparams)\> + +#### Defined in + +[src/types/composer.ts:381](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L381) + +___ + +### AppUpdateParams + +Ƭ **AppUpdateParams**: [`Expand`](types_expand.md#expand)\<[`CommonAppCallParams`](types_composer.md#commonappcallparams) & \{ `approvalProgram`: `string` \| `Uint8Array` ; `clearStateProgram`: `string` \| `Uint8Array` ; `onComplete?`: `algosdk.OnApplicationComplete.UpdateApplicationOC` }\> + +#### Defined in + +[src/types/composer.ts:360](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L360) ___ @@ -79,7 +177,7 @@ all fields are immutable from that point forward. #### Defined in -[src/types/composer.ts:188](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L188) +[src/types/composer.ts:191](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L191) ___ @@ -93,7 +191,7 @@ The account that sends this transaction will automatically be opted in to the as #### Defined in -[src/types/composer.ts:72](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L72) +[src/types/composer.ts:75](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L75) ___ @@ -107,7 +205,7 @@ Created assets can be destroyed only by the asset manager account. All of the as #### Defined in -[src/types/composer.ts:246](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L246) +[src/types/composer.ts:249](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L249) ___ @@ -119,7 +217,7 @@ Parameters to define an asset freeze transaction. #### Defined in -[src/types/composer.ts:233](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L233) +[src/types/composer.ts:236](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L236) ___ @@ -131,7 +229,7 @@ Parameters to define an asset opt-in transaction. #### Defined in -[src/types/composer.ts:274](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L274) +[src/types/composer.ts:277](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L277) ___ @@ -143,7 +241,7 @@ Parameters to define an asset opt-out transaction. #### Defined in -[src/types/composer.ts:280](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L280) +[src/types/composer.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L283) ___ @@ -155,7 +253,19 @@ Parameters to define an asset transfer transaction. #### Defined in -[src/types/composer.ts:252](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L252) +[src/types/composer.ts:255](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L255) + +___ + +### CommonAppCallParams + +Ƭ **CommonAppCallParams**: [`CommonTransactionParams`](types_composer.md#commontransactionparams) & \{ `accountReferences?`: `string`[] ; `appId`: `bigint` ; `appReferences?`: `bigint`[] ; `args?`: `Uint8Array`[] ; `assetReferences?`: `bigint`[] ; `boxReferences?`: ([`BoxReference`](../interfaces/types_app_manager.BoxReference.md) \| [`BoxIdentifier`](types_app_manager.md#boxidentifier))[] ; `onComplete?`: `algosdk.OnApplicationComplete` } + +Common parameters for defining an application call transaction. + +#### Defined in + +[src/types/composer.ts:316](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L316) ___ @@ -183,19 +293,7 @@ Common parameters for defining a transaction. #### Defined in -[src/types/composer.ts:15](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L15) - -___ - -### MethodCallParams - -Ƭ **MethodCallParams**: [`CommonTransactionParams`](types_composer.md#commontransactionparams) & `Omit`\<[`AppCallParams`](types_composer.md#appcallparams), ``"args"``\> & \{ `appId`: `bigint` ; `args?`: (`algosdk.ABIValue` \| `TransactionWithSigner` \| `Transaction` \| `Promise`\<`Transaction`\> \| [`MethodCallParams`](types_composer.md#methodcallparams))[] ; `method`: `algosdk.ABIMethod` } - -Parameters to define an ABI method application call transaction. - -#### Defined in - -[src/types/composer.ts:348](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L348) +[src/types/composer.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L18) ___ @@ -207,7 +305,7 @@ Parameters to define an online key registration transaction. #### Defined in -[src/types/composer.ts:291](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L291) +[src/types/composer.ts:294](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L294) ___ @@ -219,7 +317,7 @@ Parameters to define a payment transaction. #### Defined in -[src/types/composer.ts:56](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L56) +[src/types/composer.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L59) ## Variables @@ -229,4 +327,4 @@ Parameters to define a payment transaction. #### Defined in -[src/types/composer.ts:12](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L12) +[src/types/composer.ts:15](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L15) diff --git a/docs/code/modules/types_expand.md b/docs/code/modules/types_expand.md new file mode 100644 index 00000000..44f1b341 --- /dev/null +++ b/docs/code/modules/types_expand.md @@ -0,0 +1,28 @@ +[@algorandfoundation/algokit-utils](../README.md) / types/expand + +# Module: types/expand + +## Table of contents + +### Type Aliases + +- [Expand](types_expand.md#expand) + +## Type Aliases + +### Expand + +Ƭ **Expand**\<`T`\>: `T` extends (...`args`: infer A) => infer R ? (...`args`: [`Expand`](types_expand.md#expand)\<`A`\>) => [`Expand`](types_expand.md#expand)\<`R`\> : `T` extends infer O ? \{ [K in keyof O]: O[K] } : `never` + +Expands types for IntelliSense so they are more human readable +See https://stackoverflow.com/a/69288824 + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Defined in + +[src/types/expand.ts:5](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/expand.ts#L5) diff --git a/docs/code/modules/types_transaction.md b/docs/code/modules/types_transaction.md index 92c5fdbe..dd1978f5 100644 --- a/docs/code/modules/types_transaction.md +++ b/docs/code/modules/types_transaction.md @@ -19,6 +19,7 @@ ### Type Aliases - [Arc2TransactionNote](types_transaction.md#arc2transactionnote) +- [SendSingleTransactionResult](types_transaction.md#sendsingletransactionresult) - [SendTransactionFrom](types_transaction.md#sendtransactionfrom) - [TransactionNote](types_transaction.md#transactionnote) - [TransactionNoteData](types_transaction.md#transactionnotedata) @@ -33,7 +34,19 @@ ARC-0002 compatible transaction note components https://github.com/algorandfound #### Defined in -[src/types/transaction.ts:15](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L15) +[src/types/transaction.ts:16](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L16) + +___ + +### SendSingleTransactionResult + +Ƭ **SendSingleTransactionResult**: [`Expand`](types_expand.md#expand)\<[`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & [`ConfirmedTransactionResult`](../interfaces/types_transaction.ConfirmedTransactionResult.md)\> + +Result from sending a single transaction. + +#### Defined in + +[src/types/transaction.ts:50](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L50) ___ @@ -53,7 +66,7 @@ many types of accounts, including: #### Defined in -[src/types/transaction.ts:104](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L104) +[src/types/transaction.ts:108](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L108) ___ @@ -63,7 +76,7 @@ ___ #### Defined in -[src/types/transaction.ts:11](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L11) +[src/types/transaction.ts:12](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L12) ___ @@ -73,4 +86,4 @@ ___ #### Defined in -[src/types/transaction.ts:13](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L13) +[src/types/transaction.ts:14](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/transaction.ts#L14) diff --git a/src/__snapshots__/app-deploy.spec.ts.snap b/src/__snapshots__/app-deploy.spec.ts.snap index 192aebda..3f7fe4e7 100644 --- a/src/__snapshots__/app-deploy.spec.ts.snap +++ b/src/__snapshots__/app-deploy.spec.ts.snap @@ -3,10 +3,10 @@ exports[`deploy-app Deploy append for schema broken app if onSchemaBreak = AppendApp 1`] = ` "INFO: Idempotently deploying app "test" from creator ACCOUNT_1 using 11890 bytes of teal code and 39 bytes of teal code INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and version 1.0. -WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"global":{"numUint":3,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}},"to":{"global":{"numUint":3,"numByteSlice":3,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}}}] +WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"globalInts":3,"globalByteSlices":2,"localInts":2,"localByteSlices":2},"to":{"globalByteSlices":3,"globalInts":3,"localByteSlices":2,"localInts":2}}] INFO: onSchemaBreak=AppendApp, will attempt to create a new app VERBOSE: Sent transaction ID TXID_2 appl from ACCOUNT_1 -DEBUG: Created app APP_2 from creator ACCOUNT_1" +DEBUG: App created by ACCOUNT_1 with ID APP_2 via transaction TXID_2" `; exports[`deploy-app Deploy append for update app if onUpdate = AppendApp 1`] = ` @@ -15,7 +15,7 @@ INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and versio INFO: Detected a TEAL update in app APP_1 for creator ACCOUNT_1 INFO: onUpdate=AppendApp, will attempt to create a new app VERBOSE: Sent transaction ID TXID_2 appl from ACCOUNT_1 -DEBUG: Created app APP_2 from creator ACCOUNT_1" +DEBUG: App created by ACCOUNT_1 with ID APP_2 via transaction TXID_2" `; exports[`deploy-app Deploy failure for replacement of permanent, updated app 1`] = ` @@ -31,7 +31,7 @@ ERROR: Received error executing Atomic Transaction Composer, for more informatio exports[`deploy-app Deploy failure for replacement of schema broken app fails if onSchemaBreak = Fail 1`] = ` "INFO: Idempotently deploying app "test" from creator ACCOUNT_1 using 11890 bytes of teal code and 39 bytes of teal code INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and version 1.0. -WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"global":{"numUint":3,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}},"to":{"global":{"numUint":3,"numByteSlice":3,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}}}]" +WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"globalInts":3,"globalByteSlices":2,"localInts":2,"localByteSlices":2},"to":{"globalByteSlices":3,"globalInts":3,"localByteSlices":2,"localInts":2}}]" `; exports[`deploy-app Deploy failure for updated app fails if onupdate = Fail 1`] = ` @@ -44,13 +44,13 @@ exports[`deploy-app Deploy new app 1`] = ` "INFO: Idempotently deploying app "test" from creator ACCOUNT_1 using 11890 bytes of teal code and 39 bytes of teal code INFO: App test not found in apps created by ACCOUNT_1; deploying app with version 1.0. VERBOSE: Sent transaction ID TXID_1 appl from ACCOUNT_1 -DEBUG: Created app APP_1 from creator ACCOUNT_1" +DEBUG: App created by ACCOUNT_1 with ID APP_1 via transaction TXID_1" `; exports[`deploy-app Deploy replacement of deletable schema broken app 1`] = ` "INFO: Idempotently deploying app "test" from creator ACCOUNT_1 using 11890 bytes of teal code and 39 bytes of teal code INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and version 1.0. -WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"global":{"numUint":3,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}},"to":{"global":{"numUint":3,"numByteSlice":3,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}}}] +WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"globalInts":3,"globalByteSlices":2,"localInts":2,"localByteSlices":2},"to":{"globalByteSlices":3,"globalInts":3,"localByteSlices":2,"localInts":2}}] INFO: App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app INFO: Deploying a new test app for ACCOUNT_1; deploying app with version 2.0. WARN: Deleting existing test app with id APP_1 from ACCOUNT_1 account. @@ -70,7 +70,7 @@ WARN: Sent transactions TXID_2 to create app with id APP_2 and TXID_3 to delete exports[`deploy-app Deploy replacement to schema broken, permanent app fails 1`] = ` "INFO: Idempotently deploying app "test" from creator ACCOUNT_1 using 11890 bytes of teal code and 39 bytes of teal code INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and version 1.0. -WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"global":{"numUint":3,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}},"to":{"global":{"numUint":3,"numByteSlice":3,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}},"local":{"numUint":2,"numByteSlice":2,"attribute_map":{"numUint":"num-uint","numByteSlice":"num-byte-slice"}}}}] +WARN: Detected a breaking app schema change in app APP_1: | [{"from":{"globalInts":3,"globalByteSlices":2,"localInts":2,"localByteSlices":2},"to":{"globalByteSlices":3,"globalInts":3,"localByteSlices":2,"localInts":2}}] INFO: App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail INFO: Deploying a new test app for ACCOUNT_1; deploying app with version 2.0. WARN: Deleting existing test app with id APP_1 from ACCOUNT_1 account. @@ -83,7 +83,7 @@ INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and versio INFO: Detected a TEAL update in app APP_1 for creator ACCOUNT_1 WARN: App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail INFO: Updating existing test app for ACCOUNT_1 to version 2.0. -DEBUG: Updating app APP_1" +ERROR: Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information | [{"response":{"body":{"data":{"app-index":APP_1,"eval-states":[{"stack":[0]}],"group-index":0,"pc":948},"message":"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=948. Details: app=APP_1, pc=948, opcodes=assert; intc 4 // 0; assert"},"status":400,"text":"{\\"data\\":{\\"app-index\\":APP_1,\\"eval-states\\":[{\\"stack\\":[0]}],\\"group-index\\":0,\\"pc\\":948},\\"message\\":\\"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=948. Details: app=APP_1, pc=948, opcodes=assert; intc 4 // 0; assert\\"}\\n","ok":false},"name":"URLTokenBaseHTTPError","status":400,"traces":[]}]" `; exports[`deploy-app Deploy update to updatable updated app 1`] = ` @@ -92,7 +92,6 @@ INFO: Existing app test found by creator ACCOUNT_1, with app id APP_1 and versio INFO: Detected a TEAL update in app APP_1 for creator ACCOUNT_1 INFO: App is updatable and onUpdate=UpdateApp, updating app... INFO: Updating existing test app for ACCOUNT_1 to version 2.0. -DEBUG: Updating app APP_1 VERBOSE: Sent transaction ID TXID_2 appl from ACCOUNT_1" `; diff --git a/src/account/account.ts b/src/account/account.ts index ec691d2f..611f7da7 100644 --- a/src/account/account.ts +++ b/src/account/account.ts @@ -14,7 +14,7 @@ import TransactionSigner = algosdk.TransactionSigner import AccountInformationModel = algosdk.modelsv2.Account /** - * @deprecated Use `algorandClient.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead. + * @deprecated Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead. * * Returns an account wrapper that supports partial or full multisig signing. * @param multisigParams The parameters that define the multisig account @@ -26,7 +26,7 @@ export function multisigAccount(multisigParams: MultisigMetadata, signingAccount } /** - * @deprecated Use `algorandClient.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead. + * @deprecated Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead. * * Returns an account wrapper that supports a rekeyed account. * @param signer The account, with private key loaded, that is signing @@ -38,7 +38,7 @@ export function rekeyedAccount(signer: Account, sender: string) { } /** - * @deprecated Use `algorandClient.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead. + * @deprecated Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead. * * Returns an account wrapper that supports a transaction signer with associated sender address. * @param signer The transaction signer @@ -50,7 +50,7 @@ export function transactionSignerAccount(signer: TransactionSigner, sender: stri } /** - * @deprecated Use `algorandClient.account.random()` or `algosdk.generateAccount()` instead. + * @deprecated Use `algorand.account.random()` or `algosdk.generateAccount()` instead. * * Returns a new, random Algorand account with secret key loaded. * @@ -63,7 +63,7 @@ export function randomAccount(): Account { } /** - * @deprecated Use `algorandClient.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead. + * @deprecated Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead. * * Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier. * @@ -135,7 +135,7 @@ type ToNumberIfExtends = K extends E ? number : K export type AccountInformation = Omit, 'get_obj_for_encoding'> /** - * @deprecated Use `algorandClient.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead. + * @deprecated Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead. * * Returns the given sender account's current status, balance and spendable amounts. * @@ -174,7 +174,7 @@ export async function getAccountInformation(sender: string | SendTransactionFrom } /** - * @deprecated Use `algorandClient.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead. + * @deprecated Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead. * * Returns the given sender account's asset holding for a given asset. * diff --git a/src/account/get-account.ts b/src/account/get-account.ts index 16538172..7d054392 100644 --- a/src/account/get-account.ts +++ b/src/account/get-account.ts @@ -8,7 +8,7 @@ import Account = algosdk.Account import Algodv2 = algosdk.Algodv2 import Kmd = algosdk.Kmd -/** @deprecated use `algorandClient.account.fromEnvironment()` instead +/** @deprecated use `algorand.account.fromEnvironment()` instead * * Returns an Algorand account with private key loaded by convention based on the given name identifier. * @@ -44,7 +44,7 @@ export async function getAccount( kmdClient?: Kmd, ): Promise -/** @deprecated use `algorandClient.account.fromEnvironment()` instead +/** @deprecated use `algorand.account.fromEnvironment()` instead * Returns an Algorand account with private key loaded by convention based on the given name identifier. * * Note: This function expects to run in a Node.js environment. @@ -71,7 +71,7 @@ export async function getAccount( kmdClient?: Kmd, ): Promise -/** @deprecated use `algorandClient.account.fromEnvironment()` instead +/** @deprecated use `algorand.account.fromEnvironment()` instead * Returns an Algorand account with private key loaded by convention based on the given name identifier. * * Note: This function expects to run in a Node.js environment. diff --git a/src/account/get-dispenser-account.ts b/src/account/get-dispenser-account.ts index 986b9345..04349f95 100644 --- a/src/account/get-dispenser-account.ts +++ b/src/account/get-dispenser-account.ts @@ -6,7 +6,7 @@ import Algodv2 = algosdk.Algodv2 import Kmd = algosdk.Kmd /** - * @deprecated Use `algorandClient.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead + * @deprecated Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead * * Returns an account (with private key loaded) that can act as a dispenser * diff --git a/src/account/mnemonic-account.ts b/src/account/mnemonic-account.ts index 736bf5ad..ffad831f 100644 --- a/src/account/mnemonic-account.ts +++ b/src/account/mnemonic-account.ts @@ -2,7 +2,7 @@ import algosdk from 'algosdk' import Account = algosdk.Account /** - * @deprecated Use `algorandClient.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead. + * @deprecated Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead. * * Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret. * diff --git a/src/app-deploy.spec.ts b/src/app-deploy.spec.ts index 2b6f94c0..5c8b0d06 100644 --- a/src/app-deploy.spec.ts +++ b/src/app-deploy.spec.ts @@ -4,7 +4,8 @@ import invariant from 'tiny-invariant' import * as algokit from '.' import { getTestingAppCreateParams, getTestingAppDeployParams } from '../tests/example-contracts/testing-app/contract' import { algoKitLogCaptureFixture, algorandFixture } from './testing' -import { AppDeployMetadata, AppDeploymentParams } from './types/app' +import { AppDeployMetadata } from './types/app' +import { AppDeployParams } from './types/app-deployer' import { LogicError } from './types/logic-error' describe('deploy-app', () => { @@ -18,19 +19,19 @@ describe('deploy-app', () => { const name = 'MY_APP' test('Created app is retrieved by name with deployment metadata', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const creationMetadata = { name, version: '1.0', updatable: true, deletable: false } - const app1 = await algokit.createApp(await getTestingAppCreateParams(testAccount, creationMetadata), algod) + const app1 = await algorand.send.appCreate(await getTestingAppCreateParams(testAccount, creationMetadata)) await waitForIndexer() - const apps = await algokit.getCreatorAppsByName(testAccount, indexer) + const apps = await algorand.appDeployer.getCreatorAppsByName(testAccount.addr) expect(apps.creator).toBe(testAccount.addr) expect(Object.keys(apps.apps)).toEqual([name]) const app = apps.apps[name] expect(app.appId).toBe(app1.appId) expect(app.appAddress).toBe(app1.appAddress) - expect(app.createdRound).toBe(app1.confirmation?.confirmedRound) + expect(app.createdRound).toBe(BigInt(app1.confirmation.confirmedRound!)) expect(app.createdMetadata).toEqual(creationMetadata) expect(app.updatedRound).toBe(app.createdRound) expect(app.name).toBe(creationMetadata.name) @@ -40,14 +41,14 @@ describe('deploy-app', () => { }) test('Latest created app is retrieved', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const creationMetadata = { name, version: '1.0', updatable: true, deletable: false } - const app1 = await algokit.createApp(await getTestingAppCreateParams(testAccount, creationMetadata), algod) - const app2 = await algokit.createApp(await getTestingAppCreateParams(testAccount, creationMetadata), algod) - const app3 = await algokit.createApp(await getTestingAppCreateParams(testAccount, creationMetadata), algod) + const app1 = await algorand.send.appCreate({ ...(await getTestingAppCreateParams(testAccount, creationMetadata)), lease: '1' }) + const app2 = await algorand.send.appCreate({ ...(await getTestingAppCreateParams(testAccount, creationMetadata)), lease: '2' }) + const app3 = await algorand.send.appCreate({ ...(await getTestingAppCreateParams(testAccount, creationMetadata)), lease: '3' }) await waitForIndexer() - const apps = await algokit.getCreatorAppsByName(testAccount, indexer) + const apps = await algorand.appDeployer.getCreatorAppsByName(testAccount.addr) expect(apps.apps[name].appId).not.toBe(app1.appId) expect(apps.apps[name].appId).not.toBe(app2.appId) @@ -55,30 +56,30 @@ describe('deploy-app', () => { }) test('Created, updated and deleted apps are retrieved by name with deployment metadata', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const creationMetadata = { name, version: '1.0', updatable: true, deletable: true } const name2 = 'APP_2' const name3 = 'APP_3' - const app1 = await algokit.createApp(await getTestingAppCreateParams(testAccount, creationMetadata), algod) - const app2 = await algokit.createApp(await getTestingAppCreateParams(testAccount, { ...creationMetadata, name: name2 }), algod) - const app3 = await algokit.createApp(await getTestingAppCreateParams(testAccount, { ...creationMetadata, name: name3 }), algod) + const app1 = await algorand.send.appCreate(await getTestingAppCreateParams(testAccount, creationMetadata)) + const app2 = await algorand.send.appCreate(await getTestingAppCreateParams(testAccount, { ...creationMetadata, name: name2 })) + const app3 = await algorand.send.appCreate(await getTestingAppCreateParams(testAccount, { ...creationMetadata, name: name3 })) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const updateMetadata = { name, version: '2.0', updatable: false, deletable: false } - const update1 = await algokit.updateApp({ ...(await getTestingAppCreateParams(testAccount, updateMetadata)), appId: app1.appId }, algod) + const update1 = await algorand.send.appUpdate({ ...(await getTestingAppCreateParams(testAccount, updateMetadata)), appId: app1.appId }) // eslint-disable-next-line @typescript-eslint/no-unused-vars - const delete3 = await algokit.callApp({ appId: app3.appId, callType: 'delete_application', from: testAccount }, algod) + const delete3 = await algorand.send.appDelete({ appId: app3.appId, sender: testAccount.addr }) await waitForIndexer() - const apps = await algokit.getCreatorAppsByName(testAccount, indexer) + const apps = await algorand.appDeployer.getCreatorAppsByName(testAccount.addr) expect(apps.creator).toBe(testAccount.addr) expect(Object.keys(apps.apps).sort()).toEqual([name, name2, name3].sort()) const app1Data = apps.apps[name] expect(app1Data.appId).toBe(app1.appId) expect(app1Data.appAddress).toBe(app1.appAddress) - expect(app1Data.createdRound).toBe(app1.confirmation?.confirmedRound) + expect(app1Data.createdRound).toBe(BigInt(app1.confirmation.confirmedRound!)) expect(app1Data.createdMetadata).toEqual(creationMetadata) - expect(app1Data.updatedRound).toBe(update1.confirmation?.confirmedRound) + expect(app1Data.updatedRound).toBe(BigInt(update1.confirmation.confirmedRound!)) expect(app1Data.name).toBe(updateMetadata.name) expect(app1Data.updatable).toBe(updateMetadata.updatable) expect(app1Data.deletable).toBe(updateMetadata.deletable) @@ -95,19 +96,19 @@ describe('deploy-app', () => { }) test('Deploy new app', async () => { - const { algod, indexer, testAccount } = localnet.context + const { algorand, testAccount } = localnet.context const deployment = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: getMetadata(), }) - const result = await algokit.deployApp(deployment, algod, indexer) + const result = await algorand.appDeployer.deploy(deployment) invariant('transaction' in result) invariant(result.confirmation) - expect(result.appId).toBe(result.confirmation.applicationIndex) + expect(result.appId).toBe(BigInt(result.confirmation.applicationIndex!)) expect(result.appAddress).toBe(getApplicationAddress(result.appId)) expect(result.createdMetadata).toEqual(deployment.metadata) - expect(result.createdRound).toBe(result.confirmation.confirmedRound) + expect(result.createdRound).toBe(BigInt(result.confirmation.confirmedRound!)) expect(result.updatedRound).toBe(result.createdRound) expect(result.name).toBe(deployment.metadata.name) expect(result.version).toBe(deployment.metadata.version) @@ -124,47 +125,47 @@ describe('deploy-app', () => { }) test('Fail to deploy immutable app without TMPL_UPDATABLE', async () => { - const { algod, indexer, testAccount } = localnet.context + const { algorand, testAccount } = localnet.context const deployment = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: getMetadata({ updatable: true }), }) - deployment.approvalProgram = deployment.approvalProgram.replace(/TMPL_UPDATABLE/g, '0') - await expect(async () => await algokit.deployApp(deployment, algod, indexer)).rejects.toThrowError( + deployment.createParams.approvalProgram = deployment.createParams.approvalProgram.replace(/TMPL_UPDATABLE/g, '0') + await expect(async () => await algorand.appDeployer.deploy(deployment)).rejects.toThrowError( 'Deploy-time updatability control requested for app deployment, but TMPL_UPDATABLE not present in TEAL code', ) }) test('Fail to deploy permanent app without TMPL_DELETABLE', async () => { - const { algod, indexer, testAccount } = localnet.context + const { algorand, testAccount } = localnet.context const deployment = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: getMetadata({ deletable: true }), }) - deployment.approvalProgram = deployment.approvalProgram.replace(/TMPL_DELETABLE/g, '0') - await expect(async () => await algokit.deployApp(deployment, algod, indexer)).rejects.toThrowError( + deployment.createParams.approvalProgram = deployment.createParams.approvalProgram.replace(/TMPL_DELETABLE/g, '0') + await expect(async () => await algorand.appDeployer.deploy(deployment)).rejects.toThrowError( 'Deploy-time deletability control requested for app deployment, but TMPL_DELETABLE not present in TEAL code', ) }) test('Deploy update to updatable updated app', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ updatable: true }) const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, codeInjectionValue: 2, onUpdate: 'update', }) - const result2 = await algokit.deployApp(deployment2, algod, indexer) + const result2 = await algorand.appDeployer.deploy(deployment2) invariant('transaction' in result1) invariant('transaction' in result2) @@ -172,7 +173,7 @@ describe('deploy-app', () => { expect(result2.appId).toBe(result1.appId) expect(result2.createdMetadata).toEqual(deployment1.metadata) expect(result2.createdRound).toBe(result1.createdRound) - expect(result2.updatedRound).toBe(result2.confirmation.confirmedRound) + expect(result2.updatedRound).toBe(BigInt(result2.confirmation.confirmedRound!)) expect(result2.name).toBe(deployment2.metadata.name) expect(result2.version).toBe(deployment2.metadata.version) expect(result2.updatable).toBe(deployment2.metadata.updatable) @@ -188,25 +189,25 @@ describe('deploy-app', () => { }) test('Deploy update to immutable updated app fails', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ updatable: false }) const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, codeInjectionValue: 2, onUpdate: 'update', }) try { - await algokit.deployApp(deployment2, algod, indexer) + await algorand.appDeployer.deploy(deployment2) invariant(false) // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { @@ -224,26 +225,24 @@ describe('deploy-app', () => { }) test('Deploy failure for updated app fails if onupdate = Fail', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata() const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, codeInjectionValue: 2, onUpdate: 'fail', }) - await expect(() => algokit.deployApp(deployment2, algod, indexer)).rejects.toThrow( - 'Update detected and onUpdate=Fail, stopping deployment. ' + - 'If you want to try deleting and recreating the app then ' + - 're-run with onUpdate=UpdateApp', + await expect(() => algorand.appDeployer.deploy(deployment2)).rejects.toThrow( + 'Update detected and onUpdate=Fail, stopping deployment. Try a different onUpdate value to not fail.', ) invariant('transaction' in result1) @@ -257,23 +256,23 @@ describe('deploy-app', () => { }) test('Deploy replacement to deletable, updated app', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ deletable: true }) const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, codeInjectionValue: 2, onUpdate: 'replace', }) - const result2 = await algokit.deployApp(deployment2, algod, indexer) + const result2 = await algorand.appDeployer.deploy(deployment2) invariant('transaction' in result1) invariant('transaction' in result2) @@ -282,8 +281,8 @@ describe('deploy-app', () => { invariant(result2.deleteResult) expect(result2.appId).not.toBe(result1.appId) expect(result2.createdMetadata).toEqual(deployment2.metadata) - expect(result2.createdRound).toBe(result2.confirmation.confirmedRound) - expect(result2.updatedRound).toBe(result2.confirmation.confirmedRound) + expect(result2.createdRound).toBe(BigInt(result2.confirmation.confirmedRound!)) + expect(result2.updatedRound).toBe(BigInt(result2.confirmation.confirmedRound!)) expect(result2.name).toBe(deployment2.metadata.name) expect(result2.version).toBe(deployment2.metadata.version) expect(result2.updatable).toBe(deployment2.metadata.updatable) @@ -300,26 +299,26 @@ describe('deploy-app', () => { test('Deploy failure for replacement of permanent, updated app', async () => { algokit.Config.configure({ debug: false }) // Remove noise from snapshot - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ deletable: false }) const deployment1 = (await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, - })) as AppDeploymentParams + })) as AppDeployParams - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = (await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, codeInjectionValue: 2, onUpdate: 'replace', - })) as AppDeploymentParams + })) as AppDeployParams try { - await algokit.deployApp(deployment2, algod, indexer) + await algorand.appDeployer.deploy(deployment2) invariant(false) // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { @@ -337,23 +336,23 @@ describe('deploy-app', () => { }) test('Deploy replacement of deletable schema broken app', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ deletable: true }) const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, breakSchema: true, onSchemaBreak: 'replace', }) - const result2 = await algokit.deployApp(deployment2, algod, indexer) + const result2 = await algorand.appDeployer.deploy(deployment2) invariant('transaction' in result1) invariant('transaction' in result2) @@ -380,26 +379,26 @@ describe('deploy-app', () => { test('Deploy replacement to schema broken, permanent app fails', async () => { algokit.Config.configure({ debug: false }) // Remove noise from snapshot - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata({ deletable: false }) const deployment1 = (await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, - })) as AppDeploymentParams + })) as AppDeployParams - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = (await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, breakSchema: true, onSchemaBreak: 'replace', - })) as AppDeploymentParams + })) as AppDeployParams try { - await algokit.deployApp(deployment2, algod, indexer) + await algorand.appDeployer.deploy(deployment2) invariant(false) // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { @@ -417,23 +416,23 @@ describe('deploy-app', () => { }) test('Deploy failure for replacement of schema broken app fails if onSchemaBreak = Fail', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata() const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, onSchemaBreak: 'fail', breakSchema: true, }) - await expect(() => algokit.deployApp(deployment2, algod, indexer)).rejects.toThrow( + await expect(() => algorand.appDeployer.deploy(deployment2)).rejects.toThrow( 'Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' + 'If you want to try deleting and recreating the app then ' + 're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp', @@ -450,16 +449,16 @@ describe('deploy-app', () => { }) test('Do nothing if deploying app with no changes', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const deployment = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: getMetadata(), }) - const initialDeployment = await algokit.deployApp(deployment, algod, indexer) + const initialDeployment = await algorand.appDeployer.deploy(deployment) await waitForIndexer() logging.testLogger.clear() - const result = await algokit.deployApp(deployment, algod, indexer) + const result = await algorand.appDeployer.deploy(deployment) invariant('transaction' in initialDeployment) invariant(!('transaction' in result)) @@ -483,23 +482,23 @@ describe('deploy-app', () => { }) test('Deploy append for schema broken app if onSchemaBreak = AppendApp', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata() const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, onSchemaBreak: 'append', breakSchema: true, }) - const result2 = await algokit.deployApp(deployment2, algod, indexer) + const result2 = await algorand.appDeployer.deploy(deployment2) invariant('transaction' in result1) invariant('transaction' in result2) @@ -523,23 +522,23 @@ describe('deploy-app', () => { }) test('Deploy append for update app if onUpdate = AppendApp', async () => { - const { algod, indexer, testAccount, waitForIndexer } = localnet.context + const { algorand, testAccount, waitForIndexer } = localnet.context const metadata = getMetadata() const deployment1 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: metadata, }) - const result1 = await algokit.deployApp(deployment1, algod, indexer) + const result1 = await algorand.appDeployer.deploy(deployment1) await waitForIndexer() logging.testLogger.clear() const deployment2 = await getTestingAppDeployParams({ - from: testAccount, + sender: testAccount.addr, metadata: { ...metadata, version: '2.0' }, codeInjectionValue: 3, onUpdate: 'append', }) - const result2 = await algokit.deployApp(deployment2, algod, indexer) + const result2 = await algorand.appDeployer.deploy(deployment2) invariant('transaction' in result1) invariant('transaction' in result2) diff --git a/src/app-deploy.ts b/src/app-deploy.ts index 74967de3..07e830d6 100644 --- a/src/app-deploy.ts +++ b/src/app-deploy.ts @@ -1,8 +1,8 @@ import algosdk from 'algosdk' -import { callApp, compileTeal, createApp, getAppById, updateApp } from './app' -import { Config } from './config' -import { lookupAccountCreatedApplicationByAddress, searchTransactions } from './indexer-lookup' -import { getSenderAddress, sendAtomicTransactionComposer } from './transaction/transaction' +import { compileTeal, getAppOnCompleteAction } from './app' +import { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge' +import { getSenderAddress, getSenderTransactionSigner, getTransactionParams } from './transaction/transaction' +import { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender' import { ABIReturn, APP_DEPLOY_NOTE_DAPP, @@ -12,21 +12,27 @@ import { AppLookup, AppMetadata, CompiledTeal, - DELETABLE_TEMPLATE_NAME, - OnSchemaBreak, - OnUpdate, TealTemplateParams, - UPDATABLE_TEMPLATE_NAME, } from './types/app' +import { AppDeployer } from './types/app-deployer' +import { AppManager, BoxReference } from './types/app-manager' +import { AssetManager } from './types/asset-manager' +import AlgoKitComposer, { + AppCreateMethodCall, + AppCreateParams, + AppDeleteMethodCall, + AppDeleteParams, + AppUpdateMethodCall, + AppUpdateParams, +} from './types/composer' import { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction' import Algodv2 = algosdk.Algodv2 -import AtomicTransactionComposer = algosdk.AtomicTransactionComposer -import getApplicationAddress = algosdk.getApplicationAddress import Indexer = algosdk.Indexer import modelsv2 = algosdk.modelsv2 -import TransactionType = algosdk.TransactionType /** + * @deprecated Use `algorand.appDeployer.deploy` instead. + * * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions. * * 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 @@ -59,351 +65,148 @@ export async function deployApp( | (AppMetadata & { operationPerformed: 'nothing' }) ) > { - const { - metadata, - deployTimeParams: deployTimeParameters, - onSchemaBreak, - onUpdate, - existingDeployments, - createArgs, - updateArgs, - deleteArgs, - createOnCompleteAction, - ...appParams - } = deployment - - if (existingDeployments && existingDeployments.creator !== getSenderAddress(appParams.from)) { - throw new Error( - `Received invalid existingDeployments value for creator ${existingDeployments.creator} when attempting to deploy for creator ${appParams.from}`, - ) - } - if (!existingDeployments && !indexer) { - throw new Error(`Didn't receive an indexer client, but also didn't receive an existingDeployments cache - one of them must be provided`) - } - - Config.getLogger(appParams.suppressLog).info( - `Idempotently deploying app "${metadata.name}" from creator ${getSenderAddress(appParams.from)} using ${ - appParams.approvalProgram.length - } bytes of teal code and ${appParams.clearStateProgram.length} bytes of teal code`, - ) - - const compiledApproval = - typeof appParams.approvalProgram === 'string' - ? await performTemplateSubstitutionAndCompile(appParams.approvalProgram, algod, deployTimeParameters, metadata) - : undefined - appParams.approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : appParams.approvalProgram - - const compiledClear = - typeof appParams.clearStateProgram === 'string' - ? await performTemplateSubstitutionAndCompile(appParams.clearStateProgram, algod, deployTimeParameters) - : undefined - - appParams.clearStateProgram = compiledClear ? compiledClear.compiledBase64ToBytes : appParams.clearStateProgram - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const apps = existingDeployments ?? (await getCreatorAppsByName(appParams.from, indexer!)) - - const create = async ( - atc?: AtomicTransactionComposer, - ): Promise< - Partial & ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' } - > => { - const result = await createApp( - { - ...appParams, - onCompleteAction: createOnCompleteAction, - args: createArgs, - note: getAppDeploymentTransactionNote(metadata), - atc, - skipWaiting: false, - }, + const appManager = new AppManager(algod) + const newGroup = () => + new AlgoKitComposer({ algod, - ) - - return { - transaction: result.transaction, - transactions: result.transactions, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmation: result.confirmation!, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmations: result.confirmations!, - return: result.return, - appId: result.appId, - appAddress: result.appAddress, - createdMetadata: metadata, - createdRound: Number(result.confirmation?.confirmedRound), - updatedRound: Number(result.confirmation?.confirmedRound), - ...metadata, - deleted: false, - operationPerformed: 'create', - compiledApproval, - compiledClear, - } - } - - const existingApp = apps.apps[metadata.name] - - if (!existingApp || existingApp.deleted) { - Config.getLogger(appParams.suppressLog).info( - `App ${metadata.name} not found in apps created by ${getSenderAddress(appParams.from)}; deploying app with version ${ - metadata.version - }.`, - ) - - return await create() - } - - Config.getLogger(appParams.suppressLog).info( - `Existing app ${metadata.name} found by creator ${getSenderAddress(appParams.from)}, with app id ${existingApp.appId} and version ${ - existingApp.version - }.`, + getSigner: () => getSenderTransactionSigner(deployment.from), + getSuggestedParams: async () => await getTransactionParams(deployment.transactionParams, algod), + appManager, + }) + const deployer = new AppDeployer( + appManager, + new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager), + indexer, ) - const existingAppRecord = await getAppById(existingApp.appId, algod) - const existingApproval = Buffer.from(existingAppRecord.params.approvalProgram).toString('base64') - const existingClear = Buffer.from(existingAppRecord.params.clearStateProgram).toString('base64') - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const existingGlobalSchema = existingAppRecord.params.globalStateSchema! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const existingLocalSchema = existingAppRecord.params.localStateSchema! - - const newGlobalSchema = new modelsv2.ApplicationStateSchema({ - numByteSlice: appParams.schema.globalByteSlices, - numUint: appParams.schema.globalInts, - }) - const newLocalSchema = new modelsv2.ApplicationStateSchema({ - numByteSlice: appParams.schema.localByteSlices, - numUint: appParams.schema.localInts, + const createParams = { + approvalProgram: deployment.approvalProgram, + clearStateProgram: deployment.clearStateProgram, + sender: getSenderAddress(deployment.from), + accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))), + appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)), + assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)), + boxReferences: deployment.createArgs?.boxes + ?.map(_getBoxReference) + ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference), + lease: deployment.createArgs?.lease, + rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined, + staticFee: deployment.fee, + maxFee: deployment.maxFee, + extraProgramPages: deployment.schema.extraPages, + onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude< + algosdk.OnApplicationComplete, + algosdk.OnApplicationComplete.ClearStateOC + >, + schema: deployment.schema, + } satisfies Partial + + const updateParams = { + approvalProgram: deployment.approvalProgram, + clearStateProgram: deployment.clearStateProgram, + sender: getSenderAddress(deployment.from), + accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))), + appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)), + assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)), + boxReferences: deployment.updateArgs?.boxes + ?.map(_getBoxReference) + ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference), + lease: deployment.updateArgs?.lease, + rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined, + staticFee: deployment.fee, + maxFee: deployment.maxFee, + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + } satisfies Partial + + const deleteParams = { + sender: getSenderAddress(deployment.from), + accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))), + appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)), + assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)), + boxReferences: deployment.deleteArgs?.boxes + ?.map(_getBoxReference) + ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference), + lease: deployment.deleteArgs?.lease, + rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined, + staticFee: deployment.fee, + maxFee: deployment.maxFee, + onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + } satisfies Partial + + const encoder = new TextEncoder() + + const result = await deployer.deploy({ + createParams: deployment.createArgs?.method + ? ({ + ...createParams, + method: + 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method), + args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs, + } satisfies AppCreateMethodCall) + : ({ + ...createParams, + args: + 'appArgs' in (deployment?.createArgs ?? {}) + ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)) + : undefined, + } satisfies AppCreateParams), + updateParams: deployment.updateArgs?.method + ? ({ + ...updateParams, + method: + 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method), + args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs, + } satisfies Omit) + : ({ + ...updateParams, + args: + 'appArgs' in (deployment?.updateArgs ?? {}) + ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)) + : undefined, + } satisfies Omit), + deleteParams: deployment.deleteArgs?.method + ? ({ + ...deleteParams, + method: + 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method), + args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs, + } satisfies Omit) + : ({ + ...deleteParams, + args: + 'appArgs' in (deployment?.deleteArgs ?? {}) + ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)) + : undefined, + } satisfies Omit), + metadata: deployment.metadata, + deployTimeParams: deployment.deployTimeParams, + onSchemaBreak: deployment.onSchemaBreak, + onUpdate: deployment.onUpdate, + existingDeployments: deployment.existingDeployments + ? { + creator: deployment.existingDeployments.creator, + apps: Object.fromEntries( + Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [ + name, + { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) }, + ]), + ), + } + : undefined, + executeParams: { + maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation, + populateAppCallResources: deployment.populateAppCallResources, + suppressLog: deployment.suppressLog, + }, }) - const newApproval = Buffer.from(appParams.approvalProgram).toString('base64') - const newClear = Buffer.from(appParams.clearStateProgram).toString('base64') - - const isUpdate = newApproval !== existingApproval || newClear !== existingClear - const isSchemaBreak = isSchemaIsBroken(existingGlobalSchema, newGlobalSchema) || isSchemaIsBroken(existingLocalSchema, newLocalSchema) - - const replace = async (): Promise< - Partial & - ConfirmedTransactionResults & - AppMetadata & { - return?: ABIReturn - deleteReturn?: ABIReturn - deleteResult: ConfirmedTransactionResult - operationPerformed: 'replace' - } - > => { - const atc = new AtomicTransactionComposer() - - // Create - - Config.getLogger(appParams.suppressLog).info( - `Deploying a new ${metadata.name} app for ${getSenderAddress(appParams.from)}; deploying app with version ${metadata.version}.`, - ) - - const { transaction: createTransaction } = await create(atc) - const createTransactions = atc.clone().buildGroup() - - // Delete - - Config.getLogger(appParams.suppressLog).warn( - `Deleting existing ${metadata.name} app with id ${existingApp.appId} from ${getSenderAddress(appParams.from)} account.`, - ) - - const { transaction: deleteTransaction } = await callApp( - { - appId: existingApp.appId, - callType: 'delete_application', - from: appParams.from, - args: deleteArgs, - transactionParams: appParams.transactionParams, - suppressLog: appParams.suppressLog, - skipSending: true, - atc, - }, - algod, - ) - - // Ensure create and delete happen atomically - const { transactions, confirmations, returns } = await sendAtomicTransactionComposer( - { - atc, - sendParams: { - maxRoundsToWaitForConfirmation: appParams.maxRoundsToWaitForConfirmation, - skipWaiting: false, - suppressLog: true, - }, - }, - algod, - ) - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const createConfirmation = confirmations![createTransactions.length - 1] - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const deleteConfirmation = confirmations![confirmations!.length - 1] - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const newAppIndex = createConfirmation.applicationIndex! - - Config.getLogger(appParams.suppressLog).warn( - `Sent transactions ${createTransaction.txID()} to create app with id ${newAppIndex} and ${deleteTransaction.txID()} to delete app with id ${ - existingApp.appId - } from ${getSenderAddress(appParams.from)} account.`, - ) - - return { - transaction: createTransaction, - transactions: transactions, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmation: createConfirmation!, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmations: confirmations!, - return: returns?.[0], - deleteReturn: returns?.[1], - appId: newAppIndex, - appAddress: getApplicationAddress(newAppIndex), - createdMetadata: metadata, - createdRound: Number(createConfirmation.confirmedRound), - updatedRound: Number(createConfirmation.confirmedRound), - ...metadata, - deleted: false, - deleteResult: { transaction: deleteTransaction, confirmation: deleteConfirmation }, - operationPerformed: 'replace', - compiledApproval, - compiledClear, - } as Partial & - ConfirmedTransactionResults & - AppMetadata & { deleteResult: ConfirmedTransactionResult; operationPerformed: 'replace' } - } - - const update = async (): Promise< - Partial & ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'update' } - > => { - Config.getLogger(appParams.suppressLog).info( - `Updating existing ${metadata.name} app for ${getSenderAddress(appParams.from)} to version ${metadata.version}.`, - ) - - const result = await updateApp( - { - appId: existingApp.appId, - from: appParams.from, - args: updateArgs, - note: getAppDeploymentTransactionNote(metadata), - approvalProgram: appParams.approvalProgram, - clearStateProgram: appParams.clearStateProgram, - transactionParams: appParams.transactionParams, - suppressLog: appParams.suppressLog, - skipSending: false, - skipWaiting: false, - }, - algod, - ) - - return { - transaction: result.transaction, - transactions: result.transactions, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmation: result.confirmation!, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - confirmations: result.confirmations!, - return: result.return, - appId: existingApp.appId, - appAddress: existingApp.appAddress, - createdMetadata: existingApp.createdMetadata, - createdRound: existingApp.createdRound, - updatedRound: Number(result.confirmation?.confirmedRound), - ...metadata, - deleted: false, - operationPerformed: 'update', - compiledApproval, - compiledClear, - } - } - - if (isSchemaBreak) { - Config.getLogger(appParams.suppressLog).warn(`Detected a breaking app schema change in app ${existingApp.appId}:`, { - from: { - global: existingGlobalSchema, - local: existingLocalSchema, - }, - to: { - global: newGlobalSchema, - local: newLocalSchema, - }, - }) - - if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === OnSchemaBreak.Fail) { - throw new Error( - 'Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' + - 'If you want to try deleting and recreating the app then ' + - 're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp', - ) - } - - if (onSchemaBreak === 'append' || onSchemaBreak === OnSchemaBreak.AppendApp) { - Config.getLogger(appParams.suppressLog).info('onSchemaBreak=AppendApp, will attempt to create a new app') - return await create() - } - - if (existingApp.deletable) { - Config.getLogger(appParams.suppressLog).info( - 'App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app', - ) - } else { - Config.getLogger(appParams.suppressLog).info( - 'App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail', - ) - } - - return await replace() - } - - if (isUpdate) { - Config.getLogger(appParams.suppressLog).info( - `Detected a TEAL update in app ${existingApp.appId} for creator ${getSenderAddress(appParams.from)}`, - ) - - if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === OnUpdate.Fail) { - throw new Error( - 'Update detected and onUpdate=Fail, stopping deployment. ' + - 'If you want to try deleting and recreating the app then ' + - 're-run with onUpdate=UpdateApp', - ) - } - - if (onUpdate === 'append' || onUpdate === OnUpdate.AppendApp) { - Config.getLogger(appParams.suppressLog).info('onUpdate=AppendApp, will attempt to create a new app') - return await create() - } - - if (onUpdate === 'update' || onUpdate === OnUpdate.UpdateApp) { - if (existingApp.updatable) { - Config.getLogger(appParams.suppressLog).info(`App is updatable and onUpdate=UpdateApp, updating app...`) - } else { - Config.getLogger(appParams.suppressLog).warn( - `App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`, - ) - } - return await update() - } - - if (onUpdate === 'replace' || onUpdate === OnUpdate.ReplaceApp) { - if (existingApp.deletable) { - Config.getLogger(appParams.suppressLog).warn('App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...') - } else { - Config.getLogger(appParams.suppressLog).warn( - 'App is not deletable and onUpdate=ReplaceApp, will attempt to create new app and delete old app, delete will most likely fail', - ) - } - - return await replace() - } - } - - Config.getLogger(appParams.suppressLog).debug('No detected changes in app, nothing to do.') - - return { ...existingApp, operationPerformed: 'nothing', compiledApproval, compiledClear } + return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) } } -/** Returns true is there is a breaking change in the application state schema from before to after. +/** + * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead. + * + * Returns true is there is a breaking change in the application state schema from before to after. * i.e. if the schema becomes larger, since applications can't ask for more schema after creation. * Otherwise, there is no error, the app just doesn't store data in the extra schema :( * @@ -416,6 +219,8 @@ export function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: } /** + * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead. + * * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction. * * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls). @@ -425,108 +230,22 @@ export function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: * @returns A name-based lookup of the app information (id, address) */ export async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise { - const appLookup: Record = {} - - const creatorAddress = typeof creatorAccount !== 'string' ? getSenderAddress(creatorAccount) : creatorAccount - - // Extract all apps that account created - const createdApps = (await lookupAccountCreatedApplicationByAddress(indexer, creatorAddress)) - .map((a) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return { id: a.id, createdAtRound: a['created-at-round']!, deleted: a.deleted } - }) - .sort((a, b) => a.createdAtRound - b.createdAtRound) - - // For each app that account created (in parallel)... - const apps = await Promise.all( - createdApps.map(async (createdApp) => { - // Find any app transactions for that app in the round it was created (should always just be a single creation transaction) - const appTransactions = await searchTransactions(indexer, (s) => - s - .minRound(createdApp.createdAtRound) - .txType(TransactionType.appl) - .applicationID(createdApp.id) - .address(creatorAddress) - .addressRole('sender') - .notePrefix(Buffer.from(APP_DEPLOY_NOTE_DAPP).toString('base64')), - ) - - // Triple check the transaction is intact by filtering for the one we want: - // * application-id is 0 when the app is first created - // * also verify the sender to prevent a potential security risk - const appCreationTransaction = appTransactions.transactions.filter( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (t) => t['application-transaction']!['application-id'] === 0 && t.sender === creatorAddress, - )[0] - - const latestAppUpdateTransaction = appTransactions.transactions - .filter((t) => t.sender === creatorAddress) - .sort((a, b) => - a['confirmed-round'] === b['confirmed-round'] - ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (b['intra-round-offset']! - a['intra-round-offset']!) / 10 - : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - b['confirmed-round']! - a['confirmed-round']!, - )[0] - - if (!appCreationTransaction?.note) - // No note; ignoring - return null - - return { createdApp, appCreationTransaction, latestAppUpdateTransaction } - }), - ) - - apps - .filter((a) => a !== null) - .forEach((a) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const { createdApp, appCreationTransaction, latestAppUpdateTransaction } = a! - - const parseNote = (note?: string) => { - if (!note) { - // No note; ignoring... - return - } - - const decoder = new TextDecoder() - const noteAsBase64 = decoder.decode(Buffer.from(note)) - const noteAsString = Buffer.from(noteAsBase64, 'base64').toString('utf-8') - - if (!noteAsString.startsWith(`${APP_DEPLOY_NOTE_DAPP}:j{`)) - // Clearly not APP_DEPLOY JSON; ignoring... - return - - return JSON.parse(noteAsString.substring(APP_DEPLOY_NOTE_DAPP.length + 2)) as AppDeployMetadata - } - - try { - const creationNote = parseNote(appCreationTransaction.note) - const updateNote = parseNote(latestAppUpdateTransaction.note) - if (creationNote?.name) { - appLookup[creationNote.name] = { - appId: createdApp.id, - appAddress: getApplicationAddress(createdApp.id), - createdMetadata: creationNote, - createdRound: Number(appCreationTransaction['confirmed-round']), - ...(updateNote ?? creationNote), - updatedRound: Number(latestAppUpdateTransaction?.['confirmed-round']), - deleted: createdApp.deleted ?? false, - } - } - } catch (e) { - Config.logger.warn(`Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, e) - return - } - }) + const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount)) return { - creator: creatorAddress, - apps: appLookup, + creator: lookup.creator, + apps: Object.fromEntries( + Object.entries(lookup.apps).map(([name, app]) => [ + name, + { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) }, + ]), + ), } } /** + * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead. + * * Return the transaction note for an app deployment. * @param metadata The metadata of the deployment * @returns The transaction note as a utf-8 string @@ -540,6 +259,8 @@ export function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Ar } /** + * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead + * * Replaces deploy-time deployment control parameters within the given teal code. * * * `TMPL_UPDATABLE` for updatability / immutability control @@ -553,28 +274,12 @@ export function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Ar * @returns The replaced TEAL code */ export function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) { - if (params.updatable !== undefined) { - if (!tealCode.includes(UPDATABLE_TEMPLATE_NAME)) { - throw new Error( - `Deploy-time updatability control requested for app deployment, but ${UPDATABLE_TEMPLATE_NAME} not present in TEAL code`, - ) - } - tealCode = tealCode.replace(new RegExp(UPDATABLE_TEMPLATE_NAME, 'g'), (params.updatable ? 1 : 0).toString()) - } - - if (params.deletable !== undefined) { - if (!tealCode.includes(DELETABLE_TEMPLATE_NAME)) { - throw new Error( - `Deploy-time deletability control requested for app deployment, but ${DELETABLE_TEMPLATE_NAME} not present in TEAL code`, - ) - } - tealCode = tealCode.replace(new RegExp(DELETABLE_TEMPLATE_NAME, 'g'), (params.deletable ? 1 : 0).toString()) - } - - return tealCode + return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params) } /** + * @deprecated Use `AppManager.replaceTealTemplateParams` instead + * * Performs template substitution of a teal file. * * Looks for `TMPL_{parameter}` for template replacements. @@ -584,34 +289,12 @@ export function replaceDeployTimeControlParams(tealCode: string, params: { updat * @returns The TEAL code with replacements */ export function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) { - if (templateParams !== undefined) { - for (const key in templateParams) { - const value = templateParams[key] - const token = `TMPL_${key.replace(/^TMPL_/, '')}` - - // If this is a number, first replace any byte representations of the number - // These may appear in the TEAL in order to circumvent int compression and preserve PC values - if (typeof value === 'number' || typeof value === 'boolean') { - tealCode = tealCode.replace(new RegExp(`(?<=bytes )${token}`, 'g'), `0x${value.toString(16).padStart(16, '0')}`) - - // We could probably return here since mixing pushint and pushbytes is likely not going to happen, but might as well do both - } - - tealCode = tealCode.replace( - new RegExp(token, 'g'), - typeof value === 'string' - ? `0x${Buffer.from(value, 'utf-8').toString('hex')}` - : ArrayBuffer.isView(value) - ? `0x${Buffer.from(value).toString('hex')}` - : value.toString(), - ) - } - } - - return tealCode + return AppManager.replaceTealTemplateParams(tealCode, templateParams) } /** + * @deprecated Use `algorand.appManager.compileTealTemplate` instead. + * * Performs template substitution of a teal file and compiles it, returning the compiled result. * * Looks for `TMPL_{parameter}` for template replacements. @@ -640,6 +323,8 @@ export async function performTemplateSubstitutionAndCompile( } /** + * @deprecated Use `AppManager.stripTealComments` instead. + * * Remove comments from TEAL Code * * @param tealCode The TEAL logic to compile diff --git a/src/app.spec.ts b/src/app.spec.ts index 25810ecc..1ca5ed74 100644 --- a/src/app.spec.ts +++ b/src/app.spec.ts @@ -1,7 +1,6 @@ import { describe, test } from '@jest/globals' import algosdk from 'algosdk' import { getTestingAppContract } from '../tests/example-contracts/testing-app/contract' -import * as algokit from './' import { algoKitLogCaptureFixture, algorandFixture } from './testing' describe('app', () => { @@ -11,53 +10,41 @@ describe('app', () => { const logging = algoKitLogCaptureFixture() beforeEach(logging.beforeEach) afterEach(logging.afterEach) - - test('createApp creates an app', async () => { - const { algod, testAccount } = localnet.context + test('appCreate creates an app', async () => { + const { algorand, testAccount } = localnet.context const contract = await getTestingAppContract() - const app = await algokit.createApp( - { - approvalProgram: contract.approvalProgram.replace('TMPL_UPDATABLE', '0').replace('TMPL_DELETABLE', '0').replace('TMPL_VALUE', '1'), - clearStateProgram: contract.clearStateProgram, - schema: contract.stateSchema, - from: testAccount, - }, - algod, - ) + const app = await algorand.send.appCreate({ + approvalProgram: contract.approvalProgram.replace('TMPL_UPDATABLE', '0').replace('TMPL_DELETABLE', '0').replace('TMPL_VALUE', '1'), + clearStateProgram: contract.clearStateProgram, + schema: contract.stateSchema, + sender: testAccount.addr, + }) expect(app.appId).toBeGreaterThan(0) expect(app.appAddress).toBe(algosdk.getApplicationAddress(app.appId)) expect(app.confirmation).toBeTruthy() - expect(app.confirmation?.applicationIndex).toBe(app.appId) + expect(BigInt(app.confirmation?.applicationIndex ?? 0)).toBe(app.appId) }) - test('createApp with rekey performs rekey', async () => { - const { algod, algorand, testAccount } = localnet.context + test('appCreate with rekey performs rekey', async () => { + const { algorand, testAccount } = localnet.context const rekeyTo = algorand.account.random() const contract = await getTestingAppContract() - await algokit.createApp( - { - approvalProgram: contract.approvalProgram.replace('TMPL_UPDATABLE', '0').replace('TMPL_DELETABLE', '0').replace('TMPL_VALUE', '1'), - clearStateProgram: contract.clearStateProgram, - schema: contract.stateSchema, - from: testAccount, - args: { - rekeyTo: rekeyTo, - }, - }, - algod, - ) + await algorand.send.appCreate({ + approvalProgram: contract.approvalProgram.replace('TMPL_UPDATABLE', '0').replace('TMPL_DELETABLE', '0').replace('TMPL_VALUE', '1'), + clearStateProgram: contract.clearStateProgram, + schema: contract.stateSchema, + sender: testAccount.addr, + rekeyTo: rekeyTo.addr, + }) // If the rekey didn't work this will throw const rekeyedAccount = algorand.account.rekeyed(testAccount.addr, rekeyTo) - await algokit.transferAlgos( - { - amount: (0).algo(), - from: rekeyedAccount, - to: testAccount, - }, - algod, - ) + await algorand.send.payment({ + amount: (0).algo(), + sender: rekeyedAccount.addr, + receiver: testAccount.addr, + }) }) }) diff --git a/src/app.ts b/src/app.ts index 8e8aea7b..b1557906 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,21 +1,9 @@ import algosdk from 'algosdk' -import { Buffer } from 'buffer' -import { Config } from './config' -import { - controlFees, - encodeLease, - encodeTransactionNote, - getAtomicTransactionComposerTransactions, - getSenderAddress, - getSenderTransactionSigner, - getTransactionParams, - sendAtomicTransactionComposer, - sendTransaction, -} from './transaction/transaction' +import { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge' +import { encodeLease, getSenderAddress } from './transaction/transaction' import { ABIAppCallArgs, ABIReturn, - APP_PAGE_MAX_SIZE, AppCallArgs, AppCallParams, AppCallTransactionResult, @@ -33,21 +21,23 @@ import { RawAppCallArgs, UpdateAppParams, } from './types/app' -import { SendTransactionFrom, SendTransactionParams } from './types/transaction' +import { AppManager } from './types/app-manager' +import { SendTransactionFrom } from './types/transaction' import { toNumber } from './util' import ABIMethod = algosdk.ABIMethod import ABIMethodParams = algosdk.ABIMethodParams -import ABIResult = algosdk.ABIResult import ABIValue = algosdk.ABIValue import Address = algosdk.Address import Algodv2 = algosdk.Algodv2 import AtomicTransactionComposer = algosdk.AtomicTransactionComposer import modelsv2 = algosdk.modelsv2 import OnApplicationComplete = algosdk.OnApplicationComplete -import SourceMap = algosdk.SourceMap import Transaction = algosdk.Transaction /** + * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()` + * / `algorand.transactions.appCreateMethodCall()` instead + * * Creates a smart contract app, returns the details of the created app. * @param create The parameters to create the app with * @param algod An algod client @@ -57,129 +47,53 @@ export async function createApp( create: CreateAppParams, algod: Algodv2, ): Promise & AppCallTransactionResult & AppReference> { - const { - from, - approvalProgram: approval, - clearStateProgram: clear, - schema, - note, - transactionParams, - args, - onCompleteAction, - ...sendParams - } = create - - const compiledApproval = typeof approval === 'string' ? await compileTeal(approval, algod) : undefined - const approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : approval - const compiledClear = typeof clear === 'string' ? await compileTeal(clear, algod) : undefined - const clearProgram = compiledClear ? compiledClear.compiledBase64ToBytes : clear - - if (args && args.method) { - const atc = attachATC(sendParams) - - const before = getAtomicTransactionComposerTransactions(atc) - - atc.addMethodCall({ - appID: 0, - approvalProgram: approvalProgram as Uint8Array, - clearProgram: clearProgram as Uint8Array, - numLocalInts: schema.localInts, - numLocalByteSlices: schema.localByteSlices, - numGlobalInts: schema.globalInts, - numGlobalByteSlices: schema.globalByteSlices, - extraPages: schema.extraPages ?? Math.floor((approvalProgram.length + clearProgram.length) / APP_PAGE_MAX_SIZE), - onComplete: getAppOnCompleteAction(onCompleteAction), - suggestedParams: controlFees(await getTransactionParams(transactionParams, algod), sendParams), - note: encodeTransactionNote(note), - ...(await getAppArgsForABICall(args, from)), - }) - - if (sendParams.skipSending) { - const after = atc.clone().buildGroup() - return { - transaction: after[after.length - 1].txn, - transactions: after.slice(before.length).map((t) => t.txn), - appId: 0, - appAddress: '', - compiledApproval, - compiledClear, - } - } - - const result = await sendAtomicTransactionComposer({ atc, sendParams }, algod) - const confirmation = result.confirmations ? result.confirmations[result.confirmations?.length - 1] : undefined - if (confirmation) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const appId = confirmation.applicationIndex! - - Config.getLogger(sendParams.suppressLog).debug(`Created app ${appId} from creator ${getSenderAddress(from)}`) - - return { - transactions: result.transactions, - confirmations: result.confirmations, - return: confirmation ? getABIReturn(args, confirmation) : undefined, - transaction: result.transactions[result.transactions.length - 1], - confirmation: confirmation, - appId, - appAddress: algosdk.getApplicationAddress(appId), - compiledApproval, - compiledClear, - } - } else { - return { - transactions: result.transactions, - confirmations: result.confirmations, - return: confirmation ? getABIReturn(args, confirmation) : undefined, - transaction: result.transactions[result.transactions.length - 1], - confirmation: confirmation, - appId: 0, - appAddress: '', - compiledApproval, - compiledClear, - } - } - } else { - const transaction = algosdk.makeApplicationCreateTxnFromObject({ - approvalProgram: approvalProgram as Uint8Array, - clearProgram: clearProgram as Uint8Array, - numLocalInts: schema.localInts, - numLocalByteSlices: schema.localByteSlices, - numGlobalInts: schema.globalInts, - numGlobalByteSlices: schema.globalByteSlices, - extraPages: schema.extraPages ?? Math.floor((approvalProgram.length + clearProgram.length) / APP_PAGE_MAX_SIZE), - onComplete: getAppOnCompleteAction(onCompleteAction), - suggestedParams: await getTransactionParams(transactionParams, algod), - from: getSenderAddress(from), - note: encodeTransactionNote(note), - ...getAppArgsForTransaction(args), - rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined, - }) - - const { confirmation } = await sendTransaction({ transaction, from, sendParams }, algod) - if (confirmation) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const appId = confirmation.applicationIndex! - - Config.getLogger(sendParams.suppressLog).debug(`Created app ${appId} from creator ${getSenderAddress(from)}`) - - return { - transaction, - transactions: [transaction], - confirmation, - confirmations: confirmation ? [confirmation] : undefined, - appId, - appAddress: algosdk.getApplicationAddress(appId), - return: getABIReturn(args, confirmation), - compiledApproval, - compiledClear, - } - } else { - return { transaction, transactions: [transaction], appId: 0, appAddress: '', compiledApproval, compiledClear } - } + const onComplete = getAppOnCompleteAction(create.onCompleteAction) + if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) { + throw new Error('Cannot create an app with on-complete action of ClearState') } + + const result = create.args?.method + ? await legacySendAppTransactionBridge( + algod, + create.from, + create.args, + create, + { + sender: getSenderAddress(create.from), + onComplete, + approvalProgram: create.approvalProgram, + clearStateProgram: create.clearStateProgram, + method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method), + extraProgramPages: create.schema.extraPages, + schema: create.schema, + }, + (c) => c.appCreateMethodCall, + (c) => c.appCreateMethodCall, + ) + : await legacySendAppTransactionBridge( + algod, + create.from, + create.args, + create, + { + sender: getSenderAddress(create.from), + onComplete, + approvalProgram: create.approvalProgram, + clearStateProgram: create.clearStateProgram, + extraProgramPages: create.schema.extraPages, + schema: create.schema, + }, + (c) => c.appCreate, + (c) => c.appCreate, + ) + + return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' } } /** + * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` + * / `algorand.transactions.appUpdateMethodCall()` instead + * * Updates a smart contract app. * @param update The parameters to update the app with * @param algod An algod client @@ -189,81 +103,44 @@ export async function updateApp( update: UpdateAppParams, algod: Algodv2, ): Promise & AppCallTransactionResult> { - const { appId, from, approvalProgram: approval, clearStateProgram: clear, note, transactionParams, args, ...sendParams } = update - - const compiledApproval = typeof approval === 'string' ? await compileTeal(approval, algod) : undefined - const approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : approval - const compiledClear = typeof clear === 'string' ? await compileTeal(clear, algod) : undefined - const clearProgram = compiledClear ? compiledClear.compiledBase64ToBytes : clear - - Config.getLogger(sendParams.suppressLog).debug(`Updating app ${appId}`) - - if (args && args.method) { - const atc = attachATC(sendParams) - - const before = getAtomicTransactionComposerTransactions(atc) - - atc.addMethodCall({ - appID: toNumber(appId), - onComplete: OnApplicationComplete.UpdateApplicationOC, - approvalProgram: approvalProgram as Uint8Array, - clearProgram: clearProgram as Uint8Array, - suggestedParams: controlFees(await getTransactionParams(transactionParams, algod), sendParams), - note: encodeTransactionNote(note), - ...(await getAppArgsForABICall(args, from)), - }) - - if (sendParams.skipSending) { - const after = atc.clone().buildGroup() - return { - transaction: after[after.length - 1].txn, - transactions: after.slice(before.length).map((t) => t.txn), - } - } - - const result = await sendAtomicTransactionComposer({ atc, sendParams }, algod) - const confirmation = result.confirmations ? result.confirmations[result.confirmations?.length - 1] : undefined - return { - transactions: result.transactions, - confirmations: result.confirmations, - return: confirmation ? getABIReturn(args, confirmation) : undefined, - transaction: result.transactions[result.transactions.length - 1], - confirmation: confirmation, - } - } else { - const transaction = algosdk.makeApplicationUpdateTxnFromObject({ - appIndex: toNumber(appId), - approvalProgram: approvalProgram as Uint8Array, - clearProgram: clearProgram as Uint8Array, - suggestedParams: await getTransactionParams(transactionParams, algod), - from: getSenderAddress(from), - note: encodeTransactionNote(note), - ...getAppArgsForTransaction(args), - rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined, - }) - - const result = await sendTransaction({ transaction, from, sendParams }, algod) - - return { - ...result, - transactions: [result.transaction], - confirmations: result.confirmation ? [result.confirmation] : undefined, - return: getABIReturn(args, result.confirmation), - compiledApproval, - compiledClear, - } - } -} - -function attachATC(sendParams: SendTransactionParams) { - if (sendParams.atc) { - sendParams.skipSending = true - } - sendParams.atc = sendParams.atc ?? new AtomicTransactionComposer() - return sendParams.atc + return update.args?.method + ? await legacySendAppTransactionBridge( + algod, + update.from, + update.args, + update, + { + appId: BigInt(update.appId), + sender: getSenderAddress(update.from), + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + approvalProgram: update.approvalProgram, + clearStateProgram: update.clearStateProgram, + method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method), + }, + (c) => c.appUpdateMethodCall, + (c) => c.appUpdateMethodCall, + ) + : await legacySendAppTransactionBridge( + algod, + update.from, + update.args, + update, + { + appId: BigInt(update.appId), + sender: getSenderAddress(update.from), + onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + approvalProgram: update.approvalProgram, + clearStateProgram: update.clearStateProgram, + }, + (c) => c.appUpdate, + (c) => c.appUpdate, + ) } -/** Returns an `algosdk.OnApplicationComplete` for the given onCompleteAction. +/** + * @deprecated Use `algosdk.OnApplicationComplete` directly instead. + * + * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction. * * If given `undefined` will return `OnApplicationComplete.NoOpOC`. * @@ -297,87 +174,53 @@ export function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnAppl } /** + * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` + * / `algorand.transactions.appUpdateMethodCall()` instead + * * Issues a call to a given app. * @param call The call details. * @param algod An algod client * @returns The result of the call */ export async function callApp(call: AppCallParams, algod: Algodv2): Promise { - const { appId, callType, from, args, note, transactionParams, ...sendParams } = call - - if (args && args.method) { - const atc = attachATC(sendParams) - - const before = getAtomicTransactionComposerTransactions(atc) - - atc.addMethodCall({ - appID: toNumber(appId), - suggestedParams: controlFees(await getTransactionParams(transactionParams, algod), sendParams), - note: encodeTransactionNote(note), - onComplete: getAppOnCompleteAction(callType), - ...(await getAppArgsForABICall(args, from)), - }) - - if (sendParams.skipSending) { - const after = atc.clone().buildGroup() - return { - transaction: after[after.length - 1].txn, - transactions: after.slice(before.length).map((t) => t.txn), - } - } - - const result = await sendAtomicTransactionComposer({ atc, sendParams }, algod) - const confirmation = result.confirmations ? result.confirmations[result.confirmations?.length - 1] : undefined - return { - transactions: result.transactions, - confirmations: result.confirmations, - return: confirmation ? getABIReturn(args, confirmation) : undefined, - transaction: result.transactions[result.transactions.length - 1], - confirmation: confirmation, - } - } - - const appCallParams = { - appIndex: toNumber(appId), - from: getSenderAddress(from), - suggestedParams: await getTransactionParams(transactionParams, algod), - ...getAppArgsForTransaction(args), - note: encodeTransactionNote(note), - rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined, + const onComplete = getAppOnCompleteAction(call.callType) + if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) { + throw new Error('Cannot execute an app call with on-complete action of Update') } - let transaction: Transaction - switch (getAppOnCompleteAction(callType)) { - case OnApplicationComplete.OptInOC: - transaction = algosdk.makeApplicationOptInTxnFromObject(appCallParams) - break - case OnApplicationComplete.ClearStateOC: - transaction = algosdk.makeApplicationClearStateTxnFromObject(appCallParams) - break - case OnApplicationComplete.CloseOutOC: - transaction = algosdk.makeApplicationCloseOutTxnFromObject(appCallParams) - break - case OnApplicationComplete.DeleteApplicationOC: - transaction = algosdk.makeApplicationDeleteTxnFromObject(appCallParams) - break - case OnApplicationComplete.NoOpOC: - transaction = algosdk.makeApplicationNoOpTxnFromObject(appCallParams) - break - default: - throw new Error(`Received unexpected call type ${callType}`) - } - - const result = await sendTransaction({ transaction, from, sendParams }, algod) - - return { - ...result, - transactions: [result.transaction], - confirmations: result.confirmation ? [result.confirmation] : undefined, - return: getABIReturn(args, result.confirmation), - } + return call.args?.method + ? await legacySendAppTransactionBridge( + algod, + call.from, + call.args, + call, + { + appId: BigInt(call.appId), + sender: getSenderAddress(call.from), + onComplete, + method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method), + }, + (c) => c.appCallMethodCall, + (c) => c.appCallMethodCall, + ) + : await legacySendAppTransactionBridge( + algod, + call.from, + call.args, + call, + { + appId: BigInt(call.appId), + sender: getSenderAddress(call.from), + onComplete, + }, + (c) => c.appCall, + (c) => c.appCall, + ) } /** + * @deprecated Use `AppManager.getABIReturn` instead. + * * Returns any ABI return values for the given app call arguments and transaction confirmation. * @param args The arguments that were used for the call * @param confirmation The transaction confirmation from algod @@ -389,47 +232,24 @@ export function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.Pending } const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method) - if (method.returns.type !== 'void' && confirmation) { - // The parseMethodResponse method mutates the second parameter :( - const resultDummy: ABIResult = { - txID: '', - method, - rawReturnValue: new Uint8Array(), - } - const response = AtomicTransactionComposer.parseMethodResponse(method, resultDummy, confirmation) - return !response.decodeError - ? { - rawReturnValue: response.rawReturnValue, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - returnValue: response.returnValue!, - decodeError: undefined, - } - : { - rawReturnValue: undefined, - returnValue: undefined, - decodeError: response.decodeError, - } - } - return undefined + return AppManager.getABIReturn(confirmation, method) } /** + * @deprecated Use `(await appManager.getById(appId)).globalState` instead. + * * Returns the current global state values for the given app ID * @param appId The ID of the app return global state for * @param algod An algod client instance * @returns The current global state */ export async function getAppGlobalState(appId: number | bigint, algod: Algodv2) { - const appInfo = await getAppById(appId, algod) - - if (!appInfo.params || !appInfo.params.globalState) { - throw new Error("Couldn't find global state") - } - - return decodeAppState(appInfo.params.globalState) + return (await new AppManager(algod).getById(BigInt(appId))).globalState } /** + * @deprecated Use `algorand.app.getLocalState` instead. + * * Returns the current global state values for the given app ID and account * @param appId The ID of the app return global state for * @param account Either the string address of an account or an account object for the account to get local state for the given app @@ -437,36 +257,22 @@ export async function getAppGlobalState(appId: number | bigint, algod: Algodv2) * @returns The current local state for the given (app, account) combination */ export async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) { - const accountAddress = typeof account === 'string' ? account : getSenderAddress(account) - const appInfo = modelsv2.AccountApplicationResponse.from_obj_for_encoding( - await algod.accountApplicationInformation(accountAddress, toNumber(appId)).do(), - ) - - if (!appInfo.appLocalState?.keyValue) { - throw new Error("Couldn't find local state") - } - - return decodeAppState(appInfo.appLocalState.keyValue) + return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account)) } /** + * @deprecated Use `algorand.app.getBoxNames` instead. * Returns the names of the boxes for the given app. * @param appId The ID of the app return box names for * @param algod An algod client instance * @returns The current box names */ export async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise { - const boxResult = await algod.getApplicationBoxes(toNumber(appId)).do() - return boxResult.boxes.map((b) => { - return { - nameRaw: b.name, - nameBase64: Buffer.from(b.name).toString('base64'), - name: Buffer.from(b.name).toString('utf-8'), - } - }) + return new AppManager(algod).getBoxNames(BigInt(appId)) } /** + * @deprecated Use `algorand.app.getBoxValue` instead. * Returns the value of the given box name for the given app. * @param appId The ID of the app return box names for * @param boxName The name of the box to return either as a string, binary array or `BoxName` @@ -474,12 +280,11 @@ export async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Pr * @returns The current box value as a byte array */ export async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise { - const name = typeof boxName === 'string' ? new Uint8Array(Buffer.from(boxName, 'utf-8')) : 'name' in boxName ? boxName.nameRaw : boxName - const boxResult = await algod.getApplicationBoxByName(toNumber(appId), name).do() - return boxResult.value + return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName) } /** + * @deprecated Use `algorand.app.getBoxValues` instead. * Returns the value of the given box names for the given app. * @param appId The ID of the app return box names for * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName` @@ -487,81 +292,57 @@ export async function getAppBoxValue(appId: number | bigint, boxName: string | U * @returns The current box values as a byte array in the same order as the passed in box names */ export async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise { - return await Promise.all(boxNames.map(async (boxName) => await getAppBoxValue(appId, boxName, algod))) + return new AppManager(algod).getBoxValues( + BigInt(appId), + boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)), + ) } /** + * @deprecated Use `algorand.app.getBoxValueFromABIType` instead. * Returns the value of the given box name for the given app decoded based on the given ABI type. * @param request The parameters for the box value request * @param algod An algod client instance * @returns The current box value as an ABI value */ export async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise { - const { appId, boxName, type } = request - const value = await getAppBoxValue(appId, boxName, algod) - return type.decode(value) + return new AppManager(algod).getBoxValueFromABIType({ + appId: BigInt(request.appId), + boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName, + type: request.type, + }) } /** + * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead. * Returns the value of the given box names for the given app decoded based on the given ABI type. * @param request The parameters for the box value request * @param algod An algod client instance * @returns The current box values as an ABI value in the same order as the passed in box names */ export async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise { - const { appId, boxNames, type } = request - return await Promise.all(boxNames.map(async (boxName) => await getAppBoxValueFromABIType({ appId, boxName, type }, algod))) + return new AppManager(algod).getBoxValuesFromABIType({ + appId: BigInt(request.appId), + boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)), + type: request.type, + }) } /** + * @deprecated Use `AppManager.decodeAppState` instead. + * * Converts an array of global/local state values from the algod api to a more friendly * generic object keyed by the UTF-8 value of the key. * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas` * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values */ export function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState { - const stateValues = {} as AppState - - // Start with empty set - for (const stateVal of state) { - const keyBase64 = stateVal.key - const keyRaw = Buffer.from(keyBase64, 'base64') - const key = keyRaw.toString('utf-8') - const tealValue = stateVal.value - - const dataTypeFlag = 'action' in tealValue ? tealValue.action : tealValue.type - let valueBase64: string - let valueRaw: Buffer - switch (dataTypeFlag) { - case 1: - valueBase64 = tealValue.bytes ?? '' - valueRaw = Buffer.from(valueBase64, 'base64') - stateValues[key] = { - keyRaw, - keyBase64, - valueRaw: new Uint8Array(valueRaw), - valueBase64: valueBase64, - value: valueRaw.toString('utf-8'), - } - break - case 2: { - const value = tealValue.uint ?? 0 - stateValues[key] = { - keyRaw, - keyBase64, - value, - } - break - } - default: - throw new Error(`Received unknown state data type of ${dataTypeFlag}`) - } - } - - return stateValues + return AppManager.decodeAppState(state) } /** + * @deprecated Use `AlgoKitComposer` methods to construct transactions instead. + * * Returns the app args ready to load onto an app `Transaction` object * @param args The app call args * @returns The args ready to load into a `Transaction` @@ -581,69 +362,26 @@ export function getAppArgsForTransaction(args?: RawAppCallArgs) { } /** + * @deprecated Use `AlgoKitComposer` methods to construct transactions instead. + * * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer` * @param args The ABI app call args * @param from The transaction signer * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer */ export async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) { - const signer = getSenderTransactionSigner(from) - const methodArgs = await Promise.all( - ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => { - if (a === undefined) { - throw new Error(`Argument at position ${index} does not have a value`) - } - if (typeof a !== 'object') { - return a - } - // Handle the various forms of transactions to wrangle them for ATC - return 'txn' in a - ? a - : a instanceof Promise - ? { txn: (await a).transaction, signer } - : 'transaction' in a - ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer } - : 'txID' in a - ? { txn: a, signer } - : a - }), - ) - return { - method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method), - sender: getSenderAddress(from), - signer: signer, - boxes: args.boxes?.map(getBoxReference), - lease: encodeLease(args.lease), - appForeignApps: args.apps, - appForeignAssets: args.assets, - appAccounts: args.accounts?.map(_getAccountAddress), - methodArgs: methodArgs, - rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined, - } + return _getAppArgsForABICall(args, from) } /** + * @deprecated Use `AppManager.getBoxReference()` instead. + * * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. * @param box The box to return a reference for * @returns The box reference ready to pass into a `Transaction` */ export function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference { - const encoder = new TextEncoder() - - if (typeof box === 'object' && 'appIndex' in box) { - return box - } - - const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box } - return { - appIndex: ref.appId, - name: - typeof ref.name === 'string' - ? encoder.encode(ref.name) - : 'length' in ref.name - ? ref.name - : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey, - } as algosdk.BoxReference + return _getBoxReference(box) } function _getAccountAddress(account: string | Address) { @@ -651,6 +389,8 @@ function _getAccountAddress(account: string | Address) { } /** + * @deprecated Use `algorand.app.getById` instead. + * * Gets the current data for the given app from algod. * * @param appId The id of the app @@ -662,6 +402,8 @@ export async function getAppById(appId: number | bigint, algod: Algodv2) { } /** + * @deprecated Use `algorand.app.compileTeal` instead. + * * Compiles the given TEAL using algod and returns the result, including source map. * * @param algod An algod client @@ -669,17 +411,12 @@ export async function getAppById(appId: number | bigint, algod: Algodv2) { * @returns The information about the compiled file */ export async function compileTeal(tealCode: string, algod: Algodv2): Promise { - const compiled = await algod.compile(tealCode).sourcemap(true).do() - return { - teal: tealCode, - compiled: compiled.result, - compiledHash: compiled.hash, - compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')), - sourceMap: new SourceMap(compiled['sourcemap']), - } + return await new AppManager(algod).compileTeal(tealCode) } /** + * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead. + * * Returns the encoded ABI spec for a given ABI Method * @param method The method to return a signature for * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string` diff --git a/src/asset.ts b/src/asset.ts index 4ee93f34..dac56b02 100644 --- a/src/asset.ts +++ b/src/asset.ts @@ -9,7 +9,7 @@ import { SendTransactionResult } from './types/transaction' import Algodv2 = algosdk.Algodv2 /** - * @deprecated use `algorandClient.send.assetCreate()` / `algorandClient.transaction.assetCreate()` instead + * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead * * Create an Algorand Standard Asset (ASA). * @param create The asset creation definition @@ -53,7 +53,7 @@ export async function createAsset( } /** - * @deprecated use `algorandClient.send.assetOptIn()` / `algorandClient.transaction.assetOptIn()` instead + * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead * * Opt-in an account to an asset. * @param optIn The opt-in definition @@ -84,7 +84,7 @@ export async function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promi } /** - * @deprecated use `algorandClient.send.assetOptOut()` / `algorandClient.transaction.assetOptOut()` instead + * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead * * Opt-out an account from an asset. * @param optOut The opt-in definition @@ -118,7 +118,7 @@ export async function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Pr } /** - * @deprecated use `algorandClient.asset.bulkOptIn()` instead + * @deprecated use `algorand.asset.bulkOptIn()` instead * * Opt in to a list of assets on the Algorand blockchain. * @@ -146,7 +146,7 @@ export async function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algo } /** - * @deprecated use `algorandClient.asset.bulkOptOut()` instead + * @deprecated use `algorand.asset.bulkOptOut()` instead * * Opt out of multiple assets in Algorand blockchain. * diff --git a/src/debugging/debugging.spec.ts b/src/debugging/debugging.spec.ts index 90caacf1..b8d473a9 100644 --- a/src/debugging/debugging.spec.ts +++ b/src/debugging/debugging.spec.ts @@ -4,7 +4,6 @@ import * as fsSync from 'fs' import * as fs from 'fs/promises' import * as os from 'os' import * as path from 'path' -import { compileTeal } from '../app' import { algorandFixture } from '../testing' import { AVMDebuggerSourceMap, PersistSourceMapInput } from '../types/debugging' import { persistSourceMaps } from './debugging' @@ -77,7 +76,7 @@ int 1 test( 'build teal sourceMaps without sources', async () => { - const { algod } = localnet.context + const { algod, algorand } = localnet.context const cwd = await fs.mkdtemp(path.join(os.tmpdir(), 'cwd')) const approval = ` @@ -88,8 +87,8 @@ int 1 #pragma version 9 int 1 ` - const approvalCompiled = await compileTeal(approval, algod) - const clearCompiled = await compileTeal(clear, algod) + const approvalCompiled = await algorand.app.compileTeal(approval) + const clearCompiled = await algorand.app.compileTeal(clear) const sources = [ PersistSourceMapInput.fromCompiledTeal(approvalCompiled, 'cool_app', 'approval.teal'), PersistSourceMapInput.fromCompiledTeal(clearCompiled, 'cool_app', 'clear'), diff --git a/src/debugging/debugging.ts b/src/debugging/debugging.ts index ae97c483..a47c832f 100644 --- a/src/debugging/debugging.ts +++ b/src/debugging/debugging.ts @@ -1,8 +1,8 @@ import algosdk from 'algosdk' import * as crypto from 'crypto' -import { compileTeal } from '../app' import { Config } from '../config' import { CompiledTeal } from '../types/app' +import { AppManager } from '../types/app-manager' import { AVMDebuggerSourceMap, AVMDebuggerSourceMapEntry, PersistSourceMapsParams } from '../types/debugging' import { isNode } from '../util' @@ -102,7 +102,7 @@ async function buildAVMSourcemap({ const path = await import('path') // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const result = rawTeal ? await compileTeal(rawTeal, client) : compiledTeal! + const result = rawTeal ? await new AppManager(client).compileTeal(rawTeal) : compiledTeal! const programHash = crypto.createHash('SHA-512/256').update(Buffer.from(result.compiled, 'base64')).digest('base64') const sourceMap = result.sourceMap sourceMap.sources = withSources ? [`${fileName}${TEAL_FILE_EXT}`] : [] diff --git a/src/index.ts b/src/index.ts index 54f01108..26c4ccd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ // TODO review exports -export * from './app' export * from './app-client' export * from './app-deploy' export * from './debugging' @@ -7,6 +6,7 @@ export * from './transaction' // Legacy exports - remove after 2 x major version bumps export * from './account' +export * from './app' export * from './asset' export * from './dispenser-client' export * from './indexer-lookup' diff --git a/src/localnet/get-kmd-wallet-account.ts b/src/localnet/get-kmd-wallet-account.ts index ea4de1ba..97840f28 100644 --- a/src/localnet/get-kmd-wallet-account.ts +++ b/src/localnet/get-kmd-wallet-account.ts @@ -6,7 +6,7 @@ import Algodv2 = algosdk.Algodv2 import Kmd = algosdk.Kmd /** - * @deprecated use `algorandClient.account.kmd.getWalletAccount(name, predicate)` or `new KMDAccountManager(clientManager).getWalletAccount(name, predicate)` instead. + * @deprecated use `algorand.account.kmd.getWalletAccount(name, predicate)` or `new KMDAccountManager(clientManager).getWalletAccount(name, predicate)` instead. * * Returns an Algorand account with private key loaded from the given KMD wallet (identified by name). * diff --git a/src/localnet/get-localnet-dispenser-account.ts b/src/localnet/get-localnet-dispenser-account.ts index 28f17167..b6f28223 100644 --- a/src/localnet/get-localnet-dispenser-account.ts +++ b/src/localnet/get-localnet-dispenser-account.ts @@ -5,7 +5,7 @@ import Account = algosdk.Account import Algodv2 = algosdk.Algodv2 import Kmd = algosdk.Kmd /** - * @deprecated Use `algorandClient.account.kmd.getLocalNetDispenserAccount()` instead. + * @deprecated Use `algorand.account.kmd.getLocalNetDispenserAccount()` instead. * * Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts) * diff --git a/src/localnet/get-or-create-kmd-wallet-account.ts b/src/localnet/get-or-create-kmd-wallet-account.ts index 6ec43bae..13638a8c 100644 --- a/src/localnet/get-or-create-kmd-wallet-account.ts +++ b/src/localnet/get-or-create-kmd-wallet-account.ts @@ -7,7 +7,7 @@ import Algodv2 = algosdk.Algodv2 import Kmd = algosdk.Kmd /** - * @deprecated use `algorandClient.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead. + * @deprecated use `algorand.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead. * * Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name. * diff --git a/src/localnet/is-localnet.ts b/src/localnet/is-localnet.ts index 04ca8170..d5f475cd 100644 --- a/src/localnet/is-localnet.ts +++ b/src/localnet/is-localnet.ts @@ -2,7 +2,7 @@ import algosdk from 'algosdk' import { ClientManager } from '../types/client-manager' import Algodv2 = algosdk.Algodv2 -/** @deprecated Use `await algorandClient.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead. +/** @deprecated Use `await algorand.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead. * * Returns true if the algod client is pointing to a LocalNet Algorand network */ diff --git a/src/network-client.ts b/src/network-client.ts index 1d2c6e0d..e426d28c 100644 --- a/src/network-client.ts +++ b/src/network-client.ts @@ -153,12 +153,12 @@ export function getAlgoKmdClient(config?: AlgoClientConfig): Kmd { return config ? ClientManager.getKmdClient(config) : ClientManager.getKmdClientFromEnvironment() } -/** @deprecated Use `await algorandClient.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. */ +/** @deprecated Use `await algorand.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. */ export async function isTestNet(algod: Algodv2): Promise { return await new ClientManager({ algod }).isTestNet() } -/** @deprecated Use `await algorandClient.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. */ +/** @deprecated Use `await algorand.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. */ export async function isMainNet(algod: Algodv2): Promise { return await new ClientManager({ algod }).isMainNet() } diff --git a/src/testing/fixtures/algorand-fixture.ts b/src/testing/fixtures/algorand-fixture.ts index 044f52e6..71210f5e 100644 --- a/src/testing/fixtures/algorand-fixture.ts +++ b/src/testing/fixtures/algorand-fixture.ts @@ -84,31 +84,31 @@ export function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!) const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!) let context: AlgorandTestAutomationContext - let algorandClient: AlgorandClient + let algorand: AlgorandClient const beforeEach = async () => { Config.configure({ debug: true }) const transactionLogger = new TransactionLogger() const transactionLoggerAlgod = transactionLogger.capture(algod) - algorandClient = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd }) - const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorandClient) - algorandClient.setSignerFromAccount(acc).setSuggestedParamsTimeout(0) + algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd }) + const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand) + algorand.setSignerFromAccount(acc).setSuggestedParamsTimeout(0) // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window // otherwise we are more likely to get invalid transactions. - if (await algorandClient.client.isLocalNet()) { - algorandClient.setDefaultValidityWindow(1000) + if (await algorand.client.isLocalNet()) { + algorand.setDefaultValidityWindow(1000) } - const testAccount = { ...acc, signer: algorandClient.account.getSigner(acc.addr) } + const testAccount = { ...acc, signer: algorand.account.getSigner(acc.addr) } context = { - algorand: algorandClient, + algorand, algod: transactionLoggerAlgod, indexer: indexer, kmd: kmd, testAccount, generateAccount: async (params: GetTestAccountParams) => { - const account = await getTestAccount(params, algorandClient) - algorandClient.setSignerFromAccount(account) - return { ...account, signer: algorandClient.account.getSigner(account.addr) } + const account = await getTestAccount(params, algorand) + algorand.setSignerFromAccount(account) + return { ...account, signer: algorand.account.getSigner(account.addr) } }, transactionLogger: transactionLogger, waitForIndexer: () => transactionLogger.waitForIndexer(indexer), @@ -121,7 +121,7 @@ export function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: return context }, get algorand() { - return algorandClient + return algorand }, beforeEach, } diff --git a/src/transaction/legacy-bridge.ts b/src/transaction/legacy-bridge.ts index fe707b79..00f1c18a 100644 --- a/src/transaction/legacy-bridge.ts +++ b/src/transaction/legacy-bridge.ts @@ -1,46 +1,192 @@ import algosdk from 'algosdk' import { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator' -import { AlgorandClientTransactionSender, SendSingleTransactionResult } from '../types/algorand-client-transaction-sender' +import { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender' +import { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app' +import { AppManager, BoxReference } from '../types/app-manager' import { AssetManager } from '../types/asset-manager' -import AlgoKitComposer, { CommonTransactionParams, ExecuteParams } from '../types/composer' -import { SendTransactionFrom, SendTransactionParams, SendTransactionResult } from '../types/transaction' -import { getSenderTransactionSigner, getTransactionParams } from './transaction' +import AlgoKitComposer, { + AppCallMethodCall, + AppCallParams, + AppCreateMethodCall, + AppCreateParams, + AppDeleteMethodCall, + AppDeleteParams, + AppUpdateMethodCall, + AppUpdateParams, + BuiltTransactions, + CommonTransactionParams, + ExecuteParams, +} from '../types/composer' +import { + SendSingleTransactionResult, + SendTransactionFrom, + SendTransactionParams, + SendTransactionResult, + TransactionNote, +} from '../types/transaction' +import { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner, getTransactionParams } from './transaction' import Algodv2 = algosdk.Algodv2 import Transaction = algosdk.Transaction +import ABIMethod = algosdk.ABIMethod -/** Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */ -export async function legacySendTransactionBridge( +/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */ +export async function legacySendTransactionBridge( algod: Algodv2, from: SendTransactionFrom, sendParams: SendTransactionParams, params: T, - txn: (c: AlgorandClientTransactionCreator) => (params: T) => Promise, - send: (c: AlgorandClientTransactionSender) => (params: T & ExecuteParams) => Promise, + txn: + | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise) + | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise), + send: (c: AlgorandClientTransactionSender) => (params: T & ExecuteParams) => Promise, suggestedParams?: algosdk.SuggestedParams, -): Promise { +): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> { + const appManager = new AppManager(algod) const newGroup = () => new AlgoKitComposer({ algod, getSigner: () => getSenderTransactionSigner(from), getSuggestedParams: async () => await getTransactionParams(suggestedParams, algod), + appManager, }) - const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup)) + const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager) const transactionCreator = new AlgorandClientTransactionCreator(newGroup) if (sendParams.fee) { params.staticFee = sendParams.fee } + if (sendParams.maxFee) { params.maxFee = sendParams.maxFee } if (sendParams.atc || sendParams.skipSending) { const transaction = await txn(transactionCreator)(params) + const txns = 'transactions' in transaction ? transaction.transactions : [transaction] if (sendParams.atc) { - sendParams.atc.addTransaction({ txn: transaction, signer: getSenderTransactionSigner(from) }) + const baseIndex = sendParams.atc.count() + txns + .map((txn, i) => ({ + txn, + signer: + 'signers' in transaction ? transaction.signers.get(i) ?? getSenderTransactionSigner(from) : getSenderTransactionSigner(from), + })) + .forEach((t) => sendParams.atc!.addTransaction(t)) + // Populate ATC with method calls + if ('transactions' in transaction) { + transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m)) + } } - return { transaction } + return { transaction: txns.at(-1)!, transactions: txns } + } + + return { ...(await send(transactionSender)({ ...sendParams, ...params })) } +} + +/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */ +export async function legacySendAppTransactionBridge< + T extends + | AppCreateParams + | AppUpdateParams + | AppDeleteParams + | AppCallParams + | AppCreateMethodCall + | AppUpdateMethodCall + | AppDeleteMethodCall + | AppCallMethodCall, + TResult extends SendSingleTransactionResult, +>( + algod: Algodv2, + from: SendTransactionFrom, + appArgs: RawAppCallArgs | ABIAppCallArgs | undefined, + sendParams: SendTransactionParams & { note?: TransactionNote }, + params: Omit, + txn: + | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise) + | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise), + send: (c: AlgorandClientTransactionSender) => (params: T & ExecuteParams) => Promise, + suggestedParams?: algosdk.SuggestedParams, +): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> { + const encoder = new TextEncoder() + + const paramsWithAppArgs = { + ...params, + accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))), + appReferences: appArgs?.apps?.map((a) => BigInt(a)), + assetReferences: appArgs?.assets?.map((a) => BigInt(a)), + boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference), + lease: appArgs?.lease, + rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined, + args: appArgs + ? 'methodArgs' in appArgs + ? (await _getAppArgsForABICall(appArgs, from)).methodArgs + : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)) + : undefined, + note: encodeTransactionNote(sendParams?.note), + } as T + + return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams) +} + +/** + * @deprecated + */ +export async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) { + const signer = getSenderTransactionSigner(from) + const methodArgs = await Promise.all( + ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => { + if (a === undefined) { + throw new Error(`Argument at position ${index} does not have a value`) + } + if (typeof a !== 'object') { + return a + } + // Handle the various forms of transactions to wrangle them for ATC + return 'txn' in a + ? a + : a instanceof Promise + ? { txn: (await a).transaction, signer } + : 'transaction' in a + ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer } + : 'txID' in a + ? { txn: a, signer } + : a + }), + ) + return { + method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method), + sender: getSenderAddress(from), + signer: signer, + boxes: args.boxes?.map(_getBoxReference), + lease: encodeLease(args.lease), + appForeignApps: args.apps, + appForeignAssets: args.assets, + appAccounts: args.accounts?.map(_getAccountAddress), + methodArgs: methodArgs, + rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined, + } +} + +function _getAccountAddress(account: string | algosdk.Address) { + return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey) +} + +/** @deprecated */ +export function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference { + const encoder = new TextEncoder() + + if (typeof box === 'object' && 'appIndex' in box) { + return box } - return await send(transactionSender)({ ...sendParams, ...params }) + const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box } + return { + appIndex: ref.appId, + name: + typeof ref.name === 'string' + ? encoder.encode(ref.name) + : 'length' in ref.name + ? ref.name + : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey, + } as algosdk.BoxReference } diff --git a/src/transaction/transaction.spec.ts b/src/transaction/transaction.spec.ts index 717ef6b1..81bc2bba 100644 --- a/src/transaction/transaction.spec.ts +++ b/src/transaction/transaction.spec.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { describe, test } from '@jest/globals' -import algosdk, { makeBasicAccountTransactionSigner } from 'algosdk' +import algosdk from 'algosdk' import invariant from 'tiny-invariant' import externalARC32 from '../../tests/example-contracts/resource-packer/artifacts/ExternalApp.arc32.json' import v8ARC32 from '../../tests/example-contracts/resource-packer/artifacts/ResourcePackerv8.arc32.json' @@ -139,21 +139,16 @@ describe('transaction', () => { }) test('Transaction group is sent with same signer', async () => { - const { algod, testAccount } = localnet.context + const { algod, algorand, testAccount } = localnet.context const txn1 = await getTestTransaction(1) - const txn2Promise = algokit.transferAlgos( - { - amount: algokit.microAlgo(2), - from: testAccount, - to: testAccount.addr, - skipSending: true, - }, - algod, - ) + const txn2 = await algorand.transactions.payment({ + amount: algokit.microAlgo(2), + sender: testAccount.addr, + receiver: testAccount.addr, + }) - const { confirmations } = await algokit.sendGroupOfTransactions({ transactions: [txn1, txn2Promise], signer: testAccount }, algod) + const { confirmations } = await algokit.sendGroupOfTransactions({ transactions: [txn1, txn2], signer: testAccount }, algod) - const txn2 = (await txn2Promise).transaction invariant(confirmations) invariant(confirmations[0].txn.txn.grp) invariant(confirmations[1].txn.txn.grp) @@ -173,27 +168,25 @@ describe('transaction', () => { const txn2 = await getTestTransaction(2, account2.addr) const txn3 = await getTestTransaction(3) const txn4 = await getTestTransaction(4, account2.addr) - const signer1 = algokit.transactionSignerAccount(makeBasicAccountTransactionSigner(testAccount), testAccount.addr) - const signer2 = algokit.transactionSignerAccount(makeBasicAccountTransactionSigner(account2), account2.addr) const { confirmations } = await algokit.sendGroupOfTransactions( { transactions: [ { transaction: txn1, - signer: signer1, + signer: testAccount, }, { transaction: txn2, - signer: signer2, + signer: account2, }, { transaction: txn3, - signer: signer1, + signer: testAccount, }, { transaction: txn4, - signer: signer2, + signer: account2, }, ], }, @@ -216,10 +209,10 @@ describe('transaction', () => { }) test('Multisig single account', async () => { - const { algod, testAccount } = localnet.context + const { algorand, testAccount } = localnet.context // Setup multisig - const multisig = algokit.multisigAccount( + const multisig = algorand.account.multisig( { addrs: [testAccount.addr], threshold: 1, @@ -229,35 +222,29 @@ describe('transaction', () => { ) // Fund multisig - await algokit.transferAlgos( - { - from: testAccount, - to: multisig.addr, - amount: algokit.algo(1), - }, - algod, - ) + await algorand.send.payment({ + sender: testAccount.addr, + receiver: multisig.addr, + amount: algokit.algo(1), + }) // Use multisig - await algokit.transferAlgos( - { - from: multisig, - to: testAccount.addr, - amount: algokit.microAlgo(500), - }, - algod, - ) + await algorand.send.payment({ + sender: multisig.addr, + receiver: testAccount.addr, + amount: algokit.microAlgo(500), + }) }) test('Multisig double account', async () => { - const { algod, testAccount, generateAccount } = localnet.context + const { algod, algorand, testAccount, generateAccount } = localnet.context const account2 = await generateAccount({ initialFunds: algokit.algo(10), suppressLog: true, }) // Setup multisig - const multisig = algokit.multisigAccount( + const multisig = algorand.account.multisig( { addrs: [testAccount.addr, account2.addr], threshold: 2, @@ -267,24 +254,18 @@ describe('transaction', () => { ) // Fund multisig - await algokit.transferAlgos( - { - from: testAccount, - to: multisig.addr, - amount: algokit.algo(1), - }, - algod, - ) + await algorand.send.payment({ + sender: testAccount.addr, + receiver: multisig.addr, + amount: algokit.algo(1), + }) // Use multisig - await algokit.transferAlgos( - { - from: multisig, - to: testAccount.addr, - amount: algokit.microAlgo(500), - }, - algod, - ) + await algorand.send.payment({ + sender: multisig.addr, + receiver: testAccount.addr, + amount: algokit.microAlgo(500), + }) }) test('Transaction wait for confirmation http error', async () => { diff --git a/src/transfer/transfer-algos.ts b/src/transfer/transfer-algos.ts index 356d04a9..38e761bd 100644 --- a/src/transfer/transfer-algos.ts +++ b/src/transfer/transfer-algos.ts @@ -7,7 +7,7 @@ import { AlgoTransferParams } from '../types/transfer' import Algodv2 = algosdk.Algodv2 /** - * @deprecated Use `algorand.send.payment()` / `algorand.transaction.payment()` instead + * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead * * Transfer Algo between two accounts. * @param transfer The transfer definition diff --git a/src/transfer/transfer.ts b/src/transfer/transfer.ts index 00729bd8..86314081 100644 --- a/src/transfer/transfer.ts +++ b/src/transfer/transfer.ts @@ -73,7 +73,7 @@ export async function ensureFunded( } /** - * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transaction.assetTransfer()` instead + * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead * * Transfer asset between two accounts. * @param transfer The transfer definition diff --git a/src/types/__snapshots__/app-client.spec.ts.snap b/src/types/__snapshots__/app-client.spec.ts.snap index f2083280..0acd50a0 100644 --- a/src/types/__snapshots__/app-client.spec.ts.snap +++ b/src/types/__snapshots__/app-client.spec.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`application-client Errors Display nice error messages when there is a logic error 2`] = ` -"INFO: Idempotently deploying app "TestingApp" from creator ACCOUNT_1 using 1498 bytes of teal code and 4 bytes of teal code +"INFO: Idempotently deploying app "TestingApp" from creator ACCOUNT_1 using 1498 bytes of AVM bytecode and 4 bytes of AVM bytecode INFO: App TestingApp not found in apps created by ACCOUNT_1; deploying app with version 1.0. VERBOSE: Sent transaction ID TXID_1 appl from ACCOUNT_1 -DEBUG: Created app APP_1 from creator ACCOUNT_1 +DEBUG: App created by ACCOUNT_1 with ID APP_1 via transaction TXID_1 ERROR: Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information | [{"response":{"body":{"data":{"app-index":APP_1,"eval-states":[{"stack":[0]}],"group-index":0,"pc":885},"message":"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert"},"status":400,"text":"{\\"data\\":{\\"app-index\\":APP_1,\\"eval-states\\":[{\\"stack\\":[0]}],\\"group-index\\":0,\\"pc\\":885},\\"message\\":\\"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert\\"}\\n","ok":false},"name":"URLTokenBaseHTTPError","status":400,"traces":[]}]" `; diff --git a/src/types/account-manager.ts b/src/types/account-manager.ts index a6edb05d..d3ae2bc9 100644 --- a/src/types/account-manager.ts +++ b/src/types/account-manager.ts @@ -2,12 +2,12 @@ import algosdk from 'algosdk' import { Config } from '../config' import { calculateFundAmount, memoize } from '../util' import { AccountInformation, DISPENSER_ACCOUNT, MultisigAccount, SigningAccount, TransactionSignerAccount } from './account' -import { SendSingleTransactionResult } from './algorand-client-transaction-sender' import { AlgoAmount } from './amount' import { ClientManager } from './client-manager' import AlgoKitComposer, { CommonTransactionParams, ExecuteParams } from './composer' import { TestNetDispenserApiClient } from './dispenser-client' import { KmdAccountManager } from './kmd-account-manager' +import { SendSingleTransactionResult } from './transaction' import LogicSigAccount = algosdk.LogicSigAccount import Account = algosdk.Account import TransactionSigner = algosdk.TransactionSigner diff --git a/src/types/algorand-client-transaction-creator.ts b/src/types/algorand-client-transaction-creator.ts index cf834d1c..57ebfbb1 100644 --- a/src/types/algorand-client-transaction-creator.ts +++ b/src/types/algorand-client-transaction-creator.ts @@ -1,5 +1,6 @@ import algosdk from 'algosdk' -import AlgoKitComposer, { MethodCallParams } from './composer' +import AlgoKitComposer, { BuiltTransactions } from './composer' +import { Expand } from './expand' import Transaction = algosdk.Transaction @@ -19,7 +20,14 @@ export class AlgorandClientTransactionCreator { return async (params: T) => { const composer = this._newGroup() const result = await c(composer).apply(composer, [params]).buildTransactions() - return result[result.length - 1] + return result.transactions.at(-1)! + } + } + + private _transactions(c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer): (params: T) => Promise> { + return async (params: T) => { + const composer = this._newGroup() + return await c(composer).apply(composer, [params]).buildTransactions() } } @@ -28,7 +36,7 @@ export class AlgorandClientTransactionCreator { * @param params The parameters for the payment transaction * @example Basic example * ```typescript - * const result = await algorandClient.send.payment({ + * const result = await algorand.send.payment({ * sender: 'SENDERADDRESS', * receiver: 'RECEIVERADDRESS', * amount: (4).algo(), @@ -36,7 +44,7 @@ export class AlgorandClientTransactionCreator { * ``` * @example Advanced example * ```typescript - * const result = await algorandClient.send.payment({ + * const result = await algorand.send.payment({ * amount: (4).algo(), * receiver: 'RECEIVERADDRESS', * sender: 'SENDERADDRESS', @@ -68,11 +76,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetCreate({sender: "CREATORADDRESS", total: 100n}) + * await algorand.transactions.assetCreate({sender: "CREATORADDRESS", total: 100n}) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetCreate({ + * await algorand.transactions.assetCreate({ * sender: 'CREATORADDRESS', * total: 100n, * decimals: 2, @@ -110,11 +118,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" }) + * await algorand.transactions.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" }) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetConfig({ + * await algorand.transactions.assetConfig({ * sender: 'MANAGERADDRESS', * assetId: 123456n, * manager: 'MANAGERADDRESS', @@ -142,11 +150,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true }) + * await algorand.transactions.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true }) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetFreeze({ + * await algorand.transactions.assetFreeze({ * sender: 'MANAGERADDRESS', * assetId: 123456n, * account: 'ACCOUNTADDRESS', @@ -176,11 +184,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n }) + * await algorand.transactions.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n }) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetDestroy({ + * await algorand.transactions.assetDestroy({ * sender: 'MANAGERADDRESS', * assetId: 123456n, * lease: 'lease', @@ -204,11 +212,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" }) + * await algorand.transactions.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" }) * ``` * @example Advanced example (with clawback) * ```typescript - * await algorand.transaction.assetTransfer({ + * await algorand.transactions.assetTransfer({ * sender: 'CLAWBACKADDRESS', * assetId: 123456n, * amount: 1n, @@ -237,11 +245,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n }) + * await algorand.transactions.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n }) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetOptIn({ + * await algorand.transactions.assetOptIn({ * sender: 'SENDERADDRESS', * assetId: 123456n, * lease: 'lease', @@ -268,11 +276,11 @@ export class AlgorandClientTransactionCreator { * * @example Basic example * ```typescript - * await algorand.transaction.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n }) + * await algorand.transactions.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n }) * ``` * @example Advanced example * ```typescript - * await algorand.transaction.assetOptIn({ + * await algorand.transactions.assetOptIn({ * sender: 'SENDERADDRESS', * assetId: 123456n, * creator: 'CREATORADDRESS', @@ -292,12 +300,390 @@ export class AlgorandClientTransactionCreator { * @returns The asset opt-out transaction */ assetOptOut = this._transaction((c) => c.addAssetOptOut) - /** Create an application call transaction. */ + /** Create an application create transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app creation transaction + * @example Basic example + * ```typescript + * const result = await algorand.transactions.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) + * const createdAppId = result.appId + * ``` + * @example Advanced example + * ```typescript + * await algorand.transactions.appCreate({ + * sender: 'CREATORADDRESS', + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * schema: { + * globalInts: 1, + * globalByteSlices: 2, + * localInts: 3, + * localByteSlices: 4 + * }, + * extraProgramPages: 1, + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCreate = this._transaction((c) => c.addAppCreate) + /** Create an application update transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app update transaction + * @example Basic example + * ```typescript + * await algorand.transactions.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.transactions.appUpdate({ + * sender: 'CREATORADDRESS', + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appUpdate = this._transaction((c) => c.addAppUpdate) + /** Create an application delete transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app deletion transaction + * @example Basic example + * ```typescript + * await algorand.transactions.appDelete({ sender: 'CREATORADDRESS' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.transactions.appDelete({ + * sender: 'CREATORADDRESS', + * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appDelete = this._transaction((c) => c.addAppDelete) + /** Create an application call transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app call transaction + * @example Basic example + * ```typescript + * await algorand.transactions.appCall({ sender: 'CREATORADDRESS' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.transactions.appCall({ + * sender: 'CREATORADDRESS', + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ appCall = this._transaction((c) => c.addAppCall) - /** Create an application call with ABI method call transaction. */ - methodCall = async (params: MethodCallParams) => { - return await this._newGroup().addMethodCall(params).buildTransactions() - } + /** Create an application create call with ABI method call transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app creation transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * const result = await algorand.transactions.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) + * const createdAppId = result.appId + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appCreate({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * schema: { + * globalInts: 1, + * globalByteSlices: 2, + * localInts: 3, + * localByteSlices: 4 + * }, + * extraProgramPages: 1, + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCreateMethodCall = this._transactions((c) => c.addAppCreateMethodCall) + /** Create an application update call with ABI method call transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app update transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appUpdateMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appUpdateMethodCall = this._transactions((c) => c.addAppUpdateMethodCall) + /** Create an application delete call with ABI method call transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app deletion transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appDeleteMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appDeleteMethodCall = this._transactions((c) => c.addAppDeleteMethodCall) + /** Create an application call with ABI method call transaction. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app call transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.transactions.appCallMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCallMethodCall = this._transactions((c) => c.addAppCallMethodCall) /** Create an online key registration transaction. */ onlineKeyRegistration = this._transaction((c) => c.addOnlineKeyRegistration) } diff --git a/src/types/algorand-client-transaction-sender.ts b/src/types/algorand-client-transaction-sender.ts index 43a0a959..148d2571 100644 --- a/src/types/algorand-client-transaction-sender.ts +++ b/src/types/algorand-client-transaction-sender.ts @@ -1,27 +1,43 @@ import algosdk from 'algosdk' import { Config } from '../config' +import { SendAppCreateTransactionResult, SendAppTransactionResult, SendAppUpdateTransactionResult } from './app' +import { AppManager } from './app-manager' import { AssetManager } from './asset-manager' -import AlgoKitComposer, { AssetCreateParams, AssetOptOutParams, ExecuteParams } from './composer' -import { ConfirmedTransactionResult, SendAtomicTransactionComposerResults } from './transaction' - +import AlgoKitComposer, { + AppCallMethodCall, + AppCallParams, + AppCreateMethodCall, + AppCreateParams, + AppDeleteMethodCall, + AppDeleteParams, + AppUpdateMethodCall, + AppUpdateParams, + AssetCreateParams, + AssetOptOutParams, + ExecuteParams, +} from './composer' +import { SendSingleTransactionResult } from './transaction' import Transaction = algosdk.Transaction -/** Result from sending a single transaction. */ -export type SendSingleTransactionResult = SendAtomicTransactionComposerResults & ConfirmedTransactionResult - /** Orchestrates sending transactions for `AlgorandClient`. */ export class AlgorandClientTransactionSender { private _newGroup: () => AlgoKitComposer private _assetManager: AssetManager + private _appManager: AppManager /** * Creates a new `AlgorandClientSender` * @param newGroup A lambda that starts a new `AlgoKitComposer` transaction group * @param assetManager An `AssetManager` instance */ - constructor(newGroup: () => AlgoKitComposer, assetManager: AssetManager) { + constructor(newGroup: () => AlgoKitComposer, assetManager: AssetManager, appManager: AppManager) { this._newGroup = newGroup this._assetManager = assetManager + this._appManager = appManager + } + + newGroup() { + return this._newGroup() } private _send( @@ -45,9 +61,9 @@ export class AlgorandClientTransactionSender { const rawResult = await composer.execute(params) const result = { // Last item covers when a group is created by an app call with ABI transaction parameters - transaction: rawResult.transactions[rawResult.transactions.length - 1], - confirmation: rawResult.confirmations![rawResult.confirmations!.length - 1], - txId: rawResult.txIds[0], + transaction: rawResult.transactions.at(-1)!, + confirmation: rawResult.confirmations.at(-1)!, + txId: rawResult.txIds.at(-1)!, ...rawResult, } @@ -59,12 +75,73 @@ export class AlgorandClientTransactionSender { } } + private _sendAppCall< + T extends + | AppCreateParams + | AppUpdateParams + | AppCallParams + | AppDeleteParams + | AppCreateMethodCall + | AppUpdateMethodCall + | AppCallMethodCall + | AppDeleteMethodCall, + >( + c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer, + log?: { + preLog?: (params: T, transaction: Transaction) => string + postLog?: (params: T, result: SendSingleTransactionResult) => string + }, + ): (params: T & ExecuteParams) => Promise { + return async (params) => { + const result = await this._send(c, log)(params) + + return { ...result, return: AppManager.getABIReturn(result.confirmation, 'method' in params ? params.method : undefined) } + } + } + + private _sendAppUpdateCall( + c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer, + log?: { + preLog?: (params: T, transaction: Transaction) => string + postLog?: (params: T, result: SendSingleTransactionResult) => string + }, + ): (params: T & ExecuteParams) => Promise { + return async (params) => { + const result = await this._sendAppCall(c, log)(params) + + const compiledApproval = + typeof params.approvalProgram === 'string' ? this._appManager.getCompilationResult(params.approvalProgram) : undefined + const compiledClear = + typeof params.clearStateProgram === 'string' ? this._appManager.getCompilationResult(params.clearStateProgram) : undefined + + return { ...result, compiledApproval, compiledClear } + } + } + + private _sendAppCreateCall( + c: (c: AlgoKitComposer) => (params: T) => AlgoKitComposer, + log?: { + preLog?: (params: T, transaction: Transaction) => string + postLog?: (params: T, result: SendSingleTransactionResult) => string + }, + ): (params: T & ExecuteParams) => Promise { + return async (params) => { + const result = await this._sendAppUpdateCall(c, log)(params) + + return { + ...result, + appId: BigInt(result.confirmation.applicationIndex!), + appAddress: algosdk.getApplicationAddress(result.confirmation.applicationIndex!), + } + } + } + /** * Send a payment transaction to transfer Algo between accounts. * @param params The parameters for the payment transaction * @example Basic example * ```typescript - * const result = await algorandClient.send.payment({ + * const result = await algorand.send.payment({ * sender: 'SENDERADDRESS', * receiver: 'RECEIVERADDRESS', * amount: (4).algo(), @@ -72,7 +149,7 @@ export class AlgorandClientTransactionSender { * ``` * @example Advanced example * ```typescript - * const result = await algorandClient.send.payment({ + * const result = await algorand.send.payment({ * amount: (4).algo(), * receiver: 'RECEIVERADDRESS', * sender: 'SENDERADDRESS', @@ -372,7 +449,7 @@ export class AlgorandClientTransactionSender { * * @param params The parameters for the asset opt-out transaction * - * @example Basic example (without creator) + * @example Basic example (without creator, will be retrieved from algod) * ```typescript * await algorand.send.assetOptOut({sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true }) * ``` @@ -440,18 +517,412 @@ export class AlgorandClientTransactionSender { `Opting ${params.sender} out of asset with ID ${params.assetId} to creator ${params.creator} via transaction ${transaction.txID()}`, })(params as AssetOptOutParams & ExecuteParams) } + /** + * Create a smart contract. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app creation transaction + * @example Basic example + * ```typescript + * const result = await algorand.send.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) + * const createdAppId = result.appId + * ``` + * @example Advanced example + * ```typescript + * await algorand.send.appCreate({ + * sender: 'CREATORADDRESS', + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * schema: { + * globalInts: 1, + * globalByteSlices: 2, + * localInts: 3, + * localByteSlices: 4 + * }, + * extraProgramPages: 1, + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCreate = this._sendAppCreateCall((c) => c.addAppCreate, { + postLog: (params, result) => + `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`, + }) + + /** + * Update a smart contract. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app update transaction + * @example Basic example + * ```typescript + * await algorand.send.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.send.appUpdate({ + * sender: 'CREATORADDRESS', + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appUpdate = this._sendAppUpdateCall((c) => c.addAppUpdate) + + /** + * Delete a smart contract. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app deletion transaction + * @example Basic example + * ```typescript + * await algorand.send.appDelete({ sender: 'CREATORADDRESS' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.send.appDelete({ + * sender: 'CREATORADDRESS', + * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appDelete = this._sendAppCall((c) => c.addAppDelete) + /** * Call a smart contract. * - * Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality. + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app call transaction + * @example Basic example + * ```typescript + * await algorand.send.appCall({ sender: 'CREATORADDRESS' }) + * ``` + * @example Advanced example + * ```typescript + * await algorand.send.appCall({ + * sender: 'CREATORADDRESS', + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCall = this._sendAppCall((c) => c.addAppCall) + + /** + * Create a smart contract via an ABI method. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app creation transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * const result = await algorand.send.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) + * const createdAppId = result.appId + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appCreate({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * schema: { + * globalInts: 1, + * globalByteSlices: 2, + * localInts: 3, + * localByteSlices: 4 + * }, + * extraProgramPages: 1, + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appCreateMethodCall = this._sendAppCreateCall((c) => c.addAppCreateMethodCall, { + postLog: (params, result) => + `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`, + }) + + /** + * Update a smart contract via an ABI method. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app update transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appUpdateMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * approvalProgram: "TEALCODE", + * clearStateProgram: "TEALCODE", + * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` + */ + appUpdateMethodCall = this._sendAppUpdateCall((c) => c.addAppUpdateMethodCall) + + /** + * Delete a smart contract via an ABI method. + * + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app deletion transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appDeleteMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` */ - appCall = this._send((c) => c.addAppCall) + appDeleteMethodCall = this._sendAppCall((c) => c.addAppDeleteMethodCall) + /** - * Call a smart contract ABI method. + * Call a smart contract via an ABI method. * - * Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality. + * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality. + * + * @param params The parameters for the app call transaction + * @example Basic example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] }) + * ``` + * @example Advanced example + * ```typescript + * const method = new ABIMethod({ + * name: 'method', + * args: [{ name: 'arg1', type: 'string' }], + * returns: { type: 'string' }, + * }) + * await algorand.send.appCallMethodCall({ + * sender: 'CREATORADDRESS', + * method: method, + * args: ["arg1_value"], + * onComplete: algosdk.OnApplicationComplete.OptInOC, + * args: [new Uint8Array(1, 2, 3, 4)] + * accountReferences: ["ACCOUNT_1"] + * appReferences: [123n, 1234n] + * assetReferences: [12345n] + * boxReferences: ["box1", {appId: 1234n, name: "box2"}] + * lease: 'lease', + * note: 'note', + * // You wouldn't normally set this field + * firstValidRound: 1000n, + * validityWindow: 10, + * extraFee: (1000).microAlgo(), + * staticFee: (1000).microAlgo(), + * // Max fee doesn't make sense with extraFee AND staticFee + * // already specified, but here for completeness + * maxFee: (3000).microAlgo(), + * // Signer only needed if you want to provide one, + * // generally you'd register it with AlgorandClient + * // against the sender and not need to pass it in + * signer: transactionSigner, + * maxRoundsToWaitForConfirmation: 5, + * suppressLog: true, + *}) + * ``` */ - methodCall = this._send((c) => c.addMethodCall) + appCallMethodCall = this._sendAppCall((c) => c.addAppCallMethodCall) + /** Register an online key. */ onlineKeyRegistration = this._send((c) => c.addOnlineKeyRegistration, { preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`, diff --git a/src/types/algorand-client.spec.ts b/src/types/algorand-client.spec.ts index 00883cca..c3bfbdab 100644 --- a/src/types/algorand-client.spec.ts +++ b/src/types/algorand-client.spec.ts @@ -5,7 +5,7 @@ import { algorandFixture } from '../testing' import { TransactionSignerAccount } from './account' import AlgorandClient from './algorand-client' import { AlgoAmount } from './amount' -import { MethodCallParams } from './composer' +import { AppCallMethodCall } from './composer' async function compileProgram(algorand: AlgorandClient, b64Teal: string) { const teal = new Uint8Array(Buffer.from(b64Teal, 'base64')) @@ -83,7 +83,7 @@ describe('AlgorandClient', () => { const methodRes = await algorand .newGroup() .addPayment({ sender: alice.addr, receiver: bob.addr, amount: AlgoAmount.MicroAlgo(1), note: new Uint8Array([1]) }) - .addMethodCall({ + .addAppCallMethodCall({ sender: alice.addr, appId: appId, method: appClient.appClient.getABIMethod('doMath')!, @@ -101,17 +101,15 @@ describe('AlgorandClient', () => { }) test('method with txn arg', async () => { - const txnArgParams = { - sender: alice.addr, - appId: appId, - method: appClient.appClient.getABIMethod('txnArg')!, - args: [algorand.transactions.payment({ sender: alice.addr, receiver: alice.addr, amount: AlgoAmount.MicroAlgo(0) })], - } - const txnRes = await algorand .newGroup() .addPayment({ sender: alice.addr, receiver: alice.addr, amount: AlgoAmount.MicroAlgo(0), note: new Uint8Array([1]) }) - .addMethodCall(txnArgParams) + .addAppCallMethodCall({ + sender: alice.addr, + appId: appId, + method: appClient.appClient.getABIMethod('txnArg')!, + args: [algorand.transactions.payment({ sender: alice.addr, receiver: alice.addr, amount: (0).microAlgo() })], + }) .execute() expect(txnRes.returns?.[0].returnValue?.valueOf()).toBe(alice.addr) @@ -122,11 +120,11 @@ describe('AlgorandClient', () => { sender: alice.addr, appId: appId, method: appClient.appClient.getABIMethod('helloWorld')!, - } satisfies MethodCallParams + } satisfies AppCallMethodCall const methodArgRes = await algorand .newGroup() - .addMethodCall({ + .addAppCallMethodCall({ sender: alice.addr, appId: appId, method: appClient.appClient.getABIMethod('methodArg')!, @@ -144,11 +142,11 @@ describe('AlgorandClient', () => { appId: appId, method: appClient.appClient.getABIMethod('txnArg')!, args: [algorand.transactions.payment({ sender: alice.addr, receiver: alice.addr, amount: AlgoAmount.MicroAlgo(0) })], - } satisfies MethodCallParams + } satisfies AppCallMethodCall const nestedTxnArgRes = await algorand .newGroup() - .addMethodCall({ + .addAppCallMethodCall({ sender: alice.addr, appId: appId, method: appClient.appClient.getABIMethod('nestedTxnArg')!, @@ -166,7 +164,7 @@ describe('AlgorandClient', () => { appId: appId, method: appClient.appClient.getABIMethod('txnArg')!, args: [algorand.transactions.payment({ sender: alice.addr, receiver: alice.addr, amount: AlgoAmount.MicroAlgo(0) })], - } satisfies MethodCallParams + } satisfies AppCallMethodCall const secondTxnCall = { sender: alice.addr, @@ -174,11 +172,11 @@ describe('AlgorandClient', () => { method: appClient.appClient.getABIMethod('txnArg')!, args: [algorand.transactions.payment({ sender: alice.addr, receiver: alice.addr, amount: AlgoAmount.MicroAlgo(1) })], note: new Uint8Array([1]), - } satisfies MethodCallParams + } satisfies AppCallMethodCall const doubleNestedTxnArgRes = await algorand .newGroup() - .addMethodCall({ + .addAppCallMethodCall({ sender: alice.addr, appId: appId, method: appClient.appClient.getABIMethod('doubleNestedTxnArg')!, @@ -206,12 +204,11 @@ describe('AlgorandClient', () => { test('methodCall create', async () => { const contract = new algosdk.ABIContract(APP_SPEC.contract) - await algorand.send.methodCall({ + await algorand.send.appCreateMethodCall({ sender: alice.addr, - appId: 0n, method: contract.getMethodByName('createApplication'), approvalProgram: await compileProgram(algorand, APP_SPEC.source.approval), - clearProgram: await compileProgram(algorand, APP_SPEC.source.clear), + clearStateProgram: await compileProgram(algorand, APP_SPEC.source.clear), }) }) diff --git a/src/types/algorand-client.transfer.spec.ts b/src/types/algorand-client.transfer.spec.ts index c3a79aff..f2746fe1 100644 --- a/src/types/algorand-client.transfer.spec.ts +++ b/src/types/algorand-client.transfer.spec.ts @@ -1,7 +1,6 @@ import { describe, test } from '@jest/globals' import algosdk, { TransactionType } from 'algosdk' import invariant from 'tiny-invariant' -import { transferAsset } from '..' import { algorandFixture } from '../testing' import { generateTestAsset } from '../testing/_asset' import { AlgorandClient } from './algorand-client' @@ -173,27 +172,6 @@ describe('Transfer capability', () => { } }, 10e6) - // @deprecated test - remove when removing transferAsset - test('Transfer ASA, without sending', async () => { - const { algod, testAccount, generateAccount } = localnet.context - const secondAccount = await generateAccount({ initialFunds: (1).algo() }) - - const response = await transferAsset( - { - from: testAccount, - to: secondAccount.addr, - assetId: 1, - amount: 5, - note: `Transfer asset with wrong id`, - skipSending: true, - }, - algod, - ) - - expect(response.transaction).toBeDefined() - expect(response.confirmation).toBeUndefined() - }, 10e6) - test('Transfer ASA, asset is transfered to another account', async () => { const { algorand, testAccount, generateAccount } = localnet.context const dummyAssetId = await generateTestAsset(algorand, testAccount.addr, 100) diff --git a/src/types/algorand-client.ts b/src/types/algorand-client.ts index 2ed09795..eba6f1bd 100644 --- a/src/types/algorand-client.ts +++ b/src/types/algorand-client.ts @@ -3,6 +3,8 @@ import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './acc import { AccountManager } from './account-manager' import { AlgorandClientTransactionCreator } from './algorand-client-transaction-creator' import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender' +import { AppDeployer } from './app-deployer' +import { AppManager } from './app-manager' import { AssetManager } from './asset-manager' import { AlgoSdkClients, ClientManager } from './client-manager' import AlgoKitComposer from './composer' @@ -16,6 +18,8 @@ import LogicSigAccount = algosdk.LogicSigAccount export class AlgorandClient { private _clientManager: ClientManager private _accountManager: AccountManager + private _appManager: AppManager + private _appDeployer: AppDeployer private _assetManager: AssetManager private _transactionSender: AlgorandClientTransactionSender private _transactionCreator: AlgorandClientTransactionCreator @@ -29,9 +33,11 @@ export class AlgorandClient { private constructor(config: AlgoConfig | AlgoSdkClients) { this._clientManager = new ClientManager(config) this._accountManager = new AccountManager(this._clientManager) + this._appManager = new AppManager(this._clientManager.algod) this._assetManager = new AssetManager(this._clientManager.algod, () => this.newGroup()) - this._transactionSender = new AlgorandClientTransactionSender(() => this.newGroup(), this._assetManager) + this._transactionSender = new AlgorandClientTransactionSender(() => this.newGroup(), this._assetManager, this._appManager) this._transactionCreator = new AlgorandClientTransactionCreator(() => this.newGroup()) + this._appDeployer = new AppDeployer(this._appManager, this._transactionSender, this._clientManager.indexerIfPresent) } /** @@ -140,6 +146,16 @@ export class AlgorandClient { return this._assetManager } + /** Methods for interacting with apps. */ + public get app() { + return this._appManager + } + + /** Methods for deploying apps and managing app deployment metadata. */ + public get appDeployer() { + return this._appDeployer + } + /** Start a new `AlgoKitComposer` transaction group */ public newGroup() { return new AlgoKitComposer({ @@ -147,6 +163,7 @@ export class AlgorandClient { getSigner: (addr: string) => this.account.getSigner(addr), getSuggestedParams: () => this.getSuggestedParams(), defaultValidityWindow: this._defaultValidityWindow, + appManager: this._appManager, }) } diff --git a/src/types/app-client.spec.ts b/src/types/app-client.spec.ts index 3ea84360..c6a92711 100644 --- a/src/types/app-client.spec.ts +++ b/src/types/app-client.spec.ts @@ -15,6 +15,7 @@ import { getTestingAppContract } from '../../tests/example-contracts/testing-app import { algoKitLogCaptureFixture, algorandFixture } from '../testing' import { ABIAppCallArg } from './app' import { ApplicationClient } from './app-client' +import { AppManager } from './app-manager' import { AppSpec } from './app-spec' describe('application-client', () => { @@ -428,14 +429,11 @@ describe('application-client', () => { // If the rekey didn't work this will throw const rekeyedAccount = algorand.account.rekeyed(testAccount.addr, rekeyTo) - await algokit.transferAlgos( - { - amount: (0).algo(), - from: rekeyedAccount, - to: testAccount, - }, - algod, - ) + await algorand.send.payment({ + amount: (0).algo(), + sender: rekeyedAccount.addr, + receiver: testAccount.addr, + }) }) test('Create app with abi', async () => { @@ -542,42 +540,34 @@ describe('application-client', () => { }) test('Construct transaction with abi encoding including transaction', async () => { - const { algod, indexer, testAccount } = localnet.context - const txn = await algokit.transferAlgos( - { - from: testAccount, - to: testAccount.addr, - amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), - skipSending: true, - }, - algod, - ) + const { algod, algorand, indexer, testAccount } = localnet.context + const txn = await algorand.transactions.payment({ + sender: testAccount.addr, + receiver: testAccount.addr, + amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), + }) const { client } = await deploy(testAccount, algod, indexer) const result = await client.call({ method: 'call_abi_txn', - methodArgs: [txn.transaction, 'test'], + methodArgs: [txn, 'test'], }) invariant(result.confirmations) invariant(result.confirmations[1]) expect(result.transactions.length).toBe(2) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const returnValue = algokit.getABIReturn({ method: client.getABIMethod('call_abi_txn')!, methodArgs: [] }, result.confirmations[1]) - expect(returnValue?.returnValue).toBe(`Sent ${txn.transaction.amount}. test`) + const returnValue = AppManager.getABIReturn(result.confirmations[1], client.getABIMethod('call_abi_txn')!) + expect(returnValue?.returnValue).toBe(`Sent ${txn.amount}. test`) }) test('Sign all transactions in group with abi call with transaction arg', async () => { - const { algod, indexer, testAccount } = localnet.context - const txn = await algokit.transferAlgos( - { - from: testAccount, - to: testAccount.addr, - amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), - skipSending: true, - }, - algod, - ) + const { algod, algorand, indexer, testAccount } = localnet.context + const txn = await algorand.transactions.payment({ + sender: testAccount.addr, + receiver: testAccount.addr, + amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), + }) const { client } = await deploy(testAccount, algod, indexer) let indexes: number[] = [] @@ -588,7 +578,7 @@ describe('application-client', () => { await client.call({ method: 'call_abi_txn', - methodArgs: [txn.transaction, 'test'], + methodArgs: [txn, 'test'], sender: { addr: testAccount.addr, signer }, }) @@ -596,19 +586,13 @@ describe('application-client', () => { }) test('Sign transaction in group with different signer if provided', async () => { - const { algod, indexer, testAccount, generateAccount } = localnet.context + const { algod, algorand, indexer, testAccount, generateAccount } = localnet.context const signer = await generateAccount({ initialFunds: (1).algo() }) - const transaction = ( - await algokit.transferAlgos( - { - from: signer, - to: signer.addr, - amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), - skipSending: true, - }, - algod, - ) - ).transaction + const transaction = await algorand.transactions.payment({ + sender: signer.addr, + receiver: signer.addr, + amount: algokit.microAlgo(Math.ceil(Math.random() * 10000)), + }) const { client } = await deploy(testAccount, algod, indexer) await client.call({ @@ -633,11 +617,7 @@ describe('application-client', () => { invariant(result.confirmations) invariant(result.confirmations[0]) expect(result.transactions.length).toBe(1) - const returnValue = algokit.getABIReturn( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - { method: client.getABIMethod('call_abi_foreign_refs')!, methodArgs: [] }, - result.confirmations[0], - ) + const returnValue = AppManager.getABIReturn(result.confirmations[0], client.getABIMethod('call_abi_foreign_refs')!) const testAccountPublicKey = algosdk.decodeAddress(testAccount.addr).publicKey expect(returnValue?.returnValue).toBe(`App: 345, Asset: 567, Account: ${testAccountPublicKey[0]}:${testAccountPublicKey[1]}`) }) diff --git a/src/types/app-client.ts b/src/types/app-client.ts index 56f8319f..efa9bec9 100644 --- a/src/types/app-client.ts +++ b/src/types/app-client.ts @@ -4,7 +4,6 @@ import { callApp, compileTeal, createApp, - getABIMethodSignature, getAppBoxNames, getAppBoxValue, getAppBoxValueFromABIType, @@ -625,7 +624,7 @@ export class ApplicationClient { !call.sendParams?.atc && // The method is readonly // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.appSpec.hints[getABIMethodSignature(this.getABIMethod(call.method)!)].read_only + this.appSpec.hints[this.getABIMethodSignature(this.getABIMethod(call.method)!)].read_only ) { const atc = new AtomicTransactionComposer() await this.callOfType({ ...call, sendParams: { ...call.sendParams, atc } }, 'no_op') @@ -886,7 +885,7 @@ export class ApplicationClient { throw new Error(`Attempt to call ABI method ${args.method}, but it wasn't found`) } - const methodSignature = getABIMethodSignature(abiMethod) + const methodSignature = this.getABIMethodSignature(abiMethod) return { ...args, @@ -908,7 +907,7 @@ export class ApplicationClient { const method = defaultValueStrategy.data as ABIMethodParams const result = await this.callOfType( { - method: getABIMethodSignature(method), + method: this.getABIMethodSignature(method), methodArgs: method.args.map(() => undefined), sender, }, @@ -951,13 +950,13 @@ export class ApplicationClient { `Received a call to method ${method} in contract ${ this._appName }, but this resolved to multiple methods; please pass in an ABI signature instead: ${methods - .map(getABIMethodSignature) + .map(this.getABIMethodSignature) .join(', ')}`, ) } return methods[0] } - return this.appSpec.contract.methods.find((m) => getABIMethodSignature(m) === method) + return this.appSpec.contract.methods.find((m) => this.getABIMethodSignature(m) === method) } /** @@ -1022,4 +1021,8 @@ export class ApplicationClient { ) else return e } + + private getABIMethodSignature(method: ABIMethodParams | ABIMethod) { + return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature() + } } diff --git a/src/types/app-deployer.ts b/src/types/app-deployer.ts new file mode 100644 index 00000000..6235b375 --- /dev/null +++ b/src/types/app-deployer.ts @@ -0,0 +1,562 @@ +import algosdk from 'algosdk' +import { Config } from '../config' +import * as indexer from '../indexer-lookup' +import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender' +import { + APP_DEPLOY_NOTE_DAPP, + OnSchemaBreak, + OnUpdate, + type ABIReturn, + type AppDeployMetadata, + type SendAppCreateTransactionResult, + type SendAppUpdateTransactionResult, + type TealTemplateParams, +} from './app' +import { AppManager } from './app-manager' +import AlgoKitComposer, { + AppCreateMethodCall, + AppCreateParams, + AppDeleteMethodCall, + AppDeleteParams, + AppUpdateMethodCall, + AppUpdateParams, + ExecuteParams, +} from './composer' +import { Expand } from './expand' +import { ConfirmedTransactionResult } from './transaction' + +/** The parameters to idempotently deploy an app */ +export interface AppDeployParams { + /** The deployment metadata */ + metadata: AppDeployMetadata + /** Any deploy-time parameters to replace in the TEAL code before compiling it (used if teal code is passed in as a string) */ + deployTimeParams?: TealTemplateParams + /** What action to perform if a schema break (storage schema or extra pages change) is detected: + * + * * `replace` - Delete the old app and create a new one + * * `fail` - Fail the deployment (throw an error) + * * `append` - Deploy a new app and leave the old one as is + */ + onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak + /** What action to perform if a TEAL code update is detected: + * + * * `update` - Update the app with the new TEAL code + * * `replace` - Delete the old app and create a new one + * * `fail` - Fail the deployment (throw an error) + * * `append` - Deploy a new app and leave the old one as is + */ + onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate + /** Create transaction parameters to use if a create needs to be issued as part of deployment */ + createParams: AppCreateParams | AppCreateMethodCall + /** Update transaction parameters to use if an update needs to be issued as part of deployment */ + updateParams: + | Expand> + | Expand> + /** Delete transaction parameters to use if a delete needs to be issued as part of deployment */ + deleteParams: Expand> | Expand> + /** Parameters to use for transaction execution */ + executeParams?: ExecuteParams + /** Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup */ + existingDeployments?: AppLookup + /** Whether or not to ignore the app metadata cache and force a lookup, default: use the cache **/ + ignoreCache?: boolean +} + +/** The metadata that can be collected about a deployed app */ +export interface AppMetadata extends AppDeployMetadata { + /** The id of the app */ + appId: bigint + /** The Algorand address of the account associated with the app */ + appAddress: string + /** The round the app was created */ + createdRound: bigint + /** The last round that the app was updated */ + updatedRound: bigint + /** The metadata when the app was created */ + createdMetadata: AppDeployMetadata + /** Whether or not the app is deleted */ + deleted: boolean +} + +/** A lookup of name -> Algorand app for a creator */ +export interface AppLookup { + /** The address of the creator associated with this lookup */ + creator: Readonly + /** A hash map of app name to app metadata */ + apps: { + [name: string]: AppMetadata + } +} + +export type AppDeployResult = + | Expand<{ operationPerformed: 'create' } & AppMetadata & SendAppCreateTransactionResult> + | Expand<{ operationPerformed: 'update' } & AppMetadata & SendAppUpdateTransactionResult> + | Expand< + { operationPerformed: 'replace' } & AppMetadata & + SendAppCreateTransactionResult & { + deleteReturn?: ABIReturn + deleteResult: ConfirmedTransactionResult + } + > + | Expand<{ operationPerformed: 'nothing' } & AppMetadata> + +/** Allows management of deployment and deployment metadata of applications. */ +export class AppDeployer { + private _appManager: AppManager + private _transactionSender: AlgorandClientTransactionSender + private _indexer?: algosdk.Indexer + private _appLookups = new Map() + + /** + * Creates an `AppManager` + * @param appManager An `AppManager` instance + * @param transactionSender An `AlgorandClientTransactionSender` instance + * @param indexer An optional indexer instance; supply if you want to indexer to look up app metadata + */ + constructor(appManager: AppManager, transactionSender: AlgorandClientTransactionSender, indexer?: algosdk.Indexer) { + this._appManager = appManager + this._transactionSender = transactionSender + this._indexer = indexer + } + + /** + * 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. + * @param deployment The arguments to control the app deployment + * @returns The app reference of the new/existing app + */ + async deploy(deployment: AppDeployParams): Promise { + const { + metadata, + deployTimeParams, + onSchemaBreak, + onUpdate, + createParams, + updateParams, + deleteParams, + executeParams, + existingDeployments, + ignoreCache, + } = deployment + + // Set creation note + + createParams.note = updateParams.note = AlgoKitComposer.arc2Note({ + dAppName: APP_DEPLOY_NOTE_DAPP, + data: metadata, + format: 'j', + }) + + // Check for required fields + + if (existingDeployments && existingDeployments.creator !== createParams.sender) { + throw new Error( + `Received invalid existingDeployments value for creator ${existingDeployments.creator} when attempting to deploy for creator ${createParams.sender}`, + ) + } + if (!existingDeployments && !this._indexer) { + throw new Error( + `Didn't receive an indexer client when this AppManager was created, but also didn't receive an existingDeployments cache - one of them must be provided`, + ) + } + + Config.getLogger(executeParams?.suppressLog).info( + `Idempotently deploying app "${metadata.name}" from creator ${createParams.sender} using ${createParams.approvalProgram.length} bytes of ${typeof createParams.approvalProgram === 'string' ? 'teal code' : 'AVM bytecode'} and ${createParams.clearStateProgram.length} bytes of ${typeof createParams.approvalProgram === 'string' ? 'teal code' : 'AVM bytecode'}`, + ) + + // Compile code if required + + const compiledApproval = + typeof createParams.approvalProgram === 'string' + ? await this._appManager.compileTealTemplate(createParams.approvalProgram, deployTimeParams, metadata) + : undefined + const approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : createParams.approvalProgram + + const compiledClear = + typeof createParams.clearStateProgram === 'string' + ? await this._appManager.compileTealTemplate(createParams.clearStateProgram, deployTimeParams) + : undefined + const clearStateProgram = compiledClear ? compiledClear.compiledBase64ToBytes : createParams.clearStateProgram + + // Define routines for create, update, and replace + + const createApp = async () => { + const result = await ('method' in createParams + ? this._transactionSender.appCreateMethodCall({ ...createParams, approvalProgram, clearStateProgram, ...executeParams }) + : this._transactionSender.appCreate({ ...createParams, approvalProgram, clearStateProgram, ...executeParams })) + const appMetadata: AppMetadata = { + appId: result.appId, + appAddress: result.appAddress, + ...metadata, + createdMetadata: metadata, + createdRound: BigInt(result.confirmation.confirmedRound!), + updatedRound: BigInt(result.confirmation.confirmedRound!), + deleted: false, + } + this.updateAppLookup(createParams.sender, appMetadata) + return { + operationPerformed: 'create', + compiledApproval, + compiledClear, + ...result, + ...appMetadata, + } satisfies SendAppCreateTransactionResult & AppMetadata & { operationPerformed: 'create' } + } + const updateApp = async (existingApp: AppMetadata) => { + Config.getLogger(executeParams?.suppressLog).info( + `Updating existing ${metadata.name} app for ${createParams.sender} to version ${metadata.version}.`, + ) + const result = await ('method' in updateParams + ? this._transactionSender.appUpdateMethodCall({ + appId: existingApp.appId, + approvalProgram, + clearStateProgram, + ...updateParams, + ...executeParams, + }) + : this._transactionSender.appUpdate({ + appId: existingApp.appId, + approvalProgram, + clearStateProgram, + ...updateParams, + ...executeParams, + })) + const appMetadata: AppMetadata = { + appId: existingApp.appId, + appAddress: existingApp.appAddress, + createdMetadata: existingApp.createdMetadata, + createdRound: existingApp.createdRound, + updatedRound: BigInt(result.confirmation.confirmedRound!), + ...metadata, + deleted: false, + } + this.updateAppLookup(createParams.sender, appMetadata) + return { + operationPerformed: 'update', + compiledApproval, + compiledClear, + ...result, + ...appMetadata, + } satisfies SendAppUpdateTransactionResult & AppMetadata & { operationPerformed: 'update' } + } + const replaceApp = async (existingApp: AppMetadata) => { + Config.getLogger(executeParams?.suppressLog).info( + `Deploying a new ${metadata.name} app for ${createParams.sender}; deploying app with version ${metadata.version}.`, + ) + + Config.getLogger(executeParams?.suppressLog).warn( + `Deleting existing ${metadata.name} app with id ${existingApp.appId} from ${deleteParams.sender} account.`, + ) + + const composer = this._transactionSender.newGroup() + if ('method' in createParams) { + composer.addAppCreateMethodCall({ ...createParams, approvalProgram, clearStateProgram }) + } else { + composer.addAppCreate({ ...createParams, approvalProgram, clearStateProgram }) + } + const createIndex = await composer.count() + if ('method' in deleteParams) { + composer.addAppDeleteMethodCall({ appId: existingApp.appId, ...deleteParams }) + } else { + composer.addAppDelete({ appId: existingApp.appId, ...deleteParams }) + } + const result = await composer.execute({ ...executeParams, suppressLog: true }) + const confirmation = result.confirmations.at(createIndex - 1)! + const transaction = result.transactions.at(createIndex - 1)! + const deleteTransaction = result.transactions.at(-1)! + + Config.getLogger(executeParams?.suppressLog).warn( + `Sent transactions ${transaction.txID()} to create app with id ${confirmation.applicationIndex} and ${deleteTransaction.txID()} to delete app with id ${ + existingApp.appId + } from ${createParams.sender} account.`, + ) + + const appMetadata: AppMetadata = { + appId: BigInt(confirmation.applicationIndex!), + appAddress: algosdk.getApplicationAddress(confirmation.applicationIndex!), + ...metadata, + createdMetadata: metadata, + createdRound: BigInt(confirmation.confirmedRound!), + updatedRound: BigInt(confirmation.confirmedRound!), + deleted: false, + } + this.updateAppLookup(createParams.sender, appMetadata) + + return { + operationPerformed: 'replace', + ...result, + compiledApproval, + compiledClear, + transaction, + confirmation, + return: 'method' in createParams ? result.returns?.[0] : undefined, + deleteReturn: 'method' in deleteParams ? result.returns?.at(-1) : undefined, + ...appMetadata, + deleteResult: { transaction: deleteTransaction, confirmation: result.confirmations.at(-1)! }, + } satisfies { operationPerformed: 'replace' } & AppMetadata & + SendAppCreateTransactionResult & { + deleteReturn?: ABIReturn + deleteResult: ConfirmedTransactionResult + } + } + + // Lookup existing app metadata + + const apps = existingDeployments ?? (await this.getCreatorAppsByName(createParams.sender, ignoreCache)) + + const existingApp = apps.apps[metadata.name] + if (!existingApp || existingApp.deleted) { + Config.getLogger(executeParams?.suppressLog).info( + `App ${metadata.name} not found in apps created by ${createParams.sender}; deploying app with version ${metadata.version}.`, + ) + + return await createApp() + } + + Config.getLogger(executeParams?.suppressLog).info( + `Existing app ${metadata.name} found by creator ${createParams.sender}, with app id ${existingApp.appId} and version ${existingApp.version}.`, + ) + + const existingAppRecord = await this._appManager.getById(existingApp.appId) + const existingApproval = Buffer.from(existingAppRecord.approvalProgram).toString('base64') + const existingClear = Buffer.from(existingAppRecord.clearStateProgram).toString('base64') + + const newApproval = Buffer.from(approvalProgram).toString('base64') + const newClear = Buffer.from(clearStateProgram).toString('base64') + + // Check for changes + + const isUpdate = newApproval !== existingApproval || newClear !== existingClear + const isSchemaBreak = + existingAppRecord.localInts < (createParams.schema?.localInts ?? 0) || + existingAppRecord.globalInts < (createParams.schema?.globalInts ?? 0) || + existingAppRecord.localByteSlices < (createParams.schema?.localByteSlices ?? 0) || + existingAppRecord.globalByteSlices < (createParams.schema?.globalByteSlices ?? 0) + + if (isSchemaBreak) { + Config.getLogger(executeParams?.suppressLog).warn(`Detected a breaking app schema change in app ${existingApp.appId}:`, { + from: { + globalInts: existingAppRecord.globalInts, + globalByteSlices: existingAppRecord.globalByteSlices, + localInts: existingAppRecord.localInts, + localByteSlices: existingAppRecord.localByteSlices, + }, + to: createParams.schema, + }) + + if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === OnSchemaBreak.Fail) { + throw new Error( + 'Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' + + 'If you want to try deleting and recreating the app then ' + + 're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp', + ) + } + + if (onSchemaBreak === 'append' || onSchemaBreak === OnSchemaBreak.AppendApp) { + Config.getLogger(executeParams?.suppressLog).info('onSchemaBreak=AppendApp, will attempt to create a new app') + return await createApp() + } + + if (existingApp.deletable) { + Config.getLogger(executeParams?.suppressLog).info( + 'App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app', + ) + } else { + Config.getLogger(executeParams?.suppressLog).info( + 'App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail', + ) + } + + return await replaceApp(existingApp) + } + + if (isUpdate) { + Config.getLogger(executeParams?.suppressLog).info( + `Detected a TEAL update in app ${existingApp.appId} for creator ${createParams.sender}`, + ) + + if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === OnUpdate.Fail) { + throw new Error('Update detected and onUpdate=Fail, stopping deployment. Try a different onUpdate value to not fail.') + } + + if (onUpdate === 'append' || onUpdate === OnUpdate.AppendApp) { + Config.getLogger(executeParams?.suppressLog).info('onUpdate=AppendApp, will attempt to create a new app') + return await createApp() + } + + if (onUpdate === 'update' || onUpdate === OnUpdate.UpdateApp) { + if (existingApp.updatable) { + Config.getLogger(executeParams?.suppressLog).info(`App is updatable and onUpdate=UpdateApp, updating app...`) + } else { + Config.getLogger(executeParams?.suppressLog).warn( + `App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`, + ) + } + + return await updateApp(existingApp) + } + + if (onUpdate === 'replace' || onUpdate === OnUpdate.ReplaceApp) { + if (existingApp.deletable) { + Config.getLogger(executeParams?.suppressLog).warn( + 'App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...', + ) + } else { + Config.getLogger(executeParams?.suppressLog).warn( + 'App is not deletable and onUpdate=ReplaceApp, will attempt to create new app and delete old app, delete will most likely fail', + ) + } + + return await replaceApp(existingApp) + } + } + + Config.getLogger(executeParams?.suppressLog).debug('No detected changes in app, nothing to do.') + + return { ...existingApp, operationPerformed: 'nothing' } + } + + private updateAppLookup(sender: string, appMetadata: AppMetadata) { + const lookup = this._appLookups.get(sender) + if (!lookup) { + this._appLookups.set(sender, { creator: sender, apps: { [appMetadata.name]: appMetadata } }) + } else { + lookup.apps[appMetadata.name] = appMetadata + } + } + + /** + * 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 will not require an indexer lookup. + * + * If the `AppManager` instance wasn't created with an indexer client, this function will throw an error. + * + * @param creatorAddress The address of the account that is the creator of the apps you want to search for + * @param ignoreCache Whether ot not to ignore the cache and force a lookup, default: use the cache + * @returns A name-based lookup of the app metadata + */ + async getCreatorAppsByName(creatorAddress: string, ignoreCache?: boolean): Promise { + const appLookup: Record = {} + + if (!ignoreCache && this._appLookups.has(creatorAddress)) { + return this._appLookups.get(creatorAddress)! + } + + if (!this._indexer) { + throw new Error(`Didn't receive an indexer client when this AppManager was created, but received a call to getCreatorApps`) + } + + // Extract all apps that account created + const createdApps = (await indexer.lookupAccountCreatedApplicationByAddress(this._indexer, creatorAddress)) + .map((a) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return { id: BigInt(a.id), createdAtRound: a['created-at-round']!, deleted: a.deleted } + }) + .sort((a, b) => a.createdAtRound - b.createdAtRound) + + // For each app that account created (in parallel)... + const apps = await Promise.all( + createdApps.map(async (createdApp) => { + // Find any app transactions for that app in the round it was created (should always just be a single creation transaction) + const appTransactions = await indexer.searchTransactions(this._indexer!, (s) => + s + .minRound(createdApp.createdAtRound) + .txType(algosdk.TransactionType.appl) + .applicationID(Number(createdApp.id)) + .address(creatorAddress) + .addressRole('sender') + .notePrefix(Buffer.from(APP_DEPLOY_NOTE_DAPP).toString('base64')), + ) + + // Triple check the transaction is intact by filtering for the one we want: + // * application-id is 0 when the app is first created + // * also verify the sender to prevent a potential security risk + const appCreationTransaction = appTransactions.transactions.filter( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + (t) => t['application-transaction']!['application-id'] === 0 && t.sender === creatorAddress, + )[0] + + const latestAppUpdateTransaction = appTransactions.transactions + .filter((t) => t.sender === creatorAddress) + .sort((a, b) => + a['confirmed-round'] === b['confirmed-round'] + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + (b['intra-round-offset']! - a['intra-round-offset']!) / 10 + : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + b['confirmed-round']! - a['confirmed-round']!, + )[0] + + if (!appCreationTransaction?.note) + // No note; ignoring + return null + + return { createdApp, appCreationTransaction, latestAppUpdateTransaction } + }), + ) + + apps + .filter((a) => a !== null) + .forEach((a) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const { createdApp, appCreationTransaction, latestAppUpdateTransaction } = a! + + const parseNote = (note?: string) => { + if (!note) { + // No note; ignoring... + return + } + + const decoder = new TextDecoder() + const noteAsBase64 = decoder.decode(Buffer.from(note)) + const noteAsString = Buffer.from(noteAsBase64, 'base64').toString('utf-8') + + if (!noteAsString.startsWith(`${APP_DEPLOY_NOTE_DAPP}:j{`)) + // Clearly not APP_DEPLOY JSON; ignoring... + return + + return JSON.parse(noteAsString.substring(APP_DEPLOY_NOTE_DAPP.length + 2)) as AppDeployMetadata + } + + try { + const creationNote = parseNote(appCreationTransaction.note) + const updateNote = parseNote(latestAppUpdateTransaction.note) + if (creationNote?.name) { + appLookup[creationNote.name] = { + appId: createdApp.id, + appAddress: algosdk.getApplicationAddress(createdApp.id), + createdMetadata: creationNote, + createdRound: BigInt(appCreationTransaction['confirmed-round'] ?? 0), + ...(updateNote ?? creationNote), + updatedRound: BigInt(latestAppUpdateTransaction?.['confirmed-round'] ?? 0), + deleted: createdApp.deleted ?? false, + } + } + } catch (e) { + Config.logger.warn( + `Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, + e, + ) + return + } + }) + + const lookup = { + creator: creatorAddress, + apps: appLookup, + } + + this._appLookups.set(creatorAddress, lookup) + + return lookup + } +} diff --git a/src/types/app-manager.ts b/src/types/app-manager.ts new file mode 100644 index 00000000..94be9d42 --- /dev/null +++ b/src/types/app-manager.ts @@ -0,0 +1,476 @@ +import algosdk from 'algosdk' +import { TransactionSignerAccount } from './account' +import { + BoxName, + DELETABLE_TEMPLATE_NAME, + UPDATABLE_TEMPLATE_NAME, + type ABIReturn, + type AppDeployMetadata, + type AppState, + type CompiledTeal, + type TealTemplateParams, +} from './app' +import modelsv2 = algosdk.modelsv2 + +/** Information about an app. */ +export interface AppInformation { + /** The ID of the app. */ + appId: bigint + /** The escrow address that the app operates with. */ + appAddress: string + /** + * Approval program. + */ + approvalProgram: Uint8Array + /** + * Clear state program. + */ + clearStateProgram: Uint8Array + /** + * The address that created this application. This is the address where the + * parameters and global state for this application can be found. + */ + creator: string + /** + * Current global state values. + */ + globalState: AppState + /** The number of allocated ints in per-user local state. */ + localInts: number + /** The number of allocated byte slices in per-user local state. */ + localByteSlices: number + /** The number of allocated ints in global state. */ + globalInts: number + /** The number of allocated byte slices in global state. */ + globalByteSlices: number + /** Any extra pages that are needed for the smart contract. */ + extraProgramPages?: number +} + +/** + * Something that identifies an app box name - either a: + * * `Uint8Array` (the actual binary of the box name) + * * `string` (that will be encoded to a `Uint8Array`) + * * `TransactionSignerAccount` (that will be encoded into the + * public key address of the corresponding account) + */ +export type BoxIdentifier = string | Uint8Array | TransactionSignerAccount + +/** + * A grouping of the app ID and name identifier to reference an app box. + */ +export interface BoxReference { + /** + * A unique application id + */ + appId: bigint + /** + * Identifier for a box name + */ + name: BoxIdentifier +} + +/** + * Parameters to get and decode a box value as an ABI type. + */ +export interface BoxValueRequestParams { + /** The ID of the app return box names for */ + appId: bigint + /** The name of the box to return either as a string, binary array or `BoxName` */ + boxName: BoxIdentifier + /** The ABI type to decode the value using */ + type: algosdk.ABIType +} + +/** + * Parameters to get and decode a box value as an ABI type. + */ +export interface BoxValuesRequestParams { + /** The ID of the app return box names for */ + appId: bigint + /** The names of the boxes to return either as a string, binary array or BoxName` */ + boxNames: BoxIdentifier[] + /** The ABI type to decode the value using */ + type: algosdk.ABIType +} + +/** Allows management of application information. */ +export class AppManager { + private _algod: algosdk.Algodv2 + private _compilationResults: Record = {} + + /** + * Creates an `AppManager` + * @param algod An algod instance + */ + constructor(algod: algosdk.Algodv2) { + this._algod = algod + } + + /** + * Compiles the given TEAL using algod and returns the result, including source map. + * + * The result of this compilation is also cached keyed by the TEAL + * code so it can be retrieved via `getCompilationResult`. + * + * This function is re-entrant; it will only compile the same code once. + * + * @param tealCode The TEAL code + * @returns The information about the compiled file + */ + async compileTeal(tealCode: string): Promise { + if (this._compilationResults[tealCode]) { + return this._compilationResults[tealCode] + } + + const compiled = await this._algod.compile(tealCode).sourcemap(true).do() + const result = { + teal: tealCode, + compiled: compiled.result, + compiledHash: compiled.hash, + compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')), + sourceMap: new algosdk.SourceMap(compiled['sourcemap']), + } + this._compilationResults[tealCode] = result + return result + } + + /** + * Performs template substitution of a teal template and compiles it, returning the compiled result. + * + * Looks for `TMPL_{parameter}` for template replacements and replaces AlgoKit deploy-time control parameters + * if deployment metadata is specified. + * + * * `TMPL_UPDATABLE` for updatability / immutability control + * * `TMPL_DELETABLE` for deletability / permanence control + * + * @param tealTemplateCode The TEAL logic to compile + * @param templateParams Any parameters to replace in the .teal file before compiling + * @param deploymentMetadata The deployment metadata the app will be deployed with + * @returns The information about the compiled code + */ + async compileTealTemplate( + tealTemplateCode: string, + templateParams?: TealTemplateParams, + deploymentMetadata?: AppDeployMetadata, + ): Promise { + let tealCode = AppManager.stripTealComments(tealTemplateCode) + + tealCode = AppManager.replaceTealTemplateParams(tealCode, templateParams) + + if (deploymentMetadata) { + tealCode = AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, deploymentMetadata) + } + + return await this.compileTeal(tealCode) + } + + /** + * Returns a previous compilation result. + * @param tealCode The TEAL code + * @returns The information about the previously compiled file + * or `undefined` if that TEAL code wasn't previously compiled + */ + getCompilationResult(tealCode: string): CompiledTeal | undefined { + return this._compilationResults[tealCode] + } + + /** + * Returns the current app information for the app with the given ID. + * + * @example + * ```typescript + * const appInfo = await appManager.getById(12353n); + * ``` + * + * @param appId The ID of the app + * @returns The app information + */ + public async getById(appId: bigint): Promise { + const app = modelsv2.Application.from_obj_for_encoding(await this._algod.getApplicationByID(Number(appId)).do()) + return { + appId: BigInt(app.id), + appAddress: algosdk.getApplicationAddress(app.id), + approvalProgram: app.params.approvalProgram, + clearStateProgram: app.params.clearStateProgram, + creator: app.params.creator, + localInts: Number(app.params.localStateSchema?.numUint ?? 0), + localByteSlices: Number(app.params.localStateSchema?.numByteSlice ?? 0), + globalInts: Number(app.params.globalStateSchema?.numUint ?? 0), + globalByteSlices: Number(app.params.globalStateSchema?.numByteSlice ?? 0), + extraProgramPages: Number(app.params.extraProgramPages ?? 0), + globalState: AppManager.decodeAppState(app.params.globalState ?? []), + } + } + + /** + * Returns the current local state values for the given app ID and account address + * + * @param appId The ID of the app to return local state for + * @param address The string address of the account to get local state for the given app + * @returns The current local state for the given (app, account) combination + */ + public async getLocalState(appId: bigint, address: string) { + const appInfo = modelsv2.AccountApplicationResponse.from_obj_for_encoding( + await this._algod.accountApplicationInformation(address, Number(appId)).do(), + ) + + if (!appInfo.appLocalState?.keyValue) { + throw new Error("Couldn't find local state") + } + + return AppManager.decodeAppState(appInfo.appLocalState.keyValue) + } + + /** + * Returns the names of the current boxes for the given app. + * @param appId The ID of the app return box names for + * @returns The current box names + */ + public async getBoxNames(appId: bigint): Promise { + const boxResult = await this._algod.getApplicationBoxes(Number(appId)).do() + return boxResult.boxes.map((b) => { + return { + nameRaw: b.name, + nameBase64: Buffer.from(b.name).toString('base64'), + name: Buffer.from(b.name).toString('utf-8'), + } + }) + } + + /** + * Returns the value of the given box name for the given app. + * @param appId The ID of the app return box names for + * @param boxName The name of the box to return either as a string, binary array or `BoxName` + * @returns The current box value as a byte array + */ + public async getBoxValue(appId: bigint, boxName: BoxIdentifier): Promise { + const name = AppManager.getBoxReference(boxName).name + const boxResult = await this._algod.getApplicationBoxByName(Number(appId), name).do() + return boxResult.value + } + + /** + * Returns the value of the given box names for the given app. + * @param appId The ID of the app return box names for + * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName` + * @returns The current box values as a byte array in the same order as the passed in box names + */ + public async getBoxValues(appId: bigint, boxNames: BoxIdentifier[]): Promise { + return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValue(appId, boxName))) + } + + /** + * Returns the value of the given box name for the given app decoded based on the given ABI type. + * @param request The parameters for the box value request + * @returns The current box value as an ABI value + */ + public async getBoxValueFromABIType(request: BoxValueRequestParams): Promise { + const { appId, boxName, type } = request + const value = await this.getBoxValue(appId, boxName) + return type.decode(value) + } + + /** + * Returns the value of the given box names for the given app decoded based on the given ABI type. + * @param request The parameters for the box value request + * @returns The current box values as an ABI value in the same order as the passed in box names + */ + public async getBoxValuesFromABIType(request: BoxValuesRequestParams): Promise { + const { appId, boxNames, type } = request + return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValueFromABIType({ appId, boxName, type }))) + } + + /** + * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`. + * @param boxId The box to return a reference for + * @returns The box reference ready to pass into a `algosdk.Transaction` + */ + public static getBoxReference(boxId: BoxIdentifier | BoxReference): algosdk.BoxReference { + const ref = typeof boxId === 'object' && 'appId' in boxId ? boxId : { appId: 0n, name: boxId } + return { + appIndex: Number(ref.appId), + name: + typeof ref.name === 'string' + ? new TextEncoder().encode(ref.name) + : 'length' in ref.name + ? ref.name + : algosdk.decodeAddress(ref.name.addr).publicKey, + } as algosdk.BoxReference + } + + /** + * Converts an array of global/local state values from the algod api to a more friendly + * generic object keyed by the UTF-8 value of the key. + * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas` + * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values + */ + public static decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState { + const stateValues = {} as AppState + + // Start with empty set + for (const stateVal of state) { + const keyBase64 = stateVal.key + const keyRaw = Buffer.from(keyBase64, 'base64') + const key = keyRaw.toString('utf-8') + const tealValue = stateVal.value + + const dataTypeFlag = 'action' in tealValue ? tealValue.action : tealValue.type + let valueBase64: string + let valueRaw: Buffer + switch (dataTypeFlag) { + case 1: + valueBase64 = tealValue.bytes ?? '' + valueRaw = Buffer.from(valueBase64, 'base64') + stateValues[key] = { + keyRaw, + keyBase64, + valueRaw: new Uint8Array(valueRaw), + valueBase64: valueBase64, + value: valueRaw.toString('utf-8'), + } + break + case 2: { + const value = tealValue.uint ?? 0 + stateValues[key] = { + keyRaw, + keyBase64, + value, + } + break + } + default: + throw new Error(`Received unknown state data type of ${dataTypeFlag}`) + } + } + + return stateValues + } + + /** + * Returns any ABI return values for the given app call arguments and transaction confirmation. + * @param confirmation The transaction confirmation from algod + * @param method The ABI method + * @returns The return value for the method call + */ + public static getABIReturn( + confirmation: modelsv2.PendingTransactionResponse | undefined, + method: algosdk.ABIMethod | undefined, + ): ABIReturn | undefined { + if (!method || !confirmation || method.returns.type === 'void') { + return undefined + } + + // The parseMethodResponse method mutates the second parameter :( + const resultDummy: algosdk.ABIResult = { + txID: '', + method, + rawReturnValue: new Uint8Array(), + } + const response = algosdk.AtomicTransactionComposer.parseMethodResponse(method, resultDummy, confirmation) + return !response.decodeError + ? { + rawReturnValue: response.rawReturnValue, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + returnValue: response.returnValue!, + decodeError: undefined, + } + : { + rawReturnValue: undefined, + returnValue: undefined, + decodeError: response.decodeError, + } + } + + /** + * Replaces AlgoKit deploy-time deployment control parameters within the given TEAL template code. + * + * * `TMPL_UPDATABLE` for updatability / immutability control + * * `TMPL_DELETABLE` for deletability / permanence control + * + * Note: If these values are defined, but the corresponding `TMPL_*` value + * isn't in the teal code it will throw an exception. + * + * @param tealTemplateCode The TEAL template code to substitute + * @param params The deploy-time deployment control parameter value to replace + * @returns The replaced TEAL code + */ + static replaceTealTemplateDeployTimeControlParams(tealTemplateCode: string, params: { updatable?: boolean; deletable?: boolean }) { + if (params.updatable !== undefined) { + if (!tealTemplateCode.includes(UPDATABLE_TEMPLATE_NAME)) { + throw new Error( + `Deploy-time updatability control requested for app deployment, but ${UPDATABLE_TEMPLATE_NAME} not present in TEAL code`, + ) + } + tealTemplateCode = tealTemplateCode.replace(new RegExp(UPDATABLE_TEMPLATE_NAME, 'g'), (params.updatable ? 1 : 0).toString()) + } + + if (params.deletable !== undefined) { + if (!tealTemplateCode.includes(DELETABLE_TEMPLATE_NAME)) { + throw new Error( + `Deploy-time deletability control requested for app deployment, but ${DELETABLE_TEMPLATE_NAME} not present in TEAL code`, + ) + } + tealTemplateCode = tealTemplateCode.replace(new RegExp(DELETABLE_TEMPLATE_NAME, 'g'), (params.deletable ? 1 : 0).toString()) + } + + return tealTemplateCode + } + + /** + * Performs template substitution of a teal file. + * + * Looks for `TMPL_{parameter}` for template replacements. + * + * @param tealTemplateCode The TEAL template code to make parameter replacements in + * @param templateParams Any parameters to replace in the teal code + * @returns The TEAL code with replacements + */ + static replaceTealTemplateParams(tealTemplateCode: string, templateParams?: TealTemplateParams) { + if (templateParams !== undefined) { + for (const key in templateParams) { + const value = templateParams[key] + const token = `TMPL_${key.replace(/^TMPL_/, '')}` + + // If this is a number, first replace any byte representations of the number + // These may appear in the TEAL in order to circumvent int compression and preserve PC values + if (typeof value === 'number' || typeof value === 'boolean') { + tealTemplateCode = tealTemplateCode.replace(new RegExp(`(?<=bytes )${token}`, 'g'), `0x${value.toString(16).padStart(16, '0')}`) + + // We could probably return here since mixing pushint and pushbytes is likely not going to happen, but might as well do both + } + + tealTemplateCode = tealTemplateCode.replace( + new RegExp(token, 'g'), + typeof value === 'string' + ? `0x${Buffer.from(value, 'utf-8').toString('hex')}` + : ArrayBuffer.isView(value) + ? `0x${Buffer.from(value).toString('hex')}` + : value.toString(), + ) + } + } + + return tealTemplateCode + } + + /** + * Remove comments from TEAL code (useful to reduce code size before compilation). + * + * @param tealCode The TEAL logic to strip + * @returns The TEAL without comments + */ + static stripTealComments(tealCode: string) { + // find // outside quotes, i.e. won't pick up "//not a comment" + const regex = /\/\/(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)/ + + tealCode = tealCode + .split('\n') + .map((tealCodeLine) => { + return tealCodeLine.split(regex)[0].trim() + }) + .join('\n') + + return tealCode + } +} diff --git a/src/types/app.ts b/src/types/app.ts index eca2936d..8af17bd8 100644 --- a/src/types/app.ts +++ b/src/types/app.ts @@ -1,5 +1,7 @@ import algosdk from 'algosdk' +import { Expand } from './expand' import { + SendSingleTransactionResult, SendTransactionFrom, SendTransactionParams, SendTransactionResult, @@ -24,7 +26,7 @@ export const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE' /** The name of the TEAL template variable for deploy-time permanence control */ export const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE' -/** The app create/update ARC-2 transaction note prefix */ +/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */ export const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER' /** The maximum number of bytes in a single app code page */ @@ -42,6 +44,8 @@ export interface AppReference { } /** + * @deprecated Use `types/app-manager/BoxReference` instead. + * * A grouping of the app ID and name of the box in an Uint8Array */ export interface BoxReference { @@ -56,6 +60,8 @@ export interface BoxReference { } /** + * @deprecated Use `types/app-manager/BoxIdentifier` instead. + * * Something that identifies a box name - either a: * * `Uint8Array` * * `string` (that will be encoded to a Uint8Array) @@ -117,7 +123,11 @@ export type ABIAppCallArgs = CoreAppCallArgs & { **/ export type AppCallArgs = RawAppCallArgs | ABIAppCallArgs -/** Base interface for common data passed to an app create or update. */ +/** + * @deprecated Use `AlgoKitComposer` to construct create app transactions instead. + * + * Base interface for common data passed to an app create or update. + */ interface CreateOrUpdateAppParams extends SendTransactionParams { /** The account (with private key loaded) that will send the transaction */ from: SendTransactionFrom @@ -133,7 +143,10 @@ interface CreateOrUpdateAppParams extends SendTransactionParams { args?: AppCallArgs } -/** Parameters that are passed in when creating an app. */ +/** + * @deprecated Use `AlgoKitComposer` to construct create app transactions instead. + * + * Parameters that are passed in when creating an app. */ export interface CreateAppParams extends CreateOrUpdateAppParams { /** The storage schema to request for the created app */ schema: AppStorageSchema @@ -141,13 +154,19 @@ export interface CreateAppParams extends CreateOrUpdateAppParams { onCompleteAction?: Exclude | Exclude } -/** Parameters that are passed in when updating an app. */ +/** + * @deprecated Use `AlgoKitComposer` to construct update app transactions instead. + * + * Parameters that are passed in when updating an app. */ export interface UpdateAppParams extends CreateOrUpdateAppParams { /** The id of the app to update */ appId: number | bigint } -/** The type of call / [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for a smart contract call. +/** + * @deprecated Use `algosdk.OnApplicationComplete` directly instead. + * + * The type of call / [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for a smart contract call. * * Equivalent of `algosdk.OnApplicationComplete`, but as a more convenient string enum. * @@ -318,6 +337,27 @@ export interface AppCompilationResult { compiledClear: CompiledTeal } +/** Result from sending a single app transaction. */ +export type SendAppTransactionResult = Expand< + SendSingleTransactionResult & { + /** If an ABI method was called the processed return value */ + return?: ABIReturn + } +> + +/** Result from sending a single app transaction. */ +export type SendAppUpdateTransactionResult = Expand> + +/** Result from sending a single app transaction. */ +export type SendAppCreateTransactionResult = Expand< + SendAppUpdateTransactionResult & { + /** The id of the created app */ + appId: bigint + /** The Algorand address of the account associated with the app */ + appAddress: string + } +> + /** Object holding app state values */ export interface AppState { [key: string]: @@ -335,7 +375,8 @@ export interface AppState { } } -/** The name of a box storage box */ +/** + * The name of a box storage box */ export interface BoxName { /** Name in UTF-8 */ name: string @@ -346,6 +387,7 @@ export interface BoxName { } /** + * @deprecated Use `types/app-manager/BoxValueRequestParams` instead. * Parameters to get and decode a box value as an ABI type. */ export interface BoxValueRequestParams { @@ -358,6 +400,7 @@ export interface BoxValueRequestParams { } /** + * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead. * Parameters to get and decode a box value as an ABI type. */ export interface BoxValuesRequestParams { diff --git a/src/types/client-manager.ts b/src/types/client-manager.ts index 80bf2300..8258d599 100644 --- a/src/types/client-manager.ts +++ b/src/types/client-manager.ts @@ -92,6 +92,11 @@ export class ClientManager { return this._indexer } + /** Returns an algosdk Indexer API client or `undefined` if it's not been provided. */ + public get indexerIfPresent(): algosdk.Indexer | undefined { + return this._indexer + } + /** Returns an algosdk KMD API client or throws an error if it's not been provided. */ public get kmd(): algosdk.Kmd { if (!this._kmd) throw new Error('Attempt to use Kmd client in AlgoKit instance with no Kmd configured') diff --git a/src/types/composer.ts b/src/types/composer.ts index 0c5ea70c..e2cd2c4c 100644 --- a/src/types/composer.ts +++ b/src/types/composer.ts @@ -2,8 +2,11 @@ import algosdk from 'algosdk' import { encodeLease, encodeTransactionNote, sendAtomicTransactionComposer } from '../transaction/transaction' import { TransactionSignerAccount } from './account' import { AlgoAmount } from './amount' +import { APP_PAGE_MAX_SIZE } from './app' +import { AppManager, BoxIdentifier, BoxReference } from './app-manager' +import { Expand } from './expand' import { genesisIdIsLocalNet } from './network-client' -import { SendAtomicTransactionComposerResults } from './transaction' +import { Arc2TransactionNote, SendAtomicTransactionComposerResults } from './transaction' import Transaction = algosdk.Transaction import TransactionWithSigner = algosdk.TransactionWithSigner import isTransactionWithSigner = algosdk.isTransactionWithSigner @@ -309,57 +312,96 @@ export type OnlineKeyRegistrationParams = CommonTransactionParams & { // preventAddressFromEverParticipatingAgain?: boolean // } -/** Parameters to define an application call transaction. */ -export type AppCallParams = CommonTransactionParams & { - /** The [OnComplete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) */ +/** Common parameters for defining an application call transaction. */ +export type CommonAppCallParams = CommonTransactionParams & { + /** ID of the application; 0 if the application is being created. */ + appId: bigint + /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. */ onComplete?: algosdk.OnApplicationComplete - /** ID of the application */ - appId?: bigint - /** The program to execute for all OnCompletes other than ClearState */ - approvalProgram?: Uint8Array - /** The program to execute for ClearState OnComplete */ - clearProgram?: Uint8Array - /** The state schema for the app. This is immutable. */ - schema?: { - /** The number of integers saved in global state */ - globalUints: number - /** The number of byte slices saved in global state */ - globalByteSlices: number - /** The number of integers saved in local state */ - localUints: number - /** The number of byte slices saved in local state */ - localByteSlices: number - } - /** Application arguments */ + /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */ args?: Uint8Array[] - /** Account references */ + /** Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */ accountReferences?: string[] - /** App references */ + /** The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */ appReferences?: bigint[] - /** Asset references */ + /** The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */ assetReferences?: bigint[] - /** Number of extra pages required for the programs */ - extraPages?: number - /** Box references */ - boxReferences?: algosdk.BoxReference[] + /** Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#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. + */ + boxReferences?: (BoxReference | BoxIdentifier)[] } -/** Parameters to define an ABI method application call transaction. */ -export type MethodCallParams = CommonTransactionParams & - Omit & { - /** ID of the application */ - appId: bigint - /** The ABI method to call */ - method: algosdk.ABIMethod - /** Arguments to the ABI method, either: - * * An ABI value - * * A transaction with explicit signer - * * A transaction (where the signer will be automatically assigned) - * * An unawaited transaction (e.g. from algorand.transactions.transactionType()) - * * Another method call (via method call params object) - */ - args?: (algosdk.ABIValue | TransactionWithSigner | Transaction | Promise | MethodCallParams)[] +export type AppCreateParams = Expand< + Omit & { + onComplete?: Exclude + /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */ + approvalProgram: string | Uint8Array + /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */ + clearStateProgram: string | Uint8Array + /** The state schema for the app. This is immutable once the app is created. */ + schema?: { + /** The number of integers saved in global state. */ + globalInts: number + /** The number of byte slices saved in global state. */ + globalByteSlices: number + /** The number of integers saved in local state. */ + localInts: number + /** The number of byte slices saved in local state. */ + localByteSlices: number + } + /** Number of extra pages required for the programs. This is immutable once the app is created. */ + extraProgramPages?: number } +> + +export type AppUpdateParams = Expand< + CommonAppCallParams & { + onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC + /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */ + approvalProgram: string | Uint8Array + /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */ + clearStateProgram: string | Uint8Array + } +> + +/** Parameters to define an application call transaction. */ +export type AppCallParams = CommonAppCallParams & { + onComplete?: Exclude +} + +/** Parameters to define an application delete call transaction. */ +export type AppDeleteParams = CommonAppCallParams & { + onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC +} + +export type AppCreateMethodCall = AppMethodCall +export type AppUpdateMethodCall = AppMethodCall +export type AppDeleteMethodCall = AppMethodCall +export type AppCallMethodCall = AppMethodCall + +export type AppMethodCall = Expand> & { + /** The ABI method to call */ + method: algosdk.ABIMethod + /** Arguments to the ABI method, either: + * * An ABI value + * * A transaction with explicit signer + * * A transaction (where the signer will be automatically assigned) + * * An unawaited transaction (e.g. from algorand.transactions.transactionType()) + * * Another method call (via method call params object) + */ + args?: ( + | algosdk.ABIValue + | TransactionWithSigner + | Transaction + | Promise + | AppMethodCall + | AppMethodCall + | AppMethodCall + )[] +} type Txn = | (PaymentParams & { type: 'pay' }) @@ -370,11 +412,11 @@ type Txn = | (AssetTransferParams & { type: 'assetTransfer' }) | (AssetOptInParams & { type: 'assetOptIn' }) | (AssetOptOutParams & { type: 'assetOptOut' }) - | (AppCallParams & { type: 'appCall' }) + | ((AppCallParams | AppCreateParams | AppUpdateParams) & { type: 'appCall' }) | (OnlineKeyRegistrationParams & { type: 'keyReg' }) | (algosdk.TransactionWithSigner & { type: 'txnWithSigner' }) | { atc: algosdk.AtomicTransactionComposer; type: 'atc' } - | (MethodCallParams & { type: 'methodCall' }) + | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & { type: 'methodCall' }) /** Parameters to configure transaction execution. */ export interface ExecuteParams { @@ -382,6 +424,8 @@ export interface ExecuteParams { maxRoundsToWaitForConfirmation?: number /** Whether to suppress log messages from transaction send, default: do not suppress. */ suppressLog?: boolean + /** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */ + populateAppCallResources?: boolean } /** Parameters to create an `AlgoKitComposer`. */ @@ -396,10 +440,28 @@ export type AlgoKitComposerParams = { * then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet). */ defaultValidityWindow?: number + /** An existing `AppManager` to use to manage app compilation and cache compilation results. + * + * If not specified than an ephemeral one will be created. + */ + appManager?: AppManager +} + +/** Set of transactions built by `AlgoKitComposer`. */ +export interface BuiltTransactions { + /** The built transactions */ + transactions: algosdk.Transaction[] + /** Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. */ + methodCalls: Map + /** Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. */ + signers: Map } /** AlgoKit Composer helps you compose and execute transactions as a transaction group. */ export default class AlgoKitComposer { + /** Signer used to represent a lack of signer */ + private static NULL_SIGNER: algosdk.TransactionSigner = algosdk.makeEmptyTransactionSigner() + /** The ATC used to compose the group */ private atc = new algosdk.AtomicTransactionComposer() @@ -424,6 +486,8 @@ export default class AlgoKitComposer { /** Whether the validity window was explicitly set on construction */ private defaultValidityWindowIsExplicit = false + private appManager: AppManager + /** * Create an `AlgoKitComposer`. * @param params The configuration for this composer @@ -435,6 +499,7 @@ export default class AlgoKitComposer { this.getSigner = params.getSigner this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== undefined + this.appManager = params.appManager ?? new AppManager(params.algod) } /** @@ -525,9 +590,50 @@ export default class AlgoKitComposer { return this } + /** + * Add an application create transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The application create transaction parameters + * @returns The composer so you can chain method calls + */ + addAppCreate(params: AppCreateParams): AlgoKitComposer { + this.txns.push({ ...params, type: 'appCall' }) + + return this + } + + /** + * Add an application update transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The application update transaction parameters + * @returns The composer so you can chain method calls + */ + addAppUpdate(params: AppUpdateParams): AlgoKitComposer { + this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC }) + + return this + } + + /** + * Add an application delete transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The application delete transaction parameters + * @returns The composer so you can chain method calls + */ + addAppDelete(params: AppDeleteParams): AlgoKitComposer { + this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC }) + + return this + } + /** * Add an application call transaction to the transaction group. * + * If you want to create or update an app use `addAppCreate` or `addAppUpdate`. + * * Note: we recommend using app clients to make it easier to make app calls. * @param params The application call transaction parameters * @returns The composer so you can chain method calls @@ -539,13 +645,49 @@ export default class AlgoKitComposer { } /** - * Add an ABI method application call transaction to the transaction group. + * Add an ABI method create application call transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The ABI create method application call transaction parameters + * @returns The composer so you can chain method calls + */ + addAppCreateMethodCall(params: AppCreateMethodCall) { + this.txns.push({ ...params, type: 'methodCall' }) + return this + } + + /** + * Add an ABI method update application call transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The ABI update method application call transaction parameters + * @returns The composer so you can chain method calls + */ + addAppUpdateMethodCall(params: AppUpdateMethodCall) { + this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC }) + return this + } + + /** + * Add an ABI method delete application call transaction to the transaction group. + * + * Note: we recommend using app clients to make it easier to make app calls. + * @param params The ABI delete method application call transaction parameters + * @returns The composer so you can chain method calls + */ + addAppDeleteMethodCall(params: AppDeleteMethodCall) { + this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC }) + return this + } + + /** + * Add a non-create/non-update ABI method application call transaction to the transaction group. * * Note: we recommend using app clients to make it easier to make app calls. * @param params The ABI method application call transaction parameters * @returns The composer so you can chain method calls */ - addMethodCall(params: MethodCallParams) { + addAppCallMethodCall(params: AppCallMethodCall) { this.txns.push({ ...params, type: 'methodCall' }) return this } @@ -571,17 +713,25 @@ export default class AlgoKitComposer { return this } - private buildAtc(atc: algosdk.AtomicTransactionComposer): algosdk.TransactionWithSigner[] { + /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */ + private buildAtc( + atc: algosdk.AtomicTransactionComposer, + processTransaction?: (txn: algosdk.Transaction, index: number) => algosdk.Transaction, + ): algosdk.TransactionWithSigner[] { const group = atc.buildGroup() - const txnWithSigners = group.map((ts) => { + const txnWithSigners = group.map((ts, idx) => { + // Remove underlying group ID from the transaction since it will be re-grouped when this AlgoKitComposer is built ts.txn.group = undefined + // Process transaction if a function is provided + ts.txn = processTransaction?.(ts.txn, idx) ?? ts.txn + // If this was a method call stash the ABIMethod for later + if (atc['methodCalls'].get(idx)) { + this.txnMethodMap.set(ts.txn.txID(), atc['methodCalls'].get(idx)) + } return ts }) - const method = atc['methodCalls'].get(group.length - 1) - if (method) this.txnMethodMap.set(txnWithSigners.at(-1)!.txn.txID(), method) - return txnWithSigners } @@ -624,8 +774,13 @@ export default class AlgoKitComposer { return txn } + /** + * Builds an ABI method call transaction and any other associated transactions represented in the ABI args. + * @param includeSigner Whether to include the actual signer for the transactions. + * If you are just building transactions without signers yet then set this to `false`. + */ private async buildMethodCall( - params: MethodCallParams, + params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall, suggestedParams: algosdk.SuggestedParams, includeSigner: boolean, ): Promise { @@ -633,7 +788,7 @@ export default class AlgoKitComposer { const isAbiValue = (x: unknown): x is algosdk.ABIValue => { if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue) - return ['boolean', 'number', 'bigint', 'string', 'Uint8Array'].includes(typeof x) + return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array } for (const arg of params.args ?? []) { @@ -662,30 +817,57 @@ export default class AlgoKitComposer { ? params.signer.signer : params.signer : this.getSigner(encodeAddress(txn.from.publicKey)) - : algosdk.makeEmptyTransactionSigner(), + : AlgoKitComposer.NULL_SIGNER, }) } const methodAtc = new algosdk.AtomicTransactionComposer() - const appID = Number(params.appId || 0) + const appId = Number('appId' in params ? params.appId : 0n) + const approvalProgram = + 'approvalProgram' in params + ? typeof params.approvalProgram === 'string' + ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes + : params.approvalProgram + : undefined + const clearStateProgram = + 'clearStateProgram' in params + ? typeof params.clearStateProgram === 'string' + ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes + : params.clearStateProgram + : undefined + methodAtc.addMethodCall({ - appID, + appID: appId, sender: params.sender, suggestedParams, - onComplete: params.onComplete, + onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC, appAccounts: params.accountReferences, appForeignApps: params.appReferences?.map((x) => Number(x)), appForeignAssets: params.assetReferences?.map((x) => Number(x)), - approvalProgram: params.approvalProgram, - clearProgram: params.clearProgram, - extraPages: params.extraPages, - numLocalInts: params.schema?.localUints || (appID === 0 ? 0 : undefined), - numLocalByteSlices: params.schema?.localByteSlices || (appID === 0 ? 0 : undefined), - numGlobalInts: params.schema?.globalUints || (appID === 0 ? 0 : undefined), - numGlobalByteSlices: params.schema?.globalByteSlices || (appID === 0 ? 0 : undefined), + boxes: params.boxReferences?.map(AppManager.getBoxReference), + approvalProgram, + clearProgram: clearStateProgram, + extraPages: + appId === 0 + ? 'extraProgramPages' in params && params.extraProgramPages !== undefined + ? params.extraProgramPages + : approvalProgram + ? Math.floor((approvalProgram.length + (clearStateProgram?.length ?? 0)) / APP_PAGE_MAX_SIZE) + : 0 + : undefined, + numLocalInts: appId === 0 ? ('schema' in params ? params.schema?.localInts ?? 0 : 0) : undefined, + numLocalByteSlices: appId === 0 ? ('schema' in params ? params.schema?.localByteSlices ?? 0 : 0) : undefined, + numGlobalInts: appId === 0 ? ('schema' in params ? params.schema?.globalInts ?? 0 : 0) : undefined, + numGlobalByteSlices: appId === 0 ? ('schema' in params ? params.schema?.globalByteSlices ?? 0 : 0) : undefined, method: params.method, - signer: params.signer ? ('signer' in params.signer ? params.signer.signer : params.signer) : this.getSigner(params.sender), + signer: includeSigner + ? params.signer + ? 'signer' in params.signer + ? params.signer.signer + : params.signer + : this.getSigner(params.sender) + : AlgoKitComposer.NULL_SIGNER, methodArgs: methodArgs, // note, lease, and rekeyTo are set in the common build step note: undefined, @@ -693,12 +875,11 @@ export default class AlgoKitComposer { rekeyTo: undefined, }) - // Run the actual method call txn through the common build step to set fees and validity rounds - const group = methodAtc.buildGroup() - const methodIdx = group.length - 1 - group[methodIdx].txn = this.commonTxnBuildStep(params, group[methodIdx].txn, suggestedParams) - - return this.buildAtc(methodAtc) + // Process the ATC to get a set of transactions ready for broader grouping + // and with the common build step to set fees and validity rounds + return this.buildAtc(methodAtc, (txn, idx) => + idx === methodAtc.count() - 1 ? this.commonTxnBuildStep(params, txn, suggestedParams) : txn, + ) } private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) { @@ -784,43 +965,58 @@ export default class AlgoKitComposer { return this.commonTxnBuildStep(params, txn, suggestedParams) } - private buildAppCall(params: AppCallParams, suggestedParams: algosdk.SuggestedParams) { + private async buildAppCall(params: AppCallParams | AppUpdateParams | AppCreateParams, suggestedParams: algosdk.SuggestedParams) { + const appId = Number('appId' in params ? params.appId : 0n) + const approvalProgram = + 'approvalProgram' in params + ? typeof params.approvalProgram === 'string' + ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes + : params.approvalProgram + : undefined + const clearStateProgram = + 'clearStateProgram' in params + ? typeof params.clearStateProgram === 'string' + ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes + : params.clearStateProgram + : undefined + const sdkParams = { from: params.sender, suggestedParams, - onComplete: params.onComplete, - approvalProgram: params.approvalProgram, - clearProgram: params.clearProgram, - appArgs: params.args, - accounts: params.accountReferences, - foreignApps: params.appReferences?.map((x) => Number(x)), - foreignAssets: params.assetReferences?.map((x) => Number(x)), - extraPages: params.extraPages, - numLocalInts: params.schema?.localUints || 0, - numLocalByteSlices: params.schema?.localByteSlices || 0, - numGlobalInts: params.schema?.globalUints || 0, - numGlobalByteSlices: params.schema?.globalByteSlices || 0, + onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC, + appAccounts: params.accountReferences, + appForeignApps: params.appReferences?.map((x) => Number(x)), + appForeignAssets: params.assetReferences?.map((x) => Number(x)), + boxes: params.boxReferences?.map(AppManager.getBoxReference), + approvalProgram, + clearProgram: clearStateProgram, } let txn: algosdk.Transaction - const onComplete = params.onComplete || algosdk.OnApplicationComplete.NoOpOC - - if (!params.appId) { - if (params.approvalProgram === undefined || params.clearProgram === undefined) { - throw new Error('approvalProgram and clearProgram are required for application creation') + if (appId === 0) { + if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) { + throw new Error('approvalProgram and clearStateProgram are required for application creation') } txn = algosdk.makeApplicationCreateTxnFromObject({ ...sdkParams, - onComplete, - approvalProgram: params.approvalProgram, - clearProgram: params.clearProgram, + onComplete: sdkParams.onComplete, + extraPages: + 'extraProgramPages' in params + ? params.extraProgramPages ?? Math.floor((approvalProgram!.length + clearStateProgram!.length) / APP_PAGE_MAX_SIZE) + : 0, + numLocalInts: 'schema' in params ? params.schema?.localInts ?? 0 : 0, + numLocalByteSlices: 'schema' in params ? params.schema?.localByteSlices ?? 0 : 0, + numGlobalInts: 'schema' in params ? params.schema?.globalInts ?? 0 : 0, + numGlobalByteSlices: 'schema' in params ? params.schema?.globalByteSlices ?? 0 : 0, + approvalProgram: approvalProgram!, + clearProgram: clearStateProgram!, }) + } else { + txn = algosdk.makeApplicationCallTxnFromObject({ ...sdkParams, appIndex: appId }) } - txn = algosdk.makeApplicationCallTxnFromObject({ ...sdkParams, onComplete, appIndex: Number(params.appId || 0) }) - return this.commonTxnBuildStep(params, txn, suggestedParams) } @@ -842,20 +1038,15 @@ export default class AlgoKitComposer { return this.commonTxnBuildStep(params, txn, suggestedParams) } + /** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */ private async buildTxn(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise { switch (txn.type) { - case 'txnWithSigner': - return [txn.txn] - case 'atc': - return txn.atc.buildGroup().map((ts) => ts.txn) - case 'methodCall': - return (await this.buildMethodCall(txn, suggestedParams, false)).map((ts) => ts.txn) case 'pay': return [this.buildPayment(txn, suggestedParams)] case 'assetCreate': return [this.buildAssetCreate(txn, suggestedParams)] case 'appCall': - return [this.buildAppCall(txn, suggestedParams)] + return [await this.buildAppCall(txn, suggestedParams)] case 'assetConfig': return [this.buildAssetConfig(txn, suggestedParams)] case 'assetDestroy': @@ -894,53 +1085,85 @@ export default class AlgoKitComposer { } /** - * Compose all of the transactions without signers and return the transaction objects directly. + * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls. * - * @returns The array of built transactions + * @returns The array of built transactions and any corresponding method calls */ - async buildTransactions() { + async buildTransactions(): Promise { const suggestedParams = await this.getSuggestedParams() const transactions: algosdk.Transaction[] = [] + const methodCalls = new Map() + const signers = new Map() for (const txn of this.txns) { - transactions.push(...(await this.buildTxn(txn, suggestedParams))) + if (!['txnWithSigner', 'atc', 'methodCall'].includes(txn.type)) { + transactions.push(...(await this.buildTxn(txn, suggestedParams))) + } else { + const transactionsWithSigner = + txn.type === 'txnWithSigner' + ? [txn] + : txn.type === 'atc' + ? this.buildAtc(txn.atc) + : txn.type === 'methodCall' + ? await this.buildMethodCall(txn, suggestedParams, false) + : [] + + transactions.push(...transactionsWithSigner.map((ts) => ts.txn)) + transactionsWithSigner.forEach((ts, idx) => { + if (ts.signer && ts.signer !== AlgoKitComposer.NULL_SIGNER) { + signers.set(idx, ts.signer) + } + }) + } } - return transactions + for (let i = 0; i < transactions.length; i++) { + const method = this.txnMethodMap.get(transactions[i].txID()) + if (method) methodCalls.set(i, method) + } + + return { transactions, methodCalls, signers } + } + + /** + * Get the number of transactions currently added to this composer. + */ + async count() { + return (await this.buildTransactions()).transactions.length } /** * Compose all of the transactions in a single atomic transaction group and an atomic transaction composer. * * You can then use the transactions standalone, or use the composer to execute or simulate the transactions. + * + * Once this method is called, no further transactions will be able to be added. + * You can safely call this method multiple times to get the same result. * @returns The built atomic transaction composer and the transactions */ async build() { if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) { const suggestedParams = await this.getSuggestedParams() + // Build all of the transactions const txnWithSigners: algosdk.TransactionWithSigner[] = [] - for (const txn of this.txns) { txnWithSigners.push(...(await this.buildTxnWithSigner(txn, suggestedParams))) } - txnWithSigners.forEach((ts) => { - this.atc.addTransaction(ts) - }) - + // Add all of the transactions to the underlying ATC const methodCalls = new Map() - txnWithSigners.forEach((ts, idx) => { + this.atc.addTransaction(ts) + // Populate consolidated set of all ABI method calls const method = this.txnMethodMap.get(ts.txn.txID()) if (method) methodCalls.set(idx, method) }) - this.atc['methodCalls'] = methodCalls } - return { atc: this.atc, transactions: this.atc.buildGroup() } + return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] } } /** @@ -971,9 +1194,19 @@ export default class AlgoKitComposer { return await sendAtomicTransactionComposer( { atc: this.atc, - sendParams: { suppressLog: params?.suppressLog, maxRoundsToWaitForConfirmation: waitRounds }, + sendParams: { + suppressLog: params?.suppressLog, + maxRoundsToWaitForConfirmation: waitRounds, + populateAppCallResources: params?.populateAppCallResources, + }, }, this.algod, ) } + + static arc2Note(note: Arc2TransactionNote): Uint8Array { + const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : JSON.stringify(note.data)}` + const encoder = new TextEncoder() + return encoder.encode(arc2Payload) + } } diff --git a/src/types/expand.ts b/src/types/expand.ts new file mode 100644 index 00000000..54a20215 --- /dev/null +++ b/src/types/expand.ts @@ -0,0 +1,9 @@ +/** + * Expands types for IntelliSense so they are more human readable + * See https://stackoverflow.com/a/69288824 + */ +export type Expand = T extends (...args: infer A) => infer R + ? (...args: Expand) => Expand + : T extends infer O + ? { [K in keyof O]: O[K] } + : never diff --git a/src/types/transaction.ts b/src/types/transaction.ts index f04d9426..60db13f9 100644 --- a/src/types/transaction.ts +++ b/src/types/transaction.ts @@ -2,6 +2,7 @@ import algosdk from 'algosdk' import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account' import { AlgoAmount } from './amount' import { ABIReturn } from './app' +import { Expand } from './expand' import Account = algosdk.Account import AtomicTransactionComposer = algosdk.AtomicTransactionComposer import LogicSigAccount = algosdk.LogicSigAccount @@ -45,6 +46,9 @@ export interface SendTransactionParams { populateAppCallResources?: boolean } +/** Result from sending a single transaction. */ +export type SendSingleTransactionResult = Expand + /** The result of sending a transaction */ export interface SendTransactionResult { /** The transaction */ diff --git a/tests/example-contracts/testing-app/contract.ts b/tests/example-contracts/testing-app/contract.ts index e456930d..a92f19e4 100644 --- a/tests/example-contracts/testing-app/contract.ts +++ b/tests/example-contracts/testing-app/contract.ts @@ -1,9 +1,12 @@ +import algosdk from 'algosdk' import { readFile } from 'fs/promises' import path from 'path' import { encodeTransactionNote, replaceDeployTimeControlParams } from '../../../src' import { APP_DEPLOY_NOTE_DAPP, AppDeployMetadata, OnSchemaBreak, OnUpdate } from '../../../src/types/app' +import { AppDeployParams } from '../../../src/types/app-deployer' import { AppSpec } from '../../../src/types/app-spec' -import { Arc2TransactionNote, SendTransactionFrom } from '../../../src/types/transaction' +import { AppCreateParams } from '../../../src/types/composer' +import { Arc2TransactionNote } from '../../../src/types/transaction' export const getTestingAppContract = async () => { const appSpecFile = await readFile(path.join(__dirname, 'application.json'), 'utf-8') @@ -22,10 +25,10 @@ export const getTestingAppContract = async () => { } } -export const getTestingAppCreateParams = async (from: SendTransactionFrom, metadata: AppDeployMetadata) => { +export const getTestingAppCreateParams = async (from: algosdk.Account, metadata: AppDeployMetadata) => { const contract = await getTestingAppContract() return { - from: from, + sender: from.addr, approvalProgram: replaceDeployTimeControlParams(contract.approvalProgram, metadata).replace('TMPL_VALUE', '1'), clearStateProgram: contract.clearStateProgram, schema: contract.stateSchema, @@ -34,11 +37,11 @@ export const getTestingAppCreateParams = async (from: SendTransactionFrom, metad data: metadata, format: 'j', } as Arc2TransactionNote), - } + } satisfies AppCreateParams } export const getTestingAppDeployParams = async (deployment: { - from: SendTransactionFrom + sender: string metadata: AppDeployMetadata codeInjectionValue?: number onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak @@ -47,20 +50,28 @@ export const getTestingAppDeployParams = async (deployment: { }) => { const contract = await getTestingAppContract() return { - approvalProgram: contract.approvalProgram, - clearStateProgram: contract.clearStateProgram, - from: deployment.from, + createParams: { + sender: deployment.sender, + approvalProgram: contract.approvalProgram, + clearStateProgram: contract.clearStateProgram, + schema: deployment.breakSchema + ? { + ...contract.stateSchema, + globalByteSlices: contract.stateSchema.globalByteSlices + 1, + } + : contract.stateSchema, + }, + updateParams: { + sender: deployment.sender, + }, + deleteParams: { + sender: deployment.sender, + }, metadata: deployment.metadata, - schema: deployment.breakSchema - ? { - ...contract.stateSchema, - globalByteSlices: contract.stateSchema.globalByteSlices + 1, - } - : contract.stateSchema, deployTimeParams: { VALUE: deployment.codeInjectionValue ?? 1, }, onSchemaBreak: deployment.onSchemaBreak, onUpdate: deployment.onUpdate, - } + } satisfies AppDeployParams }