@algorandfoundation/algokit-utils 9.2.1 → 9.2.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/account/account.d.ts +28 -23
  2. package/account/get-account-config-from-environment.d.ts +2 -7
  3. package/account/get-account.d.ts +12 -14
  4. package/account/get-dispenser-account.d.ts +5 -9
  5. package/account/index.d.ts +5 -0
  6. package/account/mnemonic-account.d.ts +3 -7
  7. package/amount.d.ts +35 -40
  8. package/app-client.d.ts +6 -10
  9. package/app-deploy.d.ts +23 -25
  10. package/app.d.ts +46 -45
  11. package/asset.d.ts +12 -16
  12. package/config.d.ts +2 -7
  13. package/debugging/debugging.d.ts +1 -5
  14. package/debugging/index.d.ts +1 -0
  15. package/dispenser-client.d.ts +2 -7
  16. package/index.d.ts +18 -27
  17. package/indexer-lookup.d.ts +11 -18
  18. package/localnet/get-kmd-wallet-account.d.ts +7 -9
  19. package/localnet/get-localnet-dispenser-account.d.ts +5 -7
  20. package/localnet/get-or-create-kmd-wallet-account.d.ts +8 -10
  21. package/localnet/index.d.ts +4 -0
  22. package/localnet/is-localnet.d.ts +3 -7
  23. package/network-client.d.ts +15 -17
  24. package/package.json +1 -1
  25. package/testing/_asset.d.ts +3 -0
  26. package/testing/account.d.ts +9 -11
  27. package/testing/fixtures/algokit-log-capture-fixture.d.ts +2 -7
  28. package/testing/fixtures/algorand-fixture.d.ts +4 -9
  29. package/testing/fixtures/index.d.ts +2 -0
  30. package/testing/index.d.ts +5 -7
  31. package/testing/indexer.d.ts +1 -5
  32. package/testing/test-logger.d.ts +36 -41
  33. package/testing/transaction-logger.d.ts +27 -30
  34. package/transaction/index.d.ts +2 -0
  35. package/transaction/legacy-bridge.d.ts +35 -0
  36. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +5 -7
  37. package/transaction/resolve-signed-transactions.d.ts +16 -0
  38. package/transaction/transaction.d.ts +35 -34
  39. package/transfer/index.d.ts +2 -0
  40. package/transfer/transfer-algos.d.ts +5 -9
  41. package/transfer/transfer.d.ts +8 -11
  42. package/types/account-manager.d.ts +429 -432
  43. package/types/account.d.ts +202 -192
  44. package/types/algo-http-client-with-retry.d.ts +10 -15
  45. package/types/algorand-client-transaction-creator.d.ts +771 -778
  46. package/types/algorand-client-transaction-sender.d.ts +1085 -1090
  47. package/types/algorand-client.d.ts +236 -239
  48. package/types/amount.d.ts +43 -47
  49. package/types/app-arc56.d.ts +272 -235
  50. package/types/app-client.d.ts +1151 -1128
  51. package/types/app-deployer.d.ts +141 -139
  52. package/types/app-factory.d.ts +783 -762
  53. package/types/app-manager.d.ts +310 -304
  54. package/types/app-spec.d.ts +117 -118
  55. package/types/app.d.ts +241 -229
  56. package/types/asset-manager.d.ts +199 -204
  57. package/types/asset.d.ts +91 -95
  58. package/types/async-event-emitter.d.ts +13 -18
  59. package/types/client-manager.d.ts +451 -453
  60. package/types/composer.d.ts +1257 -1210
  61. package/types/config.d.ts +48 -53
  62. package/types/debugging.d.ts +23 -25
  63. package/types/dispenser-client.d.ts +52 -57
  64. package/types/expand.d.ts +3 -5
  65. package/types/indexer.d.ts +66 -70
  66. package/types/instance-of.d.ts +3 -5
  67. package/types/kmd-account-manager.d.ts +70 -75
  68. package/types/lifecycle-events.d.ts +8 -13
  69. package/types/logging.d.ts +11 -15
  70. package/types/logic-error.d.ts +29 -33
  71. package/types/network-client.d.ts +27 -32
  72. package/types/testing.d.ts +132 -131
  73. package/types/transaction.d.ts +110 -110
  74. package/types/transfer.d.ts +66 -70
  75. package/util.d.ts +48 -0
@@ -1,156 +1,158 @@
1
- import { Expand } from "./expand.js";
2
- import { ABIReturn, AppDeployMetadata, OnSchemaBreak, OnUpdate, SendAppCreateTransactionResult, SendAppUpdateTransactionResult, TealTemplateParams } from "./app.js";
3
- import { ConfirmedTransactionResult, SendParams } from "./transaction.js";
4
- import { AppManager } from "./app-manager.js";
5
- import { AppCreateMethodCall, AppCreateParams, AppDeleteMethodCall, AppDeleteParams, AppUpdateMethodCall, AppUpdateParams } from "./composer.js";
6
- import { AlgorandClientTransactionSender } from "./algorand-client-transaction-sender.js";
7
- import algosdk, { Address } from "algosdk";
8
-
9
- //#region src/types/app-deployer.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender';
3
+ import { OnSchemaBreak, OnUpdate, type ABIReturn, type AppDeployMetadata, type SendAppCreateTransactionResult, type SendAppUpdateTransactionResult, type TealTemplateParams } from './app';
4
+ import { AppManager } from './app-manager';
5
+ import { AppCreateMethodCall, AppCreateParams, AppDeleteMethodCall, AppDeleteParams, AppUpdateMethodCall, AppUpdateParams } from './composer';
6
+ import { Expand } from './expand';
7
+ import { ConfirmedTransactionResult, SendParams } from './transaction';
10
8
  /** Params to specify an update transaction for an app deployment */
11
- type DeployAppUpdateParams = Expand<Omit<AppUpdateParams, 'appId' | 'approvalProgram' | 'clearStateProgram'>>;
9
+ export type DeployAppUpdateParams = Expand<Omit<AppUpdateParams, 'appId' | 'approvalProgram' | 'clearStateProgram'>>;
12
10
  /** Params to specify an update method call for an app deployment */
13
- type DeployAppUpdateMethodCall = Expand<Omit<AppUpdateMethodCall, 'appId' | 'approvalProgram' | 'clearStateProgram'>>;
11
+ export type DeployAppUpdateMethodCall = Expand<Omit<AppUpdateMethodCall, 'appId' | 'approvalProgram' | 'clearStateProgram'>>;
14
12
  /** Params to specify a transaction for an app deployment */
15
- type DeployAppDeleteParams = Expand<Omit<AppDeleteParams, 'appId'>>;
13
+ export type DeployAppDeleteParams = Expand<Omit<AppDeleteParams, 'appId'>>;
16
14
  /** Params to specify a delete method call for an app deployment */
17
- type DeployAppDeleteMethodCall = Expand<Omit<AppDeleteMethodCall, 'appId'>>;
15
+ export type DeployAppDeleteMethodCall = Expand<Omit<AppDeleteMethodCall, 'appId'>>;
18
16
  /** The parameters to idempotently deploy an app */
19
- type AppDeployParams = Expand<SendParams & {
20
- /** 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) */
21
- deployTimeParams?: TealTemplateParams;
22
- /** What action to perform if a schema break (storage schema or extra pages change) is detected:
23
- *
24
- * * `fail` - Fail the deployment (throw an error, **default**)
25
- * * `replace` - Delete the old app and create a new one
26
- * * `append` - Deploy a new app and leave the old one as is
27
- */
28
- onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak;
29
- /** What action to perform if a TEAL code update is detected:
30
- *
31
- * * `fail` - Fail the deployment (throw an error, **default**)
32
- * * `update` - Update the app with the new TEAL code
33
- * * `replace` - Delete the old app and create a new one
34
- * * `append` - Deploy a new app and leave the old one as is
35
- */
36
- onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate; /** Create transaction parameters to use if a create needs to be issued as part of deployment */
37
- createParams: AppCreateParams | AppCreateMethodCall; /** Update transaction parameters to use if an update needs to be issued as part of deployment */
38
- updateParams: DeployAppUpdateParams | DeployAppUpdateMethodCall; /** Delete transaction parameters to use if a delete needs to be issued as part of deployment */
39
- deleteParams: DeployAppDeleteParams | DeployAppDeleteMethodCall; /** Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup */
40
- existingDeployments?: AppLookup; /** Whether or not to ignore the app metadata cache and force a lookup, default: use the cache **/
41
- ignoreCache?: boolean;
17
+ export type AppDeployParams = Expand<SendParams & {
18
+ /** The deployment metadata */
19
+ metadata: AppDeployMetadata;
20
+ /** Any deploy-time parameters to replace in the TEAL code before compiling it (used if teal code is passed in as a string) */
21
+ deployTimeParams?: TealTemplateParams;
22
+ /** What action to perform if a schema break (storage schema or extra pages change) is detected:
23
+ *
24
+ * * `fail` - Fail the deployment (throw an error, **default**)
25
+ * * `replace` - Delete the old app and create a new one
26
+ * * `append` - Deploy a new app and leave the old one as is
27
+ */
28
+ onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak;
29
+ /** What action to perform if a TEAL code update is detected:
30
+ *
31
+ * * `fail` - Fail the deployment (throw an error, **default**)
32
+ * * `update` - Update the app with the new TEAL code
33
+ * * `replace` - Delete the old app and create a new one
34
+ * * `append` - Deploy a new app and leave the old one as is
35
+ */
36
+ onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate;
37
+ /** Create transaction parameters to use if a create needs to be issued as part of deployment */
38
+ createParams: AppCreateParams | AppCreateMethodCall;
39
+ /** Update transaction parameters to use if an update needs to be issued as part of deployment */
40
+ updateParams: DeployAppUpdateParams | DeployAppUpdateMethodCall;
41
+ /** Delete transaction parameters to use if a delete needs to be issued as part of deployment */
42
+ deleteParams: DeployAppDeleteParams | DeployAppDeleteMethodCall;
43
+ /** Optional cached value of the existing apps for the given creator; use this to avoid an indexer lookup */
44
+ existingDeployments?: AppLookup;
45
+ /** Whether or not to ignore the app metadata cache and force a lookup, default: use the cache **/
46
+ ignoreCache?: boolean;
42
47
  }>;
43
48
  /** The metadata that can be collected about a deployed app */
44
- interface AppMetadata extends AppDeployMetadata {
45
- /** The id of the app */
46
- appId: bigint;
47
- /** The Algorand address of the account associated with the app */
48
- appAddress: Address;
49
- /** The round the app was created */
50
- createdRound: bigint;
51
- /** The last round that the app was updated */
52
- updatedRound: bigint;
53
- /** The metadata when the app was created */
54
- createdMetadata: AppDeployMetadata;
55
- /** Whether or not the app is deleted */
56
- deleted: boolean;
49
+ export interface AppMetadata extends AppDeployMetadata {
50
+ /** The id of the app */
51
+ appId: bigint;
52
+ /** The Algorand address of the account associated with the app */
53
+ appAddress: Address;
54
+ /** The round the app was created */
55
+ createdRound: bigint;
56
+ /** The last round that the app was updated */
57
+ updatedRound: bigint;
58
+ /** The metadata when the app was created */
59
+ createdMetadata: AppDeployMetadata;
60
+ /** Whether or not the app is deleted */
61
+ deleted: boolean;
57
62
  }
58
63
  /** A lookup of name -> Algorand app for a creator */
59
- interface AppLookup {
60
- /** The address of the creator associated with this lookup */
61
- creator: Readonly<Address>;
62
- /** A hash map of app name to app metadata */
63
- apps: {
64
- [name: string]: AppMetadata;
65
- };
64
+ export interface AppLookup {
65
+ /** The address of the creator associated with this lookup */
66
+ creator: Readonly<Address>;
67
+ /** A hash map of app name to app metadata */
68
+ apps: {
69
+ [name: string]: AppMetadata;
70
+ };
66
71
  }
67
- type AppDeployResult = Expand<{
68
- operationPerformed: 'create';
72
+ export type AppDeployResult = Expand<{
73
+ operationPerformed: 'create';
69
74
  } & Omit<AppMetadata, 'appId' | 'appAddress'> & SendAppCreateTransactionResult> | Expand<{
70
- operationPerformed: 'update';
75
+ operationPerformed: 'update';
71
76
  } & AppMetadata & SendAppUpdateTransactionResult> | Expand<{
72
- operationPerformed: 'replace';
77
+ operationPerformed: 'replace';
73
78
  } & Omit<AppMetadata, 'appId' | 'appAddress'> & SendAppCreateTransactionResult & {
74
- deleteReturn?: ABIReturn;
75
- deleteResult: ConfirmedTransactionResult;
79
+ deleteReturn?: ABIReturn;
80
+ deleteResult: ConfirmedTransactionResult;
76
81
  }> | Expand<{
77
- operationPerformed: 'nothing';
82
+ operationPerformed: 'nothing';
78
83
  } & AppMetadata>;
79
84
  /** Allows management of deployment and deployment metadata of applications. */
80
- declare class AppDeployer {
81
- private _appManager;
82
- private _transactionSender;
83
- private _indexer?;
84
- private _appLookups;
85
- /**
86
- * Creates an `AppManager`
87
- * @param appManager An `AppManager` instance
88
- * @param transactionSender An `AlgorandClientTransactionSender` instance
89
- * @param indexer An optional indexer instance; supply if you want to indexer to look up app metadata
90
- * @example
91
- * ```ts
92
- * const deployer = new AppDeployer(appManager, transactionSender, indexer)
93
- * ```
94
- */
95
- constructor(appManager: AppManager, transactionSender: AlgorandClientTransactionSender, indexer?: algosdk.Indexer);
96
- /**
97
- * 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).
98
- *
99
- * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/src/content/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
100
- *
101
- * **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`.
102
- *
103
- * **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.
104
- *
105
- * **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.
106
- * @param deployment The arguments to control the app deployment
107
- * @returns The result of the deployment
108
- * @example
109
- * ```ts
110
- * const deployResult = await deployer.deploy({
111
- * createParams: {
112
- * sender: 'SENDER_ADDRESS',
113
- * approvalProgram: 'APPROVAL PROGRAM',
114
- * clearStateProgram: 'CLEAR PROGRAM',
115
- * schema: {
116
- * globalByteSlices: 0,
117
- * globalInts: 0,
118
- * localByteSlices: 0,
119
- * localInts: 0
120
- * }
121
- * },
122
- * updateParams: {
123
- * sender: 'SENDER_ADDRESS'
124
- * },
125
- * deleteParams: {
126
- * sender: 'SENDER_ADDRESS'
127
- * },
128
- * metadata: { name: 'my_app', version: '2.0', updatable: false, deletable: false },
129
- * onSchemaBreak: 'append',
130
- * onUpdate: 'append'
131
- * })
132
- * ```
133
- */
134
- deploy(deployment: AppDeployParams): Promise<AppDeployResult>;
135
- private updateAppLookup;
136
- /**
137
- * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have
138
- * an [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) `AppDeployNote` as the transaction
139
- * note of the app creation transaction.
140
- *
141
- * This function caches the result for the given creator account so that subsequent calls will not require an indexer lookup.
142
- *
143
- * If the `AppManager` instance wasn't created with an indexer client, this function will throw an error.
144
- *
145
- * @param creatorAddress The address of the account that is the creator of the apps you want to search for
146
- * @param ignoreCache Whether or not to ignore the cache and force a lookup, default: use the cache
147
- * @returns A name-based lookup of the app metadata
148
- * @example
149
- * ```ts
150
- * const result = await deployer.getCreatorAppsByName(creator)
151
- */
152
- getCreatorAppsByName(creatorAddress: string | Address, ignoreCache?: boolean): Promise<AppLookup>;
85
+ export declare class AppDeployer {
86
+ private _appManager;
87
+ private _transactionSender;
88
+ private _indexer?;
89
+ private _appLookups;
90
+ /**
91
+ * Creates an `AppManager`
92
+ * @param appManager An `AppManager` instance
93
+ * @param transactionSender An `AlgorandClientTransactionSender` instance
94
+ * @param indexer An optional indexer instance; supply if you want to indexer to look up app metadata
95
+ * @example
96
+ * ```ts
97
+ * const deployer = new AppDeployer(appManager, transactionSender, indexer)
98
+ * ```
99
+ */
100
+ constructor(appManager: AppManager, transactionSender: AlgorandClientTransactionSender, indexer?: algosdk.Indexer);
101
+ /**
102
+ * 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).
103
+ *
104
+ * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/src/content/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
105
+ *
106
+ * **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`.
107
+ *
108
+ * **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.
109
+ *
110
+ * **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.
111
+ * @param deployment The arguments to control the app deployment
112
+ * @returns The result of the deployment
113
+ * @example
114
+ * ```ts
115
+ * const deployResult = await deployer.deploy({
116
+ * createParams: {
117
+ * sender: 'SENDER_ADDRESS',
118
+ * approvalProgram: 'APPROVAL PROGRAM',
119
+ * clearStateProgram: 'CLEAR PROGRAM',
120
+ * schema: {
121
+ * globalByteSlices: 0,
122
+ * globalInts: 0,
123
+ * localByteSlices: 0,
124
+ * localInts: 0
125
+ * }
126
+ * },
127
+ * updateParams: {
128
+ * sender: 'SENDER_ADDRESS'
129
+ * },
130
+ * deleteParams: {
131
+ * sender: 'SENDER_ADDRESS'
132
+ * },
133
+ * metadata: { name: 'my_app', version: '2.0', updatable: false, deletable: false },
134
+ * onSchemaBreak: 'append',
135
+ * onUpdate: 'append'
136
+ * })
137
+ * ```
138
+ */
139
+ deploy(deployment: AppDeployParams): Promise<AppDeployResult>;
140
+ private updateAppLookup;
141
+ /**
142
+ * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have
143
+ * an [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) `AppDeployNote` as the transaction
144
+ * note of the app creation transaction.
145
+ *
146
+ * This function caches the result for the given creator account so that subsequent calls will not require an indexer lookup.
147
+ *
148
+ * If the `AppManager` instance wasn't created with an indexer client, this function will throw an error.
149
+ *
150
+ * @param creatorAddress The address of the account that is the creator of the apps you want to search for
151
+ * @param ignoreCache Whether or not to ignore the cache and force a lookup, default: use the cache
152
+ * @returns A name-based lookup of the app metadata
153
+ * @example
154
+ * ```ts
155
+ * const result = await deployer.getCreatorAppsByName(creator)
156
+ */
157
+ getCreatorAppsByName(creatorAddress: string | Address, ignoreCache?: boolean): Promise<AppLookup>;
153
158
  }
154
- //#endregion
155
- export { AppDeployParams, AppDeployResult, AppDeployer, AppLookup, AppMetadata, DeployAppDeleteMethodCall, DeployAppDeleteParams, DeployAppUpdateMethodCall, DeployAppUpdateParams };
156
- //# sourceMappingURL=app-deployer.d.ts.map