@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
package/docs/auth.md CHANGED
@@ -1,7 +1,66 @@
1
1
  # Auth Module
2
2
 
3
- The **Auth module** manages blockchain accounts and authentication-related data.
4
- It allows you to query account details, account info used for signing transactions, module accounts, and chain authentication parameters.
3
+ ## What is the Auth Module?
4
+
5
+ The **Auth module** is a core Cosmos SDK module responsible for managing **accounts** on the blockchain.
6
+
7
+ In **ZigChain**, every address that holds tokens, signs transactions, or interacts with the chain is backed by an account managed by this module.
8
+
9
+ ---
10
+
11
+ ## Important Terminology
12
+
13
+ ### Account
14
+
15
+ An **Account** is an on-chain entity identified by a unique bech32 address. It tracks the public key, sequence number, and account number required to authorize transactions.
16
+
17
+ There are different account types:
18
+
19
+ | Type | Description |
20
+ | ------------- | ------------------------------------------------ |
21
+ | BaseAccount | Standard user account |
22
+ | ModuleAccount | System account owned by a chain module (e.g. staking, gov) |
23
+
24
+ ---
25
+
26
+ ### Account Number
27
+
28
+ A unique numeric ID assigned to an account when it is first seen on-chain.
29
+
30
+ Example:
31
+ ```
32
+ account_number = 138553
33
+ ```
34
+
35
+ ---
36
+
37
+ ### Sequence
38
+
39
+ A counter that increments with every transaction signed by an account. Used to prevent replay attacks.
40
+
41
+ Example:
42
+ ```
43
+ sequence = 115309
44
+ ```
45
+
46
+ > Both `account_number` and `sequence` are **required** when building and signing transactions.
47
+
48
+ ---
49
+
50
+ ### Public Key
51
+
52
+ The cryptographic public key associated with an account. Used to verify transaction signatures.
53
+
54
+ ---
55
+
56
+ ### Bech32 Prefix
57
+
58
+ The human-readable prefix prepended to all addresses on a chain. ZigChain uses `zig` as its prefix.
59
+
60
+ Example:
61
+ ```
62
+ zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5
63
+ ```
5
64
 
6
65
  ---
7
66
 
@@ -16,174 +75,481 @@ import {
16
75
 
17
76
  const endpoints = getNetworkEndpoints(Network.Testnet)
18
77
  const authApi = new ChainAuthApi(endpoints)
78
+
79
+ const address = 'zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5'
19
80
  ```
20
81
 
21
82
  ---
22
83
 
23
- ## `fetchAccount`
84
+ # 1️⃣ fetchAccount
85
+
86
+ ## Method
24
87
 
25
- Query the **full account object** by address.
26
- This may include different account types (BaseAccount, ModuleAccount, etc).
88
+ ```ts
89
+ async fetchAccount(address: string)
90
+ ```
27
91
 
28
- **CLI equivalent**
92
+ ## CLI Equivalent
29
93
 
30
94
  ```bash
31
95
  zigchaind query auth account <address>
32
96
  ```
33
97
 
34
- **Method**
98
+ ## Description
35
99
 
36
- ```ts
37
- fetchAccount(address: string)
38
- ```
100
+ Fetches the **full account object** for a given address.
101
+
102
+ This returns the complete account representation, which varies depending on account type. For a standard user wallet this will be a `BaseAccount`. For chain-owned system addresses it may be a `ModuleAccount`.
39
103
 
40
- **Example**
104
+ This is the most complete account query available.
105
+
106
+ ## Parameters
107
+
108
+ | Name | Type | Description |
109
+ | ------- | ------ | ---------------------------------- |
110
+ | address | string | Bech32 address of the account to query |
111
+
112
+ ## Usage Example
41
113
 
42
114
  ```ts
43
- const account = await authApi.fetchAccount(
44
- 'zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5'
45
- )
115
+ const account = await authApi.fetchAccount(address)
116
+ console.dir(account, { depth: null })
117
+ ```
46
118
 
47
- console.log(account)
119
+ ## Example Response
120
+
121
+ ```json
122
+ {
123
+ "account": {
124
+ "@type": "/cosmos.auth.v1beta1.BaseAccount",
125
+ "address": "zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5",
126
+ "pub_key": {
127
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
128
+ "key": "Ax6bvKIvU8eViWA6rmn6c/fyYiyuj3/tyiJt2gzv/UDP"
129
+ },
130
+ "account_number": "138553",
131
+ "sequence": "115309"
132
+ }
133
+ }
48
134
  ```
49
135
 
136
+ ## Response Field Explanation
137
+
138
+ ### `account`
139
+
140
+ The full account object.
141
+
142
+ | Field | Description |
143
+ | -------------- | ---------------------------------------------------------- |
144
+ | @type | Protobuf type URL indicating the account type |
145
+ | address | Bech32 address of the account |
146
+ | pub_key.@type | Cryptographic key type (secp256k1 for standard accounts) |
147
+ | pub_key.key | Base64-encoded public key |
148
+ | account_number | Unique chain-assigned ID for this account |
149
+ | sequence | Number of transactions sent — increments with each tx |
150
+
151
+ > ⚠️ `pub_key` may be `null` if the account exists on-chain but has never signed a transaction.
152
+
153
+ ## When to Use
154
+
155
+ * Inspecting the full account object and type
156
+ * Checking account type (`BaseAccount` vs `ModuleAccount`)
157
+ * Block explorers displaying full account details
158
+ * Debugging account state
159
+
50
160
  ---
51
161
 
52
- ## `fetchAccountInfo`
162
+ # 2️⃣ fetchAccountInfo
163
+
164
+ ## Method
53
165
 
54
- Query **common account info** used for signing transactions.
55
- This returns only the fields required for tx signing (account number, sequence, pubkey).
166
+ ```ts
167
+ async fetchAccountInfo(address: string)
168
+ ```
56
169
 
57
- **CLI equivalent**
170
+ ## CLI Equivalent
58
171
 
59
172
  ```bash
60
173
  zigchaind query auth account-info <address>
61
174
  ```
62
175
 
63
- **Method**
176
+ ## Description
177
+
178
+ Fetches **lightweight account info** — only the fields required for **signing transactions**.
179
+
180
+ Unlike `fetchAccount`, this endpoint returns a consistent, type-agnostic response regardless of the underlying account type. This makes it the preferred query when building and signing transactions.
181
+
182
+ Returns: address, public key, account number, and sequence.
64
183
 
65
- ```ts
66
- fetchAccountInfo(address: string)
67
- ```
68
184
 
69
- **Example**
185
+ ## Parameters
186
+
187
+ | Name | Type | Description |
188
+ | ------- | ------ | -------------------------------------- |
189
+ | address | string | Bech32 address of the account to query |
190
+
191
+
192
+ ## Usage Example
70
193
 
71
194
  ```ts
72
- const info = await authApi.fetchAccountInfo(
73
- 'zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5'
74
- )
195
+ const info = await authApi.fetchAccountInfo(address)
196
+ console.dir(info, { depth: null })
197
+ ```
75
198
 
76
- console.log(info)
199
+ ## Example Response
200
+
201
+ ```json
202
+ {
203
+ "info": {
204
+ "address": "zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5",
205
+ "pub_key": {
206
+ "@type": "/cosmos.crypto.secp256k1.PubKey",
207
+ "key": "Ax6bvKIvU8eViWA6rmn6c/fyYiyuj3/tyiJt2gzv/UDP"
208
+ },
209
+ "account_number": "138553",
210
+ "sequence": "115309"
211
+ }
212
+ }
77
213
  ```
78
214
 
215
+ ## Response Field Explanation
216
+
217
+ ### `info`
218
+
219
+ | Field | Description |
220
+ | -------------- | ----------------------------------------------------- |
221
+ | address | Bech32 address of the account |
222
+ | pub_key.@type | Cryptographic key type |
223
+ | pub_key.key | Base64-encoded public key |
224
+ | account_number | Required for tx signing — unique ID for this account |
225
+ | sequence | Required for tx signing — increments with each tx |
226
+
227
+ ### `fetchAccountInfo` vs `fetchAccount`
228
+
229
+ | Feature | fetchAccount | fetchAccountInfo |
230
+ | -------------------- | -------------------- | ---------------------- |
231
+ | Returns account type | ✅ Yes | ❌ No |
232
+ | Ideal for tx signing | ⚠️ Works but verbose | ✅ Preferred |
233
+ | Response size | Larger | Minimal |
234
+
235
+ ## When to Use
236
+
237
+ * Building and signing transactions (primary use case)
238
+ * Fetching `account_number` and `sequence` for tx construction
239
+ * Wallet implementations
240
+ * Any scenario where only signing data is needed
241
+
79
242
  ---
80
243
 
81
- ## `fetchBech32Prefix`
244
+ # 3️⃣ fetchBech32Prefix
82
245
 
83
- Query the **Bech32 address prefix** used by the chain (e.g. `zig`).
246
+ ## Method
247
+
248
+ ```ts
249
+ async fetchBech32Prefix()
250
+ ```
84
251
 
85
- **CLI equivalent**
252
+ ## CLI Equivalent
86
253
 
87
254
  ```bash
88
255
  zigchaind query auth bech32-prefix
89
256
  ```
90
257
 
91
- **Method**
258
+ ## Description
92
259
 
93
- ```ts
94
- fetchBech32Prefix()
95
- ```
260
+ Fetches the **Bech32 address prefix** configured for the chain.
261
+
262
+ This prefix is prepended to all addresses on the network. For ZigChain, this will always be `zig`.
263
+
264
+ This is useful when you need to programmatically verify that an address belongs to ZigChain, or when building tools that support multiple chains.
96
265
 
97
- **Example**
266
+ ## Parameters
267
+
268
+ None.
269
+
270
+
271
+ ## Usage Example
98
272
 
99
273
  ```ts
100
274
  const prefix = await authApi.fetchBech32Prefix()
101
- console.log(prefix)
275
+ console.dir(prefix, { depth: null })
102
276
  ```
103
277
 
278
+ ## Example Response
279
+
280
+ ```json
281
+ {
282
+ "bech32_prefix": "zig"
283
+ }
284
+ ```
285
+
286
+ ## Response Field Explanation
287
+
288
+ | Field | Description |
289
+ | ------------- | ---------------------------------------- |
290
+ | bech32_prefix | The human-readable prefix for addresses on this chain |
291
+
292
+ ## When to Use
293
+
294
+ * Validating that an address belongs to ZigChain
295
+ * Multi-chain tools that need to identify the network
296
+
104
297
  ---
105
298
 
106
- ## `fetchAccountsByModule`
299
+ # 4️⃣ fetchModuleAccounts
107
300
 
108
- Query the **module account information** for a specific module name.
301
+ ## Method
109
302
 
110
- **CLI equivalent**
303
+ ```ts
304
+ async fetchModuleAccounts()
305
+ ```
306
+
307
+ ## CLI Equivalent
111
308
 
112
309
  ```bash
113
- zigchaind query auth module-account <module_name>
310
+ zigchaind query auth module-accounts
114
311
  ```
115
312
 
116
- **Method**
313
+ ## Description
117
314
 
118
- ```ts
119
- fetchAccountsByModule(moduleName: string)
120
- ```
315
+ Fetches **all module accounts** registered on the chain.
316
+
317
+ Module accounts are special system-owned accounts that belong to chain modules (e.g. `gov`, `staking`, `mint`). Unlike user accounts, they are not controlled by a private key — they are controlled programmatically by their respective modules.
318
+
319
+ Each module account has a set of **permissions** that define what it is allowed to do with tokens.
121
320
 
122
- **Example**
321
+ ## Parameters
322
+
323
+ None.
324
+
325
+ ## Usage Example
123
326
 
124
327
  ```ts
125
- const stakingModule = await authApi.fetchAccountsByModule('staking')
126
- console.log(stakingModule)
328
+ const modAccounts = await authApi.fetchModuleAccounts()
329
+ console.dir(modAccounts, { depth: null })
330
+ ```
331
+
332
+ ## Example Response
333
+
334
+ ```json
335
+ {
336
+ "accounts": [
337
+ {
338
+ "@type": "/cosmos.auth.v1beta1.ModuleAccount",
339
+ "base_account": {
340
+ "address": "zig1fl48vsnmsdzcv85q5d2q4z5ajdha8yu353vaml",
341
+ "pub_key": null,
342
+ "account_number": "17",
343
+ "sequence": "0"
344
+ },
345
+ "name": "bonded_tokens_pool",
346
+ "permissions": ["burner", "staking"]
347
+ },
348
+ {
349
+ "@type": "/cosmos.auth.v1beta1.ModuleAccount",
350
+ "base_account": {
351
+ "address": "zig10d07y265gmmuvt4z0w9aw880jnsr700jmgkh5m",
352
+ "pub_key": null,
353
+ "account_number": "19",
354
+ "sequence": "0"
355
+ },
356
+ "name": "gov",
357
+ "permissions": ["burner"]
358
+ }
359
+ ]
360
+ }
127
361
  ```
128
362
 
363
+ ## Response Field Explanation
364
+
365
+ ### `accounts`
366
+
367
+ Array of all module accounts on the chain.
368
+
369
+ Each entry contains:
370
+
371
+ | Field | Description |
372
+ | --------------------------- | -------------------------------------------------------- |
373
+ | @type | Always `/cosmos.auth.v1beta1.ModuleAccount` |
374
+ | base_account.address | Bech32 address of the module account |
375
+ | base_account.pub_key | Always `null` — module accounts have no private key |
376
+ | base_account.account_number | Chain-assigned account ID |
377
+ | base_account.sequence | Always `0` — module accounts never sign transactions |
378
+ | name | Unique identifier for the module (e.g. `gov`, `staking`) |
379
+ | permissions | List of token operation permissions granted to this module |
380
+
381
+ ### Module Permission Types
382
+
383
+ | Permission | Meaning |
384
+ | ---------- | ------------------------------------------------ |
385
+ | minter | Can mint (create) new tokens |
386
+ | burner | Can burn (destroy) tokens |
387
+ | staking | Can interact with staked/bonded token operations |
388
+
389
+ ## When to Use
390
+
391
+ * Inspecting all system accounts on the chain
392
+ * Understanding which modules have minting or burning capabilities
393
+ * Block explorer chain overview pages
394
+ * Security auditing of module permissions
395
+
129
396
  ---
130
397
 
131
- ## `fetchModuleAccounts`
398
+ # 5️⃣ fetchAccountsByModule
132
399
 
133
- Query **all module accounts** registered on the chain.
400
+ ## Method
134
401
 
135
- **CLI equivalent**
402
+ ```ts
403
+ async fetchAccountsByModule(moduleName: string)
404
+ ```
405
+
406
+ ## CLI Equivalent
136
407
 
137
408
  ```bash
138
- zigchaind query auth module-accounts
409
+ zigchaind query auth module-account <module_name>
139
410
  ```
140
411
 
141
- **Method**
412
+ ## Description
142
413
 
143
- ```ts
144
- fetchModuleAccounts()
145
- ```
414
+ Fetches the **module account details** for a single, specific module by name.
415
+
416
+ Use this when you need the address, account number, or permissions of one particular module rather than fetching all of them with `fetchModuleAccounts`.
417
+
418
+ ## Parameters
419
+
420
+ | Name | Type | Description |
421
+ | ---------- | ------ | -------------------------------------------------------------- |
422
+ | moduleName | string | Name of the module (e.g. `gov`, `staking` etc) |
146
423
 
147
- **Example**
424
+
425
+ ## Usage Example
148
426
 
149
427
  ```ts
150
- const modules = await authApi.fetchModuleAccounts()
151
- console.log(modules)
428
+ const govModule = await authApi.fetchAccountsByModule('gov')
429
+ console.dir(govModule, { depth: null })
430
+ ```
431
+
432
+ ## Example Response
433
+
434
+ ```json
435
+ {
436
+ "account": {
437
+ "@type": "/cosmos.auth.v1beta1.ModuleAccount",
438
+ "base_account": {
439
+ "address": "zig10d07y265gmmuvt4z0w9aw880jnsr700jmgkh5m",
440
+ "pub_key": null,
441
+ "account_number": "19",
442
+ "sequence": "0"
443
+ },
444
+ "name": "gov",
445
+ "permissions": ["burner"]
446
+ }
447
+ }
152
448
  ```
153
449
 
450
+ ## Response Field Explanation
451
+
452
+ ### `account`
453
+
454
+ | Field | Description |
455
+ | --------------------------- | -------------------------------------------------- |
456
+ | @type | Always `/cosmos.auth.v1beta1.ModuleAccount` |
457
+ | base_account.address | Bech32 address of this module account |
458
+ | base_account.pub_key | Always `null` — no private key for module accounts |
459
+ | base_account.account_number | Chain-assigned ID for this account |
460
+ | base_account.sequence | Always `0` |
461
+ | name | The module name as registered on-chain |
462
+ | permissions | Token operation permissions for this module |
463
+
464
+ ## When to Use
465
+
466
+ * Checking permissions of a particular module
467
+ * Verifying module account existence
468
+ * Building tools that interact with module-controlled addresses (e.g. tracking gov deposit pool balances)
469
+
154
470
  ---
155
471
 
156
- ## `fetchAuthParams`
472
+ # 6️⃣ fetchAuthParams
157
473
 
158
- Query the **auth module parameters**, such as signature limits and account rules.
159
- Supports querying parameters at a **specific block height**.
474
+ ## Method
160
475
 
161
- **CLI equivalent**
476
+ ```ts
477
+ async fetchAuthParams(height?: number)
478
+ ```
479
+
480
+ ## CLI Equivalent
162
481
 
163
482
  ```bash
164
483
  zigchaind query auth params
165
484
  zigchaind query auth params --height <H>
166
485
  ```
167
486
 
168
- **Method**
487
+ ## Description
169
488
 
170
- ```ts
171
- fetchAuthParams(height?: number)
172
- ```
489
+ Fetches the **Auth module parameters** configured at chain level.
490
+
491
+ These parameters govern transaction validation rules — such as how large a memo can be, how many signatures a transaction can carry, and the computational cost of signature verification.
492
+
493
+ These are governance-controlled settings and can be updated via on-chain proposals.
494
+
495
+ Supports querying parameters at a **specific block height** for historical state.
496
+
497
+ ## Parameters
498
+
499
+ | Name | Type | Required | Description |
500
+ | ------ | ------ | -------- | ----------------------------------------------------------------- |
501
+ | height | number | ❌ No | Block height to query at. Omit for latest state. |
173
502
 
174
- **Example (latest state)**
503
+ ## Usage Example
504
+
505
+ **Latest state:**
175
506
 
176
507
  ```ts
177
508
  const params = await authApi.fetchAuthParams()
178
- console.log(params)
509
+ console.dir(params, { depth: null })
179
510
  ```
180
511
 
181
- **Example (historical state)**
512
+ **Historical state at a specific block height:**
182
513
 
183
514
  ```ts
184
- const paramsAtHeight = await authApi.fetchAuthParams(123456)
185
- console.log(paramsAtHeight)
515
+ const paramsAtHeight = await authApi.fetchAuthParams(500000)
516
+ console.dir(paramsAtHeight, { depth: null })
517
+ ```
518
+
519
+ ## Example Response
520
+
521
+ ```json
522
+ {
523
+ "params": {
524
+ "max_memo_characters": "256",
525
+ "tx_sig_limit": "7",
526
+ "tx_size_cost_per_byte": "10",
527
+ "sig_verify_cost_ed25519": "590",
528
+ "sig_verify_cost_secp256k1": "1000"
529
+ }
530
+ }
186
531
  ```
187
532
 
533
+ ## Response Field Explanation
534
+
535
+ ### `params`
536
+
537
+ | Field | Description |
538
+ | ------------------------ | ------------------------------------------------------------------------ |
539
+ | max_memo_characters | Maximum number of characters allowed in a transaction memo |
540
+ | tx_sig_limit | Maximum number of signatures allowed per transaction |
541
+ | tx_size_cost_per_byte | Gas cost charged per byte of transaction size |
542
+ | sig_verify_cost_ed25519 | Gas cost for verifying an Ed25519 signature |
543
+ | sig_verify_cost_secp256k1 | Gas cost for verifying a secp256k1 signature (standard user transactions) |
544
+
545
+ > On ZigChain, most user transactions use `secp256k1` signatures, so `sig_verify_cost_secp256k1` is the most commonly applied verification cost.
546
+
547
+ ## When to Use
548
+
549
+ * Validating memo length before broadcasting a transaction
550
+ * Estimating gas costs for multi-signature transactions
551
+ * Auditing chain governance parameters
552
+ * Building chain configuration dashboards
553
+
188
554
  ---
189
555