Wallet Manager

The WalletManager classis responsible for managing user wallets within Unity applications using the Xerial services. It provides functionalities to retrieve user data and token balances.

Usage

using System.Collections;
using UnityEngine;
using Xerial;

public class WalletManager
{
    InitializeWalletServices();
}

Example

// Instantiate WalletManager
WalletManager walletManager = new WalletManager();

Properties

  • userData: An instance of the UserData class representing the user's data retrieved from the Xerial services.

  • nativeBalance: A float value representing the user's native token balance.

  • tokenBalances: An instance of the TokenBalances class representing the user's token balances.

  • nativeTokenRequester: An instance of the RequestTransferNativeToken class for requesting native token transfers.

  • transferERCTokenRequester: An instance of the RequestERCTokenTransfer class for requesting ERC token transfers.

Example

public class WalletManager
{
    public UserData userData;
    public float nativeBalance;
    public TokenBalances tokenBalances;
    public RequestTransferNativeToken nativeTokenRequester;
    public RequestERCTokenTransfer transferERCTokenRequester;
}

Methods

  • UpdateWallet(): Initiates the process of updating the user's wallet data.

  • RequestWalletData(): Coroutine method that requests and updates the user's wallet data, including user data, native token balance, and token balances.

  • RequestUserData(string accessToken): Coroutine method that requests and updates the user's data.

  • RequestNativeTokenBalance(): Coroutine method that requests and updates the user's native token balance.

  • RequestTokenBalances(): Coroutine method that requests and updates the user's token balances.

  • InitializeWalletServices(): Initializes the necessary wallet-related services and event subscriptions upon instantiation.

Last updated