Sign Up
Skip to content

Read From Blockchain

Set Chain Id

Select the Chain ID from which you want to retrieve user information. By default, this is set to Polygon.

img

Get Ether Balance

Use the Indexer API to retrieve the Ether balance for a specified wallet address, such as the local user's address.

img
// Define success and failure callbacks
const TSuccessCallback<FEtherBalance> GenericSuccess = [=](const FEtherBalance& etherBalance) { };
const FFailureCallback GenericFailure = [=](const FSequenceError& Error) { };
 
// Get a reference of the user's current wallet session.
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
    // Example Indexer call
    USequenceWallet * Wallet = WalletOptional.GetValue();
    Wallet->GetEtherBalance(Wallet->GetWalletAddress(), GenericSuccess, GenericFailure);
}

Get Token Balances

Retrieve the user's token balances for ERC20, ERC721, and ERC1155 tokens. This will return an array of all tokens owned by the user. Ensure that 'includeMetadata' is enabled to include contract information in the response.

img
const TSuccessCallback<FGetTokenBalancesReturn> GenericSuccess = [=](const FGetTokenBalancesReturn& tokenBalances)
{
    //Response in FGetTokenBalancesReturn
};
const FFailureCallback GenericFailure = [=](const FSequenceError& Error)
{
    //GetTokenBalances Failure
};
 
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
    USequenceWallet * Wallet = WalletOptional.GetValue();
    FGetTokenBalancesArgs args;
    args.accountAddress = Wallet->GetWalletAddress();
    args.includeMetaData = true;
    Wallet->GetTokenBalances(args, GenericSuccess, GenericFailure);
}

Get Token Supplies

Retrieve the token supplies for an ERC20, ERC721, or ERC1155 token. Make sure 'includeMetadata' is enabled to include contract information in the response.

img
const TSuccessCallback<FGetTokenSuppliesReturn> GenericSuccess = [=](const FGetTokenSuppliesReturn& tokenSupplies)
{
    //Response is in FGetTokenSuppliesReturn
};
const FFailureCallback GenericFailure = [=](const FSequenceError& Error)
{
    //GetTokenSupplies Failure
};
 
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
    USequenceWallet * Wallet = WalletOptional.GetValue();
    FGetTokenSuppliesArgs args;
    args.contractAddress = "0x01";//Testing Contract Address in hex with leading 0x
    args.includeMetaData = true;
    Wallet->GetTokenSupplies(args, GenericSuccess, GenericFailure);
}

Get Token Supplies Map

Retrieve a collection of token supplies for ERC20, ERC721, or ERC1155 tokens. Make sure 'includeMetadata' is enabled to include contract information in the response.

img
const TSuccessCallback<FGetTokenSuppliesMapReturn> GenericSuccess = [=](const FGetTokenSuppliesMapReturn& tokenSuppliesMap)
{
    //Response is in FGetTokenSuppliesMapReturn
};
const FFailureCallback GenericFailure = [=](const FSequenceError& Error)
{
    //GetTokenSuppliesMap Failure
};
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
    USequenceWallet * Wallet = WalletOptional.GetValue();
    TMap<FString, FTokenList> tokenMap;
    const TPair<FString,FTokenList> item;
    tokenMap.Add(item);
    FGetTokenSuppliesMapArgs args;
    args.includeMetaData = true;
    args.tokenMap = tokenMap;
    Wallet->GetTokenSuppliesMap(args, GenericSuccess, GenericFailure);
}

Get Transaction History

Retrieve the transaction history for a wallet- or token address. For example, here we get all transaction for the current user.

img
const TSuccessCallback<FGetTransactionHistoryReturn> GenericSuccess = [=](const FGetTransactionHistoryReturn& transactionHistory)
{
    //Response is in FGetTransactionHistoryReturn
};
const FFailureCallback GenericFailure = [=](const FSequenceError& Error)
{
    //GetTransactionHistory Failure
};
 
const TOptional<USequenceWallet*> WalletOptional = USequenceWallet::Get();
if (WalletOptional.IsSet() && WalletOptional.GetValue())
{
    USequenceWallet * Wallet = WalletOptional.GetValue();
    FGetTransactionHistoryArgs args;
    args.filter.accountAddress = Wallet->GetWalletAddress();
    args.includeMetaData = true;
    args.page.page = 0;
    args.page.more = true;
    Wallet->GetTransactionHistory(args, GenericSuccess, GenericFailure);
}