and I generate the schema by calling:
cargo concordium build --schema-base64-out -
Is there anything else I need to do to for the parameters to be seen?
Edit
Also, if I refactor the code and rename the function my_function rather than contract_my_function then the error message becomes:
Update contract failed:
No receive function 'my_function of contract ‘my_contract’ ’ found in module
67d568433bd72e4326241f262213d77f446db8ba03dfba351ae35c1b2e7e510
I am sure I read previously that the receive functions need to begin with ‘contract_’ but the examples I was looking at did not have that so I removed it. Do I need to put it back or is this a different issue?
When using the contract you either have to embed the schema (using -e or --schema-embed) or you have to supply it to concordium-client. In that case you cannot use the base64 schema, but only the binary one.
Receive function does not have to start with contract_. The --entrypoint argument in your case should be contract_my_function but I would recommned changing it to just my_function in the contracdt.
1 - I was following the tutorial here tutorial where seemed to use the base64 schema and then supplied this to the dApp. Did I misunderstand?
I tried to embed the schema using --schema-embed and then rebuilt the wasm file and redeployed the contract but now I get the error “The given transaction is not valid due to: unable to deserialize parameters, due to: Unable to find contract schema in module schema” when I try to call the Init function. Do I need to change the webpage calling code as well?
This is my build command:
cargo concordium build --out my_project.wasm.v1
This is my deploy command:
concordium-client module deploy my_project.wasm.v1 --sender my_account --name my_project --grpc-port 10000 --grpc-ip node.testnet.concordium.com
I use this to get the schema (as per the previously linked tutorial)
cargo concordium build --schema-base64-out -
I copy this and paste the output in to the front end code in the variable LP_RAW_SCHEMA
And of course if you update the address as well. The one you are showing is the contract instance at address (0,0) which is probably not your contract.
concordium-client module show project_name --out -
But I just get the error messge:
concordium-client.exe: user error (Cannot establish connection to GRPC endpoint.)
Is there some other setting somewhere I need?
The one you are showing is the contract instance at address (0,0) which is probably not your contract.
The output when I deployed said "Enter password for credential with index 0 and signing key with index 0: " and not done any updates or anything so I thought it would still be at 0,0.
Is that not right? If not, how do I determine which index it is at?
The init function works and can be called.
The receive function exists when looking at the smart contract on the chain but when called we get the error message that the function does not exist.
Can you share what the issues were? Perhaps we can improve documentation if you found some things particularly confusing and they are not well explained in our existing documentation.
I did not realise that the receive function had to be called with the index returned by the init function. When I added that in to the call from the front end connected.
My view function still fails with the error message “receive function schema does not contain a parameter schema”. However, it does not take any parameters and only returns a u32 wrapped in a ReceiveResult. The parameters schema is present for the contract through and the parameters for the other two functions are passed in correctly.
Sorry, I should I have been more clear in my reply.
I have provided a schema, I built it because the init and receive functions have parameters and they all work. The view function is the only one that fails but that is the only one that has no parameters even though, in the dApp call, it has the schema.
There was a bug with an older version of the “dapp libraries” where it was not possible to invoke entrypoints that don’t take parameters. Have you updated to the latest version?