@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,204 +1,463 @@
1
1
  # IBC Transfer
2
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**.
3
+ ## What is IBC Transfer?
5
4
 
6
- It works using:
5
+ The **IBC Transfer** enables ZigChain to send and receive fungible tokens across other IBC-enabled blockchains.
7
6
 
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
7
+ Instead of directly moving tokens between chains, IBC Transfer:
11
8
 
9
+ * Locks tokens in escrow on the source chain
10
+ * Mints voucher tokens on the destination chain
12
11
  ---
13
12
 
14
- # Setup
13
+ # Important Terminology
14
+
15
+ Before documenting functions, let’s define key terms.
16
+
17
+ ### Denom
18
+
19
+ A token denomination.
20
+
21
+ Examples:
22
+
23
+ ```
24
+ uzig
25
+ uusdc
26
+ uatom
27
+ ```
28
+
29
+ On IBC transfers, denoms can become:
30
+
31
+ ```
32
+ ibc/<HASH>
33
+ ```
34
+
35
+ ### Denom Trace
36
+
37
+ Describes the full path a token took across chains.
38
+
39
+ Example:
40
+
41
+ ```
42
+ transfer/channel-44/uusdc
43
+ ```
44
+
45
+ It contains:
46
+
47
+ * Port ID
48
+ * Channel ID
49
+ * Base denom
50
+
51
+ ### Denom Hash
52
+
53
+ A SHA256 hash of the full denom trace string.
54
+
55
+ Example:
56
+
57
+ ```
58
+ SHA256("transfer/channel-44/uusdc")
59
+ =
60
+ 5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8
61
+ ```
62
+
63
+ On-chain representation:
64
+
65
+ ```
66
+ ibc/5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8
67
+ ```
68
+
69
+ ### Escrow Account
70
+
71
+ An **escrow account** is a special account controlled by the IBC Transfer module that temporarily holds tokens during a cross-chain transfer.
72
+
73
+ When you send tokens to another chain, they are **locked in this escrow account** on the source chain. The tokens do not leave immediately — instead, they are safely held while the destination chain mints a corresponding voucher token.
74
+
75
+ If the transfer succeeds, the escrowed tokens remain locked.
76
+ If the transfer fails, the tokens are released back to the sender.
77
+
78
+ This mechanism ensures:
79
+
80
+ * No tokens are duplicated
81
+ * Total supply remains correct
82
+ * Cross-chain transfers are secure and verifiable
83
+
84
+ ---
85
+
86
+ ### Transfer Parameters
87
+
88
+ Chain-level configuration controlling:
89
+
90
+ * Whether sending is enabled
91
+ * Whether receiving is enabled
92
+
93
+ ---
94
+
95
+ # Functions Documentation
96
+
97
+ ## Setup
15
98
 
16
99
  ```ts
17
100
  import {
18
101
  ChainIbcTransferApi,
19
102
  getNetworkEndpoints,
20
- Network,
103
+ Network
21
104
  } from '@zuhaibnoor/zigchain-sdk'
22
105
 
23
106
  const endpoints = getNetworkEndpoints(Network.Testnet)
24
107
  const ibcTransferApi = new ChainIbcTransferApi(endpoints)
108
+
109
+ const hash = '5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8'
110
+ const portId = 'transfer'
111
+ const channelId = 'channel-44'
112
+ const denom = 'uusdc'
25
113
  ```
26
114
 
27
115
  ---
28
116
 
29
- ## `fetchDenomByHash()`
117
+ # 1️⃣ fetchDenomByHash
118
+
119
+ ## Method
30
120
 
31
121
  ```ts
32
- fetchDenomByHash(hash: string)
122
+ async fetchDenomByHash(hash: string)
33
123
  ```
34
124
 
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
125
+ ## CLI Equivalent
43
126
 
44
127
  ```bash
45
128
  zigchaind query ibc-transfer denom <hash>
46
129
  ```
47
130
 
48
- ### Example
131
+ ## Description
132
+
133
+ Fetches the **denom trace** associated with a given IBC denom hash.
134
+
135
+ This allows you to:
136
+
137
+ * Identify the original base token
138
+ * See which port and channel it arrived through
139
+ * Reverse lookup `ibc/<hash>` tokens
140
+
141
+ ## Parameters
142
+
143
+ | Name | Type | Description |
144
+ | ---- | ------ | -------------------------- |
145
+ | hash | string | IBC denom hash (no `ibc/`) |
146
+
147
+ ## Usage Example
49
148
 
50
149
  ```ts
51
- const denomTrace = await ibcTransferApi.fetchDenomByHash(
52
- '5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8'
53
- )
54
- console.dir(denomTrace, { depth: null })
150
+ const trace = await ibcTransferApi.fetchDenomByHash(hash)
151
+ console.dir(trace, { depth: null })
55
152
  ```
56
153
 
57
154
  ---
58
155
 
59
- ## `fetchDenomHash()`
60
-
61
- ```ts
62
- fetchDenomHash(portId: string, channelId: string, denom: string)
156
+ ## Example Response
157
+
158
+ ```json
159
+ {
160
+ "denom": {
161
+ "base": "uusdc",
162
+ "trace": [
163
+ {
164
+ "port_id": "transfer",
165
+ "channel_id": "channel-44"
166
+ }
167
+ ]
168
+ }
169
+ }
63
170
  ```
64
171
 
65
- ### What it does
172
+ ## Response Field Explanation
66
173
 
67
- Fetches the **denom hash** for a token given its **port, channel, and token name**.
68
- This hash uniquely identifies the token across chains.
174
+ ### `denom`
175
+
176
+ Contains denom trace information.
177
+
178
+ | Field | Description |
179
+ | ----- | -------------------------- |
180
+ | base | Original token denom |
181
+ | trace | Array of port/channel hops |
182
+
183
+ Each trace entry includes:
184
+
185
+ | Field | Description |
186
+ | ---------- | ---------------------- |
187
+ | port_id | IBC port identifier |
188
+ | channel_id | IBC channel identifier |
189
+
190
+ ## When to Use
191
+
192
+ * Resolving `ibc/<hash>` tokens
193
+ * Building explorers
194
+ * Wallet token metadata resolution
69
195
 
70
196
  ---
71
197
 
72
- ### CLI equivalent
198
+ # 2️⃣ fetchDenomHash
199
+
200
+ ## Method
201
+
202
+ ```ts
203
+ async fetchDenomHash(
204
+ portId: string,
205
+ channelId: string,
206
+ denom: string
207
+ )
208
+ ```
209
+
210
+ ## CLI Equivalent
73
211
 
74
212
  ```bash
75
213
  zigchaind query ibc-transfer denom-hash <port> <channel> <denom>
76
214
  ```
77
215
 
78
- ### Example
216
+ ## Description
217
+
218
+ Computes and returns the **IBC denom hash** from:
219
+
220
+ * Port ID
221
+ * Channel ID
222
+ * Base denom
223
+
224
+ This produces the deterministic hash used on-chain.
225
+
226
+ ## Parameters
227
+
228
+ | Name | Type | Description |
229
+ | --------- | ------ | ----------------------------- |
230
+ | portId | string | IBC port (usually `transfer`) |
231
+ | channelId | string | IBC channel identifier |
232
+ | denom | string | Base token denom |
233
+
234
+ ## Usage Example
79
235
 
80
236
  ```ts
81
237
  const denomHash = await ibcTransferApi.fetchDenomHash(
82
- 'transfer',
83
- 'channel-0',
84
- 'uzig'
238
+ portId,
239
+ channelId,
240
+ denom
85
241
  )
242
+
86
243
  console.dir(denomHash, { depth: null })
87
244
  ```
88
245
 
89
- ---
90
-
91
- ## `fetchDenoms()`
246
+ ## Example Response
92
247
 
93
- ```ts
94
- fetchDenoms()
248
+ ```json
249
+ {
250
+ "hash": "5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8"
251
+ }
95
252
  ```
96
253
 
97
- ### What it does
254
+ ## Response Field Explanation
255
+
256
+ | Field | Description |
257
+ | ----- | ------------------------------- |
258
+ | hash | SHA256 hash of full denom trace |
98
259
 
99
- Returns **all denom traces** currently registered in the IBC transfer module.
100
- Useful to **list all IBC token representations** on the chain.
260
+ ## When to Use
261
+
262
+ * Generating `ibc/<hash>` values
263
+ * Wallet token display logic
264
+ * SDK internal conversions
265
+ * Verifying denom determinism
101
266
 
102
267
  ---
103
268
 
104
- ### CLI equivalent
269
+ # 3️⃣ fetchDenoms
270
+
271
+ ## Method
272
+
273
+ ```ts
274
+ async fetchDenoms()
275
+ ```
276
+
277
+ ## CLI Equivalent
105
278
 
106
279
  ```bash
107
280
  zigchaind query ibc-transfer denoms
108
281
  ```
109
282
 
110
- ### Example
283
+ ## Description
284
+
285
+ Returns all registered IBC denom traces on ZigChain.
286
+
287
+ Useful for discovering:
288
+
289
+ * Imported tokens
290
+ * Multi-hop tokens
291
+ * All IBC assets on-chain
292
+
293
+ ## Parameters
294
+
295
+ None.
296
+
297
+ ## Usage Example
111
298
 
112
299
  ```ts
113
- const allDenoms = await ibcTransferApi.fetchDenoms()
114
- console.dir(allDenoms, { depth: null })
300
+ const denoms = await ibcTransferApi.fetchDenoms()
301
+ console.dir(denoms, { depth: null })
302
+ ```
303
+
304
+ ## Example Response
305
+
306
+ ```json
307
+ {
308
+ "denoms": [
309
+ {
310
+ "base": "uusdc",
311
+ "trace": [
312
+ {
313
+ "port_id": "transfer",
314
+ "channel_id": "channel-44"
315
+ }
316
+ ]
317
+ }
318
+ ],
319
+ "pagination": {
320
+ "next_key": null,
321
+ "total": "15"
322
+ }
323
+ }
115
324
  ```
116
325
 
117
326
  ---
118
327
 
119
- ## `fetchEscrowAddress()`
328
+ ## Response Field Explanation
120
329
 
121
- ```ts
122
- fetchEscrowAddress(portId: string, channelId: string)
123
- ```
330
+ ### `denoms`
331
+
332
+ Array of denom traces.
333
+
334
+ Each entry includes:
124
335
 
125
- ### What it does
336
+ | Field | Description |
337
+ | ----- | ------------------- |
338
+ | base | Original base denom |
339
+ | trace | Path of IBC hops |
126
340
 
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.
341
+ ## When to Use
342
+
343
+ * Building token explorers
344
+ * Indexing IBC assets
345
+ * Chain analytics
346
+ * Asset discovery tools
129
347
 
130
348
  ---
131
349
 
132
- ### CLI equivalent
350
+ # 4️⃣ fetchEscrowAddress
351
+
352
+ ## Method
353
+
354
+ ```ts
355
+ async fetchEscrowAddress(
356
+ portId: string,
357
+ channelId: string
358
+ )
359
+ ```
360
+
361
+ ## CLI Equivalent
133
362
 
134
363
  ```bash
135
364
  zigchaind query ibc-transfer escrow-address <port> <channel>
136
365
  ```
137
366
 
138
- ### Example
367
+ ## Description
368
+
369
+ Returns the escrow account address for a specific port and channel.
370
+
371
+ Tokens sent through this channel are temporarily locked here before being transferred.
372
+
373
+ ## Parameters
374
+
375
+ | Name | Type | Description |
376
+ | --------- | ------ | ---------------------- |
377
+ | portId | string | IBC port identifier |
378
+ | channelId | string | IBC channel identifier |
379
+
380
+ ## Usage Example
139
381
 
140
382
  ```ts
141
- const escrowAddr = await ibcTransferApi.fetchEscrowAddress(
142
- 'transfer',
143
- 'channel-0'
383
+ const escrow = await ibcTransferApi.fetchEscrowAddress(
384
+ portId,
385
+ channelId
144
386
  )
145
- console.dir(escrowAddr, { depth: null })
146
- ```
147
387
 
148
- ---
388
+ console.dir(escrow, { depth: null })
389
+ ```
149
390
 
150
- ## `fetchTransferParams()`
391
+ ## Example Response
151
392
 
152
- ```ts
153
- fetchTransferParams()
393
+ ```json
394
+ {
395
+ "escrow_address": "zig1hcea3h0ykw4jqyjhj3tnydsk22s06adh5y350m"
396
+ }
154
397
  ```
155
398
 
156
- ### What it does
399
+ ## Response Field Explanation
157
400
 
158
- Returns the **current parameters** of the IBC transfer module.
159
- This includes rules like **allowed tokens, transfer fees, and limits**.
401
+ | Field | Description |
402
+ | -------------- | ----------------------------- |
403
+ | escrow_address | Module escrow account address |
160
404
 
161
405
  ---
162
406
 
163
- ### CLI equivalent
407
+ # 5️⃣ fetchTransferParams
164
408
 
165
- ```bash
166
- zigchaind query ibc-transfer params
409
+ ## Method
410
+
411
+ ```ts
412
+ async fetchTransferParams()
167
413
  ```
168
414
 
169
- ### Example
415
+ ## CLI Equivalent
170
416
 
171
- ```ts
172
- const params = await ibcTransferApi.fetchTransferParams()
173
- console.dir(params, { depth: null })
417
+ ```bash
418
+ zigchaind query ibc-transfer params
174
419
  ```
175
420
 
176
- ---
421
+ ## Description
177
422
 
178
- ### How Escrow Works with Token Wrapping
423
+ Fetches the chain-level configuration of the IBC Transfer module.
179
424
 
180
- 1. **Original tokens exist on the source chain** (e.g., `uzig` on ZigChain).
425
+ These parameters determine whether token transfers are allowed.
181
426
 
182
- 2. **When you initiate an IBC transfer** to another chain:
427
+ ## Parameters
183
428
 
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.
429
+ None.
187
430
 
188
- 3. **Receipt / Wrapped Token:**
431
+ ## Usage Example
189
432
 
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.
433
+ ```ts
434
+ const params = await ibcTransferApi.fetchTransferParams()
435
+ console.dir(params, { depth: null })
436
+ ```
193
437
 
194
- 4. **Completion / Finalization:**
438
+ ## Example Response
195
439
 
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.
440
+ ```json
441
+ {
442
+ "params": {
443
+ "send_enabled": true,
444
+ "receive_enabled": true
445
+ }
446
+ }
447
+ ```
198
448
 
199
- ---
449
+ ## Response Field Explanation
200
450
 
451
+ ### `params`
201
452
 
453
+ | Field | Description |
454
+ | --------------- | ------------------------------------------- |
455
+ | send_enabled | Whether outgoing IBC transfers are allowed |
456
+ | receive_enabled | Whether incoming IBC transfers are accepted |
202
457
 
458
+ ## When to Use
203
459
 
460
+ * Checking if transfers are paused
461
+ * Governance audits
462
+ ---
204
463