RESTClient
that simplifies the process of querying data from both the Initia L1 and rollups. This client encapsulates various endpoints and methods into user-friendly helper functions, organized under sub-categories of the rest
client based on their corresponding Cosmos SDK modules.
In this tutorial, we’ll explore several examples demonstrating how to leverage these helper functions to retrieve key data points efficiently using the SDK.
For demonstration purposes, we will assume that all of these examples are implemented in a file named src/query.ts
.
balance
function from the bank
module. This function takes in an address and returns the balance of the account.
First, we will make the necessary imports and initialize the RESTClient
.
next_key
in the pagination object, which we can use to get the next page of results. We will then keep looping through the results until we have all the pages, which we will know is the case when next_key
is null
.
balance()
: query the balance of an accountblockInfo()
: query the block informationtxInfo()
: query the transaction informationprice()
: query the oracle priceviewfunction()
: query the move contract view functionsviewJSON()
: query the move contract view functions with JSON argumentsresources()
: query the move contract resourcesmodules()
: query the move contract modulestableInfo()
: query the move contract table infocontractInfo()
: query the wasm contract infosmartContractState()
: query the wasm smart contract statecall()
: query the evm contract