@zuhaibnoor/zigchain-sdk 1.0.3 → 1.1.0

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 (168) hide show
  1. package/dist/auth/ChainAuthApi.d.ts +0 -3
  2. package/dist/auth/ChainAuthApi.d.ts.map +1 -1
  3. package/dist/auth/ChainAuthApi.js +0 -26
  4. package/dist/auth/ChainAuthApi.js.map +1 -1
  5. package/dist/bank/ChainBankApi.d.ts +0 -9
  6. package/dist/bank/ChainBankApi.d.ts.map +1 -1
  7. package/dist/bank/ChainBankApi.js +0 -18
  8. package/dist/bank/ChainBankApi.js.map +1 -1
  9. package/dist/client/http.d.ts +1 -0
  10. package/dist/client/http.d.ts.map +1 -1
  11. package/dist/client/http.js +10 -0
  12. package/dist/client/http.js.map +1 -1
  13. package/dist/distribution/ChainDistributionApi.d.ts +47 -0
  14. package/dist/distribution/ChainDistributionApi.d.ts.map +1 -0
  15. package/dist/distribution/ChainDistributionApi.js +75 -0
  16. package/dist/distribution/ChainDistributionApi.js.map +1 -0
  17. package/dist/distribution/types.d.ts +71 -0
  18. package/dist/distribution/types.d.ts.map +1 -0
  19. package/dist/distribution/types.js +2 -0
  20. package/dist/distribution/types.js.map +1 -0
  21. package/dist/evidence/ChainEvidenceApi.d.ts +15 -0
  22. package/dist/evidence/ChainEvidenceApi.d.ts.map +1 -0
  23. package/dist/evidence/ChainEvidenceApi.js +22 -0
  24. package/dist/evidence/ChainEvidenceApi.js.map +1 -0
  25. package/dist/evidence/types.d.ts +15 -0
  26. package/dist/evidence/types.d.ts.map +1 -0
  27. package/dist/evidence/types.js +2 -0
  28. package/dist/evidence/types.js.map +1 -0
  29. package/dist/feegrant/ChainFeegrantApi.d.ts +22 -0
  30. package/dist/feegrant/ChainFeegrantApi.d.ts.map +1 -0
  31. package/dist/feegrant/ChainFeegrantApi.js +32 -0
  32. package/dist/feegrant/ChainFeegrantApi.js.map +1 -0
  33. package/dist/feegrant/types.d.ts +17 -0
  34. package/dist/feegrant/types.d.ts.map +1 -0
  35. package/dist/feegrant/types.js +2 -0
  36. package/dist/feegrant/types.js.map +1 -0
  37. package/dist/ibc/ChainIbcApi.d.ts +55 -0
  38. package/dist/ibc/ChainIbcApi.d.ts.map +1 -0
  39. package/dist/ibc/ChainIbcApi.js +82 -0
  40. package/dist/ibc/ChainIbcApi.js.map +1 -0
  41. package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts +55 -0
  42. package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts.map +1 -0
  43. package/dist/ibc/ibcChannel/ChainIbcChannelApi.js +82 -0
  44. package/dist/ibc/ibcChannel/ChainIbcChannelApi.js.map +1 -0
  45. package/dist/ibc/ibcChannel/types.d.ts +106 -0
  46. package/dist/ibc/ibcChannel/types.d.ts.map +1 -0
  47. package/dist/ibc/ibcChannel/types.js +2 -0
  48. package/dist/ibc/ibcChannel/types.js.map +1 -0
  49. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts +14 -0
  50. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts.map +1 -0
  51. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js +38 -0
  52. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js.map +1 -0
  53. package/dist/ibc/ibcChannelV2/types.d.ts +26 -0
  54. package/dist/ibc/ibcChannelV2/types.d.ts.map +1 -0
  55. package/dist/ibc/ibcChannelV2/types.js +3 -0
  56. package/dist/ibc/ibcChannelV2/types.js.map +1 -0
  57. package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts +15 -0
  58. package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts.map +1 -0
  59. package/dist/ibc/ibcClient/ChainIbcClientApi.js +39 -0
  60. package/dist/ibc/ibcClient/ChainIbcClientApi.js.map +1 -0
  61. package/dist/ibc/ibcClient/types.d.ts +53 -0
  62. package/dist/ibc/ibcClient/types.d.ts.map +1 -0
  63. package/dist/ibc/ibcClient/types.js +2 -0
  64. package/dist/ibc/ibcClient/types.js.map +1 -0
  65. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts +11 -0
  66. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts.map +1 -0
  67. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js +24 -0
  68. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js.map +1 -0
  69. package/dist/ibc/ibcConnection/types.d.ts +18 -0
  70. package/dist/ibc/ibcConnection/types.d.ts.map +1 -0
  71. package/dist/ibc/ibcConnection/types.js +2 -0
  72. package/dist/ibc/ibcConnection/types.js.map +1 -0
  73. package/dist/ibc/types.d.ts +106 -0
  74. package/dist/ibc/types.d.ts.map +1 -0
  75. package/dist/ibc/types.js +2 -0
  76. package/dist/ibc/types.js.map +1 -0
  77. package/dist/ibc-transfer/ChainIbcTransferApi.d.ts +12 -0
  78. package/dist/ibc-transfer/ChainIbcTransferApi.d.ts.map +1 -0
  79. package/dist/ibc-transfer/ChainIbcTransferApi.js +30 -0
  80. package/dist/ibc-transfer/ChainIbcTransferApi.js.map +1 -0
  81. package/dist/ibc-transfer/types.d.ts +26 -0
  82. package/dist/ibc-transfer/types.d.ts.map +1 -0
  83. package/dist/ibc-transfer/types.js +2 -0
  84. package/dist/ibc-transfer/types.js.map +1 -0
  85. package/dist/index.d.ts +26 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +26 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/interchain-accounts/ChainInterChainAccApi.d.ts +9 -0
  90. package/dist/interchain-accounts/ChainInterChainAccApi.d.ts.map +1 -0
  91. package/dist/interchain-accounts/ChainInterChainAccApi.js +16 -0
  92. package/dist/interchain-accounts/ChainInterChainAccApi.js.map +1 -0
  93. package/dist/interchain-accounts/types.d.ts +12 -0
  94. package/dist/interchain-accounts/types.d.ts.map +1 -0
  95. package/dist/interchain-accounts/types.js +2 -0
  96. package/dist/interchain-accounts/types.js.map +1 -0
  97. package/dist/networks/endpoints.js +2 -2
  98. package/dist/networks/endpoints.js.map +1 -1
  99. package/dist/runtime/ChainRuntimeApi.d.ts +12 -0
  100. package/dist/runtime/ChainRuntimeApi.d.ts.map +1 -0
  101. package/dist/runtime/ChainRuntimeApi.js +16 -0
  102. package/dist/runtime/ChainRuntimeApi.js.map +1 -0
  103. package/dist/runtime/types.d.ts +4 -0
  104. package/dist/runtime/types.d.ts.map +1 -0
  105. package/dist/runtime/types.js +2 -0
  106. package/dist/runtime/types.js.map +1 -0
  107. package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts +19 -0
  108. package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts.map +1 -0
  109. package/dist/tokenwrapper/ChainTokenWrapperApi.js +26 -0
  110. package/dist/tokenwrapper/ChainTokenWrapperApi.js.map +1 -0
  111. package/dist/tokenwrapper/types.d.ts +15 -0
  112. package/dist/tokenwrapper/types.d.ts.map +1 -0
  113. package/dist/tokenwrapper/types.js +2 -0
  114. package/dist/tokenwrapper/types.js.map +1 -0
  115. package/dist/txs/ChainTxsApi.d.ts +12 -0
  116. package/dist/txs/ChainTxsApi.d.ts.map +1 -0
  117. package/dist/txs/ChainTxsApi.js +17 -0
  118. package/dist/txs/ChainTxsApi.js.map +1 -0
  119. package/dist/txs/types.d.ts +22 -0
  120. package/dist/txs/types.d.ts.map +1 -0
  121. package/dist/txs/types.js +5 -0
  122. package/dist/txs/types.js.map +1 -0
  123. package/dist/upgrade/ChainUpgradeApi.d.ts +22 -0
  124. package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -0
  125. package/dist/upgrade/ChainUpgradeApi.js +40 -0
  126. package/dist/upgrade/ChainUpgradeApi.js.map +1 -0
  127. package/dist/upgrade/types.d.ts +24 -0
  128. package/dist/upgrade/types.d.ts.map +1 -0
  129. package/dist/upgrade/types.js +5 -0
  130. package/dist/upgrade/types.js.map +1 -0
  131. package/dist/validator-set/ChainCometValidator.d.ts +8 -0
  132. package/dist/validator-set/ChainCometValidator.d.ts.map +1 -0
  133. package/dist/validator-set/ChainCometValidator.js +15 -0
  134. package/dist/validator-set/ChainCometValidator.js.map +1 -0
  135. package/dist/validator-set/types.d.ts +18 -0
  136. package/dist/validator-set/types.d.ts.map +1 -0
  137. package/dist/validator-set/types.js +2 -0
  138. package/dist/validator-set/types.js.map +1 -0
  139. package/dist/wasm/ChainWasmApi.d.ts +57 -0
  140. package/dist/wasm/ChainWasmApi.d.ts.map +1 -0
  141. package/dist/wasm/ChainWasmApi.js +78 -0
  142. package/dist/wasm/ChainWasmApi.js.map +1 -0
  143. package/dist/wasm/types.d.ts +77 -0
  144. package/dist/wasm/types.d.ts.map +1 -0
  145. package/dist/wasm/types.js +2 -0
  146. package/dist/wasm/types.js.map +1 -0
  147. package/docs/auth.md +438 -72
  148. package/docs/bank.md +782 -123
  149. package/docs/block-results.md +328 -21
  150. package/docs/comet-validator-set.md +70 -0
  151. package/docs/distribution.md +201 -0
  152. package/docs/evidence.md +199 -0
  153. package/docs/feegrant.md +206 -0
  154. package/docs/gov.md +166 -0
  155. package/docs/ibc/ibcChannel.md +490 -0
  156. package/docs/ibc/ibcClient.md +302 -0
  157. package/docs/ibc/ibcConnection.md +214 -0
  158. package/docs/ibc-transfer.md +204 -0
  159. package/docs/interchain-accounts.md +120 -0
  160. package/docs/mint.md +133 -0
  161. package/docs/runtime.md +81 -0
  162. package/docs/slashing.md +139 -0
  163. package/docs/staking.md +633 -0
  164. package/docs/tokenwrapper.md +137 -0
  165. package/docs/txs.md +0 -0
  166. package/docs/upgrade.md +133 -0
  167. package/docs/wasm.md +916 -0
  168. package/package.json +1 -1
@@ -0,0 +1,490 @@
1
+ # IBC Module
2
+
3
+ The **IBC (Inter-Blockchain Communication)** module allows ZigChain to communicate with other blockchains.
4
+
5
+ Think of IBC like a **secure bridge system** between blockchains.
6
+
7
+ It works using:
8
+
9
+ * **Clients** → light verifiers that track another chain
10
+ * **Connections** → links between two chains
11
+ * **Channels** → communication lanes built on top of connections
12
+ * **Packets** → messages or token transfers sent through channels
13
+
14
+ # Setup
15
+
16
+ ```ts
17
+ import {
18
+ ChainIbcChannelApi,
19
+ getNetworkEndpoints,
20
+ Network,
21
+ } from '@zuhaibnoor/zigchain-sdk'
22
+
23
+ const endpoints = getNetworkEndpoints(Network.Testnet)
24
+ const ibcApi = new ChainIbcApi(endpoints)
25
+ ```
26
+
27
+ ---
28
+ ## `fetchChannels()`
29
+
30
+ ### What it does
31
+
32
+ Returns **all IBC channels** that exist on ZigChain.
33
+
34
+ ### What is a Channel?
35
+
36
+ A **channel** is like a communication lane between two blockchains.
37
+
38
+ If:
39
+
40
+ * Connection = physical cable
41
+ * Channel = lane inside that cable
42
+ * Packet = message sent through the lane
43
+
44
+ Then this function shows you all those lanes.
45
+
46
+ ---
47
+
48
+ ### CLI equivalent
49
+
50
+ ```bash
51
+ zigchaind query ibc channel channels
52
+ ```
53
+
54
+ ### Example
55
+
56
+ ```ts
57
+ const channels = await ibcApi.fetchChannels()
58
+ console.dir(channels, { depth: null })
59
+ ```
60
+
61
+ You’ll see:
62
+
63
+ * channel IDs
64
+ * port IDs
65
+ * connection ID
66
+ * whether the channel is OPEN or CLOSED
67
+
68
+ ---
69
+
70
+ ## `fetchChannelClientState()`
71
+
72
+ ```ts
73
+ fetchChannelClientState(portId: string, channelId: string)
74
+ ```
75
+
76
+ ### What it does
77
+
78
+ Returns the **client state** associated with a channel.
79
+
80
+ ---
81
+
82
+ ### What is a Client?
83
+
84
+ In IBC, a **client** is a small verifier inside ZigChain that:
85
+
86
+ * Tracks another blockchain
87
+ * Confirms that the other chain is valid
88
+
89
+ It is NOT a user.
90
+ It is NOT a wallet.
91
+
92
+ It is a **light client**.
93
+
94
+ ---
95
+
96
+ ### What is State?
97
+
98
+ "State" simply means the **current stored information** about something.
99
+
100
+ So:
101
+
102
+ **Client State = the current verification information about the other chain.**
103
+
104
+ It contains:
105
+
106
+ * chain ID
107
+ * latest height
108
+ * trust level
109
+ * proof parameters
110
+
111
+ ---
112
+
113
+ ### CLI equivalent
114
+
115
+ ```bash
116
+ zigchaind query ibc channel client-state <port-id> <channel-id>
117
+ ```
118
+
119
+ ### Example
120
+
121
+ ```ts
122
+ const clientState = await ibcApi.fetchChannelClientState(
123
+ 'transfer',
124
+ 'channel-0'
125
+ )
126
+
127
+ console.dir(clientState, { depth: null })
128
+ ```
129
+
130
+ ---
131
+
132
+ ## `fetchChannelsByConnection()`
133
+
134
+ ```ts
135
+ fetchChannelsByConnection(connectionId: string)
136
+ ```
137
+
138
+ ### What it does
139
+
140
+ Returns all channels built on a specific connection.
141
+
142
+ ---
143
+
144
+ ### What is a Connection?
145
+
146
+ A **connection** is a secure link between two chains.
147
+
148
+ You can think of it like:
149
+
150
+ * Client = verifier
151
+ * Connection = secured bridge
152
+ * Channel = lane on the bridge
153
+
154
+ A single connection can have multiple channels.
155
+
156
+ ---
157
+
158
+ ### CLI equivalent
159
+
160
+ ```bash
161
+ zigchaind query ibc channel connections <connection-id>
162
+ ```
163
+
164
+ ### Example
165
+
166
+ ```ts
167
+ const channels = await ibcApi.fetchChannelsByConnection(
168
+ 'connection-0'
169
+ )
170
+
171
+ console.dir(channels, { depth: null })
172
+ ```
173
+
174
+ ---
175
+
176
+ ## `fetchChannelEnd()`
177
+
178
+ ```ts
179
+ fetchChannelEnd(portId: string, channelId: string)
180
+ ```
181
+
182
+ ### What it does
183
+
184
+ Returns full details of a specific channel.
185
+
186
+ ---
187
+
188
+ ### Why is it called "Channel End"?
189
+
190
+ Because a channel exists on **both chains**.
191
+
192
+ Each chain stores its own "end" of the channel.
193
+
194
+ So:
195
+
196
+ * ZigChain has one end
197
+ * The other chain has another end
198
+
199
+ This function shows ZigChain’s side.
200
+
201
+ ---
202
+
203
+ ### CLI equivalent
204
+
205
+ ```bash
206
+ zigchaind query ibc channel end <port-id> <channel-id>
207
+ ```
208
+
209
+ ---
210
+
211
+ ## `fetchNextSequenceReceive()`
212
+
213
+ ```ts
214
+ fetchNextSequenceReceive(portId: string, channelId: string)
215
+ ```
216
+
217
+ ### What it does
218
+
219
+ Returns the **next packet number ZigChain expects to receive**.
220
+
221
+ ---
222
+
223
+ ### What is a Sequence?
224
+
225
+ Every packet sent through a channel gets a number:
226
+
227
+ 1
228
+ 2
229
+ 3
230
+ 4
231
+
232
+ This number is called a **sequence number**.
233
+
234
+ It ensures:
235
+
236
+ * No duplicates
237
+ * No skipped packets
238
+ * Proper ordering
239
+
240
+ ---
241
+
242
+ ### So what is "Next Sequence Receive"?
243
+
244
+ It means:
245
+
246
+ > “What is the next packet number I am waiting to receive?”
247
+
248
+ If it returns `15`,
249
+ that means ZigChain has already received up to 14.
250
+
251
+ ---
252
+
253
+ ### CLI equivalent
254
+
255
+ ```bash
256
+ zigchaind query ibc channel next-sequence-receive <port-id> <channel-id>
257
+ ```
258
+
259
+ ---
260
+
261
+ ## `fetchNextSequenceSend()`
262
+
263
+ ```ts
264
+ fetchNextSequenceSend(portId: string, channelId: string)
265
+ ```
266
+
267
+ ### What it does
268
+
269
+ Returns the next packet number that will be used when sending a packet.
270
+
271
+ ---
272
+
273
+ ### What does this mean?
274
+
275
+ If it returns `20`,
276
+ then the next packet you send will be sequence number 20.
277
+
278
+ This helps track outgoing transfers.
279
+
280
+ ---
281
+
282
+ ### CLI equivalent
283
+
284
+ ```bash
285
+ zigchaind query ibc channel next-sequence-send <port-id> <channel-id>
286
+ ```
287
+
288
+ ---
289
+
290
+ ## `fetchPacketAcknowledgement()`
291
+
292
+ ```ts
293
+ fetchPacketAcknowledgement(
294
+ portId: string,
295
+ channelId: string,
296
+ sequence: number | string
297
+ )
298
+ ```
299
+
300
+ ### What it does
301
+
302
+ Returns the acknowledgement for a specific packet.
303
+
304
+ ---
305
+
306
+ ### What is an Acknowledgement?
307
+
308
+ When a packet is sent to another chain:
309
+
310
+ 1. It gets processed there.
311
+ 2. The other chain sends back a confirmation.
312
+ 3. That confirmation is called an **acknowledgement**.
313
+
314
+ Think of it like:
315
+
316
+ * You send a parcel 📦
317
+ * Receiver signs and confirms delivery
318
+ * That confirmation = acknowledgement
319
+
320
+ ---
321
+
322
+ ### Why is this important?
323
+
324
+ It proves:
325
+
326
+ * The packet was received
327
+ * The packet was processed successfully (or failed)
328
+
329
+ ---
330
+
331
+ ### CLI equivalent
332
+
333
+ ```bash
334
+ zigchaind query ibc channel packet-ack <port-id> <channel-id> <sequence>
335
+ ```
336
+
337
+ ---
338
+
339
+ ## `fetchPacketCommitment()`
340
+
341
+ ```ts
342
+ async fetchPacketCommitment(
343
+ portId: string,
344
+ channelId: string,
345
+ sequence: number | string
346
+ )
347
+ ```
348
+
349
+ ### Description
350
+
351
+ Queries the **packet commitment** for a specific packet sequence.
352
+
353
+ A **packet commitment** is a cryptographic record stored on the sending chain when a packet is sent.
354
+ It proves that the packet was created and committed to state.
355
+
356
+ This function answers:
357
+
358
+ > “Was packet `<sequence>` committed on this channel?”
359
+
360
+ ---
361
+
362
+ ### Parameters
363
+
364
+ * **portId** – The application port (e.g., `"transfer"`).
365
+ * **channelId** – The IBC channel identifier (e.g., `"channel-0"`).
366
+ * **sequence** – The packet sequence number.
367
+
368
+ ---
369
+
370
+ ## `fetchPacketCommitments()`
371
+
372
+ ```ts
373
+ async fetchPacketCommitments(
374
+ portId: string,
375
+ channelId: string
376
+ )
377
+ ```
378
+
379
+ ### Description
380
+
381
+ Queries **all packet commitments** for a given channel and port.
382
+
383
+ This returns all packets that:
384
+
385
+ * Were sent from this chain
386
+ * Still have commitments stored
387
+
388
+ It is useful to see all outstanding or tracked packets on a channel.
389
+
390
+ ---
391
+
392
+ ### Parameters
393
+
394
+ * **portId** – The application port.
395
+ * **channelId** – The IBC channel identifier.
396
+
397
+ ---
398
+
399
+ ## `fetchPacketReceipt()`
400
+
401
+ ```ts
402
+ async fetchPacketReceipt(
403
+ portId: string,
404
+ channelId: string,
405
+ sequence: number | string
406
+ )
407
+ ```
408
+
409
+ ### Description
410
+
411
+ Queries the **packet receipt** for a specific packet.
412
+
413
+ A **packet receipt** is stored on the receiving chain after a packet is successfully processed.
414
+ It confirms that the packet was received.
415
+
416
+ This function answers:
417
+
418
+ > “Has packet `<sequence>` been received on this chain?”
419
+
420
+ ---
421
+
422
+ ### Parameters
423
+
424
+ * **portId** – The application port.
425
+ * **channelId** – The IBC channel identifier.
426
+ * **sequence** – The packet sequence number.
427
+
428
+ ---
429
+
430
+ ## `fetchUnreceivedAcks()`
431
+
432
+ ```ts
433
+ async fetchUnreceivedAcks(
434
+ portId: string,
435
+ channelId: string,
436
+ sequences: (number | string)[]
437
+ )
438
+ ```
439
+
440
+ ### Description
441
+
442
+ Checks which packet acknowledgements have **not yet been received**.
443
+
444
+ An **acknowledgement (ack)** is a confirmation sent back to the original chain after a packet is processed on the counterparty chain.
445
+
446
+ This function answers:
447
+
448
+ > “Out of these sequences, which acknowledgements are still missing?”
449
+
450
+ ---
451
+
452
+ ### Parameters
453
+
454
+ * **portId** – The application port.
455
+ * **channelId** – The IBC channel identifier.
456
+ * **sequences** – List of packet sequence numbers to check.
457
+
458
+ ---
459
+
460
+ ## `fetchUnreceivedPackets()`
461
+
462
+ ```ts
463
+ async fetchUnreceivedPackets(
464
+ portId: string,
465
+ channelId: string,
466
+ sequences: (number | string)[]
467
+ )
468
+ ```
469
+
470
+ ### Description
471
+
472
+ Checks which packets have been committed but **not yet received** on the counterparty chain.
473
+
474
+ This helps detect pending or stuck packets.
475
+
476
+ This function answers:
477
+
478
+ > “Out of these committed packets, which ones have not been received?”
479
+
480
+ ---
481
+
482
+ ### Parameters
483
+
484
+ * **portId** – The application port.
485
+ * **channelId** – The IBC channel identifier.
486
+ * **sequences** – List of packet sequence numbers to check.
487
+
488
+ ---
489
+
490
+