How to process Operations
After you created an Operation, the operation needs to be signed for. You could handle this in various ways, but we do recommend using our provided SDKs.
Using our SDK
When using our SDK, processing an operation is as simple as providing the user entity id and the operation id. The SignOperation
method will automatically open a browser.
StartCoroutine(beamClient.SignOperation("entity-id-of-user", "operation-id-of-api", result =>
{
// handle the result here
},
chainId: 13337, // defaults to 13337
secondsTimeout: 240, // timeout in seconds for getting a response in case browser flow was chosen
fallBackToBrowser: true // if true, opens a browser for the user to sign the operation if Session was not started
));
Using the provided URL
As you might have seen when creating an Operation, we return a url
property in the response. The url
is a URL to our web interface, which the user can use in order to sign for the Operation.
Please note that if you use the web interface, we won't provide you with a proper callback about the status of the Operation. You will need to poll our APIs' getOperation
method periodically in order to know about status changes in the Operation based on user actions.
// {
// "status": "Pending",
// "id": "clwt0h7ej000c2jckyr2nh0cv",
// "createdAt": "2024-05-30T08:46:42.620Z",
// "updatedAt": null,
// "gameId": "cltr8rde601aeakka28hbtuim",
// "userId": "clwdehitt005biwog2szib1fh",
// "chainId": 13337,
// "url": "https://identity.testnet.onbeam.com/games/cltr8rde601aeakka28hbtuim/operation/clwt0h7ej000c2jckyr2nh0cv/confirm",
// "game": {
// ...
// },
// "transactions": [
// ..
// ]
// }