Unity
SDK Reference

SDK Reference

The following FractalClient functions assume the user is already authenticated with appropriate scopes.

Wallet Data

Fetching the user information and content of associated wallets (Coins & NFTs). This section wraps the WalletService (opens in a new tab) of the Fractal API.

  • Obtaining User Info
  • Reading coins and balances.
  • Reading NFTs owned by the account.

Obtaining User Info

Returns info about a user's Fractal Account. This feature requires IDENTIFY scope.

UserInfo user = await FractalClient.Instance.GetUser();
Debug.Log(userData.email);

The callback returns UserInfo (Class Reference) (opens in a new tab).

Reading User Coins

Returns coins held in a given wallet. This feature requires COINS_READ scope.

UserCoins userCoins = await FractalClient.Instance.GetCoins();
foreach (Coin userCoin in userCoins.coins)
{
    Debug.Log(userCoin.address);
}

The callback returns UserCoins with an array of Coin (Class Reference) (opens in a new tab).

Reading User NFTs

Returns items held in a given wallet. This feature requires ITEMS_READ scope.

UserItems userItems = await FractalClient.Instance.GetItems();
foreach (Item userItem in userCoins.items)
{
    Debug.Log(userCoin.address);
}

The callback returns UserItems with an array of Item (Class Reference) (opens in a new tab).

Following are exceptions that can occur while calling any of the methods in FractalClient.

Error classMeaning
FractalNotAuthenticatedUser is not authenticated or session token is invalid/expired.
FractalAPIRequestErrorAPI Request returned non-successful result. Exception contains HTTP error code, error message and details.
FractalInvalidResponseError while parsing the value returned by the API.
FractalSDKSignTransactionDeniedErrorThe transaction was denied.