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 class | Meaning |
---|---|
FractalNotAuthenticated | User is not authenticated or session token is invalid/expired. |
FractalAPIRequestError | API Request returned non-successful result. Exception contains HTTP error code, error message and details. |
FractalInvalidResponse | Error while parsing the value returned by the API. |
FractalSDKSignTransactionDeniedError | The transaction was denied. |