@algorandfoundation/algokit-utils 9.2.0-beta.7 → 9.2.0-beta.9

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.
@@ -2,7 +2,7 @@ import algosdk, { Address } from 'algosdk';
2
2
  import { Config } from '../config.mjs';
3
3
  import { encodeLease, sendAtomicTransactionComposer, getABIReturnValue } from '../transaction/transaction.mjs';
4
4
  import { calculateExtraProgramPages, asJson } from '../util.mjs';
5
- import { AppManager, getAccessReference } from './app-manager.mjs';
5
+ import { AppManager } from './app-manager.mjs';
6
6
  import { EventType } from './lifecycle-events.mjs';
7
7
  import { genesisIdIsLocalNet } from './network-client.mjs';
8
8
 
@@ -1018,7 +1018,7 @@ class TransactionComposer {
1018
1018
  appForeignApps: params.appReferences?.map((x) => Number(x)),
1019
1019
  appForeignAssets: params.assetReferences?.map((x) => Number(x)),
1020
1020
  boxes: params.boxReferences?.map(AppManager.getBoxReference),
1021
- access: params.accessReferences?.map(getAccessReference),
1021
+ access: params.accessReferences?.map(getResourceReference),
1022
1022
  approvalProgram,
1023
1023
  clearProgram: clearStateProgram,
1024
1024
  extraPages: appId === 0
@@ -1158,7 +1158,7 @@ class TransactionComposer {
1158
1158
  foreignApps: params.appReferences?.map((x) => Number(x)),
1159
1159
  foreignAssets: params.assetReferences?.map((x) => Number(x)),
1160
1160
  boxes: params.boxReferences?.map(AppManager.getBoxReference),
1161
- access: params.accessReferences?.map(getAccessReference),
1161
+ access: params.accessReferences?.map(getResourceReference),
1162
1162
  approvalProgram,
1163
1163
  clearProgram: clearStateProgram,
1164
1164
  };
@@ -1467,6 +1467,31 @@ class TransactionComposer {
1467
1467
  }
1468
1468
  /** Signer used to represent a lack of signer */
1469
1469
  TransactionComposer.NULL_SIGNER = algosdk.makeEmptyTransactionSigner();
1470
+ /**
1471
+ * Returns an `algosdk.TransactionResourceReference` given a `ResourceReference`.
1472
+ */
1473
+ function getResourceReference(accessReference) {
1474
+ return {
1475
+ address: typeof accessReference.address === 'string' ? Address.fromString(accessReference.address) : accessReference.address,
1476
+ appIndex: accessReference.appId,
1477
+ assetIndex: accessReference.assetId,
1478
+ holding: accessReference.holding ? getHoldingReference(accessReference.holding) : undefined,
1479
+ locals: accessReference.locals ? getLocalsReference(accessReference.locals) : undefined,
1480
+ box: accessReference.box ? AppManager.getBoxReference(accessReference.box) : undefined,
1481
+ };
1482
+ }
1483
+ function getHoldingReference(holdingReference) {
1484
+ return {
1485
+ assetIndex: holdingReference.assetId,
1486
+ address: typeof holdingReference.address === 'string' ? Address.fromString(holdingReference.address) : holdingReference.address,
1487
+ };
1488
+ }
1489
+ function getLocalsReference(localsReference) {
1490
+ return {
1491
+ appIndex: localsReference.appId,
1492
+ address: typeof localsReference.address === 'string' ? Address.fromString(localsReference.address) : localsReference.address,
1493
+ };
1494
+ }
1470
1495
 
1471
1496
  export { MAX_TRANSACTION_GROUP_SIZE, TransactionComposer };
1472
1497
  //# sourceMappingURL=composer.mjs.map