connectComet
Auto-detects the CometBFT/Tendermint version and returns the appropriate client.CometClient
CometClient is a union type of all version-specific clients: Tendermint37Client | Comet38Client | Comet1Client. They share these methods:
| Method | Parameters | Returns |
|---|---|---|
status | — | Promise<StatusResponse> |
block | height?: number | Promise<BlockResponse> |
blockResults | height?: number | Promise<BlockResultsResponse> |
blockchain | minHeight?: number, maxHeight?: number | Promise<BlockchainResponse> |
tx | params: TxParams | Promise<TxResponse> |
txSearch | params: TxSearchParams | Promise<TxSearchResponse> |
validators | params: ValidatorsParams | Promise<ValidatorsResponse> |
broadcastTxSync | params: BroadcastTxParams | Promise<BroadcastTxSyncResponse> |
broadcastTxAsync | params: BroadcastTxParams | Promise<BroadcastTxAsyncResponse> |
broadcastTxCommit | params: BroadcastTxParams | Promise<BroadcastTxCommitResponse> |
abciQuery | params: AbciQueryParams | Promise<AbciQueryResponse> |
disconnect | — | void |
Version-Specific Clients
Tendermint37Client
For Tendermint 0.37 nodes.| Method | Parameters | Returns |
|---|---|---|
connect (static) | endpoint: string | HttpEndpoint | Promise<Tendermint37Client> |
create (static) | rpcClient: RpcClient | Tendermint37Client |
Comet38Client
For CometBFT 0.38 nodes.| Method | Parameters | Returns |
|---|---|---|
connect (static) | endpoint: string | HttpEndpoint | Promise<Comet38Client> |
create (static) | rpcClient: RpcClient | Comet38Client |
Comet1Client
For CometBFT 1.x nodes.| Method | Parameters | Returns |
|---|---|---|
connect (static) | endpoint: string | HttpEndpoint | Promise<Comet1Client> |
create (static) | rpcClient: RpcClient | Comet1Client |
Type Guards
| Function | Parameters | Returns |
|---|---|---|
isTendermint37Client | client: CometClient | client is Tendermint37Client |
isComet38Client | client: CometClient | client is Comet38Client |
isComet1Client | client: CometClient | client is Comet1Client |
true.
RPC Clients
Low-level HTTP and WebSocket implementations.HttpClient
Standard HTTP client for request/response RPC.| Method | Parameters | Returns |
|---|---|---|
constructor | endpoint: string | HttpEndpoint, timeout?: number | HttpClient |
execute | request: JsonRpcRequest | Promise<JsonRpcSuccessResponse> |
disconnect | — | void |
HttpBatchClient
Batches multiple RPC requests into a single HTTP call.| Method | Parameters | Returns |
|---|---|---|
constructor | endpoint: string | HttpEndpoint, options?: Partial<HttpBatchClientOptions> | HttpBatchClient |
execute | request: JsonRpcRequest | Promise<JsonRpcSuccessResponse> |
disconnect | — | void |
WebsocketClient
WebSocket client for streaming subscriptions.| Method | Parameters | Returns |
|---|---|---|
constructor | endpoint: string, onError?: (err: any) => void | WebsocketClient |
execute | request: JsonRpcRequest | Promise<JsonRpcSuccessResponse> |
listen | request: JsonRpcRequest | Stream<SubscriptionEvent> |
connected | — | Promise<void> (resolves when the socket is connected) |
disconnect | — | void |
Key Types
HttpEndpoint
RpcClient
BlockIdFlag
Date Utilities
| Function | Parameters | Returns |
|---|---|---|
fromRfc3339WithNanoseconds | str: string | DateWithNanoseconds |
toRfc3339WithNanoseconds | date: ReadonlyDateWithNanoseconds | string |
fromSeconds | seconds: number, nanos?: number | DateWithNanoseconds |
toSeconds | date: ReadonlyDateWithNanoseconds | { seconds: number; nanos: number } |
Address Utilities
| Function | Parameters | Returns |
|---|---|---|
pubkeyToAddress | type: "ed25519" | "secp256k1", data: Uint8Array | string |
pubkeyToRawAddress | type: "ed25519" | "secp256k1", data: Uint8Array | Uint8Array |
rawSecp256k1PubkeyToRawAddress | pubkeyData: Uint8Array | Uint8Array |
rawEd25519PubkeyToRawAddress | pubkeyData: Uint8Array | Uint8Array |