@zuhaibnoor/zigchain-sdk 1.1.0 → 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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
  3. package/dist/circuit/ChainCircuitApi.js.map +1 -1
  4. package/dist/dex/ChainDexApi.d.ts.map +1 -1
  5. package/dist/dex/ChainDexApi.js.map +1 -1
  6. package/dist/distribution/ChainDistributionApi.d.ts.map +1 -1
  7. package/dist/distribution/ChainDistributionApi.js +0 -1
  8. package/dist/distribution/ChainDistributionApi.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/staking/ChainStakingApi.d.ts +1 -5
  14. package/dist/staking/ChainStakingApi.d.ts.map +1 -1
  15. package/dist/staking/ChainStakingApi.js +9 -7
  16. package/dist/staking/ChainStakingApi.js.map +1 -1
  17. package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -1
  18. package/dist/validator-set/ChainValidator.d.ts +8 -0
  19. package/dist/validator-set/ChainValidator.d.ts.map +1 -0
  20. package/dist/validator-set/ChainValidator.js +15 -0
  21. package/dist/validator-set/ChainValidator.js.map +1 -0
  22. package/docs/block.md +325 -38
  23. package/docs/circuit.md +164 -35
  24. package/docs/dex.md +313 -63
  25. package/docs/distribution.md +664 -93
  26. package/docs/evidence.md +117 -122
  27. package/docs/factory.md +308 -62
  28. package/docs/gov.md +268 -70
  29. package/docs/ibc/ibcChannel.md +736 -249
  30. package/docs/ibc/ibcClient.md +608 -139
  31. package/docs/ibc-transfer.md +349 -90
  32. package/docs/interchain-accounts.md +151 -48
  33. package/docs/mint.md +173 -36
  34. package/docs/runtime.md +81 -42
  35. package/docs/slashing.md +209 -61
  36. package/docs/staking.md +534 -411
  37. package/docs/tokenwrapper.md +221 -64
  38. package/docs/txs.md +447 -0
  39. package/docs/upgrade.md +281 -58
  40. package/docs/validator-set.md +177 -0
  41. package/package.json +1 -1
  42. package/docs/comet-validator-set.md +0 -70
@@ -1,302 +1,771 @@
1
- # IBC Client
1
+ # IBC Client Module
2
2
 
3
- The **IBC Client** is the security foundation of IBC.
3
+ ## What is the IBC Client Module?
4
4
 
5
- If IBC is a secure bridge between blockchains, then:
5
+ The **IBC Client module** allows you to query information about IBC (Inter-Blockchain Communication) light clients.
6
6
 
7
- * **Client** the verifier
8
- * **Connection** → secured bridge
9
- * **Channel** → communication lane
10
- * **Packet** → message sent through the lane
7
+ IBC clients are light clients that verify the state of other blockchains within ZigChain. They maintain state history and validate cross-chain transactions.
11
8
 
12
- Without a client, nothing in IBC works.
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
13
15
 
14
16
  ---
15
17
 
16
- # Setup
18
+ # Important Terminology
17
19
 
18
- ```ts
19
- import {
20
- ChainIbcClientApi,
21
- getNetworkEndpoints,
22
- Network,
23
- } from '@zuhaibnoor/zigchain-sdk'
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:
24
33
 
25
- const endpoints = getNetworkEndpoints(Network.Testnet)
26
- const ibcClientApi = new ChainIbcClientApi(endpoints)
27
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.
28
57
 
29
58
  ---
30
59
 
31
- # What is an IBC Client?
60
+ ### Revision Number and Height
32
61
 
33
- An **IBC client** is NOT a user.
34
- It is NOT a wallet.
62
+ IBC blockchains use a two-part height identifier:
35
63
 
36
- It is a **light verifier** stored on ZigChain that:
64
+ * **Revision Number** Increments on chain upgrades
65
+ * **Revision Height** – Block number within that revision
37
66
 
38
- * Tracks another blockchain
39
- * Verifies its block headers
40
- * Stores its consensus states
41
- * Ensures packets are valid
67
+ Example:
42
68
 
43
- Think of it like:
69
+ ```
70
+ revision_number: 3
71
+ revision_height: 20311715
72
+ ```
44
73
 
45
- > A small embedded validator that watches another chain.
74
+ This represents block `20311715` in revision `3`.
46
75
 
47
76
  ---
48
77
 
49
- # `fetchClientStates()`
78
+ ### Client Status
50
79
 
51
- ### What it does
80
+ The **Client Status** indicates the operational state of a light client.
52
81
 
53
- Returns **all IBC clients** stored on ZigChain.
82
+ Possible values:
54
83
 
55
- Each client represents one external blockchain.
84
+ * `Active` Client is operational
85
+ * `Expired` – Client has expired (no updates)
86
+ * `Frozen` – Client is frozen due to misbehavior
56
87
 
57
88
  ---
58
89
 
59
- ### CLI equivalent
90
+ ### Light Client Type
60
91
 
61
- ```bash
62
- zigchaind query ibc client states
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'
63
117
  ```
64
118
 
65
119
  ---
66
120
 
67
- ### Example
121
+ # 1️⃣ fetchConsensusState
122
+
123
+ ## Method
68
124
 
69
125
  ```ts
70
- const clients = await ibcClientApi.fetchClientStates()
71
- console.dir(clients, { depth: null })
126
+ async fetchConsensusState(
127
+ clientId: string,
128
+ height: number | string,
129
+ rev_no: number | string
130
+ )
72
131
  ```
73
132
 
74
- You’ll see:
133
+ ## CLI Equivalent
75
134
 
76
- * client IDs
77
- * client types
78
- * latest height
135
+ ```bash
136
+ zigchaind query ibc client consensus-state <client-id> <revision-number> <revision-height>
137
+ ```
138
+ ## Description
79
139
 
80
- ---
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
81
145
 
82
- # `fetchClientState()`
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
83
153
 
84
154
  ```ts
85
- fetchClientState(clientId: string)
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
+ }
86
181
  ```
87
182
 
88
- ### What it does
183
+ ## Response Field Explanation
89
184
 
90
- Returns the **full state of a specific client**.
185
+ ### `consensus_state`
91
186
 
92
- ---
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 |
93
195
 
94
- ### What is "State"?
196
+ ### `proof`
95
197
 
96
- State means:
198
+ Merkle proof for verification (usually null for queries).
97
199
 
98
- > The stored verification information about the other chain.
200
+ ### `proof_height`
99
201
 
100
- It contains things like:
202
+ Height of the proof on the ZigChain blockchain.
101
203
 
102
- * chain ID
103
- * latest verified height
104
- * trust level
105
- * frozen height (if compromised)
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
106
210
 
107
211
  ---
108
212
 
109
- ### CLI equivalent
213
+ # 2️⃣ fetchConsensusStates
214
+
215
+ ## Method
216
+
217
+ ```ts
218
+ async fetchConsensusStates(clientId: string)
219
+ ```
220
+
221
+ ## CLI Equivalent
110
222
 
111
223
  ```bash
112
- zigchaind query ibc client state <client-id>
224
+ zigchaind query ibc client consensus-states <client-id>
113
225
  ```
114
226
 
115
- ---
116
227
 
117
- ### Example
228
+ ## Description
118
229
 
119
- ```ts
120
- const state = await ibcClientApi.fetchClientState(
121
- '07-tendermint-0'
122
- )
230
+ Fetches **all consensus states** stored for a client.
123
231
 
124
- console.dir(state, { depth: null })
125
- ```
232
+ Returns a paginated list of every consensus state the client has verified.
126
233
 
127
- ---
234
+ ## Parameters
128
235
 
129
- # `fetchClientStatus()`
236
+ | Name | Type | Description |
237
+ | -------- | ------ | ------------------------------ |
238
+ | clientId | string | IBC client identifier |
239
+
240
+ ## Usage Example
130
241
 
131
242
  ```ts
132
- fetchClientStatus(clientId: string)
243
+ const states = await clientApi.fetchConsensusStates('07-tendermint-40')
244
+ console.dir(states, { depth: null })
133
245
  ```
134
246
 
135
- ### What it does
247
+ ## Example Response
136
248
 
137
- Returns the health status of a client.
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
+ ```
138
287
 
139
- Possible values:
288
+ ## Response Field Explanation
140
289
 
141
- * `Active`
142
- * `Frozen`
143
- * `Expired`
144
- * `Unknown`
290
+ ### `consensus_states`
145
291
 
146
- ---
292
+ Array of consensus state entries.
147
293
 
148
- ### Why does this matter?
294
+ Each entry contains:
149
295
 
150
- If a client is:
296
+ | Field | Description |
297
+ | ------------------ | ------------------------------------- |
298
+ | height | Revision number and height |
299
+ | consensus_state | The consensus state data |
151
300
 
152
- * Frozen → packets cannot be verified
153
- * Expired → it needs updating
154
- * Active → everything works normally
155
301
 
156
302
  ---
157
303
 
158
- ### CLI equivalent
304
+ # 3️⃣ fetchConsensusStateHeights
305
+
306
+ ## Method
307
+
308
+ ```ts
309
+ async fetchConsensusStateHeights(clientId: string)
310
+ ```
311
+
312
+ ## CLI Equivalent
159
313
 
160
314
  ```bash
161
- zigchaind query ibc client status <client-id>
315
+ zigchaind query ibc client consensus-state-heights <client-id>
162
316
  ```
163
317
 
164
- ---
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.
165
325
 
166
- # `fetchConsensusStates()`
326
+ ## Parameters
327
+
328
+ | Name | Type | Description |
329
+ | -------- | ------ | --------------------- |
330
+ | clientId | string | IBC client identifier |
331
+
332
+ ## Usage Example
167
333
 
168
334
  ```ts
169
- fetchConsensusStates(clientId: string)
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
+ }
170
360
  ```
171
361
 
172
- ### What it does
362
+ ## Response Field Explanation
173
363
 
174
- Returns **all stored consensus states** of a client.
364
+ ### `consensus_state_heights`
175
365
 
176
- ---
366
+ Array of height objects at which consensus states are stored.
177
367
 
178
- ### What is a Consensus State?
368
+ Each entry contains:
179
369
 
180
- A consensus state is:
370
+ | Field | Description |
371
+ | ------------------ | ---------------- |
372
+ | revision_number | Revision number |
373
+ | revision_height | Block height |
181
374
 
182
- > A verified snapshot of the other chain at a specific height.
375
+ ### `pagination`
183
376
 
184
- Each time a client is updated, a new consensus state is stored.
377
+ Pagination information.
185
378
 
186
379
  ---
187
380
 
188
- ### CLI equivalent
381
+ # 4️⃣ fetchClientCreator
382
+
383
+ ## Method
384
+
385
+ ```ts
386
+ async fetchClientCreator(clientId: string)
387
+ ```
388
+
389
+ ## CLI Equivalent
189
390
 
190
391
  ```bash
191
- zigchaind query ibc client consensus-states <client-id>
392
+ zigchaind query ibc client client-creator <client-id>
192
393
  ```
193
394
 
194
- ---
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 |
195
406
 
196
- # `fetchConsensusState()`
407
+ ## Usage Example
197
408
 
198
409
  ```ts
199
- fetchConsensusState(
200
- clientId: string,
201
- height: number | string,
202
- revisionNumber: number | string
203
- )
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
+ }
204
420
  ```
205
421
 
206
- ### What it does
207
422
 
208
- Returns the consensus state of a client at a specific height.
423
+ ## Response Field Explanation
424
+
425
+ | Field | Description |
426
+ | ------- | ------------------------------ |
427
+ | creator | Bech32 address of client creator |
428
+
209
429
 
430
+ ## When to Use
431
+
432
+ * Auditing client creation
433
+ * Tracking who set up cross-chain connections
210
434
  ---
211
435
 
212
- ### CLI equivalent
436
+ # 5️⃣ fetchClientParams
437
+
438
+ ## Method
439
+
440
+ ```ts
441
+ async fetchClientParams()
442
+ ```
443
+
444
+ ## CLI Equivalent
213
445
 
214
446
  ```bash
215
- zigchaind query ibc client consensus-state <client-id> <revision> <height>
447
+ zigchaind query ibc client params
216
448
  ```
217
449
 
218
- ---
219
450
 
220
- # `fetchConsensusStateHeights()`
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
221
462
 
222
463
  ```ts
223
- fetchConsensusStateHeights(clientId: string)
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
+ }
224
476
  ```
225
477
 
226
- ### What it does
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
227
498
 
228
- Returns all heights for which consensus states exist.
499
+ * Checking which light clients can be created
500
+ * Verifying chain configuration
229
501
 
230
- Useful to know which heights are verifiable.
231
502
 
232
503
  ---
233
504
 
234
- ### CLI equivalent
505
+ # 6️⃣ fetchClientState
506
+
507
+ ## Method
508
+
509
+ ```ts
510
+ async fetchClientState(clientId: string)
511
+ ```
512
+
513
+ ## CLI Equivalent
235
514
 
236
515
  ```bash
237
- zigchaind query ibc client consensus-state-heights <client-id>
516
+ zigchaind query ibc client client-state <client-id>
238
517
  ```
239
518
 
240
- ---
519
+ ## Description
241
520
 
242
- # `fetchClientCreator()`
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
243
532
 
244
533
  ```ts
245
- fetchClientCreator(clientId: string)
534
+ const clientState = await clientApi.fetchClientState('07-tendermint-40')
535
+ console.dir(clientState, { depth: null })
246
536
  ```
247
537
 
248
- ### What it does
538
+ ## Example Response
249
539
 
250
- Returns the account address that created the client.
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
+ ```
251
581
 
252
- ---
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.
253
606
 
254
- ### Why is this useful?
607
+ Example: `numerator: 2, denominator: 3` = 2/3 of validators
255
608
 
256
- * Auditing
257
- * Governance
258
- * Debugging
609
+ ### Time Periods
610
+
611
+ All time values are in duration format (e.g., `403200s` = 403200 seconds).
259
612
 
260
613
  ---
261
614
 
262
- ### CLI equivalent
615
+ # 7️⃣ fetchClientStates
616
+
617
+ ## Method
618
+
619
+ ```ts
620
+ async fetchClientStates()
621
+ ```
622
+
623
+ ## CLI Equivalent
263
624
 
264
625
  ```bash
265
- zigchaind query ibc client creator <client-id>
626
+ zigchaind query ibc client client-states
266
627
  ```
267
628
 
268
- ---
629
+ ## Description
269
630
 
270
- # `fetchClientParams()`
631
+ Fetches **all IBC clients** on the chain.
271
632
 
272
- ### What it does
633
+ Returns the client state of every light client configured on ZigChain.
273
634
 
274
- Returns the global parameters of the IBC client module.
635
+ ## Parameters
275
636
 
276
- Example response:
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)
277
647
 
278
648
  ```json
279
649
  {
280
- "params": {
281
- "allowed_clients": ["*"]
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"
282
680
  }
283
681
  }
284
682
  ```
285
683
 
286
- ---
684
+ ## Response Field Explanation
685
+
686
+ ### `client_states`
687
+
688
+ Array of client entries.
689
+
690
+ Each entry contains:
287
691
 
288
- ### What does `"*"` mean?
692
+ | Field | Description |
693
+ | ------------- | ------------------------ |
694
+ | client_id | Unique client identifier |
695
+ | client_state | Full client configuration |
289
696
 
290
- It means:
291
697
 
292
- > All client types are allowed on this chain.
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
293
705
 
294
706
  ---
295
707
 
296
- ### CLI equivalent
708
+ # 8️⃣ fetchClientStatus
709
+
710
+ ## Method
711
+
712
+ ```ts
713
+ async fetchClientStatus(clientId: string)
714
+ ```
715
+
716
+ ## CLI Equivalent
297
717
 
298
718
  ```bash
299
- zigchaind query ibc client params
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 })
300
739
  ```
301
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
+
302
770
  ---
771
+