Skip to content
API
Operations (beta)
Creating operations

How to initialize Operations

When you would like to transfer an asset that is owned by your user, you will need to ask them to sign for the transaction involved.

In order to do this, you need to initiate an Operation. Initiating an Operation is as simple as calling a method on the request client for the Player API. If the thing you're trying to do requires the user to sign a transaction, an Operation will be returned.

To make this a bit more tangible, here's a call you might make. At the bottom you will find an Operation response. Disclaimer: Operations will remain valid for a 24-hour time period, after which they will be removed / cleaned up.

 
beamClient.TransferAsset('entity-id-of-user', {
  receiverEntityId: "receiver-entity-id-of-user",
  assetAddress: "0x9eeaecbe2884aa7e82f450e3fc174f30fc2a8de3",
  tokenId: 23
});
 
// {
//   "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": [
//     {
//       "type": "OpenfortTransaction",
//       "status": "Pending",
//       "id": "clwt0h7ej000d2jck6dolrgoe",
//       "externalId": "tin_ec87b4c5-0646-43e9-8a3b-1a5956274cc6",
//       "signature": null,
//       "operationId": "clwt0h7ej000c2jckyr2nh0cv",
//       "data": "0xcec36ff1260ebfcc3b306bee7c0404e9147bbcf7788c8b3d989dd757b5bbc3d7"
//     }
//   ]
// }