Skip to content

Commit

Permalink
App deprecation (#310)
Browse files Browse the repository at this point in the history
Deprecations:
* `createApp` -> `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()` / `algorand.transactions.appCreateMethodCall()`
* `updateApp` -> `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` / `algorand.transactions.appUpdateMethodCall()` 
* `callApp` -> `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()` / `algorand.transactions.appUpdateMethodCall()`
* `deployApp` -> `algorand.appDeployer.deploy`
* `getCreatorAppsByName` -> `algorand.appDeployer.getCreatorAppsByName`
* `getABIReturn` -> `AppManager.getABIReturn`
* `getAppGlobalState` -> `(await appManager.getById(appId)).globalState`
* `getAppLocalState` -> `algorand.app.getLocalState`
* `getAppBoxNames` -> `algorand.app.getBoxNames`
* `getAppBoxValue` -> `algorand.app.getBoxValue`
* `getAppBoxValues` -> `algorand.app.getBoxValues`
* `getAppBoxValueFromABIType` -> `algorand.app.getAppBoxValueFromABIType`
* `getBoxValueFromABIType` -> `algorand.app.getAppBoxValuesFromABIType`
* `decodeAppState` -> `AppManager.decodeAppState`
* `getBoxReference` -> `AppManager.getBoxReference`
* `getAppById` -> `algorand.app.getById`
* `compileTeal` -> `algorand.app.compileTeal`
* `performTemplateSubstitutionAndCompile` -> `algorand.appManager.compileTealTemplate`
* `replaceDeployTimeControlParams` -> `AppManager.replaceTealTemplateDeployTimeControlParams`
* `performTemplateSubstitution` -> `AppManager.replaceTealTemplateParams`
* `stripTealComments` -> `AppManager.stripTealComments`
* `getAppOnCompleteAction` -> `algosdk.OnApplicationComplete`
* `getABIMethodSignature` -> `abiMethod.getSignature()` / `new ABIMethod(abiMethodParams).getSignature()`
* `getAppArgsForTransaction`
* `getAppArgsForABICall`
* `isSchemaIsBroken`
* `getAppDeploymentTransactionNote`

Updates:
* Fixed numerous bugs in `AlgoKitComposer` related to handling app call transactions
* `build` on `AlgoKitComposer` now returns ABI method call objects for transactions that had them so you can resolve ABI return values

New functionality:
* `AppManager` class and `algorand.app`
* `AppDeployer` class and `algorand.appDeployer`
* `AlgoKitComposer.arc2Note` to allow constructing an ARC-2 transaction note
* `count` method in `AlgoKitComposer` to support retrieving current number of transactions
* `buildTransactions` method in `AlgoKitComposer` to support building transactions without needing a signer present and switched to using that from `algorand.transactions`
* Added support for `populateAppCallResources` to `AlgoKitComposer`
* `algorand.client.indexerIfPresent` so you can optionally retrieve indexer if it's present
* `algorand.send/transactions.{appMethods}` for the following methods: `appCreate`, `appCreateMethodCall`, `appUpdate`, `appUpdateMethodCall`, `appDelete`, `appDeleteMethodCall`, `appCall`, `appCallMethodCall` and corresponding `addX` methods in `AlgoKitComposer` / `algorand.newGroup()`
* TEAL compilation caching (within `AppManager` instance)
* AppLookup caching (within `AppDeployer` instance)

BREAKING CHANGE: Renamed `clearProgram` to `clearStateProgram` and `extraPages` to `extraProgramPages` in `AlgoKitComposer` to match algod api
  • Loading branch information
robdmoore authored Sep 4, 2024
1 parent 01ab071 commit 41d8df1
Show file tree
Hide file tree
Showing 126 changed files with 7,995 additions and 2,466 deletions.
2 changes: 1 addition & 1 deletion docs/capabilities/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions docs/capabilities/algorand-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/capabilities/app-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
227 changes: 169 additions & 58 deletions docs/capabilities/app-deploy.md

Large diffs are not rendered by default.

558 changes: 412 additions & 146 deletions docs/capabilities/app.md

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions docs/capabilities/asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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).

Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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):

Expand Down
2 changes: 1 addition & 1 deletion docs/capabilities/transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
3 changes: 3 additions & 0 deletions docs/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions docs/code/classes/types_account_manager.AccountManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.

Expand All @@ -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

Expand Down
Loading

0 comments on commit 41d8df1

Please sign in to comment.