@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,793 +1,814 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { TransactionSignerAccount } from "./account.js";
3
- import { Expand } from "./expand.js";
4
- import { ABIReturn, AppDeployMetadata, AppReturn, CompiledTeal, SendAppTransactionResult, TealTemplateParams } from "./app.js";
5
- import { ConfirmedTransactionResult, SendParams } from "./transaction.js";
6
- import { BoxIdentifier, BoxReference, ResourceReference } from "./app-manager.js";
7
- import { AppMethodCall, AppMethodCallParams, AppMethodCallTransactionArgument } from "./composer.js";
8
- import { ABIStruct, Arc56Contract, Arc56Method } from "./app-arc56.js";
9
- import { AppDeployParams } from "./app-deployer.js";
10
- import { AppSpec } from "./app-spec.js";
11
- import { AlgorandClient } from "./algorand-client.js";
12
- import { AppClient, AppClientBareCallParams, AppClientCompilationParams, AppClientCompilationResult, AppClientMethodCallParams, AppClientParams, AppSourceMaps, ResolveAppClientByCreatorAndName } from "./app-client.js";
13
- import algosdk, { Address } from "algosdk";
14
-
15
- //#region src/types/app-factory.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { TransactionSignerAccount } from './account';
3
+ import { type AlgorandClient } from './algorand-client';
4
+ import { AppReturn, SendAppTransactionResult, TealTemplateParams } from './app';
5
+ import { ABIStruct, Arc56Contract, Arc56Method } from './app-arc56';
6
+ import { AppClient, AppClientBareCallParams, AppClientCompilationParams, AppClientMethodCallParams, AppClientParams, AppSourceMaps, ResolveAppClientByCreatorAndName } from './app-client';
7
+ import { AppDeployParams } from './app-deployer';
8
+ import { AppSpec } from './app-spec';
9
+ import { AppMethodCall, AppMethodCallTransactionArgument } from './composer';
10
+ import { Expand } from './expand';
11
+ import { SendParams } from './transaction';
12
+ import OnApplicationComplete = algosdk.OnApplicationComplete;
13
+ import ABIValue = algosdk.ABIValue;
14
+ import TransactionSigner = algosdk.TransactionSigner;
16
15
  /** Parameters to create an app client */
17
- interface AppFactoryParams {
18
- /** The ARC-56 or ARC-32 application spec as either:
19
- * * Parsed JSON ARC-56 `Contract`
20
- * * Parsed JSON ARC-32 `AppSpec`
21
- * * Raw JSON string (in either ARC-56 or ARC-32 format)
22
- */
23
- appSpec: Arc56Contract | AppSpec | string;
24
- /** `AlgorandClient` instance */
25
- algorand: AlgorandClient;
26
- /**
27
- * Optional override for the app name; used for on-chain metadata and lookups.
28
- * Defaults to the ARC-32/ARC-56 app spec name.
29
- */
30
- appName?: string;
31
- /** Optional address to use for the account to use as the default sender for calls. */
32
- defaultSender?: Address | string;
33
- /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */
34
- defaultSigner?: TransactionSigner;
35
- /** The version of app that is / will be deployed; defaults to 1.0 */
36
- version?: string;
37
- /**
38
- * Whether or not the contract should have deploy-time immutability control set, undefined = ignore.
39
- * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
40
- *
41
- * Useful if you want to vend multiple contracts from the same factory without specifying this value
42
- * for each call.
43
- */
44
- updatable?: boolean;
45
- /**
46
- * Whether or not the contract should have deploy-time permanence control set, undefined = ignore.
47
- * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
48
- *
49
- * Useful if you want to vend multiple contracts from the same factory without specifying this value
50
- * for each call.
51
- */
52
- deletable?: boolean;
53
- /**
54
- * Optional deploy-time TEAL template replacement parameters.
55
- * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
56
- *
57
- * Useful if you want to vend multiple contracts from the same factory without specifying this value
58
- * for each call.
59
- */
60
- deployTimeParams?: TealTemplateParams;
16
+ export interface AppFactoryParams {
17
+ /** The ARC-56 or ARC-32 application spec as either:
18
+ * * Parsed JSON ARC-56 `Contract`
19
+ * * Parsed JSON ARC-32 `AppSpec`
20
+ * * Raw JSON string (in either ARC-56 or ARC-32 format)
21
+ */
22
+ appSpec: Arc56Contract | AppSpec | string;
23
+ /** `AlgorandClient` instance */
24
+ algorand: AlgorandClient;
25
+ /**
26
+ * Optional override for the app name; used for on-chain metadata and lookups.
27
+ * Defaults to the ARC-32/ARC-56 app spec name.
28
+ */
29
+ appName?: string;
30
+ /** Optional address to use for the account to use as the default sender for calls. */
31
+ defaultSender?: Address | string;
32
+ /** Optional signer to use as the default signer for default sender calls (if not specified then the signer will be resolved from `AlgorandClient`). */
33
+ defaultSigner?: TransactionSigner;
34
+ /** The version of app that is / will be deployed; defaults to 1.0 */
35
+ version?: string;
36
+ /**
37
+ * Whether or not the contract should have deploy-time immutability control set, undefined = ignore.
38
+ * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
39
+ *
40
+ * Useful if you want to vend multiple contracts from the same factory without specifying this value
41
+ * for each call.
42
+ */
43
+ updatable?: boolean;
44
+ /**
45
+ * Whether or not the contract should have deploy-time permanence control set, undefined = ignore.
46
+ * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
47
+ *
48
+ * Useful if you want to vend multiple contracts from the same factory without specifying this value
49
+ * for each call.
50
+ */
51
+ deletable?: boolean;
52
+ /**
53
+ * Optional deploy-time TEAL template replacement parameters.
54
+ * If specified here will get used in calls to `deploy` and `create` calls unless overridden in those calls.
55
+ *
56
+ * Useful if you want to vend multiple contracts from the same factory without specifying this value
57
+ * for each call.
58
+ */
59
+ deployTimeParams?: TealTemplateParams;
61
60
  }
62
61
  /** onComplete parameter for a create app call */
63
- type CreateOnComplete = {
64
- onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
62
+ export type CreateOnComplete = {
63
+ onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
65
64
  };
66
65
  /** Specifies a schema used for creating an app */
67
- type CreateSchema = {
68
- /** The state schema for the app. This is immutable once the app is created. By default uses the ARC32/ARC-56 spec. */schema?: {
69
- /** The number of integers saved in global state. */globalInts: number; /** The number of byte slices saved in global state. */
70
- globalByteSlices: number; /** The number of integers saved in local state. */
71
- localInts: number; /** The number of byte slices saved in local state. */
72
- localByteSlices: number;
73
- };
74
- /** Number of extra pages required for the programs.
75
- * Defaults to the number needed for the programs in this call if not specified.
76
- * This is immutable once the app is created. */
77
- extraProgramPages?: number;
66
+ export type CreateSchema = {
67
+ /** The state schema for the app. This is immutable once the app is created. By default uses the ARC32/ARC-56 spec. */
68
+ schema?: {
69
+ /** The number of integers saved in global state. */
70
+ globalInts: number;
71
+ /** The number of byte slices saved in global state. */
72
+ globalByteSlices: number;
73
+ /** The number of integers saved in local state. */
74
+ localInts: number;
75
+ /** The number of byte slices saved in local state. */
76
+ localByteSlices: number;
77
+ };
78
+ /** Number of extra pages required for the programs.
79
+ * Defaults to the number needed for the programs in this call if not specified.
80
+ * This is immutable once the app is created. */
81
+ extraProgramPages?: number;
78
82
  };
79
83
  /** Params to specify a bare (raw) create call for an app */
80
- type AppFactoryCreateParams = Expand<AppClientBareCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>;
84
+ export type AppFactoryCreateParams = Expand<AppClientBareCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>;
81
85
  /** Params to specify a create method call for an app */
82
- type AppFactoryCreateMethodCallParams = Expand<AppClientMethodCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>;
86
+ export type AppFactoryCreateMethodCallParams = Expand<AppClientMethodCallParams & AppClientCompilationParams & CreateOnComplete & CreateSchema>;
83
87
  /** Params to get an app client by ID from an app factory. */
84
- type AppFactoryAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>;
88
+ export type AppFactoryAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>;
85
89
  /** Params to get an app client by creator address and name from an app factory. */
86
- type AppFactoryResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>;
90
+ export type AppFactoryResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>;
87
91
  /** Parameters to define a deployment for an `AppFactory` */
88
- type AppFactoryDeployParams = Expand<Omit<AppDeployParams, 'createParams' | 'updateParams' | 'deleteParams' | 'metadata'> & {
89
- /** Create transaction parameters to use if a create needs to be issued as part of deployment */createParams?: Expand<AppClientMethodCallParams & CreateOnComplete & CreateSchema> | Expand<AppClientBareCallParams & CreateOnComplete & CreateSchema>; /** Update transaction parameters to use if a create needs to be issued as part of deployment */
90
- updateParams?: AppClientMethodCallParams | AppClientBareCallParams; /** Delete transaction parameters to use if a create needs to be issued as part of deployment */
91
- deleteParams?: AppClientMethodCallParams | AppClientBareCallParams;
92
- /**
93
- * Whether or not the contract should have deploy-time immutability control set.
94
- * `undefined` = use AppFactory constructor value if set or base it on the app spec.
95
- */
96
- updatable?: boolean;
97
- /**
98
- * Whether or not the contract should have deploy-time permanence control set.
99
- * `undefined` = use AppFactory constructor value if set or base it on the app spec.
100
- */
101
- deletable?: boolean; /** Override the app name for this deployment */
102
- appName?: string;
92
+ export type AppFactoryDeployParams = Expand<Omit<AppDeployParams, 'createParams' | 'updateParams' | 'deleteParams' | 'metadata'> & {
93
+ /** Create transaction parameters to use if a create needs to be issued as part of deployment */
94
+ createParams?: Expand<AppClientMethodCallParams & CreateOnComplete & CreateSchema> | Expand<AppClientBareCallParams & CreateOnComplete & CreateSchema>;
95
+ /** Update transaction parameters to use if a create needs to be issued as part of deployment */
96
+ updateParams?: AppClientMethodCallParams | AppClientBareCallParams;
97
+ /** Delete transaction parameters to use if a create needs to be issued as part of deployment */
98
+ deleteParams?: AppClientMethodCallParams | AppClientBareCallParams;
99
+ /**
100
+ * Whether or not the contract should have deploy-time immutability control set.
101
+ * `undefined` = use AppFactory constructor value if set or base it on the app spec.
102
+ */
103
+ updatable?: boolean;
104
+ /**
105
+ * Whether or not the contract should have deploy-time permanence control set.
106
+ * `undefined` = use AppFactory constructor value if set or base it on the app spec.
107
+ */
108
+ deletable?: boolean;
109
+ /** Override the app name for this deployment */
110
+ appName?: string;
103
111
  }>;
104
112
  /**
105
113
  * ARC-56/ARC-32 app factory that, for a given app spec, allows you to create
106
114
  * and deploy one or more app instances and to create one or more app clients
107
115
  * to interact with those (or other) app instances.
108
116
  */
109
- declare class AppFactory {
110
- private _appSpec;
111
- private _appName;
112
- private _algorand;
113
- private _version;
114
- private _defaultSender?;
115
- private _defaultSigner?;
116
- private _deployTimeParams?;
117
- private _updatable?;
118
- private _deletable?;
119
- private _approvalSourceMap;
120
- private _clearSourceMap;
121
- private _paramsMethods;
122
- /**
123
- * Create a new app factory.
124
- * @param params The parameters to create the app factory
125
- * @returns The `AppFactory` instance
126
- * @example
127
- * ```typescript
128
- * const appFactory = new AppFactory({
129
- * appSpec: appSpec,
130
- * algorand: AlgorandClient.mainNet(),
131
- * })
132
- */
133
- constructor(params: AppFactoryParams);
134
- /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
135
- get appName(): string;
136
- /** The ARC-56 app spec being used */
137
- get appSpec(): Arc56Contract;
138
- /** Return the algorand client this factory is using. */
139
- get algorand(): AlgorandClient;
140
- /** Get parameters to create transactions (create and deploy related calls) for the current app.
141
- *
142
- * A good mental model for this is that these parameters represent a deferred transaction creation.
143
- * @example Create a transaction in the future using Algorand Client
144
- * ```typescript
145
- * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
146
- * // ...
147
- * await algorand.send.AppCreateMethodCall(createAppParams)
148
- * ```
149
- * @example Define a nested transaction as an ABI argument
150
- * ```typescript
151
- * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
152
- * await appClient.send.call({method: 'my_method', args: [createAppParams]})
153
- * ```
154
- */
155
- get params(): {
156
- /** Return params for a create ABI call, including deploy-time TEAL template replacements and compilation if provided */create: (params: AppFactoryCreateMethodCallParams) => Promise<{
157
- deployTimeParams: TealTemplateParams | undefined;
158
- schema: {
159
- /** The number of integers saved in global state. */globalInts: number; /** The number of byte slices saved in global state. */
160
- globalByteSlices: number; /** The number of integers saved in local state. */
161
- localInts: number; /** The number of byte slices saved in local state. */
162
- localByteSlices: number;
163
- };
164
- approvalProgram: Uint8Array<ArrayBufferLike>;
165
- clearStateProgram: Uint8Array<ArrayBufferLike>;
166
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
167
- rekeyTo?: (string | Address) | undefined;
168
- note?: (Uint8Array | string) | undefined;
169
- lease?: (Uint8Array | string) | undefined;
170
- staticFee?: AlgoAmount | undefined;
171
- extraFee?: AlgoAmount | undefined;
172
- maxFee?: AlgoAmount | undefined;
173
- validityWindow?: number | bigint | undefined;
174
- firstValidRound?: bigint | undefined;
175
- lastValidRound?: bigint | undefined;
176
- onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
177
- accountReferences?: (string | Address)[] | undefined;
178
- appReferences?: bigint[] | undefined;
179
- assetReferences?: bigint[] | undefined;
180
- boxReferences?: (BoxReference | BoxIdentifier)[];
181
- accessReferences?: ResourceReference[] | undefined;
182
- rejectVersion?: number | undefined;
183
- sender?: (Address | string) | undefined;
184
- method: string;
185
- args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[];
186
- updatable?: boolean | undefined;
187
- deletable?: boolean | undefined;
188
- extraProgramPages?: number | undefined;
189
- } & {
190
- sender: algosdk.Address;
191
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
192
- method: Arc56Method;
193
- args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
194
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
195
- sender: string | Address;
196
- rekeyTo?: (string | Address) | undefined;
197
- note?: (Uint8Array | string) | undefined;
198
- lease?: (Uint8Array | string) | undefined;
199
- staticFee?: AlgoAmount | undefined;
200
- extraFee?: AlgoAmount | undefined;
201
- maxFee?: AlgoAmount | undefined;
202
- validityWindow?: number | bigint | undefined;
203
- firstValidRound?: bigint | undefined;
204
- lastValidRound?: bigint | undefined;
205
- onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
206
- args?: Uint8Array[] | undefined;
207
- accountReferences?: (string | Address)[] | undefined;
208
- appReferences?: bigint[] | undefined;
209
- assetReferences?: bigint[] | undefined;
210
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
211
- accessReferences?: ResourceReference[] | undefined;
212
- rejectVersion?: number | undefined;
213
- approvalProgram: string | Uint8Array;
214
- clearStateProgram: string | Uint8Array;
215
- schema?: {
216
- globalInts: number;
217
- globalByteSlices: number;
218
- localInts: number;
219
- localByteSlices: number;
220
- } | undefined;
221
- extraProgramPages?: number | undefined;
222
- }> | AppMethodCall<{
223
- sender: string | Address;
224
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
225
- rekeyTo?: (string | Address) | undefined;
226
- note?: (Uint8Array | string) | undefined;
227
- lease?: (Uint8Array | string) | undefined;
228
- staticFee?: AlgoAmount | undefined;
229
- extraFee?: AlgoAmount | undefined;
230
- maxFee?: AlgoAmount | undefined;
231
- validityWindow?: number | bigint | undefined;
232
- firstValidRound?: bigint | undefined;
233
- lastValidRound?: bigint | undefined;
234
- appId: bigint;
235
- onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
236
- args?: Uint8Array[] | undefined;
237
- accountReferences?: (string | Address)[] | undefined;
238
- appReferences?: bigint[] | undefined;
239
- assetReferences?: bigint[] | undefined;
240
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
241
- accessReferences?: ResourceReference[] | undefined;
242
- rejectVersion?: number | undefined;
243
- approvalProgram: string | Uint8Array;
244
- clearStateProgram: string | Uint8Array;
245
- }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
246
- onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
247
- }>; /** Return params for a deployment update ABI call */
248
- deployUpdate: (params: AppClientMethodCallParams) => {
249
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
250
- rekeyTo?: (string | Address) | undefined;
251
- note?: (Uint8Array | string) | undefined;
252
- lease?: (Uint8Array | string) | undefined;
253
- staticFee?: AlgoAmount | undefined;
254
- extraFee?: AlgoAmount | undefined;
255
- maxFee?: AlgoAmount | undefined;
256
- validityWindow?: number | bigint | undefined;
257
- firstValidRound?: bigint | undefined;
258
- lastValidRound?: bigint | undefined;
259
- onComplete?: algosdk.OnApplicationComplete | undefined;
260
- accountReferences?: (string | Address)[] | undefined;
261
- appReferences?: bigint[] | undefined;
262
- assetReferences?: bigint[] | undefined;
263
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
264
- accessReferences?: ResourceReference[] | undefined;
265
- rejectVersion?: number | undefined;
266
- sender?: (Address | string) | undefined;
267
- method: string;
268
- args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[] | undefined;
269
- } & {
270
- sender: algosdk.Address;
271
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
272
- method: Arc56Method;
273
- args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
274
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
275
- sender: string | Address;
276
- rekeyTo?: (string | Address) | undefined;
277
- note?: (Uint8Array | string) | undefined;
278
- lease?: (Uint8Array | string) | undefined;
279
- staticFee?: AlgoAmount | undefined;
280
- extraFee?: AlgoAmount | undefined;
281
- maxFee?: AlgoAmount | undefined;
282
- validityWindow?: number | bigint | undefined;
283
- firstValidRound?: bigint | undefined;
284
- lastValidRound?: bigint | undefined;
285
- onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
286
- args?: Uint8Array[] | undefined;
287
- accountReferences?: (string | Address)[] | undefined;
288
- appReferences?: bigint[] | undefined;
289
- assetReferences?: bigint[] | undefined;
290
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
291
- accessReferences?: ResourceReference[] | undefined;
292
- rejectVersion?: number | undefined;
293
- approvalProgram: string | Uint8Array;
294
- clearStateProgram: string | Uint8Array;
295
- schema?: {
296
- globalInts: number;
297
- globalByteSlices: number;
298
- localInts: number;
299
- localByteSlices: number;
300
- } | undefined;
301
- extraProgramPages?: number | undefined;
302
- }> | AppMethodCall<{
303
- sender: string | Address;
304
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
305
- rekeyTo?: (string | Address) | undefined;
306
- note?: (Uint8Array | string) | undefined;
307
- lease?: (Uint8Array | string) | undefined;
308
- staticFee?: AlgoAmount | undefined;
309
- extraFee?: AlgoAmount | undefined;
310
- maxFee?: AlgoAmount | undefined;
311
- validityWindow?: number | bigint | undefined;
312
- firstValidRound?: bigint | undefined;
313
- lastValidRound?: bigint | undefined;
314
- appId: bigint;
315
- onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
316
- args?: Uint8Array[] | undefined;
317
- accountReferences?: (string | Address)[] | undefined;
318
- appReferences?: bigint[] | undefined;
319
- assetReferences?: bigint[] | undefined;
320
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
321
- accessReferences?: ResourceReference[] | undefined;
322
- rejectVersion?: number | undefined;
323
- approvalProgram: string | Uint8Array;
324
- clearStateProgram: string | Uint8Array;
325
- }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
326
- onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
327
- }; /** Return params for a deployment delete ABI call */
328
- deployDelete: (params: AppClientMethodCallParams) => {
329
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
330
- rekeyTo?: (string | Address) | undefined;
331
- note?: (Uint8Array | string) | undefined;
332
- lease?: (Uint8Array | string) | undefined;
333
- staticFee?: AlgoAmount | undefined;
334
- extraFee?: AlgoAmount | undefined;
335
- maxFee?: AlgoAmount | undefined;
336
- validityWindow?: number | bigint | undefined;
337
- firstValidRound?: bigint | undefined;
338
- lastValidRound?: bigint | undefined;
339
- onComplete?: algosdk.OnApplicationComplete | undefined;
340
- accountReferences?: (string | Address)[] | undefined;
341
- appReferences?: bigint[] | undefined;
342
- assetReferences?: bigint[] | undefined;
343
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
344
- accessReferences?: ResourceReference[] | undefined;
345
- rejectVersion?: number | undefined;
346
- sender?: (Address | string) | undefined;
347
- method: string;
348
- args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[] | undefined;
349
- } & {
350
- sender: algosdk.Address;
351
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
352
- method: Arc56Method;
353
- args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
354
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
355
- sender: string | Address;
356
- rekeyTo?: (string | Address) | undefined;
357
- note?: (Uint8Array | string) | undefined;
358
- lease?: (Uint8Array | string) | undefined;
359
- staticFee?: AlgoAmount | undefined;
360
- extraFee?: AlgoAmount | undefined;
361
- maxFee?: AlgoAmount | undefined;
362
- validityWindow?: number | bigint | undefined;
363
- firstValidRound?: bigint | undefined;
364
- lastValidRound?: bigint | undefined;
365
- onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
366
- args?: Uint8Array[] | undefined;
367
- accountReferences?: (string | Address)[] | undefined;
368
- appReferences?: bigint[] | undefined;
369
- assetReferences?: bigint[] | undefined;
370
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
371
- accessReferences?: ResourceReference[] | undefined;
372
- rejectVersion?: number | undefined;
373
- approvalProgram: string | Uint8Array;
374
- clearStateProgram: string | Uint8Array;
375
- schema?: {
376
- globalInts: number;
377
- globalByteSlices: number;
378
- localInts: number;
379
- localByteSlices: number;
380
- } | undefined;
381
- extraProgramPages?: number | undefined;
382
- }> | AppMethodCall<{
383
- sender: string | Address;
384
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
385
- rekeyTo?: (string | Address) | undefined;
386
- note?: (Uint8Array | string) | undefined;
387
- lease?: (Uint8Array | string) | undefined;
388
- staticFee?: AlgoAmount | undefined;
389
- extraFee?: AlgoAmount | undefined;
390
- maxFee?: AlgoAmount | undefined;
391
- validityWindow?: number | bigint | undefined;
392
- firstValidRound?: bigint | undefined;
393
- lastValidRound?: bigint | undefined;
394
- appId: bigint;
395
- onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
396
- args?: Uint8Array[] | undefined;
397
- accountReferences?: (string | Address)[] | undefined;
398
- appReferences?: bigint[] | undefined;
399
- assetReferences?: bigint[] | undefined;
400
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
401
- accessReferences?: ResourceReference[] | undefined;
402
- rejectVersion?: number | undefined;
403
- approvalProgram: string | Uint8Array;
404
- clearStateProgram: string | Uint8Array;
405
- }> | AppMethodCall<AppMethodCallParams> | undefined)[] | undefined;
406
- onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
117
+ export declare class AppFactory {
118
+ private _appSpec;
119
+ private _appName;
120
+ private _algorand;
121
+ private _version;
122
+ private _defaultSender?;
123
+ private _defaultSigner?;
124
+ private _deployTimeParams?;
125
+ private _updatable?;
126
+ private _deletable?;
127
+ private _approvalSourceMap;
128
+ private _clearSourceMap;
129
+ private _paramsMethods;
130
+ /**
131
+ * Create a new app factory.
132
+ * @param params The parameters to create the app factory
133
+ * @returns The `AppFactory` instance
134
+ * @example
135
+ * ```typescript
136
+ * const appFactory = new AppFactory({
137
+ * appSpec: appSpec,
138
+ * algorand: AlgorandClient.mainNet(),
139
+ * })
140
+ */
141
+ constructor(params: AppFactoryParams);
142
+ /** The name of the app (from the ARC-32 / ARC-56 app spec or override). */
143
+ get appName(): string;
144
+ /** The ARC-56 app spec being used */
145
+ get appSpec(): Arc56Contract;
146
+ /** Return the algorand client this factory is using. */
147
+ get algorand(): AlgorandClient;
148
+ /** Get parameters to create transactions (create and deploy related calls) for the current app.
149
+ *
150
+ * A good mental model for this is that these parameters represent a deferred transaction creation.
151
+ * @example Create a transaction in the future using Algorand Client
152
+ * ```typescript
153
+ * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
154
+ * // ...
155
+ * await algorand.send.AppCreateMethodCall(createAppParams)
156
+ * ```
157
+ * @example Define a nested transaction as an ABI argument
158
+ * ```typescript
159
+ * const createAppParams = appFactory.params.create({method: 'create_method', args: [123, 'hello']})
160
+ * await appClient.send.call({method: 'my_method', args: [createAppParams]})
161
+ * ```
162
+ */
163
+ get params(): {
164
+ /** Return params for a create ABI call, including deploy-time TEAL template replacements and compilation if provided */
165
+ create: (params: AppFactoryCreateMethodCallParams) => Promise<{
166
+ deployTimeParams: TealTemplateParams | undefined;
167
+ schema: {
168
+ /** The number of integers saved in global state. */
169
+ globalInts: number;
170
+ /** The number of byte slices saved in global state. */
171
+ globalByteSlices: number;
172
+ /** The number of integers saved in local state. */
173
+ localInts: number;
174
+ /** The number of byte slices saved in local state. */
175
+ localByteSlices: number;
176
+ };
177
+ approvalProgram: Uint8Array<ArrayBufferLike>;
178
+ clearStateProgram: Uint8Array<ArrayBufferLike>;
179
+ maxFee?: import("./amount").AlgoAmount | undefined;
180
+ note?: (Uint8Array | string) | undefined;
181
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
182
+ onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
183
+ rejectVersion?: number | undefined;
184
+ lease?: (Uint8Array | string) | undefined;
185
+ rekeyTo?: (string | Address) | undefined;
186
+ staticFee?: import("./amount").AlgoAmount | undefined;
187
+ extraFee?: import("./amount").AlgoAmount | undefined;
188
+ validityWindow?: number | bigint | undefined;
189
+ firstValidRound?: bigint | undefined;
190
+ lastValidRound?: bigint | undefined;
191
+ accountReferences?: (string | Address)[] | undefined;
192
+ appReferences?: bigint[] | undefined;
193
+ assetReferences?: bigint[] | undefined;
194
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[];
195
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
196
+ sender?: (Address | string) | undefined;
197
+ method: string;
198
+ args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[];
199
+ updatable?: boolean | undefined;
200
+ deletable?: boolean | undefined;
201
+ extraProgramPages?: number | undefined;
202
+ } & {
203
+ sender: algosdk.Address;
204
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
205
+ method: Arc56Method;
206
+ args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
207
+ sender: string | Address;
208
+ maxFee?: import("./amount").AlgoAmount | undefined;
209
+ note?: (Uint8Array | string) | undefined;
210
+ args?: Uint8Array[] | undefined;
211
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
212
+ onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
213
+ rejectVersion?: number | undefined;
214
+ lease?: (Uint8Array | string) | undefined;
215
+ rekeyTo?: (string | Address) | undefined;
216
+ staticFee?: import("./amount").AlgoAmount | undefined;
217
+ extraFee?: import("./amount").AlgoAmount | undefined;
218
+ validityWindow?: number | bigint | undefined;
219
+ firstValidRound?: bigint | undefined;
220
+ lastValidRound?: bigint | undefined;
221
+ accountReferences?: (string | Address)[] | undefined;
222
+ appReferences?: bigint[] | undefined;
223
+ assetReferences?: bigint[] | undefined;
224
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
225
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
226
+ approvalProgram: string | Uint8Array;
227
+ clearStateProgram: string | Uint8Array;
228
+ schema?: {
229
+ globalInts: number;
230
+ globalByteSlices: number;
231
+ localInts: number;
232
+ localByteSlices: number;
233
+ } | undefined;
234
+ extraProgramPages?: number | undefined;
235
+ }> | AppMethodCall<{
236
+ sender: string | Address;
237
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
238
+ rekeyTo?: (string | Address) | undefined;
239
+ note?: (Uint8Array | string) | undefined;
240
+ lease?: (Uint8Array | string) | undefined;
241
+ staticFee?: import("./amount").AlgoAmount | undefined;
242
+ extraFee?: import("./amount").AlgoAmount | undefined;
243
+ maxFee?: import("./amount").AlgoAmount | undefined;
244
+ validityWindow?: number | bigint | undefined;
245
+ firstValidRound?: bigint | undefined;
246
+ lastValidRound?: bigint | undefined;
247
+ appId: bigint;
248
+ onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
249
+ args?: Uint8Array[] | undefined;
250
+ accountReferences?: (string | Address)[] | undefined;
251
+ appReferences?: bigint[] | undefined;
252
+ assetReferences?: bigint[] | undefined;
253
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
254
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
255
+ rejectVersion?: number | undefined;
256
+ approvalProgram: string | Uint8Array;
257
+ clearStateProgram: string | Uint8Array;
258
+ }> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
259
+ onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
260
+ }>;
261
+ /** Return params for a deployment update ABI call */
262
+ deployUpdate: (params: AppClientMethodCallParams) => {
263
+ maxFee?: import("./amount").AlgoAmount | undefined;
264
+ note?: (Uint8Array | string) | undefined;
265
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
266
+ onComplete?: algosdk.OnApplicationComplete | undefined;
267
+ rejectVersion?: number | undefined;
268
+ lease?: (Uint8Array | string) | undefined;
269
+ rekeyTo?: (string | Address) | undefined;
270
+ staticFee?: import("./amount").AlgoAmount | undefined;
271
+ extraFee?: import("./amount").AlgoAmount | undefined;
272
+ validityWindow?: number | bigint | undefined;
273
+ firstValidRound?: bigint | undefined;
274
+ lastValidRound?: bigint | undefined;
275
+ accountReferences?: (string | Address)[] | undefined;
276
+ appReferences?: bigint[] | undefined;
277
+ assetReferences?: bigint[] | undefined;
278
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
279
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
280
+ sender?: (Address | string) | undefined;
281
+ method: string;
282
+ args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[] | undefined;
283
+ } & {
284
+ sender: algosdk.Address;
285
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
286
+ method: Arc56Method;
287
+ args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
288
+ sender: string | Address;
289
+ maxFee?: import("./amount").AlgoAmount | undefined;
290
+ note?: (Uint8Array | string) | undefined;
291
+ args?: Uint8Array[] | undefined;
292
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
293
+ onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
294
+ rejectVersion?: number | undefined;
295
+ lease?: (Uint8Array | string) | undefined;
296
+ rekeyTo?: (string | Address) | undefined;
297
+ staticFee?: import("./amount").AlgoAmount | undefined;
298
+ extraFee?: import("./amount").AlgoAmount | undefined;
299
+ validityWindow?: number | bigint | undefined;
300
+ firstValidRound?: bigint | undefined;
301
+ lastValidRound?: bigint | undefined;
302
+ accountReferences?: (string | Address)[] | undefined;
303
+ appReferences?: bigint[] | undefined;
304
+ assetReferences?: bigint[] | undefined;
305
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
306
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
307
+ approvalProgram: string | Uint8Array;
308
+ clearStateProgram: string | Uint8Array;
309
+ schema?: {
310
+ globalInts: number;
311
+ globalByteSlices: number;
312
+ localInts: number;
313
+ localByteSlices: number;
314
+ } | undefined;
315
+ extraProgramPages?: number | undefined;
316
+ }> | AppMethodCall<{
317
+ sender: string | Address;
318
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
319
+ rekeyTo?: (string | Address) | undefined;
320
+ note?: (Uint8Array | string) | undefined;
321
+ lease?: (Uint8Array | string) | undefined;
322
+ staticFee?: import("./amount").AlgoAmount | undefined;
323
+ extraFee?: import("./amount").AlgoAmount | undefined;
324
+ maxFee?: import("./amount").AlgoAmount | undefined;
325
+ validityWindow?: number | bigint | undefined;
326
+ firstValidRound?: bigint | undefined;
327
+ lastValidRound?: bigint | undefined;
328
+ appId: bigint;
329
+ onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
330
+ args?: Uint8Array[] | undefined;
331
+ accountReferences?: (string | Address)[] | undefined;
332
+ appReferences?: bigint[] | undefined;
333
+ assetReferences?: bigint[] | undefined;
334
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
335
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
336
+ rejectVersion?: number | undefined;
337
+ approvalProgram: string | Uint8Array;
338
+ clearStateProgram: string | Uint8Array;
339
+ }> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
340
+ onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
341
+ };
342
+ /** Return params for a deployment delete ABI call */
343
+ deployDelete: (params: AppClientMethodCallParams) => {
344
+ maxFee?: import("./amount").AlgoAmount | undefined;
345
+ note?: (Uint8Array | string) | undefined;
346
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
347
+ onComplete?: algosdk.OnApplicationComplete | undefined;
348
+ rejectVersion?: number | undefined;
349
+ lease?: (Uint8Array | string) | undefined;
350
+ rekeyTo?: (string | Address) | undefined;
351
+ staticFee?: import("./amount").AlgoAmount | undefined;
352
+ extraFee?: import("./amount").AlgoAmount | undefined;
353
+ validityWindow?: number | bigint | undefined;
354
+ firstValidRound?: bigint | undefined;
355
+ lastValidRound?: bigint | undefined;
356
+ accountReferences?: (string | Address)[] | undefined;
357
+ appReferences?: bigint[] | undefined;
358
+ assetReferences?: bigint[] | undefined;
359
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
360
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
361
+ sender?: (Address | string) | undefined;
362
+ method: string;
363
+ args?: (ABIValue | ABIStruct | AppMethodCallTransactionArgument | undefined)[] | undefined;
364
+ } & {
365
+ sender: algosdk.Address;
366
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
367
+ method: Arc56Method;
368
+ args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
369
+ sender: string | Address;
370
+ maxFee?: import("./amount").AlgoAmount | undefined;
371
+ note?: (Uint8Array | string) | undefined;
372
+ args?: Uint8Array[] | undefined;
373
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
374
+ onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
375
+ rejectVersion?: number | undefined;
376
+ lease?: (Uint8Array | string) | undefined;
377
+ rekeyTo?: (string | Address) | undefined;
378
+ staticFee?: import("./amount").AlgoAmount | undefined;
379
+ extraFee?: import("./amount").AlgoAmount | undefined;
380
+ validityWindow?: number | bigint | undefined;
381
+ firstValidRound?: bigint | undefined;
382
+ lastValidRound?: bigint | undefined;
383
+ accountReferences?: (string | Address)[] | undefined;
384
+ appReferences?: bigint[] | undefined;
385
+ assetReferences?: bigint[] | undefined;
386
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
387
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
388
+ approvalProgram: string | Uint8Array;
389
+ clearStateProgram: string | Uint8Array;
390
+ schema?: {
391
+ globalInts: number;
392
+ globalByteSlices: number;
393
+ localInts: number;
394
+ localByteSlices: number;
395
+ } | undefined;
396
+ extraProgramPages?: number | undefined;
397
+ }> | AppMethodCall<{
398
+ sender: string | Address;
399
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
400
+ rekeyTo?: (string | Address) | undefined;
401
+ note?: (Uint8Array | string) | undefined;
402
+ lease?: (Uint8Array | string) | undefined;
403
+ staticFee?: import("./amount").AlgoAmount | undefined;
404
+ extraFee?: import("./amount").AlgoAmount | undefined;
405
+ maxFee?: import("./amount").AlgoAmount | undefined;
406
+ validityWindow?: number | bigint | undefined;
407
+ firstValidRound?: bigint | undefined;
408
+ lastValidRound?: bigint | undefined;
409
+ appId: bigint;
410
+ onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
411
+ args?: Uint8Array[] | undefined;
412
+ accountReferences?: (string | Address)[] | undefined;
413
+ appReferences?: bigint[] | undefined;
414
+ assetReferences?: bigint[] | undefined;
415
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
416
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
417
+ rejectVersion?: number | undefined;
418
+ approvalProgram: string | Uint8Array;
419
+ clearStateProgram: string | Uint8Array;
420
+ }> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
421
+ onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
422
+ };
423
+ bare: {
424
+ /** Return params for a create bare call, including deploy-time TEAL template replacements and compilation if provided */
425
+ create: (params?: AppFactoryCreateParams) => Promise<{
426
+ approvalProgram: Uint8Array;
427
+ clearStateProgram: Uint8Array;
428
+ compiledApproval?: import("./app").CompiledTeal | undefined;
429
+ compiledClear?: import("./app").CompiledTeal | undefined;
430
+ deployTimeParams: TealTemplateParams | undefined;
431
+ schema: {
432
+ /** The number of integers saved in global state. */
433
+ globalInts: number;
434
+ /** The number of byte slices saved in global state. */
435
+ globalByteSlices: number;
436
+ /** The number of integers saved in local state. */
437
+ localInts: number;
438
+ /** The number of byte slices saved in local state. */
439
+ localByteSlices: number;
440
+ };
441
+ maxFee?: import("./amount").AlgoAmount;
442
+ note?: Uint8Array | string;
443
+ args?: Uint8Array[];
444
+ signer?: algosdk.TransactionSigner | TransactionSignerAccount;
445
+ rejectVersion?: number;
446
+ lease?: Uint8Array | string;
447
+ rekeyTo?: string | Address;
448
+ staticFee?: import("./amount").AlgoAmount;
449
+ extraFee?: import("./amount").AlgoAmount;
450
+ validityWindow?: number | bigint;
451
+ firstValidRound?: bigint;
452
+ lastValidRound?: bigint;
453
+ accountReferences?: (string | Address)[];
454
+ appReferences?: bigint[];
455
+ assetReferences?: bigint[];
456
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[];
457
+ accessReferences?: import("./app-manager").ResourceReference[];
458
+ sender?: Address | string;
459
+ updatable?: boolean;
460
+ deletable?: boolean;
461
+ onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
462
+ extraProgramPages?: number;
463
+ } & {
464
+ sender: algosdk.Address;
465
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
466
+ onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
467
+ }>;
468
+ /** Return params for a deployment update bare call */
469
+ deployUpdate: (params?: AppClientBareCallParams) => {
470
+ maxFee?: import("./amount").AlgoAmount | undefined;
471
+ note?: (Uint8Array | string) | undefined;
472
+ args?: Uint8Array[] | undefined;
473
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
474
+ rejectVersion?: number | undefined;
475
+ lease?: (Uint8Array | string) | undefined;
476
+ rekeyTo?: (string | Address) | undefined;
477
+ staticFee?: import("./amount").AlgoAmount | undefined;
478
+ extraFee?: import("./amount").AlgoAmount | undefined;
479
+ validityWindow?: number | bigint | undefined;
480
+ firstValidRound?: bigint | undefined;
481
+ lastValidRound?: bigint | undefined;
482
+ accountReferences?: (string | Address)[] | undefined;
483
+ appReferences?: bigint[] | undefined;
484
+ assetReferences?: bigint[] | undefined;
485
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
486
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
487
+ sender?: (Address | string) | undefined;
488
+ } & {
489
+ sender: algosdk.Address;
490
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
491
+ onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
492
+ };
493
+ /** Return params for a deployment delete bare call */
494
+ deployDelete: (params?: AppClientBareCallParams) => {
495
+ maxFee?: import("./amount").AlgoAmount | undefined;
496
+ note?: (Uint8Array | string) | undefined;
497
+ args?: Uint8Array[] | undefined;
498
+ signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
499
+ rejectVersion?: number | undefined;
500
+ lease?: (Uint8Array | string) | undefined;
501
+ rekeyTo?: (string | Address) | undefined;
502
+ staticFee?: import("./amount").AlgoAmount | undefined;
503
+ extraFee?: import("./amount").AlgoAmount | undefined;
504
+ validityWindow?: number | bigint | undefined;
505
+ firstValidRound?: bigint | undefined;
506
+ lastValidRound?: bigint | undefined;
507
+ accountReferences?: (string | Address)[] | undefined;
508
+ appReferences?: bigint[] | undefined;
509
+ assetReferences?: bigint[] | undefined;
510
+ boxReferences?: (import("./app-manager").BoxReference | import("./app-manager").BoxIdentifier)[] | undefined;
511
+ accessReferences?: import("./app-manager").ResourceReference[] | undefined;
512
+ sender?: (Address | string) | undefined;
513
+ } & {
514
+ sender: algosdk.Address;
515
+ signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
516
+ onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
517
+ };
518
+ };
407
519
  };
408
- bare: {
409
- /** Return params for a create bare call, including deploy-time TEAL template replacements and compilation if provided */create: (params?: AppFactoryCreateParams) => Promise<{
410
- approvalProgram: Uint8Array;
411
- clearStateProgram: Uint8Array;
412
- compiledApproval?: CompiledTeal | undefined;
413
- compiledClear?: CompiledTeal | undefined;
414
- deployTimeParams: TealTemplateParams | undefined;
415
- schema: {
416
- /** The number of integers saved in global state. */globalInts: number; /** The number of byte slices saved in global state. */
417
- globalByteSlices: number; /** The number of integers saved in local state. */
418
- localInts: number; /** The number of byte slices saved in local state. */
419
- localByteSlices: number;
520
+ /** Create transactions for the current app */
521
+ readonly createTransaction: {
522
+ /** Create bare (raw) transactions for the current app */
523
+ bare: {
524
+ /**
525
+ * Create a create app call transaction using a bare (raw) create call.
526
+ *
527
+ * Performs deploy-time TEAL template placeholder substitutions (if specified).
528
+ * @param params The parameters to create the create call transaction
529
+ * @returns The create call transaction
530
+ */
531
+ create: (params?: AppFactoryCreateParams) => Promise<algosdk.Transaction>;
420
532
  };
421
- signer?: algosdk.TransactionSigner | TransactionSignerAccount;
422
- rekeyTo?: string | Address;
423
- note?: Uint8Array | string;
424
- lease?: Uint8Array | string;
425
- staticFee?: AlgoAmount;
426
- extraFee?: AlgoAmount;
427
- maxFee?: AlgoAmount;
428
- validityWindow?: number | bigint;
429
- firstValidRound?: bigint;
430
- lastValidRound?: bigint;
431
- args?: Uint8Array[];
432
- accountReferences?: (string | Address)[];
433
- appReferences?: bigint[];
434
- assetReferences?: bigint[];
435
- boxReferences?: (BoxReference | BoxIdentifier)[];
436
- accessReferences?: ResourceReference[];
437
- rejectVersion?: number;
438
- sender?: Address | string;
439
- updatable?: boolean;
440
- deletable?: boolean;
441
- onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>;
442
- extraProgramPages?: number;
443
- } & {
444
- sender: algosdk.Address;
445
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
446
- onComplete: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC;
447
- }>; /** Return params for a deployment update bare call */
448
- deployUpdate: (params?: AppClientBareCallParams) => {
449
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
450
- rekeyTo?: (string | Address) | undefined;
451
- note?: (Uint8Array | string) | undefined;
452
- lease?: (Uint8Array | string) | undefined;
453
- staticFee?: AlgoAmount | undefined;
454
- extraFee?: AlgoAmount | undefined;
455
- maxFee?: AlgoAmount | undefined;
456
- validityWindow?: number | bigint | undefined;
457
- firstValidRound?: bigint | undefined;
458
- lastValidRound?: bigint | undefined;
459
- args?: Uint8Array[] | undefined;
460
- accountReferences?: (string | Address)[] | undefined;
461
- appReferences?: bigint[] | undefined;
462
- assetReferences?: bigint[] | undefined;
463
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
464
- accessReferences?: ResourceReference[] | undefined;
465
- rejectVersion?: number | undefined;
466
- sender?: (Address | string) | undefined;
467
- } & {
468
- sender: algosdk.Address;
469
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
470
- onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
471
- }; /** Return params for a deployment delete bare call */
472
- deployDelete: (params?: AppClientBareCallParams) => {
473
- signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
474
- rekeyTo?: (string | Address) | undefined;
475
- note?: (Uint8Array | string) | undefined;
476
- lease?: (Uint8Array | string) | undefined;
477
- staticFee?: AlgoAmount | undefined;
478
- extraFee?: AlgoAmount | undefined;
479
- maxFee?: AlgoAmount | undefined;
480
- validityWindow?: number | bigint | undefined;
481
- firstValidRound?: bigint | undefined;
482
- lastValidRound?: bigint | undefined;
483
- args?: Uint8Array[] | undefined;
484
- accountReferences?: (string | Address)[] | undefined;
485
- appReferences?: bigint[] | undefined;
486
- assetReferences?: bigint[] | undefined;
487
- boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
488
- accessReferences?: ResourceReference[] | undefined;
489
- rejectVersion?: number | undefined;
490
- sender?: (Address | string) | undefined;
491
- } & {
492
- sender: algosdk.Address;
493
- signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
494
- onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC;
495
- };
533
+ /**
534
+ * Create a create app call transaction using an ABI create call.
535
+ *
536
+ * Performs deploy-time TEAL template placeholder substitutions (if specified).
537
+ * @param params The parameters to create the create call transaction
538
+ * @returns The create call transaction
539
+ */
540
+ create: (params: AppFactoryCreateMethodCallParams) => Promise<{
541
+ transactions: algosdk.Transaction[];
542
+ methodCalls: Map<number, algosdk.ABIMethod>;
543
+ signers: Map<number, algosdk.TransactionSigner>;
544
+ }>;
496
545
  };
497
- };
498
- /** Create transactions for the current app */
499
- readonly createTransaction: {
500
- /** Create bare (raw) transactions for the current app */bare: {
501
- /**
502
- * Create a create app call transaction using a bare (raw) create call.
503
- *
504
- * Performs deploy-time TEAL template placeholder substitutions (if specified).
505
- * @param params The parameters to create the create call transaction
506
- * @returns The create call transaction
507
- */
508
- create: (params?: AppFactoryCreateParams) => Promise<algosdk.Transaction>;
546
+ /** Send transactions to the current app */
547
+ readonly send: {
548
+ /** Send bare (raw) transactions for the current app */
549
+ bare: {
550
+ /**
551
+ * Creates an instance of the app using a bare (raw) create call and returns the result
552
+ * of the creation transaction and an app client to interact with that app instance.
553
+ *
554
+ * Performs deploy-time TEAL template placeholder substitutions (if specified).
555
+ * @param params The parameters to create the app
556
+ * @returns The app client and the result of the creation transaction
557
+ */
558
+ create: (params?: AppFactoryCreateParams & SendParams) => Promise<{
559
+ appClient: AppClient;
560
+ result: {
561
+ compiledApproval?: import("./app").CompiledTeal | undefined;
562
+ compiledClear?: import("./app").CompiledTeal | undefined;
563
+ return: undefined;
564
+ groupId: string;
565
+ txIds: string[];
566
+ returns?: import("./app").ABIReturn[] | undefined;
567
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
568
+ transactions: algosdk.Transaction[];
569
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
570
+ transaction: algosdk.Transaction;
571
+ appId: bigint;
572
+ appAddress: Address;
573
+ };
574
+ }>;
575
+ };
576
+ /**
577
+ * Creates an instance of the app and returns the result of the creation
578
+ * transaction and an app client to interact with that app instance.
579
+ *
580
+ * Performs deploy-time TEAL template placeholder substitutions (if specified).
581
+ * @param params The parameters to create the app
582
+ * @returns The app client and the result of the creation transaction
583
+ */
584
+ create: (params: AppFactoryCreateMethodCallParams & SendParams) => Promise<{
585
+ appClient: AppClient;
586
+ result: {
587
+ compiledApproval?: import("./app").CompiledTeal | undefined;
588
+ compiledClear?: import("./app").CompiledTeal | undefined;
589
+ appId: bigint;
590
+ groupId: string;
591
+ txIds: string[];
592
+ returns?: import("./app").ABIReturn[] | undefined;
593
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
594
+ transactions: algosdk.Transaction[];
595
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
596
+ transaction: algosdk.Transaction;
597
+ appAddress: Address;
598
+ return?: Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined;
599
+ };
600
+ }>;
509
601
  };
510
602
  /**
511
- * Create a create app call transaction using an ABI create call.
603
+ * 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).
604
+ *
605
+ * **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`.
512
606
  *
513
- * Performs deploy-time TEAL template placeholder substitutions (if specified).
514
- * @param params The parameters to create the create call transaction
515
- * @returns The create call transaction
607
+ * **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.
608
+ *
609
+ * **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.
610
+ * @param params The arguments to control the app deployment
611
+ * @returns The app client and the result of the deployment
612
+ * @example
613
+ * ```ts
614
+ * const { appClient, result } = await factory.deploy({
615
+ * createParams: {
616
+ * sender: 'SENDER_ADDRESS',
617
+ * approvalProgram: 'APPROVAL PROGRAM',
618
+ * clearStateProgram: 'CLEAR PROGRAM',
619
+ * schema: {
620
+ * globalByteSlices: 0,
621
+ * globalInts: 0,
622
+ * localByteSlices: 0,
623
+ * localInts: 0
624
+ * }
625
+ * },
626
+ * updateParams: {
627
+ * sender: 'SENDER_ADDRESS'
628
+ * },
629
+ * deleteParams: {
630
+ * sender: 'SENDER_ADDRESS'
631
+ * },
632
+ * metadata: { name: 'my_app', version: '2.0', updatable: false, deletable: false },
633
+ * onSchemaBreak: 'append',
634
+ * onUpdate: 'append'
635
+ * })
636
+ * ```
516
637
  */
517
- create: (params: AppFactoryCreateMethodCallParams) => Promise<{
518
- transactions: algosdk.Transaction[];
519
- methodCalls: Map<number, algosdk.ABIMethod>;
520
- signers: Map<number, algosdk.TransactionSigner>;
521
- }>;
522
- };
523
- /** Send transactions to the current app */
524
- readonly send: {
525
- /** Send bare (raw) transactions for the current app */bare: {
526
- /**
527
- * Creates an instance of the app using a bare (raw) create call and returns the result
528
- * of the creation transaction and an app client to interact with that app instance.
529
- *
530
- * Performs deploy-time TEAL template placeholder substitutions (if specified).
531
- * @param params The parameters to create the app
532
- * @returns The app client and the result of the creation transaction
533
- */
534
- create: (params?: AppFactoryCreateParams & SendParams) => Promise<{
638
+ deploy(params: AppFactoryDeployParams): Promise<{
535
639
  appClient: AppClient;
536
640
  result: {
537
- compiledApproval?: CompiledTeal | undefined;
538
- compiledClear?: CompiledTeal | undefined;
539
- return: undefined;
540
- groupId: string;
541
- txIds: string[];
542
- returns?: ABIReturn[] | undefined;
543
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
544
- transactions: algosdk.Transaction[];
545
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
546
- transaction: algosdk.Transaction;
547
- appId: bigint;
548
- appAddress: Address;
641
+ return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
642
+ deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
643
+ compiledApproval?: import("./app").CompiledTeal | undefined;
644
+ compiledClear?: import("./app").CompiledTeal | undefined;
645
+ operationPerformed: "create";
646
+ version: string;
647
+ name: string;
648
+ createdRound: bigint;
649
+ updatedRound: bigint;
650
+ createdMetadata: import("./app").AppDeployMetadata;
651
+ deleted: boolean;
652
+ deletable?: boolean | undefined;
653
+ updatable?: boolean | undefined;
654
+ groupId: string;
655
+ txIds: string[];
656
+ returns?: import("./app").ABIReturn[] | undefined;
657
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
658
+ transactions: algosdk.Transaction[];
659
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
660
+ transaction: algosdk.Transaction;
661
+ appId: bigint;
662
+ appAddress: Address;
663
+ } | {
664
+ return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
665
+ deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
666
+ compiledApproval?: import("./app").CompiledTeal | undefined;
667
+ compiledClear?: import("./app").CompiledTeal | undefined;
668
+ operationPerformed: "update";
669
+ appId: bigint;
670
+ appAddress: Address;
671
+ createdRound: bigint;
672
+ updatedRound: bigint;
673
+ createdMetadata: import("./app").AppDeployMetadata;
674
+ deleted: boolean;
675
+ name: string;
676
+ version: string;
677
+ deletable?: boolean | undefined;
678
+ updatable?: boolean | undefined;
679
+ groupId: string;
680
+ txIds: string[];
681
+ returns?: import("./app").ABIReturn[] | undefined;
682
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
683
+ transactions: algosdk.Transaction[];
684
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
685
+ transaction: algosdk.Transaction;
686
+ } | {
687
+ return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
688
+ deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
689
+ compiledApproval?: import("./app").CompiledTeal | undefined;
690
+ compiledClear?: import("./app").CompiledTeal | undefined;
691
+ operationPerformed: "replace";
692
+ version: string;
693
+ name: string;
694
+ createdRound: bigint;
695
+ updatedRound: bigint;
696
+ createdMetadata: import("./app").AppDeployMetadata;
697
+ deleted: boolean;
698
+ deletable?: boolean | undefined;
699
+ updatable?: boolean | undefined;
700
+ groupId: string;
701
+ txIds: string[];
702
+ returns?: import("./app").ABIReturn[] | undefined;
703
+ confirmations: algosdk.modelsv2.PendingTransactionResponse[];
704
+ transactions: algosdk.Transaction[];
705
+ confirmation: algosdk.modelsv2.PendingTransactionResponse;
706
+ transaction: algosdk.Transaction;
707
+ appId: bigint;
708
+ appAddress: Address;
709
+ deleteResult: import("./transaction").ConfirmedTransactionResult;
710
+ } | {
711
+ return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
712
+ deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
713
+ compiledApproval?: import("./app").CompiledTeal | undefined;
714
+ compiledClear?: import("./app").CompiledTeal | undefined;
715
+ operationPerformed: "nothing";
716
+ appId: bigint;
717
+ appAddress: Address;
718
+ createdRound: bigint;
719
+ updatedRound: bigint;
720
+ createdMetadata: import("./app").AppDeployMetadata;
721
+ deleted: boolean;
722
+ name: string;
723
+ version: string;
724
+ deletable?: boolean | undefined;
725
+ updatable?: boolean | undefined;
549
726
  };
550
- }>;
551
- };
727
+ }>;
552
728
  /**
553
- * Creates an instance of the app and returns the result of the creation
554
- * transaction and an app client to interact with that app instance.
729
+ * Returns a new `AppClient` client for an app instance of the given ID.
555
730
  *
556
- * Performs deploy-time TEAL template placeholder substitutions (if specified).
557
- * @param params The parameters to create the app
558
- * @returns The app client and the result of the creation transaction
731
+ * Automatically populates appName, defaultSender and source maps from the factory
732
+ * if not specified in the params.
733
+ * @param params The parameters to create the app client
734
+ * @returns The `AppClient` instance
735
+ * @example
736
+ * ```typescript
737
+ * const appClient = factory.getAppClientById({ appId: 12345n })
738
+ * ```
559
739
  */
560
- create: (params: AppFactoryCreateMethodCallParams & SendParams) => Promise<{
561
- appClient: AppClient;
562
- result: {
563
- compiledApproval?: CompiledTeal | undefined;
564
- compiledClear?: CompiledTeal | undefined;
565
- groupId: string;
566
- txIds: string[];
567
- returns?: ABIReturn[] | undefined;
568
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
569
- transactions: algosdk.Transaction[];
570
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
571
- transaction: algosdk.Transaction;
572
- appId: bigint;
573
- appAddress: Address;
574
- return?: Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined;
575
- };
576
- }>;
577
- };
578
- /**
579
- * 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).
580
- *
581
- * **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`.
582
- *
583
- * **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.
584
- *
585
- * **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.
586
- * @param params The arguments to control the app deployment
587
- * @returns The app client and the result of the deployment
588
- * @example
589
- * ```ts
590
- * const { appClient, result } = await factory.deploy({
591
- * createParams: {
592
- * sender: 'SENDER_ADDRESS',
593
- * approvalProgram: 'APPROVAL PROGRAM',
594
- * clearStateProgram: 'CLEAR PROGRAM',
595
- * schema: {
596
- * globalByteSlices: 0,
597
- * globalInts: 0,
598
- * localByteSlices: 0,
599
- * localInts: 0
600
- * }
601
- * },
602
- * updateParams: {
603
- * sender: 'SENDER_ADDRESS'
604
- * },
605
- * deleteParams: {
606
- * sender: 'SENDER_ADDRESS'
607
- * },
608
- * metadata: { name: 'my_app', version: '2.0', updatable: false, deletable: false },
609
- * onSchemaBreak: 'append',
610
- * onUpdate: 'append'
611
- * })
612
- * ```
613
- */
614
- deploy(params: AppFactoryDeployParams): Promise<{
615
- appClient: AppClient;
616
- result: {
617
- return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
618
- deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
619
- compiledApproval?: CompiledTeal | undefined;
620
- compiledClear?: CompiledTeal | undefined;
621
- operationPerformed: "create";
622
- updatable?: boolean | undefined;
623
- deletable?: boolean | undefined;
624
- name: string;
625
- createdRound: bigint;
626
- updatedRound: bigint;
627
- createdMetadata: AppDeployMetadata;
628
- deleted: boolean;
629
- version: string;
630
- groupId: string;
631
- txIds: string[];
632
- returns?: ABIReturn[] | undefined;
633
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
634
- transactions: algosdk.Transaction[];
635
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
636
- transaction: algosdk.Transaction;
637
- appId: bigint;
638
- appAddress: Address;
639
- } | {
640
- return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
641
- deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
642
- compiledApproval?: CompiledTeal | undefined;
643
- compiledClear?: CompiledTeal | undefined;
644
- operationPerformed: "update";
645
- appId: bigint;
646
- appAddress: Address;
647
- createdRound: bigint;
648
- updatedRound: bigint;
649
- createdMetadata: AppDeployMetadata;
650
- deleted: boolean;
651
- name: string;
652
- version: string;
653
- deletable?: boolean | undefined;
654
- updatable?: boolean | undefined;
655
- groupId: string;
656
- txIds: string[];
657
- returns?: ABIReturn[] | undefined;
658
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
659
- transactions: algosdk.Transaction[];
660
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
661
- transaction: algosdk.Transaction;
662
- } | {
663
- return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
664
- deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
665
- compiledApproval?: CompiledTeal | undefined;
666
- compiledClear?: CompiledTeal | undefined;
667
- operationPerformed: "replace";
668
- updatable?: boolean | undefined;
669
- deletable?: boolean | undefined;
670
- name: string;
671
- createdRound: bigint;
672
- updatedRound: bigint;
673
- createdMetadata: AppDeployMetadata;
674
- deleted: boolean;
675
- version: string;
676
- groupId: string;
677
- txIds: string[];
678
- returns?: ABIReturn[] | undefined;
679
- confirmations: algosdk.modelsv2.PendingTransactionResponse[];
680
- transactions: algosdk.Transaction[];
681
- confirmation: algosdk.modelsv2.PendingTransactionResponse;
682
- transaction: algosdk.Transaction;
683
- appId: bigint;
684
- appAddress: Address;
685
- deleteResult: ConfirmedTransactionResult;
686
- } | {
687
- return: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
688
- deleteReturn: string | number | bigint | boolean | algosdk.Address | Uint8Array<ArrayBufferLike> | algosdk.ABIValue[] | ABIStruct | undefined;
689
- compiledApproval?: CompiledTeal | undefined;
690
- compiledClear?: CompiledTeal | undefined;
691
- operationPerformed: "nothing";
692
- appId: bigint;
693
- appAddress: Address;
694
- createdRound: bigint;
695
- updatedRound: bigint;
696
- createdMetadata: AppDeployMetadata;
697
- deleted: boolean;
698
- name: string;
699
- version: string;
700
- deletable?: boolean | undefined;
701
- updatable?: boolean | undefined;
702
- };
703
- }>;
704
- /**
705
- * Returns a new `AppClient` client for an app instance of the given ID.
706
- *
707
- * Automatically populates appName, defaultSender and source maps from the factory
708
- * if not specified in the params.
709
- * @param params The parameters to create the app client
710
- * @returns The `AppClient` instance
711
- * @example
712
- * ```typescript
713
- * const appClient = factory.getAppClientById({ appId: 12345n })
714
- * ```
715
- */
716
- getAppClientById(params: AppFactoryAppClientParams): AppClient;
717
- /**
718
- * Returns a new `AppClient` client, resolving the app by creator address and name
719
- * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
720
- *
721
- * Automatically populates appName, defaultSender and source maps from the factory
722
- * if not specified in the params.
723
- * @param params The parameters to create the app client
724
- * @returns The `AppClient` instance
725
- * @example
726
- * ```typescript
727
- * const appClient = factory.getAppClientByCreatorAndName({ creatorAddress: 'CREATOR_ADDRESS', appName: 'my_app' })
728
- * ```
729
- */
730
- getAppClientByCreatorAndName(params: AppFactoryResolveAppClientByCreatorAndNameParams): Promise<AppClient>;
731
- /**
732
- * Takes an error that may include a logic error from a call to the current app and re-exposes the
733
- * error to include source code information via the source map and ARC-56 spec.
734
- * @param e The error to parse
735
- * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)
736
- * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
737
- */
738
- exposeLogicError(e: Error, isClearStateProgram?: boolean): Error;
739
- /**
740
- * Export the current source maps for the app.
741
- * @returns The source maps
742
- */
743
- exportSourceMaps(): AppSourceMaps;
744
- /**
745
- * Import source maps for the app.
746
- * @param sourceMaps The source maps to import
747
- */
748
- importSourceMaps(sourceMaps: AppSourceMaps): void;
749
- private getDeployTimeControl;
750
- private getParamsMethods;
751
- /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
752
- private handleCallErrors;
753
- /**
754
- * Compiles the approval and clear state programs (if TEAL templates provided),
755
- * performing any provided deploy-time parameter replacement and stores
756
- * the source maps.
757
- *
758
- * If no TEAL templates provided it will use any byte code provided in the app spec.
759
- *
760
- * Will store any generated source maps for later use in debugging.
761
- * @param compilation Optional compilation parameters to use for the compilation
762
- * @returns The compilation result
763
- * @example
764
- * ```typescript
765
- * const result = await factory.compile()
766
- * ```
767
- */
768
- compile(compilation?: AppClientCompilationParams): Promise<AppClientCompilationResult>;
769
- private getBareParams;
770
- private getABIParams;
771
- private getCreateABIArgsWithDefaultValues;
772
- /** Returns the sender for a call, using the `defaultSender`
773
- * if none provided and throws an error if neither provided */
774
- private getSender;
775
- /** Returns the signer for a call, using the provided signer or the `defaultSigner`
776
- * if no signer was provided and the sender resolves to the default sender, the call will use default signer
777
- * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
778
- private getSigner;
779
- /**
780
- * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
781
- * on the ARC-56 method.
782
- *
783
- * If the return type is a struct then the struct will be returned.
784
- *
785
- * @param result The SendAppTransactionResult to be mapped
786
- * @param method The method that was called
787
- * @returns The smart contract response with an updated return value
788
- */
789
- parseMethodCallReturn<TReturn extends Uint8Array | ABIValue | ABIStruct | undefined, TResult extends SendAppTransactionResult = SendAppTransactionResult>(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>>;
740
+ getAppClientById(params: AppFactoryAppClientParams): AppClient;
741
+ /**
742
+ * Returns a new `AppClient` client, resolving the app by creator address and name
743
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
744
+ *
745
+ * Automatically populates appName, defaultSender and source maps from the factory
746
+ * if not specified in the params.
747
+ * @param params The parameters to create the app client
748
+ * @returns The `AppClient` instance
749
+ * @example
750
+ * ```typescript
751
+ * const appClient = factory.getAppClientByCreatorAndName({ creatorAddress: 'CREATOR_ADDRESS', appName: 'my_app' })
752
+ * ```
753
+ */
754
+ getAppClientByCreatorAndName(params: AppFactoryResolveAppClientByCreatorAndNameParams): Promise<AppClient>;
755
+ /**
756
+ * Takes an error that may include a logic error from a call to the current app and re-exposes the
757
+ * error to include source code information via the source map and ARC-56 spec.
758
+ * @param e The error to parse
759
+ * @param isClearStateProgram Whether or not the code was running the clear state program (defaults to approval program)
760
+ * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
761
+ */
762
+ exposeLogicError(e: Error, isClearStateProgram?: boolean): Error;
763
+ /**
764
+ * Export the current source maps for the app.
765
+ * @returns The source maps
766
+ */
767
+ exportSourceMaps(): AppSourceMaps;
768
+ /**
769
+ * Import source maps for the app.
770
+ * @param sourceMaps The source maps to import
771
+ */
772
+ importSourceMaps(sourceMaps: AppSourceMaps): void;
773
+ private getDeployTimeControl;
774
+ private getParamsMethods;
775
+ /** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
776
+ private handleCallErrors;
777
+ /**
778
+ * Compiles the approval and clear state programs (if TEAL templates provided),
779
+ * performing any provided deploy-time parameter replacement and stores
780
+ * the source maps.
781
+ *
782
+ * If no TEAL templates provided it will use any byte code provided in the app spec.
783
+ *
784
+ * Will store any generated source maps for later use in debugging.
785
+ * @param compilation Optional compilation parameters to use for the compilation
786
+ * @returns The compilation result
787
+ * @example
788
+ * ```typescript
789
+ * const result = await factory.compile()
790
+ * ```
791
+ */
792
+ compile(compilation?: AppClientCompilationParams): Promise<import("./app-client").AppClientCompilationResult>;
793
+ private getBareParams;
794
+ private getABIParams;
795
+ private getCreateABIArgsWithDefaultValues;
796
+ /** Returns the sender for a call, using the `defaultSender`
797
+ * if none provided and throws an error if neither provided */
798
+ private getSender;
799
+ /** Returns the signer for a call, using the provided signer or the `defaultSigner`
800
+ * if no signer was provided and the sender resolves to the default sender, the call will use default signer
801
+ * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
802
+ private getSigner;
803
+ /**
804
+ * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
805
+ * on the ARC-56 method.
806
+ *
807
+ * If the return type is a struct then the struct will be returned.
808
+ *
809
+ * @param result The SendAppTransactionResult to be mapped
810
+ * @param method The method that was called
811
+ * @returns The smart contract response with an updated return value
812
+ */
813
+ parseMethodCallReturn<TReturn extends Uint8Array | ABIValue | ABIStruct | undefined, TResult extends SendAppTransactionResult = SendAppTransactionResult>(result: Promise<TResult> | TResult, method: Arc56Method): Promise<Omit<TResult, 'return'> & AppReturn<TReturn>>;
790
814
  }
791
- //#endregion
792
- export { AppFactory, AppFactoryAppClientParams, AppFactoryCreateMethodCallParams, AppFactoryCreateParams, AppFactoryDeployParams, AppFactoryParams, AppFactoryResolveAppClientByCreatorAndNameParams, CreateOnComplete, CreateSchema };
793
- //# sourceMappingURL=app-factory.d.ts.map