@algorandfoundation/algokit-utils 9.2.0-beta.1 → 9.2.0-beta.10
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.
- package/package.json +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +3 -3
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/transaction/transaction.d.ts +1 -1
- package/transaction/transaction.js +27 -4
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +27 -4
- package/transaction/transaction.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +12 -2
- package/types/algorand-client-transaction-creator.js +8 -0
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +8 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +108 -16
- package/types/algorand-client-transaction-sender.js +8 -0
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +8 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/app-client.d.ts +74 -37
- package/types/app-deployer.js +3 -3
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -3
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +36 -18
- package/types/app-manager.d.ts +3 -5
- package/types/app-manager.js +1 -26
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +3 -27
- package/types/app-manager.mjs.map +1 -1
- package/types/composer.d.ts +12 -2
- package/types/composer.js +39 -3
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +40 -4
- package/types/composer.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +1 -0
- package/types/kmd-account-manager.js +33 -14
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +33 -14
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/testing.d.ts +2 -2
package/types/app-factory.d.ts
CHANGED
|
@@ -167,6 +167,7 @@ export declare class AppFactory {
|
|
|
167
167
|
note?: string | Uint8Array | undefined;
|
|
168
168
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
169
169
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
170
|
+
rejectVersion?: number | undefined;
|
|
170
171
|
lease?: string | Uint8Array | undefined;
|
|
171
172
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
172
173
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -178,7 +179,7 @@ export declare class AppFactory {
|
|
|
178
179
|
appReferences?: bigint[] | undefined;
|
|
179
180
|
assetReferences?: bigint[] | undefined;
|
|
180
181
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
181
|
-
accessReferences?: import("./app-manager").
|
|
182
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
182
183
|
sender?: string | algosdk.Address | undefined;
|
|
183
184
|
method: string;
|
|
184
185
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -214,6 +215,7 @@ export declare class AppFactory {
|
|
|
214
215
|
note?: string | Uint8Array | undefined;
|
|
215
216
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
216
217
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
218
|
+
rejectVersion?: number | undefined;
|
|
217
219
|
lease?: string | Uint8Array | undefined;
|
|
218
220
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
219
221
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -225,7 +227,7 @@ export declare class AppFactory {
|
|
|
225
227
|
appReferences?: bigint[] | undefined;
|
|
226
228
|
assetReferences?: bigint[] | undefined;
|
|
227
229
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
228
|
-
accessReferences?: import("./app-manager").
|
|
230
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
229
231
|
sender?: string | algosdk.Address | undefined;
|
|
230
232
|
method: string;
|
|
231
233
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -243,6 +245,7 @@ export declare class AppFactory {
|
|
|
243
245
|
args?: Uint8Array[] | undefined;
|
|
244
246
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
245
247
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
248
|
+
rejectVersion?: number | undefined;
|
|
246
249
|
lease?: string | Uint8Array | undefined;
|
|
247
250
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
248
251
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -254,7 +257,7 @@ export declare class AppFactory {
|
|
|
254
257
|
appReferences?: bigint[] | undefined;
|
|
255
258
|
assetReferences?: bigint[] | undefined;
|
|
256
259
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
257
|
-
accessReferences?: import("./app-manager").
|
|
260
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
258
261
|
approvalProgram: string | Uint8Array;
|
|
259
262
|
clearStateProgram: string | Uint8Array;
|
|
260
263
|
schema?: {
|
|
@@ -283,7 +286,8 @@ export declare class AppFactory {
|
|
|
283
286
|
appReferences?: bigint[] | undefined;
|
|
284
287
|
assetReferences?: bigint[] | undefined;
|
|
285
288
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
286
|
-
accessReferences?: import("./app-manager").
|
|
289
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
290
|
+
rejectVersion?: number | undefined;
|
|
287
291
|
approvalProgram: string | Uint8Array;
|
|
288
292
|
clearStateProgram: string | Uint8Array;
|
|
289
293
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -295,6 +299,7 @@ export declare class AppFactory {
|
|
|
295
299
|
note?: string | Uint8Array | undefined;
|
|
296
300
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
297
301
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
302
|
+
rejectVersion?: number | undefined;
|
|
298
303
|
lease?: string | Uint8Array | undefined;
|
|
299
304
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
300
305
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -306,7 +311,7 @@ export declare class AppFactory {
|
|
|
306
311
|
appReferences?: bigint[] | undefined;
|
|
307
312
|
assetReferences?: bigint[] | undefined;
|
|
308
313
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
309
|
-
accessReferences?: import("./app-manager").
|
|
314
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
310
315
|
sender?: string | algosdk.Address | undefined;
|
|
311
316
|
method: string;
|
|
312
317
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -315,6 +320,7 @@ export declare class AppFactory {
|
|
|
315
320
|
note?: string | Uint8Array | undefined;
|
|
316
321
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
317
322
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
323
|
+
rejectVersion?: number | undefined;
|
|
318
324
|
lease?: string | Uint8Array | undefined;
|
|
319
325
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
320
326
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -326,7 +332,7 @@ export declare class AppFactory {
|
|
|
326
332
|
appReferences?: bigint[] | undefined;
|
|
327
333
|
assetReferences?: bigint[] | undefined;
|
|
328
334
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
329
|
-
accessReferences?: import("./app-manager").
|
|
335
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
330
336
|
sender?: string | algosdk.Address | undefined;
|
|
331
337
|
method: string;
|
|
332
338
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -341,6 +347,7 @@ export declare class AppFactory {
|
|
|
341
347
|
args?: Uint8Array[] | undefined;
|
|
342
348
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
343
349
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
350
|
+
rejectVersion?: number | undefined;
|
|
344
351
|
lease?: string | Uint8Array | undefined;
|
|
345
352
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
346
353
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -352,7 +359,7 @@ export declare class AppFactory {
|
|
|
352
359
|
appReferences?: bigint[] | undefined;
|
|
353
360
|
assetReferences?: bigint[] | undefined;
|
|
354
361
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
355
|
-
accessReferences?: import("./app-manager").
|
|
362
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
356
363
|
approvalProgram: string | Uint8Array;
|
|
357
364
|
clearStateProgram: string | Uint8Array;
|
|
358
365
|
schema?: {
|
|
@@ -381,7 +388,8 @@ export declare class AppFactory {
|
|
|
381
388
|
appReferences?: bigint[] | undefined;
|
|
382
389
|
assetReferences?: bigint[] | undefined;
|
|
383
390
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
384
|
-
accessReferences?: import("./app-manager").
|
|
391
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
392
|
+
rejectVersion?: number | undefined;
|
|
385
393
|
approvalProgram: string | Uint8Array;
|
|
386
394
|
clearStateProgram: string | Uint8Array;
|
|
387
395
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -393,6 +401,7 @@ export declare class AppFactory {
|
|
|
393
401
|
note?: string | Uint8Array | undefined;
|
|
394
402
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
395
403
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
404
|
+
rejectVersion?: number | undefined;
|
|
396
405
|
lease?: string | Uint8Array | undefined;
|
|
397
406
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
398
407
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -404,7 +413,7 @@ export declare class AppFactory {
|
|
|
404
413
|
appReferences?: bigint[] | undefined;
|
|
405
414
|
assetReferences?: bigint[] | undefined;
|
|
406
415
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
407
|
-
accessReferences?: import("./app-manager").
|
|
416
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
408
417
|
sender?: string | algosdk.Address | undefined;
|
|
409
418
|
method: string;
|
|
410
419
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -413,6 +422,7 @@ export declare class AppFactory {
|
|
|
413
422
|
note?: string | Uint8Array | undefined;
|
|
414
423
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
415
424
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
425
|
+
rejectVersion?: number | undefined;
|
|
416
426
|
lease?: string | Uint8Array | undefined;
|
|
417
427
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
418
428
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -424,7 +434,7 @@ export declare class AppFactory {
|
|
|
424
434
|
appReferences?: bigint[] | undefined;
|
|
425
435
|
assetReferences?: bigint[] | undefined;
|
|
426
436
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
427
|
-
accessReferences?: import("./app-manager").
|
|
437
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
428
438
|
sender?: string | algosdk.Address | undefined;
|
|
429
439
|
method: string;
|
|
430
440
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -439,6 +449,7 @@ export declare class AppFactory {
|
|
|
439
449
|
args?: Uint8Array[] | undefined;
|
|
440
450
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
441
451
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
452
|
+
rejectVersion?: number | undefined;
|
|
442
453
|
lease?: string | Uint8Array | undefined;
|
|
443
454
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
444
455
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -450,7 +461,7 @@ export declare class AppFactory {
|
|
|
450
461
|
appReferences?: bigint[] | undefined;
|
|
451
462
|
assetReferences?: bigint[] | undefined;
|
|
452
463
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
453
|
-
accessReferences?: import("./app-manager").
|
|
464
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
454
465
|
approvalProgram: string | Uint8Array;
|
|
455
466
|
clearStateProgram: string | Uint8Array;
|
|
456
467
|
schema?: {
|
|
@@ -479,7 +490,8 @@ export declare class AppFactory {
|
|
|
479
490
|
appReferences?: bigint[] | undefined;
|
|
480
491
|
assetReferences?: bigint[] | undefined;
|
|
481
492
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
482
|
-
accessReferences?: import("./app-manager").
|
|
493
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
494
|
+
rejectVersion?: number | undefined;
|
|
483
495
|
approvalProgram: string | Uint8Array;
|
|
484
496
|
clearStateProgram: string | Uint8Array;
|
|
485
497
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -492,6 +504,7 @@ export declare class AppFactory {
|
|
|
492
504
|
note?: string | Uint8Array | undefined;
|
|
493
505
|
args?: Uint8Array[] | undefined;
|
|
494
506
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
507
|
+
rejectVersion?: number | undefined;
|
|
495
508
|
lease?: string | Uint8Array | undefined;
|
|
496
509
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
497
510
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -503,7 +516,7 @@ export declare class AppFactory {
|
|
|
503
516
|
appReferences?: bigint[] | undefined;
|
|
504
517
|
assetReferences?: bigint[] | undefined;
|
|
505
518
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
506
|
-
accessReferences?: import("./app-manager").
|
|
519
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
507
520
|
sender?: string | algosdk.Address | undefined;
|
|
508
521
|
deployTimeParams?: TealTemplateParams | undefined;
|
|
509
522
|
updatable?: boolean | undefined;
|
|
@@ -540,6 +553,7 @@ export declare class AppFactory {
|
|
|
540
553
|
note?: string | Uint8Array | undefined;
|
|
541
554
|
args?: Uint8Array[] | undefined;
|
|
542
555
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
556
|
+
rejectVersion?: number | undefined;
|
|
543
557
|
lease?: string | Uint8Array | undefined;
|
|
544
558
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
545
559
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -551,7 +565,7 @@ export declare class AppFactory {
|
|
|
551
565
|
appReferences?: bigint[] | undefined;
|
|
552
566
|
assetReferences?: bigint[] | undefined;
|
|
553
567
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
554
|
-
accessReferences?: import("./app-manager").
|
|
568
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
555
569
|
sender?: string | algosdk.Address | undefined;
|
|
556
570
|
updatable?: boolean | undefined;
|
|
557
571
|
deletable?: boolean | undefined;
|
|
@@ -568,6 +582,7 @@ export declare class AppFactory {
|
|
|
568
582
|
note?: string | Uint8Array | undefined;
|
|
569
583
|
args?: Uint8Array[] | undefined;
|
|
570
584
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
585
|
+
rejectVersion?: number | undefined;
|
|
571
586
|
lease?: string | Uint8Array | undefined;
|
|
572
587
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
573
588
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -579,13 +594,14 @@ export declare class AppFactory {
|
|
|
579
594
|
appReferences?: bigint[] | undefined;
|
|
580
595
|
assetReferences?: bigint[] | undefined;
|
|
581
596
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
582
|
-
accessReferences?: import("./app-manager").
|
|
597
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
583
598
|
sender?: string | algosdk.Address | undefined;
|
|
584
599
|
} | undefined) => {
|
|
585
600
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
586
601
|
note?: string | Uint8Array | undefined;
|
|
587
602
|
args?: Uint8Array[] | undefined;
|
|
588
603
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
604
|
+
rejectVersion?: number | undefined;
|
|
589
605
|
lease?: string | Uint8Array | undefined;
|
|
590
606
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
591
607
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -597,7 +613,7 @@ export declare class AppFactory {
|
|
|
597
613
|
appReferences?: bigint[] | undefined;
|
|
598
614
|
assetReferences?: bigint[] | undefined;
|
|
599
615
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
600
|
-
accessReferences?: import("./app-manager").
|
|
616
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
601
617
|
sender?: string | algosdk.Address | undefined;
|
|
602
618
|
} & {
|
|
603
619
|
sender: algosdk.Address;
|
|
@@ -610,6 +626,7 @@ export declare class AppFactory {
|
|
|
610
626
|
note?: string | Uint8Array | undefined;
|
|
611
627
|
args?: Uint8Array[] | undefined;
|
|
612
628
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
629
|
+
rejectVersion?: number | undefined;
|
|
613
630
|
lease?: string | Uint8Array | undefined;
|
|
614
631
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
615
632
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -621,13 +638,14 @@ export declare class AppFactory {
|
|
|
621
638
|
appReferences?: bigint[] | undefined;
|
|
622
639
|
assetReferences?: bigint[] | undefined;
|
|
623
640
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
624
|
-
accessReferences?: import("./app-manager").
|
|
641
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
625
642
|
sender?: string | algosdk.Address | undefined;
|
|
626
643
|
} | undefined) => {
|
|
627
644
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
628
645
|
note?: string | Uint8Array | undefined;
|
|
629
646
|
args?: Uint8Array[] | undefined;
|
|
630
647
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
648
|
+
rejectVersion?: number | undefined;
|
|
631
649
|
lease?: string | Uint8Array | undefined;
|
|
632
650
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
633
651
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -639,7 +657,7 @@ export declare class AppFactory {
|
|
|
639
657
|
appReferences?: bigint[] | undefined;
|
|
640
658
|
assetReferences?: bigint[] | undefined;
|
|
641
659
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
642
|
-
accessReferences?: import("./app-manager").
|
|
660
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
643
661
|
sender?: string | algosdk.Address | undefined;
|
|
644
662
|
} & {
|
|
645
663
|
sender: algosdk.Address;
|
package/types/app-manager.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface AppInformation {
|
|
|
35
35
|
globalByteSlices: number;
|
|
36
36
|
/** Any extra pages that are needed for the smart contract. */
|
|
37
37
|
extraProgramPages?: number;
|
|
38
|
+
/** The number of updates to the application programs */
|
|
39
|
+
version?: number;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Something that identifies an app box name - either a:
|
|
@@ -100,7 +102,7 @@ export interface LocalsReference {
|
|
|
100
102
|
/**
|
|
101
103
|
* Names a single resource reference. Only one of the fields should be set.
|
|
102
104
|
*/
|
|
103
|
-
export interface
|
|
105
|
+
export interface ResourceReference {
|
|
104
106
|
/** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */
|
|
105
107
|
address?: string | Address;
|
|
106
108
|
/** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */
|
|
@@ -341,7 +343,3 @@ export declare class AppManager {
|
|
|
341
343
|
*/
|
|
342
344
|
static stripTealComments(tealCode: string): string;
|
|
343
345
|
}
|
|
344
|
-
/**
|
|
345
|
-
* Returns an `algosdk.TransactionResourceReference` given a `AccessReference`.
|
|
346
|
-
*/
|
|
347
|
-
export declare function getAccessReference(accessReference: AccessReference): algosdk.TransactionResourceReference;
|
package/types/app-manager.js
CHANGED
|
@@ -108,6 +108,7 @@ class AppManager {
|
|
|
108
108
|
globalByteSlices: Number(app.params.globalStateSchema?.numByteSlice ?? 0),
|
|
109
109
|
extraProgramPages: Number(app.params.extraProgramPages ?? 0),
|
|
110
110
|
globalState: AppManager.decodeAppState(app.params.globalState ?? []),
|
|
111
|
+
version: app.params.version,
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
@@ -392,31 +393,6 @@ class AppManager {
|
|
|
392
393
|
.join('\n');
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
|
-
function getHoldingReference(holdingReference) {
|
|
396
|
-
return {
|
|
397
|
-
assetIndex: holdingReference.assetId,
|
|
398
|
-
address: typeof holdingReference.address === 'string' ? algosdk.Address.fromString(holdingReference.address) : holdingReference.address,
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
function getLocalsReference(localsReference) {
|
|
402
|
-
return {
|
|
403
|
-
appIndex: localsReference.appId,
|
|
404
|
-
address: typeof localsReference.address === 'string' ? algosdk.Address.fromString(localsReference.address) : localsReference.address,
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Returns an `algosdk.TransactionResourceReference` given a `AccessReference`.
|
|
409
|
-
*/
|
|
410
|
-
function getAccessReference(accessReference) {
|
|
411
|
-
return {
|
|
412
|
-
address: typeof accessReference.address === 'string' ? algosdk.Address.fromString(accessReference.address) : accessReference.address,
|
|
413
|
-
appIndex: accessReference.appId,
|
|
414
|
-
assetIndex: accessReference.assetId,
|
|
415
|
-
holding: accessReference.holding ? getHoldingReference(accessReference.holding) : undefined,
|
|
416
|
-
locals: accessReference.locals ? getLocalsReference(accessReference.locals) : undefined,
|
|
417
|
-
box: accessReference.box ? AppManager.getBoxReference(accessReference.box) : undefined,
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
396
|
/**
|
|
421
397
|
* Find the first string within a line of TEAL. Only matches outside of quotes and base64 are returned.
|
|
422
398
|
* Returns undefined if not found
|
|
@@ -509,5 +485,4 @@ function isValidTokenCharacter(char) {
|
|
|
509
485
|
}
|
|
510
486
|
|
|
511
487
|
exports.AppManager = AppManager;
|
|
512
|
-
exports.getAccessReference = getAccessReference;
|
|
513
488
|
//# sourceMappingURL=app-manager.js.map
|
package/types/app-manager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-manager.js","sources":["../../src/types/app-manager.ts"],"sourcesContent":["import algosdk, { Address, ProgramSourceMap } from 'algosdk'\nimport { getABIReturnValue } from '../transaction/transaction'\nimport { TransactionSignerAccount } from './account'\nimport {\n BoxName,\n DELETABLE_TEMPLATE_NAME,\n UPDATABLE_TEMPLATE_NAME,\n type ABIReturn,\n type AppState,\n type CompiledTeal,\n type TealTemplateParams,\n} from './app'\nimport modelsv2 = algosdk.modelsv2\n\n/** Information about an app. */\nexport interface AppInformation {\n /** The ID of the app. */\n appId: bigint\n /** The escrow address that the app operates with. */\n appAddress: Address\n /**\n * Approval program.\n */\n approvalProgram: Uint8Array\n /**\n * Clear state program.\n */\n clearStateProgram: Uint8Array\n /**\n * The address that created this application. This is the address where the\n * parameters and global state for this application can be found.\n */\n creator: Address\n /**\n * Current global state values.\n */\n globalState: AppState\n /** The number of allocated ints in per-user local state. */\n localInts: number\n /** The number of allocated byte slices in per-user local state. */\n localByteSlices: number\n /** The number of allocated ints in global state. */\n globalInts: number\n /** The number of allocated byte slices in global state. */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract. */\n extraProgramPages?: number\n}\n\n/**\n * Something that identifies an app box name - either a:\n * * `Uint8Array` (the actual binary of the box name)\n * * `string` (that will be encoded to a `Uint8Array`)\n * * `TransactionSignerAccount` (that will be encoded into the\n * public key address of the corresponding account)\n */\nexport type BoxIdentifier = string | Uint8Array | TransactionSignerAccount\n\n/**\n * A grouping of the app ID and name identifier to reference an app box.\n */\nexport interface BoxReference {\n /**\n * A unique application id\n */\n appId: bigint\n /**\n * Identifier for a box name\n */\n name: BoxIdentifier\n}\n\n/**\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: BoxIdentifier\n /** The ABI type to decode the value using */\n type: algosdk.ABIType\n}\n\n/**\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: bigint\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: BoxIdentifier[]\n /** The ABI type to decode the value using */\n type: algosdk.ABIType\n}\n\n/**\n * Defines a holding by referring to an Address and Asset it belongs to.\n */\nexport interface HoldingReference {\n /** Asset ID for asset in access list. */\n assetId: bigint\n /** Address in access list, or the sender of the transaction. */\n address: string | Address\n}\n\n/**\n * Defines a local state by referring to an Address and App it belongs to.\n */\nexport interface LocalsReference {\n /** Application ID for app in access list, or zero if referring to the called application. */\n appId: bigint\n /** Address in access list, or the sender of the transaction. */\n address: string | Address\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport interface AccessReference {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: string | Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/** Allows management of application information. */\nexport class AppManager {\n private _algod: algosdk.Algodv2\n private _compilationResults: Record<string, CompiledTeal> = {}\n\n /**\n * Creates an `AppManager`\n * @param algod An algod instance\n */\n constructor(algod: algosdk.Algodv2) {\n this._algod = algod\n }\n\n /**\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * The result of this compilation is also cached keyed by the TEAL\n * code so it can be retrieved via `getCompilationResult`.\n *\n * This function is re-entrant; it will only compile the same code once.\n *\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n * @example\n * ```typescript\n * const compiled = await appManager.compileTeal(tealProgram)\n * ```\n */\n async compileTeal(tealCode: string): Promise<CompiledTeal> {\n if (this._compilationResults[tealCode]) {\n return this._compilationResults[tealCode]\n }\n\n const compiled = await this._algod.compile(tealCode).sourcemap(true).do()\n const result = {\n teal: tealCode,\n compiled: compiled.result,\n compiledHash: compiled.hash,\n compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')),\n sourceMap: new ProgramSourceMap(JSON.parse(algosdk.encodeJSON(compiled.sourcemap!))),\n }\n this._compilationResults[tealCode] = result\n\n return result\n }\n\n /**\n * Performs template substitution of a teal template and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements and replaces AlgoKit deploy-time control parameters\n * if deployment metadata is specified.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * @param tealTemplateCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n * @example\n * ```typescript\n * const compiled = await appManager.compileTealTemplate(tealTemplate, { TMPL_APP_ID: 12345n }, { updatable: true, deletable: false })\n * ```\n */\n async compileTealTemplate(\n tealTemplateCode: string,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: { updatable?: boolean; deletable?: boolean },\n ): Promise<CompiledTeal> {\n let tealCode = AppManager.stripTealComments(tealTemplateCode)\n\n tealCode = AppManager.replaceTealTemplateParams(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await this.compileTeal(tealCode)\n }\n\n /**\n * Returns a previous compilation result.\n * @param tealCode The TEAL code\n * @returns The information about the previously compiled file\n * or `undefined` if that TEAL code wasn't previously compiled\n * @example\n * ```typescript\n * const compiled = appManager.getCompilationResult(tealProgram)\n * ```\n */\n getCompilationResult(tealCode: string): CompiledTeal | undefined {\n return this._compilationResults[tealCode]\n }\n\n /**\n * Returns the current app information for the app with the given ID.\n *\n * @example\n * ```typescript\n * const appInfo = await appManager.getById(12353n);\n * ```\n *\n * @param appId The ID of the app\n * @returns The app information\n */\n public async getById(appId: bigint): Promise<AppInformation> {\n const app = await this._algod.getApplicationByID(Number(appId)).do()\n return {\n appId: BigInt(app.id),\n appAddress: algosdk.getApplicationAddress(app.id),\n approvalProgram: app.params.approvalProgram,\n clearStateProgram: app.params.clearStateProgram,\n creator: app.params.creator,\n localInts: Number(app.params.localStateSchema?.numUint ?? 0),\n localByteSlices: Number(app.params.localStateSchema?.numByteSlice ?? 0),\n globalInts: Number(app.params.globalStateSchema?.numUint ?? 0),\n globalByteSlices: Number(app.params.globalStateSchema?.numByteSlice ?? 0),\n extraProgramPages: Number(app.params.extraProgramPages ?? 0),\n globalState: AppManager.decodeAppState(app.params.globalState ?? []),\n }\n }\n\n /**\n * Returns the current global state values for the given app ID and account address\n *\n * @param appId The ID of the app to return global state for\n * @returns The current global state for the given app\n * @example\n * ```typescript\n * const globalState = await appManager.getGlobalState(12353n);\n * ```\n */\n public async getGlobalState(appId: bigint) {\n return (await this.getById(appId)).globalState\n }\n\n /**\n * Returns the current local state values for the given app ID and account address\n *\n * @param appId The ID of the app to return local state for\n * @param address The string address of the account to get local state for the given app\n * @returns The current local state for the given (app, account) combination\n * @example\n * ```typescript\n * const localState = await appManager.getLocalState(12353n, 'ACCOUNTADDRESS');\n * ```\n */\n public async getLocalState(appId: bigint, address: Address | string) {\n const appInfo = await this._algod.accountApplicationInformation(address, appId).do()\n\n if (!appInfo.appLocalState?.keyValue) {\n throw new Error(\"Couldn't find local state\")\n }\n\n return AppManager.decodeAppState(appInfo.appLocalState.keyValue)\n }\n\n /**\n * Returns the names of the current boxes for the given app.\n * @param appId The ID of the app return box names for\n * @returns The current box names\n * @example\n * ```typescript\n * const boxNames = await appManager.getBoxNames(12353n);\n * ```\n */\n public async getBoxNames(appId: bigint): Promise<BoxName[]> {\n const boxResult = await this._algod.getApplicationBoxes(appId).do()\n return boxResult.boxes.map((b) => {\n return {\n nameRaw: b.name,\n nameBase64: Buffer.from(b.name).toString('base64'),\n name: Buffer.from(b.name).toString('utf-8'),\n }\n })\n }\n\n /**\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @returns The current box value as a byte array\n * @example\n * ```typescript\n * const boxValue = await appManager.getBoxValue(12353n, 'boxName');\n * ```\n */\n public async getBoxValue(appId: bigint, boxName: BoxIdentifier | BoxName): Promise<Uint8Array> {\n const boxId = typeof boxName === 'object' && 'nameRaw' in boxName ? boxName.nameRaw : boxName\n const name = AppManager.getBoxReference(boxId).name\n const boxResult = await this._algod.getApplicationBoxByName(Number(appId), name).do()\n return boxResult.value\n }\n\n /**\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @returns The current box values as a byte array in the same order as the passed in box names\n * @example\n * ```typescript\n * const boxValues = await appManager.getBoxValues(12353n, ['boxName1', 'boxName2']);\n * ```\n */\n public async getBoxValues(appId: bigint, boxNames: (BoxIdentifier | BoxName)[]): Promise<Uint8Array[]> {\n return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValue(appId, boxName)))\n }\n\n /**\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @returns The current box value as an ABI value\n * @example\n * ```typescript\n * const boxValue = await appManager.getBoxValueFromABIType({ appId: 12353n, boxName: 'boxName', type: new ABIUintType(32) });\n * ```\n */\n public async getBoxValueFromABIType(request: BoxValueRequestParams): Promise<algosdk.ABIValue> {\n const { appId, boxName, type } = request\n const value = await this.getBoxValue(appId, boxName)\n return type.decode(value)\n }\n\n /**\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @returns The current box values as an ABI value in the same order as the passed in box names\n * @example\n * ```typescript\n * const boxValues = await appManager.getBoxValuesFromABIType({ appId: 12353n, boxNames: ['boxName1', 'boxName2'], type: new ABIUintType(32) });\n * ```\n */\n public async getBoxValuesFromABIType(request: BoxValuesRequestParams): Promise<algosdk.ABIValue[]> {\n const { appId, boxNames, type } = request\n return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValueFromABIType({ appId, boxName, type })))\n }\n\n /**\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param boxId The box to return a reference for\n * @returns The box reference ready to pass into a `algosdk.Transaction`\n * @example\n * ```typescript\n * const boxRef = AppManager.getBoxReference('boxName');\n * ```\n */\n public static getBoxReference(boxId: BoxIdentifier | BoxReference): algosdk.BoxReference {\n const ref = typeof boxId === 'object' && 'appId' in boxId ? boxId : { appId: 0n, name: boxId }\n return {\n appIndex: ref.appId,\n name: typeof ref.name === 'string' ? new TextEncoder().encode(ref.name) : 'length' in ref.name ? ref.name : ref.name.addr.publicKey,\n } as algosdk.BoxReference\n }\n\n /**\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n * @example\n * ```typescript\n * const stateValues = AppManager.decodeAppState(state);\n * ```\n */\n public static decodeAppState(state: { key: Uint8Array; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n const stateValues = {} as AppState\n\n // Start with empty set\n for (const stateVal of state) {\n const keyBase64 = Buffer.from(stateVal.key).toString('base64')\n const keyRaw = stateVal.key\n const key = Buffer.from(stateVal.key).toString('utf-8')\n const tealValue = stateVal.value\n\n const dataTypeFlag = 'action' in tealValue ? tealValue.action : tealValue.type\n let valueBase64: string\n let valueRaw: Buffer\n switch (dataTypeFlag) {\n case 1:\n valueBase64 =\n typeof tealValue.bytes === 'string' ? tealValue.bytes : tealValue.bytes ? Buffer.from(tealValue.bytes).toString('base64') : ''\n valueRaw = Buffer.from(valueBase64, 'base64')\n stateValues[key] = {\n keyRaw,\n keyBase64,\n valueRaw: new Uint8Array(valueRaw),\n valueBase64: valueBase64,\n value: valueRaw.toString('utf-8'),\n }\n break\n case 2: {\n const value = tealValue.uint ?? 0\n stateValues[key] = {\n keyRaw,\n keyBase64,\n value: BigInt(value),\n }\n break\n }\n default:\n throw new Error(`Received unknown state data type of ${dataTypeFlag}`)\n }\n }\n\n return stateValues\n }\n\n /**\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param confirmation The transaction confirmation from algod\n * @param method The ABI method\n * @returns The return value for the method call\n * @example\n * ```typescript\n * const returnValue = AppManager.getABIReturn(confirmation, ABIMethod.fromSignature('hello(string)void'));\n * ```\n */\n public static getABIReturn(\n confirmation: modelsv2.PendingTransactionResponse | undefined,\n method: algosdk.ABIMethod | undefined,\n ): ABIReturn | undefined {\n if (!method || !confirmation || method.returns.type === 'void') {\n return undefined\n }\n\n // The parseMethodResponse method mutates the second parameter :(\n const resultDummy: algosdk.ABIResult = {\n txID: '',\n method,\n rawReturnValue: new Uint8Array(),\n }\n return getABIReturnValue(algosdk.AtomicTransactionComposer.parseMethodResponse(method, resultDummy, confirmation), method.returns.type)\n }\n\n /**\n * Replaces AlgoKit deploy-time deployment control parameters within the given TEAL template code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are defined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealTemplateCode The TEAL template code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n * @example\n * ```typescript\n * const tealCode = AppManager.replaceTealTemplateDeployTimeControlParams(tealTemplate, { updatable: true, deletable: false });\n * ```\n */\n static replaceTealTemplateDeployTimeControlParams(tealTemplateCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n if (params.updatable !== undefined) {\n if (!tealTemplateCode.includes(UPDATABLE_TEMPLATE_NAME)) {\n throw new Error(\n `Deploy-time updatability control requested for app deployment, but ${UPDATABLE_TEMPLATE_NAME} not present in TEAL code`,\n )\n }\n tealTemplateCode = replaceTemplateVariable(tealTemplateCode, UPDATABLE_TEMPLATE_NAME, (params.updatable ? 1 : 0).toString())\n }\n\n if (params.deletable !== undefined) {\n if (!tealTemplateCode.includes(DELETABLE_TEMPLATE_NAME)) {\n throw new Error(\n `Deploy-time deletability control requested for app deployment, but ${DELETABLE_TEMPLATE_NAME} not present in TEAL code`,\n )\n }\n tealTemplateCode = replaceTemplateVariable(tealTemplateCode, DELETABLE_TEMPLATE_NAME, (params.deletable ? 1 : 0).toString())\n }\n\n return tealTemplateCode\n }\n\n /**\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealTemplateCode The TEAL template code to make parameter replacements in\n * @param templateParams Any parameters to replace in the teal code\n * @returns The TEAL code with replacements\n * @example\n * ```typescript\n * const tealCode = AppManager.replaceTealTemplateParams(tealTemplate, { TMPL_APP_ID: 12345n });\n * ```\n */\n static replaceTealTemplateParams(tealTemplateCode: string, templateParams?: TealTemplateParams) {\n if (templateParams !== undefined) {\n for (const key in templateParams) {\n const value = templateParams[key]\n const token = `TMPL_${key.replace(/^TMPL_/, '')}`\n\n // If this is a number, first replace any byte representations of the number\n // These may appear in the TEAL in order to circumvent int compression and preserve PC values\n if (typeof value === 'number' || typeof value === 'bigint') {\n tealTemplateCode = tealTemplateCode.replace(new RegExp(`(?<=bytes )${token}`, 'g'), `0x${value.toString(16).padStart(16, '0')}`)\n\n // We could probably return here since mixing pushint and pushbytes is likely not going to happen, but might as well do both\n }\n\n tealTemplateCode = replaceTemplateVariable(\n tealTemplateCode,\n token,\n typeof value === 'string'\n ? `0x${Buffer.from(value, 'utf-8').toString('hex')}`\n : ArrayBuffer.isView(value)\n ? `0x${Buffer.from(value).toString('hex')}`\n : value.toString(),\n )\n }\n }\n\n return tealTemplateCode\n }\n\n /**\n * Remove comments from TEAL code (useful to reduce code size before compilation).\n *\n * @param tealCode The TEAL logic to strip\n * @returns The TEAL without comments\n * @example\n * ```typescript\n * const stripped = AppManager.stripTealComments(tealProgram);\n * ```\n */\n static stripTealComments(tealCode: string) {\n const stripCommentFromLine = (line: string) => {\n const commentIndex = findUnquotedString(line, '//')\n if (commentIndex === undefined) {\n return line\n }\n return line.slice(0, commentIndex).trimEnd()\n }\n\n return tealCode\n .split('\\n')\n .map((line) => stripCommentFromLine(line))\n .join('\\n')\n }\n}\n\nfunction getHoldingReference(holdingReference: HoldingReference): algosdk.TransactionHoldingReference {\n return {\n assetIndex: holdingReference.assetId,\n address: typeof holdingReference.address === 'string' ? Address.fromString(holdingReference.address) : holdingReference.address!,\n } satisfies algosdk.TransactionHoldingReference\n}\n\nfunction getLocalsReference(localsReference: LocalsReference): algosdk.TransactionLocalsReference {\n return {\n appIndex: localsReference.appId,\n address: typeof localsReference.address === 'string' ? Address.fromString(localsReference.address) : localsReference.address!,\n } satisfies algosdk.TransactionLocalsReference\n}\n\n/**\n * Returns an `algosdk.TransactionResourceReference` given a `AccessReference`.\n */\nexport function getAccessReference(accessReference: AccessReference): algosdk.TransactionResourceReference {\n return {\n address: typeof accessReference.address === 'string' ? Address.fromString(accessReference.address) : accessReference.address,\n appIndex: accessReference.appId,\n assetIndex: accessReference.assetId,\n holding: accessReference.holding ? getHoldingReference(accessReference.holding) : undefined,\n locals: accessReference.locals ? getLocalsReference(accessReference.locals) : undefined,\n box: accessReference.box ? AppManager.getBoxReference(accessReference.box) : undefined,\n } as algosdk.TransactionResourceReference\n}\n\n/**\n * Find the first string within a line of TEAL. Only matches outside of quotes and base64 are returned.\n * Returns undefined if not found\n */\nconst findUnquotedString = (line: string, token: string, startIndex: number = 0, _endIndex?: number): number | undefined => {\n const endIndex = _endIndex === undefined ? line.length : _endIndex\n let index = startIndex\n let inQuotes = false\n let inBase64 = false\n\n while (index < endIndex) {\n const currentChar = line[index]\n if ((currentChar === ' ' || currentChar === '(') && !inQuotes && lastTokenBase64(line, index)) {\n // enter base64\n inBase64 = true\n } else if ((currentChar === ' ' || currentChar === ')') && !inQuotes && inBase64) {\n // exit base64\n inBase64 = false\n } else if (currentChar === '\\\\' && inQuotes) {\n // escaped char, skip next character\n index += 1\n } else if (currentChar === '\"') {\n // quote boundary\n inQuotes = !inQuotes\n } else if (!inQuotes && !inBase64 && line.startsWith(token, index)) {\n // can test for match\n return index\n }\n index += 1\n }\n return undefined\n}\n\nconst lastTokenBase64 = (line: string, index: number): boolean => {\n try {\n const tokens = line.slice(0, index).split(/\\s+/)\n const last = tokens[tokens.length - 1]\n return ['base64', 'b64'].includes(last)\n } catch {\n return false\n }\n}\n\nfunction replaceTemplateVariable(program: string, token: string, replacement: string): string {\n const result: string[] = []\n const tokenIndexOffset = replacement.length - token.length\n\n const programLines = program.split('\\n')\n\n for (const line of programLines) {\n const _commentIndex = findUnquotedString(line, '//')\n const commentIndex = _commentIndex === undefined ? line.length : _commentIndex\n let code = line.substring(0, commentIndex)\n const comment = line.substring(commentIndex)\n let trailingIndex = 0\n\n while (true) {\n const tokenIndex = findTemplateToken(code, token, trailingIndex)\n if (tokenIndex === undefined) {\n break\n }\n trailingIndex = tokenIndex + token.length\n const prefix = code.substring(0, tokenIndex)\n const suffix = code.substring(trailingIndex)\n code = `${prefix}${replacement}${suffix}`\n trailingIndex += tokenIndexOffset\n }\n result.push(code + comment)\n }\n\n return result.join('\\n')\n}\n\nconst findTemplateToken = (line: string, token: string, startIndex: number = 0, _endIndex?: number): number | undefined => {\n const endIndex = _endIndex === undefined ? line.length : _endIndex\n\n let index = startIndex\n while (index < endIndex) {\n const tokenIndex = findUnquotedString(line, token, index, endIndex)\n if (tokenIndex === undefined) {\n break\n }\n const trailingIndex = tokenIndex + token.length\n if (\n (tokenIndex === 0 || !isValidTokenCharacter(line[tokenIndex - 1])) &&\n (trailingIndex >= line.length || !isValidTokenCharacter(line[trailingIndex]))\n ) {\n return tokenIndex\n }\n index = trailingIndex\n }\n return undefined\n}\n\nfunction isValidTokenCharacter(char: string): boolean {\n return char.length === 1 && (/\\w/.test(char) || char === '_')\n}\n"],"names":["ProgramSourceMap","getABIReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME","Address"],"mappings":";;;;;;AAsIA;MACa,UAAU,CAAA;AAIrB;;;AAGG;AACH,IAAA,WAAA,CAAY,KAAsB,EAAA;QAN1B,IAAmB,CAAA,mBAAA,GAAiC,EAAE;AAO5D,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;;AAGrB;;;;;;;;;;;;;;AAcG;IACH,MAAM,WAAW,CAAC,QAAgB,EAAA;AAChC,QAAA,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE;AACtC,YAAA,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC;;AAG3C,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE;AACzE,QAAA,MAAM,MAAM,GAAG;AACb,YAAA,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,YAAY,EAAE,QAAQ,CAAC,IAAI;AAC3B,YAAA,qBAAqB,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAA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ent":["import algosdk, { Address, ProgramSourceMap } from 'algosdk'\nimport { getABIReturnValue } from '../transaction/transaction'\nimport { TransactionSignerAccount } from './account'\nimport {\n BoxName,\n DELETABLE_TEMPLATE_NAME,\n UPDATABLE_TEMPLATE_NAME,\n type ABIReturn,\n type AppState,\n type CompiledTeal,\n type TealTemplateParams,\n} from './app'\nimport modelsv2 = algosdk.modelsv2\n\n/** Information about an app. */\nexport interface AppInformation {\n /** The ID of the app. */\n appId: bigint\n /** The escrow address that the app operates with. */\n appAddress: Address\n /**\n * Approval program.\n */\n approvalProgram: Uint8Array\n /**\n * Clear state program.\n */\n clearStateProgram: Uint8Array\n /**\n * The address that created this application. This is the address where the\n * parameters and global state for this application can be found.\n */\n creator: Address\n /**\n * Current global state values.\n */\n globalState: AppState\n /** The number of allocated ints in per-user local state. */\n localInts: number\n /** The number of allocated byte slices in per-user local state. */\n localByteSlices: number\n /** The number of allocated ints in global state. */\n globalInts: number\n /** The number of allocated byte slices in global state. */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract. */\n extraProgramPages?: number\n /** The number of updates to the application programs */\n version?: number\n}\n\n/**\n * Something that identifies an app box name - either a:\n * * `Uint8Array` (the actual binary of the box name)\n * * `string` (that will be encoded to a `Uint8Array`)\n * * `TransactionSignerAccount` (that will be encoded into the\n * public key address of the corresponding account)\n */\nexport type BoxIdentifier = string | Uint8Array | TransactionSignerAccount\n\n/**\n * A grouping of the app ID and name identifier to reference an app box.\n */\nexport interface BoxReference {\n /**\n * A unique application id\n */\n appId: bigint\n /**\n * Identifier for a box name\n */\n name: BoxIdentifier\n}\n\n/**\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: BoxIdentifier\n /** The ABI type to decode the value using */\n type: algosdk.ABIType\n}\n\n/**\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: bigint\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: BoxIdentifier[]\n /** The ABI type to decode the value using */\n type: algosdk.ABIType\n}\n\n/**\n * Defines a holding by referring to an Address and Asset it belongs to.\n */\nexport interface HoldingReference {\n /** Asset ID for asset in access list. */\n assetId: bigint\n /** Address in access list, or the sender of the transaction. */\n address: string | Address\n}\n\n/**\n * Defines a local state by referring to an Address and App it belongs to.\n */\nexport interface LocalsReference {\n /** Application ID for app in access list, or zero if referring to the called application. */\n appId: bigint\n /** Address in access list, or the sender of the transaction. */\n address: string | Address\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport interface ResourceReference {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: string | Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/** Allows management of application information. */\nexport class AppManager {\n private _algod: algosdk.Algodv2\n private _compilationResults: Record<string, CompiledTeal> = {}\n\n /**\n * Creates an `AppManager`\n * @param algod An algod instance\n */\n constructor(algod: algosdk.Algodv2) {\n this._algod = algod\n }\n\n /**\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * The result of this compilation is also cached keyed by the TEAL\n * code so it can be retrieved via `getCompilationResult`.\n *\n * This function is re-entrant; it will only compile the same code once.\n *\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n * @example\n * ```typescript\n * const compiled = await appManager.compileTeal(tealProgram)\n * ```\n */\n async compileTeal(tealCode: string): Promise<CompiledTeal> {\n if (this._compilationResults[tealCode]) {\n return this._compilationResults[tealCode]\n }\n\n const compiled = await this._algod.compile(tealCode).sourcemap(true).do()\n const result = {\n teal: tealCode,\n compiled: compiled.result,\n compiledHash: compiled.hash,\n compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')),\n sourceMap: new ProgramSourceMap(JSON.parse(algosdk.encodeJSON(compiled.sourcemap!))),\n }\n this._compilationResults[tealCode] = result\n\n return result\n }\n\n /**\n * Performs template substitution of a teal template and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements and replaces AlgoKit deploy-time control parameters\n * if deployment metadata is specified.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * @param tealTemplateCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n * @example\n * ```typescript\n * const compiled = await appManager.compileTealTemplate(tealTemplate, { TMPL_APP_ID: 12345n }, { updatable: true, deletable: false })\n * ```\n */\n async compileTealTemplate(\n tealTemplateCode: string,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: { updatable?: boolean; deletable?: boolean },\n ): Promise<CompiledTeal> {\n let tealCode = AppManager.stripTealComments(tealTemplateCode)\n\n tealCode = AppManager.replaceTealTemplateParams(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await this.compileTeal(tealCode)\n }\n\n /**\n * Returns a previous compilation result.\n * @param tealCode The TEAL code\n * @returns The information about the previously compiled file\n * or `undefined` if that TEAL code wasn't previously compiled\n * @example\n * ```typescript\n * const compiled = appManager.getCompilationResult(tealProgram)\n * ```\n */\n getCompilationResult(tealCode: string): CompiledTeal | undefined {\n return this._compilationResults[tealCode]\n }\n\n /**\n * Returns the current app information for the app with the given ID.\n *\n * @example\n * ```typescript\n * const appInfo = await appManager.getById(12353n);\n * ```\n *\n * @param appId The ID of the app\n * @returns The app information\n */\n public async getById(appId: bigint): Promise<AppInformation> {\n const app = await this._algod.getApplicationByID(Number(appId)).do()\n return {\n appId: BigInt(app.id),\n appAddress: algosdk.getApplicationAddress(app.id),\n approvalProgram: app.params.approvalProgram,\n clearStateProgram: app.params.clearStateProgram,\n creator: app.params.creator,\n localInts: Number(app.params.localStateSchema?.numUint ?? 0),\n localByteSlices: Number(app.params.localStateSchema?.numByteSlice ?? 0),\n globalInts: Number(app.params.globalStateSchema?.numUint ?? 0),\n globalByteSlices: Number(app.params.globalStateSchema?.numByteSlice ?? 0),\n extraProgramPages: Number(app.params.extraProgramPages ?? 0),\n globalState: AppManager.decodeAppState(app.params.globalState ?? []),\n version: app.params.version,\n }\n }\n\n /**\n * Returns the current global state values for the given app ID and account address\n *\n * @param appId The ID of the app to return global state for\n * @returns The current global state for the given app\n * @example\n * ```typescript\n * const globalState = await appManager.getGlobalState(12353n);\n * ```\n */\n public async getGlobalState(appId: bigint) {\n return (await this.getById(appId)).globalState\n }\n\n /**\n * Returns the current local state values for the given app ID and account address\n *\n * @param appId The ID of the app to return local state for\n * @param address The string address of the account to get local state for the given app\n * @returns The current local state for the given (app, account) combination\n * @example\n * ```typescript\n * const localState = await appManager.getLocalState(12353n, 'ACCOUNTADDRESS');\n * ```\n */\n public async getLocalState(appId: bigint, address: Address | string) {\n const appInfo = await this._algod.accountApplicationInformation(address, appId).do()\n\n if (!appInfo.appLocalState?.keyValue) {\n throw new Error(\"Couldn't find local state\")\n }\n\n return AppManager.decodeAppState(appInfo.appLocalState.keyValue)\n }\n\n /**\n * Returns the names of the current boxes for the given app.\n * @param appId The ID of the app return box names for\n * @returns The current box names\n * @example\n * ```typescript\n * const boxNames = await appManager.getBoxNames(12353n);\n * ```\n */\n public async getBoxNames(appId: bigint): Promise<BoxName[]> {\n const boxResult = await this._algod.getApplicationBoxes(appId).do()\n return boxResult.boxes.map((b) => {\n return {\n nameRaw: b.name,\n nameBase64: Buffer.from(b.name).toString('base64'),\n name: Buffer.from(b.name).toString('utf-8'),\n }\n })\n }\n\n /**\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @returns The current box value as a byte array\n * @example\n * ```typescript\n * const boxValue = await appManager.getBoxValue(12353n, 'boxName');\n * ```\n */\n public async getBoxValue(appId: bigint, boxName: BoxIdentifier | BoxName): Promise<Uint8Array> {\n const boxId = typeof boxName === 'object' && 'nameRaw' in boxName ? boxName.nameRaw : boxName\n const name = AppManager.getBoxReference(boxId).name\n const boxResult = await this._algod.getApplicationBoxByName(Number(appId), name).do()\n return boxResult.value\n }\n\n /**\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @returns The current box values as a byte array in the same order as the passed in box names\n * @example\n * ```typescript\n * const boxValues = await appManager.getBoxValues(12353n, ['boxName1', 'boxName2']);\n * ```\n */\n public async getBoxValues(appId: bigint, boxNames: (BoxIdentifier | BoxName)[]): Promise<Uint8Array[]> {\n return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValue(appId, boxName)))\n }\n\n /**\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @returns The current box value as an ABI value\n * @example\n * ```typescript\n * const boxValue = await appManager.getBoxValueFromABIType({ appId: 12353n, boxName: 'boxName', type: new ABIUintType(32) });\n * ```\n */\n public async getBoxValueFromABIType(request: BoxValueRequestParams): Promise<algosdk.ABIValue> {\n const { appId, boxName, type } = request\n const value = await this.getBoxValue(appId, boxName)\n return type.decode(value)\n }\n\n /**\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @returns The current box values as an ABI value in the same order as the passed in box names\n * @example\n * ```typescript\n * const boxValues = await appManager.getBoxValuesFromABIType({ appId: 12353n, boxNames: ['boxName1', 'boxName2'], type: new ABIUintType(32) });\n * ```\n */\n public async getBoxValuesFromABIType(request: BoxValuesRequestParams): Promise<algosdk.ABIValue[]> {\n const { appId, boxNames, type } = request\n return await Promise.all(boxNames.map(async (boxName) => await this.getBoxValueFromABIType({ appId, boxName, type })))\n }\n\n /**\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param boxId The box to return a reference for\n * @returns The box reference ready to pass into a `algosdk.Transaction`\n * @example\n * ```typescript\n * const boxRef = AppManager.getBoxReference('boxName');\n * ```\n */\n public static getBoxReference(boxId: BoxIdentifier | BoxReference): algosdk.BoxReference {\n const ref = typeof boxId === 'object' && 'appId' in boxId ? boxId : { appId: 0n, name: boxId }\n return {\n appIndex: ref.appId,\n name: typeof ref.name === 'string' ? new TextEncoder().encode(ref.name) : 'length' in ref.name ? ref.name : ref.name.addr.publicKey,\n } as algosdk.BoxReference\n }\n\n /**\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n * @example\n * ```typescript\n * const stateValues = AppManager.decodeAppState(state);\n * ```\n */\n public static decodeAppState(state: { key: Uint8Array; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n const stateValues = {} as AppState\n\n // Start with empty set\n for (const stateVal of state) {\n const keyBase64 = Buffer.from(stateVal.key).toString('base64')\n const keyRaw = stateVal.key\n const key = Buffer.from(stateVal.key).toString('utf-8')\n const tealValue = stateVal.value\n\n const dataTypeFlag = 'action' in tealValue ? tealValue.action : tealValue.type\n let valueBase64: string\n let valueRaw: Buffer\n switch (dataTypeFlag) {\n case 1:\n valueBase64 =\n typeof tealValue.bytes === 'string' ? tealValue.bytes : tealValue.bytes ? Buffer.from(tealValue.bytes).toString('base64') : ''\n valueRaw = Buffer.from(valueBase64, 'base64')\n stateValues[key] = {\n keyRaw,\n keyBase64,\n valueRaw: new Uint8Array(valueRaw),\n valueBase64: valueBase64,\n value: valueRaw.toString('utf-8'),\n }\n break\n case 2: {\n const value = tealValue.uint ?? 0\n stateValues[key] = {\n keyRaw,\n keyBase64,\n value: BigInt(value),\n }\n break\n }\n default:\n throw new Error(`Received unknown state data type of ${dataTypeFlag}`)\n }\n }\n\n return stateValues\n }\n\n /**\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param confirmation The transaction confirmation from algod\n * @param method The ABI method\n * @returns The return value for the method call\n * @example\n * ```typescript\n * const returnValue = AppManager.getABIReturn(confirmation, ABIMethod.fromSignature('hello(string)void'));\n * ```\n */\n public static getABIReturn(\n confirmation: modelsv2.PendingTransactionResponse | undefined,\n method: algosdk.ABIMethod | undefined,\n ): ABIReturn | undefined {\n if (!method || !confirmation || method.returns.type === 'void') {\n return undefined\n }\n\n // The parseMethodResponse method mutates the second parameter :(\n const resultDummy: algosdk.ABIResult = {\n txID: '',\n method,\n rawReturnValue: new Uint8Array(),\n }\n return getABIReturnValue(algosdk.AtomicTransactionComposer.parseMethodResponse(method, resultDummy, confirmation), method.returns.type)\n }\n\n /**\n * Replaces AlgoKit deploy-time deployment control parameters within the given TEAL template code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are defined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealTemplateCode The TEAL template code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n * @example\n * ```typescript\n * const tealCode = AppManager.replaceTealTemplateDeployTimeControlParams(tealTemplate, { updatable: true, deletable: false });\n * ```\n */\n static replaceTealTemplateDeployTimeControlParams(tealTemplateCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n if (params.updatable !== undefined) {\n if (!tealTemplateCode.includes(UPDATABLE_TEMPLATE_NAME)) {\n throw new Error(\n `Deploy-time updatability control requested for app deployment, but ${UPDATABLE_TEMPLATE_NAME} not present in TEAL code`,\n )\n }\n tealTemplateCode = replaceTemplateVariable(tealTemplateCode, UPDATABLE_TEMPLATE_NAME, (params.updatable ? 1 : 0).toString())\n }\n\n if (params.deletable !== undefined) {\n if (!tealTemplateCode.includes(DELETABLE_TEMPLATE_NAME)) {\n throw new Error(\n `Deploy-time deletability control requested for app deployment, but ${DELETABLE_TEMPLATE_NAME} not present in TEAL code`,\n )\n }\n tealTemplateCode = replaceTemplateVariable(tealTemplateCode, DELETABLE_TEMPLATE_NAME, (params.deletable ? 1 : 0).toString())\n }\n\n return tealTemplateCode\n }\n\n /**\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealTemplateCode The TEAL template code to make parameter replacements in\n * @param templateParams Any parameters to replace in the teal code\n * @returns The TEAL code with replacements\n * @example\n * ```typescript\n * const tealCode = AppManager.replaceTealTemplateParams(tealTemplate, { TMPL_APP_ID: 12345n });\n * ```\n */\n static replaceTealTemplateParams(tealTemplateCode: string, templateParams?: TealTemplateParams) {\n if (templateParams !== undefined) {\n for (const key in templateParams) {\n const value = templateParams[key]\n const token = `TMPL_${key.replace(/^TMPL_/, '')}`\n\n // If this is a number, first replace any byte representations of the number\n // These may appear in the TEAL in order to circumvent int compression and preserve PC values\n if (typeof value === 'number' || typeof value === 'bigint') {\n tealTemplateCode = tealTemplateCode.replace(new RegExp(`(?<=bytes )${token}`, 'g'), `0x${value.toString(16).padStart(16, '0')}`)\n\n // We could probably return here since mixing pushint and pushbytes is likely not going to happen, but might as well do both\n }\n\n tealTemplateCode = replaceTemplateVariable(\n tealTemplateCode,\n token,\n typeof value === 'string'\n ? `0x${Buffer.from(value, 'utf-8').toString('hex')}`\n : ArrayBuffer.isView(value)\n ? `0x${Buffer.from(value).toString('hex')}`\n : value.toString(),\n )\n }\n }\n\n return tealTemplateCode\n }\n\n /**\n * Remove comments from TEAL code (useful to reduce code size before compilation).\n *\n * @param tealCode The TEAL logic to strip\n * @returns The TEAL without comments\n * @example\n * ```typescript\n * const stripped = AppManager.stripTealComments(tealProgram);\n * ```\n */\n static stripTealComments(tealCode: string) {\n const stripCommentFromLine = (line: string) => {\n const commentIndex = findUnquotedString(line, '//')\n if (commentIndex === undefined) {\n return line\n }\n return line.slice(0, commentIndex).trimEnd()\n }\n\n return tealCode\n .split('\\n')\n .map((line) => stripCommentFromLine(line))\n .join('\\n')\n }\n}\n\n/**\n * Find the first string within a line of TEAL. Only matches outside of quotes and base64 are returned.\n * Returns undefined if not found\n */\nconst findUnquotedString = (line: string, token: string, startIndex: number = 0, _endIndex?: number): number | undefined => {\n const endIndex = _endIndex === undefined ? line.length : _endIndex\n let index = startIndex\n let inQuotes = false\n let inBase64 = false\n\n while (index < endIndex) {\n const currentChar = line[index]\n if ((currentChar === ' ' || currentChar === '(') && !inQuotes && lastTokenBase64(line, index)) {\n // enter base64\n inBase64 = true\n } else if ((currentChar === ' ' || currentChar === ')') && !inQuotes && inBase64) {\n // exit base64\n inBase64 = false\n } else if (currentChar === '\\\\' && inQuotes) {\n // escaped char, skip next character\n index += 1\n } else if (currentChar === '\"') {\n // quote boundary\n inQuotes = !inQuotes\n } else if (!inQuotes && !inBase64 && line.startsWith(token, index)) {\n // can test for match\n return index\n }\n index += 1\n }\n return undefined\n}\n\nconst lastTokenBase64 = (line: string, index: number): boolean => {\n try {\n const tokens = line.slice(0, index).split(/\\s+/)\n const last = tokens[tokens.length - 1]\n return ['base64', 'b64'].includes(last)\n } catch {\n return false\n }\n}\n\nfunction replaceTemplateVariable(program: string, token: string, replacement: string): string {\n const result: string[] = []\n const tokenIndexOffset = replacement.length - token.length\n\n const programLines = program.split('\\n')\n\n for (const line of programLines) {\n const _commentIndex = findUnquotedString(line, '//')\n const commentIndex = _commentIndex === undefined ? line.length : _commentIndex\n let code = line.substring(0, commentIndex)\n const comment = line.substring(commentIndex)\n let trailingIndex = 0\n\n while (true) {\n const tokenIndex = findTemplateToken(code, token, trailingIndex)\n if (tokenIndex === undefined) {\n break\n }\n trailingIndex = tokenIndex + token.length\n const prefix = code.substring(0, tokenIndex)\n const suffix = code.substring(trailingIndex)\n code = `${prefix}${replacement}${suffix}`\n trailingIndex += tokenIndexOffset\n }\n result.push(code + comment)\n }\n\n return result.join('\\n')\n}\n\nconst findTemplateToken = (line: string, token: string, startIndex: number = 0, _endIndex?: number): number | undefined => {\n const endIndex = _endIndex === undefined ? line.length : _endIndex\n\n let index = startIndex\n while (index < endIndex) {\n const tokenIndex = findUnquotedString(line, token, index, endIndex)\n if (tokenIndex === undefined) {\n break\n }\n const trailingIndex = tokenIndex + token.length\n if (\n (tokenIndex === 0 || !isValidTokenCharacter(line[tokenIndex - 1])) &&\n (trailingIndex >= line.length || !isValidTokenCharacter(line[trailingIndex]))\n ) {\n return tokenIndex\n }\n index = trailingIndex\n }\n return undefined\n}\n\nfunction isValidTokenCharacter(char: string): boolean {\n return char.length === 1 && (/\\w/.test(char) || char === '_')\n}\n"],"names":["ProgramSourceMap","getABIReturnValue","UPDATABLE_TEMPLATE_NAME","DELETABLE_TEMPLATE_NAME"],"mappings":";;;;;;AAwIA;MACa,UAAU,CAAA;AAIrB;;;AAGG;AACH,IAAA,WAAA,CAAY,KAAsB,EAAA;QAN1B,IAAmB,CAAA,mBAAA,GAAiC,EAAE;AAO5D,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;;AAGrB;;;;;;;;;;;;;;AAcG;IACH,MAAM,WAAW,CAAC,QAAgB,EAAA;AAChC,QAAA,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE;AACtC,YAAA,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC;;AAG3C,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE;AACzE,QAAA,MAAM,MAAM,GAAG;AACb,YAAA,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,YAAY,EAAE,QAAQ,CAAC,IAAI;AAC3B,YAAA,qBAAqB,EA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AK,GAAG,aAAa;;AAEvB,IAAA,OAAO,SAAS;AAClB,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,CAAC;AAC/D;;;;"}
|
package/types/app-manager.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import algosdk, { ProgramSourceMap
|
|
1
|
+
import algosdk, { ProgramSourceMap } from 'algosdk';
|
|
2
2
|
import { getABIReturnValue } from '../transaction/transaction.mjs';
|
|
3
3
|
import { UPDATABLE_TEMPLATE_NAME, DELETABLE_TEMPLATE_NAME } from './app.mjs';
|
|
4
4
|
|
|
@@ -106,6 +106,7 @@ class AppManager {
|
|
|
106
106
|
globalByteSlices: Number(app.params.globalStateSchema?.numByteSlice ?? 0),
|
|
107
107
|
extraProgramPages: Number(app.params.extraProgramPages ?? 0),
|
|
108
108
|
globalState: AppManager.decodeAppState(app.params.globalState ?? []),
|
|
109
|
+
version: app.params.version,
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
@@ -390,31 +391,6 @@ class AppManager {
|
|
|
390
391
|
.join('\n');
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
|
-
function getHoldingReference(holdingReference) {
|
|
394
|
-
return {
|
|
395
|
-
assetIndex: holdingReference.assetId,
|
|
396
|
-
address: typeof holdingReference.address === 'string' ? Address.fromString(holdingReference.address) : holdingReference.address,
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
function getLocalsReference(localsReference) {
|
|
400
|
-
return {
|
|
401
|
-
appIndex: localsReference.appId,
|
|
402
|
-
address: typeof localsReference.address === 'string' ? Address.fromString(localsReference.address) : localsReference.address,
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Returns an `algosdk.TransactionResourceReference` given a `AccessReference`.
|
|
407
|
-
*/
|
|
408
|
-
function getAccessReference(accessReference) {
|
|
409
|
-
return {
|
|
410
|
-
address: typeof accessReference.address === 'string' ? Address.fromString(accessReference.address) : accessReference.address,
|
|
411
|
-
appIndex: accessReference.appId,
|
|
412
|
-
assetIndex: accessReference.assetId,
|
|
413
|
-
holding: accessReference.holding ? getHoldingReference(accessReference.holding) : undefined,
|
|
414
|
-
locals: accessReference.locals ? getLocalsReference(accessReference.locals) : undefined,
|
|
415
|
-
box: accessReference.box ? AppManager.getBoxReference(accessReference.box) : undefined,
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
394
|
/**
|
|
419
395
|
* Find the first string within a line of TEAL. Only matches outside of quotes and base64 are returned.
|
|
420
396
|
* Returns undefined if not found
|
|
@@ -506,5 +482,5 @@ function isValidTokenCharacter(char) {
|
|
|
506
482
|
return char.length === 1 && (/\w/.test(char) || char === '_');
|
|
507
483
|
}
|
|
508
484
|
|
|
509
|
-
export { AppManager
|
|
485
|
+
export { AppManager };
|
|
510
486
|
//# sourceMappingURL=app-manager.mjs.map
|