@algorandfoundation/algokit-utils 1.0.0-beta.8 → 1.0.0

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 (141) hide show
  1. package/account.d.ts +91 -0
  2. package/account.d.ts.map +1 -0
  3. package/account.js +158 -0
  4. package/account.js.map +1 -0
  5. package/amount.d.ts +8 -0
  6. package/amount.d.ts.map +1 -0
  7. package/amount.js +24 -0
  8. package/amount.js.map +1 -0
  9. package/app.d.ts +108 -0
  10. package/app.d.ts.map +1 -0
  11. package/app.js +423 -0
  12. package/app.js.map +1 -0
  13. package/application-client.d.ts +10 -0
  14. package/application-client.d.ts.map +1 -0
  15. package/application-client.js +15 -0
  16. package/application-client.js.map +1 -0
  17. package/deploy-app.d.ts +93 -0
  18. package/deploy-app.d.ts.map +1 -0
  19. package/deploy-app.js +410 -0
  20. package/deploy-app.js.map +1 -0
  21. package/index.d.ts +14 -0
  22. package/index.d.ts.map +1 -0
  23. package/index.js +5 -2
  24. package/index.js.map +1 -0
  25. package/indexer-lookup.d.ts +31 -0
  26. package/indexer-lookup.d.ts.map +1 -0
  27. package/indexer-lookup.js +96 -0
  28. package/indexer-lookup.js.map +1 -0
  29. package/localnet.d.ts +54 -0
  30. package/localnet.d.ts.map +1 -0
  31. package/localnet.js +121 -0
  32. package/localnet.js.map +1 -0
  33. package/network-client.d.ts +93 -0
  34. package/network-client.d.ts.map +1 -0
  35. package/network-client.js +182 -0
  36. package/network-client.js.map +1 -0
  37. package/package.json +3 -3
  38. package/testing/account.d.ts +14 -0
  39. package/testing/account.d.ts.map +1 -0
  40. package/testing/account.js +31 -0
  41. package/testing/account.js.map +1 -0
  42. package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  43. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  44. package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
  45. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  46. package/testing/fixtures/algorand-fixture.d.ts +20 -0
  47. package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  48. package/testing/fixtures/algorand-fixture.js +49 -0
  49. package/testing/fixtures/algorand-fixture.js.map +1 -0
  50. package/testing/fixtures/index.d.ts +3 -0
  51. package/testing/fixtures/index.d.ts.map +1 -0
  52. package/testing/fixtures/index.js +19 -0
  53. package/testing/fixtures/index.js.map +1 -0
  54. package/testing/index.d.ts +6 -0
  55. package/testing/index.d.ts.map +1 -0
  56. package/testing/index.js +22 -0
  57. package/testing/index.js.map +1 -0
  58. package/testing/indexer.d.ts +12 -0
  59. package/testing/indexer.d.ts.map +1 -0
  60. package/testing/indexer.js +39 -0
  61. package/testing/indexer.js.map +1 -0
  62. package/testing/test-logger.d.ts +39 -0
  63. package/testing/test-logger.d.ts.map +1 -0
  64. package/testing/test-logger.js +69 -0
  65. package/testing/test-logger.js.map +1 -0
  66. package/testing/transaction-logger.d.ts +29 -0
  67. package/testing/transaction-logger.d.ts.map +1 -0
  68. package/testing/transaction-logger.js +71 -0
  69. package/testing/transaction-logger.js.map +1 -0
  70. package/transaction.d.ts +80 -0
  71. package/transaction.d.ts.map +1 -0
  72. package/transaction.js +256 -0
  73. package/transaction.js.map +1 -0
  74. package/transfer.d.ts +21 -0
  75. package/transfer.d.ts.map +1 -0
  76. package/transfer.js +65 -0
  77. package/transfer.js.map +1 -0
  78. package/types/account.d.ts +52 -0
  79. package/types/account.d.ts.map +1 -0
  80. package/types/account.js +86 -0
  81. package/types/account.js.map +1 -0
  82. package/types/algo-http-client-with-retry.d.ts +14 -0
  83. package/types/algo-http-client-with-retry.d.ts.map +1 -0
  84. package/types/algo-http-client-with-retry.js +62 -0
  85. package/types/algo-http-client-with-retry.js.map +1 -0
  86. package/types/algod.d.ts +137 -0
  87. package/types/algod.d.ts.map +1 -0
  88. package/types/algod.js +3 -0
  89. package/types/algod.js.map +1 -0
  90. package/types/amount.d.ts +20 -0
  91. package/types/amount.d.ts.map +1 -0
  92. package/types/amount.js +37 -0
  93. package/types/amount.js.map +1 -0
  94. package/types/app.d.ts +279 -0
  95. package/types/app.d.ts.map +1 -0
  96. package/types/app.js +32 -0
  97. package/types/app.js.map +1 -0
  98. package/types/application-client.d.ts +229 -0
  99. package/types/application-client.d.ts.map +1 -0
  100. package/types/application-client.js +470 -0
  101. package/types/application-client.js.map +1 -0
  102. package/types/appspec.d.ts +77 -0
  103. package/types/appspec.d.ts.map +1 -0
  104. package/types/appspec.js +15 -0
  105. package/types/appspec.js.map +1 -0
  106. package/types/config.d.ts +15 -0
  107. package/types/config.d.ts.map +1 -0
  108. package/types/config.js +27 -0
  109. package/types/config.js.map +1 -0
  110. package/types/indexer.d.ts +313 -0
  111. package/types/indexer.d.ts.map +1 -0
  112. package/types/indexer.js +25 -0
  113. package/types/indexer.js.map +1 -0
  114. package/types/logging.d.ts +13 -0
  115. package/types/logging.d.ts.map +1 -0
  116. package/types/logging.js +27 -0
  117. package/types/logging.js.map +1 -0
  118. package/types/logic-error.d.ts +33 -0
  119. package/types/logic-error.d.ts.map +1 -0
  120. package/types/logic-error.js +46 -0
  121. package/types/logic-error.js.map +1 -0
  122. package/types/network-client.d.ts +11 -0
  123. package/types/network-client.d.ts.map +1 -0
  124. package/types/network-client.js +3 -0
  125. package/types/network-client.js.map +1 -0
  126. package/types/testing.d.ts +89 -0
  127. package/types/testing.d.ts.map +1 -0
  128. package/types/testing.js +3 -0
  129. package/types/testing.js.map +1 -0
  130. package/types/transaction.d.ts +67 -0
  131. package/types/transaction.d.ts.map +1 -0
  132. package/types/transaction.js +3 -0
  133. package/types/transaction.js.map +1 -0
  134. package/types/transfer.d.ts +32 -0
  135. package/types/transfer.d.ts.map +1 -0
  136. package/types/transfer.js +3 -0
  137. package/types/transfer.js.map +1 -0
  138. package/types/urlTokenBaseHTTPClient.d.ts +41 -0
  139. package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  140. package/types/urlTokenBaseHTTPClient.js +151 -0
  141. package/types/urlTokenBaseHTTPClient.js.map +1 -0
@@ -0,0 +1,470 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ApplicationClient = void 0;
27
+ const algosdk_1 = __importStar(require("algosdk"));
28
+ const buffer_1 = require("buffer");
29
+ const app_1 = require("../app");
30
+ const deploy_app_1 = require("../deploy-app");
31
+ const transaction_1 = require("../transaction");
32
+ const transfer_1 = require("../transfer");
33
+ const app_2 = require("./app");
34
+ const appspec_1 = require("./appspec");
35
+ const logic_error_1 = require("./logic-error");
36
+ /** Application client - a class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app */
37
+ class ApplicationClient {
38
+ // todo: process ABI args as needed to make them nicer to deal with like beaker-ts
39
+ // todo: support importing and exporting a source map
40
+ // todo: support readonly, noop method calls
41
+ // todo: support different oncomplete for create
42
+ // todo: find create, update, delete, etc. methods from app spec and call them by default
43
+ // todo: intelligent version management when deploying
44
+ /**
45
+ * Create a new ApplicationClient instance
46
+ * @param appDetails The details of the app
47
+ * @param algod An algod instance
48
+ * @param indexer An indexer instance
49
+ */
50
+ constructor(appDetails, algod) {
51
+ const { app, sender, params, ...appIdentifier } = appDetails;
52
+ this.algod = algod;
53
+ this.appSpec = typeof app == 'string' ? JSON.parse(app) : app;
54
+ this._appName = appIdentifier.name ?? this.appSpec.contract.name;
55
+ if ('creatorAddress' in appIdentifier) {
56
+ this._appId = 0;
57
+ this._creator = appIdentifier.creatorAddress;
58
+ if ('indexer' in appIdentifier) {
59
+ this.indexer = appIdentifier.indexer;
60
+ }
61
+ else {
62
+ if (appIdentifier.existingDeployments.creator !== this._creator) {
63
+ throw new Error(`Attempt to create application client with invalid existingDeployments against a different creator (${appIdentifier.existingDeployments.creator}) instead of expected creator ${this._creator}`);
64
+ }
65
+ this.existingDeployments = appIdentifier.existingDeployments;
66
+ }
67
+ }
68
+ else {
69
+ if (appIdentifier.id < 0) {
70
+ throw new Error(`Attempt to create application client with invalid app id of ${appIdentifier.id}`);
71
+ }
72
+ this._appId = appIdentifier.id;
73
+ }
74
+ this._appAddress = algosdk_1.default.getApplicationAddress(this._appId);
75
+ this.sender = sender;
76
+ this.params = params;
77
+ }
78
+ /**
79
+ * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
80
+ *
81
+ * To understand the architecture decisions behind this functionality please @see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
82
+ *
83
+ * **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.
84
+ *
85
+ * **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.
86
+ * @param deploy Deployment details
87
+ * @returns The metadata and transaction result(s) of the deployment, or just the metadata if it didn't need to issue transactions
88
+ */
89
+ async deploy(deploy) {
90
+ const { sender, version, allowUpdate, allowDelete, sendParams, createArgs, updateArgs, deleteArgs, ...deployArgs } = deploy ?? {};
91
+ if (this._appId !== 0) {
92
+ throw new Error(`Attempt to deploy app which already has an app id of ${this._appId}`);
93
+ }
94
+ if (!sender && !this.sender) {
95
+ throw new Error('No sender provided, unable to deploy app');
96
+ }
97
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
98
+ const from = sender ?? this.sender;
99
+ if (!this._creator) {
100
+ throw new Error('Attempt to deploy a contract without having specified a creator');
101
+ }
102
+ if (this._creator !== (0, transaction_1.getSenderAddress)(from)) {
103
+ throw new Error(`Attempt to deploy contract with a sender address (${(0, transaction_1.getSenderAddress)(from)}) that differs from the given creator address for this application client: ${this._creator}`);
104
+ }
105
+ const approval = buffer_1.Buffer.from(this.appSpec.source.approval, 'base64').toString('utf-8');
106
+ const clear = buffer_1.Buffer.from(this.appSpec.source.clear, 'base64').toString('utf-8');
107
+ try {
108
+ await this.getAppReference();
109
+ const result = await (0, deploy_app_1.deployApp)({
110
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
111
+ from,
112
+ approvalProgram: approval,
113
+ clearStateProgram: clear,
114
+ metadata: {
115
+ name: this._appName,
116
+ version: version ?? '1.0',
117
+ updatable: allowUpdate ?? approval.includes(app_2.UPDATABLE_TEMPLATE_NAME)
118
+ ? (!this.appSpec.bare_call_config.update_application && this.appSpec.bare_call_config.update_application !== 'NEVER') ||
119
+ !!Object.keys(this.appSpec.hints).filter((h) => !this.appSpec.hints[h].call_config.update_application &&
120
+ this.appSpec.hints[h].call_config.update_application !== 'NEVER')[0]
121
+ : undefined,
122
+ deletable: allowDelete ?? approval.includes(app_2.DELETABLE_TEMPLATE_NAME)
123
+ ? (!this.appSpec.bare_call_config.delete_application && this.appSpec.bare_call_config.delete_application !== 'NEVER') ||
124
+ !!Object.keys(this.appSpec.hints).filter((h) => !this.appSpec.hints[h].call_config.delete_application &&
125
+ this.appSpec.hints[h].call_config.delete_application !== 'NEVER')[0]
126
+ : undefined,
127
+ },
128
+ schema: {
129
+ globalByteSlices: this.appSpec.state.global.num_byte_slices,
130
+ globalInts: this.appSpec.state.global.num_uints,
131
+ localByteSlices: this.appSpec.state.local.num_byte_slices,
132
+ localInts: this.appSpec.state.local.num_uints,
133
+ },
134
+ transactionParams: this.params,
135
+ ...(sendParams ?? {}),
136
+ existingDeployments: this.existingDeployments,
137
+ createArgs: this.getCallArgs(createArgs),
138
+ updateArgs: this.getCallArgs(updateArgs),
139
+ deleteArgs: this.getCallArgs(deleteArgs),
140
+ ...deployArgs,
141
+ }, this.algod, this.indexer);
142
+ this._approvalSourceMap = result.compiledApproval?.sourceMap;
143
+ this._clearSourceMap = result.compiledClear?.sourceMap;
144
+ // Nothing needed to happen
145
+ if (result.operationPerformed === 'nothing') {
146
+ return result;
147
+ }
148
+ if (!this.existingDeployments) {
149
+ throw new Error('Expected existingDeployments to be present');
150
+ }
151
+ const { transaction, confirmation, operationPerformed, ...appMetadata } = result;
152
+ this.existingDeployments = {
153
+ creator: this.existingDeployments.creator,
154
+ apps: { ...this.existingDeployments.apps, [this._appName]: appMetadata },
155
+ };
156
+ return result;
157
+ }
158
+ catch (e) {
159
+ throw this.exposeLogicError(e);
160
+ }
161
+ }
162
+ async create(create) {
163
+ const { sender, note, sendParams, deployTimeParams, updatable, deletable, ...args } = create ?? {};
164
+ if (this._appId !== 0) {
165
+ throw new Error(`Attempt to create app which already has an app id of ${this._appId}`);
166
+ }
167
+ if (!sender && !this.sender) {
168
+ throw new Error('No sender provided, unable to create app');
169
+ }
170
+ const approval = buffer_1.Buffer.from(this.appSpec.source.approval, 'base64').toString('utf-8');
171
+ const clear = buffer_1.Buffer.from(this.appSpec.source.clear, 'base64').toString('utf-8');
172
+ try {
173
+ const result = await (0, app_1.createApp)({
174
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
175
+ from: sender ?? this.sender,
176
+ approvalProgram: (0, deploy_app_1.replaceDeployTimeControlParams)((0, deploy_app_1.performTemplateSubstitution)(approval, deployTimeParams), {
177
+ updatable,
178
+ deletable,
179
+ }),
180
+ clearStateProgram: (0, deploy_app_1.performTemplateSubstitution)(clear, deployTimeParams),
181
+ schema: {
182
+ globalByteSlices: this.appSpec.state.global.num_byte_slices,
183
+ globalInts: this.appSpec.state.global.num_uints,
184
+ localByteSlices: this.appSpec.state.local.num_byte_slices,
185
+ localInts: this.appSpec.state.local.num_uints,
186
+ },
187
+ args: this.getCallArgs(args),
188
+ note: note,
189
+ transactionParams: this.params,
190
+ ...(sendParams ?? {}),
191
+ }, this.algod);
192
+ this._approvalSourceMap = result.compiledApproval?.sourceMap;
193
+ this._clearSourceMap = result.compiledClear?.sourceMap;
194
+ if (result.confirmation) {
195
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
196
+ this._appId = result.confirmation['application-index'];
197
+ this._appAddress = (0, algosdk_1.getApplicationAddress)(this._appId);
198
+ }
199
+ return result;
200
+ }
201
+ catch (e) {
202
+ throw this.exposeLogicError(e);
203
+ }
204
+ }
205
+ async update(update) {
206
+ const { sender, note, sendParams, deployTimeParams, updatable, deletable, ...args } = update ?? {};
207
+ if (this._appId === 0) {
208
+ throw new Error(`Attempt to update app which doesn't have an app id defined`);
209
+ }
210
+ if (!sender && !this.sender) {
211
+ throw new Error('No sender provided, unable to create app');
212
+ }
213
+ const approval = buffer_1.Buffer.from(this.appSpec.source.approval, 'base64').toString('utf-8');
214
+ const clear = buffer_1.Buffer.from(this.appSpec.source.clear, 'base64').toString('utf-8');
215
+ try {
216
+ const result = await (0, app_1.updateApp)({
217
+ appId: this._appId,
218
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
219
+ from: sender ?? this.sender,
220
+ approvalProgram: (0, deploy_app_1.replaceDeployTimeControlParams)((0, deploy_app_1.performTemplateSubstitution)(approval, deployTimeParams), {
221
+ updatable,
222
+ deletable,
223
+ }),
224
+ clearStateProgram: (0, deploy_app_1.performTemplateSubstitution)(clear, deployTimeParams),
225
+ args: this.getCallArgs(args),
226
+ note: note,
227
+ transactionParams: this.params,
228
+ ...(sendParams ?? {}),
229
+ }, this.algod);
230
+ this._approvalSourceMap = result.compiledApproval?.sourceMap;
231
+ this._clearSourceMap = result.compiledClear?.sourceMap;
232
+ return result;
233
+ }
234
+ catch (e) {
235
+ throw this.exposeLogicError(e);
236
+ }
237
+ }
238
+ async call(call) {
239
+ return await this._call(call, 'normal');
240
+ }
241
+ async optIn(call) {
242
+ return await this._call(call, 'optin');
243
+ }
244
+ async closeOut(call) {
245
+ return await this._call(call, 'optin');
246
+ }
247
+ async clearState(call) {
248
+ return await this._call(call, 'optin');
249
+ }
250
+ async delete(call) {
251
+ return await this._call(call, 'optin');
252
+ }
253
+ async _call(call, callType) {
254
+ const { sender, note, sendParams, ...args } = call;
255
+ if (!sender && !this.sender) {
256
+ throw new Error('No sender provided, unable to call app');
257
+ }
258
+ const appMetadata = await this.getAppReference();
259
+ if (appMetadata.appId === 0) {
260
+ throw new Error(`Attempt to call an app that can't be found '${this._appName}' for creator '${this._creator}'.`);
261
+ }
262
+ try {
263
+ return await (0, app_1.callApp)({
264
+ appId: appMetadata.appId,
265
+ callType: callType,
266
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
267
+ from: sender ?? this.sender,
268
+ args: this.getCallArgs(args),
269
+ note: note,
270
+ transactionParams: this.params,
271
+ ...(sendParams ?? {}),
272
+ }, this.algod);
273
+ }
274
+ catch (e) {
275
+ throw this.exposeLogicError(e);
276
+ }
277
+ }
278
+ /**
279
+ * Funds ALGOs into the app account for this app.
280
+ * @param fund The parameters for the funding or the funding amount
281
+ * @returns The result of the funding
282
+ */
283
+ async fundAppAccount(fund) {
284
+ const { amount, sender, note, sendParams } = 'microAlgos' in fund ? { amount: fund } : fund;
285
+ if (!sender && !this.sender) {
286
+ throw new Error('No sender provided, unable to call app');
287
+ }
288
+ const ref = await this.getAppReference();
289
+ return await (0, transfer_1.transferAlgos)({
290
+ to: ref.appAddress,
291
+ amount: amount,
292
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
293
+ from: this.sender ?? sender,
294
+ note: note,
295
+ transactionParams: this.params,
296
+ ...(sendParams ?? {}),
297
+ }, this.algod);
298
+ }
299
+ /**
300
+ * Returns global state for the current app.
301
+ * @returns The global state
302
+ */
303
+ async getGlobalState() {
304
+ const appRef = await this.getAppReference();
305
+ if (appRef.appId === 0) {
306
+ throw new Error('No app has been created yet, unable to get global state');
307
+ }
308
+ return (0, app_1.getAppGlobalState)(appRef.appId, this.algod);
309
+ }
310
+ /**
311
+ * Returns local state for the given account / account address.
312
+ * @returns The global state
313
+ */
314
+ async getLocalState(account) {
315
+ const appRef = await this.getAppReference();
316
+ if (appRef.appId === 0) {
317
+ throw new Error('No app has been created yet, unable to get global state');
318
+ }
319
+ return (0, app_1.getAppLocalState)(appRef.appId, account, this.algod);
320
+ }
321
+ /**
322
+ * Returns the names of all current boxes for the current app.
323
+ * @returns The names of the boxes
324
+ */
325
+ async getBoxNames() {
326
+ const appRef = await this.getAppReference();
327
+ if (appRef.appId === 0) {
328
+ throw new Error('No app has been created yet, unable to get global state');
329
+ }
330
+ return await (0, app_1.getAppBoxNames)(appRef.appId, this.algod);
331
+ }
332
+ /**
333
+ * Returns the values of all current boxes for the current app.
334
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
335
+ * @param filter Optional filter to filter which boxes' values are returned
336
+ * @returns The (name, value) pair of the boxes with values as raw byte arrays
337
+ */
338
+ async getBoxValues(filter) {
339
+ const appRef = await this.getAppReference();
340
+ if (appRef.appId === 0) {
341
+ throw new Error('No app has been created yet, unable to get global state');
342
+ }
343
+ const names = await this.getBoxNames();
344
+ return await Promise.all(names
345
+ .filter(filter ?? ((_) => true))
346
+ .map(async (boxName) => ({ name: boxName, value: await (0, app_1.getAppBoxValue)(appRef.appId, boxName, this.algod) })));
347
+ }
348
+ /**
349
+ * Returns the values of all current boxes for the current app decoded using an ABI Type.
350
+ * Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
351
+ * @param type The ABI type to decode the values with
352
+ * @param filter Optional filter to filter which boxes' values are returned
353
+ * @returns The (name, value) pair of the boxes with values as the ABI Value
354
+ */
355
+ async getBoxValuesAsABIType(type, filter) {
356
+ const appRef = await this.getAppReference();
357
+ if (appRef.appId === 0) {
358
+ throw new Error('No app has been created yet, unable to get global state');
359
+ }
360
+ const names = await this.getBoxNames();
361
+ return await Promise.all(names.filter(filter ?? ((_) => true)).map(async (boxName) => ({
362
+ name: boxName,
363
+ value: await (0, app_1.getAppBoxValueFromABIType)({ appId: appRef.appId, boxName, type }, this.algod),
364
+ })));
365
+ }
366
+ /**
367
+ * Returns the arguments for an app call for the given ABI method or raw method specification.
368
+ * @param args The call args specific to this application client
369
+ * @returns The call args ready to pass into an app call
370
+ */
371
+ getCallArgs(args) {
372
+ if (!args) {
373
+ return undefined;
374
+ }
375
+ if ('method' in args) {
376
+ const abiMethod = this.getABIMethodParams(args.method);
377
+ if (!abiMethod) {
378
+ throw new Error(`Attempt to call ABI method ${args.method}, but it wasn't found`);
379
+ }
380
+ if (Array.isArray(args.methodArgs)) {
381
+ return {
382
+ method: abiMethod,
383
+ args: args.methodArgs,
384
+ };
385
+ }
386
+ else {
387
+ return {
388
+ method: abiMethod,
389
+ ...args.methodArgs,
390
+ };
391
+ }
392
+ }
393
+ else {
394
+ return args.args;
395
+ }
396
+ }
397
+ /**
398
+ * Returns the ABI Method parameters for the given method name string for the app represented by this application client instance
399
+ * @param method Either the name of the method or the ABI method spec definition string
400
+ * @returns The ABI method params for the given method
401
+ */
402
+ getABIMethodParams(method) {
403
+ if (!method.includes('(')) {
404
+ const methods = this.appSpec.contract.methods.filter((m) => m.name === method);
405
+ if (methods.length > 1) {
406
+ throw new Error(`Received a call to method ${method} in contract ${this._appName}, but this resolved to multiple methods; please pass in an ABI signature instead: ${methods.map(appspec_1.getABISignature).join(', ')}`);
407
+ }
408
+ return methods[0];
409
+ }
410
+ return this.appSpec.contract.methods.find((m) => (0, appspec_1.getABISignature)(m) === method);
411
+ }
412
+ /**
413
+ * Returns the ABI Method for the given method name string for the app represented by this application client instance
414
+ * @param method Either the name of the method or the ABI method spec definition string
415
+ * @returns The ABI method for the given method
416
+ */
417
+ getABIMethod(method) {
418
+ const methodParams = this.getABIMethodParams(method);
419
+ return methodParams ? new algosdk_1.ABIMethod(methodParams) : undefined;
420
+ }
421
+ /**
422
+ * Gets the reference information for the current application instance.
423
+ * `appId` will be 0 if it can't find an app.
424
+ * @returns The app reference, or if deployed using the `deploy` method, the app metadata too
425
+ */
426
+ async getAppReference() {
427
+ if (!this.existingDeployments && this._creator) {
428
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
429
+ this.existingDeployments = await (0, deploy_app_1.getCreatorAppsByName)(this._creator, this.indexer);
430
+ }
431
+ if (this.existingDeployments && this._appId === 0) {
432
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
433
+ const app = this.existingDeployments.apps[this._appName];
434
+ if (!app) {
435
+ return {
436
+ appId: 0,
437
+ appAddress: (0, algosdk_1.getApplicationAddress)(0),
438
+ };
439
+ }
440
+ return app;
441
+ }
442
+ return {
443
+ appId: this._appId,
444
+ appAddress: this._appAddress,
445
+ };
446
+ }
447
+ /**
448
+ * Takes an error that may include a logic error from a smart contract call and re-exposes the error to include source code information via the source map.
449
+ * This is automatically used within @see ApplicationClient but if you pass `skipSending: true` e.g. if doing a group transaction
450
+ * then you can use this in a try/catch block to get better debugging information.
451
+ * @param e The error to parse
452
+ * @param isClear Whether or not the code was running the clear state program
453
+ * @returns The new error, or if there was no logic error or source map then the wrapped error with source details
454
+ */
455
+ exposeLogicError(e, isClear) {
456
+ if ((!isClear && this._approvalSourceMap == undefined) || (isClear && this._clearSourceMap == undefined))
457
+ return e;
458
+ const errorDetails = logic_error_1.LogicError.parseLogicError(e.message);
459
+ if (errorDetails !== undefined)
460
+ return new logic_error_1.LogicError(errorDetails, buffer_1.Buffer.from(isClear ? this.appSpec.source.clear : this.appSpec.source.approval, 'base64')
461
+ .toString()
462
+ .split('\n'),
463
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
464
+ isClear ? this._clearSourceMap : this._approvalSourceMap);
465
+ else
466
+ return e;
467
+ }
468
+ }
469
+ exports.ApplicationClient = ApplicationClient;
470
+ //# sourceMappingURL=application-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-client.js","sourceRoot":"","sources":["../../src/types/application-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAUgB;AAChB,mCAA+B;AAC/B,gCASe;AACf,8CAA4H;AAC5H,gDAAiD;AACjD,0CAA2C;AAE3C,+BAec;AACd,uCAAoD;AACpD,+CAA0C;AAsH1C,qIAAqI;AACrI,MAAa,iBAAiB;IAgB5B,kFAAkF;IAClF,qDAAqD;IACrD,4CAA4C;IAC5C,gDAAgD;IAChD,yFAAyF;IACzF,sDAAsD;IAEtD;;;;;OAKG;IACH,YAAY,UAA6B,EAAE,KAAc;QACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,GAAG,UAAU,CAAA;QAC5D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAa,CAAC,CAAC,CAAC,GAAG,CAAA;QAC1E,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA;QAEhE,IAAI,gBAAgB,IAAI,aAAa,EAAE;YACrC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;YACf,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,cAAc,CAAA;YAC5C,IAAI,SAAS,IAAI,aAAa,EAAE;gBAC9B,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAA;aACrC;iBAAM;gBACL,IAAI,aAAa,CA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BACR,OAAO;oBACL,KAAK,EAAE,CAAC;oBACR,UAAU,EAAE,IAAA,+BAAqB,EAAC,CAAC,CAAC;iBACrC,CAAA;aACF;YACD,OAAO,GAAG,CAAA;SACX;QAED,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,UAAU,EAAE,IAAI,CAAC,WAAW;SACb,CAAA;IACnB,CAAC;IAED;;;;;;;OAOG;IACH,gBAAgB,CAAC,CAAQ,EAAE,OAAiB;QAC1C,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,IAAI,SAAS,CAAC;YAAE,OAAO,CAAC,CAAA;QAElH,MAAM,YAAY,GAAG,wBAAU,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QAE1D,IAAI,YAAY,KAAK,SAAS;YAC5B,OAAO,IAAI,wBAAU,CACnB,YAAY,EACZ,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC;iBACtF,QAAQ,EAAE;iBACV,KAAK,CAAC,IAAI,CAAC;YACd,oEAAoE;YACpE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,eAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAmB,CAC3D,CAAA;;YACE,OAAO,CAAC,CAAA;IACf,CAAC;CACF;AA9hBD,8CA8hBC"}
@@ -0,0 +1,77 @@
1
+ import { ABIContractParams, ABIMethod, ABIMethodParams } from 'algosdk';
2
+ export interface AppSpec {
3
+ hints: HintSpec;
4
+ schema: SchemaSpec;
5
+ source: AppSources;
6
+ contract: ABIContractParams;
7
+ state: StateSchemaSpec;
8
+ bare_call_config: {
9
+ no_op?: CallConfigValue;
10
+ opt_in?: CallConfigValue;
11
+ close_out?: CallConfigValue;
12
+ clear_state?: CallConfigValue;
13
+ update_application?: CallConfigValue;
14
+ delete_application?: CallConfigValue;
15
+ };
16
+ }
17
+ export type HintSpec = Record<string, Hint>;
18
+ export interface AppSources {
19
+ approval: string;
20
+ clear: string;
21
+ }
22
+ export type CallConfigValue = 'NEVER' | 'CALL' | 'CREATE' | 'ALL';
23
+ export interface Hint {
24
+ structs: Record<string, Struct>;
25
+ readonly: boolean;
26
+ default_arguments: Record<string, DefaultArgument>;
27
+ call_config: {
28
+ no_op?: CallConfigValue;
29
+ opt_in?: CallConfigValue;
30
+ close_out?: CallConfigValue;
31
+ clear_state?: CallConfigValue;
32
+ update_application?: CallConfigValue;
33
+ delete_application?: CallConfigValue;
34
+ };
35
+ }
36
+ export type StructElement = [string, string];
37
+ export interface Struct {
38
+ name: string;
39
+ elements: StructElement[];
40
+ }
41
+ export interface DefaultArgument {
42
+ source: string;
43
+ data: string | bigint | number;
44
+ }
45
+ export declare enum AVMType {
46
+ uint64 = 0,
47
+ bytes = 1
48
+ }
49
+ export interface DeclaredSchemaValueSpec {
50
+ type: AVMType;
51
+ key: string;
52
+ desc: string;
53
+ static: boolean;
54
+ }
55
+ export interface ReservedSchemaValueSpec {
56
+ type: AVMType;
57
+ desc: string;
58
+ max_keys: number;
59
+ }
60
+ export interface SchemaSpec {
61
+ local: Schema;
62
+ global: Schema;
63
+ }
64
+ export interface Schema {
65
+ declared: Record<string, DeclaredSchemaValueSpec>;
66
+ reserved: Record<string, ReservedSchemaValueSpec>;
67
+ }
68
+ export interface StateSchemaSpec {
69
+ global: StateSchema;
70
+ local: StateSchema;
71
+ }
72
+ export type StateSchema = {
73
+ num_uints: number;
74
+ num_byte_slices: number;
75
+ };
76
+ export declare const getABISignature: (method: ABIMethodParams | ABIMethod) => string;
77
+ //# sourceMappingURL=appspec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appspec.d.ts","sourceRoot":"","sources":["../../src/types/appspec.ts"],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GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE5C,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAC/B;AAED,oBAAY,OAAO;IACjB,MAAM,IAAA;IACN,KAAK,IAAA;CACN;AACD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IACjD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,eAAe,GAAG,SAAS,WAIlE,CAAA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getABISignature = exports.AVMType = void 0;
4
+ var AVMType;
5
+ (function (AVMType) {
6
+ AVMType[AVMType["uint64"] = 0] = "uint64";
7
+ AVMType[AVMType["bytes"] = 1] = "bytes";
8
+ })(AVMType = exports.AVMType || (exports.AVMType = {}));
9
+ const getABISignature = (method) => {
10
+ const argSignature = method.args.map((a) => a.type).join(',');
11
+ const returnSignature = method.returns.type;
12
+ return `{${method.name}}(${argSignature})${returnSignature}`;
13
+ };
14
+ exports.getABISignature = getABISignature;
15
+ //# sourceMappingURL=appspec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appspec.js","sourceRoot":"","sources":["../../src/types/appspec.ts"],"names":[],"mappings":";;;AAqDA,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,yCAAM,CAAA;IACN,uCAAK,CAAA;AACP,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AAkCM,MAAM,eAAe,GAAG,CAAC,MAAmC,EAAE,EAAE;IACrE,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC7D,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAA;IAC3C,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,eAAe,EAAE,CAAA;AAC9D,CAAC,CAAA;AAJY,QAAA,eAAe,mBAI3B"}
@@ -0,0 +1,15 @@
1
+ import { Logger } from './logging';
2
+ /** The AlgoKit configuration type */
3
+ export interface Config {
4
+ logger: Logger;
5
+ }
6
+ /** Updatable AlgoKit config */
7
+ export declare class UpdatableConfig implements Readonly<Config> {
8
+ private config;
9
+ get logger(): Logger;
10
+ getLogger(returnNullLogger?: boolean): Logger;
11
+ constructor();
12
+ /** Update the AlgoKit configuration with your own configuration settings */
13
+ configure(newConfig: Config): void;
14
+ }
15
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAc,MAAM,WAAW,CAAA;AAE7D,qCAAqC;AACrC,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,+BAA+B;AAC/B,qBAAa,eAAgB,YAAW,QAAQ,CAAC,MAAM,CAAC;IACtD,OAAO,CAAC,MAAM,CAAQ;IAEtB,IAAI,MAAM,WAET;IAED,SAAS,CAAC,gBAAgB,CAAC,EAAE,OAAO;;IAcpC,4EAA4E;IAC5E,SAAS,CAAC,SAAS,EAAE,MAAM;CAG5B"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdatableConfig = void 0;
4
+ const logging_1 = require("./logging");
5
+ /** Updatable AlgoKit config */
6
+ class UpdatableConfig {
7
+ get logger() {
8
+ return this.config.logger;
9
+ }
10
+ getLogger(returnNullLogger) {
11
+ if (returnNullLogger) {
12
+ return logging_1.nullLogger;
13
+ }
14
+ return this.logger;
15
+ }
16
+ constructor() {
17
+ this.config = {
18
+ logger: logging_1.consoleLogger,
19
+ };
20
+ }
21
+ /** Update the AlgoKit configuration with your own configuration settings */
22
+ configure(newConfig) {
23
+ this.config = newConfig;
24
+ }
25
+ }
26
+ exports.UpdatableConfig = UpdatableConfig;
27
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";;;AAAA,uCAA6D;AAO7D,+BAA+B;AAC/B,MAAa,eAAe;IAG1B,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,SAAS,CAAC,gBAA0B;QAClC,IAAI,gBAAgB,EAAE;YACpB,OAAO,oBAAU,CAAA;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED;QACE,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,uBAAa;SACtB,CAAA;IACH,CAAC;IAED,4EAA4E;IAC5E,SAAS,CAAC,SAAiB;QACzB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;IACzB,CAAC;CACF;AAzBD,0CAyBC"}