Skip to content

Chore/minor fixes #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pages/sdk/assets/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Callout emoji="🛠️">
Feel like something is missing, and needs to be prioritized? Let's have a chat through [email protected]!
Expand Down
15 changes: 7 additions & 8 deletions pages/sdk/assets/managing-player-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand All @@ -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.
Expand All @@ -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
});
Expand Down
4 changes: 2 additions & 2 deletions pages/sdk/assets/reading-player-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion pages/sdk/transactions/custom-transactions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down