@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
package/docs/factory.md CHANGED
@@ -1,7 +1,77 @@
1
1
  # Factory Module
2
2
 
3
- The **ChainFactoryApi** allows you to interact with the chain’s token factory module.
4
- It is used to query **denoms created by admins**, **denom details**, **denom authorizations**, and the **module parameters**.
3
+ ## What is the Factory Module?
4
+
5
+ The **Factory module** is a ZigChain-native token factory that allows any address to **create and manage custom tokens** directly on-chain.
6
+
7
+ ---
8
+
9
+ ## Important Terminology
10
+
11
+ ### Factory Token
12
+
13
+ A token created through the Factory module. Every factory token has a structured denom format:
14
+
15
+ ```
16
+ coin.<creator-address>.<token-name>
17
+ ```
18
+
19
+ Example:
20
+ ```
21
+ coin.zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a.neon
22
+ ```
23
+
24
+ This format ensures every factory token is globally unique and its creator is identifiable directly from the denom.
25
+
26
+ ---
27
+
28
+ ### Creator
29
+
30
+ The address that originally created the token through the Factory module. The creator address is permanently embedded in the token denom and cannot be changed.
31
+
32
+ ---
33
+
34
+ ### Bank Admin
35
+
36
+ The address authorized to **mint and burn** this token. By default this is the creator, but it can be transferred to another address — for example, a smart contract that controls minting logic.
37
+
38
+ ---
39
+
40
+ ### Metadata Admin
41
+
42
+ The address authorized to **update the token's metadata** (name, symbol, description, URI). Also defaults to the creator and can be transferred independently of the bank admin.
43
+
44
+ > Bank admin and metadata admin can be different addresses — this allows separating minting authority from metadata management.
45
+
46
+ ---
47
+
48
+ ### Minting Cap
49
+
50
+ The maximum amount that can be minted **in a single minting operation**. This is a per-operation limit, not a total supply limit.
51
+
52
+ ```
53
+ minting_cap = '1000000000'
54
+ ```
55
+
56
+ ---
57
+
58
+ ### Max Supply
59
+
60
+ The absolute maximum total supply this token can ever reach. Once `total_minted` reaches `max_supply`, no more tokens can be minted.
61
+
62
+ ```
63
+ max_supply = '1000000000'
64
+ ```
65
+
66
+ ---
67
+
68
+ ### Creation Fee
69
+
70
+ A flat fee in `uzig` that must be paid to create a new factory token. This fee goes to the configured `beneficiary` address.
71
+
72
+ ```
73
+ create_fee_amount = 100000000 → 100 ZIG
74
+ ```
5
75
 
6
76
  ---
7
77
 
@@ -16,144 +86,320 @@ import {
16
86
 
17
87
  const endpoints = getNetworkEndpoints(Network.Testnet)
18
88
  const factoryApi = new ChainFactoryApi(endpoints)
89
+
90
+ const denom = 'coin.zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a.neon'
91
+ const denom_admin = 'zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a'
19
92
  ```
20
93
 
21
94
  ---
22
95
 
23
- ## `fetchParams`
96
+ # 1️⃣ fetchParams
97
+
98
+ ## Method
24
99
 
25
- Fetch the **factory module parameters**.
100
+ ```ts
101
+ async fetchParams()
102
+ ```
26
103
 
27
- **CLI equivalent**
104
+ ## CLI Equivalent
28
105
 
29
106
  ```bash
30
107
  zigchaind query factory params
31
108
  ```
32
109
 
33
- **Method**
110
+ ## Description
34
111
 
35
- ```ts
36
- fetchParams()
37
- ```
112
+ Fetches the **Factory module parameters** configured at chain level.
38
113
 
39
- **Returns**
114
+ These governance-controlled settings define the cost of creating a new token and where that fee is sent. Anyone who wants to create a factory token must pay the `create_fee_amount` in `create_fee_denom` to the `beneficiary` address.
40
115
 
41
- * `FactoryParamsResponse` – Contains factory-related settings and limits.
116
+ ## Parameters
42
117
 
43
- **Example**
118
+ None.
119
+
120
+ ## Usage Example
44
121
 
45
122
  ```ts
46
123
  const params = await factoryApi.fetchParams()
47
- console.log('Factory params:')
48
124
  console.dir(params, { depth: null })
49
125
  ```
50
126
 
127
+ ## Example Response
128
+
129
+ ```json
130
+ {
131
+ "params": {
132
+ "create_fee_denom": "uzig",
133
+ "create_fee_amount": 100000000,
134
+ "beneficiary": "zig1s3mhkcycpgjj5tdv09ux6qg7hgzcyu6shzsfu0"
135
+ }
136
+ }
137
+ ```
138
+
139
+ ## Response Field Explanation
140
+
141
+ ### `params`
142
+
143
+ | Field | Description |
144
+ | ------------------ | ------------------------------------------------------------------------------- |
145
+ | create_fee_denom | Denomination in which the creation fee must be paid (always `uzig`) |
146
+ | create_fee_amount | Amount in `uzig` required to create a new token (`100000000` = 100 ZIG) |
147
+ | beneficiary | Address that receives the token creation fee |
148
+
149
+ ## When to Use
150
+
151
+ * Displaying token creation cost to users before they create a token
152
+ * Verifying current fee requirements for factory token creation
153
+ * Governance monitoring for fee parameter changes
154
+
51
155
  ---
52
156
 
53
- ## `fetchDenomsByAdmin`
157
+ # 2️⃣ fetchDenomsByAdmin
54
158
 
55
- Fetch all **denoms created by a specific admin address**.
159
+ ## Method
160
+
161
+ ```ts
162
+ async fetchDenomsByAdmin(admin: string)
163
+ ```
56
164
 
57
- **CLI equivalent**
165
+ ## CLI Equivalent
58
166
 
59
167
  ```bash
60
168
  zigchaind query factory denoms-by-admin <admin-address>
61
169
  ```
62
170
 
63
- **Method**
171
+ ---
64
172
 
65
- ```ts
66
- fetchDenomsByAdmin(admin: string)
67
- ```
173
+ ## Description
68
174
 
69
- **Parameters**
175
+ Fetches **all factory tokens created by a specific address**.
70
176
 
71
- * `admin: string` Address of the admin whose denoms you want to fetch.
177
+ This answers the question: "Which tokens has this address created through the factory module?" It returns the full list of token denoms owned by the given admin, paginated for large collections.
72
178
 
73
- **Returns**
179
+ ---
180
+
181
+ ## Parameters
74
182
 
75
- * `DenomsByAdminResponse` List of denoms created by the admin.
183
+ | Name | Type | Description |
184
+ | ----- | ------ | ------------------------------------------------------- |
185
+ | admin | string | Bech32 address of the token creator/admin to query |
186
+
187
+ ---
76
188
 
77
- **Example**
189
+ ## Usage Example
78
190
 
79
191
  ```ts
80
- const denoms = await factoryApi.fetchDenomsByAdmin('zig1...adminaddress')
81
- console.log('Denoms by admin:')
192
+ const denoms = await factoryApi.fetchDenomsByAdmin(denom_admin)
82
193
  console.dir(denoms, { depth: null })
83
194
  ```
84
195
 
196
+ ## Example Response
197
+
198
+ ```json
199
+ {
200
+ "denoms": [
201
+ "coin.zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a.neon"
202
+ ],
203
+ "pagination": {
204
+ "next_key": null,
205
+ "total": "1"
206
+ }
207
+ }
208
+ ```
209
+
210
+ ## Response Field Explanation
211
+
212
+ ### `denoms`
213
+
214
+ Array of factory token denoms created by this admin.
215
+
216
+ | Field | Description |
217
+ | ------ | -------------------------------------------------------------- |
218
+ | denoms | List of full token denom strings owned by this admin address |
219
+
220
+ Each denom follows the format `coin.<admin-address>.<token-name>`.
221
+
222
+ ### `pagination`
223
+
224
+ | Field | Description |
225
+ | -------- | ------------------------------------------------------------- |
226
+ | next_key | Cursor for next page. `null` if all results are returned |
227
+ | total | Total number of factory tokens created by this address |
228
+
229
+ ## When to Use
230
+
231
+ * Wallet dashboards showing all tokens a user has created
232
+ * Token discovery tools for a specific creator
233
+ * Auditing which tokens an address controls as admin
234
+ * Building creator profile pages in token explorers
235
+
85
236
  ---
86
237
 
87
- ## `fetchDenom`
238
+ # 3️⃣ fetchDenom
88
239
 
89
- Fetch **details of a specific denom**.
240
+ ## Method
90
241
 
91
- **CLI equivalent**
242
+ ```ts
243
+ async fetchDenom(denom: string)
244
+ ```
245
+
246
+ ## CLI Equivalent
92
247
 
93
248
  ```bash
94
249
  zigchaind query factory show-denom <denom>
95
250
  ```
96
251
 
97
- **Method**
252
+ ## Description
98
253
 
99
- ```ts
100
- fetchDenom(denom: string)
101
- ```
102
-
103
- **Parameters**
254
+ Fetches the **full details and lifecycle statistics** of a specific factory token.
104
255
 
105
- * `denom: string` The denom to query.
256
+ This returns everything about a token its supply stats (minted, burned, current), supply caps, whether the minting cap can be changed, and the addresses holding admin and metadata authority.
106
257
 
107
- **Returns**
258
+ ## Parameters
108
259
 
109
- * `ShowDenomResponse` Information about the denom, such as creator, admin, and metadata.
260
+ | Name | Type | Description |
261
+ | ----- | ------ | ---------------------------------------- |
262
+ | denom | string | Full factory token denom to query |
110
263
 
111
- **Example**
264
+ ## Usage Example
112
265
 
113
266
  ```ts
114
- const denomInfo = await factoryApi.fetchDenom('uzig')
115
- console.log('Denom info:')
267
+ const denomInfo = await factoryApi.fetchDenom(denom)
116
268
  console.dir(denomInfo, { depth: null })
117
269
  ```
118
270
 
119
- ---
271
+ ## Example Response
272
+
273
+ ```json
274
+ {
275
+ "denom": "coin.zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a.neon",
276
+ "total_minted": "0",
277
+ "total_supply": "0",
278
+ "total_burned": "0",
279
+ "minting_cap": "1000000000",
280
+ "max_supply": "1000000000",
281
+ "can_change_minting_cap": true,
282
+ "creator": "zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a",
283
+ "bank_admin": "zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a",
284
+ "metadata_admin": "zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a"
285
+ }
286
+ ```
120
287
 
121
- ## `fetchDenomAuth`
288
+ ## Response Field Explanation
122
289
 
123
- Fetch the **authorization details for a specific denom**.
290
+ | Field | Description |
291
+ | --------------------- | ---------------------------------------------------------------------------------- |
292
+ | denom | Full factory token denom string |
293
+ | total_minted | Cumulative amount ever minted since token creation |
294
+ | total_supply | Current circulating supply (`total_minted - total_burned`) |
295
+ | total_burned | Cumulative amount ever burned since token creation |
296
+ | minting_cap | Maximum amount mintable in a single minting operation |
297
+ | max_supply | Absolute maximum total supply this token can ever reach |
298
+ | can_change_minting_cap | Whether the bank admin can update the `minting_cap` in the future |
299
+ | creator | Address that originally created this token — permanently embedded in the denom |
300
+ | bank_admin | Address authorized to mint and burn this token |
301
+ | metadata_admin | Address authorized to update this token's name, symbol, description, and URI |
124
302
 
125
- **CLI equivalent**
303
+ ### Supply Lifecycle
126
304
 
127
- ```bash
128
- zigchaind query factory denom-auth <denom>
305
+ ```
306
+ total_minted - total_burned = total_supply
129
307
  ```
130
308
 
131
- **Method**
309
+ | Field | Meaning |
310
+ | ------------- | -------------------------------------------- |
311
+ | total_minted | All tokens ever created (cumulative) |
312
+ | total_burned | All tokens ever destroyed (cumulative) |
313
+ | total_supply | Tokens currently in circulation |
314
+
315
+ > In the example, all three supply fields are `0` — this token was created but no minting has occurred yet.
316
+
317
+ ## When to Use
318
+
319
+ * Verifying a token's supply cap before interacting with it
320
+ * Checking who controls minting and metadata for a token
321
+ * Auditing token admin authority for security reviews
322
+ * Tracking a token's mint/burn history over time
323
+
324
+ ---
325
+
326
+ # 4️⃣ fetchDenomAuth
327
+
328
+ ## Method
132
329
 
133
330
  ```ts
134
- fetchDenomAuth(denom: string)
331
+ async fetchDenomAuth(denom: string)
135
332
  ```
136
333
 
137
- **Parameters**
334
+ ## CLI Equivalent
335
+
336
+ ```bash
337
+ zigchaind query factory denom-auth <denom>
338
+ ```
138
339
 
139
- * `denom: string` – The denom to query.
340
+ ## Description
140
341
 
141
- **Returns**
342
+ Fetches the **current authorization configuration** for a factory token — specifically which addresses hold bank admin and metadata admin authority.
142
343
 
143
- * `DenomAuthResponse` Shows the permissions and authorities associated with the denom.
344
+ This is a lightweight alternative to `fetchDenom` when you only need to check who controls a token, without the full supply statistics.
144
345
 
145
- **Example**
346
+ ## Parameters
347
+
348
+ | Name | Type | Description |
349
+ | ----- | ------ | ----------------------------------------- |
350
+ | denom | string | Full factory token denom to query |
351
+
352
+ ## Usage Example
146
353
 
147
354
  ```ts
148
- const auth = await factoryApi.fetchDenomAuth('uzig')
149
- console.log('Denom authorization:')
355
+ const auth = await factoryApi.fetchDenomAuth(denom)
150
356
  console.dir(auth, { depth: null })
151
357
  ```
152
358
 
153
- ---
359
+ ## Example Response
360
+
361
+ ```json
362
+ {
363
+ "denom_auth": {
364
+ "denom": "coin.zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a.neon",
365
+ "bank_admin": "zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a",
366
+ "metadata_admin": "zig1020uljv3lamnhlgvetx5tq5gtjl6p7ggvepdeep2fjul6u0pevzsjz270a"
367
+ }
368
+ }
369
+ ```
370
+
371
+ ## Response Field Explanation
372
+
373
+ ### `denom_auth`
374
+
375
+ | Field | Description |
376
+ | -------------- | ------------------------------------------------------------------------ |
377
+ | denom | The factory token denom this authorization applies to |
378
+ | bank_admin | Address authorized to mint and burn this token |
379
+ | metadata_admin | Address authorized to update this token's metadata |
380
+
381
+ ### `fetchDenom` vs `fetchDenomAuth`
382
+
383
+ | Feature | fetchDenom | fetchDenomAuth |
384
+ | -------------------------- | ------------------- | --------------------------- |
385
+ | Admin addresses | ✅ Yes | ✅ Yes |
386
+ | Supply statistics | ✅ Yes | ❌ No |
387
+ | Supply caps | ✅ Yes | ❌ No |
388
+ | Creator address | ✅ Yes | ❌ No |
389
+ | Use case | Full token details | Quick authority check only |
390
+
391
+ ### Admin Role Separation
392
+
393
+ | Role | Can Do | Cannot Do |
394
+ | -------------- | --------------------------------------------- | ---------------------------- |
395
+ | bank_admin | Mint tokens, burn tokens, update minting cap | Change metadata |
396
+ | metadata_admin | Update name, symbol, description, URI | Mint or burn tokens |
397
+
398
+ > When both admin roles are the same address (as in the example), the creator has full control over the token. When they differ, minting authority and metadata authority are independently delegated.
399
+
400
+ ## When to Use
154
401
 
155
- ## Notes
402
+ * Quick check of who can mint or burn a specific token
403
+ * Verifying whether admin authority has been transferred
404
+ * Security audits of token control structures
156
405
 
157
- * All queries are **read-only** and do not require a wallet.
158
- * Useful for tracking **admin-created tokens** and their **permissions**.
159
- * Denom authorizations indicate **who can mint, burn, or manage a token**.