Link Search Menu Expand Document



The class CosmWasmClient is exported from the CosmJS package @cosmjs/cosmwasm-stargate (🔗 Link). It already comes with a handful of methods that can be used to execute frequently used queries.

It is used only to execute queries. NOT to work with signed transactions. If you are looking for the documentation for this, please see the 🔗 CosmWasmSigningClient documentation.

To execute extended queries, please refer to the 🔗 Query documentation.


import { CosmWasmClient } from "cosmwasm";

// This is your rpc endpoint
const rpcEndpoint = "";

async function main() {
  const client = await CosmWasmClient.connect(rpcEndpoint);


Available Methods


Method Description Params
.connect() Returns the client. tmClient: Tendermint34Client
.getChainId() Get current chain’s ID. none
.getHeight() Get current height of the chain. none
.getAccount() Get more information about an account. searchAddress: string
.getSequence()   address: string
.getBlock()   height?: number
.getBalance()   address: string, searchDenom: string


Method Description Params
.getTx()   id: string
.searchTx()   query: SearchTxQuery, filter: SearchTxFilter = {}
.txsQuery()   query: string


Method Description Params
.getCodes()   none
.getCodeDetails()   codeId: number

Smart Contracts

Method Description Params
.getContracts()   cideId: number
.getContract()   address: string
.queryContractRaw()   address: string, key: Uint8Array
.queryContractSmart()   address: string, queryMsg: Record<string, unknown>