From 6157af861b2cc3747a445bdb9f217cadbb6993be Mon Sep 17 00:00:00 2001 From: lewinskimaciej Date: Wed, 5 Jun 2024 12:31:36 +0200 Subject: [PATCH] chore: add swagger link to getOperation, update unity samples --- pages/service/operations/_meta.json | 3 +- .../operations/creating-operations.mdx | 2 +- .../operations/processing-operations.mdx | 58 ++++++++++--------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/pages/service/operations/_meta.json b/pages/service/operations/_meta.json index 314cc5e..cf54669 100644 --- a/pages/service/operations/_meta.json +++ b/pages/service/operations/_meta.json @@ -1,4 +1,5 @@ { "introduction": "Introduction", - "creating-operations": "Creating operations" + "creating-operations": "Creating operations", + "processing-operations": "Processing operations" } diff --git a/pages/service/operations/creating-operations.mdx b/pages/service/operations/creating-operations.mdx index 62bca9c..72ce28b 100644 --- a/pages/service/operations/creating-operations.mdx +++ b/pages/service/operations/creating-operations.mdx @@ -18,7 +18,7 @@ beamClient.TransferAsset('entity-id-of-user', { receiverEntityId: "receiver-entity-id-of-user", assetAddress: "0x9eeaecbe2884aa7e82f450e3fc174f30fc2a8de3", tokenId: 23 -}) +}); // { // "status": "Pending", diff --git a/pages/service/operations/processing-operations.mdx b/pages/service/operations/processing-operations.mdx index a96e0f3..45e80e1 100644 --- a/pages/service/operations/processing-operations.mdx +++ b/pages/service/operations/processing-operations.mdx @@ -9,18 +9,23 @@ After you created an Operation, the operation needs to be signed for. You could ### 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. +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 or sign it with an existing Session. ```csharp -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 -)); +StartCoroutine(beamClient.CreateSession( + "entityIdOfYourUser", + actionResult => + { + if (actionResult.Status == BeamResultType.Success) + { + var session = actionResult.Result; + // you now have an active session that can sign operations + } + }, + chainId: 13337, // optional chainId, defaults to 13337 + secondsTimeout: 240 // timeout in seconds for getting a result of Session signing from the browser + )); ``` @@ -28,25 +33,24 @@ StartCoroutine(beamClient.SignOperation("entity-id-of-user", "operation-id-of-ap 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. +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](https://api.testnet.onbeam.com/api/player#/Operation/getOperation) method periodically in order to know about status changes in the Operation based on user actions. ```csharp - -// { -// "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": [ -// .. -// ] -// } +// { +// "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": [ +// ... +// ] +// } ```