@algorandfoundation/algokit-utils 8.1.0 → 8.1.1-beta.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.
- package/package.json +1 -1
- package/types/app-client.js +38 -15
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +38 -15
- package/types/app-client.mjs.map +1 -1
- package/types/composer.js +8 -4
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +8 -4
- package/types/composer.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +1 -1
- package/types/kmd-account-manager.js +1 -1
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +1 -1
- package/types/kmd-account-manager.mjs.map +1 -1
package/types/app-client.mjs
CHANGED
|
@@ -753,21 +753,44 @@ class AppClient {
|
|
|
753
753
|
// Read-only call - do it via simulate
|
|
754
754
|
if ((params.onComplete === OnApplicationComplete.NoOpOC || !params.onComplete) &&
|
|
755
755
|
getArc56Method(params.method, this._appSpec).method.readonly) {
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
756
|
+
const readonlyParams = {
|
|
757
|
+
...params,
|
|
758
|
+
};
|
|
759
|
+
// Read-only calls do not require fees to be paid, as they are only simulated on the network.
|
|
760
|
+
// Therefore there is no value in calculating the minimum fee needed for a successful app call with inner transactions.
|
|
761
|
+
// As a a result we only need to send a single simulate call,
|
|
762
|
+
// however to do this successfully we need to ensure fees for the transaction are fully covered using maxFee.
|
|
763
|
+
if (params.coverAppCallInnerTransactionFees) {
|
|
764
|
+
if (params.maxFee === undefined) {
|
|
765
|
+
throw Error(`Please provide a maxFee for the transaction when coverAppCallInnerTransactionFees is enabled.`);
|
|
766
|
+
}
|
|
767
|
+
readonlyParams.staticFee = params.maxFee;
|
|
768
|
+
readonlyParams.extraFee = undefined;
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
const result = await this._algorand
|
|
772
|
+
.newGroup()
|
|
773
|
+
.addAppCallMethodCall(await this.params.call(readonlyParams))
|
|
774
|
+
.simulate({
|
|
775
|
+
allowUnnamedResources: params.populateAppCallResources ?? true,
|
|
776
|
+
// Simulate calls for a readonly method shouldn't invoke signing
|
|
777
|
+
skipSignatures: true,
|
|
778
|
+
});
|
|
779
|
+
return this.processMethodCallReturn({
|
|
780
|
+
...result,
|
|
781
|
+
transaction: result.transactions.at(-1),
|
|
782
|
+
confirmation: result.confirmations.at(-1),
|
|
783
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
784
|
+
return: (result.returns?.length ?? 0 > 0) ? result.returns?.at(-1) : undefined,
|
|
785
|
+
}, getArc56Method(params.method, this._appSpec));
|
|
786
|
+
}
|
|
787
|
+
catch (e) {
|
|
788
|
+
const error = e;
|
|
789
|
+
if (params.coverAppCallInnerTransactionFees && error && error.message && error.message.match(/fee too small/)) {
|
|
790
|
+
throw Error(`Fees were too small. You may need to increase the transaction maxFee.`);
|
|
791
|
+
}
|
|
792
|
+
throw e;
|
|
793
|
+
}
|
|
771
794
|
}
|
|
772
795
|
return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.call(params)), getArc56Method(params.method, this._appSpec)));
|
|
773
796
|
},
|