@zuhaibnoor/zigchain-sdk 1.0.3 → 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 (185) hide show
  1. package/README.md +1 -1
  2. package/dist/auth/ChainAuthApi.d.ts +0 -3
  3. package/dist/auth/ChainAuthApi.d.ts.map +1 -1
  4. package/dist/auth/ChainAuthApi.js +0 -26
  5. package/dist/auth/ChainAuthApi.js.map +1 -1
  6. package/dist/bank/ChainBankApi.d.ts +0 -9
  7. package/dist/bank/ChainBankApi.d.ts.map +1 -1
  8. package/dist/bank/ChainBankApi.js +0 -18
  9. package/dist/bank/ChainBankApi.js.map +1 -1
  10. package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
  11. package/dist/circuit/ChainCircuitApi.js.map +1 -1
  12. package/dist/client/http.d.ts +1 -0
  13. package/dist/client/http.d.ts.map +1 -1
  14. package/dist/client/http.js +10 -0
  15. package/dist/client/http.js.map +1 -1
  16. package/dist/dex/ChainDexApi.d.ts.map +1 -1
  17. package/dist/dex/ChainDexApi.js.map +1 -1
  18. package/dist/distribution/ChainDistributionApi.d.ts +47 -0
  19. package/dist/distribution/ChainDistributionApi.d.ts.map +1 -0
  20. package/dist/distribution/ChainDistributionApi.js +74 -0
  21. package/dist/distribution/ChainDistributionApi.js.map +1 -0
  22. package/dist/distribution/types.d.ts +71 -0
  23. package/dist/distribution/types.d.ts.map +1 -0
  24. package/dist/distribution/types.js +2 -0
  25. package/dist/distribution/types.js.map +1 -0
  26. package/dist/evidence/ChainEvidenceApi.d.ts +15 -0
  27. package/dist/evidence/ChainEvidenceApi.d.ts.map +1 -0
  28. package/dist/evidence/ChainEvidenceApi.js +22 -0
  29. package/dist/evidence/ChainEvidenceApi.js.map +1 -0
  30. package/dist/evidence/types.d.ts +15 -0
  31. package/dist/evidence/types.d.ts.map +1 -0
  32. package/dist/evidence/types.js +2 -0
  33. package/dist/evidence/types.js.map +1 -0
  34. package/dist/feegrant/ChainFeegrantApi.d.ts +22 -0
  35. package/dist/feegrant/ChainFeegrantApi.d.ts.map +1 -0
  36. package/dist/feegrant/ChainFeegrantApi.js +32 -0
  37. package/dist/feegrant/ChainFeegrantApi.js.map +1 -0
  38. package/dist/feegrant/types.d.ts +17 -0
  39. package/dist/feegrant/types.d.ts.map +1 -0
  40. package/dist/feegrant/types.js +2 -0
  41. package/dist/feegrant/types.js.map +1 -0
  42. package/dist/ibc/ChainIbcApi.d.ts +55 -0
  43. package/dist/ibc/ChainIbcApi.d.ts.map +1 -0
  44. package/dist/ibc/ChainIbcApi.js +82 -0
  45. package/dist/ibc/ChainIbcApi.js.map +1 -0
  46. package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts +55 -0
  47. package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts.map +1 -0
  48. package/dist/ibc/ibcChannel/ChainIbcChannelApi.js +82 -0
  49. package/dist/ibc/ibcChannel/ChainIbcChannelApi.js.map +1 -0
  50. package/dist/ibc/ibcChannel/types.d.ts +106 -0
  51. package/dist/ibc/ibcChannel/types.d.ts.map +1 -0
  52. package/dist/ibc/ibcChannel/types.js +2 -0
  53. package/dist/ibc/ibcChannel/types.js.map +1 -0
  54. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts +14 -0
  55. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts.map +1 -0
  56. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js +38 -0
  57. package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js.map +1 -0
  58. package/dist/ibc/ibcChannelV2/types.d.ts +26 -0
  59. package/dist/ibc/ibcChannelV2/types.d.ts.map +1 -0
  60. package/dist/ibc/ibcChannelV2/types.js +3 -0
  61. package/dist/ibc/ibcChannelV2/types.js.map +1 -0
  62. package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts +15 -0
  63. package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts.map +1 -0
  64. package/dist/ibc/ibcClient/ChainIbcClientApi.js +39 -0
  65. package/dist/ibc/ibcClient/ChainIbcClientApi.js.map +1 -0
  66. package/dist/ibc/ibcClient/types.d.ts +53 -0
  67. package/dist/ibc/ibcClient/types.d.ts.map +1 -0
  68. package/dist/ibc/ibcClient/types.js +2 -0
  69. package/dist/ibc/ibcClient/types.js.map +1 -0
  70. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts +11 -0
  71. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts.map +1 -0
  72. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js +24 -0
  73. package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js.map +1 -0
  74. package/dist/ibc/ibcConnection/types.d.ts +18 -0
  75. package/dist/ibc/ibcConnection/types.d.ts.map +1 -0
  76. package/dist/ibc/ibcConnection/types.js +2 -0
  77. package/dist/ibc/ibcConnection/types.js.map +1 -0
  78. package/dist/ibc/types.d.ts +106 -0
  79. package/dist/ibc/types.d.ts.map +1 -0
  80. package/dist/ibc/types.js +2 -0
  81. package/dist/ibc/types.js.map +1 -0
  82. package/dist/ibc-transfer/ChainIbcTransferApi.d.ts +12 -0
  83. package/dist/ibc-transfer/ChainIbcTransferApi.d.ts.map +1 -0
  84. package/dist/ibc-transfer/ChainIbcTransferApi.js +30 -0
  85. package/dist/ibc-transfer/ChainIbcTransferApi.js.map +1 -0
  86. package/dist/ibc-transfer/types.d.ts +26 -0
  87. package/dist/ibc-transfer/types.d.ts.map +1 -0
  88. package/dist/ibc-transfer/types.js +2 -0
  89. package/dist/ibc-transfer/types.js.map +1 -0
  90. package/dist/index.d.ts +26 -0
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +26 -0
  93. package/dist/index.js.map +1 -1
  94. package/dist/interchain-accounts/ChainInterChainAccApi.d.ts +9 -0
  95. package/dist/interchain-accounts/ChainInterChainAccApi.d.ts.map +1 -0
  96. package/dist/interchain-accounts/ChainInterChainAccApi.js +16 -0
  97. package/dist/interchain-accounts/ChainInterChainAccApi.js.map +1 -0
  98. package/dist/interchain-accounts/types.d.ts +12 -0
  99. package/dist/interchain-accounts/types.d.ts.map +1 -0
  100. package/dist/interchain-accounts/types.js +2 -0
  101. package/dist/interchain-accounts/types.js.map +1 -0
  102. package/dist/networks/endpoints.js +2 -2
  103. package/dist/networks/endpoints.js.map +1 -1
  104. package/dist/runtime/ChainRuntimeApi.d.ts +12 -0
  105. package/dist/runtime/ChainRuntimeApi.d.ts.map +1 -0
  106. package/dist/runtime/ChainRuntimeApi.js +16 -0
  107. package/dist/runtime/ChainRuntimeApi.js.map +1 -0
  108. package/dist/runtime/types.d.ts +4 -0
  109. package/dist/runtime/types.d.ts.map +1 -0
  110. package/dist/runtime/types.js +2 -0
  111. package/dist/runtime/types.js.map +1 -0
  112. package/dist/staking/ChainStakingApi.d.ts +1 -5
  113. package/dist/staking/ChainStakingApi.d.ts.map +1 -1
  114. package/dist/staking/ChainStakingApi.js +9 -7
  115. package/dist/staking/ChainStakingApi.js.map +1 -1
  116. package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts +19 -0
  117. package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts.map +1 -0
  118. package/dist/tokenwrapper/ChainTokenWrapperApi.js +26 -0
  119. package/dist/tokenwrapper/ChainTokenWrapperApi.js.map +1 -0
  120. package/dist/tokenwrapper/types.d.ts +15 -0
  121. package/dist/tokenwrapper/types.d.ts.map +1 -0
  122. package/dist/tokenwrapper/types.js +2 -0
  123. package/dist/tokenwrapper/types.js.map +1 -0
  124. package/dist/txs/ChainTxsApi.d.ts +12 -0
  125. package/dist/txs/ChainTxsApi.d.ts.map +1 -0
  126. package/dist/txs/ChainTxsApi.js +17 -0
  127. package/dist/txs/ChainTxsApi.js.map +1 -0
  128. package/dist/txs/types.d.ts +22 -0
  129. package/dist/txs/types.d.ts.map +1 -0
  130. package/dist/txs/types.js +5 -0
  131. package/dist/txs/types.js.map +1 -0
  132. package/dist/upgrade/ChainUpgradeApi.d.ts +22 -0
  133. package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -0
  134. package/dist/upgrade/ChainUpgradeApi.js +40 -0
  135. package/dist/upgrade/ChainUpgradeApi.js.map +1 -0
  136. package/dist/upgrade/types.d.ts +24 -0
  137. package/dist/upgrade/types.d.ts.map +1 -0
  138. package/dist/upgrade/types.js +5 -0
  139. package/dist/upgrade/types.js.map +1 -0
  140. package/dist/validator-set/ChainCometValidator.d.ts +8 -0
  141. package/dist/validator-set/ChainCometValidator.d.ts.map +1 -0
  142. package/dist/validator-set/ChainCometValidator.js +15 -0
  143. package/dist/validator-set/ChainCometValidator.js.map +1 -0
  144. package/dist/validator-set/ChainValidator.d.ts +8 -0
  145. package/dist/validator-set/ChainValidator.d.ts.map +1 -0
  146. package/dist/validator-set/ChainValidator.js +15 -0
  147. package/dist/validator-set/ChainValidator.js.map +1 -0
  148. package/dist/validator-set/types.d.ts +18 -0
  149. package/dist/validator-set/types.d.ts.map +1 -0
  150. package/dist/validator-set/types.js +2 -0
  151. package/dist/validator-set/types.js.map +1 -0
  152. package/dist/wasm/ChainWasmApi.d.ts +57 -0
  153. package/dist/wasm/ChainWasmApi.d.ts.map +1 -0
  154. package/dist/wasm/ChainWasmApi.js +78 -0
  155. package/dist/wasm/ChainWasmApi.js.map +1 -0
  156. package/dist/wasm/types.d.ts +77 -0
  157. package/dist/wasm/types.d.ts.map +1 -0
  158. package/dist/wasm/types.js +2 -0
  159. package/dist/wasm/types.js.map +1 -0
  160. package/docs/auth.md +438 -72
  161. package/docs/bank.md +782 -123
  162. package/docs/block-results.md +328 -21
  163. package/docs/block.md +325 -38
  164. package/docs/circuit.md +164 -35
  165. package/docs/dex.md +313 -63
  166. package/docs/distribution.md +772 -0
  167. package/docs/evidence.md +194 -0
  168. package/docs/factory.md +308 -62
  169. package/docs/feegrant.md +206 -0
  170. package/docs/gov.md +364 -0
  171. package/docs/ibc/ibcChannel.md +977 -0
  172. package/docs/ibc/ibcClient.md +771 -0
  173. package/docs/ibc/ibcConnection.md +214 -0
  174. package/docs/ibc-transfer.md +463 -0
  175. package/docs/interchain-accounts.md +223 -0
  176. package/docs/mint.md +270 -0
  177. package/docs/runtime.md +120 -0
  178. package/docs/slashing.md +287 -0
  179. package/docs/staking.md +756 -0
  180. package/docs/tokenwrapper.md +294 -0
  181. package/docs/txs.md +447 -0
  182. package/docs/upgrade.md +356 -0
  183. package/docs/validator-set.md +177 -0
  184. package/docs/wasm.md +916 -0
  185. package/package.json +1 -1
@@ -0,0 +1,772 @@
1
+ # Distribution Module
2
+
3
+ ## What is the Distribution Module?
4
+
5
+ The **Distribution module** is a core Cosmos SDK module responsible for **collecting and distributing staking rewards** on ZigChain.
6
+
7
+ Every block, newly minted tokens and transaction fees flow through this module. It handles splitting rewards between validators (as commission) and delegators (as staking rewards), maintains the community pool, and tracks outstanding and withdrawn amounts for every participant.
8
+
9
+ ---
10
+
11
+ ## Important Terminology
12
+
13
+ ### Staking Rewards
14
+
15
+ When you delegate tokens to a validator, you earn a share of the block rewards proportional to your stake. These accumulate over time and must be explicitly withdrawn.
16
+
17
+ ---
18
+
19
+ ### Validator Commission
20
+
21
+ A **commission** is the percentage of delegator rewards that a validator keeps for themselves as payment for running the node. The remaining portion flows to delegators.
22
+
23
+ Commission accumulates continuously and is tracked separately from delegator rewards.
24
+
25
+ ---
26
+
27
+ ### Community Pool
28
+
29
+ A portion of every block reward (defined by `community_tax`) is sent to the **community pool** — a shared on-chain treasury. These funds can only be spent via governance proposals.
30
+
31
+ ---
32
+
33
+ ### Withdraw Address
34
+
35
+ By default, a delegator's rewards are sent to their own address when withdrawn. A delegator can optionally configure a **custom withdraw address** — a different address where rewards will be sent instead.
36
+
37
+ ---
38
+
39
+ ### Community Tax
40
+
41
+ The fraction of each block reward that is diverted to the community pool before distributing the remainder to validators and delegators.
42
+
43
+ ```
44
+ community_tax = 0.02 → 2% of all block rewards go to the community pool
45
+ ```
46
+
47
+ ---
48
+
49
+ ### Outstanding Rewards
50
+
51
+ Rewards that have been earned but **not yet withdrawn**. These accumulate on-chain until the validator or delegator explicitly claims them.
52
+
53
+ ---
54
+
55
+ ## Setup
56
+
57
+ ```ts
58
+ import {
59
+ ChainDistributionApi,
60
+ getNetworkEndpoints,
61
+ Network,
62
+ } from '@zuhaibnoor/zigchain-sdk'
63
+
64
+ const endpoints = getNetworkEndpoints(Network.Testnet)
65
+ const distributionApi = new ChainDistributionApi(endpoints)
66
+
67
+ const delegator = 'zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6'
68
+ const validator = 'zigvaloper1pwwymlyeyfcz3pjvcegvz8tj3yf0pr3wqqhrwk'
69
+ ```
70
+
71
+ ---
72
+
73
+ # 1️⃣ fetchParams
74
+
75
+ ## Method
76
+
77
+ ```ts
78
+ async fetchParams()
79
+ ```
80
+
81
+ ## CLI Equivalent
82
+
83
+ ```bash
84
+ zigchaind query distribution params
85
+ ```
86
+
87
+ ## Description
88
+
89
+ Fetches the **Distribution module parameters** configured at chain level.
90
+
91
+ These are governance-controlled settings that define how block rewards are split across the community pool, validators, and delegators. The most important parameter is `community_tax` — the fraction of every block reward redirected to the community pool before validator and delegator distribution.
92
+
93
+ ## Parameters
94
+
95
+ None.
96
+
97
+ ## Usage Example
98
+
99
+ ```ts
100
+ const params = await distributionApi.fetchParams()
101
+ console.dir(params, { depth: null })
102
+ ```
103
+
104
+ ## Example Response
105
+
106
+ ```json
107
+ {
108
+ "params": {
109
+ "community_tax": "0.020000000000000000",
110
+ "base_proposer_reward": "0.000000000000000000",
111
+ "bonus_proposer_reward": "0.000000000000000000",
112
+ "withdraw_addr_enabled": true
113
+ }
114
+ }
115
+ ```
116
+
117
+ ## Response Field Explanation
118
+
119
+ ### `params`
120
+
121
+ | Field | Description |
122
+ | ---------------------- | --------------------------------------------------------------------------------------- |
123
+ | community_tax | Fraction of each block reward sent to the community pool (`0.02` = 2%) |
124
+ | base_proposer_reward | Base bonus reward for the block proposer. Set to `0` on ZigChain |
125
+ | bonus_proposer_reward | Additional bonus for proposers based on included votes. Set to `0` on ZigChain |
126
+ | withdraw_addr_enabled | Whether delegators can set a custom reward withdrawal address (`true` = enabled) |
127
+
128
+ > On ZigChain, both proposer reward bonuses are set to `0`, meaning all validators earn equal reward rates regardless of whether they proposed the block. The 2% community tax applies to every block.
129
+
130
+ ## When to Use
131
+
132
+ * Understanding how block rewards are split at the protocol level
133
+ * Verifying whether custom withdraw addresses are enabled
134
+ * Governance monitoring for parameter change proposals
135
+
136
+ ---
137
+
138
+ # 2️⃣ fetchCommunityPool
139
+
140
+ ## Method
141
+
142
+ ```ts
143
+ async fetchCommunityPool()
144
+ ```
145
+
146
+ ## CLI Equivalent
147
+
148
+ ```bash
149
+ zigchaind query distribution community-pool
150
+ ```
151
+
152
+ ## Description
153
+
154
+ Fetches the **current balance of the community pool**.
155
+
156
+ The community pool accumulates 2% of every block reward continuously. The balance shown includes fractional amounts tracked with high precision — these accumulate as decimal remainders from reward calculations.
157
+
158
+ ## Parameters
159
+
160
+ None.
161
+
162
+ ## Usage Example
163
+
164
+ ```ts
165
+ const pool = await distributionApi.fetchCommunityPool()
166
+ console.dir(pool, { depth: null })
167
+ ```
168
+
169
+ ## Example Response
170
+
171
+ ```json
172
+ {
173
+ "pool": [
174
+ {
175
+ "denom": "uzig",
176
+ "amount": "243098073712.963766803812287124"
177
+ }
178
+ ]
179
+ }
180
+ ```
181
+
182
+ ## Response Field Explanation
183
+
184
+ ### `pool`
185
+
186
+ Array of coin balances in the community pool. Currently only `uzig` accumulates here on ZigChain testnet.
187
+
188
+ | Field | Description |
189
+ | ------ | --------------------------------------------------------------------------------- |
190
+ | denom | Token denomination in the pool |
191
+ | amount | High-precision decimal balance — includes fractional `uzig` from reward rounding |
192
+
193
+ ## When to Use
194
+
195
+ * Governance dashboards displaying available community funds
196
+ * Tracking community pool growth over time
197
+ * Calculating how much is available for governance spending proposals
198
+
199
+ ---
200
+
201
+ # 3️⃣ fetchDelegatorValidators
202
+
203
+ ## Method
204
+
205
+ ```ts
206
+ async fetchDelegatorValidators(delegator: string)
207
+ ```
208
+
209
+ ## CLI Equivalent
210
+
211
+ ```bash
212
+ zigchaind query distribution delegator-validators <delegator>
213
+ ```
214
+
215
+ ## Description
216
+
217
+ Fetches the **list of validators a delegator is currently earning rewards from**.
218
+
219
+ This returns only validators with active delegations from the given address — validators where the delegator has staked tokens and is accumulating rewards. It does not include validators with zero delegation.
220
+
221
+ ---
222
+
223
+ ## Parameters
224
+
225
+ | Name | Type | Description |
226
+ | --------- | ------ | ---------------------------------------------- |
227
+ | delegator | string | Bech32 address of the delegator to query |
228
+
229
+ ---
230
+
231
+ ## Usage Example
232
+
233
+ ```ts
234
+ const delegatorValidators = await distributionApi.fetchDelegatorValidators(delegator)
235
+ console.dir(delegatorValidators, { depth: null })
236
+ ```
237
+
238
+ ## Example Response
239
+
240
+ ```json
241
+ {
242
+ "validators": [
243
+ "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr"
244
+ ]
245
+ }
246
+ ```
247
+
248
+ ## Response Field Explanation
249
+
250
+ ### `validators`
251
+
252
+ Array of validator operator addresses (`zigvaloper...`) from which this delegator is earning rewards.
253
+
254
+ | Field | Description |
255
+ | ---------- | ----------------------------------------------------------------------- |
256
+ | validators | List of validator operator addresses with active delegations |
257
+
258
+ > In the example, this delegator has staked with exactly one validator. A delegator who has spread stake across multiple validators will see multiple entries here.
259
+
260
+ ## When to Use
261
+
262
+ * Displaying a delegator's active staking positions
263
+ * Wallet dashboards showing which validators a user is staked with
264
+ * Building staking portfolio views
265
+
266
+ ---
267
+
268
+ # 4️⃣ fetchDelegatorWithdrawAddress
269
+
270
+ ## Method
271
+
272
+ ```ts
273
+ async fetchDelegatorWithdrawAddress(delegator: string)
274
+ ```
275
+
276
+ ## CLI Equivalent
277
+
278
+ ```bash
279
+ zigchaind query distribution delegator-withdraw-address <delegator>
280
+ ```
281
+
282
+ ## Description
283
+
284
+ Fetches the **reward withdrawal address** configured for a delegator.
285
+
286
+ By default, this matches the delegator's own address. If the delegator has set a custom withdraw address, rewards will be sent there instead when claimed. This is useful for directing rewards to a separate cold wallet or treasury address.
287
+
288
+ ---
289
+
290
+ ## Parameters
291
+
292
+ | Name | Type | Description |
293
+ | --------- | ------ | ------------------------------------------------ |
294
+ | delegator | string | Bech32 address of the delegator to query |
295
+
296
+ ---
297
+
298
+ ## Usage Example
299
+
300
+ ```ts
301
+ const withdrawAddr = await distributionApi.fetchDelegatorWithdrawAddress(delegator)
302
+ console.dir(withdrawAddr, { depth: null })
303
+ ```
304
+
305
+ ## Example Response
306
+
307
+ ```json
308
+ {
309
+ "withdraw_address": "zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6"
310
+ }
311
+ ```
312
+
313
+ ## Response Field Explanation
314
+
315
+ | Field | Description |
316
+ | ---------------- | ----------------------------------------------------------------------------------- |
317
+ | withdraw_address | Address where rewards will be sent when the delegator withdraws. Defaults to the delegator's own address. |
318
+
319
+ > When `withdraw_address` matches the delegator's own address (as in the example), no custom withdraw address has been set — this is the default state.
320
+
321
+ ## When to Use
322
+
323
+ * Verifying where a delegator's rewards will be sent before withdrawal
324
+ * Wallet UIs displaying reward destination
325
+ * Confirming a custom withdraw address was set correctly
326
+
327
+ ---
328
+
329
+ # 5️⃣ fetchValidatorCommission
330
+
331
+ ## Method
332
+
333
+ ```ts
334
+ async fetchValidatorCommission(validator: string)
335
+ ```
336
+
337
+ ## CLI Equivalent
338
+
339
+ ```bash
340
+ zigchaind query distribution commission <validator>
341
+ ```
342
+
343
+ ## Description
344
+
345
+ Fetches the **accumulated commission** that a validator has earned but not yet withdrawn.
346
+
347
+ Commission is the validator's share of delegator rewards, taken at the validator's configured commission rate each block. It accumulates continuously until the validator explicitly withdraws it.
348
+
349
+ ## Parameters
350
+
351
+ | Name | Type | Description |
352
+ | --------- | ------ | ----------------------------------------------------- |
353
+ | validator | string | Validator operator address (`zigvaloper...`) to query |
354
+
355
+ ## Usage Example
356
+
357
+ ```ts
358
+ const commission = await distributionApi.fetchValidatorCommission(validator)
359
+ console.dir(commission, { depth: null })
360
+ ```
361
+
362
+ ## Example Response
363
+
364
+ ```json
365
+ {
366
+ "commission": {
367
+ "commission": [
368
+ {
369
+ "denom": "uzig",
370
+ "amount": "221571475888.997127352507253303"
371
+ }
372
+ ]
373
+ }
374
+ }
375
+ ```
376
+
377
+ ## Response Field Explanation
378
+
379
+ ### `commission.commission`
380
+
381
+ Array of outstanding commission amounts per denom.
382
+
383
+ | Field | Description |
384
+ | ------ | ---------------------------------------------------------------------------------- |
385
+ | denom | Token denomination of the commission |
386
+ | amount | High-precision accumulated commission amount not yet withdrawn by the validator |
387
+
388
+ > `221571475888 uzig` ≈ 221,571 ZIG in outstanding commission for this validator — reflecting the high activity of a top validator on ZigChain testnet.
389
+
390
+ ## When to Use
391
+
392
+ * Validator dashboards showing pending commission to withdraw
393
+ * Comparing commission accumulation across validators
394
+
395
+ ---
396
+
397
+ # 6️⃣ fetchDelegatorRewards
398
+
399
+ ## Method
400
+
401
+ ```ts
402
+ async fetchDelegatorRewards(delegator: string)
403
+ ```
404
+
405
+ ## CLI Equivalent
406
+
407
+ ```bash
408
+ zigchaind query distribution rewards <delegator-address>
409
+ ```
410
+
411
+ ## Description
412
+
413
+ Fetches **all pending staking rewards** accumulated by a delegator across every validator they are staked with.
414
+
415
+ Returns a per-validator breakdown of rewards as well as the combined total across all validators. Rewards accumulate each block and remain here until the delegator explicitly withdraws them.
416
+
417
+ ## Parameters
418
+
419
+ | Name | Type | Description |
420
+ | --------- | ------ | ---------------------------------------------- |
421
+ | delegator | string | Bech32 address of the delegator to query |
422
+
423
+ ## Usage Example
424
+
425
+ ```ts
426
+ const rewards = await distributionApi.fetchDelegatorRewards(delegator)
427
+ console.dir(rewards, { depth: null })
428
+ ```
429
+
430
+ ## Example Response
431
+
432
+ ```json
433
+ {
434
+ "rewards": [
435
+ {
436
+ "validator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
437
+ "reward": []
438
+ }
439
+ ],
440
+ "total": []
441
+ }
442
+ ```
443
+
444
+ ## Response Field Explanation
445
+
446
+ ### `rewards`
447
+
448
+ Array of per-validator reward entries for this delegator.
449
+
450
+ | Field | Description |
451
+ | ----------------- | ------------------------------------------------------------------------ |
452
+ | validator_address | Validator operator address this reward entry is associated with |
453
+ | reward | Array of pending reward coins from this validator. Empty if none pending |
454
+
455
+ ### `total`
456
+
457
+ Aggregated rewards across all validators combined.
458
+
459
+ | Field | Description |
460
+ | ----- | --------------------------------------------------------------------- |
461
+ | total | Array of total pending reward coins. Empty if no rewards are pending |
462
+
463
+
464
+ ## When to Use
465
+
466
+ * Wallet dashboards displaying a user's total pending rewards
467
+ * Showing per-validator reward breakdown before withdrawal
468
+ * Calculating total claimable rewards across all staking positions
469
+
470
+ ---
471
+
472
+ # 7️⃣ fetchDelegatorRewardsByValidator
473
+
474
+ ## Method
475
+
476
+ ```ts
477
+ async fetchDelegatorRewardsByValidator(delegator: string, validator: string)
478
+ ```
479
+
480
+ ## CLI Equivalent
481
+
482
+ ```bash
483
+ zigchaind query distribution rewards-by-validator <delegator> <validator>
484
+ ```
485
+
486
+ ## Description
487
+
488
+ Fetches the **pending rewards earned by a delegator from a single specific validator**.
489
+
490
+ This is the targeted alternative to `fetchDelegatorRewards` — use this when you only need the reward from one particular validator rather than the full cross-validator breakdown.
491
+
492
+ ## Parameters
493
+
494
+ | Name | Type | Description |
495
+ | --------- | ------ | ------------------------------------------------------- |
496
+ | delegator | string | Bech32 address of the delegator |
497
+ | validator | string | Validator operator address (`zigvaloper...`) to query |
498
+
499
+ ## Usage Example
500
+
501
+ ```ts
502
+ const rewardsByVal = await distributionApi.fetchDelegatorRewardsByValidator(
503
+ delegator,
504
+ 'zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr'
505
+ )
506
+ console.dir(rewardsByVal, { depth: null })
507
+ ```
508
+
509
+ ## Example Response
510
+
511
+ ```json
512
+ {
513
+ "rewards": []
514
+ }
515
+ ```
516
+
517
+ ## Response Field Explanation
518
+
519
+ ### `rewards`
520
+
521
+ Array of pending reward coins from this specific validator.
522
+
523
+ | Field | Description |
524
+ | ------- | ----------------------------------------------------------------------- |
525
+ | rewards | Array of coin amounts pending from this validator. Empty if none pending |
526
+
527
+ ### `fetchDelegatorRewards` vs `fetchDelegatorRewardsByValidator`
528
+
529
+ | Feature | fetchDelegatorRewards | fetchDelegatorRewardsByValidator |
530
+ | -------------------------- | --------------------------- | --------------------------------- |
531
+ | Scope | All validators | Single validator only |
532
+ | Includes total | ✅ Yes | ❌ No |
533
+ | Use case | Full portfolio rewards view | Per-validator reward inspection |
534
+
535
+ ## When to Use
536
+
537
+ * Per-validator reward analytics
538
+ * Validator-specific staking dashboards
539
+ * Comparing reward rates across different validators a delegator uses
540
+
541
+ ---
542
+
543
+ # 8️⃣ fetchValidatorSlashes
544
+
545
+ ## Method
546
+
547
+ ```ts
548
+ async fetchValidatorSlashes(validator: string)
549
+ ```
550
+
551
+ ## CLI Equivalent
552
+
553
+ ```bash
554
+ zigchaind query distribution slashes <validator-address>
555
+ ```
556
+
557
+ ## Description
558
+
559
+ Fetches the **slashing history** of a specific validator.
560
+
561
+ A slash is a penalty applied to a validator (and proportionally to their delegators) for misbehaviour — such as double signing a block or extended downtime. Each slash event records the period it occurred in and the fraction of stake that was penalized.
562
+
563
+ An empty `slashes` array means the validator has **no recorded slashing events** — a good sign of validator reliability.
564
+
565
+ ## Parameters
566
+
567
+ | Name | Type | Description |
568
+ | --------- | ------ | ----------------------------------------------------- |
569
+ | validator | string | Validator operator address (`zigvaloper...`) to query |
570
+
571
+ ## Usage Example
572
+
573
+ ```ts
574
+ const slashes = await distributionApi.fetchValidatorSlashes(validator)
575
+ console.dir(slashes, { depth: null })
576
+ ```
577
+
578
+ ## Example Response
579
+
580
+ ```json
581
+ {
582
+ "slashes": [],
583
+ "pagination": {
584
+ "next_key": null,
585
+ "total": "0"
586
+ }
587
+ }
588
+ ```
589
+
590
+ ## Response Field Explanation
591
+
592
+ ### `slashes`
593
+
594
+ Array of slashing events applied to this validator. Empty means no slashes on record.
595
+
596
+ If slash events are present, each entry would contain:
597
+
598
+ | Field | Description |
599
+ | ---------------- | -------------------------------------------------------------------- |
600
+ | validator_period | The distribution period during which the slash occurred |
601
+ | fraction | The fraction of stake that was slashed (e.g. `0.05` = 5% penalty) |
602
+
603
+ ### `pagination`
604
+
605
+ | Field | Description |
606
+ | -------- | ---------------------------------------------------- |
607
+ | next_key | Cursor for next page. `null` if all results returned |
608
+ | total | Total number of slash events recorded |
609
+
610
+ > `total: '0'` for this validator confirms a clean slashing history — no misbehaviour has been recorded.
611
+
612
+ ## When to Use
613
+
614
+ * Assessing validator reliability before delegating
615
+ * Building validator comparison and reputation dashboards
616
+ * Monitoring validators for new slash events
617
+
618
+ ---
619
+
620
+ # 9️⃣ fetchValidatorDistributionInfo
621
+
622
+ ## Method
623
+
624
+ ```ts
625
+ async fetchValidatorDistributionInfo(validator: string)
626
+ ```
627
+
628
+ ## CLI Equivalent
629
+
630
+ ```bash
631
+ zigchaind query distribution validator-distribution-info <validator-address>
632
+ ```
633
+
634
+ ## Description
635
+
636
+ Fetches a **complete distribution overview for a validator**, including their self-bond rewards and accumulated commission — all in a single query.
637
+
638
+ This is the most comprehensive single-call view of a validator's earnings from the distribution module. It shows both the rewards earned on the validator's own staked tokens and the commission earned from delegator rewards.
639
+
640
+ ## Parameters
641
+
642
+ | Name | Type | Description |
643
+ | --------- | ------ | ----------------------------------------------------- |
644
+ | validator | string | Validator operator address (`zigvaloper...`) to query |
645
+
646
+ ## Usage Example
647
+
648
+ ```ts
649
+ const distInfo = await distributionApi.fetchValidatorDistributionInfo(validator)
650
+ console.dir(distInfo, { depth: null })
651
+ ```
652
+
653
+ ## Example Response
654
+
655
+ ```json
656
+ {
657
+ "operator_address": "zig1pwwymlyeyfcz3pjvcegvz8tj3yf0pr3w48m900",
658
+ "self_bond_rewards": [
659
+ {
660
+ "denom": "uzig",
661
+ "amount": "744261754912.141600000000000000"
662
+ }
663
+ ],
664
+ "commission": [
665
+ {
666
+ "denom": "uzig",
667
+ "amount": "221589430188.073196173617296226"
668
+ }
669
+ ]
670
+ }
671
+ ```
672
+
673
+ ## Response Field Explanation
674
+
675
+ | Field | Description |
676
+ | ----------------- | ----------------------------------------------------------------------------------- |
677
+ | operator_address | The validator's account address (`zig...`) — where rewards are sent on withdrawal |
678
+ | self_bond_rewards | Pending rewards earned on the validator's own self-delegated stake |
679
+ | commission | Pending commission accumulated from delegator rewards, not yet withdrawn |
680
+
681
+ ### `self_bond_rewards` and `commission`
682
+
683
+ Both fields are arrays of coin amounts with high-precision decimal values:
684
+
685
+ | Field | Description |
686
+ | ------ | ------------------------------------------------------------- |
687
+ | denom | Token denomination |
688
+ | amount | High-precision accumulated amount including decimal remainder |
689
+
690
+ > For this validator: ~744,261 ZIG in self-bond rewards and ~221,589 ZIG in commission are outstanding — both reflecting a high-activity top validator on ZigChain testnet.
691
+
692
+ ### Total Validator Earnings Breakdown
693
+
694
+ | Source | Field | Description |
695
+ | ----------------- | ------------------ | ---------------------------------------- |
696
+ | Own stake rewards | self_bond_rewards | Earned as a delegator on own validator |
697
+ | Commission | commission | Earned as a percentage of delegator rewards |
698
+
699
+ ## When to Use
700
+
701
+ * Validator dashboards showing total pending earnings in one call
702
+ * Comparing validator self-bond rewards vs commission income
703
+ * Calculating total validator revenue for analytics
704
+ ---
705
+
706
+ # 🔟 fetchValidatorOutstandingRewards
707
+
708
+ ## Method
709
+
710
+ ```ts
711
+ async fetchValidatorOutstandingRewards(validator: string)
712
+ ```
713
+
714
+ ## CLI Equivalent
715
+
716
+ ```bash
717
+ zigchaind query distribution validator-outstanding-rewards <validator-address>
718
+ ```
719
+
720
+ ---
721
+
722
+ ## Description
723
+
724
+ Fetches the **total outstanding rewards** for a validator — the sum of all unwithdrawn rewards across all delegations to that validator, plus the validator's own pending commission and self-bond rewards.
725
+
726
+ This represents the complete pool of rewards sitting in the distribution module that are attributable to this validator, across every participant who has not yet withdrawn.
727
+
728
+ ---
729
+
730
+ ## Parameters
731
+
732
+ | Name | Type | Description |
733
+ | --------- | ------ | ----------------------------------------------------- |
734
+ | validator | string | Validator operator address (`zigvaloper...`) to query |
735
+
736
+ ---
737
+
738
+ ## Usage Example
739
+
740
+ ```ts
741
+ const outstanding = await distributionApi.fetchValidatorOutstandingRewards(validator)
742
+ console.dir(outstanding, { depth: null })
743
+ ```
744
+
745
+ ## Example Response
746
+
747
+ ```json
748
+ {
749
+ "rewards": {
750
+ "rewards": [
751
+ {
752
+ "denom": "uzig",
753
+ "amount": "985083471414.779638309606269193"
754
+ }
755
+ ]
756
+ }
757
+ }
758
+ ```
759
+
760
+ ## Response Field Explanation
761
+
762
+ ### `rewards.rewards`
763
+
764
+ Array of total outstanding reward amounts across all delegations to this validator.
765
+
766
+ | Field | Description |
767
+ | ------ | --------------------------------------------------------------------------------- |
768
+ | denom | Token denomination |
769
+ | amount | Total unwithdrawn rewards attributable to this validator, with high-precision decimals |
770
+
771
+
772
+ ---