Returns a interface used to interact with the CosmWASM Contracts on chain.
getCosmWasmClient contains helper functions to get a CosmWasmClient. This should be used for querying smart contracts only. If you need to call a contracts execute msg, see the SigningCosmWasmClient below.
// Create a CosmWasmClient constcosmWasmClient = awaitgetCosmWasmClient(RPC_URL);
Example: Querying a Contract
Build the queryMsg according to the contracts specific query specifications. Each contract will define its own queryable state, so check the contract documentation for the correct query message format by examining the contract source code or documentation.
// Create the query msg json based on contract specific query specifications constqueryMsg = { tokens: { owner:address, }, };
// Query a smart contract state constqueryResponse = cosmWasmClient.queryContractSmart(CONTRACT_ADDR, queryMsg);
Returns a interface used to interact with the CosmWASM Contracts on chain.
getCosmWasmClientcontains helper functions to get aCosmWasmClient. This should be used for querying smart contracts only. If you need to call a contracts execute msg, see theSigningCosmWasmClientbelow.Example: Getting a Client
Example: Querying a Contract
Build the
queryMsgaccording to the contracts specific query specifications. Each contract will define its own queryable state, so check the contract documentation for the correct query message format by examining the contract source code or documentation.