@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/slashing.md CHANGED
@@ -1,11 +1,65 @@
1
1
  # Slashing Module
2
2
 
3
- The **ChainSlashingApi** lets you query slashing-related data.
4
- It is used to fetch **slashing parameters** and **validator signing information**, which helps track validator uptime and potential slashing conditions.
3
+ ## What is the Slashing Module?
4
+
5
+ The **Slashing module** enforces validator accountability.
6
+
7
+ It penalizes validators for:
8
+
9
+ * Double-signing blocks
10
+ * Missing too many blocks (downtime)
11
+
12
+ Penalties may include:
13
+
14
+ * Token slashing (stake reduction)
15
+ * Temporary jailing
16
+ * Permanent tombstoning (for double-signing)
17
+
18
+ This module ensures network security and validator reliability.
19
+
20
+ ---
21
+
22
+ # Important Terminology
23
+
24
+ ### Validator Consensus Address (`valcons`)
25
+
26
+ A special validator address used for consensus-level operations.
27
+
28
+ Example:
29
+
30
+ ```text
31
+ zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47
32
+ ```
33
+
34
+ Used when querying signing information.
35
+
36
+ ---
37
+
38
+ ### Signed Blocks Window
39
+
40
+ Number of recent blocks tracked for validator uptime.
41
+
42
+ ---
43
+
44
+ ### Missed Blocks Counter
45
+
46
+ Number of missed blocks within the tracking window.
47
+
48
+ ---
49
+
50
+ ### Tombstoned
51
+
52
+ If `true`, the validator permanently double-signed and can never rejoin the validator set.
5
53
 
6
54
  ---
7
55
 
8
- ## Setup
56
+ ### Jail
57
+
58
+ Temporary removal from the validator set due to downtime.
59
+
60
+ ---
61
+
62
+ # Setup
9
63
 
10
64
  ```ts
11
65
  import {
@@ -20,120 +74,214 @@ const slashingApi = new ChainSlashingApi(endpoints)
20
74
 
21
75
  ---
22
76
 
23
- ## `fetchParams`
77
+ # 1️⃣ fetchParams
24
78
 
25
- Fetch the **slashing module parameters**.
79
+ ## Method
80
+
81
+ ```ts
82
+ async fetchParams()
83
+ ```
26
84
 
27
- **CLI equivalent**
85
+ ## CLI Equivalent
28
86
 
29
87
  ```bash
30
88
  zigchaind query slashing params
31
89
  ```
32
90
 
33
- **Method**
91
+ ## Description
34
92
 
35
- ```ts
36
- fetchParams()
37
- ```
93
+ Fetches the **slashing module parameters** that define:
94
+
95
+ * Uptime requirements
96
+ * Jail duration
97
+ * Slashing percentages
98
+
99
+ ## Parameters
100
+
101
+ None.
38
102
 
39
- **Example**
103
+ ## Usage Example
40
104
 
41
105
  ```ts
42
106
  const params = await slashingApi.fetchParams()
43
107
  console.dir(params, { depth: null })
44
108
  ```
45
109
 
110
+ ## Example Response
111
+
112
+ ```json
113
+ {
114
+ "params": {
115
+ "signed_blocks_window": "35000",
116
+ "min_signed_per_window": "0.800000000000000000",
117
+ "downtime_jail_duration": "600s",
118
+ "slash_fraction_double_sign": "0.000500000000000000",
119
+ "slash_fraction_downtime": "0.000100000000000000"
120
+ }
121
+ }
122
+ ```
123
+
124
+ ## Response Field Explanation
125
+
126
+ | Field | Description |
127
+ | -------------------------- | ------------------------------------------------ |
128
+ | signed_blocks_window | Number of blocks tracked for validator uptime |
129
+ | min_signed_per_window | Minimum percentage of blocks that must be signed |
130
+ | downtime_jail_duration | Time a validator remains jailed for downtime |
131
+ | slash_fraction_double_sign | Percentage slashed for double-signing |
132
+ | slash_fraction_downtime | Percentage slashed for excessive downtime |
133
+
134
+ ### Example Interpretation
135
+
136
+ ```text
137
+ min_signed_per_window = 0.8 → validator must sign 80% of 35,000 blocks
138
+ downtime_jail_duration = 600s → jailed for 10 minutes
139
+ ```
140
+
46
141
  ---
47
142
 
48
- ## `fetchSigningInfos`
143
+ # 2️⃣ fetchSigningInfos
49
144
 
50
- Fetch **signing information for all validators**.
51
- This includes missed blocks, start height, and jail status.
145
+ ## Method
146
+
147
+ ```ts
148
+ async fetchSigningInfos()
149
+ ```
52
150
 
53
- **CLI equivalent**
151
+ ## CLI Equivalent
54
152
 
55
153
  ```bash
56
154
  zigchaind query slashing signing-infos
57
155
  ```
58
156
 
59
- **Method**
157
+ ## Description
60
158
 
61
- ```ts
62
- fetchSigningInfos()
63
- ```
159
+ Fetches **signing information for all validators**.
160
+
161
+ Includes:
162
+
163
+ * Start height
164
+ * Jail status
165
+ * Missed block count
166
+ * Tombstone status
167
+
168
+ ## Parameters
64
169
 
65
- **Example**
170
+ None.
171
+
172
+ ## Usage Example
66
173
 
67
174
  ```ts
68
175
  const infos = await slashingApi.fetchSigningInfos()
69
176
  console.log(infos)
70
177
  ```
71
178
 
179
+ ## Example Response (Truncated)
180
+
181
+ ```json
182
+ {
183
+ "info": [
184
+ {
185
+ "address": "zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47",
186
+ "start_height": "3909190",
187
+ "index_offset": "724541",
188
+ "jailed_until": "1970-01-01T00:00:00Z",
189
+ "tombstoned": false,
190
+ "missed_blocks_counter": "0"
191
+ }
192
+ ],
193
+ "pagination": {
194
+ "next_key": null,
195
+ "total": "8"
196
+ }
197
+ }
198
+ ```
199
+
72
200
  ---
73
201
 
74
- ## `fetchSigningInfo`
202
+ ## Signing Info Field Explanation
75
203
 
76
- Fetch **signing information for a specific validator** using its **consensus address**.
204
+ | Field | Description |
205
+ | --------------------- | ----------------------------------- |
206
+ | address | Validator consensus address |
207
+ | start_height | Block height when tracking started |
208
+ | index_offset | Internal block tracking offset |
209
+ | jailed_until | Timestamp until validator is jailed |
210
+ | tombstoned | Permanent ban indicator |
211
+ | missed_blocks_counter | Number of missed blocks |
77
212
 
78
- **CLI equivalent**
213
+ ### Jail Status Interpretation
79
214
 
80
- ```bash
81
- zigchaind query slashing signing-info <valcons-address>
215
+ If:
216
+
217
+ ```text
218
+ jailed_until = 1970-01-01T00:00:00Z
82
219
  ```
83
220
 
84
- **Method**
221
+ The validator is **not currently jailed**.
85
222
 
86
- ```ts
87
- fetchSigningInfo(valConsAddress: string)
88
- ```
223
+ If the timestamp is in the future → validator is jailed.
224
+
225
+ ---
89
226
 
90
- **Example**
227
+ # 3️⃣ fetchSigningInfo
228
+
229
+ ## Method
91
230
 
92
231
  ```ts
93
- const signingInfo = await slashingApi.fetchSigningInfo(
94
- 'zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47'
95
- )
232
+ async fetchSigningInfo(valConsAddress: string)
233
+ ```
234
+
235
+ ## CLI Equivalent
96
236
 
97
- console.dir(signingInfo, { depth: null })
237
+ ```bash
238
+ zigchaind query slashing signing-info <valcons-address>
98
239
  ```
99
240
 
100
- ---
241
+ ## Description
101
242
 
102
- ## Example (Full)
243
+ Fetches signing information for a **specific validator** using its consensus address.
103
244
 
104
- ```ts
105
- import {
106
- ChainSlashingApi,
107
- getNetworkEndpoints,
108
- Network
109
- } from '@zuhaibnoor/zigchain-sdk'
245
+ ## Parameters
246
+
247
+ | Parameter | Type | Description |
248
+ | -------------- | ------ | --------------------------------------- |
249
+ | valConsAddress | string | Validator consensus (`valcons`) address |
110
250
 
111
- async function main() {
112
- const endpoints = getNetworkEndpoints(Network.Testnet)
113
- const slashingApi = new ChainSlashingApi(endpoints)
251
+ ## Usage Example
114
252
 
115
- console.log('--- Slashing Params ---')
116
- const params = await slashingApi.fetchParams()
117
- console.dir(params, { depth: null })
253
+ ```ts
254
+ const singleInfo = await slashingApi.fetchSigningInfo(
255
+ 'zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47'
256
+ )
118
257
 
119
- console.log('\n--- All Signing Infos ---')
120
- const infos = await slashingApi.fetchSigningInfos()
121
- console.log(infos)
258
+ console.dir(singleInfo, { depth: null })
259
+ ```
122
260
 
123
- console.log('\n--- Single Signing Info ---')
124
- const singleInfo = await slashingApi.fetchSigningInfo(
125
- 'zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47'
126
- )
127
- console.dir(singleInfo, { depth: null })
261
+ ## Example Response
262
+
263
+ ```json
264
+ {
265
+ "val_signing_info": {
266
+ "address": "zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47",
267
+ "start_height": "3909190",
268
+ "index_offset": "724541",
269
+ "jailed_until": "1970-01-01T00:00:00Z",
270
+ "tombstoned": false,
271
+ "missed_blocks_counter": "0"
272
+ }
128
273
  }
129
-
130
- main()
131
274
  ```
132
275
 
133
276
  ---
134
277
 
135
- ## Notes
278
+ # Summary
136
279
 
137
- * Slashing queries are **read-only** and require no wallet.
138
- * All slashing queries are performed via **LCD endpoints**.
280
+ | Function | CLI Equivalent | Purpose |
281
+ | --------------------- | ------------------------------------------------- | --------------------------------------- |
282
+ | `fetchParams()` | `zigchaind query slashing params` | Returns slashing configuration |
283
+ | `fetchSigningInfos()` | `zigchaind query slashing signing-infos` | Returns signing info for all validators |
284
+ | `fetchSigningInfo()` | `zigchaind query slashing signing-info <valcons>` | Returns signing info for one validator |
285
+
286
+ ---
139
287