diff --git a/pages/sdk/assets/introduction.mdx b/pages/sdk/assets/introduction.mdx index 7b569d4e..cd9e9e83 100644 --- a/pages/sdk/assets/introduction.mdx +++ b/pages/sdk/assets/introduction.mdx @@ -6,9 +6,9 @@ import { Callout } from "nextra/components"; # Introduction to Assets -Asset management is a crucial part of the Beam integration within your game. Depending on on-chain activities that you want to support in your in-game economy, you have the option to manage assets of the players you created, but also list - buy and make offers on assets through the Beam SDK. By nature of self custodial Player accounts, every most operations require the Player to sign the operation, either directly or via [Sessions](/sdk/sessions/introduction). +Asset management is a crucial part of the Beam integration within your game. Depending on on-chain activities that you want to support in your in-game economy, you have the option to manage assets of the players you created, but also list - buy and make offers on assets through the Beam SDK. By nature of self custodial Player accounts, most operations require the Player to sign the operation, either directly or via [Sessions](/sdk/sessions/introduction). -By providing these options through the sdk, you are able to create a frictionless in-game marketplace built on Beam without having to worry about creating infrastructure to support it. +By providing these options through the SDK, you are able to create a frictionless in-game marketplace built on Beam without having to worry about creating infrastructure to support it. Feel like something is missing, and needs to be prioritized? Let's have a chat through build@onbeam.com! diff --git a/pages/sdk/assets/managing-player-assets.mdx b/pages/sdk/assets/managing-player-assets.mdx index d41c2652..71d5b598 100644 --- a/pages/sdk/assets/managing-player-assets.mdx +++ b/pages/sdk/assets/managing-player-assets.mdx @@ -4,18 +4,17 @@ title: Managing player assets # Managing player assets -Because -Through the API key, you are authorized to initalize Operations on Assets for all the players you created, for every contract we registered to your game. Methods described below are available, but obviously ERC20 token transfers will only be relevant to you if we added an ERC20 contract to your game within Beam. +Through the API key, you are authorized to initalize Operations on Assets for all the players you created, for every contract that is registered to your game. Methods described below are available, but obviously ERC20 token transfers will only be relevant to you if you added an ERC20 contract to your game within Beam. ### Currency transfers (ERC20) -If we registered an ERC20 contract for your game, you are able to manage the ERC20 assets in all the profiles that you created. Sending these tokens around is easy. We simply expect you to know the ID of the sender, as well as the ID of the receiver, both of which you should have created a Player for. You can also send directly to an on-chain account address. +If you registered an ERC20 contract, you are able to manage the ERC20 assets for all the players within your game. Sending these tokens around is easy. We simply expect you to know the ID of the sender, as well as the ID of the receiver, both of which you should have created a Player for. You can also send directly to an on-chain account address. Initiating a token transfer would look something like this. In the example below, we are not considering more complicated features like sponsoring transactions just yet - the transaction will be paid for by you - the game developer. ```typescript -const transaction = await beam.assets.transferTokenV3("your-sender-id", { - receiverEntityId: "your-receiver-id", +const transaction = await beam.assets.transferTokenV3("sender-entity-id", { + receiverEntityId: "receiver-entity-id", assetAddress: "your-contract-address", amountToTransfer: "10", // 10 means 10 - we don't expect you to consider any other format like gwei }); @@ -42,8 +41,8 @@ Operation returned by the method needs to be signed. Learn more about Operations Asset transfers work in a similar fashion as ERC20 token transfers, but instead of calling the `transferToken`, you will need to call the `transferAsset` method and pass an `assetId` property for the asset you want to move around. ```typescript -const transaction = await beam.assets.transferAssetV3("your-sender-id", { - receiverEntityId: "your-receiver-id", +const transaction = await beam.assets.transferAssetV3("sender-entity-id", { + receiverEntityId: "receiver-entity-id", assetAddress: "your-contract-address", assetId: "73", amountToTransfer: 1, // amountToTransfer is related to 1155, defaults to 1 and doesn't have to be passed for ERC721 contracts. @@ -69,7 +68,7 @@ const transaction = await beam.assets.transferAssetV3("your-sender-id", { Lastly - we offer you the possibility to transfer our native token: BEAM. Depending on the context of your game, you might want to be able to transfer our native token around between profiles. ```typescript -const transaction = await beam.assets.transferNativeTokenV3("your-sender-id", { +const transaction = await beam.assets.transferNativeTokenV3("sender-entity-id", { receiverEntityId: "your-receiver-id", amountToTransfer: "10", // 10 means 10 - we don't expect you to consider any other format like gwei }); diff --git a/pages/sdk/assets/reading-player-assets.mdx b/pages/sdk/assets/reading-player-assets.mdx index 3fa2061a..b869a4b9 100644 --- a/pages/sdk/assets/reading-player-assets.mdx +++ b/pages/sdk/assets/reading-player-assets.mdx @@ -6,7 +6,7 @@ title: Player assets Depending on your needs, we offer various ways to validate the balance of a player - whenever that's for an ERC20, ERC721, ERC1155 or the native token on Beam. -However, depending on the token types there are a few caveats, as we are using an indexer for the ERC721 / ERC1155 type contracts, causing there to be a small delay between on-chain events and the actual sdk method response. +However, depending on the token types there are a few caveats, as we are using an indexer for the ERC721 / ERC1155 type contracts, causing there to be a small delay between on-chain events and the actual SDK method response. ### NFTs (ERC721, ERC1155) @@ -68,7 +68,7 @@ const profileTokens = await beam.assetsV2.getProfileCurrenciesV2("entity-id"); ### Native token -If you are interested in validating the native currency of a profile, for example to validate whenever the profile has enough BEAM to run a self-paid transaction, you could fetch the native token balance directly by doing the following: +If you are interested in validating the native currency of a player, for example to validate whenever the player has enough BEAM to run a self-paid transaction, you could fetch the native token balance directly by doing the following: ```typescript const profileTokens = await beam.assets.getProfileNativeCurrencyV3("entity-id"); diff --git a/pages/sdk/transactions/custom-transactions.mdx b/pages/sdk/transactions/custom-transactions.mdx index b9dfaff6..12e7d9b0 100644 --- a/pages/sdk/transactions/custom-transactions.mdx +++ b/pages/sdk/transactions/custom-transactions.mdx @@ -11,7 +11,7 @@ There's a limit of 9 interactions per transaction to prevent potential security You can simply do this by creating a transaction that interacts with one or more contracts in one go by padding an `interactions` array. This would look something like the snippet below. Keep in mind that everything you see below is completely contextual based on the contracts you're calling and the functions that are available on said contract. ```typescript -const transaction = await beam.transactions.createTransaction("profile-id", { +const transaction = await beam.transactions.createTransaction("entity-id-of-user", { interactions: [ { contract: "0x9eeaecbe2884aa7e82f450e3fc174f30fc2a8de3", // 👈 the asset contract you're calling