Ability to call a read-only function in devnet from deployment plans
To test smart contracts, I run clarinet integrate. I step through the block manually, from time to time I run an additional deployment plan.
I thought, I could include a read-only call in the deployment plan so that I see the current state of the blockchain/contract without writing additional javascript code to call read-only functions.
I tried to use a deployment plan to call a read-only function. It fails with following error:
{"error":"transaction rejected","reason":"NoSuchPublicFunction","txid":"1c7a98a37d718c116e77e63d5343ab5d9ab29d6e1586e0dce99802594ed6fa64"}
Is there a way to get the chain object of the devnet so that I can use function callReadOnlyFn from deno lib clarinet?
I'll have a look
@hugocaillard and @lgalabru to discuss feasibility & add priority & sizing.
I usually write a simple helper contact that wraps read-only functions in public functions
Looking fro more details, are we talking about simnet or devnet @friedger?
@friedger Does this bit of (low-visibility) docs help?
Read-only functions and functions that take no arguments are passed an empty list like so:
parameters: []
Devnet. Via Deployment plans? No. I would need to use another tool like node fetch?
Hello @friedger,
It seems like this issue is leading to confusing. Could you refine the original description with more details?
- What you tried to do?
- Why? Use case?
- What the current behavior (that, you already provided)
- What would be the expected behavior? (Or behaviors if you think there are multiple options)
Thank you 🙏
What you tried to do? Why? Use case?
Use clarinet integrate and not write and js code
What the current behavior (that, you already provided)
Currently, I wrap read-only functions in a helper contract, then I can call this helper contract to get the result of the read-only function via a deployment plan.
What would be the expected behavior? (Or behaviors if you think there are multiple options)
I am looking for a way to call a read-only function without the wrapper and without js code.
@friedger Do you have a repo or a config/code snippet that shows how you call the public-function wrapper?
@hugocaillard Here is the helper: https://github.com/friedger/clarity-stacking-pools/blob/main/contracts/testing/helper.clar and here is the deployment plan: https://github.com/friedger/clarity-stacking-pools/blob/main/deployments/1-alice-delegate.devnet-plan.yaml