> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequence.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Read From Blockchain

> Documentation for Unreal SDK API for reading from the blockchain with the Sequence infrastructure stack for web3 gaming.

## Set Chain by Id

By default your Chain Id is defined in your SequenceConfig.ini file. Use this function to change it during runtime.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/jCmUvzGpoEMBvubT/images/unreal/set_chain_by_id.png?fit=max&auto=format&n=jCmUvzGpoEMBvubT&q=85&s=aa5a4fceaccc55d405410b721ac8bdc7" width="1372" height="632" data-path="images/unreal/set_chain_by_id.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    SequenceSdk::SetChainId(NewChainId);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **NewChainId (int64)**

  The new chain id, such as 421614 for Arbitrum Sepolia.
</Accordion>

## Get Native Token Balance

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

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_native_token_balance.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=508cef49383d716b9e2622ebaf1964e5" width="2824" height="1302" data-path="images/unreal/get_native_token_balance.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqEtherBalance> OnApiSuccess = [this, OnSuccess](const FSeqEtherBalance& EtherBalance) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->GetNativeTokenBalance(SequenceSdk::GetChainId(), WalletAddress, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **Wallet Address (FString)**

  The wallet address from which you want to retrieve data.
</Accordion>

<Accordion title="Return Types">
  **Balance (Integer64)**

  The amount of Ether owned by the specified wallet address.
</Accordion>

## 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.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_token_balances.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=4097e5cfe26434ff188a0a8d609d67c4" width="2824" height="1302" data-path="images/unreal/get_token_balances.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetTokenBalancesReturn> OnApiSuccess = [this, OnSuccess](const FSeqGetTokenBalancesReturn& Balances) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    FSeqGetTokenBalancesArgs Args;
    Args.accountAddress = WalletAddress;
    Args.contractAddress = ContractAddress;
    Args.includeMetaData = IncludeMetadata;

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->GetTokenBalances(SequenceSdk::GetChainId(), Args, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **Contract Address (FString)**

  An ERC20, ERC721 or ERC1155 contract address from which you want to retrieve data.

  **Wallet Address (FString)**

  The wallet address which owns tokens on the specified contract address.

  **Include Metadata (Boolean)**

  Enable this flag if you want to receive token metadata in the response.
</Accordion>

<Accordion title="Return Types">
  **Balances (SeqGetTokenBalancesReturn Struct)**

  Contains a SeqTokenBalance array that lists all token IDs owned by the specified wallet address. " + "If 'Include Metadata' is set to true, token metadata is also included.
</Accordion>

## Get Token Supplies

Retrieve the token supplies for an ERC20, ERC721, or ERC1155 token.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_token_supplies.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=0c5708b85c313caf3330fe5ec6889a3e" width="2824" height="1302" data-path="images/unreal/get_token_supplies.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetTokenSuppliesReturn> OnApiSuccess = [this, OnSuccess](const FSeqGetTokenSuppliesReturn& Supplies) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    FSeqGetTokenSuppliesArgs Args;
    Args.contractAddress = ContractAddress;
    Args.includeMetaData = IncludeMetadata;

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->GetTokenSupplies(SequenceSdk::GetChainId(), Args, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **Contract Address (FString)**

  An ERC20, ERC721 or ERC1155 contract address from which you want to retrieve token supplies.

  **Include Metadata (Boolean)**

  Enable this flag if you want to receive token metadata in the response.
</Accordion>

<Accordion title="Return Types">
  **Supplies (SeqGetTokenSuppliesReturn Struct)**

  Contains a SeqTokenSupply array that lists all token IDs available on the specified contract address. " + "Each element contains a 'supply' value. If 'Include Metadata' is set to true, token metadata is also included.
</Accordion>

## Get Token Supplies Map

Retrieve a collection of token supplies for ERC20, ERC721, or ERC1155 tokens.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_token_supplies_map.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=9a2565728c1650c1061519490d9ac2a4" width="2824" height="1302" data-path="images/unreal/get_token_supplies_map.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetTokenSuppliesMapReturn> OnApiSuccess = [this, OnSuccess](const FSeqGetTokenSuppliesMapReturn& SuppliesMap) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    FSeqGetTokenSuppliesMapArgs Args;
    Args.tokenMap = TokenMap;
    Args.includeMetaData = IncludeMetadata;

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->GetTokenSupplies(SequenceSdk::GetChainId(), Args, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **Token Map (FString->FSeqTokenList Map))**

  A map of token IDs that you want to retrieve data from.

  **Include Metadata (Boolean)**

  Enable this flag if you want to receive token metadata in the response.
</Accordion>

<Accordion title="Return Types">
  **Supplies (SeqGetTokenSuppliesMapReturn Struct)**

  Contains a SeqTokenSupply array for each specified ID in the 'Token Map'. " + "Each element contains a 'supply' value. If 'Include Metadata' is set to true, token metadata is also included.
</Accordion>

## Get Transaction History

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

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_transaction_history.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=882edd276cabe0ab566569085fb69414" width="2824" height="1302" data-path="images/unreal/get_transaction_history.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetTransactionHistoryReturn> OnApiSuccess = [this, OnSuccess](const FSeqGetTransactionHistoryReturn& TransactionHistory) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    FSeqGetTransactionHistoryArgs Args;
    Args.filter = Filter;
    Args.page = Page;
    Args.includeMetaData = IncludeMetadata;

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->GetTransactionHistory(SequenceSdk::GetChainId(), Args, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Parameters">
  **Account Address (FString)**

  Specify a wallet address if you want to receive the history for a specific user.

  **Contract Address (FString)**

  Specify an ERC20, ERC721 or ERC1155 contract address if you want to receive the history for a specific token.

  **Include Metadata (Boolean)**

  Enable this flag if you want to receive token metadata in the response.
</Accordion>

<Accordion title="Return Types">
  **Transaction History (SeqGetTransactionHistoryReturn Struct)**

  Contains a SeqTransaction array that lists all transactions.
</Accordion>

## Runtime Status

Retrieve the runtime status of the current chain.
For example, call this function to get the latest block number.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/jCmUvzGpoEMBvubT/images/unreal/runtime_status.png?fit=max&auto=format&n=jCmUvzGpoEMBvubT&q=85&s=1bc73f14517d4712e12624ccf62b5281" width="2824" height="1302" data-path="images/unreal/runtime_status.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqRuntimeStatus> OnApiSuccess = [this, OnSuccess](const FSeqRuntimeStatus& Status) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->RuntimeStatus(SequenceSdk::GetChainId(), OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Return Types">
  **Status (SeqRuntimeStatus Struct)**

  Object containing all details related to the status of our Indexer.

  **Error (FString)**

  Error message containing more details on why the request failed.
</Accordion>

## Version

Retrieve the version of the current chain.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/UrAdORNA0LqTwWWW/images/unreal/version.png?fit=max&auto=format&n=UrAdORNA0LqTwWWW&q=85&s=db511cd7d42f7be9d307e6c1682df326" width="2824" height="1302" data-path="images/unreal/version.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqVersion> OnApiSuccess = [this, OnSuccess](const FSeqVersion& Status) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->Version(SequenceSdk::GetChainId(), OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Return Types">
  **Web Rpc Version (FString)**

  TBD.

  **Schema Version (FString)**

  TBD.

  **Schema Hash (FString)**

  TBD.

  **App Version (FString)**

  TBD.

  **Error (FString)**

  Error message containing more details on why the request failed.
</Accordion>

## Ping

Ping the indexer to check if our endpoint is alive and ready.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/jCmUvzGpoEMBvubT/images/unreal/ping.png?fit=max&auto=format&n=jCmUvzGpoEMBvubT&q=85&s=3c3baf6d54d492c31e3393a2765f5c1c" width="2824" height="1302" data-path="images/unreal/ping.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<bool> OnApiSuccess = [this, OnSuccess](const bool Status) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequenceIndexer* Indexer = NewObject<USequenceIndexer>();
    Indexer->Ping(SequenceSdk::GetChainId(), OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

<Accordion title="Return Types">
  **Success (bool)**

  True if the indexer is running.

  **Error (FString)**

  Error message containing more details on why the request failed.
</Accordion>
