The parameter for the permit function is created at the backend of the server. The server sends the transaction to the chain (the transaction is not send via the Browser wallet at the front end). E.g. here is the line for how to create the Transfer payload.
I appreciate your effort. But the example above is for a semi-fungible token. please provide me an example of creating a mint payload through the permit function.
The sponsored transaction example in our repo showcases how you can use the transfer or the updateOperator entry points via the permit function (only these two entry points are supported in the contract to keep the example simple). I linked the NFT token contract and backend from our example here:
Smart Contract:
Backend:
It seems you want in addition to mint tokens via the sponsored transaction mechanism.
We have a semi-fungible token contract that showcases how you can set up the mint function in the smart contract to do that:
Then you can set the payload (at the backend) equal to the MintParams. For the cis2_multi smart contract (the above contract) it would look like this:
Currently, we don’t have a front-end example that showcases the requested mint entrypoint out of the box. But I am confident that you can use the sponsored transaction example front end and adjust it for the mint entrypoint. Feel free to reach out if you have difficulties to do that.
I encountered this error when the txn is to simulate.
Error: Unable to submit transfer: {"code":500,"message":"Transaction simulation error. Your transaction would revert with the given input parameters: reason: InvalidAccountReference { contents: AccountAddress([165, 44, 226, 8, 186, 20, ...) }"}
The error comes from the rust-sdk: It means that your account does not exist on chain. Did you deploy/create the account [165, 44, 226, 8, 186, 20, …] on Concordium testnet?
Thank you @Doris , I just encountered a strange error.
Error: Unable to submit transfer: {"code":500,"message":"Transaction simulation error. Your transaction would revert with the given input parameters: reason: InvalidContractAddress { contents: ContractAddress { index: 7754, subindex: 0 } }"}
Hi @Doris, from the rejection reasons, the reason for the invalid contract address is that a contract was not initialized. However on using the https://sctools.mainnet.concordium.software/., the contract was initialized in other to return its index. On my backend, we can also see from {"code":500,"message":"Transaction simulation error. Your transaction would revert with the given input parameters: reason: InvalidContractAddress { contents: ContractAddress { index: 7760, subindex: 0 } }"} that the index and the subindex are added properly. In my attempts to resolve this, I don’t seem to get hold of what the actual reason for this could be.