InterchainJS
Networks
Cosmos
Rpc
Overview

Cosmos Query Client RPC Tests

This directory contains functional tests for the Cosmos Query Client using the Osmosis RPC endpoint.

Overview

The tests in query-client.test.ts validate all query-client related functions by making actual RPC calls to the Osmosis mainnet RPC endpoint at https://rpc.osmosis.zone/.

Test Categories

1. Connection Management

  • Connection establishment and disconnection
  • Protocol information retrieval

2. Basic Info Methods

  • getStatus() - Chain status information
  • getAbciInfo() - ABCI application info
  • getHealth() - Node health status
  • getNetInfo() - Network information and peers

3. Block Query Methods

  • getBlock() - Retrieve block by height or latest
  • getBlockByHash() - Retrieve block by hash
  • getBlockResults() - Get block execution results
  • getBlockchain() - Get range of block metadata
  • getHeader() - Get block header by height
  • getHeaderByHash() - Get block header by hash
  • getCommit() - Get block commit information
  • searchBlocks() - Search blocks with query

4. Transaction Query Methods

  • getTx() - Get transaction by hash
  • searchTxs() - Search transactions with query
  • getUnconfirmedTxs() - Get unconfirmed transactions
  • getNumUnconfirmedTxs() - Get count of unconfirmed transactions

5. Chain Query Methods

  • getValidators() - Get validator set with pagination
  • getConsensusParams() - Get consensus parameters
  • getGenesis() - Get genesis data

6. ABCI Query Methods

  • queryAbci() - Execute ABCI queries

7. Error Handling

  • Invalid block heights
  • Invalid hashes
  • Invalid pagination parameters

Running the Tests

# Run all RPC tests
npm run test:rpc
 
# Run tests in watch mode
npm run test:rpc:watch
 
# Run specific test file
npx jest --config ./jest.rpc.config.js rpc/query-client.test.ts

Test Configuration

The tests use the following configuration:

  • Endpoint: https://rpc.osmosis.zone/
  • Timeout: 30 seconds per request
  • Test Timeout: 60 seconds per test

Notes

  • These are functional tests that make real network requests
  • Tests may fail if the RPC endpoint is unavailable or rate-limited
  • Some tests depend on chain state (e.g., finding transactions)
  • The tests validate response structures based on Tendermint RPC v0.34 specification

References