@zuhaibnoor/zigchain-sdk 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/distribution/ChainDistributionApi.d.ts +47 -0
- package/dist/distribution/ChainDistributionApi.d.ts.map +1 -0
- package/dist/distribution/ChainDistributionApi.js +75 -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/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/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 +555 -0
- package/docs/bank.md +974 -0
- package/docs/block-results.md +371 -0
- package/docs/block.md +97 -0
- package/docs/circuit.md +93 -0
- package/docs/comet-validator-set.md +70 -0
- package/docs/dex.md +159 -0
- package/docs/distribution.md +201 -0
- package/docs/evidence.md +199 -0
- package/docs/factory.md +159 -0
- package/docs/feegrant.md +206 -0
- package/docs/gov.md +166 -0
- package/docs/ibc/ibcChannel.md +490 -0
- package/docs/ibc/ibcClient.md +302 -0
- package/docs/ibc/ibcConnection.md +214 -0
- package/docs/ibc-transfer.md +204 -0
- package/docs/interchain-accounts.md +120 -0
- package/docs/mint.md +133 -0
- package/docs/runtime.md +81 -0
- package/docs/slashing.md +139 -0
- package/docs/staking.md +633 -0
- package/docs/tokenwrapper.md +137 -0
- package/docs/txs.md +0 -0
- package/docs/upgrade.md +133 -0
- package/docs/wasm.md +916 -0
- package/package.json +2 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Interchain Accounts (ICA) Module
|
|
2
|
+
|
|
3
|
+
The **Interchain Accounts (ICA) module** allows one blockchain to control an account on another blockchain through IBC.
|
|
4
|
+
|
|
5
|
+
It enables:
|
|
6
|
+
|
|
7
|
+
* Remote account creation
|
|
8
|
+
* Cross-chain transaction execution
|
|
9
|
+
* Programmatic interaction between chains
|
|
10
|
+
|
|
11
|
+
This module has two parts:
|
|
12
|
+
|
|
13
|
+
* **Controller** → The chain initiating control
|
|
14
|
+
* **Host** → The chain hosting the remote account
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Setup
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
ChainInterchainAccountsApi,
|
|
23
|
+
getNetworkEndpoints,
|
|
24
|
+
Network,
|
|
25
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
26
|
+
|
|
27
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
28
|
+
const icaApi = new ChainInterchainAccountsApi(endpoints)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## `fetchControllerParams()`
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
fetchControllerParams()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### What it does
|
|
40
|
+
|
|
41
|
+
Fetches the **current parameters** of the ICA Controller submodule.
|
|
42
|
+
|
|
43
|
+
The controller is responsible for:
|
|
44
|
+
|
|
45
|
+
* Creating interchain accounts
|
|
46
|
+
* Sending transactions to remote chains
|
|
47
|
+
* Managing cross-chain account control
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### CLI Equivalent
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
zigchaind query interchain-accounts controller params
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Example
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const controllerParams = await icaApi.fetchControllerParams()
|
|
63
|
+
console.dir(controllerParams, { depth: null })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## `fetchHostParams()`
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
fetchHostParams()
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### What it does
|
|
75
|
+
|
|
76
|
+
Fetches the **current parameters** of the ICA Host submodule.
|
|
77
|
+
|
|
78
|
+
The host is responsible for:
|
|
79
|
+
|
|
80
|
+
* Receiving interchain account requests
|
|
81
|
+
* Executing transactions on behalf of remote controllers
|
|
82
|
+
* Managing allowed message types
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### CLI Equivalent
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
zigchaind query interchain-accounts host params
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Example
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const hostParams = await icaApi.fetchHostParams()
|
|
98
|
+
console.dir(hostParams, { depth: null })
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
# Interchain Accounts
|
|
104
|
+
|
|
105
|
+
Interchain Accounts allow one chain to control an account on another chain.
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
|
|
109
|
+
* ZigChain (Controller)
|
|
110
|
+
* Another IBC chain (Host)
|
|
111
|
+
|
|
112
|
+
ZigChain can:
|
|
113
|
+
|
|
114
|
+
* Create an account on the host chain
|
|
115
|
+
* Send transactions to be executed there
|
|
116
|
+
* Manage funds remotely
|
|
117
|
+
|
|
118
|
+
This makes advanced cross-chain applications possible.
|
|
119
|
+
|
|
120
|
+
---
|
package/docs/mint.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Mint Module
|
|
2
|
+
|
|
3
|
+
The **ChainMintApi** lets you query minting-related data.
|
|
4
|
+
It is used to fetch **inflation**, **annual token provisions**, and **mint module parameters**.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import {
|
|
12
|
+
ChainMintApi,
|
|
13
|
+
getNetworkEndpoints,
|
|
14
|
+
Network,
|
|
15
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
16
|
+
|
|
17
|
+
cosnt endpoints = getNetworkEndpoints(Network.Testnet)
|
|
18
|
+
const mintApi = new ChainMintApi(endpoints)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## `fetchInflation`
|
|
24
|
+
|
|
25
|
+
Fetch the **current inflation rate** of the chain.
|
|
26
|
+
|
|
27
|
+
**CLI equivalent**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
zigchaind query mint inflation
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Method**
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
fetchInflation()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const inflation = await mintApi.fetchInflation()
|
|
43
|
+
console.log(inflation)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## `fetchAnnualProvisions`
|
|
49
|
+
|
|
50
|
+
Fetch the **annual provisions**, i.e. the total number of tokens minted per year.
|
|
51
|
+
|
|
52
|
+
**CLI equivalent**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
zigchaind query mint annual-provisions
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Method**
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
fetchAnnualProvisions()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Example**
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const annualProvisions = await mintApi.fetchAnnualProvisions()
|
|
68
|
+
console.log(annualProvisions)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## `fetchParams`
|
|
74
|
+
|
|
75
|
+
Fetch the **mint module parameters**.
|
|
76
|
+
|
|
77
|
+
**CLI equivalent**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
zigchaind query mint params
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Method**
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
fetchParams()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Example**
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const params = await mintApi.fetchParams()
|
|
93
|
+
console.dir(params, { depth: null })
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Example (Full)
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import {
|
|
102
|
+
ChainMintApi,
|
|
103
|
+
getNetworkEndpoints,
|
|
104
|
+
Network
|
|
105
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
106
|
+
|
|
107
|
+
async function main() {
|
|
108
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
109
|
+
const mintApi = new ChainMintApi(endpoints)
|
|
110
|
+
|
|
111
|
+
const inflation = await mintApi.fetchInflation()
|
|
112
|
+
console.log('Inflation:', inflation)
|
|
113
|
+
|
|
114
|
+
const annualProvisions = await mintApi.fetchAnnualProvisions()
|
|
115
|
+
console.log('Annual Provisions:', annualProvisions)
|
|
116
|
+
|
|
117
|
+
const params = await mintApi.fetchParams()
|
|
118
|
+
console.log('Mint Params:')
|
|
119
|
+
console.dir(params, { depth: null })
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
main()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Notes
|
|
128
|
+
|
|
129
|
+
* Mint queries are **read-only** and require no wallet.
|
|
130
|
+
* Inflation and provisions are returned as **string values** for precision.
|
|
131
|
+
* All mint endpoints are queried via **LCD**.
|
|
132
|
+
|
|
133
|
+
|
package/docs/runtime.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Runtime Module
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The **Runtime module** provides information about the **running ZigChain application itself**, not about accounts, balances, validators, or governance.
|
|
6
|
+
|
|
7
|
+
It allows you to:
|
|
8
|
+
|
|
9
|
+
* Inspect how the chain is configured
|
|
10
|
+
* Discover what services and APIs the chain exposes
|
|
11
|
+
* Read AutoCLI command definitions generated by the chain
|
|
12
|
+
|
|
13
|
+
⚠️ **Important**
|
|
14
|
+
This module is **read-only and informational**.
|
|
15
|
+
It does **not** change chain state and does **not** require any address or permissions.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## When should you use the Runtime module?
|
|
20
|
+
|
|
21
|
+
Use this module when you want to:
|
|
22
|
+
|
|
23
|
+
* Build developer tools, explorers, or SDKs
|
|
24
|
+
* Inspect chain configuration values
|
|
25
|
+
* Discover available gRPC services
|
|
26
|
+
* Understand how CLI commands are generated internally
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Initialization
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
ChainRuntimeApi,
|
|
35
|
+
getNetworkEndpoints,
|
|
36
|
+
Network
|
|
37
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
38
|
+
|
|
39
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
40
|
+
const runtime = new ChainRuntimeApi(endpoints)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## `fetchConfig()`
|
|
46
|
+
|
|
47
|
+
### Purpose
|
|
48
|
+
|
|
49
|
+
Fetches the **current runtime configuration** of the ZigChain node.
|
|
50
|
+
|
|
51
|
+
This includes application-level configuration such as:
|
|
52
|
+
|
|
53
|
+
* API settings
|
|
54
|
+
* gRPC settings
|
|
55
|
+
* pruning options
|
|
56
|
+
* minimum gas prices
|
|
57
|
+
* other node runtime parameters
|
|
58
|
+
|
|
59
|
+
### Usage Example
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const config = await runtime.fetchConfig()
|
|
63
|
+
console.dir(config, { depth: null })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### When to use
|
|
67
|
+
|
|
68
|
+
* Debug node behavior
|
|
69
|
+
* Verify network configuration
|
|
70
|
+
* Inspect gas, API, or service settings
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## Summary Table
|
|
76
|
+
|
|
77
|
+
| Function | CLI Command | Description |
|
|
78
|
+
| --------------------------- | ------------------------------------ | -------------------------------------------------------------- |
|
|
79
|
+
| `fetchConfig()` | `zigchaind query runtime config` | Fetches the current node and application runtime configuration |
|
|
80
|
+
|
|
81
|
+
|
package/docs/slashing.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Slashing Module
|
|
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.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import {
|
|
12
|
+
ChainSlashingApi,
|
|
13
|
+
getNetworkEndpoints,
|
|
14
|
+
Network,
|
|
15
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
16
|
+
|
|
17
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
18
|
+
const slashingApi = new ChainSlashingApi(endpoints)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## `fetchParams`
|
|
24
|
+
|
|
25
|
+
Fetch the **slashing module parameters**.
|
|
26
|
+
|
|
27
|
+
**CLI equivalent**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
zigchaind query slashing params
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Method**
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
fetchParams()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const params = await slashingApi.fetchParams()
|
|
43
|
+
console.dir(params, { depth: null })
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## `fetchSigningInfos`
|
|
49
|
+
|
|
50
|
+
Fetch **signing information for all validators**.
|
|
51
|
+
This includes missed blocks, start height, and jail status.
|
|
52
|
+
|
|
53
|
+
**CLI equivalent**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
zigchaind query slashing signing-infos
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Method**
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
fetchSigningInfos()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Example**
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
const infos = await slashingApi.fetchSigningInfos()
|
|
69
|
+
console.log(infos)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## `fetchSigningInfo`
|
|
75
|
+
|
|
76
|
+
Fetch **signing information for a specific validator** using its **consensus address**.
|
|
77
|
+
|
|
78
|
+
**CLI equivalent**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
zigchaind query slashing signing-info <valcons-address>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Method**
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
fetchSigningInfo(valConsAddress: string)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Example**
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
const signingInfo = await slashingApi.fetchSigningInfo(
|
|
94
|
+
'zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47'
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
console.dir(signingInfo, { depth: null })
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Example (Full)
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import {
|
|
106
|
+
ChainSlashingApi,
|
|
107
|
+
getNetworkEndpoints,
|
|
108
|
+
Network
|
|
109
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
110
|
+
|
|
111
|
+
async function main() {
|
|
112
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
113
|
+
const slashingApi = new ChainSlashingApi(endpoints)
|
|
114
|
+
|
|
115
|
+
console.log('--- Slashing Params ---')
|
|
116
|
+
const params = await slashingApi.fetchParams()
|
|
117
|
+
console.dir(params, { depth: null })
|
|
118
|
+
|
|
119
|
+
console.log('\n--- All Signing Infos ---')
|
|
120
|
+
const infos = await slashingApi.fetchSigningInfos()
|
|
121
|
+
console.log(infos)
|
|
122
|
+
|
|
123
|
+
console.log('\n--- Single Signing Info ---')
|
|
124
|
+
const singleInfo = await slashingApi.fetchSigningInfo(
|
|
125
|
+
'zigvalcons1qd9g9rwjmgs7k02w65t2hlekc39vnqsq0ajs47'
|
|
126
|
+
)
|
|
127
|
+
console.dir(singleInfo, { depth: null })
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main()
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Notes
|
|
136
|
+
|
|
137
|
+
* Slashing queries are **read-only** and require no wallet.
|
|
138
|
+
* All slashing queries are performed via **LCD endpoints**.
|
|
139
|
+
|