@zuhaibnoor/zigchain-sdk 1.0.2 → 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 (172) 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 +555 -0
  148. package/docs/bank.md +974 -0
  149. package/docs/block-results.md +371 -0
  150. package/docs/block.md +97 -0
  151. package/docs/circuit.md +93 -0
  152. package/docs/comet-validator-set.md +70 -0
  153. package/docs/dex.md +159 -0
  154. package/docs/distribution.md +201 -0
  155. package/docs/evidence.md +199 -0
  156. package/docs/factory.md +159 -0
  157. package/docs/feegrant.md +206 -0
  158. package/docs/gov.md +166 -0
  159. package/docs/ibc/ibcChannel.md +490 -0
  160. package/docs/ibc/ibcClient.md +302 -0
  161. package/docs/ibc/ibcConnection.md +214 -0
  162. package/docs/ibc-transfer.md +204 -0
  163. package/docs/interchain-accounts.md +120 -0
  164. package/docs/mint.md +133 -0
  165. package/docs/runtime.md +81 -0
  166. package/docs/slashing.md +139 -0
  167. package/docs/staking.md +633 -0
  168. package/docs/tokenwrapper.md +137 -0
  169. package/docs/txs.md +0 -0
  170. package/docs/upgrade.md +133 -0
  171. package/docs/wasm.md +916 -0
  172. package/package.json +2 -1
@@ -0,0 +1,302 @@
1
+ # IBC Client
2
+
3
+ The **IBC Client** is the security foundation of IBC.
4
+
5
+ If IBC is a secure bridge between blockchains, then:
6
+
7
+ * **Client** → the verifier
8
+ * **Connection** → secured bridge
9
+ * **Channel** → communication lane
10
+ * **Packet** → message sent through the lane
11
+
12
+ Without a client, nothing in IBC works.
13
+
14
+ ---
15
+
16
+ # Setup
17
+
18
+ ```ts
19
+ import {
20
+ ChainIbcClientApi,
21
+ getNetworkEndpoints,
22
+ Network,
23
+ } from '@zuhaibnoor/zigchain-sdk'
24
+
25
+ const endpoints = getNetworkEndpoints(Network.Testnet)
26
+ const ibcClientApi = new ChainIbcClientApi(endpoints)
27
+ ```
28
+
29
+ ---
30
+
31
+ # What is an IBC Client?
32
+
33
+ An **IBC client** is NOT a user.
34
+ It is NOT a wallet.
35
+
36
+ It is a **light verifier** stored on ZigChain that:
37
+
38
+ * Tracks another blockchain
39
+ * Verifies its block headers
40
+ * Stores its consensus states
41
+ * Ensures packets are valid
42
+
43
+ Think of it like:
44
+
45
+ > A small embedded validator that watches another chain.
46
+
47
+ ---
48
+
49
+ # `fetchClientStates()`
50
+
51
+ ### What it does
52
+
53
+ Returns **all IBC clients** stored on ZigChain.
54
+
55
+ Each client represents one external blockchain.
56
+
57
+ ---
58
+
59
+ ### CLI equivalent
60
+
61
+ ```bash
62
+ zigchaind query ibc client states
63
+ ```
64
+
65
+ ---
66
+
67
+ ### Example
68
+
69
+ ```ts
70
+ const clients = await ibcClientApi.fetchClientStates()
71
+ console.dir(clients, { depth: null })
72
+ ```
73
+
74
+ You’ll see:
75
+
76
+ * client IDs
77
+ * client types
78
+ * latest height
79
+
80
+ ---
81
+
82
+ # `fetchClientState()`
83
+
84
+ ```ts
85
+ fetchClientState(clientId: string)
86
+ ```
87
+
88
+ ### What it does
89
+
90
+ Returns the **full state of a specific client**.
91
+
92
+ ---
93
+
94
+ ### What is "State"?
95
+
96
+ State means:
97
+
98
+ > The stored verification information about the other chain.
99
+
100
+ It contains things like:
101
+
102
+ * chain ID
103
+ * latest verified height
104
+ * trust level
105
+ * frozen height (if compromised)
106
+
107
+ ---
108
+
109
+ ### CLI equivalent
110
+
111
+ ```bash
112
+ zigchaind query ibc client state <client-id>
113
+ ```
114
+
115
+ ---
116
+
117
+ ### Example
118
+
119
+ ```ts
120
+ const state = await ibcClientApi.fetchClientState(
121
+ '07-tendermint-0'
122
+ )
123
+
124
+ console.dir(state, { depth: null })
125
+ ```
126
+
127
+ ---
128
+
129
+ # `fetchClientStatus()`
130
+
131
+ ```ts
132
+ fetchClientStatus(clientId: string)
133
+ ```
134
+
135
+ ### What it does
136
+
137
+ Returns the health status of a client.
138
+
139
+ Possible values:
140
+
141
+ * `Active`
142
+ * `Frozen`
143
+ * `Expired`
144
+ * `Unknown`
145
+
146
+ ---
147
+
148
+ ### Why does this matter?
149
+
150
+ If a client is:
151
+
152
+ * Frozen → packets cannot be verified
153
+ * Expired → it needs updating
154
+ * Active → everything works normally
155
+
156
+ ---
157
+
158
+ ### CLI equivalent
159
+
160
+ ```bash
161
+ zigchaind query ibc client status <client-id>
162
+ ```
163
+
164
+ ---
165
+
166
+ # `fetchConsensusStates()`
167
+
168
+ ```ts
169
+ fetchConsensusStates(clientId: string)
170
+ ```
171
+
172
+ ### What it does
173
+
174
+ Returns **all stored consensus states** of a client.
175
+
176
+ ---
177
+
178
+ ### What is a Consensus State?
179
+
180
+ A consensus state is:
181
+
182
+ > A verified snapshot of the other chain at a specific height.
183
+
184
+ Each time a client is updated, a new consensus state is stored.
185
+
186
+ ---
187
+
188
+ ### CLI equivalent
189
+
190
+ ```bash
191
+ zigchaind query ibc client consensus-states <client-id>
192
+ ```
193
+
194
+ ---
195
+
196
+ # `fetchConsensusState()`
197
+
198
+ ```ts
199
+ fetchConsensusState(
200
+ clientId: string,
201
+ height: number | string,
202
+ revisionNumber: number | string
203
+ )
204
+ ```
205
+
206
+ ### What it does
207
+
208
+ Returns the consensus state of a client at a specific height.
209
+
210
+ ---
211
+
212
+ ### CLI equivalent
213
+
214
+ ```bash
215
+ zigchaind query ibc client consensus-state <client-id> <revision> <height>
216
+ ```
217
+
218
+ ---
219
+
220
+ # `fetchConsensusStateHeights()`
221
+
222
+ ```ts
223
+ fetchConsensusStateHeights(clientId: string)
224
+ ```
225
+
226
+ ### What it does
227
+
228
+ Returns all heights for which consensus states exist.
229
+
230
+ Useful to know which heights are verifiable.
231
+
232
+ ---
233
+
234
+ ### CLI equivalent
235
+
236
+ ```bash
237
+ zigchaind query ibc client consensus-state-heights <client-id>
238
+ ```
239
+
240
+ ---
241
+
242
+ # `fetchClientCreator()`
243
+
244
+ ```ts
245
+ fetchClientCreator(clientId: string)
246
+ ```
247
+
248
+ ### What it does
249
+
250
+ Returns the account address that created the client.
251
+
252
+ ---
253
+
254
+ ### Why is this useful?
255
+
256
+ * Auditing
257
+ * Governance
258
+ * Debugging
259
+
260
+ ---
261
+
262
+ ### CLI equivalent
263
+
264
+ ```bash
265
+ zigchaind query ibc client creator <client-id>
266
+ ```
267
+
268
+ ---
269
+
270
+ # `fetchClientParams()`
271
+
272
+ ### What it does
273
+
274
+ Returns the global parameters of the IBC client module.
275
+
276
+ Example response:
277
+
278
+ ```json
279
+ {
280
+ "params": {
281
+ "allowed_clients": ["*"]
282
+ }
283
+ }
284
+ ```
285
+
286
+ ---
287
+
288
+ ### What does `"*"` mean?
289
+
290
+ It means:
291
+
292
+ > All client types are allowed on this chain.
293
+
294
+ ---
295
+
296
+ ### CLI equivalent
297
+
298
+ ```bash
299
+ zigchaind query ibc client params
300
+ ```
301
+
302
+ ---
@@ -0,0 +1,214 @@
1
+ # IBC Connection
2
+
3
+ The **IBC Connection** creates a secure link between two blockchains.
4
+
5
+ If IBC is a secure bridge system:
6
+
7
+ * **Client** → verifier
8
+ * **Connection** → secured bridge
9
+ * **Channel** → lane on the bridge
10
+ * **Packet** → message sent through the lane
11
+
12
+ A connection must be established before channels can be created.
13
+
14
+ ---
15
+
16
+ # Setup
17
+
18
+ ```ts
19
+ import {
20
+ ChainIbcConnectionApi,
21
+ getNetworkEndpoints,
22
+ Network,
23
+ } from '@zuhaibnoor/zigchain-sdk'
24
+
25
+ const endpoints = getNetworkEndpoints(Network.Testnet)
26
+ const ibcConnectionApi = new ChainIbcConnectionApi(endpoints)
27
+ ```
28
+
29
+ ---
30
+
31
+ # What is a Connection?
32
+
33
+ A **connection** is a secure, authenticated bridge between two chains.
34
+
35
+ It is created using a handshake process:
36
+
37
+ 1. INIT
38
+ 2. TRY
39
+ 3. ACK
40
+ 4. CONFIRM
41
+
42
+ Once the connection state becomes `OPEN`, channels can be built on top of it.
43
+
44
+ ---
45
+
46
+ # `fetchConnections()`
47
+
48
+ ### What it does
49
+
50
+ Returns **all IBC connections** stored on ZigChain.
51
+
52
+ ---
53
+
54
+ ### Why is this useful?
55
+
56
+ It lets you see:
57
+
58
+ * Which chains ZigChain is connected to
59
+ * Connection states (INIT, TRYOPEN, OPEN)
60
+ * Associated client IDs
61
+
62
+ ---
63
+
64
+ ### CLI equivalent
65
+
66
+ ```bash
67
+ zigchaind query ibc connection connections
68
+ ```
69
+
70
+ ---
71
+
72
+ ### Example
73
+
74
+ ```ts
75
+ const connections = await ibcConnectionApi.fetchConnections()
76
+ console.dir(connections, { depth: null })
77
+ ```
78
+
79
+ ---
80
+
81
+ # `fetchConnectionEnd()`
82
+
83
+ ```ts
84
+ fetchConnectionEnd(connectionId: string)
85
+ ```
86
+
87
+ ### What it does
88
+
89
+ Returns full details of a specific connection.
90
+
91
+ ---
92
+
93
+ ### Why is it called "Connection End"?
94
+
95
+ Because the connection exists on **both chains**.
96
+
97
+ Each chain stores its own side (or "end") of the connection.
98
+
99
+ This function returns ZigChain’s side.
100
+
101
+ ---
102
+
103
+ ### It contains:
104
+
105
+ * client ID
106
+ * counterparty client ID
107
+ * connection state
108
+ * supported versions
109
+
110
+ ---
111
+
112
+ ### CLI equivalent
113
+
114
+ ```bash
115
+ zigchaind query ibc connection end <connection-id>
116
+ ```
117
+
118
+ ---
119
+
120
+ ### Example
121
+
122
+ ```ts
123
+ const connection = await ibcConnectionApi.fetchConnectionEnd(
124
+ 'connection-0'
125
+ )
126
+
127
+ console.dir(connection, { depth: null })
128
+ ```
129
+
130
+ ---
131
+
132
+ # `fetchConnectionParams()`
133
+
134
+ ### What it does
135
+
136
+ Returns the global parameters of the IBC connection module.
137
+
138
+ ---
139
+
140
+ ### What are Connection Parameters?
141
+
142
+ These are chain-wide rules that control:
143
+
144
+ * Expected "block time" (The average time it takes for a blockchain to produce a new block.)
145
+ * Verification timing assumptions
146
+
147
+ These parameters affect timeout behavior and security assumptions.
148
+
149
+ ---
150
+
151
+ ### CLI equivalent
152
+
153
+ ```bash
154
+ zigchaind query ibc connection params
155
+ ```
156
+
157
+ ---
158
+
159
+ ### Example
160
+
161
+ ```ts
162
+ const params = await ibcConnectionApi.fetchConnectionParams()
163
+ console.dir(params)
164
+ ```
165
+
166
+ ---
167
+
168
+ # `fetchClientConnectionPaths()`
169
+
170
+ ```ts
171
+ fetchClientConnectionPaths(clientId: string)
172
+ ```
173
+
174
+ ### What it does
175
+
176
+ Returns all connections that were created using a specific client.
177
+
178
+ ---
179
+
180
+ ### Why is this useful?
181
+
182
+ Remember:
183
+
184
+ Client → verifies another chain
185
+ Connection → built using that client
186
+
187
+ So this query answers:
188
+
189
+ > “Which bridges were created using this verifier?”
190
+
191
+ ---
192
+
193
+ ### CLI equivalent
194
+
195
+ ```bash
196
+ zigchaind query ibc connection path <client-id>
197
+ ```
198
+
199
+ ---
200
+
201
+ ### Example
202
+
203
+ ```ts
204
+ const paths = await ibcConnectionApi.fetchClientConnectionPaths(
205
+ '07-tendermint-0'
206
+ )
207
+
208
+ console.dir(paths)
209
+ ```
210
+
211
+ ---
212
+
213
+
214
+
@@ -0,0 +1,204 @@
1
+ # IBC Transfer
2
+
3
+ The **IBC Transfer module** allows ZigChain to **send and receive fungible tokens** across different blockchains using IBC.
4
+ Think of it as a **secure token bridge system**.
5
+
6
+ It works using:
7
+
8
+ * **Denoms** → representations of tokens on other chains (can be traced via `denom trace` or `denom hash`)
9
+ * **Escrow accounts** → temporary holding accounts for tokens being transferred
10
+ * **Parameters** → rules and settings of the IBC transfer module
11
+
12
+ ---
13
+
14
+ # Setup
15
+
16
+ ```ts
17
+ import {
18
+ ChainIbcTransferApi,
19
+ getNetworkEndpoints,
20
+ Network,
21
+ } from '@zuhaibnoor/zigchain-sdk'
22
+
23
+ const endpoints = getNetworkEndpoints(Network.Testnet)
24
+ const ibcTransferApi = new ChainIbcTransferApi(endpoints)
25
+ ```
26
+
27
+ ---
28
+
29
+ ## `fetchDenomByHash()`
30
+
31
+ ```ts
32
+ fetchDenomByHash(hash: string)
33
+ ```
34
+
35
+ ### What it does
36
+
37
+ Fetches the **denom trace info** from a **denom hash**.
38
+ A **denom trace** shows the **origin chain, port, and channel** of a token.
39
+
40
+ ---
41
+
42
+ ### CLI equivalent
43
+
44
+ ```bash
45
+ zigchaind query ibc-transfer denom <hash>
46
+ ```
47
+
48
+ ### Example
49
+
50
+ ```ts
51
+ const denomTrace = await ibcTransferApi.fetchDenomByHash(
52
+ '5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8'
53
+ )
54
+ console.dir(denomTrace, { depth: null })
55
+ ```
56
+
57
+ ---
58
+
59
+ ## `fetchDenomHash()`
60
+
61
+ ```ts
62
+ fetchDenomHash(portId: string, channelId: string, denom: string)
63
+ ```
64
+
65
+ ### What it does
66
+
67
+ Fetches the **denom hash** for a token given its **port, channel, and token name**.
68
+ This hash uniquely identifies the token across chains.
69
+
70
+ ---
71
+
72
+ ### CLI equivalent
73
+
74
+ ```bash
75
+ zigchaind query ibc-transfer denom-hash <port> <channel> <denom>
76
+ ```
77
+
78
+ ### Example
79
+
80
+ ```ts
81
+ const denomHash = await ibcTransferApi.fetchDenomHash(
82
+ 'transfer',
83
+ 'channel-0',
84
+ 'uzig'
85
+ )
86
+ console.dir(denomHash, { depth: null })
87
+ ```
88
+
89
+ ---
90
+
91
+ ## `fetchDenoms()`
92
+
93
+ ```ts
94
+ fetchDenoms()
95
+ ```
96
+
97
+ ### What it does
98
+
99
+ Returns **all denom traces** currently registered in the IBC transfer module.
100
+ Useful to **list all IBC token representations** on the chain.
101
+
102
+ ---
103
+
104
+ ### CLI equivalent
105
+
106
+ ```bash
107
+ zigchaind query ibc-transfer denoms
108
+ ```
109
+
110
+ ### Example
111
+
112
+ ```ts
113
+ const allDenoms = await ibcTransferApi.fetchDenoms()
114
+ console.dir(allDenoms, { depth: null })
115
+ ```
116
+
117
+ ---
118
+
119
+ ## `fetchEscrowAddress()`
120
+
121
+ ```ts
122
+ fetchEscrowAddress(portId: string, channelId: string)
123
+ ```
124
+
125
+ ### What it does
126
+
127
+ Returns the **escrow account address** for a given port and channel.
128
+ Tokens being sent across IBC are **temporarily held** in this escrow account until they reach the other chain.
129
+
130
+ ---
131
+
132
+ ### CLI equivalent
133
+
134
+ ```bash
135
+ zigchaind query ibc-transfer escrow-address <port> <channel>
136
+ ```
137
+
138
+ ### Example
139
+
140
+ ```ts
141
+ const escrowAddr = await ibcTransferApi.fetchEscrowAddress(
142
+ 'transfer',
143
+ 'channel-0'
144
+ )
145
+ console.dir(escrowAddr, { depth: null })
146
+ ```
147
+
148
+ ---
149
+
150
+ ## `fetchTransferParams()`
151
+
152
+ ```ts
153
+ fetchTransferParams()
154
+ ```
155
+
156
+ ### What it does
157
+
158
+ Returns the **current parameters** of the IBC transfer module.
159
+ This includes rules like **allowed tokens, transfer fees, and limits**.
160
+
161
+ ---
162
+
163
+ ### CLI equivalent
164
+
165
+ ```bash
166
+ zigchaind query ibc-transfer params
167
+ ```
168
+
169
+ ### Example
170
+
171
+ ```ts
172
+ const params = await ibcTransferApi.fetchTransferParams()
173
+ console.dir(params, { depth: null })
174
+ ```
175
+
176
+ ---
177
+
178
+ ### How Escrow Works with Token Wrapping
179
+
180
+ 1. **Original tokens exist on the source chain** (e.g., `uzig` on ZigChain).
181
+
182
+ 2. **When you initiate an IBC transfer** to another chain:
183
+
184
+ * The tokens are **not sent directly**.
185
+ * Instead, they are **locked in an escrow account** on the source chain.
186
+ * The escrow account acts like a **safe holding place** for those tokens.
187
+
188
+ 3. **Receipt / Wrapped Token:**
189
+
190
+ * The destination chain does **not get the original tokens**.
191
+ * Instead, it receives a **representation of those tokens** — often called a **voucher** or **wrapped token**.
192
+ * This wrapped token can be used on the destination chain as if it were the original token.
193
+
194
+ 4. **Completion / Finalization:**
195
+
196
+ * Once the destination chain confirms the receipt of the wrapped token, the escrow account on the source chain marks the tokens as **spent / transferred**.
197
+ * If the transfer fails or is canceled, the tokens remain in the escrow account and can be returned to the original owner.
198
+
199
+ ---
200
+
201
+
202
+
203
+
204
+