@algorandfoundation/algokit-utils 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +3 -3
  2. package/package.json +1 -1
  3. package/testing/test-logger.js +7 -5
  4. package/testing/test-logger.js.map +1 -1
  5. package/testing/test-logger.mjs +7 -5
  6. package/testing/test-logger.mjs.map +1 -1
  7. package/transaction/transaction.js +4 -4
  8. package/transaction/transaction.js.map +1 -1
  9. package/transaction/transaction.mjs +5 -5
  10. package/transaction/transaction.mjs.map +1 -1
  11. package/types/algorand-client-transaction-sender.js +7 -1
  12. package/types/algorand-client-transaction-sender.js.map +1 -1
  13. package/types/algorand-client-transaction-sender.mjs +7 -1
  14. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  15. package/types/app-client.d.ts +12 -8
  16. package/types/app-client.js +6 -6
  17. package/types/app-client.js.map +1 -1
  18. package/types/app-client.mjs +7 -7
  19. package/types/app-client.mjs.map +1 -1
  20. package/types/app-factory.d.ts +30 -29
  21. package/types/app-factory.js +8 -0
  22. package/types/app-factory.js.map +1 -1
  23. package/types/app-factory.mjs +8 -0
  24. package/types/app-factory.mjs.map +1 -1
  25. package/types/app-manager.d.ts +2 -2
  26. package/types/app-manager.js +2 -1
  27. package/types/app-manager.js.map +1 -1
  28. package/types/app-manager.mjs +2 -1
  29. package/types/app-manager.mjs.map +1 -1
  30. package/types/composer.d.ts +20 -6
  31. package/types/composer.js +8 -10
  32. package/types/composer.js.map +1 -1
  33. package/types/composer.mjs +8 -10
  34. package/types/composer.mjs.map +1 -1
  35. package/types/config.d.ts +0 -4
  36. package/types/config.js.map +1 -1
  37. package/types/config.mjs.map +1 -1
  38. package/types/dispenser-client.js +3 -1
  39. package/types/dispenser-client.js.map +1 -1
  40. package/types/dispenser-client.mjs +3 -1
  41. package/types/dispenser-client.mjs.map +1 -1
  42. package/types/transaction.d.ts +1 -1
  43. package/util.d.ts +2 -0
  44. package/util.js +16 -0
  45. package/util.js.map +1 -1
  46. package/util.mjs +15 -1
  47. package/util.mjs.map +1 -1
@@ -5,7 +5,7 @@ import { replaceDeployTimeControlParams, performTemplateSubstitution, deployApp,
5
5
  import { Config } from '../config.mjs';
6
6
  import { legacySendTransactionBridge } from '../transaction/legacy-bridge.mjs';
7
7
  import { getSenderAddress, encodeTransactionNote } from '../transaction/transaction.mjs';
8
- import { binaryStartsWith } from '../util.mjs';
8
+ import { asJson, binaryStartsWith } from '../util.mjs';
9
9
  import { UPDATABLE_TEMPLATE_NAME, DELETABLE_TEMPLATE_NAME } from './app.mjs';
10
10
  import { getArc56Method, getArc56ReturnValue, getABITupleFromABIStruct, getABIDecodedValue, getABIEncodedValue } from './app-arc56.mjs';
11
11
  import { arc32ToArc56 } from './app-spec.mjs';
@@ -180,7 +180,7 @@ class AppClient {
180
180
  const availableAppSpecNetworks = Object.keys(appSpec.networks ?? {});
181
181
  const networkIndex = availableAppSpecNetworks.findIndex((n) => networkNames.includes(n));
182
182
  if (networkIndex === -1) {
183
- throw new Error(`No app ID found for network ${JSON.stringify(networkNames)} in the app spec`);
183
+ throw new Error(`No app ID found for network ${asJson(networkNames)} in the app spec`);
184
184
  }
185
185
  const appId = BigInt(appSpec.networks[networkIndex].appID);
186
186
  return new AppClient({ ...params, appId, appSpec });
@@ -474,8 +474,8 @@ class AppClient {
474
474
  getLineForPc);
475
475
  }
476
476
  if (errorMessage) {
477
- const appId = JSON.stringify(e).match(/(?<=app=)\d+/)?.[0] || '';
478
- const txId = JSON.stringify(e).match(/(?<=transaction )\S+(?=:)/)?.[0];
477
+ const appId = asJson(e).match(/(?<=app=)\d+/)?.[0] || '';
478
+ const txId = asJson(e).match(/(?<=transaction )\S+(?=:)/)?.[0];
479
479
  const error = new Error(`Runtime error when executing ${appSpec.name} (appId: ${appId}) in transaction ${txId}: ${errorMessage}`);
480
480
  error.cause = e;
481
481
  return error;
@@ -817,15 +817,15 @@ class AppClient {
817
817
  * if none provided and throws an error if neither provided */
818
818
  getSender(sender) {
819
819
  if (!sender && !this._defaultSender) {
820
- throw new Error(`No sender provided and no default sender present in app client for call to app ${this._appName}`);
820
+ throw new Error(`No sender provided and no default sender present in app factory for call to app ${this._appName}`);
821
821
  }
822
822
  return sender ?? this._defaultSender;
823
823
  }
824
824
  /** Returns the signer for a call, using the provided signer or the `defaultSigner`
825
- * if no signer was provided and the call will use default sender
825
+ * if no signer was provided and the sender resolves to the default sender, the call will use default signer
826
826
  * or `undefined` otherwise (so the signer is resolved from `AlgorandClient`) */
827
827
  getSigner(sender, signer) {
828
- return signer ?? (!sender ? this._defaultSigner : undefined);
828
+ return signer ?? (!sender || sender === this._defaultSender ? this._defaultSigner : undefined);
829
829
  }
830
830
  getBareParams(params, onComplete) {
831
831
  return {