@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
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Interchain Accounts
|
|
2
|
+
|
|
3
|
+
## What are Interchain Accounts?
|
|
4
|
+
|
|
5
|
+
The **Interchain Accounts (ICA)** allow one blockchain to control an account on another blockchain using IBC.
|
|
6
|
+
|
|
7
|
+
This enables:
|
|
8
|
+
|
|
9
|
+
* Remote account creation
|
|
10
|
+
* Cross-chain transaction execution
|
|
11
|
+
|
|
12
|
+
Instead of bridging tokens, ICA lets one chain execute transactions on another chain as if it owned an account there.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Important Terminology
|
|
17
|
+
|
|
18
|
+
Before documenting functions, let’s define key terms.
|
|
19
|
+
|
|
20
|
+
### Controller Chain
|
|
21
|
+
|
|
22
|
+
The chain that initiates and controls an interchain account.
|
|
23
|
+
|
|
24
|
+
It:
|
|
25
|
+
|
|
26
|
+
* Creates the remote account
|
|
27
|
+
* Sends transactions
|
|
28
|
+
* Manages execution logic
|
|
29
|
+
|
|
30
|
+
### Host Chain
|
|
31
|
+
|
|
32
|
+
The chain that hosts the interchain account.
|
|
33
|
+
|
|
34
|
+
It:
|
|
35
|
+
|
|
36
|
+
* Creates the account
|
|
37
|
+
* Executes transactions
|
|
38
|
+
* Applies local validation rules
|
|
39
|
+
|
|
40
|
+
### Interchain Account
|
|
41
|
+
|
|
42
|
+
A special account on the **host chain** that is controlled by a **controller chain** via IBC.
|
|
43
|
+
|
|
44
|
+
It behaves like a normal account but is operated remotely.
|
|
45
|
+
|
|
46
|
+
### ICA Controller Module
|
|
47
|
+
|
|
48
|
+
Submodule responsible for:
|
|
49
|
+
|
|
50
|
+
* Registering interchain accounts
|
|
51
|
+
* Sending transaction packets
|
|
52
|
+
* Managing remote execution
|
|
53
|
+
|
|
54
|
+
### ICA Host Module
|
|
55
|
+
|
|
56
|
+
Submodule responsible for:
|
|
57
|
+
|
|
58
|
+
* Creating accounts for controllers
|
|
59
|
+
* Executing received transactions
|
|
60
|
+
* Defining which messages are allowed
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# Functions Documentation
|
|
65
|
+
|
|
66
|
+
## Setup
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import {
|
|
70
|
+
ChainInterchainAccountsApi,
|
|
71
|
+
getNetworkEndpoints,
|
|
72
|
+
Network,
|
|
73
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
74
|
+
|
|
75
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
76
|
+
const icaApi = new ChainInterchainAccountsApi(endpoints)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
# 1️⃣ fetchControllerParams
|
|
82
|
+
|
|
83
|
+
## Method
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
async fetchControllerParams()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## CLI Equivalent
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
zigchaind query interchain-accounts controller params
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Description
|
|
96
|
+
|
|
97
|
+
Fetches the **ICA Controller module parameters**.
|
|
98
|
+
|
|
99
|
+
These parameters define whether the chain is allowed to:
|
|
100
|
+
|
|
101
|
+
* Create interchain accounts
|
|
102
|
+
* Send remote execution transactions
|
|
103
|
+
|
|
104
|
+
## Parameters
|
|
105
|
+
|
|
106
|
+
None.
|
|
107
|
+
|
|
108
|
+
## Usage Example
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const controllerParams = await icaApi.fetchControllerParams()
|
|
112
|
+
console.dir(controllerParams, { depth: null })
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Example Response
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"params": {
|
|
120
|
+
"controller_enabled": true
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Response Field Explanation
|
|
126
|
+
|
|
127
|
+
### `params`
|
|
128
|
+
|
|
129
|
+
| Field | Description |
|
|
130
|
+
| ------------------ | ----------------------------------------------------------------------- |
|
|
131
|
+
| controller_enabled | Indicates whether ICA controller functionality is enabled on this chain |
|
|
132
|
+
|
|
133
|
+
If `false`, the chain cannot initiate interchain accounts.
|
|
134
|
+
|
|
135
|
+
## When to Use
|
|
136
|
+
|
|
137
|
+
* Checking if ICA controller is active
|
|
138
|
+
* Validating cross-chain automation availability
|
|
139
|
+
* Governance audits
|
|
140
|
+
* Chain status dashboards
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
# 2️⃣ fetchHostParams
|
|
145
|
+
|
|
146
|
+
## Method
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
async fetchHostParams()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## CLI Equivalent
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
zigchaind query interchain-accounts host params
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Description
|
|
159
|
+
|
|
160
|
+
Fetches the **ICA Host module parameters**.
|
|
161
|
+
|
|
162
|
+
These parameters define:
|
|
163
|
+
|
|
164
|
+
* Whether the chain can host interchain accounts
|
|
165
|
+
* Which message types remote controllers are allowed to execute
|
|
166
|
+
|
|
167
|
+
## Parameters
|
|
168
|
+
|
|
169
|
+
None.
|
|
170
|
+
|
|
171
|
+
## Usage Example
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
const hostParams = await icaApi.fetchHostParams()
|
|
175
|
+
console.dir(hostParams, { depth: null })
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Example Response
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"params": {
|
|
183
|
+
"host_enabled": true,
|
|
184
|
+
"allow_messages": ["*"]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Response Field Explanation
|
|
190
|
+
|
|
191
|
+
### `params`
|
|
192
|
+
|
|
193
|
+
| Field | Description |
|
|
194
|
+
| -------------- | ------------------------------------------------------------ |
|
|
195
|
+
| host_enabled | Indicates whether this chain can host interchain accounts |
|
|
196
|
+
| allow_messages | List of allowed message types remote controllers may execute |
|
|
197
|
+
|
|
198
|
+
If `allow_messages` contains `"*"`, all message types are allowed.
|
|
199
|
+
|
|
200
|
+
If restricted, only specific message types can be executed.
|
|
201
|
+
|
|
202
|
+
## When to Use
|
|
203
|
+
|
|
204
|
+
* Verifying if the chain accepts ICA requests
|
|
205
|
+
* Checking remote execution permissions
|
|
206
|
+
* Security auditing
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
# How Interchain Accounts Work (Simple Flow)
|
|
210
|
+
|
|
211
|
+
Example:
|
|
212
|
+
|
|
213
|
+
* ZigChain = Controller
|
|
214
|
+
* Another chain = Host
|
|
215
|
+
|
|
216
|
+
1️⃣ ZigChain registers an interchain account on the host chain
|
|
217
|
+
2️⃣ The host chain creates a new account
|
|
218
|
+
3️⃣ ZigChain sends transaction packets
|
|
219
|
+
4️⃣ The host chain executes those transactions
|
|
220
|
+
|
|
221
|
+
From the host chain’s perspective, it looks like a normal account submitting transactions — but it is controlled remotely.
|
|
222
|
+
|
|
223
|
+
---
|
package/docs/mint.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Mint Module
|
|
2
|
+
|
|
3
|
+
## What is the Mint Module?
|
|
4
|
+
|
|
5
|
+
The **Mint module** is responsible for controlling the chain’s token inflation.
|
|
6
|
+
|
|
7
|
+
It:
|
|
8
|
+
|
|
9
|
+
* Mints new tokens
|
|
10
|
+
* Adjusts inflation dynamically
|
|
11
|
+
* Distributes newly minted tokens (usually to staking rewards)
|
|
12
|
+
|
|
13
|
+
On ZigChain, this module defines how **`uzig`** is issued over time.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Important Terminology
|
|
18
|
+
|
|
19
|
+
### Inflation
|
|
20
|
+
|
|
21
|
+
The annual rate at which new tokens are created.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
0.0152 → 1.52% yearly inflation
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Annual Provisions
|
|
32
|
+
|
|
33
|
+
The total number of tokens minted per year at the current inflation rate.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### Mint Denom
|
|
38
|
+
|
|
39
|
+
The base token denomination used for minting.
|
|
40
|
+
|
|
41
|
+
On ZigChain:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
uzig
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### Goal Bonded
|
|
50
|
+
|
|
51
|
+
Target percentage of total supply that should be staked (bonded).
|
|
52
|
+
|
|
53
|
+
The inflation rate adjusts to move toward this target.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### Blocks Per Year
|
|
58
|
+
|
|
59
|
+
Estimated number of blocks produced annually.
|
|
60
|
+
Used to calculate per-block minting rewards.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# Setup
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import {
|
|
68
|
+
ChainMintApi,
|
|
69
|
+
getNetworkEndpoints,
|
|
70
|
+
Network,
|
|
71
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
72
|
+
|
|
73
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
74
|
+
const mintApi = new ChainMintApi(endpoints)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
# 1️⃣ fetchInflation
|
|
80
|
+
|
|
81
|
+
## Method
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
async fetchInflation()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## CLI Equivalent
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
zigchaind query mint inflation
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Description
|
|
94
|
+
|
|
95
|
+
Fetches the **current annual inflation rate** of the chain.
|
|
96
|
+
|
|
97
|
+
Inflation determines how many new tokens are created each year.
|
|
98
|
+
|
|
99
|
+
## Parameters
|
|
100
|
+
|
|
101
|
+
None.
|
|
102
|
+
|
|
103
|
+
## Usage Example
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
const inflation = await mintApi.fetchInflation()
|
|
107
|
+
console.log(inflation)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Example Response
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"inflation": "0.015253209212607990"
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Response Field Explanation
|
|
119
|
+
|
|
120
|
+
| Field | Description |
|
|
121
|
+
| --------- | --------------------------------------------- |
|
|
122
|
+
| inflation | Annual inflation rate (decimal string format) |
|
|
123
|
+
|
|
124
|
+
In this example:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
0.0152532 → 1.52532% annual inflation
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# 2️⃣ fetchAnnualProvisions
|
|
133
|
+
|
|
134
|
+
## Method
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
async fetchAnnualProvisions()
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## CLI Equivalent
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
zigchaind query mint annual-provisions
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Description
|
|
147
|
+
|
|
148
|
+
Fetches the **total amount of tokens minted per year** at the current inflation rate.
|
|
149
|
+
|
|
150
|
+
## Parameters
|
|
151
|
+
|
|
152
|
+
None.
|
|
153
|
+
|
|
154
|
+
## Usage Example
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
const annualProvisions = await mintApi.fetchAnnualProvisions()
|
|
158
|
+
console.log(annualProvisions)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Example Response
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"annual_provisions": "35437230683581.300264112982799590"
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Response Field Explanation
|
|
170
|
+
|
|
171
|
+
| Field | Description |
|
|
172
|
+
| ----------------- | ---------------------------------------------------------- |
|
|
173
|
+
| annual_provisions | Total tokens minted per year (string format for precision) |
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
# 3️⃣ fetchParams
|
|
179
|
+
|
|
180
|
+
## Method
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
async fetchParams()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## CLI Equivalent
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
zigchaind query mint params
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Description
|
|
193
|
+
|
|
194
|
+
Fetches the **Mint module parameters** that control inflation behavior.
|
|
195
|
+
|
|
196
|
+
These parameters define:
|
|
197
|
+
|
|
198
|
+
* Inflation boundaries
|
|
199
|
+
* Adjustment rate
|
|
200
|
+
* Target staking ratio
|
|
201
|
+
* Mint denomination
|
|
202
|
+
|
|
203
|
+
## Parameters
|
|
204
|
+
|
|
205
|
+
None.
|
|
206
|
+
|
|
207
|
+
## Usage Example
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
const params = await mintApi.fetchParams()
|
|
211
|
+
console.dir(params, { depth: null })
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Example Response
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"params": {
|
|
219
|
+
"mint_denom": "uzig",
|
|
220
|
+
"inflation_rate_change": "0.020000000000000000",
|
|
221
|
+
"inflation_max": "0.020000000000000000",
|
|
222
|
+
"inflation_min": "0.009000000000000000",
|
|
223
|
+
"goal_bonded": "0.150000000000000000",
|
|
224
|
+
"blocks_per_year": "12614400"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Response Field Explanation
|
|
230
|
+
|
|
231
|
+
| Field | Description |
|
|
232
|
+
| --------------------- | ---------------------------------------- |
|
|
233
|
+
| mint_denom | Token denomination used for minting |
|
|
234
|
+
| inflation_rate_change | Maximum annual inflation adjustment rate |
|
|
235
|
+
| inflation_max | Maximum possible inflation |
|
|
236
|
+
| inflation_min | Minimum possible inflation |
|
|
237
|
+
| goal_bonded | Target percentage of tokens staked |
|
|
238
|
+
| blocks_per_year | Estimated blocks produced per year |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
# Example (Full)
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
import {
|
|
246
|
+
ChainMintApi,
|
|
247
|
+
getNetworkEndpoints,
|
|
248
|
+
Network
|
|
249
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
250
|
+
|
|
251
|
+
async function main() {
|
|
252
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
253
|
+
const mintApi = new ChainMintApi(endpoints)
|
|
254
|
+
|
|
255
|
+
const inflation = await mintApi.fetchInflation()
|
|
256
|
+
console.log('Inflation:', inflation)
|
|
257
|
+
|
|
258
|
+
const annualProvisions = await mintApi.fetchAnnualProvisions()
|
|
259
|
+
console.log('Annual Provisions:', annualProvisions)
|
|
260
|
+
|
|
261
|
+
const params = await mintApi.fetchParams()
|
|
262
|
+
console.log('Mint Params:')
|
|
263
|
+
console.dir(params, { depth: null })
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
main()
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
package/docs/runtime.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Runtime Module
|
|
2
|
+
|
|
3
|
+
## What is the Runtime Module?
|
|
4
|
+
|
|
5
|
+
The **Runtime module** exposes configuration details about the running ZigChain node.
|
|
6
|
+
|
|
7
|
+
It does **not** return blockchain state like balances or validators.
|
|
8
|
+
|
|
9
|
+
Instead, it returns **node-level configuration settings** that define how the application behaves.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
# Setup
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import {
|
|
16
|
+
ChainRuntimeApi,
|
|
17
|
+
getNetworkEndpoints,
|
|
18
|
+
Network
|
|
19
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
20
|
+
|
|
21
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
22
|
+
const runtime = new ChainRuntimeApi(endpoints)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# 1️⃣ fetchConfig
|
|
28
|
+
|
|
29
|
+
## Method
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
async fetchConfig()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## CLI Equivalent
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
zigchaind query runtime config
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Description
|
|
42
|
+
|
|
43
|
+
Fetches the **current node runtime configuration**.
|
|
44
|
+
|
|
45
|
+
This includes:
|
|
46
|
+
|
|
47
|
+
* Minimum gas price
|
|
48
|
+
* Pruning strategy settings
|
|
49
|
+
* Halt height configuration
|
|
50
|
+
* Other core node parameters
|
|
51
|
+
|
|
52
|
+
This is **node-level configuration**, not consensus state.
|
|
53
|
+
|
|
54
|
+
## Parameters
|
|
55
|
+
|
|
56
|
+
None.
|
|
57
|
+
|
|
58
|
+
## Usage Example
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const config = await runtime.fetchConfig()
|
|
62
|
+
console.dir(config, { depth: null })
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Example Response
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"minimum_gas_price": "0.002500000000000000uzig",
|
|
70
|
+
"pruning_keep_recent": "100",
|
|
71
|
+
"pruning_interval": "10",
|
|
72
|
+
"halt_height": "0"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Response Field Explanation
|
|
77
|
+
|
|
78
|
+
| Field | Description |
|
|
79
|
+
| ------------------- | ------------------------------------------------------- |
|
|
80
|
+
| minimum_gas_price | Minimum gas price required for transactions |
|
|
81
|
+
| pruning_keep_recent | Number of recent heights to keep during pruning |
|
|
82
|
+
| pruning_interval | Interval (in blocks) between pruning operations |
|
|
83
|
+
| halt_height | Block height at which the node will stop (0 = disabled) |
|
|
84
|
+
|
|
85
|
+
### minimum_gas_price
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
0.0025uzig
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This means transactions must pay at least this gas price to be accepted by the node.
|
|
94
|
+
|
|
95
|
+
### pruning_keep_recent
|
|
96
|
+
|
|
97
|
+
Defines how many recent blocks the node keeps before pruning older state.
|
|
98
|
+
|
|
99
|
+
Lower values → smaller storage
|
|
100
|
+
Higher values → more historical data retained
|
|
101
|
+
|
|
102
|
+
### pruning_interval
|
|
103
|
+
|
|
104
|
+
How often pruning is executed (in block intervals).
|
|
105
|
+
|
|
106
|
+
### halt_height
|
|
107
|
+
|
|
108
|
+
If set to a value greater than 0, the node will automatically stop at that block height.
|
|
109
|
+
|
|
110
|
+
`0` means no automatic halt.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
# Summary
|
|
114
|
+
|
|
115
|
+
| Function | CLI Equivalent | Purpose |
|
|
116
|
+
| --------------- | -------------------------------- | ---------------------------------- |
|
|
117
|
+
| `fetchConfig()` | `zigchaind query runtime config` | Returns node runtime configuration |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|