@zuhaibnoor/zigchain-sdk 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth/ChainAuthApi.d.ts +0 -3
- package/dist/auth/ChainAuthApi.d.ts.map +1 -1
- package/dist/auth/ChainAuthApi.js +0 -26
- package/dist/auth/ChainAuthApi.js.map +1 -1
- package/dist/bank/ChainBankApi.d.ts +0 -9
- package/dist/bank/ChainBankApi.d.ts.map +1 -1
- package/dist/bank/ChainBankApi.js +0 -18
- package/dist/bank/ChainBankApi.js.map +1 -1
- package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
- package/dist/circuit/ChainCircuitApi.js.map +1 -1
- package/dist/client/http.d.ts +1 -0
- package/dist/client/http.d.ts.map +1 -1
- package/dist/client/http.js +10 -0
- package/dist/client/http.js.map +1 -1
- package/dist/dex/ChainDexApi.d.ts.map +1 -1
- package/dist/dex/ChainDexApi.js.map +1 -1
- package/dist/distribution/ChainDistributionApi.d.ts +47 -0
- package/dist/distribution/ChainDistributionApi.d.ts.map +1 -0
- package/dist/distribution/ChainDistributionApi.js +74 -0
- package/dist/distribution/ChainDistributionApi.js.map +1 -0
- package/dist/distribution/types.d.ts +71 -0
- package/dist/distribution/types.d.ts.map +1 -0
- package/dist/distribution/types.js +2 -0
- package/dist/distribution/types.js.map +1 -0
- package/dist/evidence/ChainEvidenceApi.d.ts +15 -0
- package/dist/evidence/ChainEvidenceApi.d.ts.map +1 -0
- package/dist/evidence/ChainEvidenceApi.js +22 -0
- package/dist/evidence/ChainEvidenceApi.js.map +1 -0
- package/dist/evidence/types.d.ts +15 -0
- package/dist/evidence/types.d.ts.map +1 -0
- package/dist/evidence/types.js +2 -0
- package/dist/evidence/types.js.map +1 -0
- package/dist/feegrant/ChainFeegrantApi.d.ts +22 -0
- package/dist/feegrant/ChainFeegrantApi.d.ts.map +1 -0
- package/dist/feegrant/ChainFeegrantApi.js +32 -0
- package/dist/feegrant/ChainFeegrantApi.js.map +1 -0
- package/dist/feegrant/types.d.ts +17 -0
- package/dist/feegrant/types.d.ts.map +1 -0
- package/dist/feegrant/types.js +2 -0
- package/dist/feegrant/types.js.map +1 -0
- package/dist/ibc/ChainIbcApi.d.ts +55 -0
- package/dist/ibc/ChainIbcApi.d.ts.map +1 -0
- package/dist/ibc/ChainIbcApi.js +82 -0
- package/dist/ibc/ChainIbcApi.js.map +1 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts +55 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts.map +1 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.js +82 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.js.map +1 -0
- package/dist/ibc/ibcChannel/types.d.ts +106 -0
- package/dist/ibc/ibcChannel/types.d.ts.map +1 -0
- package/dist/ibc/ibcChannel/types.js +2 -0
- package/dist/ibc/ibcChannel/types.js.map +1 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts +14 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts.map +1 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js +38 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js.map +1 -0
- package/dist/ibc/ibcChannelV2/types.d.ts +26 -0
- package/dist/ibc/ibcChannelV2/types.d.ts.map +1 -0
- package/dist/ibc/ibcChannelV2/types.js +3 -0
- package/dist/ibc/ibcChannelV2/types.js.map +1 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts +15 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts.map +1 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.js +39 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.js.map +1 -0
- package/dist/ibc/ibcClient/types.d.ts +53 -0
- package/dist/ibc/ibcClient/types.d.ts.map +1 -0
- package/dist/ibc/ibcClient/types.js +2 -0
- package/dist/ibc/ibcClient/types.js.map +1 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts +11 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts.map +1 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js +24 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js.map +1 -0
- package/dist/ibc/ibcConnection/types.d.ts +18 -0
- package/dist/ibc/ibcConnection/types.d.ts.map +1 -0
- package/dist/ibc/ibcConnection/types.js +2 -0
- package/dist/ibc/ibcConnection/types.js.map +1 -0
- package/dist/ibc/types.d.ts +106 -0
- package/dist/ibc/types.d.ts.map +1 -0
- package/dist/ibc/types.js +2 -0
- package/dist/ibc/types.js.map +1 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.d.ts +12 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.d.ts.map +1 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.js +30 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.js.map +1 -0
- package/dist/ibc-transfer/types.d.ts +26 -0
- package/dist/ibc-transfer/types.d.ts.map +1 -0
- package/dist/ibc-transfer/types.js +2 -0
- package/dist/ibc-transfer/types.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/interchain-accounts/ChainInterChainAccApi.d.ts +9 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.d.ts.map +1 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.js +16 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.js.map +1 -0
- package/dist/interchain-accounts/types.d.ts +12 -0
- package/dist/interchain-accounts/types.d.ts.map +1 -0
- package/dist/interchain-accounts/types.js +2 -0
- package/dist/interchain-accounts/types.js.map +1 -0
- package/dist/networks/endpoints.js +2 -2
- package/dist/networks/endpoints.js.map +1 -1
- package/dist/runtime/ChainRuntimeApi.d.ts +12 -0
- package/dist/runtime/ChainRuntimeApi.d.ts.map +1 -0
- package/dist/runtime/ChainRuntimeApi.js +16 -0
- package/dist/runtime/ChainRuntimeApi.js.map +1 -0
- package/dist/runtime/types.d.ts +4 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/staking/ChainStakingApi.d.ts +1 -5
- package/dist/staking/ChainStakingApi.d.ts.map +1 -1
- package/dist/staking/ChainStakingApi.js +9 -7
- package/dist/staking/ChainStakingApi.js.map +1 -1
- package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts +19 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts.map +1 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.js +26 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.js.map +1 -0
- package/dist/tokenwrapper/types.d.ts +15 -0
- package/dist/tokenwrapper/types.d.ts.map +1 -0
- package/dist/tokenwrapper/types.js +2 -0
- package/dist/tokenwrapper/types.js.map +1 -0
- package/dist/txs/ChainTxsApi.d.ts +12 -0
- package/dist/txs/ChainTxsApi.d.ts.map +1 -0
- package/dist/txs/ChainTxsApi.js +17 -0
- package/dist/txs/ChainTxsApi.js.map +1 -0
- package/dist/txs/types.d.ts +22 -0
- package/dist/txs/types.d.ts.map +1 -0
- package/dist/txs/types.js +5 -0
- package/dist/txs/types.js.map +1 -0
- package/dist/upgrade/ChainUpgradeApi.d.ts +22 -0
- package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -0
- package/dist/upgrade/ChainUpgradeApi.js +40 -0
- package/dist/upgrade/ChainUpgradeApi.js.map +1 -0
- package/dist/upgrade/types.d.ts +24 -0
- package/dist/upgrade/types.d.ts.map +1 -0
- package/dist/upgrade/types.js +5 -0
- package/dist/upgrade/types.js.map +1 -0
- package/dist/validator-set/ChainCometValidator.d.ts +8 -0
- package/dist/validator-set/ChainCometValidator.d.ts.map +1 -0
- package/dist/validator-set/ChainCometValidator.js +15 -0
- package/dist/validator-set/ChainCometValidator.js.map +1 -0
- package/dist/validator-set/ChainValidator.d.ts +8 -0
- package/dist/validator-set/ChainValidator.d.ts.map +1 -0
- package/dist/validator-set/ChainValidator.js +15 -0
- package/dist/validator-set/ChainValidator.js.map +1 -0
- package/dist/validator-set/types.d.ts +18 -0
- package/dist/validator-set/types.d.ts.map +1 -0
- package/dist/validator-set/types.js +2 -0
- package/dist/validator-set/types.js.map +1 -0
- package/dist/wasm/ChainWasmApi.d.ts +57 -0
- package/dist/wasm/ChainWasmApi.d.ts.map +1 -0
- package/dist/wasm/ChainWasmApi.js +78 -0
- package/dist/wasm/ChainWasmApi.js.map +1 -0
- package/dist/wasm/types.d.ts +77 -0
- package/dist/wasm/types.d.ts.map +1 -0
- package/dist/wasm/types.js +2 -0
- package/dist/wasm/types.js.map +1 -0
- package/docs/auth.md +438 -72
- package/docs/bank.md +782 -123
- package/docs/block-results.md +328 -21
- package/docs/block.md +325 -38
- package/docs/circuit.md +164 -35
- package/docs/dex.md +313 -63
- package/docs/distribution.md +772 -0
- package/docs/evidence.md +194 -0
- package/docs/factory.md +308 -62
- package/docs/feegrant.md +206 -0
- package/docs/gov.md +364 -0
- package/docs/ibc/ibcChannel.md +977 -0
- package/docs/ibc/ibcClient.md +771 -0
- package/docs/ibc/ibcConnection.md +214 -0
- package/docs/ibc-transfer.md +463 -0
- package/docs/interchain-accounts.md +223 -0
- package/docs/mint.md +270 -0
- package/docs/runtime.md +120 -0
- package/docs/slashing.md +287 -0
- package/docs/staking.md +756 -0
- package/docs/tokenwrapper.md +294 -0
- package/docs/txs.md +447 -0
- package/docs/upgrade.md +356 -0
- package/docs/validator-set.md +177 -0
- package/docs/wasm.md +916 -0
- package/package.json +1 -1
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
# IBC Client Module
|
|
2
|
+
|
|
3
|
+
## What is the IBC Client Module?
|
|
4
|
+
|
|
5
|
+
The **IBC Client module** allows you to query information about IBC (Inter-Blockchain Communication) light clients.
|
|
6
|
+
|
|
7
|
+
IBC clients are light clients that verify the state of other blockchains within ZigChain. They maintain state history and validate cross-chain transactions.
|
|
8
|
+
|
|
9
|
+
This module helps you:
|
|
10
|
+
|
|
11
|
+
* Query client configurations
|
|
12
|
+
* Monitor client status and health
|
|
13
|
+
* Verify cross-chain communication setup
|
|
14
|
+
* Track client creators and parameters
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Important Terminology
|
|
19
|
+
|
|
20
|
+
Before documenting functions, let's define key terms.
|
|
21
|
+
|
|
22
|
+
### IBC Client
|
|
23
|
+
|
|
24
|
+
An **IBC Client** is a light client that tracks the consensus state of another blockchain.
|
|
25
|
+
|
|
26
|
+
Each client:
|
|
27
|
+
* Is assigned a unique `client_id`
|
|
28
|
+
* Verifies state proofs from another chain
|
|
29
|
+
* Maintains a history of consensus states
|
|
30
|
+
* Can be updated with new blocks
|
|
31
|
+
|
|
32
|
+
Example client ID:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
07-tendermint-40
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The naming convention is `<light-client-type>-<instance-number>`.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Client State
|
|
43
|
+
|
|
44
|
+
The **Client State** contains the configuration and current status of a light client.
|
|
45
|
+
|
|
46
|
+
It includes:
|
|
47
|
+
* Chain ID of the remote chain
|
|
48
|
+
* Trust parameters
|
|
49
|
+
* Latest verified height
|
|
50
|
+
* Proof specifications
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Consensus State
|
|
55
|
+
|
|
56
|
+
A **Consensus State** is a snapshot of a blockchain's validator set and app hash at a specific height.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### Revision Number and Height
|
|
61
|
+
|
|
62
|
+
IBC blockchains use a two-part height identifier:
|
|
63
|
+
|
|
64
|
+
* **Revision Number** – Increments on chain upgrades
|
|
65
|
+
* **Revision Height** – Block number within that revision
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
revision_number: 3
|
|
71
|
+
revision_height: 20311715
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This represents block `20311715` in revision `3`.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Client Status
|
|
79
|
+
|
|
80
|
+
The **Client Status** indicates the operational state of a light client.
|
|
81
|
+
|
|
82
|
+
Possible values:
|
|
83
|
+
|
|
84
|
+
* `Active` – Client is operational
|
|
85
|
+
* `Expired` – Client has expired (no updates)
|
|
86
|
+
* `Frozen` – Client is frozen due to misbehavior
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Light Client Type
|
|
91
|
+
|
|
92
|
+
Different light client implementations for different blockchain types.
|
|
93
|
+
|
|
94
|
+
Common types:
|
|
95
|
+
|
|
96
|
+
* `07-tendermint` – Tendermint consensus
|
|
97
|
+
* `06-solomachine` – Solo machine client
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
# Functions Documentation
|
|
102
|
+
|
|
103
|
+
Setup:
|
|
104
|
+
```ts
|
|
105
|
+
import {
|
|
106
|
+
ChainIbcClientApi,
|
|
107
|
+
getNetworkEndpoints,
|
|
108
|
+
Network
|
|
109
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
110
|
+
|
|
111
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
112
|
+
const clientApi = new ChainIbcClientApi(endpoints)
|
|
113
|
+
|
|
114
|
+
const clientId = '07-tendermint-40'
|
|
115
|
+
const revision_no = '3'
|
|
116
|
+
const revision_height = '20311715'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
# 1️⃣ fetchConsensusState
|
|
122
|
+
|
|
123
|
+
## Method
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
async fetchConsensusState(
|
|
127
|
+
clientId: string,
|
|
128
|
+
height: number | string,
|
|
129
|
+
rev_no: number | string
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## CLI Equivalent
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
zigchaind query ibc client consensus-state <client-id> <revision-number> <revision-height>
|
|
137
|
+
```
|
|
138
|
+
## Description
|
|
139
|
+
|
|
140
|
+
Fetches the **consensus state of a client at a specific height**.
|
|
141
|
+
|
|
142
|
+
Returns the validator set and app hash at that block, along with proof information.
|
|
143
|
+
|
|
144
|
+
## Parameters
|
|
145
|
+
|
|
146
|
+
| Name | Type | Description |
|
|
147
|
+
| -------- | ----------------- | ------------------------------------- |
|
|
148
|
+
| clientId | string | IBC client identifier (e.g., `07-tendermint-40`) |
|
|
149
|
+
| height | number \| string | Revision height (block number) |
|
|
150
|
+
| rev_no | number \| string | Revision number |
|
|
151
|
+
|
|
152
|
+
## Usage Example
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const consensusState = await clientApi.fetchConsensusState(
|
|
156
|
+
'07-tendermint-40',
|
|
157
|
+
'20311715',
|
|
158
|
+
'3'
|
|
159
|
+
)
|
|
160
|
+
console.dir(consensusState, { depth: null })
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Example Response
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"consensus_state": {
|
|
168
|
+
"@type": "/ibc.lightclients.tendermint.v1.ConsensusState",
|
|
169
|
+
"timestamp": "2025-08-07T09:58:01.945662422Z",
|
|
170
|
+
"root": {
|
|
171
|
+
"hash": "z5EtwHpY4eOr2J9pxHRVC0jO68sjrEq5kOFKXZ4Un8c="
|
|
172
|
+
},
|
|
173
|
+
"next_validators_hash": "C7A4E4A6E4D3CE7EE93C83CDC6EC2A68F2C424AC8DD6CB9F769B55D8FE14BCF9"
|
|
174
|
+
},
|
|
175
|
+
"proof": null,
|
|
176
|
+
"proof_height": {
|
|
177
|
+
"revision_number": "2",
|
|
178
|
+
"revision_height": "4647355"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Response Field Explanation
|
|
184
|
+
|
|
185
|
+
### `consensus_state`
|
|
186
|
+
|
|
187
|
+
The consensus state of the remote blockchain at that height.
|
|
188
|
+
|
|
189
|
+
| Field | Description |
|
|
190
|
+
| --------------------- | ------------------------------------- |
|
|
191
|
+
| @type | Type of consensus state |
|
|
192
|
+
| timestamp | When this consensus state was created |
|
|
193
|
+
| root | App hash (merkle root) |
|
|
194
|
+
| next_validators_hash | Hash of next validator set |
|
|
195
|
+
|
|
196
|
+
### `proof`
|
|
197
|
+
|
|
198
|
+
Merkle proof for verification (usually null for queries).
|
|
199
|
+
|
|
200
|
+
### `proof_height`
|
|
201
|
+
|
|
202
|
+
Height of the proof on the ZigChain blockchain.
|
|
203
|
+
|
|
204
|
+
## When to Use
|
|
205
|
+
|
|
206
|
+
* Verifying state from a specific height on remote chain
|
|
207
|
+
* Accessing historical consensus information
|
|
208
|
+
* Validating cross-chain proofs
|
|
209
|
+
* Debugging IBC transactions
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
# 2️⃣ fetchConsensusStates
|
|
214
|
+
|
|
215
|
+
## Method
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
async fetchConsensusStates(clientId: string)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## CLI Equivalent
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
zigchaind query ibc client consensus-states <client-id>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
## Description
|
|
229
|
+
|
|
230
|
+
Fetches **all consensus states** stored for a client.
|
|
231
|
+
|
|
232
|
+
Returns a paginated list of every consensus state the client has verified.
|
|
233
|
+
|
|
234
|
+
## Parameters
|
|
235
|
+
|
|
236
|
+
| Name | Type | Description |
|
|
237
|
+
| -------- | ------ | ------------------------------ |
|
|
238
|
+
| clientId | string | IBC client identifier |
|
|
239
|
+
|
|
240
|
+
## Usage Example
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
const states = await clientApi.fetchConsensusStates('07-tendermint-40')
|
|
244
|
+
console.dir(states, { depth: null })
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Example Response
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"consensus_states": [
|
|
252
|
+
{
|
|
253
|
+
"height": {
|
|
254
|
+
"revision_number": "3",
|
|
255
|
+
"revision_height": "20214158"
|
|
256
|
+
},
|
|
257
|
+
"consensus_state": {
|
|
258
|
+
"@type": "/ibc.lightclients.tendermint.v1.ConsensusState",
|
|
259
|
+
"timestamp": "2025-08-01T01:03:18.104587239Z",
|
|
260
|
+
"root": {
|
|
261
|
+
"hash": "S4bGyoy7tgkNwGo/+rMIbLwgT3k2wbUcdgJ0/2dO77A="
|
|
262
|
+
},
|
|
263
|
+
"next_validators_hash": "3D03EA8EA7B8F287D43FA16CD76EDC99DEA2FF78B9F3F4E26F1C5F38A702988E"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"height": {
|
|
268
|
+
"revision_number": "3",
|
|
269
|
+
"revision_height": "20214413"
|
|
270
|
+
},
|
|
271
|
+
"consensus_state": {
|
|
272
|
+
"@type": "/ibc.lightclients.tendermint.v1.ConsensusState",
|
|
273
|
+
"timestamp": "2025-08-01T01:27:16.945419603Z",
|
|
274
|
+
"root": {
|
|
275
|
+
"hash": "hG5WlVXUUlmq8Gj50VySITymGCJamkSFaT+2X1VIh8A="
|
|
276
|
+
},
|
|
277
|
+
"next_validators_hash": "3D03EA8EA7B8F287D43FA16CD76EDC99DEA2FF78B9F3F4E26F1C5F38A702988E"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
"pagination": {
|
|
282
|
+
"next_key": null,
|
|
283
|
+
"total": "10"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Response Field Explanation
|
|
289
|
+
|
|
290
|
+
### `consensus_states`
|
|
291
|
+
|
|
292
|
+
Array of consensus state entries.
|
|
293
|
+
|
|
294
|
+
Each entry contains:
|
|
295
|
+
|
|
296
|
+
| Field | Description |
|
|
297
|
+
| ------------------ | ------------------------------------- |
|
|
298
|
+
| height | Revision number and height |
|
|
299
|
+
| consensus_state | The consensus state data |
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
# 3️⃣ fetchConsensusStateHeights
|
|
305
|
+
|
|
306
|
+
## Method
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
async fetchConsensusStateHeights(clientId: string)
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## CLI Equivalent
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
zigchaind query ibc client consensus-state-heights <client-id>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Description
|
|
319
|
+
|
|
320
|
+
Fetches **all heights** at which consensus states are stored for a client.
|
|
321
|
+
|
|
322
|
+
Returns a lightweight list of heights without full state data.
|
|
323
|
+
|
|
324
|
+
Useful for efficient lookups and pagination.
|
|
325
|
+
|
|
326
|
+
## Parameters
|
|
327
|
+
|
|
328
|
+
| Name | Type | Description |
|
|
329
|
+
| -------- | ------ | --------------------- |
|
|
330
|
+
| clientId | string | IBC client identifier |
|
|
331
|
+
|
|
332
|
+
## Usage Example
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
const heights = await clientApi.fetchConsensusStateHeights('07-tendermint-40')
|
|
336
|
+
console.dir(heights, { depth: null })
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Example Response
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"consensus_state_heights": [
|
|
344
|
+
{ "revision_number": "3", "revision_height": "20214158" },
|
|
345
|
+
{ "revision_number": "3", "revision_height": "20214413" },
|
|
346
|
+
{ "revision_number": "3", "revision_height": "20228806" },
|
|
347
|
+
{ "revision_number": "3", "revision_height": "20244115" },
|
|
348
|
+
{ "revision_number": "3", "revision_height": "20259431" },
|
|
349
|
+
{ "revision_number": "3", "revision_height": "20274741" },
|
|
350
|
+
{ "revision_number": "3", "revision_height": "20310435" },
|
|
351
|
+
{ "revision_number": "3", "revision_height": "20311711" },
|
|
352
|
+
{ "revision_number": "3", "revision_height": "20311714" },
|
|
353
|
+
{ "revision_number": "3", "revision_height": "20311715" }
|
|
354
|
+
],
|
|
355
|
+
"pagination": {
|
|
356
|
+
"next_key": null,
|
|
357
|
+
"total": "10"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Response Field Explanation
|
|
363
|
+
|
|
364
|
+
### `consensus_state_heights`
|
|
365
|
+
|
|
366
|
+
Array of height objects at which consensus states are stored.
|
|
367
|
+
|
|
368
|
+
Each entry contains:
|
|
369
|
+
|
|
370
|
+
| Field | Description |
|
|
371
|
+
| ------------------ | ---------------- |
|
|
372
|
+
| revision_number | Revision number |
|
|
373
|
+
| revision_height | Block height |
|
|
374
|
+
|
|
375
|
+
### `pagination`
|
|
376
|
+
|
|
377
|
+
Pagination information.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
# 4️⃣ fetchClientCreator
|
|
382
|
+
|
|
383
|
+
## Method
|
|
384
|
+
|
|
385
|
+
```ts
|
|
386
|
+
async fetchClientCreator(clientId: string)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## CLI Equivalent
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
zigchaind query ibc client client-creator <client-id>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Description
|
|
396
|
+
|
|
397
|
+
Fetches the **address that created** the IBC client.
|
|
398
|
+
|
|
399
|
+
This shows who initialized the client on ZigChain.
|
|
400
|
+
|
|
401
|
+
## Parameters
|
|
402
|
+
|
|
403
|
+
| Name | Type | Description |
|
|
404
|
+
| -------- | ------ | --------------------- |
|
|
405
|
+
| clientId | string | IBC client identifier |
|
|
406
|
+
|
|
407
|
+
## Usage Example
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
const creator = await clientApi.fetchClientCreator('07-tendermint-40')
|
|
411
|
+
console.dir(creator, { depth: null })
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Example Response
|
|
415
|
+
|
|
416
|
+
```json
|
|
417
|
+
{
|
|
418
|
+
"creator": "zig1xj0nym9p4mugg93cmxa46unzy0lt2hvddm2986"
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
## Response Field Explanation
|
|
424
|
+
|
|
425
|
+
| Field | Description |
|
|
426
|
+
| ------- | ------------------------------ |
|
|
427
|
+
| creator | Bech32 address of client creator |
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
## When to Use
|
|
431
|
+
|
|
432
|
+
* Auditing client creation
|
|
433
|
+
* Tracking who set up cross-chain connections
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
# 5️⃣ fetchClientParams
|
|
437
|
+
|
|
438
|
+
## Method
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
async fetchClientParams()
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## CLI Equivalent
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
zigchaind query ibc client params
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
## Description
|
|
452
|
+
|
|
453
|
+
Fetches the **IBC client module parameters**.
|
|
454
|
+
|
|
455
|
+
These are chain-level settings that control client behavior.
|
|
456
|
+
|
|
457
|
+
## Parameters
|
|
458
|
+
|
|
459
|
+
None.
|
|
460
|
+
|
|
461
|
+
## Usage Example
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
const params = await clientApi.fetchClientParams()
|
|
465
|
+
console.dir(params, { depth: null })
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## Example Response
|
|
469
|
+
|
|
470
|
+
```json
|
|
471
|
+
{
|
|
472
|
+
"params": {
|
|
473
|
+
"allowed_clients": ["*"]
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
## Response Field Explanation
|
|
479
|
+
|
|
480
|
+
### `params`
|
|
481
|
+
|
|
482
|
+
Client module parameters.
|
|
483
|
+
|
|
484
|
+
| Field | Description |
|
|
485
|
+
| ----------------- | ------------------------------------- |
|
|
486
|
+
| allowed_clients | List of allowed client types |
|
|
487
|
+
|
|
488
|
+
### `allowed_clients`
|
|
489
|
+
|
|
490
|
+
Array of permitted light client types.
|
|
491
|
+
|
|
492
|
+
* `*` – All client types allowed
|
|
493
|
+
* List of specific types – Only those types allowed
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
## When to Use
|
|
498
|
+
|
|
499
|
+
* Checking which light clients can be created
|
|
500
|
+
* Verifying chain configuration
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
# 6️⃣ fetchClientState
|
|
506
|
+
|
|
507
|
+
## Method
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
async fetchClientState(clientId: string)
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
## CLI Equivalent
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
zigchaind query ibc client client-state <client-id>
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
## Description
|
|
520
|
+
|
|
521
|
+
Fetches the **raw client state** of a specific IBC client.
|
|
522
|
+
|
|
523
|
+
Contains all configuration parameters and the latest verified height.
|
|
524
|
+
|
|
525
|
+
## Parameters
|
|
526
|
+
|
|
527
|
+
| Name | Type | Description |
|
|
528
|
+
| -------- | ------ | --------------------- |
|
|
529
|
+
| clientId | string | IBC client identifier |
|
|
530
|
+
|
|
531
|
+
## Usage Example
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
const clientState = await clientApi.fetchClientState('07-tendermint-40')
|
|
535
|
+
console.dir(clientState, { depth: null })
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## Example Response
|
|
539
|
+
|
|
540
|
+
```json
|
|
541
|
+
{
|
|
542
|
+
"client_state": {
|
|
543
|
+
"@type": "/ibc.lightclients.tendermint.v1.ClientState",
|
|
544
|
+
"chain_id": "axelar-testnet-lisbon-3",
|
|
545
|
+
"trust_level": { "numerator": "2", "denominator": "3" },
|
|
546
|
+
"trusting_period": "403200s",
|
|
547
|
+
"unbonding_period": "604800s",
|
|
548
|
+
"max_clock_drift": "40s",
|
|
549
|
+
"frozen_height": { "revision_number": "0", "revision_height": "0" },
|
|
550
|
+
"latest_height": { "revision_number": "3", "revision_height": "20311715" },
|
|
551
|
+
"proof_specs": [
|
|
552
|
+
{
|
|
553
|
+
"leaf_spec": {
|
|
554
|
+
"hash": "SHA256",
|
|
555
|
+
"prehash_key": "NO_HASH",
|
|
556
|
+
"prehash_value": "SHA256",
|
|
557
|
+
"length": "VAR_PROTO",
|
|
558
|
+
"prefix": "AA=="
|
|
559
|
+
},
|
|
560
|
+
"inner_spec": {
|
|
561
|
+
"child_order": [0, 1],
|
|
562
|
+
"child_size": 33,
|
|
563
|
+
"min_prefix_length": 4,
|
|
564
|
+
"max_prefix_length": 12,
|
|
565
|
+
"empty_child": null,
|
|
566
|
+
"hash": "SHA256"
|
|
567
|
+
},
|
|
568
|
+
"max_depth": 0,
|
|
569
|
+
"min_depth": 0,
|
|
570
|
+
"prehash_key_before_comparison": false
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
"upgrade_path": ["upgrade", "upgradedIBCState"],
|
|
574
|
+
"allow_update_after_expiry": true,
|
|
575
|
+
"allow_update_after_misbehaviour": true
|
|
576
|
+
},
|
|
577
|
+
"proof": null,
|
|
578
|
+
"proof_height": { "revision_number": "2", "revision_height": "4647357" }
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## Response Field Explanation
|
|
583
|
+
|
|
584
|
+
### `client_state`
|
|
585
|
+
|
|
586
|
+
The complete client configuration.
|
|
587
|
+
|
|
588
|
+
| Field | Description |
|
|
589
|
+
| ---------------------------- | ------------------------------------- |
|
|
590
|
+
| @type | Client type (e.g., Tendermint) |
|
|
591
|
+
| chain_id | Chain ID of the remote blockchain |
|
|
592
|
+
| trust_level | Fraction of validators needed to trust |
|
|
593
|
+
| trusting_period | How long to trust client without update |
|
|
594
|
+
| unbonding_period | Unbonding period of remote chain |
|
|
595
|
+
| max_clock_drift | Maximum allowed clock drift |
|
|
596
|
+
| frozen_height | Height at which client was frozen (if any) |
|
|
597
|
+
| latest_height | Latest verified height |
|
|
598
|
+
| proof_specs | Merkle proof specifications |
|
|
599
|
+
| upgrade_path | Path for client upgrades |
|
|
600
|
+
| allow_update_after_expiry | Whether to allow updates after expiry |
|
|
601
|
+
| allow_update_after_misbehaviour | Whether to allow updates after misbehavior |
|
|
602
|
+
|
|
603
|
+
### Trust Level
|
|
604
|
+
|
|
605
|
+
The fraction of validators whose signatures are required to trust the client.
|
|
606
|
+
|
|
607
|
+
Example: `numerator: 2, denominator: 3` = 2/3 of validators
|
|
608
|
+
|
|
609
|
+
### Time Periods
|
|
610
|
+
|
|
611
|
+
All time values are in duration format (e.g., `403200s` = 403200 seconds).
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
# 7️⃣ fetchClientStates
|
|
616
|
+
|
|
617
|
+
## Method
|
|
618
|
+
|
|
619
|
+
```ts
|
|
620
|
+
async fetchClientStates()
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
## CLI Equivalent
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
zigchaind query ibc client client-states
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
## Description
|
|
630
|
+
|
|
631
|
+
Fetches **all IBC clients** on the chain.
|
|
632
|
+
|
|
633
|
+
Returns the client state of every light client configured on ZigChain.
|
|
634
|
+
|
|
635
|
+
## Parameters
|
|
636
|
+
|
|
637
|
+
None.
|
|
638
|
+
|
|
639
|
+
## Usage Example
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
const allClients = await clientApi.fetchClientStates()
|
|
643
|
+
console.dir(allClients, { depth: null })
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## Example Response (Partial)
|
|
647
|
+
|
|
648
|
+
```json
|
|
649
|
+
{
|
|
650
|
+
"client_states": [
|
|
651
|
+
{
|
|
652
|
+
"client_id": "07-tendermint-0",
|
|
653
|
+
"client_state": {
|
|
654
|
+
"@type": "/ibc.lightclients.tendermint.v1.ClientState",
|
|
655
|
+
"chain_id": "axelar-testnet-lisbon-3",
|
|
656
|
+
"trust_level": { "numerator": "2", "denominator": "3" },
|
|
657
|
+
"trusting_period": "403200s",
|
|
658
|
+
"unbonding_period": "604800s",
|
|
659
|
+
"max_clock_drift": "40s",
|
|
660
|
+
"frozen_height": { "revision_number": "0", "revision_height": "0" },
|
|
661
|
+
"latest_height": { "revision_number": "3", "revision_height": "26422416" },
|
|
662
|
+
"proof_specs": [...]
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"client_id": "07-tendermint-1",
|
|
667
|
+
"client_state": {
|
|
668
|
+
"@type": "/ibc.lightclients.tendermint.v1.ClientState",
|
|
669
|
+
"chain_id": "cosmoshub-4",
|
|
670
|
+
"trust_level": { "numerator": "1", "denominator": "3" },
|
|
671
|
+
"trusting_period": "1209600s",
|
|
672
|
+
"unbonding_period": "1814400s",
|
|
673
|
+
...
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
"pagination": {
|
|
678
|
+
"next_key": null,
|
|
679
|
+
"total": "88"
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
## Response Field Explanation
|
|
685
|
+
|
|
686
|
+
### `client_states`
|
|
687
|
+
|
|
688
|
+
Array of client entries.
|
|
689
|
+
|
|
690
|
+
Each entry contains:
|
|
691
|
+
|
|
692
|
+
| Field | Description |
|
|
693
|
+
| ------------- | ------------------------ |
|
|
694
|
+
| client_id | Unique client identifier |
|
|
695
|
+
| client_state | Full client configuration |
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
## When to Use
|
|
699
|
+
|
|
700
|
+
* Discovering all IBC clients on chain
|
|
701
|
+
* Building chain topology maps
|
|
702
|
+
* Analyzing cross-chain connections
|
|
703
|
+
* Auditing IBC setup
|
|
704
|
+
* Finding clients tracking specific chains
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
# 8️⃣ fetchClientStatus
|
|
709
|
+
|
|
710
|
+
## Method
|
|
711
|
+
|
|
712
|
+
```ts
|
|
713
|
+
async fetchClientStatus(clientId: string)
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
## CLI Equivalent
|
|
717
|
+
|
|
718
|
+
```bash
|
|
719
|
+
zigchaind query ibc client status <client-id>
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
## Description
|
|
723
|
+
|
|
724
|
+
Fetches the **operational status** of an IBC client.
|
|
725
|
+
|
|
726
|
+
Indicates whether the client is actively tracking the remote blockchain.
|
|
727
|
+
|
|
728
|
+
## Parameters
|
|
729
|
+
|
|
730
|
+
| Name | Type | Description |
|
|
731
|
+
| -------- | ------ | --------------------- |
|
|
732
|
+
| clientId | string | IBC client identifier |
|
|
733
|
+
|
|
734
|
+
## Usage Example
|
|
735
|
+
|
|
736
|
+
```ts
|
|
737
|
+
const status = await clientApi.fetchClientStatus('07-tendermint-40')
|
|
738
|
+
console.dir(status, { depth: null })
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
## Example Response
|
|
742
|
+
|
|
743
|
+
```json
|
|
744
|
+
{
|
|
745
|
+
"status": "Expired"
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
## Response Field Explanation
|
|
750
|
+
|
|
751
|
+
| Field | Description |
|
|
752
|
+
| ------ | ------------------------ |
|
|
753
|
+
| status | Current client status |
|
|
754
|
+
|
|
755
|
+
### Status Values
|
|
756
|
+
|
|
757
|
+
| Status | Meaning |
|
|
758
|
+
| ------- | -------------------------------------------- |
|
|
759
|
+
| `Active` | Client is healthy and actively tracking |
|
|
760
|
+
| `Expired` | Client has not been updated recently |
|
|
761
|
+
| `Frozen` | Client is frozen due to misbehavior detection |
|
|
762
|
+
|
|
763
|
+
## When to Use
|
|
764
|
+
|
|
765
|
+
* Monitoring client health
|
|
766
|
+
* Detecting stale or frozen clients
|
|
767
|
+
* Alerting on client problems
|
|
768
|
+
* Building status dashboards
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|