02QueryingChainWasmX - InjectiveLabs/injective-ts GitHub Wiki

:warning: The Docs have been moved to https://docs.ts.injective.network/querying/querying-chain/querying-chain-wasmx :warning:

Example code snippets to query the wasmX module on chain

Using gRPC

  • Get parameters related to the wasmX module
import { ChainGrpcWasmXApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const chainGrpcWasmXApi = new ChainGrpcWasmXApi(endpoints.grpc);

const moduleParams = await chainGrpcWasmXApi.fetchModuleParams();

console.log(moduleParams);
  • Get the wasmX module state
import { ChainGrpcWasmXApi } from "@injectivelabs/sdk-ts";
import { getNetworkEndpoints, Network } from "@injectivelabs/networks";

const endpoints = getNetworkEndpoints(Network.TestnetK8s);
const chainGrpcWasmXApi = new ChainGrpcWasmXApi(endpoints.grpc);

const moduleState = await chainGrpcWasmXApi.fetchModuleState();

console.log(moduleState);