Query data

Query data#

After you’re connected to the blockchain via an LCDClient instance, you can query data from it. Data access is organized into various module APIs, which are accessible from within the LCDClient instance. Because they make HTTP requests in the background, they are Promises that can be awaited in order to not block during network IO.

async main() {
  const marketParams = await terra.market.parameters();
  const exchangeRates = await terra.oracle.exchangeRates();
  console.log(marketParams.base_pool);
  console.log(exchangeRates.get('uusd'));
}

main();

Each module has its own set of querying functions. To get a comprehensive list, explore the module documentation: