@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.
- package/README.md +1 -1
- package/dist/auth/ChainAuthApi.d.ts +0 -3
- package/dist/auth/ChainAuthApi.d.ts.map +1 -1
- package/dist/auth/ChainAuthApi.js +0 -26
- package/dist/auth/ChainAuthApi.js.map +1 -1
- package/dist/bank/ChainBankApi.d.ts +0 -9
- package/dist/bank/ChainBankApi.d.ts.map +1 -1
- package/dist/bank/ChainBankApi.js +0 -18
- package/dist/bank/ChainBankApi.js.map +1 -1
- package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
- package/dist/circuit/ChainCircuitApi.js.map +1 -1
- package/dist/client/http.d.ts +1 -0
- package/dist/client/http.d.ts.map +1 -1
- package/dist/client/http.js +10 -0
- package/dist/client/http.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 +47 -0
- package/dist/distribution/ChainDistributionApi.d.ts.map +1 -0
- package/dist/distribution/ChainDistributionApi.js +74 -0
- package/dist/distribution/ChainDistributionApi.js.map +1 -0
- package/dist/distribution/types.d.ts +71 -0
- package/dist/distribution/types.d.ts.map +1 -0
- package/dist/distribution/types.js +2 -0
- package/dist/distribution/types.js.map +1 -0
- package/dist/evidence/ChainEvidenceApi.d.ts +15 -0
- package/dist/evidence/ChainEvidenceApi.d.ts.map +1 -0
- package/dist/evidence/ChainEvidenceApi.js +22 -0
- package/dist/evidence/ChainEvidenceApi.js.map +1 -0
- package/dist/evidence/types.d.ts +15 -0
- package/dist/evidence/types.d.ts.map +1 -0
- package/dist/evidence/types.js +2 -0
- package/dist/evidence/types.js.map +1 -0
- package/dist/feegrant/ChainFeegrantApi.d.ts +22 -0
- package/dist/feegrant/ChainFeegrantApi.d.ts.map +1 -0
- package/dist/feegrant/ChainFeegrantApi.js +32 -0
- package/dist/feegrant/ChainFeegrantApi.js.map +1 -0
- package/dist/feegrant/types.d.ts +17 -0
- package/dist/feegrant/types.d.ts.map +1 -0
- package/dist/feegrant/types.js +2 -0
- package/dist/feegrant/types.js.map +1 -0
- package/dist/ibc/ChainIbcApi.d.ts +55 -0
- package/dist/ibc/ChainIbcApi.d.ts.map +1 -0
- package/dist/ibc/ChainIbcApi.js +82 -0
- package/dist/ibc/ChainIbcApi.js.map +1 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts +55 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.d.ts.map +1 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.js +82 -0
- package/dist/ibc/ibcChannel/ChainIbcChannelApi.js.map +1 -0
- package/dist/ibc/ibcChannel/types.d.ts +106 -0
- package/dist/ibc/ibcChannel/types.d.ts.map +1 -0
- package/dist/ibc/ibcChannel/types.js +2 -0
- package/dist/ibc/ibcChannel/types.js.map +1 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts +14 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.d.ts.map +1 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js +38 -0
- package/dist/ibc/ibcChannelV2/ChainIbcChannelV2.js.map +1 -0
- package/dist/ibc/ibcChannelV2/types.d.ts +26 -0
- package/dist/ibc/ibcChannelV2/types.d.ts.map +1 -0
- package/dist/ibc/ibcChannelV2/types.js +3 -0
- package/dist/ibc/ibcChannelV2/types.js.map +1 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts +15 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.d.ts.map +1 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.js +39 -0
- package/dist/ibc/ibcClient/ChainIbcClientApi.js.map +1 -0
- package/dist/ibc/ibcClient/types.d.ts +53 -0
- package/dist/ibc/ibcClient/types.d.ts.map +1 -0
- package/dist/ibc/ibcClient/types.js +2 -0
- package/dist/ibc/ibcClient/types.js.map +1 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts +11 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.d.ts.map +1 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js +24 -0
- package/dist/ibc/ibcConnection/ChainIbcConnectionApi.js.map +1 -0
- package/dist/ibc/ibcConnection/types.d.ts +18 -0
- package/dist/ibc/ibcConnection/types.d.ts.map +1 -0
- package/dist/ibc/ibcConnection/types.js +2 -0
- package/dist/ibc/ibcConnection/types.js.map +1 -0
- package/dist/ibc/types.d.ts +106 -0
- package/dist/ibc/types.d.ts.map +1 -0
- package/dist/ibc/types.js +2 -0
- package/dist/ibc/types.js.map +1 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.d.ts +12 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.d.ts.map +1 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.js +30 -0
- package/dist/ibc-transfer/ChainIbcTransferApi.js.map +1 -0
- package/dist/ibc-transfer/types.d.ts +26 -0
- package/dist/ibc-transfer/types.d.ts.map +1 -0
- package/dist/ibc-transfer/types.js +2 -0
- package/dist/ibc-transfer/types.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/interchain-accounts/ChainInterChainAccApi.d.ts +9 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.d.ts.map +1 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.js +16 -0
- package/dist/interchain-accounts/ChainInterChainAccApi.js.map +1 -0
- package/dist/interchain-accounts/types.d.ts +12 -0
- package/dist/interchain-accounts/types.d.ts.map +1 -0
- package/dist/interchain-accounts/types.js +2 -0
- package/dist/interchain-accounts/types.js.map +1 -0
- package/dist/networks/endpoints.js +2 -2
- package/dist/networks/endpoints.js.map +1 -1
- package/dist/runtime/ChainRuntimeApi.d.ts +12 -0
- package/dist/runtime/ChainRuntimeApi.d.ts.map +1 -0
- package/dist/runtime/ChainRuntimeApi.js +16 -0
- package/dist/runtime/ChainRuntimeApi.js.map +1 -0
- package/dist/runtime/types.d.ts +4 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- 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/tokenwrapper/ChainTokenWrapperApi.d.ts +19 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.d.ts.map +1 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.js +26 -0
- package/dist/tokenwrapper/ChainTokenWrapperApi.js.map +1 -0
- package/dist/tokenwrapper/types.d.ts +15 -0
- package/dist/tokenwrapper/types.d.ts.map +1 -0
- package/dist/tokenwrapper/types.js +2 -0
- package/dist/tokenwrapper/types.js.map +1 -0
- package/dist/txs/ChainTxsApi.d.ts +12 -0
- package/dist/txs/ChainTxsApi.d.ts.map +1 -0
- package/dist/txs/ChainTxsApi.js +17 -0
- package/dist/txs/ChainTxsApi.js.map +1 -0
- package/dist/txs/types.d.ts +22 -0
- package/dist/txs/types.d.ts.map +1 -0
- package/dist/txs/types.js +5 -0
- package/dist/txs/types.js.map +1 -0
- package/dist/upgrade/ChainUpgradeApi.d.ts +22 -0
- package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -0
- package/dist/upgrade/ChainUpgradeApi.js +40 -0
- package/dist/upgrade/ChainUpgradeApi.js.map +1 -0
- package/dist/upgrade/types.d.ts +24 -0
- package/dist/upgrade/types.d.ts.map +1 -0
- package/dist/upgrade/types.js +5 -0
- package/dist/upgrade/types.js.map +1 -0
- package/dist/validator-set/ChainCometValidator.d.ts +8 -0
- package/dist/validator-set/ChainCometValidator.d.ts.map +1 -0
- package/dist/validator-set/ChainCometValidator.js +15 -0
- package/dist/validator-set/ChainCometValidator.js.map +1 -0
- 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/dist/validator-set/types.d.ts +18 -0
- package/dist/validator-set/types.d.ts.map +1 -0
- package/dist/validator-set/types.js +2 -0
- package/dist/validator-set/types.js.map +1 -0
- package/dist/wasm/ChainWasmApi.d.ts +57 -0
- package/dist/wasm/ChainWasmApi.d.ts.map +1 -0
- package/dist/wasm/ChainWasmApi.js +78 -0
- package/dist/wasm/ChainWasmApi.js.map +1 -0
- package/dist/wasm/types.d.ts +77 -0
- package/dist/wasm/types.d.ts.map +1 -0
- package/dist/wasm/types.js +2 -0
- package/dist/wasm/types.js.map +1 -0
- package/docs/auth.md +438 -72
- package/docs/bank.md +782 -123
- package/docs/block-results.md +328 -21
- package/docs/block.md +325 -38
- package/docs/circuit.md +164 -35
- package/docs/dex.md +313 -63
- package/docs/distribution.md +772 -0
- package/docs/evidence.md +194 -0
- package/docs/factory.md +308 -62
- package/docs/feegrant.md +206 -0
- package/docs/gov.md +364 -0
- package/docs/ibc/ibcChannel.md +977 -0
- package/docs/ibc/ibcClient.md +771 -0
- package/docs/ibc/ibcConnection.md +214 -0
- package/docs/ibc-transfer.md +463 -0
- package/docs/interchain-accounts.md +223 -0
- package/docs/mint.md +270 -0
- package/docs/runtime.md +120 -0
- package/docs/slashing.md +287 -0
- package/docs/staking.md +756 -0
- package/docs/tokenwrapper.md +294 -0
- package/docs/txs.md +447 -0
- package/docs/upgrade.md +356 -0
- package/docs/validator-set.md +177 -0
- package/docs/wasm.md +916 -0
- package/package.json +1 -1
package/docs/staking.md
ADDED
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
# STAKING Module
|
|
2
|
+
|
|
3
|
+
## What is STAKING?
|
|
4
|
+
|
|
5
|
+
**Staking** in the Cosmos ecosystem (including **ZigChain**) allows token holders to:
|
|
6
|
+
|
|
7
|
+
* Delegate tokens to validators
|
|
8
|
+
* Earn rewards
|
|
9
|
+
* Participate in network security
|
|
10
|
+
|
|
11
|
+
The staking module tracks delegations, validators, and staking parameters.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Important Terminology
|
|
16
|
+
|
|
17
|
+
### Delegator
|
|
18
|
+
|
|
19
|
+
A user who locks tokens by delegating to a validator.
|
|
20
|
+
|
|
21
|
+
### Validator
|
|
22
|
+
|
|
23
|
+
An entity responsible for validating blocks.
|
|
24
|
+
|
|
25
|
+
### Delegation
|
|
26
|
+
|
|
27
|
+
Tokens staked by a delegator to a validator.
|
|
28
|
+
|
|
29
|
+
### Shares
|
|
30
|
+
|
|
31
|
+
Proportional representation of a delegator’s stake in the validator.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
# Functions Documentation
|
|
36
|
+
|
|
37
|
+
Setup:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import {
|
|
41
|
+
ChainStakingApi,
|
|
42
|
+
getNetworkEndpoints,
|
|
43
|
+
Network
|
|
44
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
45
|
+
|
|
46
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
47
|
+
const stakingApi = new ChainStakingApi(endpoints)
|
|
48
|
+
|
|
49
|
+
const delegator = 'zig1q8uh4ytf632jqykrd4m0weuzq9uv4r4jzra9h6'
|
|
50
|
+
const validator = 'zigvaloper1q8uh4ytf632jqykrd4m0weuzq9uv4r4jhy3rkr'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# 1️⃣ fetchDelegations
|
|
56
|
+
|
|
57
|
+
## Method
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
async fetchDelegations(delegatorAddress: string)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## CLI Equivalent
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
zigchaind query staking delegations <delegator>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Description
|
|
70
|
+
|
|
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 |
|
|
79
|
+
|
|
80
|
+
## Usage Example
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const delegations = await stakingApi.fetchDelegations(delegator)
|
|
84
|
+
console.dir(delegations, { depth: null })
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Example Response
|
|
90
|
+
|
|
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
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Response Field Explanation
|
|
110
|
+
|
|
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 |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
# 2️⃣ fetchDelegation
|
|
125
|
+
|
|
126
|
+
## Method
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
async fetchDelegation(delegatorAddress: string, validatorAddress: string)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## CLI Equivalent
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
zigchaind query staking delegation <delegator> <validator>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Description
|
|
139
|
+
|
|
140
|
+
Query a **single delegation** from a delegator to a specific validator.
|
|
141
|
+
|
|
142
|
+
## Parameters
|
|
143
|
+
|
|
144
|
+
| Name | Type | Description |
|
|
145
|
+
| ---------------- | ------ | ------------------------------- |
|
|
146
|
+
| delegatorAddress | string | Bech32 address of the delegator |
|
|
147
|
+
| validatorAddress | string | Bech32 address of the validator |
|
|
148
|
+
|
|
149
|
+
## Usage Example
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
const delegation = await stakingApi.fetchDelegation(delegator, validator)
|
|
153
|
+
console.dir(delegation, { depth: null })
|
|
154
|
+
```
|
|
155
|
+
|
|
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 |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
# 3️⃣ fetchValidatorDelegations
|
|
223
|
+
|
|
224
|
+
## Method
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
async fetchValidatorDelegations(validator_addr: string)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## CLI Equivalent
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
zigchaind query staking delegations-to <validator>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Description
|
|
237
|
+
|
|
238
|
+
Fetch all delegations to a specific validator.
|
|
239
|
+
|
|
240
|
+
## Parameters
|
|
241
|
+
|
|
242
|
+
| Name | Type | Description |
|
|
243
|
+
| -------------- | ------ | ------------------------------- |
|
|
244
|
+
| validator_addr | string | Bech32 address of the validator |
|
|
245
|
+
|
|
246
|
+
## Usage Example
|
|
247
|
+
|
|
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
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
# 4️⃣ fetchDelegatorValidator
|
|
282
|
+
|
|
283
|
+
## Method
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
async fetchDelegatorValidator(delegatorAddress: string, validatorAddress: string)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## CLI Equivalent
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
zigchaind query staking delegator-validator <delegator> <validator>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Description
|
|
296
|
+
|
|
297
|
+
Query validator info for a specific delegator-validator pair.
|
|
298
|
+
|
|
299
|
+
## Parameters
|
|
300
|
+
|
|
301
|
+
| Name | Type | Description |
|
|
302
|
+
| ---------------- | ------ | ------------------------ |
|
|
303
|
+
| delegatorAddress | string | Bech32 delegator address |
|
|
304
|
+
| validatorAddress | string | Bech32 validator address |
|
|
305
|
+
|
|
306
|
+
## Usage Example
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
const delegatorValidator = await stakingApi.fetchDelegatorValidator(delegator, validator)
|
|
310
|
+
console.dir(delegatorValidator, { depth: null })
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Example Response
|
|
314
|
+
|
|
315
|
+
*(Same as `fetchDelegation` — returns validator object.)*
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
# 5️⃣ fetchDelegatorValidators
|
|
320
|
+
|
|
321
|
+
## Method
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
async fetchDelegatorValidators(delegatorAddress: string)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## CLI Equivalent
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
zigchaind query staking delegator-validators <delegator>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Description
|
|
334
|
+
|
|
335
|
+
Fetch info of **all validators** a delegator has delegated to.
|
|
336
|
+
|
|
337
|
+
## Parameters
|
|
338
|
+
|
|
339
|
+
| Name | Type | Description |
|
|
340
|
+
| ---------------- | ------ | ------------------------ |
|
|
341
|
+
| delegatorAddress | string | Bech32 delegator address |
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Usage Example
|
|
346
|
+
|
|
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
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
# 6️⃣ fetchStakingParams
|
|
380
|
+
|
|
381
|
+
## Method
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
async fetchStakingParams()
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## CLI Equivalent
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
zigchaind query staking params
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## Description
|
|
394
|
+
|
|
395
|
+
Fetches chain-level **staking module parameters**.
|
|
396
|
+
|
|
397
|
+
## Parameters
|
|
398
|
+
|
|
399
|
+
None.
|
|
400
|
+
|
|
401
|
+
## Usage Example
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
const params = await stakingApi.fetchStakingParams()
|
|
405
|
+
console.dir(params, { depth: null })
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Example Response
|
|
409
|
+
|
|
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
|
+
```
|
|
422
|
+
|
|
423
|
+
## Response Field Explanation
|
|
424
|
+
|
|
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 |
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
Here's batch 1 of the Staking module documentation:
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
# fetchStakingPool
|
|
442
|
+
|
|
443
|
+
## Method
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
async fetchStakingPool()
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## CLI Equivalent
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
zigchaind query staking pool
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Description
|
|
456
|
+
|
|
457
|
+
Fetches the **chain-wide staking pool** — the total accounting of all bonded and non-bonded tokens across every validator.
|
|
458
|
+
|
|
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.
|
|
460
|
+
|
|
461
|
+
## Parameters
|
|
462
|
+
|
|
463
|
+
None.
|
|
464
|
+
|
|
465
|
+
## Usage Example
|
|
466
|
+
|
|
467
|
+
```ts
|
|
468
|
+
const pool = await stakingApi.fetchStakingPool()
|
|
469
|
+
console.dir(pool, { depth: null })
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
## Example Response
|
|
473
|
+
|
|
474
|
+
```json
|
|
475
|
+
{
|
|
476
|
+
"pool": {
|
|
477
|
+
"not_bonded_tokens": "108314438077",
|
|
478
|
+
"bonded_tokens": "101692473101453"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
## Response Field Explanation
|
|
484
|
+
|
|
485
|
+
### `pool`
|
|
486
|
+
|
|
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 |
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
# fetchRedelegation
|
|
495
|
+
|
|
496
|
+
## Method
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
async fetchRedelegation(delegator_addr: string)
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
## CLI Equivalent
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
zigchaind query staking redelegation <delegator-address>
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## Description
|
|
509
|
+
|
|
510
|
+
Fetches all **active redelegations** for a specific delegator.
|
|
511
|
+
|
|
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.
|
|
513
|
+
|
|
514
|
+
An empty `redelegation_responses` array means the delegator has no active redelegations in progress.
|
|
515
|
+
|
|
516
|
+
## Parameters
|
|
517
|
+
|
|
518
|
+
| Name | Type | Description |
|
|
519
|
+
| -------------- | ------ | ------------------------------------------------ |
|
|
520
|
+
| delegator_addr | string | Bech32 address of the delegator to query |
|
|
521
|
+
|
|
522
|
+
## Usage Example
|
|
523
|
+
|
|
524
|
+
```ts
|
|
525
|
+
const redelegations = await stakingApi.fetchRedelegation(delegator)
|
|
526
|
+
console.dir(redelegations, { depth: null })
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
## Example Response
|
|
530
|
+
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"redelegation_responses": [],
|
|
534
|
+
"pagination": {
|
|
535
|
+
"next_key": null,
|
|
536
|
+
"total": "0"
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## Response Field Explanation
|
|
542
|
+
|
|
543
|
+
### `redelegation_responses`
|
|
544
|
+
|
|
545
|
+
Array of active redelegation entries for this delegator. Empty if no redelegations are in progress.
|
|
546
|
+
|
|
547
|
+
If entries are present, each would contain:
|
|
548
|
+
|
|
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 |
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
# fetchValidator
|
|
563
|
+
|
|
564
|
+
## Method
|
|
565
|
+
|
|
566
|
+
```ts
|
|
567
|
+
async fetchValidator(validator: string)
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
## CLI Equivalent
|
|
571
|
+
|
|
572
|
+
```bash
|
|
573
|
+
zigchaind query staking validator <validator-address>
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## Description
|
|
577
|
+
|
|
578
|
+
Fetches the **full details of a single validator** by their operator address.
|
|
579
|
+
|
|
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.
|
|
581
|
+
|
|
582
|
+
## Parameters
|
|
583
|
+
|
|
584
|
+
| Name | Type | Description |
|
|
585
|
+
| --------- | ------ | ----------------------------------------------------- |
|
|
586
|
+
| validator | string | Validator operator address (`zigvaloper...`) to query |
|
|
587
|
+
|
|
588
|
+
## Usage Example
|
|
589
|
+
|
|
590
|
+
```ts
|
|
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 |
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
# 4️⃣ fetchValidators
|
|
664
|
+
|
|
665
|
+
## Method
|
|
666
|
+
|
|
667
|
+
```ts
|
|
668
|
+
async fetchValidators()
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## CLI Equivalent
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
zigchaind query staking validators
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
## Description
|
|
678
|
+
|
|
679
|
+
Fetches **all validators** registered on the chain — both active (bonded) and inactive (unbonded), including jailed validators.
|
|
680
|
+
|
|
681
|
+
## Parameters
|
|
682
|
+
|
|
683
|
+
None.
|
|
684
|
+
|
|
685
|
+
## Usage Example
|
|
686
|
+
|
|
687
|
+
```ts
|
|
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
|
|
755
|
+
|
|
756
|
+
---
|