Read from Blockchain
Reading from the blockchain is done using Unity-Native implementation of our Sequence Indexer. We recommend creating an instance of theChainIndexer class. This will expose you to all the functionality offered by the IIndexer interface.
Ping async Task. This can be useful if a request is failing. During development, you can also check the status of our indexers on our status page.
Get Balance
To check the Ether (or whatever your network’s default gas currency is) balance of a user, use theGetEtherBalance async Task.
Get Token Balances
To fetch the token balances for a user you’ll want to use theGetTokenBalances async Task.
GetTokenBalancesArgs.
Page you receive in your GetTokenBalancesReturn to see if it has more and then if it does make another request, including the Page.
GetTokenBalancesOrganizedInDictionary. This will fetch all of the TokenBalances for a given contractAddress and userAccountAddress and organize them into a Dictionary mapping tokenID (BigInteger) to TokenBalance. In general, you’ll want to use this most often.
Get Token Supplies
If you need to fetch the total token supply for a given smart contract, you can use theGetTokenSupplies async Task.
Get Token Supplies Map
ForGetTokenSupplies power users, we also provide a GetTokenSuppliesMap async Task that allows you to fetch the supplies for multiple token contracts and token ids in a map.
suppliesMap[usdcAddress].Length = 1 with the TokenSupply object relating to the supply of the ERC20 token.
Similarly, you can expect that suppliesMap[skyweaverAddress].Length = 3 with the TokenSupply object relating to the specified token ids.
Get Transaction history
To fetch the transaction history for a given account, you’ll want to use theGetTransactionHistory method.
TransactionHistoryFilter object allows you to specify how you want to filter your transaction history query, e.g. by account address(es), contract address(es), etc. More info here.