@algorandfoundation/algokit-utils 9.1.1-beta.3 → 9.1.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/testing/transaction-logger.d.ts +2 -0
- package/testing/transaction-logger.js +26 -7
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs +26 -7
- package/testing/transaction-logger.mjs.map +1 -1
- package/types/app-client.d.ts +1 -1
- package/types/app-client.js +11 -7
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +11 -7
- package/types/app-client.mjs.map +1 -1
package/types/app-client.mjs
CHANGED
|
@@ -18,6 +18,8 @@ var getApplicationAddress = algosdk.getApplicationAddress;
|
|
|
18
18
|
var Indexer = algosdk.Indexer;
|
|
19
19
|
var OnApplicationComplete = algosdk.OnApplicationComplete;
|
|
20
20
|
var SourceMap = algosdk.ProgramSourceMap;
|
|
21
|
+
/** The maximum opcode budget for a simulate call as per https://github.com/algorand/go-algorand/blob/807b29a91c371d225e12b9287c5d56e9b33c4e4c/ledger/simulation/trace.go#L104 */
|
|
22
|
+
const MAX_SIMULATE_OPCODE_BUDGET = 20000 * 16;
|
|
21
23
|
/**
|
|
22
24
|
* Determines deploy time control (UPDATABLE, DELETABLE) value by inspecting application specification
|
|
23
25
|
* @param approval TEAL Approval program, not the base64 version found on the appSpec
|
|
@@ -913,13 +915,11 @@ class AppClient {
|
|
|
913
915
|
...params,
|
|
914
916
|
};
|
|
915
917
|
// Read-only calls do not require fees to be paid, as they are only simulated on the network.
|
|
916
|
-
//
|
|
917
|
-
//
|
|
918
|
-
//
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
throw Error(`Please provide a maxFee for the transaction when coverAppCallInnerTransactionFees is enabled.`);
|
|
922
|
-
}
|
|
918
|
+
// With maximum opcode budget provided, ensure_budget (and similar op-up utilities) won't need to create inner transactions,
|
|
919
|
+
// so fee coverage for op-up inner transactions does not need to be accounted for in readonly calls.
|
|
920
|
+
// If max_fee is provided, use it as static_fee, as there may still be inner transactions sent which need to be covered by the outermost transaction,
|
|
921
|
+
// even though ARC-22 specifies that readonly methods should not send inner transactions.
|
|
922
|
+
if (params.coverAppCallInnerTransactionFees && params.maxFee) {
|
|
923
923
|
readonlyParams.staticFee = params.maxFee;
|
|
924
924
|
readonlyParams.extraFee = undefined;
|
|
925
925
|
}
|
|
@@ -931,6 +931,8 @@ class AppClient {
|
|
|
931
931
|
allowUnnamedResources: params.populateAppCallResources ?? true,
|
|
932
932
|
// Simulate calls for a readonly method shouldn't invoke signing
|
|
933
933
|
skipSignatures: true,
|
|
934
|
+
// Simulate calls for a readonly method can use the max opcode budget
|
|
935
|
+
extraOpcodeBudget: MAX_SIMULATE_OPCODE_BUDGET,
|
|
934
936
|
});
|
|
935
937
|
return this.processMethodCallReturn({
|
|
936
938
|
...result,
|
|
@@ -942,6 +944,8 @@ class AppClient {
|
|
|
942
944
|
}
|
|
943
945
|
catch (e) {
|
|
944
946
|
const error = e;
|
|
947
|
+
// For read-only calls with max opcode budget, fee issues should be rare
|
|
948
|
+
// but we can still provide helpful error message if they occur
|
|
945
949
|
if (params.coverAppCallInnerTransactionFees && error && error.message && error.message.match(/fee too small/)) {
|
|
946
950
|
throw Error(`Fees were too small. You may need to increase the transaction maxFee.`);
|
|
947
951
|
}
|