It is possible to incentivize and reward users in experiences by dropping items directly to their wallet as part of the experience mechanics. This should be done on the server side, and the player must have a connected wallet for it to work. Make sure the inventory is set up as well. In the airdrop node, you need to set two values:

  1. YomPlayer: Specify the player to whom the item will be airdropped.

  2. Item ID: Provide the ID of the item that will be airdropped. There are separate IDs for devnet and mainnet.

The airdrop node will add an item based on the item ID to the player's wallet. Please note that the airdrop function will not work for users who haven't logged in with a wallet.

Checking if airdrop received

If you want to check if a user has already received an airdrop, you can follow these steps:

  1. Retrieve the YomPlayer of the player.

  2. Get the inventory of the YomPlayer.

  3. Check if there is an item in the inventory with the ID of your master NFT ID. If an item with that ID exists, it means the user has already received the airdrop.

Checking wallet connection

To check if a user has a wallet connected, follow these steps:

  1. Get the player you want to check.

  2. Retrieve the YomPlayer from that player.

  3. Get the wallet of the YomPlayer.

  4. Check if the wallet ID is empty. If it's not empty, it means the user has a wallet connected.

Checking if wallet is fetched

Fetching the wallet may take some time, so there is a callback function called "OnInventoryFetched" that you can use. To check if the wallet has been fetched, do the following:

  1. Get the YomPlayer from the player.

  2. Check if the YomPlayer has a valid inventory.

  3. Bind an event to the "OnInventoryFetched" callback to be notified when the inventory is fetched.

Note: Airdrops last until the maximum supply of the item has been reached.

Last updated