@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.
Files changed (47) hide show
  1. package/app.d.ts +1 -1
  2. package/package.json +2 -2
  3. package/testing/fixtures/algorand-fixture.d.ts +3 -3
  4. package/testing/fixtures/algorand-fixture.js.map +1 -1
  5. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  6. package/transaction/legacy-bridge.d.ts +1 -1
  7. package/transaction/transaction.d.ts +1 -1
  8. package/transaction/transaction.js +66 -26
  9. package/transaction/transaction.js.map +1 -1
  10. package/transaction/transaction.mjs +66 -26
  11. package/transaction/transaction.mjs.map +1 -1
  12. package/types/algorand-client-transaction-creator.d.ts +20 -0
  13. package/types/algorand-client-transaction-creator.js +16 -0
  14. package/types/algorand-client-transaction-creator.js.map +1 -1
  15. package/types/algorand-client-transaction-creator.mjs +16 -0
  16. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  17. package/types/algorand-client-transaction-sender.d.ts +116 -0
  18. package/types/algorand-client-transaction-sender.js +16 -0
  19. package/types/algorand-client-transaction-sender.js.map +1 -1
  20. package/types/algorand-client-transaction-sender.mjs +16 -0
  21. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  22. package/types/app-client.d.ts +74 -0
  23. package/types/app-client.js +4 -1
  24. package/types/app-client.js.map +1 -1
  25. package/types/app-client.mjs +4 -1
  26. package/types/app-client.mjs.map +1 -1
  27. package/types/app-deployer.js +3 -3
  28. package/types/app-deployer.js.map +1 -1
  29. package/types/app-deployer.mjs +3 -3
  30. package/types/app-deployer.mjs.map +1 -1
  31. package/types/app-factory.d.ts +36 -0
  32. package/types/app-manager.d.ts +37 -0
  33. package/types/app-manager.js +1 -0
  34. package/types/app-manager.js.map +1 -1
  35. package/types/app-manager.mjs +1 -0
  36. package/types/app-manager.mjs.map +1 -1
  37. package/types/composer.d.ts +21 -1
  38. package/types/composer.js +53 -2
  39. package/types/composer.js.map +1 -1
  40. package/types/composer.mjs +53 -2
  41. package/types/composer.mjs.map +1 -1
  42. package/types/kmd-account-manager.d.ts +1 -0
  43. package/types/kmd-account-manager.js +33 -14
  44. package/types/kmd-account-manager.js.map +1 -1
  45. package/types/kmd-account-manager.mjs +33 -14
  46. package/types/kmd-account-manager.mjs.map +1 -1
  47. package/types/testing.d.ts +2 -2
@@ -399,6 +399,7 @@ class TransactionComposer {
399
399
  * appReferences: [123n, 1234n]
400
400
  * assetReferences: [12345n]
401
401
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
402
+ * accessReferences: [{ appId: 1234n }]
402
403
  * lease: 'lease',
403
404
  * note: 'note',
404
405
  * // You wouldn't normally set this field
@@ -409,6 +410,7 @@ class TransactionComposer {
409
410
  * // Max fee doesn't make sense with extraFee AND staticFee
410
411
  * // already specified, but here for completeness
411
412
  * maxFee: (3000).microAlgo(),
413
+ * rejectVersion: 1,
412
414
  * // Signer only needed if you want to provide one,
413
415
  * // generally you'd register it with AlgorandClient
414
416
  * // against the sender and not need to pass it in
@@ -444,6 +446,7 @@ class TransactionComposer {
444
446
  * appReferences: [123n, 1234n]
445
447
  * assetReferences: [12345n]
446
448
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
449
+ * accessReferences: [{ appId: 1234n }]
447
450
  * lease: 'lease',
448
451
  * note: 'note',
449
452
  * // You wouldn't normally set this field
@@ -454,6 +457,7 @@ class TransactionComposer {
454
457
  * // Max fee doesn't make sense with extraFee AND staticFee
455
458
  * // already specified, but here for completeness
456
459
  * maxFee: (3000).microAlgo(),
460
+ * rejectVersion: 1,
457
461
  *})
458
462
  * ```
459
463
  */
@@ -481,6 +485,7 @@ class TransactionComposer {
481
485
  * appReferences: [123n, 1234n]
482
486
  * assetReferences: [12345n]
483
487
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
488
+ * accessReferences: [{ appId: 1234n }]
484
489
  * lease: 'lease',
485
490
  * note: 'note',
486
491
  * // You wouldn't normally set this field
@@ -491,6 +496,7 @@ class TransactionComposer {
491
496
  * // Max fee doesn't make sense with extraFee AND staticFee
492
497
  * // already specified, but here for completeness
493
498
  * maxFee: (3000).microAlgo(),
499
+ * rejectVersion: 1,
494
500
  *})
495
501
  * ```
496
502
  */
@@ -520,6 +526,7 @@ class TransactionComposer {
520
526
  * appReferences: [123n, 1234n]
521
527
  * assetReferences: [12345n]
522
528
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
529
+ * accessReferences: [{ appId: 1234n }]
523
530
  * lease: 'lease',
524
531
  * note: 'note',
525
532
  * // You wouldn't normally set this field
@@ -530,6 +537,7 @@ class TransactionComposer {
530
537
  * // Max fee doesn't make sense with extraFee AND staticFee
531
538
  * // already specified, but here for completeness
532
539
  * maxFee: (3000).microAlgo(),
540
+ * rejectVersion: 1,
533
541
  *})
534
542
  * ```
535
543
  */
@@ -578,6 +586,7 @@ class TransactionComposer {
578
586
  * appReferences: [123n, 1234n]
579
587
  * assetReferences: [12345n]
580
588
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
589
+ * accessReferences: [{ appId: 1234n }]
581
590
  * lease: 'lease',
582
591
  * note: 'note',
583
592
  * // You wouldn't normally set this field
@@ -588,6 +597,7 @@ class TransactionComposer {
588
597
  * // Max fee doesn't make sense with extraFee AND staticFee
589
598
  * // already specified, but here for completeness
590
599
  * maxFee: (3000).microAlgo(),
600
+ * rejectVersion: 1,
591
601
  *})
592
602
  * ```
593
603
  */
@@ -629,6 +639,7 @@ class TransactionComposer {
629
639
  * appReferences: [123n, 1234n]
630
640
  * assetReferences: [12345n]
631
641
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
642
+ * accessReferences: [{ appId: 1234n }]
632
643
  * lease: 'lease',
633
644
  * note: 'note',
634
645
  * // You wouldn't normally set this field
@@ -639,6 +650,7 @@ class TransactionComposer {
639
650
  * // Max fee doesn't make sense with extraFee AND staticFee
640
651
  * // already specified, but here for completeness
641
652
  * maxFee: (3000).microAlgo(),
653
+ * rejectVersion: 1,
642
654
  *})
643
655
  * ```
644
656
  */
@@ -678,6 +690,7 @@ class TransactionComposer {
678
690
  * appReferences: [123n, 1234n]
679
691
  * assetReferences: [12345n]
680
692
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
693
+ * accessReferences: [{ appId: 1234n }]
681
694
  * lease: 'lease',
682
695
  * note: 'note',
683
696
  * // You wouldn't normally set this field
@@ -688,6 +701,7 @@ class TransactionComposer {
688
701
  * // Max fee doesn't make sense with extraFee AND staticFee
689
702
  * // already specified, but here for completeness
690
703
  * maxFee: (3000).microAlgo(),
704
+ * rejectVersion: 1,
691
705
  *})
692
706
  * ```
693
707
  */
@@ -727,6 +741,7 @@ class TransactionComposer {
727
741
  * appReferences: [123n, 1234n]
728
742
  * assetReferences: [12345n]
729
743
  * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
744
+ * accessReferences: [{ appId: 1234n }]
730
745
  * lease: 'lease',
731
746
  * note: 'note',
732
747
  * // You wouldn't normally set this field
@@ -737,6 +752,7 @@ class TransactionComposer {
737
752
  * // Max fee doesn't make sense with extraFee AND staticFee
738
753
  * // already specified, but here for completeness
739
754
  * maxFee: (3000).microAlgo(),
755
+ * rejectVersion: 1,
740
756
  *})
741
757
  * ```
742
758
  */
@@ -910,7 +926,12 @@ class TransactionComposer {
910
926
  const isAbiValue = (x) => {
911
927
  if (Array.isArray(x))
912
928
  return x.length == 0 || x.every(isAbiValue);
913
- return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array;
929
+ return (typeof x === 'bigint' ||
930
+ typeof x === 'boolean' ||
931
+ typeof x === 'number' ||
932
+ typeof x === 'string' ||
933
+ x instanceof Uint8Array ||
934
+ x instanceof algosdk.Address);
914
935
  };
915
936
  for (let i = (params.args ?? []).length - 1; i >= 0; i--) {
916
937
  const arg = params.args[i];
@@ -1005,6 +1026,7 @@ class TransactionComposer {
1005
1026
  appForeignApps: params.appReferences?.map((x) => Number(x)),
1006
1027
  appForeignAssets: params.assetReferences?.map((x) => Number(x)),
1007
1028
  boxes: params.boxReferences?.map(AppManager.getBoxReference),
1029
+ access: params.accessReferences?.map(getResourceReference),
1008
1030
  approvalProgram,
1009
1031
  clearProgram: clearStateProgram,
1010
1032
  extraPages: appId === 0
@@ -1035,6 +1057,7 @@ class TransactionComposer {
1035
1057
  return arg;
1036
1058
  })
1037
1059
  .reverse(),
1060
+ rejectVersion: params.rejectVersion,
1038
1061
  // note, lease, and rekeyTo are set in the common build step
1039
1062
  note: undefined,
1040
1063
  lease: undefined,
@@ -1144,8 +1167,10 @@ class TransactionComposer {
1144
1167
  foreignApps: params.appReferences?.map((x) => Number(x)),
1145
1168
  foreignAssets: params.assetReferences?.map((x) => Number(x)),
1146
1169
  boxes: params.boxReferences?.map(AppManager.getBoxReference),
1170
+ access: params.accessReferences?.map(getResourceReference),
1147
1171
  approvalProgram,
1148
1172
  clearProgram: clearStateProgram,
1173
+ rejectVersion: params.rejectVersion,
1149
1174
  };
1150
1175
  if (appId === 0n) {
1151
1176
  if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) {
@@ -1315,7 +1340,8 @@ class TransactionComposer {
1315
1340
  });
1316
1341
  this.atc['methodCalls'] = methodCalls;
1317
1342
  }
1318
- return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] };
1343
+ const transactions = this.atc.buildGroup();
1344
+ return { atc: this.atc, transactions, methodCalls: this.atc['methodCalls'] };
1319
1345
  }
1320
1346
  /**
1321
1347
  * Rebuild the group, discarding any previously built transactions.
@@ -1452,6 +1478,31 @@ class TransactionComposer {
1452
1478
  }
1453
1479
  /** Signer used to represent a lack of signer */
1454
1480
  TransactionComposer.NULL_SIGNER = algosdk.makeEmptyTransactionSigner();
1481
+ /**
1482
+ * Returns an `algosdk.TransactionResourceReference` given a `ResourceReference`.
1483
+ */
1484
+ function getResourceReference(accessReference) {
1485
+ return {
1486
+ address: typeof accessReference.address === 'string' ? Address.fromString(accessReference.address) : accessReference.address,
1487
+ appIndex: accessReference.appId,
1488
+ assetIndex: accessReference.assetId,
1489
+ holding: accessReference.holding ? getHoldingReference(accessReference.holding) : undefined,
1490
+ locals: accessReference.locals ? getLocalsReference(accessReference.locals) : undefined,
1491
+ box: accessReference.box ? AppManager.getBoxReference(accessReference.box) : undefined,
1492
+ };
1493
+ }
1494
+ function getHoldingReference(holdingReference) {
1495
+ return {
1496
+ assetIndex: holdingReference.assetId,
1497
+ address: typeof holdingReference.address === 'string' ? Address.fromString(holdingReference.address) : holdingReference.address,
1498
+ };
1499
+ }
1500
+ function getLocalsReference(localsReference) {
1501
+ return {
1502
+ appIndex: localsReference.appId,
1503
+ address: typeof localsReference.address === 'string' ? Address.fromString(localsReference.address) : localsReference.address,
1504
+ };
1505
+ }
1455
1506
 
1456
1507
  export { MAX_TRANSACTION_GROUP_SIZE, TransactionComposer };
1457
1508
  //# sourceMappingURL=composer.mjs.map