@algorandfoundation/algokit-utils 9.1.2 → 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/app.d.ts +1 -1
- package/package.json +2 -2
- 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/legacy-bridge.d.ts +1 -1
- package/transaction/transaction.d.ts +1 -1
- package/transaction/transaction.js +66 -26
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +66 -26
- package/transaction/transaction.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +20 -0
- package/types/algorand-client-transaction-creator.js +16 -0
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +16 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +116 -0
- package/types/algorand-client-transaction-sender.js +16 -0
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +16 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/app-client.d.ts +74 -0
- package/types/app-client.js +4 -1
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +4 -1
- package/types/app-client.mjs.map +1 -1
- 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 -0
- package/types/app-manager.d.ts +37 -0
- package/types/app-manager.js +1 -0
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +1 -0
- package/types/app-manager.mjs.map +1 -1
- package/types/composer.d.ts +21 -1
- package/types/composer.js +53 -2
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +53 -2
- 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,6 +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;
|
|
182
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
181
183
|
sender?: string | algosdk.Address | undefined;
|
|
182
184
|
method: string;
|
|
183
185
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -213,6 +215,7 @@ export declare class AppFactory {
|
|
|
213
215
|
note?: string | Uint8Array | undefined;
|
|
214
216
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
215
217
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
218
|
+
rejectVersion?: number | undefined;
|
|
216
219
|
lease?: string | Uint8Array | undefined;
|
|
217
220
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
218
221
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -224,6 +227,7 @@ export declare class AppFactory {
|
|
|
224
227
|
appReferences?: bigint[] | undefined;
|
|
225
228
|
assetReferences?: bigint[] | undefined;
|
|
226
229
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
230
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
227
231
|
sender?: string | algosdk.Address | undefined;
|
|
228
232
|
method: string;
|
|
229
233
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -241,6 +245,7 @@ export declare class AppFactory {
|
|
|
241
245
|
args?: Uint8Array[] | undefined;
|
|
242
246
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
243
247
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
248
|
+
rejectVersion?: number | undefined;
|
|
244
249
|
lease?: string | Uint8Array | undefined;
|
|
245
250
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
246
251
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -252,6 +257,7 @@ export declare class AppFactory {
|
|
|
252
257
|
appReferences?: bigint[] | undefined;
|
|
253
258
|
assetReferences?: bigint[] | undefined;
|
|
254
259
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
260
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
255
261
|
approvalProgram: string | Uint8Array;
|
|
256
262
|
clearStateProgram: string | Uint8Array;
|
|
257
263
|
schema?: {
|
|
@@ -280,6 +286,8 @@ export declare class AppFactory {
|
|
|
280
286
|
appReferences?: bigint[] | undefined;
|
|
281
287
|
assetReferences?: bigint[] | undefined;
|
|
282
288
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
289
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
290
|
+
rejectVersion?: number | undefined;
|
|
283
291
|
approvalProgram: string | Uint8Array;
|
|
284
292
|
clearStateProgram: string | Uint8Array;
|
|
285
293
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -291,6 +299,7 @@ export declare class AppFactory {
|
|
|
291
299
|
note?: string | Uint8Array | undefined;
|
|
292
300
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
293
301
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
302
|
+
rejectVersion?: number | undefined;
|
|
294
303
|
lease?: string | Uint8Array | undefined;
|
|
295
304
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
296
305
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -302,6 +311,7 @@ export declare class AppFactory {
|
|
|
302
311
|
appReferences?: bigint[] | undefined;
|
|
303
312
|
assetReferences?: bigint[] | undefined;
|
|
304
313
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
314
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
305
315
|
sender?: string | algosdk.Address | undefined;
|
|
306
316
|
method: string;
|
|
307
317
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -310,6 +320,7 @@ export declare class AppFactory {
|
|
|
310
320
|
note?: string | Uint8Array | undefined;
|
|
311
321
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
312
322
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
323
|
+
rejectVersion?: number | undefined;
|
|
313
324
|
lease?: string | Uint8Array | undefined;
|
|
314
325
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
315
326
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -321,6 +332,7 @@ export declare class AppFactory {
|
|
|
321
332
|
appReferences?: bigint[] | undefined;
|
|
322
333
|
assetReferences?: bigint[] | undefined;
|
|
323
334
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
335
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
324
336
|
sender?: string | algosdk.Address | undefined;
|
|
325
337
|
method: string;
|
|
326
338
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -335,6 +347,7 @@ export declare class AppFactory {
|
|
|
335
347
|
args?: Uint8Array[] | undefined;
|
|
336
348
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
337
349
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
350
|
+
rejectVersion?: number | undefined;
|
|
338
351
|
lease?: string | Uint8Array | undefined;
|
|
339
352
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
340
353
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -346,6 +359,7 @@ export declare class AppFactory {
|
|
|
346
359
|
appReferences?: bigint[] | undefined;
|
|
347
360
|
assetReferences?: bigint[] | undefined;
|
|
348
361
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
362
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
349
363
|
approvalProgram: string | Uint8Array;
|
|
350
364
|
clearStateProgram: string | Uint8Array;
|
|
351
365
|
schema?: {
|
|
@@ -374,6 +388,8 @@ export declare class AppFactory {
|
|
|
374
388
|
appReferences?: bigint[] | undefined;
|
|
375
389
|
assetReferences?: bigint[] | undefined;
|
|
376
390
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
391
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
392
|
+
rejectVersion?: number | undefined;
|
|
377
393
|
approvalProgram: string | Uint8Array;
|
|
378
394
|
clearStateProgram: string | Uint8Array;
|
|
379
395
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -385,6 +401,7 @@ export declare class AppFactory {
|
|
|
385
401
|
note?: string | Uint8Array | undefined;
|
|
386
402
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
387
403
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
404
|
+
rejectVersion?: number | undefined;
|
|
388
405
|
lease?: string | Uint8Array | undefined;
|
|
389
406
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
390
407
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -396,6 +413,7 @@ export declare class AppFactory {
|
|
|
396
413
|
appReferences?: bigint[] | undefined;
|
|
397
414
|
assetReferences?: bigint[] | undefined;
|
|
398
415
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
416
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
399
417
|
sender?: string | algosdk.Address | undefined;
|
|
400
418
|
method: string;
|
|
401
419
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -404,6 +422,7 @@ export declare class AppFactory {
|
|
|
404
422
|
note?: string | Uint8Array | undefined;
|
|
405
423
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
406
424
|
onComplete?: algosdk.OnApplicationComplete | undefined;
|
|
425
|
+
rejectVersion?: number | undefined;
|
|
407
426
|
lease?: string | Uint8Array | undefined;
|
|
408
427
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
409
428
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -415,6 +434,7 @@ export declare class AppFactory {
|
|
|
415
434
|
appReferences?: bigint[] | undefined;
|
|
416
435
|
assetReferences?: bigint[] | undefined;
|
|
417
436
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
437
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
418
438
|
sender?: string | algosdk.Address | undefined;
|
|
419
439
|
method: string;
|
|
420
440
|
args?: (algosdk.ABIValue | AppMethodCallTransactionArgument | ABIStruct | undefined)[] | undefined;
|
|
@@ -429,6 +449,7 @@ export declare class AppFactory {
|
|
|
429
449
|
args?: Uint8Array[] | undefined;
|
|
430
450
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
431
451
|
onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
|
|
452
|
+
rejectVersion?: number | undefined;
|
|
432
453
|
lease?: string | Uint8Array | undefined;
|
|
433
454
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
434
455
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -440,6 +461,7 @@ export declare class AppFactory {
|
|
|
440
461
|
appReferences?: bigint[] | undefined;
|
|
441
462
|
assetReferences?: bigint[] | undefined;
|
|
442
463
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
464
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
443
465
|
approvalProgram: string | Uint8Array;
|
|
444
466
|
clearStateProgram: string | Uint8Array;
|
|
445
467
|
schema?: {
|
|
@@ -468,6 +490,8 @@ export declare class AppFactory {
|
|
|
468
490
|
appReferences?: bigint[] | undefined;
|
|
469
491
|
assetReferences?: bigint[] | undefined;
|
|
470
492
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
493
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
494
|
+
rejectVersion?: number | undefined;
|
|
471
495
|
approvalProgram: string | Uint8Array;
|
|
472
496
|
clearStateProgram: string | Uint8Array;
|
|
473
497
|
}> | AppMethodCall<import("./composer").AppMethodCallParams> | undefined)[] | undefined;
|
|
@@ -480,6 +504,7 @@ export declare class AppFactory {
|
|
|
480
504
|
note?: string | Uint8Array | undefined;
|
|
481
505
|
args?: Uint8Array[] | undefined;
|
|
482
506
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
507
|
+
rejectVersion?: number | undefined;
|
|
483
508
|
lease?: string | Uint8Array | undefined;
|
|
484
509
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
485
510
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -491,6 +516,7 @@ export declare class AppFactory {
|
|
|
491
516
|
appReferences?: bigint[] | undefined;
|
|
492
517
|
assetReferences?: bigint[] | undefined;
|
|
493
518
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
519
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
494
520
|
sender?: string | algosdk.Address | undefined;
|
|
495
521
|
deployTimeParams?: TealTemplateParams | undefined;
|
|
496
522
|
updatable?: boolean | undefined;
|
|
@@ -527,6 +553,7 @@ export declare class AppFactory {
|
|
|
527
553
|
note?: string | Uint8Array | undefined;
|
|
528
554
|
args?: Uint8Array[] | undefined;
|
|
529
555
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
556
|
+
rejectVersion?: number | undefined;
|
|
530
557
|
lease?: string | Uint8Array | undefined;
|
|
531
558
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
532
559
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -538,6 +565,7 @@ export declare class AppFactory {
|
|
|
538
565
|
appReferences?: bigint[] | undefined;
|
|
539
566
|
assetReferences?: bigint[] | undefined;
|
|
540
567
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
568
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
541
569
|
sender?: string | algosdk.Address | undefined;
|
|
542
570
|
updatable?: boolean | undefined;
|
|
543
571
|
deletable?: boolean | undefined;
|
|
@@ -554,6 +582,7 @@ export declare class AppFactory {
|
|
|
554
582
|
note?: string | Uint8Array | undefined;
|
|
555
583
|
args?: Uint8Array[] | undefined;
|
|
556
584
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
585
|
+
rejectVersion?: number | undefined;
|
|
557
586
|
lease?: string | Uint8Array | undefined;
|
|
558
587
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
559
588
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -565,12 +594,14 @@ export declare class AppFactory {
|
|
|
565
594
|
appReferences?: bigint[] | undefined;
|
|
566
595
|
assetReferences?: bigint[] | undefined;
|
|
567
596
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
597
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
568
598
|
sender?: string | algosdk.Address | undefined;
|
|
569
599
|
} | undefined) => {
|
|
570
600
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
571
601
|
note?: string | Uint8Array | undefined;
|
|
572
602
|
args?: Uint8Array[] | undefined;
|
|
573
603
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
604
|
+
rejectVersion?: number | undefined;
|
|
574
605
|
lease?: string | Uint8Array | undefined;
|
|
575
606
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
576
607
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -582,6 +613,7 @@ export declare class AppFactory {
|
|
|
582
613
|
appReferences?: bigint[] | undefined;
|
|
583
614
|
assetReferences?: bigint[] | undefined;
|
|
584
615
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
616
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
585
617
|
sender?: string | algosdk.Address | undefined;
|
|
586
618
|
} & {
|
|
587
619
|
sender: algosdk.Address;
|
|
@@ -594,6 +626,7 @@ export declare class AppFactory {
|
|
|
594
626
|
note?: string | Uint8Array | undefined;
|
|
595
627
|
args?: Uint8Array[] | undefined;
|
|
596
628
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
629
|
+
rejectVersion?: number | undefined;
|
|
597
630
|
lease?: string | Uint8Array | undefined;
|
|
598
631
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
599
632
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -605,12 +638,14 @@ export declare class AppFactory {
|
|
|
605
638
|
appReferences?: bigint[] | undefined;
|
|
606
639
|
assetReferences?: bigint[] | undefined;
|
|
607
640
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
641
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
608
642
|
sender?: string | algosdk.Address | undefined;
|
|
609
643
|
} | undefined) => {
|
|
610
644
|
maxFee?: import("./amount").AlgoAmount | undefined;
|
|
611
645
|
note?: string | Uint8Array | undefined;
|
|
612
646
|
args?: Uint8Array[] | undefined;
|
|
613
647
|
signer?: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
|
|
648
|
+
rejectVersion?: number | undefined;
|
|
614
649
|
lease?: string | Uint8Array | undefined;
|
|
615
650
|
rekeyTo?: string | algosdk.Address | undefined;
|
|
616
651
|
staticFee?: import("./amount").AlgoAmount | undefined;
|
|
@@ -622,6 +657,7 @@ export declare class AppFactory {
|
|
|
622
657
|
appReferences?: bigint[] | undefined;
|
|
623
658
|
assetReferences?: bigint[] | undefined;
|
|
624
659
|
boxReferences?: (import("./app-manager").BoxIdentifier | import("./app-manager").BoxReference)[] | undefined;
|
|
660
|
+
accessReferences?: import("./app-manager").ResourceReference[] | undefined;
|
|
625
661
|
sender?: string | algosdk.Address | undefined;
|
|
626
662
|
} & {
|
|
627
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:
|
|
@@ -79,6 +81,41 @@ export interface BoxValuesRequestParams {
|
|
|
79
81
|
/** The ABI type to decode the value using */
|
|
80
82
|
type: algosdk.ABIType;
|
|
81
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Defines a holding by referring to an Address and Asset it belongs to.
|
|
86
|
+
*/
|
|
87
|
+
export interface HoldingReference {
|
|
88
|
+
/** Asset ID for asset in access list. */
|
|
89
|
+
assetId: bigint;
|
|
90
|
+
/** Address in access list, or the sender of the transaction. */
|
|
91
|
+
address: string | Address;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Defines a local state by referring to an Address and App it belongs to.
|
|
95
|
+
*/
|
|
96
|
+
export interface LocalsReference {
|
|
97
|
+
/** Application ID for app in access list, or zero if referring to the called application. */
|
|
98
|
+
appId: bigint;
|
|
99
|
+
/** Address in access list, or the sender of the transaction. */
|
|
100
|
+
address: string | Address;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Names a single resource reference. Only one of the fields should be set.
|
|
104
|
+
*/
|
|
105
|
+
export interface ResourceReference {
|
|
106
|
+
/** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */
|
|
107
|
+
address?: string | Address;
|
|
108
|
+
/** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */
|
|
109
|
+
appId?: bigint;
|
|
110
|
+
/** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */
|
|
111
|
+
assetId?: bigint;
|
|
112
|
+
/** Defines a holding by referring to an Address and Asset it belongs to. */
|
|
113
|
+
holding?: HoldingReference;
|
|
114
|
+
/** Defines a local state by referring to an Address and App it belongs to. */
|
|
115
|
+
locals?: LocalsReference;
|
|
116
|
+
/** Defines a box by its name and the application ID it belongs to. */
|
|
117
|
+
box?: BoxReference;
|
|
118
|
+
}
|
|
82
119
|
/** Allows management of application information. */
|
|
83
120
|
export declare class AppManager {
|
|
84
121
|
private _algod;
|
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
|
/**
|
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/** 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\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":";;;;;;AAgGA;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,E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AAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAC7E;AACA,YAAA,OAAO,UAAU;;QAEnB,KAAK,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;;;;"}
|
|
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 /** 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,IA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AAK,EAAE,KAAK,EAAE,QAAQ,CAAC;AACnE,QAAA,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B;;AAEF,QAAA,MAAM,aAAa,GAAG,UAAU,GAAG,KAAK,CAAC,MAAM;AAC/C,QAAA,IACE,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;AACjE,aAAC,aAAa,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAC7E;AACA,YAAA,OAAO,UAAU;;QAEnB,KAAK,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
|
@@ -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
|
/**
|