Signing transactions
Your app will need to send transactions to the Casper network. Such operations must be approved by the user by signing what we call in Casper a deploy.
How to build a deploy object is out of the scope of this documentation. We recommend to refer to the official Casper docs on this topic. Note that your frontend web application does not necessarily always create the deploy. In some scenarios, that can be a responsibility of your backend application or even another party.
In any case, at some point you will have a deploy in the form of a json object. Removing the payment
and session
details for the sake of simplicity, it will look like this:
Typically, you'll handle a deploy without approvals. And such approval is what you want to get from the user. Then, the deploy will be ready to be processed by a Casper node.
To get the approval CSPR.click SDK offers two options:
send()
method. Use it to ask CSPR.click to request the user to approve the transaction and then send it to a Casper node, where it will be processed.sign()
method. Use it to ask CSPR.click to request the user to approve the transaction and return to you the signature value.
In most cases, you can just use the send()
method and process its result to communicate to the user whether the operation is being processed in the Casper network or it has been rejected for some reason.
But in some advanced scenarios you will require the sign()
method and get the signature to continue the processing of the transaction.
Last updated