The given transaction is not valid due to: Error: Unable to serialize value due to: Parsing failed
at ob.sendTransaction (chrome-extension://mnnkpffndmickbiakofclnpoiajlegmg/inject.js:14:8000)
For front end code i am trying to create a very simple example, I used piggybank as starting point and just trying to pass parameters for mint. to statement above when invoking the contract
Okay. If you succeed with the parameters supplied when using the concordium client and sc-tools they should be OK. They also look correct when comparing with the source code linked.
Are you sure you’re passing the correct schema to the function? Can you try to give it a module schema instead and see if that works?
there should be a moduleSchemaFromBase64 function in @concordium/wallet-connectors or @concordium/react-components. You pass this function a base64 representation of the schema.
You might be able to get the base64 string by executing
cat schema.bin | base64
Otherwise you could build the contract with the --schema-base64-out - argument. The - makes it write the schema to stdout, i.e. prints it in your terminal.
I believe each line represent a schema for different contract method, in react components the method i believe is typeSchemaFromBase64. The error persists
Im not sure that each line represents an individual entity in the contract, but I could be wrong. Anyhow, when using the entire module schema you’d have to use the function moduleSchemaFromBase64 to construct the schema parameter instead, as otherwise (if you use typeSchemaFromBase64 ) the function will definitely fail.
One line of Scheme with method moduleSchemaFromBase64 I get following error
ERROR
The given transaction is not valid due to: Error: Unable to serialize parameters, due to: Parse error
at ob.sendTransaction (chrome-extension://mnnkpffndmickbiakofclnpoiajlegmg/inject.js:14:8000)
I took the liberty of formatting your post’s code snippets in code blocks (``` around the code) and I noticed you use a multiline string literal for the schema. This could explain the base64 validation error. Try defining the schema with quotes instead.
ERROR
The given transaction is not valid due to: Error: Unable to serialize parameters, due to: Unable to find contract schema in module schema
at ob.sendTransaction (chrome-extension://mnnkpffndmickbiakofclnpoiajlegmg/inject.js:14:8000)
The error could suggest that you’re specifying the wrong contract name for the entrypoint.
Alternatively, we recommend using @concordium/ccd-js-gen to generate a contract client for you for a more frictionless experience when integrating with smart contracts.