@@ -5,6 +5,7 @@ import { IBC } from "./foundry/transaction";
55import { delay } from "./util" ;
66import Debug from "debug" ;
77import { ClientState } from "./foundry/types" ;
8+ import { IBCHeader , IBCQueryResult } from "./types" ;
89
910const debug = Debug ( "common:tx" ) ;
1011
@@ -36,7 +37,7 @@ export interface ChainConfig {
3637export class Chain {
3738 private readonly sdk : SDK ;
3839 private readonly faucetAddress : PlatformAddress ;
39- private readonly counterpartyIdentifiers : CounterpartyIdentifiers ;
40+ public readonly counterpartyIdentifiers : CounterpartyIdentifiers ;
4041
4142 public constructor ( config : ChainConfig ) {
4243 this . sdk = new SDK ( {
@@ -64,6 +65,19 @@ export class Chain {
6465 public async latestHeight ( ) : Promise < number > {
6566 return await this . sdk . rpc . chain . getBestBlockNumber ( ) ;
6667 }
68+
69+ public async queryClient (
70+ blockNumber : number
71+ ) : Promise < IBCQueryResult < ClientState > | null > {
72+ return this . sdk . rpc . sendRpcRequest ( "ibc_query_client_state" , [
73+ this . counterpartyIdentifiers . client ,
74+ blockNumber
75+ ] ) ;
76+ }
77+
78+ public async queryHeader ( blockNumber : number ) : Promise < IBCHeader | null > {
79+ return this . sdk . rpc . sendRpcRequest ( "ibc_compose_header" , [ blockNumber ] ) ;
80+ }
6781}
6882
6983async function waitForTx ( sdk : SDK , txHash : H256 ) {
0 commit comments