@algorandfoundation/algokit-utils 7.0.0-beta.1 → 7.0.0-beta.2

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 (132) hide show
  1. package/account/account.d.ts +7 -7
  2. package/account/account.js +7 -7
  3. package/account/account.mjs +7 -7
  4. package/account/get-account.d.ts +2 -2
  5. package/account/get-account.js +1 -1
  6. package/account/get-account.mjs +1 -1
  7. package/account/get-dispenser-account.d.ts +1 -1
  8. package/account/get-dispenser-account.js +1 -1
  9. package/account/get-dispenser-account.mjs +1 -1
  10. package/account/mnemonic-account.d.ts +1 -1
  11. package/account/mnemonic-account.js +1 -1
  12. package/account/mnemonic-account.mjs +1 -1
  13. package/app-deploy.d.ts +18 -1
  14. package/app-deploy.d.ts.map +1 -1
  15. package/app-deploy.js +142 -333
  16. package/app-deploy.js.map +1 -1
  17. package/app-deploy.mjs +145 -336
  18. package/app-deploy.mjs.map +1 -1
  19. package/app.d.ts +38 -1
  20. package/app.d.ts.map +1 -1
  21. package/app.js +113 -370
  22. package/app.js.map +1 -1
  23. package/app.mjs +114 -371
  24. package/app.mjs.map +1 -1
  25. package/asset.d.ts +5 -5
  26. package/asset.js +5 -5
  27. package/asset.mjs +5 -5
  28. package/debugging/debugging.js +2 -2
  29. package/debugging/debugging.js.map +1 -1
  30. package/debugging/debugging.mjs +2 -2
  31. package/debugging/debugging.mjs.map +1 -1
  32. package/index.d.ts +1 -1
  33. package/index.d.ts.map +1 -1
  34. package/index.js +12 -12
  35. package/index.mjs +1 -1
  36. package/localnet/get-kmd-wallet-account.d.ts +1 -1
  37. package/localnet/get-kmd-wallet-account.js +1 -1
  38. package/localnet/get-kmd-wallet-account.mjs +1 -1
  39. package/localnet/get-localnet-dispenser-account.d.ts +1 -1
  40. package/localnet/get-localnet-dispenser-account.js +1 -1
  41. package/localnet/get-localnet-dispenser-account.mjs +1 -1
  42. package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -1
  43. package/localnet/get-or-create-kmd-wallet-account.js +1 -1
  44. package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
  45. package/localnet/is-localnet.d.ts +1 -1
  46. package/localnet/is-localnet.js +1 -1
  47. package/localnet/is-localnet.mjs +1 -1
  48. package/network-client.d.ts +2 -2
  49. package/network-client.d.ts.map +1 -1
  50. package/network-client.js +2 -2
  51. package/network-client.mjs +2 -2
  52. package/package.json +1 -1
  53. package/testing/fixtures/algorand-fixture.js +12 -12
  54. package/testing/fixtures/algorand-fixture.js.map +1 -1
  55. package/testing/fixtures/algorand-fixture.mjs +12 -12
  56. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  57. package/transaction/legacy-bridge.d.ts +31 -5
  58. package/transaction/legacy-bridge.d.ts.map +1 -1
  59. package/transaction/legacy-bridge.js +99 -5
  60. package/transaction/legacy-bridge.js.map +1 -1
  61. package/transaction/legacy-bridge.mjs +98 -7
  62. package/transaction/legacy-bridge.mjs.map +1 -1
  63. package/transfer/transfer-algos.d.ts +1 -1
  64. package/transfer/transfer-algos.js +1 -1
  65. package/transfer/transfer-algos.mjs +1 -1
  66. package/transfer/transfer.d.ts +1 -1
  67. package/transfer/transfer.js +1 -1
  68. package/transfer/transfer.mjs +1 -1
  69. package/types/account-manager.d.ts +1 -1
  70. package/types/account-manager.d.ts.map +1 -1
  71. package/types/algorand-client-transaction-creator.d.ts +450 -20
  72. package/types/algorand-client-transaction-creator.d.ts.map +1 -1
  73. package/types/algorand-client-transaction-creator.js +406 -22
  74. package/types/algorand-client-transaction-creator.js.map +1 -1
  75. package/types/algorand-client-transaction-creator.mjs +406 -22
  76. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  77. package/types/algorand-client-transaction-sender.d.ts +750 -24
  78. package/types/algorand-client-transaction-sender.d.ts.map +1 -1
  79. package/types/algorand-client-transaction-sender.js +426 -12
  80. package/types/algorand-client-transaction-sender.js.map +1 -1
  81. package/types/algorand-client-transaction-sender.mjs +426 -12
  82. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  83. package/types/algorand-client.d.ts +8 -0
  84. package/types/algorand-client.d.ts.map +1 -1
  85. package/types/algorand-client.js +14 -1
  86. package/types/algorand-client.js.map +1 -1
  87. package/types/algorand-client.mjs +14 -1
  88. package/types/algorand-client.mjs.map +1 -1
  89. package/types/app-client.d.ts +13 -1
  90. package/types/app-client.d.ts.map +1 -1
  91. package/types/app-client.js +8 -5
  92. package/types/app-client.js.map +1 -1
  93. package/types/app-client.mjs +9 -6
  94. package/types/app-client.mjs.map +1 -1
  95. package/types/app-deployer.d.ts +121 -0
  96. package/types/app-deployer.d.ts.map +1 -0
  97. package/types/app-deployer.js +354 -0
  98. package/types/app-deployer.js.map +1 -0
  99. package/types/app-deployer.mjs +352 -0
  100. package/types/app-deployer.mjs.map +1 -0
  101. package/types/app-manager.d.ts +235 -0
  102. package/types/app-manager.d.ts.map +1 -0
  103. package/types/app-manager.js +336 -0
  104. package/types/app-manager.js.map +1 -0
  105. package/types/app-manager.mjs +334 -0
  106. package/types/app-manager.mjs.map +1 -0
  107. package/types/app.d.ts +42 -7
  108. package/types/app.d.ts.map +1 -1
  109. package/types/app.js +1 -1
  110. package/types/app.js.map +1 -1
  111. package/types/app.mjs +1 -1
  112. package/types/app.mjs.map +1 -1
  113. package/types/client-manager.d.ts +2 -0
  114. package/types/client-manager.d.ts.map +1 -1
  115. package/types/client-manager.js +4 -0
  116. package/types/client-manager.js.map +1 -1
  117. package/types/client-manager.mjs +4 -0
  118. package/types/client-manager.mjs.map +1 -1
  119. package/types/composer.d.ts +150 -39
  120. package/types/composer.d.ts.map +1 -1
  121. package/types/composer.js +218 -62
  122. package/types/composer.js.map +1 -1
  123. package/types/composer.mjs +218 -62
  124. package/types/composer.mjs.map +1 -1
  125. package/types/expand.d.ts +8 -0
  126. package/types/expand.d.ts.map +1 -0
  127. package/types/expand.js +3 -0
  128. package/types/expand.js.map +1 -0
  129. package/types/expand.mjs +2 -0
  130. package/types/expand.mjs.map +1 -0
  131. package/types/transaction.d.ts +3 -0
  132. package/types/transaction.d.ts.map +1 -1
@@ -0,0 +1,352 @@
1
+ import algosdk from 'algosdk';
2
+ import { Config } from '../config.mjs';
3
+ import { lookupAccountCreatedApplicationByAddress, searchTransactions } from '../indexer-lookup.mjs';
4
+ import { APP_DEPLOY_NOTE_DAPP, OnSchemaBreak, OnUpdate } from './app.mjs';
5
+ import AlgoKitComposer from './composer.mjs';
6
+
7
+ /** Allows management of deployment and deployment metadata of applications. */
8
+ class AppDeployer {
9
+ /**
10
+ * Creates an `AppManager`
11
+ * @param appManager An `AppManager` instance
12
+ * @param transactionSender An `AlgorandClientTransactionSender` instance
13
+ * @param indexer An optional indexer instance; supply if you want to indexer to look up app metadata
14
+ */
15
+ constructor(appManager, transactionSender, indexer) {
16
+ this._appLookups = new Map();
17
+ this._appManager = appManager;
18
+ this._transactionSender = transactionSender;
19
+ this._indexer = indexer;
20
+ }
21
+ /**
22
+ * 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).
23
+ *
24
+ * 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
25
+ *
26
+ * **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`.
27
+ *
28
+ * **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.
29
+ *
30
+ * **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.
31
+ * @param deployment The arguments to control the app deployment
32
+ * @returns The app reference of the new/existing app
33
+ */
34
+ async deploy(deployment) {
35
+ const { metadata, deployTimeParams, onSchemaBreak, onUpdate, createParams, updateParams, deleteParams, executeParams, existingDeployments, ignoreCache, } = deployment;
36
+ // Set creation note
37
+ createParams.note = updateParams.note = AlgoKitComposer.arc2Note({
38
+ dAppName: APP_DEPLOY_NOTE_DAPP,
39
+ data: metadata,
40
+ format: 'j',
41
+ });
42
+ // Check for required fields
43
+ if (existingDeployments && existingDeployments.creator !== createParams.sender) {
44
+ throw new Error(`Received invalid existingDeployments value for creator ${existingDeployments.creator} when attempting to deploy for creator ${createParams.sender}`);
45
+ }
46
+ if (!existingDeployments && !this._indexer) {
47
+ throw new Error(`Didn't receive an indexer client when this AppManager was created, but also didn't receive an existingDeployments cache - one of them must be provided`);
48
+ }
49
+ Config.getLogger(executeParams?.suppressLog).info(`Idempotently deploying app "${metadata.name}" from creator ${createParams.sender} using ${createParams.approvalProgram.length} bytes of ${typeof createParams.approvalProgram === 'string' ? 'teal code' : 'AVM bytecode'} and ${createParams.clearStateProgram.length} bytes of ${typeof createParams.approvalProgram === 'string' ? 'teal code' : 'AVM bytecode'}`);
50
+ // Compile code if required
51
+ const compiledApproval = typeof createParams.approvalProgram === 'string'
52
+ ? await this._appManager.compileTealTemplate(createParams.approvalProgram, deployTimeParams, metadata)
53
+ : undefined;
54
+ const approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : createParams.approvalProgram;
55
+ const compiledClear = typeof createParams.clearStateProgram === 'string'
56
+ ? await this._appManager.compileTealTemplate(createParams.clearStateProgram, deployTimeParams)
57
+ : undefined;
58
+ const clearStateProgram = compiledClear ? compiledClear.compiledBase64ToBytes : createParams.clearStateProgram;
59
+ // Define routines for create, update, and replace
60
+ const createApp = async () => {
61
+ const result = await ('method' in createParams
62
+ ? this._transactionSender.appCreateMethodCall({ ...createParams, approvalProgram, clearStateProgram, ...executeParams })
63
+ : this._transactionSender.appCreate({ ...createParams, approvalProgram, clearStateProgram, ...executeParams }));
64
+ const appMetadata = {
65
+ appId: result.appId,
66
+ appAddress: result.appAddress,
67
+ ...metadata,
68
+ createdMetadata: metadata,
69
+ createdRound: BigInt(result.confirmation.confirmedRound),
70
+ updatedRound: BigInt(result.confirmation.confirmedRound),
71
+ deleted: false,
72
+ };
73
+ this.updateAppLookup(createParams.sender, appMetadata);
74
+ return {
75
+ operationPerformed: 'create',
76
+ compiledApproval,
77
+ compiledClear,
78
+ ...result,
79
+ ...appMetadata,
80
+ };
81
+ };
82
+ const updateApp = async (existingApp) => {
83
+ Config.getLogger(executeParams?.suppressLog).info(`Updating existing ${metadata.name} app for ${createParams.sender} to version ${metadata.version}.`);
84
+ const result = await ('method' in updateParams
85
+ ? this._transactionSender.appUpdateMethodCall({
86
+ appId: existingApp.appId,
87
+ approvalProgram,
88
+ clearStateProgram,
89
+ ...updateParams,
90
+ ...executeParams,
91
+ })
92
+ : this._transactionSender.appUpdate({
93
+ appId: existingApp.appId,
94
+ approvalProgram,
95
+ clearStateProgram,
96
+ ...updateParams,
97
+ ...executeParams,
98
+ }));
99
+ const appMetadata = {
100
+ appId: existingApp.appId,
101
+ appAddress: existingApp.appAddress,
102
+ createdMetadata: existingApp.createdMetadata,
103
+ createdRound: existingApp.createdRound,
104
+ updatedRound: BigInt(result.confirmation.confirmedRound),
105
+ ...metadata,
106
+ deleted: false,
107
+ };
108
+ this.updateAppLookup(createParams.sender, appMetadata);
109
+ return {
110
+ operationPerformed: 'update',
111
+ compiledApproval,
112
+ compiledClear,
113
+ ...result,
114
+ ...appMetadata,
115
+ };
116
+ };
117
+ const replaceApp = async (existingApp) => {
118
+ Config.getLogger(executeParams?.suppressLog).info(`Deploying a new ${metadata.name} app for ${createParams.sender}; deploying app with version ${metadata.version}.`);
119
+ Config.getLogger(executeParams?.suppressLog).warn(`Deleting existing ${metadata.name} app with id ${existingApp.appId} from ${deleteParams.sender} account.`);
120
+ const composer = this._transactionSender.newGroup();
121
+ if ('method' in createParams) {
122
+ composer.addAppCreateMethodCall({ ...createParams, approvalProgram, clearStateProgram });
123
+ }
124
+ else {
125
+ composer.addAppCreate({ ...createParams, approvalProgram, clearStateProgram });
126
+ }
127
+ const createIndex = await composer.count();
128
+ if ('method' in deleteParams) {
129
+ composer.addAppDeleteMethodCall({ appId: existingApp.appId, ...deleteParams });
130
+ }
131
+ else {
132
+ composer.addAppDelete({ appId: existingApp.appId, ...deleteParams });
133
+ }
134
+ const result = await composer.execute({ ...executeParams, suppressLog: true });
135
+ const confirmation = result.confirmations.at(createIndex - 1);
136
+ const transaction = result.transactions.at(createIndex - 1);
137
+ const deleteTransaction = result.transactions.at(-1);
138
+ Config.getLogger(executeParams?.suppressLog).warn(`Sent transactions ${transaction.txID()} to create app with id ${confirmation.applicationIndex} and ${deleteTransaction.txID()} to delete app with id ${existingApp.appId} from ${createParams.sender} account.`);
139
+ const appMetadata = {
140
+ appId: BigInt(confirmation.applicationIndex),
141
+ appAddress: algosdk.getApplicationAddress(confirmation.applicationIndex),
142
+ ...metadata,
143
+ createdMetadata: metadata,
144
+ createdRound: BigInt(confirmation.confirmedRound),
145
+ updatedRound: BigInt(confirmation.confirmedRound),
146
+ deleted: false,
147
+ };
148
+ this.updateAppLookup(createParams.sender, appMetadata);
149
+ return {
150
+ operationPerformed: 'replace',
151
+ ...result,
152
+ compiledApproval,
153
+ compiledClear,
154
+ transaction,
155
+ confirmation,
156
+ return: 'method' in createParams ? result.returns?.[0] : undefined,
157
+ deleteReturn: 'method' in deleteParams ? result.returns?.at(-1) : undefined,
158
+ ...appMetadata,
159
+ deleteResult: { transaction: deleteTransaction, confirmation: result.confirmations.at(-1) },
160
+ };
161
+ };
162
+ // Lookup existing app metadata
163
+ const apps = existingDeployments ?? (await this.getCreatorAppsByName(createParams.sender, ignoreCache));
164
+ const existingApp = apps.apps[metadata.name];
165
+ if (!existingApp || existingApp.deleted) {
166
+ Config.getLogger(executeParams?.suppressLog).info(`App ${metadata.name} not found in apps created by ${createParams.sender}; deploying app with version ${metadata.version}.`);
167
+ return await createApp();
168
+ }
169
+ Config.getLogger(executeParams?.suppressLog).info(`Existing app ${metadata.name} found by creator ${createParams.sender}, with app id ${existingApp.appId} and version ${existingApp.version}.`);
170
+ const existingAppRecord = await this._appManager.getById(existingApp.appId);
171
+ const existingApproval = Buffer.from(existingAppRecord.approvalProgram).toString('base64');
172
+ const existingClear = Buffer.from(existingAppRecord.clearStateProgram).toString('base64');
173
+ const newApproval = Buffer.from(approvalProgram).toString('base64');
174
+ const newClear = Buffer.from(clearStateProgram).toString('base64');
175
+ // Check for changes
176
+ const isUpdate = newApproval !== existingApproval || newClear !== existingClear;
177
+ const isSchemaBreak = existingAppRecord.localInts < (createParams.schema?.localInts ?? 0) ||
178
+ existingAppRecord.globalInts < (createParams.schema?.globalInts ?? 0) ||
179
+ existingAppRecord.localByteSlices < (createParams.schema?.localByteSlices ?? 0) ||
180
+ existingAppRecord.globalByteSlices < (createParams.schema?.globalByteSlices ?? 0);
181
+ if (isSchemaBreak) {
182
+ Config.getLogger(executeParams?.suppressLog).warn(`Detected a breaking app schema change in app ${existingApp.appId}:`, {
183
+ from: {
184
+ globalInts: existingAppRecord.globalInts,
185
+ globalByteSlices: existingAppRecord.globalByteSlices,
186
+ localInts: existingAppRecord.localInts,
187
+ localByteSlices: existingAppRecord.localByteSlices,
188
+ },
189
+ to: createParams.schema,
190
+ });
191
+ if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === OnSchemaBreak.Fail) {
192
+ throw new Error('Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' +
193
+ 'If you want to try deleting and recreating the app then ' +
194
+ 're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp');
195
+ }
196
+ if (onSchemaBreak === 'append' || onSchemaBreak === OnSchemaBreak.AppendApp) {
197
+ Config.getLogger(executeParams?.suppressLog).info('onSchemaBreak=AppendApp, will attempt to create a new app');
198
+ return await createApp();
199
+ }
200
+ if (existingApp.deletable) {
201
+ Config.getLogger(executeParams?.suppressLog).info('App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app');
202
+ }
203
+ else {
204
+ Config.getLogger(executeParams?.suppressLog).info('App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail');
205
+ }
206
+ return await replaceApp(existingApp);
207
+ }
208
+ if (isUpdate) {
209
+ Config.getLogger(executeParams?.suppressLog).info(`Detected a TEAL update in app ${existingApp.appId} for creator ${createParams.sender}`);
210
+ if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === OnUpdate.Fail) {
211
+ throw new Error('Update detected and onUpdate=Fail, stopping deployment. Try a different onUpdate value to not fail.');
212
+ }
213
+ if (onUpdate === 'append' || onUpdate === OnUpdate.AppendApp) {
214
+ Config.getLogger(executeParams?.suppressLog).info('onUpdate=AppendApp, will attempt to create a new app');
215
+ return await createApp();
216
+ }
217
+ if (onUpdate === 'update' || onUpdate === OnUpdate.UpdateApp) {
218
+ if (existingApp.updatable) {
219
+ Config.getLogger(executeParams?.suppressLog).info(`App is updatable and onUpdate=UpdateApp, updating app...`);
220
+ }
221
+ else {
222
+ Config.getLogger(executeParams?.suppressLog).warn(`App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`);
223
+ }
224
+ return await updateApp(existingApp);
225
+ }
226
+ if (onUpdate === 'replace' || onUpdate === OnUpdate.ReplaceApp) {
227
+ if (existingApp.deletable) {
228
+ Config.getLogger(executeParams?.suppressLog).warn('App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...');
229
+ }
230
+ else {
231
+ Config.getLogger(executeParams?.suppressLog).warn('App is not deletable and onUpdate=ReplaceApp, will attempt to create new app and delete old app, delete will most likely fail');
232
+ }
233
+ return await replaceApp(existingApp);
234
+ }
235
+ }
236
+ Config.getLogger(executeParams?.suppressLog).debug('No detected changes in app, nothing to do.');
237
+ return { ...existingApp, operationPerformed: 'nothing' };
238
+ }
239
+ updateAppLookup(sender, appMetadata) {
240
+ const lookup = this._appLookups.get(sender);
241
+ if (!lookup) {
242
+ this._appLookups.set(sender, { creator: sender, apps: { [appMetadata.name]: appMetadata } });
243
+ }
244
+ else {
245
+ lookup.apps[appMetadata.name] = appMetadata;
246
+ }
247
+ }
248
+ /**
249
+ * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have
250
+ * an [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) `AppDeployNote` as the transaction
251
+ * note of the app creation transaction.
252
+ *
253
+ * This function caches the result for the given creator account so that subsequent calls will not require an indexer lookup.
254
+ *
255
+ * If the `AppManager` instance wasn't created with an indexer client, this function will throw an error.
256
+ *
257
+ * @param creatorAddress The address of the account that is the creator of the apps you want to search for
258
+ * @param ignoreCache Whether ot not to ignore the cache and force a lookup, default: use the cache
259
+ * @returns A name-based lookup of the app metadata
260
+ */
261
+ async getCreatorAppsByName(creatorAddress, ignoreCache) {
262
+ const appLookup = {};
263
+ if (!ignoreCache && this._appLookups.has(creatorAddress)) {
264
+ return this._appLookups.get(creatorAddress);
265
+ }
266
+ if (!this._indexer) {
267
+ throw new Error(`Didn't receive an indexer client when this AppManager was created, but received a call to getCreatorApps`);
268
+ }
269
+ // Extract all apps that account created
270
+ const createdApps = (await lookupAccountCreatedApplicationByAddress(this._indexer, creatorAddress))
271
+ .map((a) => {
272
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
273
+ return { id: BigInt(a.id), createdAtRound: a['created-at-round'], deleted: a.deleted };
274
+ })
275
+ .sort((a, b) => a.createdAtRound - b.createdAtRound);
276
+ // For each app that account created (in parallel)...
277
+ const apps = await Promise.all(createdApps.map(async (createdApp) => {
278
+ // Find any app transactions for that app in the round it was created (should always just be a single creation transaction)
279
+ const appTransactions = await searchTransactions(this._indexer, (s) => s
280
+ .minRound(createdApp.createdAtRound)
281
+ .txType(algosdk.TransactionType.appl)
282
+ .applicationID(Number(createdApp.id))
283
+ .address(creatorAddress)
284
+ .addressRole('sender')
285
+ .notePrefix(Buffer.from(APP_DEPLOY_NOTE_DAPP).toString('base64')));
286
+ // Triple check the transaction is intact by filtering for the one we want:
287
+ // * application-id is 0 when the app is first created
288
+ // * also verify the sender to prevent a potential security risk
289
+ const appCreationTransaction = appTransactions.transactions.filter(
290
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
291
+ (t) => t['application-transaction']['application-id'] === 0 && t.sender === creatorAddress)[0];
292
+ const latestAppUpdateTransaction = appTransactions.transactions
293
+ .filter((t) => t.sender === creatorAddress)
294
+ .sort((a, b) => a['confirmed-round'] === b['confirmed-round']
295
+ ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
296
+ (b['intra-round-offset'] - a['intra-round-offset']) / 10
297
+ : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
298
+ b['confirmed-round'] - a['confirmed-round'])[0];
299
+ if (!appCreationTransaction?.note)
300
+ // No note; ignoring
301
+ return null;
302
+ return { createdApp, appCreationTransaction, latestAppUpdateTransaction };
303
+ }));
304
+ apps
305
+ .filter((a) => a !== null)
306
+ .forEach((a) => {
307
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
308
+ const { createdApp, appCreationTransaction, latestAppUpdateTransaction } = a;
309
+ const parseNote = (note) => {
310
+ if (!note) {
311
+ // No note; ignoring...
312
+ return;
313
+ }
314
+ const decoder = new TextDecoder();
315
+ const noteAsBase64 = decoder.decode(Buffer.from(note));
316
+ const noteAsString = Buffer.from(noteAsBase64, 'base64').toString('utf-8');
317
+ if (!noteAsString.startsWith(`${APP_DEPLOY_NOTE_DAPP}:j{`))
318
+ // Clearly not APP_DEPLOY JSON; ignoring...
319
+ return;
320
+ return JSON.parse(noteAsString.substring(APP_DEPLOY_NOTE_DAPP.length + 2));
321
+ };
322
+ try {
323
+ const creationNote = parseNote(appCreationTransaction.note);
324
+ const updateNote = parseNote(latestAppUpdateTransaction.note);
325
+ if (creationNote?.name) {
326
+ appLookup[creationNote.name] = {
327
+ appId: createdApp.id,
328
+ appAddress: algosdk.getApplicationAddress(createdApp.id),
329
+ createdMetadata: creationNote,
330
+ createdRound: BigInt(appCreationTransaction['confirmed-round'] ?? 0),
331
+ ...(updateNote ?? creationNote),
332
+ updatedRound: BigInt(latestAppUpdateTransaction?.['confirmed-round'] ?? 0),
333
+ deleted: createdApp.deleted ?? false,
334
+ };
335
+ }
336
+ }
337
+ catch (e) {
338
+ Config.logger.warn(`Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, e);
339
+ return;
340
+ }
341
+ });
342
+ const lookup = {
343
+ creator: creatorAddress,
344
+ apps: appLookup,
345
+ };
346
+ this._appLookups.set(creatorAddress, lookup);
347
+ return lookup;
348
+ }
349
+ }
350
+
351
+ export { AppDeployer };
352
+ //# sourceMappingURL=app-deployer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-deployer.mjs","sources":["../../src/types/app-deployer.ts"],"sourcesContent":[null],"names":["indexer.lookupAccountCreatedApplicationByAddress","indexer.searchTransactions"],"mappings":";;;;;;AAsGA;MACa,WAAW,CAAA;AAMtB;;;;;AAKG;AACH,IAAA,WAAA,CAAY,UAAsB,EAAE,iBAAkD,EAAE,OAAyB,EAAA;AARzG,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,GAAG,EAAqB,CAAA;AAShD,QAAA,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;AAC7B,QAAA,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;KACxB;AAED;;;;;;;;;;;;AAYG;IACH,MAAM,MAAM,CAAC,UAA2B,EAAA;QACtC,MAAM,EACJ,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,WAAW,GACZ,GAAG,UAAU,CAAA;;QAId,YAAY,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC/D,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,MAAM,EAAE,GAAG;AACZ,SAAA,CAAC,CAAA;;QAIF,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,KAAK,YAAY,CA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E,wBAAA,IAAI,UAAU,IAAI,YAAY;wBAC9B,YAAY,EAAE,MAAM,CAAC,0BAA0B,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAC1E,wBAAA,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,KAAK;qBACrC,CAAA;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;AACV,gBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAChB,CAA8C,2CAAA,EAAA,UAAU,CAAC,EAAE,gBAAgB,cAAc,CAAA,kBAAA,CAAoB,EAC7G,CAAC,CACF,CAAA;gBACD,OAAM;aACP;AACH,SAAC,CAAC,CAAA;AAEJ,QAAA,MAAM,MAAM,GAAG;AACb,YAAA,OAAO,EAAE,cAAc;AACvB,YAAA,IAAI,EAAE,SAAS;SAChB,CAAA;QAED,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AAE5C,QAAA,OAAO,MAAM,CAAA;KACd;AACF;;;;"}
@@ -0,0 +1,235 @@
1
+ import algosdk from 'algosdk';
2
+ import { TransactionSignerAccount } from './account';
3
+ import { BoxName, type ABIReturn, type AppDeployMetadata, type AppState, type CompiledTeal, type TealTemplateParams } from './app';
4
+ import modelsv2 = algosdk.modelsv2;
5
+ /** Information about an app. */
6
+ export interface AppInformation {
7
+ /** The ID of the app. */
8
+ appId: bigint;
9
+ /** The escrow address that the app operates with. */
10
+ appAddress: string;
11
+ /**
12
+ * Approval program.
13
+ */
14
+ approvalProgram: Uint8Array;
15
+ /**
16
+ * Clear state program.
17
+ */
18
+ clearStateProgram: Uint8Array;
19
+ /**
20
+ * The address that created this application. This is the address where the
21
+ * parameters and global state for this application can be found.
22
+ */
23
+ creator: string;
24
+ /**
25
+ * Current global state values.
26
+ */
27
+ globalState: AppState;
28
+ /** The number of allocated ints in per-user local state. */
29
+ localInts: number;
30
+ /** The number of allocated byte slices in per-user local state. */
31
+ localByteSlices: number;
32
+ /** The number of allocated ints in global state. */
33
+ globalInts: number;
34
+ /** The number of allocated byte slices in global state. */
35
+ globalByteSlices: number;
36
+ /** Any extra pages that are needed for the smart contract. */
37
+ extraProgramPages?: number;
38
+ }
39
+ /**
40
+ * Something that identifies an app box name - either a:
41
+ * * `Uint8Array` (the actual binary of the box name)
42
+ * * `string` (that will be encoded to a `Uint8Array`)
43
+ * * `TransactionSignerAccount` (that will be encoded into the
44
+ * public key address of the corresponding account)
45
+ */
46
+ export type BoxIdentifier = string | Uint8Array | TransactionSignerAccount;
47
+ /**
48
+ * A grouping of the app ID and name identifier to reference an app box.
49
+ */
50
+ export interface BoxReference {
51
+ /**
52
+ * A unique application id
53
+ */
54
+ appId: bigint;
55
+ /**
56
+ * Identifier for a box name
57
+ */
58
+ name: BoxIdentifier;
59
+ }
60
+ /**
61
+ * Parameters to get and decode a box value as an ABI type.
62
+ */
63
+ export interface BoxValueRequestParams {
64
+ /** The ID of the app return box names for */
65
+ appId: bigint;
66
+ /** The name of the box to return either as a string, binary array or `BoxName` */
67
+ boxName: BoxIdentifier;
68
+ /** The ABI type to decode the value using */
69
+ type: algosdk.ABIType;
70
+ }
71
+ /**
72
+ * Parameters to get and decode a box value as an ABI type.
73
+ */
74
+ export interface BoxValuesRequestParams {
75
+ /** The ID of the app return box names for */
76
+ appId: bigint;
77
+ /** The names of the boxes to return either as a string, binary array or BoxName` */
78
+ boxNames: BoxIdentifier[];
79
+ /** The ABI type to decode the value using */
80
+ type: algosdk.ABIType;
81
+ }
82
+ /** Allows management of application information. */
83
+ export declare class AppManager {
84
+ private _algod;
85
+ private _compilationResults;
86
+ /**
87
+ * Creates an `AppManager`
88
+ * @param algod An algod instance
89
+ */
90
+ constructor(algod: algosdk.Algodv2);
91
+ /**
92
+ * Compiles the given TEAL using algod and returns the result, including source map.
93
+ *
94
+ * The result of this compilation is also cached keyed by the TEAL
95
+ * code so it can be retrieved via `getCompilationResult`.
96
+ *
97
+ * This function is re-entrant; it will only compile the same code once.
98
+ *
99
+ * @param tealCode The TEAL code
100
+ * @returns The information about the compiled file
101
+ */
102
+ compileTeal(tealCode: string): Promise<CompiledTeal>;
103
+ /**
104
+ * Performs template substitution of a teal template and compiles it, returning the compiled result.
105
+ *
106
+ * Looks for `TMPL_{parameter}` for template replacements and replaces AlgoKit deploy-time control parameters
107
+ * if deployment metadata is specified.
108
+ *
109
+ * * `TMPL_UPDATABLE` for updatability / immutability control
110
+ * * `TMPL_DELETABLE` for deletability / permanence control
111
+ *
112
+ * @param tealTemplateCode The TEAL logic to compile
113
+ * @param templateParams Any parameters to replace in the .teal file before compiling
114
+ * @param deploymentMetadata The deployment metadata the app will be deployed with
115
+ * @returns The information about the compiled code
116
+ */
117
+ compileTealTemplate(tealTemplateCode: string, templateParams?: TealTemplateParams, deploymentMetadata?: AppDeployMetadata): Promise<CompiledTeal>;
118
+ /**
119
+ * Returns a previous compilation result.
120
+ * @param tealCode The TEAL code
121
+ * @returns The information about the previously compiled file
122
+ * or `undefined` if that TEAL code wasn't previously compiled
123
+ */
124
+ getCompilationResult(tealCode: string): CompiledTeal | undefined;
125
+ /**
126
+ * Returns the current app information for the app with the given ID.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const appInfo = await appManager.getById(12353n);
131
+ * ```
132
+ *
133
+ * @param appId The ID of the app
134
+ * @returns The app information
135
+ */
136
+ getById(appId: bigint): Promise<AppInformation>;
137
+ /**
138
+ * Returns the current local state values for the given app ID and account address
139
+ *
140
+ * @param appId The ID of the app to return local state for
141
+ * @param address The string address of the account to get local state for the given app
142
+ * @returns The current local state for the given (app, account) combination
143
+ */
144
+ getLocalState(appId: bigint, address: string): Promise<AppState>;
145
+ /**
146
+ * Returns the names of the current boxes for the given app.
147
+ * @param appId The ID of the app return box names for
148
+ * @returns The current box names
149
+ */
150
+ getBoxNames(appId: bigint): Promise<BoxName[]>;
151
+ /**
152
+ * Returns the value of the given box name for the given app.
153
+ * @param appId The ID of the app return box names for
154
+ * @param boxName The name of the box to return either as a string, binary array or `BoxName`
155
+ * @returns The current box value as a byte array
156
+ */
157
+ getBoxValue(appId: bigint, boxName: BoxIdentifier): Promise<Uint8Array>;
158
+ /**
159
+ * Returns the value of the given box names for the given app.
160
+ * @param appId The ID of the app return box names for
161
+ * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`
162
+ * @returns The current box values as a byte array in the same order as the passed in box names
163
+ */
164
+ getBoxValues(appId: bigint, boxNames: BoxIdentifier[]): Promise<Uint8Array[]>;
165
+ /**
166
+ * Returns the value of the given box name for the given app decoded based on the given ABI type.
167
+ * @param request The parameters for the box value request
168
+ * @returns The current box value as an ABI value
169
+ */
170
+ getBoxValueFromABIType(request: BoxValueRequestParams): Promise<algosdk.ABIValue>;
171
+ /**
172
+ * Returns the value of the given box names for the given app decoded based on the given ABI type.
173
+ * @param request The parameters for the box value request
174
+ * @returns The current box values as an ABI value in the same order as the passed in box names
175
+ */
176
+ getBoxValuesFromABIType(request: BoxValuesRequestParams): Promise<algosdk.ABIValue[]>;
177
+ /**
178
+ * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.
179
+ * @param boxId The box to return a reference for
180
+ * @returns The box reference ready to pass into a `algosdk.Transaction`
181
+ */
182
+ static getBoxReference(boxId: BoxIdentifier | BoxReference): algosdk.BoxReference;
183
+ /**
184
+ * Converts an array of global/local state values from the algod api to a more friendly
185
+ * generic object keyed by the UTF-8 value of the key.
186
+ * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`
187
+ * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values
188
+ */
189
+ static decodeAppState(state: {
190
+ key: string;
191
+ value: modelsv2.TealValue | modelsv2.EvalDelta;
192
+ }[]): AppState;
193
+ /**
194
+ * Returns any ABI return values for the given app call arguments and transaction confirmation.
195
+ * @param confirmation The transaction confirmation from algod
196
+ * @param method The ABI method
197
+ * @returns The return value for the method call
198
+ */
199
+ static getABIReturn(confirmation: modelsv2.PendingTransactionResponse | undefined, method: algosdk.ABIMethod | undefined): ABIReturn | undefined;
200
+ /**
201
+ * Replaces AlgoKit deploy-time deployment control parameters within the given TEAL template code.
202
+ *
203
+ * * `TMPL_UPDATABLE` for updatability / immutability control
204
+ * * `TMPL_DELETABLE` for deletability / permanence control
205
+ *
206
+ * Note: If these values are defined, but the corresponding `TMPL_*` value
207
+ * isn't in the teal code it will throw an exception.
208
+ *
209
+ * @param tealTemplateCode The TEAL template code to substitute
210
+ * @param params The deploy-time deployment control parameter value to replace
211
+ * @returns The replaced TEAL code
212
+ */
213
+ static replaceTealTemplateDeployTimeControlParams(tealTemplateCode: string, params: {
214
+ updatable?: boolean;
215
+ deletable?: boolean;
216
+ }): string;
217
+ /**
218
+ * Performs template substitution of a teal file.
219
+ *
220
+ * Looks for `TMPL_{parameter}` for template replacements.
221
+ *
222
+ * @param tealTemplateCode The TEAL template code to make parameter replacements in
223
+ * @param templateParams Any parameters to replace in the teal code
224
+ * @returns The TEAL code with replacements
225
+ */
226
+ static replaceTealTemplateParams(tealTemplateCode: string, templateParams?: TealTemplateParams): string;
227
+ /**
228
+ * Remove comments from TEAL code (useful to reduce code size before compilation).
229
+ *
230
+ * @param tealCode The TEAL logic to strip
231
+ * @returns The TEAL without comments
232
+ */
233
+ static stripTealComments(tealCode: string): string;
234
+ }
235
+ //# sourceMappingURL=app-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-manager.d.ts","sourceRoot":"","sources":["../../src/types/app-manager.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EACL,OAAO,EAGP,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,OAAO,CAAA;AACd,OAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAElC,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,yBA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