Skip to content

Commit

Permalink
chore: add swagger link to getOperation, update unity samples
Browse files Browse the repository at this point in the history
  • Loading branch information
lewinskimaciej committed Jun 5, 2024
1 parent 6623be2 commit 6157af8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
3 changes: 2 additions & 1 deletion pages/service/operations/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"introduction": "Introduction",
"creating-operations": "Creating operations"
"creating-operations": "Creating operations",
"processing-operations": "Processing operations"
}
2 changes: 1 addition & 1 deletion pages/service/operations/creating-operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ beamClient.TransferAsset('entity-id-of-user', {
receiverEntityId: "receiver-entity-id-of-user",
assetAddress: "0x9eeaecbe2884aa7e82f450e3fc174f30fc2a8de3",
tokenId: 23
})
});

// {
// "status": "Pending",
Expand Down
58 changes: 31 additions & 27 deletions pages/service/operations/processing-operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,48 @@ 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
));
```


### 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.
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": [
// ...
// ]
// }
```

0 comments on commit 6157af8

Please sign in to comment.