@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.
- package/README.md +1 -1
- package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
- package/dist/circuit/ChainCircuitApi.js.map +1 -1
- package/dist/dex/ChainDexApi.d.ts.map +1 -1
- package/dist/dex/ChainDexApi.js.map +1 -1
- package/dist/distribution/ChainDistributionApi.d.ts.map +1 -1
- package/dist/distribution/ChainDistributionApi.js +0 -1
- package/dist/distribution/ChainDistributionApi.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/staking/ChainStakingApi.d.ts +1 -5
- package/dist/staking/ChainStakingApi.d.ts.map +1 -1
- package/dist/staking/ChainStakingApi.js +9 -7
- package/dist/staking/ChainStakingApi.js.map +1 -1
- package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -1
- package/dist/validator-set/ChainValidator.d.ts +8 -0
- package/dist/validator-set/ChainValidator.d.ts.map +1 -0
- package/dist/validator-set/ChainValidator.js +15 -0
- package/dist/validator-set/ChainValidator.js.map +1 -0
- package/docs/block.md +325 -38
- package/docs/circuit.md +164 -35
- package/docs/dex.md +313 -63
- package/docs/distribution.md +664 -93
- package/docs/evidence.md +117 -122
- package/docs/factory.md +308 -62
- package/docs/gov.md +268 -70
- package/docs/ibc/ibcChannel.md +736 -249
- package/docs/ibc/ibcClient.md +608 -139
- package/docs/ibc-transfer.md +349 -90
- package/docs/interchain-accounts.md +151 -48
- package/docs/mint.md +173 -36
- package/docs/runtime.md +81 -42
- package/docs/slashing.md +209 -61
- package/docs/staking.md +534 -411
- package/docs/tokenwrapper.md +221 -64
- package/docs/txs.md +447 -0
- package/docs/upgrade.md +281 -58
- package/docs/validator-set.md +177 -0
- package/package.json +1 -1
- package/docs/comet-validator-set.md +0 -70
package/docs/staking.md
CHANGED
|
@@ -1,633 +1,756 @@
|
|
|
1
|
-
#
|
|
1
|
+
# STAKING Module
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## What is STAKING?
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Staking** in the Cosmos ecosystem (including **ZigChain**) allows token holders to:
|
|
6
6
|
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Delegate tokens to validators
|
|
8
|
+
* Earn rewards
|
|
9
|
+
* Participate in network security
|
|
10
10
|
|
|
11
|
-
The
|
|
11
|
+
The staking module tracks delegations, validators, and staking parameters.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
# Important Terminology
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
ChainStakingApi,
|
|
20
|
-
getNetworkEndpoints,
|
|
21
|
-
Network,
|
|
22
|
-
} from '@zuhaibnoor/zigchain-sdk'
|
|
23
|
-
|
|
24
|
-
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
25
|
-
const stakingApi = new ChainStakingApi(endpoints)
|
|
26
|
-
```
|
|
17
|
+
### Delegator
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## `fetchDelegation`
|
|
19
|
+
A user who locks tokens by delegating to a validator.
|
|
31
20
|
|
|
32
|
-
|
|
21
|
+
### Validator
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
* one **validator**
|
|
23
|
+
An entity responsible for validating blocks.
|
|
36
24
|
|
|
37
|
-
|
|
25
|
+
### Delegation
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
* shares
|
|
41
|
-
* delegation status
|
|
27
|
+
Tokens staked by a delegator to a validator.
|
|
42
28
|
|
|
43
|
-
|
|
29
|
+
### Shares
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
* Showing detailed info for one delegation
|
|
31
|
+
Proportional representation of a delegator’s stake in the validator.
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
---
|
|
49
34
|
|
|
50
|
-
|
|
51
|
-
zigchaind query staking delegation <delegator> <validator>
|
|
52
|
-
```
|
|
35
|
+
# Functions Documentation
|
|
53
36
|
|
|
54
|
-
|
|
37
|
+
Setup:
|
|
55
38
|
|
|
56
39
|
```ts
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
**Example**
|
|
40
|
+
import {
|
|
41
|
+
ChainStakingApi,
|
|
42
|
+
getNetworkEndpoints,
|
|
43
|
+
Network
|
|
44
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
64
45
|
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
delegatorAddr,
|
|
68
|
-
validatorAddr
|
|
69
|
-
)
|
|
46
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
47
|
+
const stakingApi = new ChainStakingApi(endpoints)
|
|
70
48
|
|
|
71
|
-
|
|
49
|
+
const delegator = 'zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6'
|
|
50
|
+
const validator = 'zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr'
|
|
72
51
|
```
|
|
73
52
|
|
|
74
53
|
---
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Fetch **all delegations made by a delegator** across **all validators**.
|
|
79
|
-
|
|
80
|
-
This returns a **list**, not a single delegation.
|
|
55
|
+
# 1️⃣ fetchDelegations
|
|
81
56
|
|
|
82
|
-
|
|
57
|
+
## Method
|
|
83
58
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
**Difference from `fetchDelegation`**
|
|
89
|
-
|
|
90
|
-
* `fetchDelegation` → one validator
|
|
91
|
-
* `fetchDelegations` → all validators
|
|
59
|
+
```ts
|
|
60
|
+
async fetchDelegations(delegatorAddress: string)
|
|
61
|
+
```
|
|
92
62
|
|
|
93
|
-
|
|
63
|
+
## CLI Equivalent
|
|
94
64
|
|
|
95
65
|
```bash
|
|
96
66
|
zigchaind query staking delegations <delegator>
|
|
97
67
|
```
|
|
98
68
|
|
|
99
|
-
|
|
69
|
+
## Description
|
|
100
70
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
71
|
+
Query all delegations made by a delegator.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Parameters
|
|
75
|
+
|
|
76
|
+
| Name | Type | Description |
|
|
77
|
+
| ---------------- | ------ | ------------------------------- |
|
|
78
|
+
| delegatorAddress | string | Bech32 address of the delegator |
|
|
104
79
|
|
|
105
|
-
|
|
80
|
+
## Usage Example
|
|
106
81
|
|
|
107
82
|
```ts
|
|
108
|
-
const delegations = await stakingApi.fetchDelegations(
|
|
83
|
+
const delegations = await stakingApi.fetchDelegations(delegator)
|
|
109
84
|
console.dir(delegations, { depth: null })
|
|
110
85
|
```
|
|
111
86
|
|
|
112
|
-
---
|
|
113
87
|
|
|
114
|
-
## `fetchValidatorDelegations`
|
|
115
88
|
|
|
116
|
-
|
|
89
|
+
## Example Response
|
|
117
90
|
|
|
118
|
-
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"delegation_responses": [
|
|
94
|
+
{
|
|
95
|
+
"delegation": {
|
|
96
|
+
"delegator_address": "zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6",
|
|
97
|
+
"validator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
98
|
+
"shares": "1500000.000000000000000000"
|
|
99
|
+
},
|
|
100
|
+
"balance": { "denom": "uzig", "amount": "1500000" }
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"pagination": { "next_key": null, "total": "1" }
|
|
104
|
+
}
|
|
105
|
+
```
|
|
119
106
|
|
|
120
|
-
|
|
107
|
+
---
|
|
121
108
|
|
|
122
|
-
|
|
123
|
-
* Showing who has delegated to a validator
|
|
124
|
-
* Calculating validator voting power
|
|
109
|
+
## Response Field Explanation
|
|
125
110
|
|
|
126
|
-
|
|
111
|
+
| Field | Description |
|
|
112
|
+
| ---------------------------- | -------------------------------------- |
|
|
113
|
+
| delegation_responses | Array of delegations for the delegator |
|
|
114
|
+
| delegation.delegator_address | Address of the delegator |
|
|
115
|
+
| delegation.validator_address | Address of the validator |
|
|
116
|
+
| delegation.shares | Delegation shares |
|
|
117
|
+
| balance.denom | Token denomination (`uzig`) |
|
|
118
|
+
| balance.amount | Delegated amount in smallest unit |
|
|
119
|
+
| pagination.next_key | Key for next page (null if none) |
|
|
120
|
+
| pagination.total | Total delegations |
|
|
127
121
|
|
|
128
|
-
|
|
129
|
-
* `fetchValidatorDelegations` → validator → delegators
|
|
122
|
+
---
|
|
130
123
|
|
|
131
|
-
|
|
124
|
+
# 2️⃣ fetchDelegation
|
|
132
125
|
|
|
133
|
-
|
|
134
|
-
zigchaind query staking delegations-to <validator>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Method**
|
|
126
|
+
## Method
|
|
138
127
|
|
|
139
128
|
```ts
|
|
140
|
-
|
|
129
|
+
async fetchDelegation(delegatorAddress: string, validatorAddress: string)
|
|
141
130
|
```
|
|
142
131
|
|
|
143
|
-
|
|
132
|
+
## CLI Equivalent
|
|
144
133
|
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
await stakingApi.fetchValidatorDelegations(validatorAddr)
|
|
148
|
-
|
|
149
|
-
console.dir(validatorDelegations, { depth: null })
|
|
134
|
+
```bash
|
|
135
|
+
zigchaind query staking delegation <delegator> <validator>
|
|
150
136
|
```
|
|
151
137
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## `fetchDelegatorValidator`
|
|
138
|
+
## Description
|
|
155
139
|
|
|
156
|
-
|
|
140
|
+
Query a **single delegation** from a delegator to a specific validator.
|
|
157
141
|
|
|
158
|
-
|
|
142
|
+
## Parameters
|
|
159
143
|
|
|
160
|
-
|
|
161
|
-
|
|
144
|
+
| Name | Type | Description |
|
|
145
|
+
| ---------------- | ------ | ------------------------------- |
|
|
146
|
+
| delegatorAddress | string | Bech32 address of the delegator |
|
|
147
|
+
| validatorAddress | string | Bech32 address of the validator |
|
|
162
148
|
|
|
163
|
-
|
|
164
|
-
this method focuses on **validator details**, not delegation amounts.
|
|
149
|
+
## Usage Example
|
|
165
150
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* UI flows that depend on validator state
|
|
171
|
-
|
|
172
|
-
**Difference from `fetchDelegation`**
|
|
151
|
+
```ts
|
|
152
|
+
const delegation = await stakingApi.fetchDelegation(delegator, validator)
|
|
153
|
+
console.dir(delegation, { depth: null })
|
|
154
|
+
```
|
|
173
155
|
|
|
174
|
-
|
|
175
|
-
|
|
156
|
+
## Example Response
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"validator": {
|
|
161
|
+
"operator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
162
|
+
"consensus_pubkey": {
|
|
163
|
+
"@type": "/cosmos.crypto.ed25519.PubKey",
|
|
164
|
+
"key": "qLwYZi8Sm9IUvjoa48+sS9Sqata0Lm2r9QhjesO+6ZI="
|
|
165
|
+
},
|
|
166
|
+
"jailed": false,
|
|
167
|
+
"status": "BOND_STATUS_UNBONDED",
|
|
168
|
+
"tokens": "1501000",
|
|
169
|
+
"delegator_shares": "1501000.000000000000000000",
|
|
170
|
+
"description": {
|
|
171
|
+
"moniker": "testnet-validator-multisig",
|
|
172
|
+
"identity": "",
|
|
173
|
+
"website": "https://testnet-validator.example.com",
|
|
174
|
+
"security_contact": "security@example.com",
|
|
175
|
+
"details": "Multi-sig test: Updated validator description"
|
|
176
|
+
},
|
|
177
|
+
"unbonding_height": "0",
|
|
178
|
+
"unbonding_time": "1970-01-01T00:00:00Z",
|
|
179
|
+
"commission": {
|
|
180
|
+
"commission_rates": {
|
|
181
|
+
"rate": "0.100000000000000000",
|
|
182
|
+
"max_rate": "0.200000000000000000",
|
|
183
|
+
"max_change_rate": "0.010000000000000000"
|
|
184
|
+
},
|
|
185
|
+
"update_time": "2025-12-03T07:13:59.701638398Z"
|
|
186
|
+
},
|
|
187
|
+
"min_self_delegation": "1",
|
|
188
|
+
"unbonding_on_hold_ref_count": "0",
|
|
189
|
+
"unbonding_ids": []
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Response Field Explanation
|
|
195
|
+
|
|
196
|
+
| Field | Description |
|
|
197
|
+
| ----------------------------------------------------- | ----------------------------------- |
|
|
198
|
+
| validator.operator_address | Validator operator address |
|
|
199
|
+
| validator.consensus_pubkey.@type | Public key type |
|
|
200
|
+
| validator.consensus_pubkey.key | Base64-encoded validator public key |
|
|
201
|
+
| validator.jailed | Whether validator is jailed |
|
|
202
|
+
| validator.status | Bond status |
|
|
203
|
+
| validator.tokens | Total tokens for validator |
|
|
204
|
+
| validator.delegator_shares | Delegator’s share in validator |
|
|
205
|
+
| validator.description.moniker | Validator display name |
|
|
206
|
+
| validator.description.identity | Identity field |
|
|
207
|
+
| validator.description.website | Validator website |
|
|
208
|
+
| validator.description.security_contact | Security contact |
|
|
209
|
+
| validator.description.details | Extra description |
|
|
210
|
+
| validator.unbonding_height | Unbonding start height |
|
|
211
|
+
| validator.unbonding_time | Unbonding start time |
|
|
212
|
+
| validator.commission.commission_rates.rate | Current commission rate |
|
|
213
|
+
| validator.commission.commission_rates.max_rate | Max commission rate |
|
|
214
|
+
| validator.commission.commission_rates.max_change_rate | Max change per update |
|
|
215
|
+
| validator.commission.update_time | Last commission update timestamp |
|
|
216
|
+
| validator.min_self_delegation | Minimum self-delegation required |
|
|
217
|
+
| validator.unbonding_on_hold_ref_count | Counter for unbonding references |
|
|
218
|
+
| validator.unbonding_ids | Array of unbonding IDs |
|
|
176
219
|
|
|
177
|
-
|
|
220
|
+
---
|
|
178
221
|
|
|
179
|
-
|
|
180
|
-
zigchaind query staking delegator-validator <delegator> <validator>
|
|
181
|
-
```
|
|
222
|
+
# 3️⃣ fetchValidatorDelegations
|
|
182
223
|
|
|
183
|
-
|
|
224
|
+
## Method
|
|
184
225
|
|
|
185
226
|
```ts
|
|
186
|
-
|
|
187
|
-
delegatorAddress: string,
|
|
188
|
-
validatorAddress: string
|
|
189
|
-
)
|
|
227
|
+
async fetchValidatorDelegations(validator_addr: string)
|
|
190
228
|
```
|
|
191
229
|
|
|
192
|
-
|
|
230
|
+
## CLI Equivalent
|
|
193
231
|
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
await stakingApi.fetchDelegatorValidator(
|
|
197
|
-
delegatorAddr,
|
|
198
|
-
validatorAddr
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
console.dir(validatorInfo, { depth: null })
|
|
232
|
+
```bash
|
|
233
|
+
zigchaind query staking delegations-to <validator>
|
|
202
234
|
```
|
|
203
235
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
## `fetchDelegatorValidators`
|
|
236
|
+
## Description
|
|
207
237
|
|
|
208
|
-
Fetch
|
|
238
|
+
Fetch all delegations to a specific validator.
|
|
209
239
|
|
|
210
|
-
|
|
240
|
+
## Parameters
|
|
211
241
|
|
|
212
|
-
|
|
242
|
+
| Name | Type | Description |
|
|
243
|
+
| -------------- | ------ | ------------------------------- |
|
|
244
|
+
| validator_addr | string | Bech32 address of the validator |
|
|
213
245
|
|
|
214
|
-
|
|
215
|
-
* It answers *“Which validators am I connected to?”* rather than *“How much did I stake?”*
|
|
246
|
+
## Usage Example
|
|
216
247
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
248
|
+
```ts
|
|
249
|
+
const valDelegations = await stakingApi.fetchValidatorDelegations(validator)
|
|
250
|
+
console.dir(valDelegations, { depth: null })
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Example Response
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"delegation_responses": [
|
|
258
|
+
{
|
|
259
|
+
"delegation": {
|
|
260
|
+
"delegator_address": "zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6",
|
|
261
|
+
"validator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
262
|
+
"shares": "1500000.000000000000000000"
|
|
263
|
+
},
|
|
264
|
+
"balance": { "denom": "uzig", "amount": "1500000" }
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"delegation": {
|
|
268
|
+
"delegator_address": "zig1zxxkdjzsvtu7zgnu04wvlvq9umhl4rgcq83cyl",
|
|
269
|
+
"validator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
270
|
+
"shares": "1000.000000000000000000"
|
|
271
|
+
},
|
|
272
|
+
"balance": { "denom": "uzig", "amount": "1000" }
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"pagination": { "next_key": null, "total": "2" }
|
|
276
|
+
}
|
|
277
|
+
```
|
|
222
278
|
|
|
223
|
-
|
|
279
|
+
---
|
|
224
280
|
|
|
225
|
-
|
|
226
|
-
* `fetchDelegatorValidators` → validator identities & status
|
|
281
|
+
# 4️⃣ fetchDelegatorValidator
|
|
227
282
|
|
|
228
|
-
|
|
283
|
+
## Method
|
|
229
284
|
|
|
230
|
-
```
|
|
231
|
-
|
|
285
|
+
```ts
|
|
286
|
+
async fetchDelegatorValidator(delegatorAddress: string, validatorAddress: string)
|
|
232
287
|
```
|
|
233
288
|
|
|
234
|
-
|
|
289
|
+
## CLI Equivalent
|
|
235
290
|
|
|
236
|
-
```
|
|
237
|
-
|
|
291
|
+
```bash
|
|
292
|
+
zigchaind query staking delegator-validator <delegator> <validator>
|
|
238
293
|
```
|
|
239
294
|
|
|
240
|
-
|
|
295
|
+
## Description
|
|
241
296
|
|
|
242
|
-
|
|
243
|
-
const validators =
|
|
244
|
-
await stakingApi.fetchDelegatorValidators(delegatorAddr)
|
|
297
|
+
Query validator info for a specific delegator-validator pair.
|
|
245
298
|
|
|
246
|
-
|
|
247
|
-
```
|
|
299
|
+
## Parameters
|
|
248
300
|
|
|
249
|
-
|
|
301
|
+
| Name | Type | Description |
|
|
302
|
+
| ---------------- | ------ | ------------------------ |
|
|
303
|
+
| delegatorAddress | string | Bech32 delegator address |
|
|
304
|
+
| validatorAddress | string | Bech32 validator address |
|
|
250
305
|
|
|
251
|
-
##
|
|
306
|
+
## Usage Example
|
|
252
307
|
|
|
253
|
-
|
|
308
|
+
```ts
|
|
309
|
+
const delegatorValidator = await stakingApi.fetchDelegatorValidator(delegator, validator)
|
|
310
|
+
console.dir(delegatorValidator, { depth: null })
|
|
311
|
+
```
|
|
254
312
|
|
|
255
|
-
|
|
313
|
+
## Example Response
|
|
256
314
|
|
|
257
|
-
*
|
|
258
|
-
* total voting power
|
|
259
|
-
* staking-related metadata
|
|
315
|
+
*(Same as `fetchDelegation` — returns validator object.)*
|
|
260
316
|
|
|
261
|
-
|
|
317
|
+
---
|
|
262
318
|
|
|
263
|
-
|
|
319
|
+
# 5️⃣ fetchDelegatorValidators
|
|
264
320
|
|
|
265
|
-
|
|
266
|
-
* Replaying chain state for historical research
|
|
267
|
-
* Governance or slashing investigations
|
|
321
|
+
## Method
|
|
268
322
|
|
|
269
|
-
|
|
323
|
+
```ts
|
|
324
|
+
async fetchDelegatorValidators(delegatorAddress: string)
|
|
325
|
+
```
|
|
270
326
|
|
|
271
|
-
|
|
327
|
+
## CLI Equivalent
|
|
272
328
|
|
|
273
329
|
```bash
|
|
274
|
-
zigchaind query staking
|
|
330
|
+
zigchaind query staking delegator-validators <delegator>
|
|
275
331
|
```
|
|
276
332
|
|
|
277
|
-
|
|
333
|
+
## Description
|
|
278
334
|
|
|
279
|
-
|
|
280
|
-
fetchHistoricalInfo(height: number | string)
|
|
281
|
-
```
|
|
335
|
+
Fetch info of **all validators** a delegator has delegated to.
|
|
282
336
|
|
|
283
|
-
|
|
337
|
+
## Parameters
|
|
284
338
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
```
|
|
339
|
+
| Name | Type | Description |
|
|
340
|
+
| ---------------- | ------ | ------------------------ |
|
|
341
|
+
| delegatorAddress | string | Bech32 delegator address |
|
|
289
342
|
|
|
290
343
|
---
|
|
291
344
|
|
|
292
|
-
##
|
|
345
|
+
## Usage Example
|
|
293
346
|
|
|
294
|
-
|
|
347
|
+
```ts
|
|
348
|
+
const delegatorValidators = await stakingApi.fetchDelegatorValidators(delegator)
|
|
349
|
+
console.dir(delegatorValidators, { depth: null })
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Example Response
|
|
353
|
+
|
|
354
|
+
```json
|
|
355
|
+
{
|
|
356
|
+
"validators": [
|
|
357
|
+
{
|
|
358
|
+
"operator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
359
|
+
"consensus_pubkey": { "@type": "/cosmos.crypto.ed25519.PubKey", "key": "qLwYZi8Sm9IUvjoa48+sS9Sqata0Lm2r9QhjesO+6ZI=" },
|
|
360
|
+
"jailed": false,
|
|
361
|
+
"status": "BOND_STATUS_UNBONDED",
|
|
362
|
+
"tokens": "1501000",
|
|
363
|
+
"delegator_shares": "1501000.000000000000000000",
|
|
364
|
+
"description": { "moniker": "testnet-validator-multisig", "identity": "", "website": "https://testnet-validator.example.com", "security_contact": "security@example.com", "details": "Multi-sig test: Updated validator description" },
|
|
365
|
+
"unbonding_height": "0",
|
|
366
|
+
"unbonding_time": "1970-01-01T00:00:00Z",
|
|
367
|
+
"commission": { "commission_rates": { "rate": "0.100000000000000000", "max_rate": "0.200000000000000000", "max_change_rate": "0.010000000000000000" }, "update_time": "2025-12-03T07:13:59.701638398Z" },
|
|
368
|
+
"min_self_delegation": "1",
|
|
369
|
+
"unbonding_on_hold_ref_count": "0",
|
|
370
|
+
"unbonding_ids": []
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
"pagination": { "next_key": null, "total": "1" }
|
|
374
|
+
}
|
|
375
|
+
```
|
|
295
376
|
|
|
296
|
-
|
|
377
|
+
---
|
|
297
378
|
|
|
298
|
-
|
|
299
|
-
* maximum number of validators
|
|
300
|
-
* bond denomination
|
|
379
|
+
# 6️⃣ fetchStakingParams
|
|
301
380
|
|
|
302
|
-
|
|
381
|
+
## Method
|
|
303
382
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
383
|
+
```ts
|
|
384
|
+
async fetchStakingParams()
|
|
385
|
+
```
|
|
307
386
|
|
|
308
|
-
|
|
387
|
+
## CLI Equivalent
|
|
309
388
|
|
|
310
389
|
```bash
|
|
311
390
|
zigchaind query staking params
|
|
312
391
|
```
|
|
313
392
|
|
|
314
|
-
|
|
393
|
+
## Description
|
|
315
394
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
395
|
+
Fetches chain-level **staking module parameters**.
|
|
396
|
+
|
|
397
|
+
## Parameters
|
|
398
|
+
|
|
399
|
+
None.
|
|
319
400
|
|
|
320
|
-
|
|
401
|
+
## Usage Example
|
|
321
402
|
|
|
322
403
|
```ts
|
|
323
404
|
const params = await stakingApi.fetchStakingParams()
|
|
324
405
|
console.dir(params, { depth: null })
|
|
325
406
|
```
|
|
326
407
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
## `fetchStakingPool`
|
|
330
|
-
|
|
331
|
-
Fetch the **current staking pool state**.
|
|
408
|
+
## Example Response
|
|
332
409
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
410
|
+
```json
|
|
411
|
+
{
|
|
412
|
+
"params": {
|
|
413
|
+
"unbonding_time": "604800s",
|
|
414
|
+
"max_validators": 8,
|
|
415
|
+
"max_entries": 8,
|
|
416
|
+
"historical_entries": 10000,
|
|
417
|
+
"bond_denom": "uzig",
|
|
418
|
+
"min_commission_rate": "0.000000000000000000"
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
```
|
|
337
422
|
|
|
338
|
-
|
|
423
|
+
## Response Field Explanation
|
|
339
424
|
|
|
340
|
-
|
|
425
|
+
| Field | Description |
|
|
426
|
+
| ------------------- | --------------------------------------------- |
|
|
427
|
+
| unbonding_time | Duration tokens take to unbond |
|
|
428
|
+
| max_validators | Maximum validators allowed |
|
|
429
|
+
| max_entries | Max unbonding entries per delegator |
|
|
430
|
+
| historical_entries | How many historical validator sets are stored |
|
|
431
|
+
| bond_denom | Token denomination used for staking |
|
|
432
|
+
| min_commission_rate | Minimum allowed validator commission |
|
|
341
433
|
|
|
342
|
-
|
|
343
|
-
* Calculating staking ratios
|
|
344
|
-
* Showing bonded vs unbonded supply
|
|
434
|
+
---
|
|
345
435
|
|
|
346
|
-
|
|
436
|
+
Here's batch 1 of the Staking module documentation:
|
|
347
437
|
|
|
348
|
-
|
|
349
|
-
* Pool → live staking state
|
|
438
|
+
---
|
|
350
439
|
|
|
351
|
-
**CLI equivalent**
|
|
352
440
|
|
|
353
|
-
|
|
354
|
-
zigchaind query staking pool
|
|
355
|
-
```
|
|
441
|
+
# fetchStakingPool
|
|
356
442
|
|
|
357
|
-
|
|
443
|
+
## Method
|
|
358
444
|
|
|
359
445
|
```ts
|
|
360
|
-
fetchStakingPool()
|
|
446
|
+
async fetchStakingPool()
|
|
361
447
|
```
|
|
362
448
|
|
|
363
|
-
|
|
449
|
+
## CLI Equivalent
|
|
364
450
|
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
console.dir(pool, { depth: null })
|
|
451
|
+
```bash
|
|
452
|
+
zigchaind query staking pool
|
|
368
453
|
```
|
|
369
454
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
## `fetchRedelegation`
|
|
373
|
-
|
|
374
|
-
Fetch **all redelegations initiated by a delegator**.
|
|
375
|
-
|
|
376
|
-
Redelegation allows moving stake from:
|
|
377
|
-
|
|
378
|
-
* one validator → another
|
|
379
|
-
* **without unbonding**
|
|
380
|
-
|
|
381
|
-
This endpoint returns **ongoing and completed redelegations** for a delegator.
|
|
455
|
+
## Description
|
|
382
456
|
|
|
383
|
-
**
|
|
457
|
+
Fetches the **chain-wide staking pool** — the total accounting of all bonded and non-bonded tokens across every validator.
|
|
384
458
|
|
|
385
|
-
|
|
386
|
-
* Tracking in-progress redelegations
|
|
387
|
-
* Preventing invalid redelegation actions in UI
|
|
459
|
+
This gives a high-level view of how much of the total token supply is currently actively staked (securing consensus) versus sitting in unbonding or with inactive validators.
|
|
388
460
|
|
|
389
|
-
|
|
461
|
+
## Parameters
|
|
390
462
|
|
|
391
|
-
|
|
392
|
-
* Redelegation → stake movement between validators
|
|
463
|
+
None.
|
|
393
464
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
zigchaind query staking redelegations <delegator>
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
**Method**
|
|
465
|
+
## Usage Example
|
|
401
466
|
|
|
402
467
|
```ts
|
|
403
|
-
|
|
468
|
+
const pool = await stakingApi.fetchStakingPool()
|
|
469
|
+
console.dir(pool, { depth: null })
|
|
404
470
|
```
|
|
405
471
|
|
|
406
|
-
|
|
472
|
+
## Example Response
|
|
407
473
|
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
474
|
+
```json
|
|
475
|
+
{
|
|
476
|
+
"pool": {
|
|
477
|
+
"not_bonded_tokens": "108314438077",
|
|
478
|
+
"bonded_tokens": "101692473101453"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
413
481
|
```
|
|
414
482
|
|
|
415
|
-
|
|
483
|
+
## Response Field Explanation
|
|
416
484
|
|
|
417
|
-
|
|
418
|
-
These functions cover **unbonding flows and validator discovery**, which are the last big pieces users usually get confused about. I’ll document them *very clearly* and show how they differ from each other.
|
|
485
|
+
### `pool`
|
|
419
486
|
|
|
420
|
-
|
|
487
|
+
| Field | Description |
|
|
488
|
+
| ----------------- | ------------------------------------------------------------------------------- |
|
|
489
|
+
| bonded_tokens | Total `uzig` staked with validators in `BOND_STATUS_BONDED` (active set) |
|
|
490
|
+
| not_bonded_tokens | Total `uzig` held by unbonding or inactive (`BOND_STATUS_UNBONDED`) validators |
|
|
421
491
|
|
|
422
492
|
---
|
|
423
493
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
Fetch the **unbonding delegation between a specific delegator and validator**.
|
|
427
|
-
|
|
428
|
-
This shows stake that:
|
|
429
|
-
|
|
430
|
-
* has been undelegated
|
|
431
|
-
* is still in the **unbonding period**
|
|
432
|
-
* is **not yet liquid**
|
|
433
|
-
|
|
434
|
-
**What you get**
|
|
435
|
-
|
|
436
|
-
* balance currently unbonding
|
|
437
|
-
* completion time
|
|
438
|
-
* creation height
|
|
439
|
-
|
|
440
|
-
**When to use**
|
|
441
|
-
|
|
442
|
-
* Showing “pending unstake” information
|
|
443
|
-
* Tracking completion times in wallets
|
|
444
|
-
* Validator-level unbonding inspections
|
|
445
|
-
|
|
446
|
-
**Difference from other unbonding queries**
|
|
447
|
-
|
|
448
|
-
* This is **one delegator → one validator**
|
|
449
|
-
* Most granular unbonding query
|
|
450
|
-
|
|
451
|
-
**CLI equivalent**
|
|
452
|
-
|
|
453
|
-
```bash
|
|
454
|
-
zigchaind query staking unbonding-delegation <delegator> <validator>
|
|
455
|
-
```
|
|
494
|
+
# fetchRedelegation
|
|
456
495
|
|
|
457
|
-
|
|
496
|
+
## Method
|
|
458
497
|
|
|
459
498
|
```ts
|
|
460
|
-
|
|
499
|
+
async fetchRedelegation(delegator_addr: string)
|
|
461
500
|
```
|
|
462
501
|
|
|
463
|
-
|
|
502
|
+
## CLI Equivalent
|
|
464
503
|
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
await stakingApi.fetchUnbondingDelegation(delegator, validator)
|
|
468
|
-
|
|
469
|
-
console.dir(unbonding, { depth: null })
|
|
504
|
+
```bash
|
|
505
|
+
zigchaind query staking redelegation <delegator-address>
|
|
470
506
|
```
|
|
471
507
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
## `fetchUnbondingDelegations`
|
|
475
|
-
|
|
476
|
-
Fetch **all unbonding delegations for a delegator** across every validator.
|
|
508
|
+
## Description
|
|
477
509
|
|
|
478
|
-
|
|
510
|
+
Fetches all **active redelegations** for a specific delegator.
|
|
479
511
|
|
|
480
|
-
|
|
512
|
+
A redelegation represents stake that has been moved from one validator to another but has not yet completed its cooldown period. During this period the stake cannot be redelegated again — this prevents "redelegation hopping" attacks.
|
|
481
513
|
|
|
482
|
-
|
|
483
|
-
* Showing total pending unbonded stake
|
|
484
|
-
* Preventing double-unbonding actions
|
|
514
|
+
An empty `redelegation_responses` array means the delegator has no active redelegations in progress.
|
|
485
515
|
|
|
486
|
-
|
|
516
|
+
## Parameters
|
|
487
517
|
|
|
488
|
-
|
|
489
|
-
|
|
518
|
+
| Name | Type | Description |
|
|
519
|
+
| -------------- | ------ | ------------------------------------------------ |
|
|
520
|
+
| delegator_addr | string | Bech32 address of the delegator to query |
|
|
490
521
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
**CLI equivalent**
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
zigchaind query staking unbonding-delegations <delegator>
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
**Method**
|
|
522
|
+
## Usage Example
|
|
500
523
|
|
|
501
524
|
```ts
|
|
502
|
-
|
|
525
|
+
const redelegations = await stakingApi.fetchRedelegation(delegator)
|
|
526
|
+
console.dir(redelegations, { depth: null })
|
|
503
527
|
```
|
|
504
528
|
|
|
505
|
-
|
|
529
|
+
## Example Response
|
|
506
530
|
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"redelegation_responses": [],
|
|
534
|
+
"pagination": {
|
|
535
|
+
"next_key": null,
|
|
536
|
+
"total": "0"
|
|
537
|
+
}
|
|
538
|
+
}
|
|
512
539
|
```
|
|
513
540
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
## `fetchUnbondingDelegationsFrom`
|
|
541
|
+
## Response Field Explanation
|
|
517
542
|
|
|
518
|
-
|
|
543
|
+
### `redelegation_responses`
|
|
519
544
|
|
|
520
|
-
|
|
545
|
+
Array of active redelegation entries for this delegator. Empty if no redelegations are in progress.
|
|
521
546
|
|
|
522
|
-
|
|
547
|
+
If entries are present, each would contain:
|
|
523
548
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
549
|
+
| Field | Description |
|
|
550
|
+
| ---------------------------------- | ----------------------------------------------------- |
|
|
551
|
+
| redelegation.delegator_address | The delegator's address |
|
|
552
|
+
| redelegation.validator_src_address | Validator the stake is moving away from |
|
|
553
|
+
| redelegation.validator_dst_address | Validator the stake is moving toward |
|
|
554
|
+
| entries[].completion_time | When the redelegation cooldown ends |
|
|
555
|
+
| entries[].shares_dst | Amount of shares being redelegated |
|
|
556
|
+
| balance | Token amount being redelegated |
|
|
527
557
|
|
|
528
|
-
**Perspective**
|
|
529
558
|
|
|
530
|
-
* Delegator-focused → *who is unstaking*
|
|
531
|
-
* Validator-focused → *from where stake is leaving*
|
|
532
559
|
|
|
533
|
-
|
|
560
|
+
---
|
|
534
561
|
|
|
535
|
-
|
|
536
|
-
zigchaind query staking unbonding-delegations-from <validator>
|
|
537
|
-
```
|
|
562
|
+
# fetchValidator
|
|
538
563
|
|
|
539
|
-
|
|
564
|
+
## Method
|
|
540
565
|
|
|
541
566
|
```ts
|
|
542
|
-
|
|
567
|
+
async fetchValidator(validator: string)
|
|
543
568
|
```
|
|
544
569
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
```ts
|
|
548
|
-
const validatorUnbondings =
|
|
549
|
-
await stakingApi.fetchUnbondingDelegationsFrom(validator)
|
|
570
|
+
## CLI Equivalent
|
|
550
571
|
|
|
551
|
-
|
|
572
|
+
```bash
|
|
573
|
+
zigchaind query staking validator <validator-address>
|
|
552
574
|
```
|
|
553
575
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
## `fetchValidator`
|
|
576
|
+
## Description
|
|
557
577
|
|
|
558
|
-
|
|
578
|
+
Fetches the **full details of a single validator** by their operator address.
|
|
559
579
|
|
|
560
|
-
|
|
580
|
+
Returns the validator's complete profile — their bonding status, total stake, commission structure, self-delegation minimum, description, and unbonding state. This is the most detailed single-validator view available.
|
|
561
581
|
|
|
562
|
-
|
|
563
|
-
* commission rates
|
|
564
|
-
* operator address
|
|
565
|
-
* consensus public key
|
|
566
|
-
* voting power
|
|
582
|
+
## Parameters
|
|
567
583
|
|
|
568
|
-
|
|
584
|
+
| Name | Type | Description |
|
|
585
|
+
| --------- | ------ | ----------------------------------------------------- |
|
|
586
|
+
| validator | string | Validator operator address (`zigvaloper...`) to query |
|
|
569
587
|
|
|
570
|
-
|
|
571
|
-
* Delegation confirmation screens
|
|
572
|
-
* Governance and slashing tools
|
|
573
|
-
|
|
574
|
-
**CLI equivalent**
|
|
575
|
-
|
|
576
|
-
```bash
|
|
577
|
-
zigchaind query staking validator <validator>
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
**Method**
|
|
581
|
-
|
|
582
|
-
```ts
|
|
583
|
-
fetchValidator(validator: string)
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
**Example**
|
|
588
|
+
## Usage Example
|
|
587
589
|
|
|
588
590
|
```ts
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
+
const val = await stakingApi.fetchValidator(validator)
|
|
592
|
+
console.dir(val, { depth: null })
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
## Example Response
|
|
596
|
+
|
|
597
|
+
```json
|
|
598
|
+
{
|
|
599
|
+
"validator": {
|
|
600
|
+
"operator_address": "zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr",
|
|
601
|
+
"consensus_pubkey": {
|
|
602
|
+
"@type": "/cosmos.crypto.ed25519.PubKey",
|
|
603
|
+
"key": "qLwYZi8Sm9IUvjoa48+sS9Sqata0Lm2r9QhjesO+6ZI="
|
|
604
|
+
},
|
|
605
|
+
"jailed": false,
|
|
606
|
+
"status": "BOND_STATUS_UNBONDED",
|
|
607
|
+
"tokens": "1501000",
|
|
608
|
+
"delegator_shares": "1501000.000000000000000000",
|
|
609
|
+
"description": {
|
|
610
|
+
"moniker": "testnet-validator-multisig",
|
|
611
|
+
"identity": "",
|
|
612
|
+
"website": "https://testnet-validator.example.com",
|
|
613
|
+
"security_contact": "security@example.com",
|
|
614
|
+
"details": "Multi-sig test: Updated validator description"
|
|
615
|
+
},
|
|
616
|
+
"unbonding_height": "0",
|
|
617
|
+
"unbonding_time": "1970-01-01T00:00:00Z",
|
|
618
|
+
"commission": {
|
|
619
|
+
"commission_rates": {
|
|
620
|
+
"rate": "0.100000000000000000",
|
|
621
|
+
"max_rate": "0.200000000000000000",
|
|
622
|
+
"max_change_rate": "0.010000000000000000"
|
|
623
|
+
},
|
|
624
|
+
"update_time": "2025-12-03T07:13:59.701638398Z"
|
|
625
|
+
},
|
|
626
|
+
"min_self_delegation": "1",
|
|
627
|
+
"unbonding_on_hold_ref_count": "0",
|
|
628
|
+
"unbonding_ids": []
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
## Response Field Explanation
|
|
634
|
+
|
|
635
|
+
### `validator`
|
|
636
|
+
|
|
637
|
+
| Field | Description |
|
|
638
|
+
| -------------------------- | -------------------------------------------------------------------------------- |
|
|
639
|
+
| operator_address | Validator's staking operator address (`zigvaloper...`) |
|
|
640
|
+
| consensus_pubkey.@type | Key type — always Ed25519 for CometBFT validators |
|
|
641
|
+
| consensus_pubkey.key | Base64-encoded Ed25519 public key used for block signing |
|
|
642
|
+
| jailed | `true` if validator has been penalized and removed from active set |
|
|
643
|
+
| status | Current bond status (`BONDED`, `UNBONDED`, or `UNBONDING`) |
|
|
644
|
+
| tokens | Total `uzig` bonded to this validator |
|
|
645
|
+
| delegator_shares | Internal share accounting — normally equals `tokens` unless slashed |
|
|
646
|
+
| description.moniker | Human-readable validator name |
|
|
647
|
+
| description.identity | Optional Keybase identity for verification |
|
|
648
|
+
| description.website | Validator's website |
|
|
649
|
+
| description.security_contact | Contact email for security issues |
|
|
650
|
+
| description.details | Validator's self-description |
|
|
651
|
+
| unbonding_height | Block height when unbonding began. `0` if not currently unbonding |
|
|
652
|
+
| unbonding_time | Timestamp when unbonding completes. Epoch zero if not unbonding |
|
|
653
|
+
| commission.commission_rates.rate | Current commission rate charged to delegators |
|
|
654
|
+
| commission.commission_rates.max_rate | Hard cap on commission — can never be increased above this |
|
|
655
|
+
| commission.commission_rates.max_change_rate | Max daily commission rate change — prevents sudden increases |
|
|
656
|
+
| commission.update_time | When commission was last changed |
|
|
657
|
+
| min_self_delegation | Minimum `uzig` the validator operator must self-delegate |
|
|
658
|
+
| unbonding_ids | IDs of active unbonding operations. Empty if none |
|
|
591
659
|
|
|
592
|
-
console.dir(validatorInfo, { depth: null })
|
|
593
|
-
```
|
|
594
660
|
|
|
595
661
|
---
|
|
596
662
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
Fetch **all validators in the network**.
|
|
600
|
-
|
|
601
|
-
This returns the **full validator set**, optionally filtered by status at the chain level.
|
|
663
|
+
# 4️⃣ fetchValidators
|
|
602
664
|
|
|
603
|
-
|
|
665
|
+
## Method
|
|
604
666
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
**Difference from delegator-validator queries**
|
|
610
|
-
|
|
611
|
-
* `fetchValidators` → network-wide
|
|
612
|
-
* `fetchDelegatorValidators` → user-specific
|
|
667
|
+
```ts
|
|
668
|
+
async fetchValidators()
|
|
669
|
+
```
|
|
613
670
|
|
|
614
|
-
|
|
671
|
+
## CLI Equivalent
|
|
615
672
|
|
|
616
673
|
```bash
|
|
617
674
|
zigchaind query staking validators
|
|
618
675
|
```
|
|
619
676
|
|
|
620
|
-
|
|
677
|
+
## Description
|
|
621
678
|
|
|
622
|
-
|
|
623
|
-
fetchValidators()
|
|
624
|
-
```
|
|
679
|
+
Fetches **all validators** registered on the chain — both active (bonded) and inactive (unbonded), including jailed validators.
|
|
625
680
|
|
|
626
|
-
|
|
681
|
+
## Parameters
|
|
682
|
+
|
|
683
|
+
None.
|
|
684
|
+
|
|
685
|
+
## Usage Example
|
|
627
686
|
|
|
628
687
|
```ts
|
|
629
|
-
const
|
|
630
|
-
console.dir(
|
|
631
|
-
```
|
|
632
|
-
|
|
688
|
+
const vals = await stakingApi.fetchValidators()
|
|
689
|
+
console.dir(vals, { depth: null })
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
## Example Response
|
|
693
|
+
|
|
694
|
+
```json
|
|
695
|
+
{
|
|
696
|
+
"validators": [
|
|
697
|
+
{
|
|
698
|
+
"operator_address": "zigvaloper1pwwymlyeyfcz3pjvcegvz8tj3yf0pr3wqqhrwk",
|
|
699
|
+
"consensus_pubkey": {
|
|
700
|
+
"@type": "/cosmos.crypto.ed25519.PubKey",
|
|
701
|
+
"key": "f+akljJ8Y0dKwWz3bKkRN+RDz9EM+yA/j7Gre+Hn02c="
|
|
702
|
+
},
|
|
703
|
+
"jailed": false,
|
|
704
|
+
"status": "BOND_STATUS_BONDED",
|
|
705
|
+
"tokens": "25350105116909",
|
|
706
|
+
"delegator_shares": "25350105116909.000000000000000000",
|
|
707
|
+
"description": {
|
|
708
|
+
"moniker": "ZIG Sentinel - Foundation 1",
|
|
709
|
+
"identity": "D752CA2B4A74AD75",
|
|
710
|
+
"website": "https://zigchain.com",
|
|
711
|
+
"security_contact": "",
|
|
712
|
+
"details": "The guardian of ZIGChain..."
|
|
713
|
+
},
|
|
714
|
+
"commission": {
|
|
715
|
+
"commission_rates": {
|
|
716
|
+
"rate": "0.050000000000000000",
|
|
717
|
+
"max_rate": "0.200000000000000000",
|
|
718
|
+
"max_change_rate": "0.010000000000000000"
|
|
719
|
+
},
|
|
720
|
+
"update_time": "2025-09-17T16:00:38.206163930Z"
|
|
721
|
+
},
|
|
722
|
+
"min_self_delegation": "1"
|
|
723
|
+
}
|
|
724
|
+
],
|
|
725
|
+
"pagination": {
|
|
726
|
+
"next_key": null,
|
|
727
|
+
"total": "30"
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
Each validator entry has the same structure as `fetchValidator` — refer to that section for the full field-by-field breakdown.
|
|
733
|
+
|
|
734
|
+
## Response Field Explanation
|
|
735
|
+
|
|
736
|
+
### `validators`
|
|
737
|
+
|
|
738
|
+
Array of all registered validators. Each entry is identical in structure to the `validator` object returned by `fetchValidator`.
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
### `fetchValidator` vs `fetchValidators`
|
|
742
|
+
|
|
743
|
+
| Feature | fetchValidator | fetchValidators |
|
|
744
|
+
| --------------------- | -------------------------- | --------------------------- |
|
|
745
|
+
| Scope | Single validator by address | All validators |
|
|
746
|
+
| Use case | Specific validator lookup | Full registry overview |
|
|
747
|
+
| Response size | Minimal | Large (paginated) |
|
|
748
|
+
|
|
749
|
+
## When to Use
|
|
750
|
+
|
|
751
|
+
* Building validator list pages in explorers or wallets
|
|
752
|
+
* Letting users browse and compare validators before delegating
|
|
753
|
+
* Calculating total network stake across all validators
|
|
754
|
+
* Monitoring the active validator set
|
|
633
755
|
|
|
756
|
+
---
|