@zuhaibnoor/zigchain-sdk 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
  3. package/dist/circuit/ChainCircuitApi.js.map +1 -1
  4. package/dist/dex/ChainDexApi.d.ts.map +1 -1
  5. package/dist/dex/ChainDexApi.js.map +1 -1
  6. package/dist/distribution/ChainDistributionApi.d.ts.map +1 -1
  7. package/dist/distribution/ChainDistributionApi.js +0 -1
  8. package/dist/distribution/ChainDistributionApi.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/staking/ChainStakingApi.d.ts +1 -5
  14. package/dist/staking/ChainStakingApi.d.ts.map +1 -1
  15. package/dist/staking/ChainStakingApi.js +9 -7
  16. package/dist/staking/ChainStakingApi.js.map +1 -1
  17. package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -1
  18. package/dist/validator-set/ChainValidator.d.ts +8 -0
  19. package/dist/validator-set/ChainValidator.d.ts.map +1 -0
  20. package/dist/validator-set/ChainValidator.js +15 -0
  21. package/dist/validator-set/ChainValidator.js.map +1 -0
  22. package/docs/block.md +325 -38
  23. package/docs/circuit.md +164 -35
  24. package/docs/dex.md +313 -63
  25. package/docs/distribution.md +664 -93
  26. package/docs/evidence.md +117 -122
  27. package/docs/factory.md +308 -62
  28. package/docs/gov.md +268 -70
  29. package/docs/ibc/ibcChannel.md +736 -249
  30. package/docs/ibc/ibcClient.md +608 -139
  31. package/docs/ibc-transfer.md +349 -90
  32. package/docs/interchain-accounts.md +151 -48
  33. package/docs/mint.md +173 -36
  34. package/docs/runtime.md +81 -42
  35. package/docs/slashing.md +209 -61
  36. package/docs/staking.md +534 -411
  37. package/docs/tokenwrapper.md +221 -64
  38. package/docs/txs.md +447 -0
  39. package/docs/upgrade.md +281 -58
  40. package/docs/validator-set.md +177 -0
  41. package/package.json +1 -1
  42. package/docs/comet-validator-set.md +0 -70
@@ -1,21 +1,69 @@
1
- # Interchain Accounts (ICA) Module
1
+ # Interchain Accounts
2
+
3
+ ## What are Interchain Accounts?
2
4
 
3
- The **Interchain Accounts (ICA) module** allows one blockchain to control an account on another blockchain through IBC.
5
+ The **Interchain Accounts (ICA)** allow one blockchain to control an account on another blockchain using IBC.
4
6
 
5
- It enables:
7
+ This enables:
6
8
 
7
9
  * Remote account creation
8
10
  * Cross-chain transaction execution
9
- * Programmatic interaction between chains
10
11
 
11
- This module has two parts:
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
12
41
 
13
- * **Controller** The chain initiating control
14
- * **Host** → The chain hosting the remote account
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
15
61
 
16
62
  ---
17
63
 
18
- # Setup
64
+ # Functions Documentation
65
+
66
+ ## Setup
19
67
 
20
68
  ```ts
21
69
  import {
@@ -30,91 +78,146 @@ const icaApi = new ChainInterchainAccountsApi(endpoints)
30
78
 
31
79
  ---
32
80
 
33
- ## `fetchControllerParams()`
81
+ # 1️⃣ fetchControllerParams
82
+
83
+ ## Method
34
84
 
35
85
  ```ts
36
- fetchControllerParams()
86
+ async fetchControllerParams()
37
87
  ```
38
88
 
39
- ### What it does
89
+ ## CLI Equivalent
40
90
 
41
- Fetches the **current parameters** of the ICA Controller submodule.
91
+ ```bash
92
+ zigchaind query interchain-accounts controller params
93
+ ```
42
94
 
43
- The controller is responsible for:
95
+ ## Description
44
96
 
45
- * Creating interchain accounts
46
- * Sending transactions to remote chains
47
- * Managing cross-chain account control
97
+ Fetches the **ICA Controller module parameters**.
48
98
 
49
- ---
99
+ These parameters define whether the chain is allowed to:
50
100
 
51
- ### CLI Equivalent
101
+ * Create interchain accounts
102
+ * Send remote execution transactions
52
103
 
53
- ```bash
54
- zigchaind query interchain-accounts controller params
55
- ```
104
+ ## Parameters
56
105
 
57
- ---
106
+ None.
58
107
 
59
- ### Example
108
+ ## Usage Example
60
109
 
61
110
  ```ts
62
111
  const controllerParams = await icaApi.fetchControllerParams()
63
112
  console.dir(controllerParams, { depth: null })
64
113
  ```
65
114
 
66
- ---
67
-
68
- ## `fetchHostParams()`
115
+ ## Example Response
69
116
 
70
- ```ts
71
- fetchHostParams()
117
+ ```json
118
+ {
119
+ "params": {
120
+ "controller_enabled": true
121
+ }
122
+ }
72
123
  ```
73
124
 
74
- ### What it does
125
+ ## Response Field Explanation
126
+
127
+ ### `params`
75
128
 
76
- Fetches the **current parameters** of the ICA Host submodule.
129
+ | Field | Description |
130
+ | ------------------ | ----------------------------------------------------------------------- |
131
+ | controller_enabled | Indicates whether ICA controller functionality is enabled on this chain |
77
132
 
78
- The host is responsible for:
133
+ If `false`, the chain cannot initiate interchain accounts.
79
134
 
80
- * Receiving interchain account requests
81
- * Executing transactions on behalf of remote controllers
82
- * Managing allowed message types
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
83
141
 
84
142
  ---
85
143
 
86
- ### CLI Equivalent
144
+ # 2️⃣ fetchHostParams
145
+
146
+ ## Method
147
+
148
+ ```ts
149
+ async fetchHostParams()
150
+ ```
151
+
152
+ ## CLI Equivalent
87
153
 
88
154
  ```bash
89
155
  zigchaind query interchain-accounts host params
90
156
  ```
91
157
 
92
- ---
158
+ ## Description
159
+
160
+ Fetches the **ICA Host module parameters**.
161
+
162
+ These parameters define:
93
163
 
94
- ### Example
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
95
172
 
96
173
  ```ts
97
174
  const hostParams = await icaApi.fetchHostParams()
98
175
  console.dir(hostParams, { depth: null })
99
176
  ```
100
177
 
101
- ---
178
+ ## Example Response
102
179
 
103
- # Interchain Accounts
180
+ ```json
181
+ {
182
+ "params": {
183
+ "host_enabled": true,
184
+ "allow_messages": ["*"]
185
+ }
186
+ }
187
+ ```
104
188
 
105
- Interchain Accounts allow one chain to control an account on another chain.
189
+ ## Response Field Explanation
106
190
 
107
- Example:
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 |
108
197
 
109
- * ZigChain (Controller)
110
- * Another IBC chain (Host)
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:
111
212
 
112
- ZigChain can:
213
+ * ZigChain = Controller
214
+ * Another chain = Host
113
215
 
114
- * Create an account on the host chain
115
- * Send transactions to be executed there
116
- * Manage funds remotely
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
117
220
 
118
- This makes advanced cross-chain applications possible.
221
+ From the host chain’s perspective, it looks like a normal account submitting transactions — but it is controlled remotely.
119
222
 
120
223
  ---
package/docs/mint.md CHANGED
@@ -1,11 +1,67 @@
1
1
  # Mint Module
2
2
 
3
- The **ChainMintApi** lets you query minting-related data.
4
- It is used to fetch **inflation**, **annual token provisions**, and **mint module parameters**.
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
+ ```
5
46
 
6
47
  ---
7
48
 
8
- ## Setup
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
9
65
 
10
66
  ```ts
11
67
  import {
@@ -14,88 +70,176 @@ import {
14
70
  Network,
15
71
  } from '@zuhaibnoor/zigchain-sdk'
16
72
 
17
- cosnt endpoints = getNetworkEndpoints(Network.Testnet)
73
+ const endpoints = getNetworkEndpoints(Network.Testnet)
18
74
  const mintApi = new ChainMintApi(endpoints)
19
75
  ```
20
76
 
21
77
  ---
22
78
 
23
- ## `fetchInflation`
79
+ # 1️⃣ fetchInflation
80
+
81
+ ## Method
24
82
 
25
- Fetch the **current inflation rate** of the chain.
83
+ ```ts
84
+ async fetchInflation()
85
+ ```
26
86
 
27
- **CLI equivalent**
87
+ ## CLI Equivalent
28
88
 
29
89
  ```bash
30
90
  zigchaind query mint inflation
31
91
  ```
32
92
 
33
- **Method**
93
+ ## Description
34
94
 
35
- ```ts
36
- fetchInflation()
37
- ```
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.
38
102
 
39
- **Example**
103
+ ## Usage Example
40
104
 
41
105
  ```ts
42
106
  const inflation = await mintApi.fetchInflation()
43
107
  console.log(inflation)
44
108
  ```
45
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
+
46
130
  ---
47
131
 
48
- ## `fetchAnnualProvisions`
132
+ # 2️⃣ fetchAnnualProvisions
49
133
 
50
- Fetch the **annual provisions**, i.e. the total number of tokens minted per year.
134
+ ## Method
51
135
 
52
- **CLI equivalent**
136
+ ```ts
137
+ async fetchAnnualProvisions()
138
+ ```
139
+
140
+ ## CLI Equivalent
53
141
 
54
142
  ```bash
55
143
  zigchaind query mint annual-provisions
56
144
  ```
57
145
 
58
- **Method**
146
+ ## Description
59
147
 
60
- ```ts
61
- fetchAnnualProvisions()
62
- ```
148
+ Fetches the **total amount of tokens minted per year** at the current inflation rate.
149
+
150
+ ## Parameters
63
151
 
64
- **Example**
152
+ None.
153
+
154
+ ## Usage Example
65
155
 
66
156
  ```ts
67
157
  const annualProvisions = await mintApi.fetchAnnualProvisions()
68
158
  console.log(annualProvisions)
69
159
  ```
70
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
+
71
176
  ---
72
177
 
73
- ## `fetchParams`
178
+ # 3️⃣ fetchParams
74
179
 
75
- Fetch the **mint module parameters**.
180
+ ## Method
181
+
182
+ ```ts
183
+ async fetchParams()
184
+ ```
76
185
 
77
- **CLI equivalent**
186
+ ## CLI Equivalent
78
187
 
79
188
  ```bash
80
189
  zigchaind query mint params
81
190
  ```
82
191
 
83
- **Method**
192
+ ## Description
84
193
 
85
- ```ts
86
- fetchParams()
87
- ```
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
88
202
 
89
- **Example**
203
+ ## Parameters
204
+
205
+ None.
206
+
207
+ ## Usage Example
90
208
 
91
209
  ```ts
92
210
  const params = await mintApi.fetchParams()
93
211
  console.dir(params, { depth: null })
94
212
  ```
95
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
+
96
240
  ---
97
241
 
98
- ## Example (Full)
242
+ # Example (Full)
99
243
 
100
244
  ```ts
101
245
  import {
@@ -124,10 +268,3 @@ main()
124
268
 
125
269
  ---
126
270
 
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 CHANGED
@@ -1,33 +1,15 @@
1
1
  # Runtime Module
2
2
 
3
- ## Overview
3
+ ## What is the Runtime Module?
4
4
 
5
- The **Runtime module** provides information about the **running ZigChain application itself**, not about accounts, balances, validators, or governance.
5
+ The **Runtime module** exposes configuration details about the running ZigChain node.
6
6
 
7
- It allows you to:
7
+ It does **not** return blockchain state like balances or validators.
8
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.
9
+ Instead, it returns **node-level configuration settings** that define how the application behaves.
16
10
 
17
11
  ---
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
12
+ # Setup
31
13
 
32
14
  ```ts
33
15
  import {
@@ -42,40 +24,97 @@ const runtime = new ChainRuntimeApi(endpoints)
42
24
 
43
25
  ---
44
26
 
45
- ## `fetchConfig()`
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
+ ```
46
40
 
47
- ### Purpose
41
+ ## Description
48
42
 
49
- Fetches the **current runtime configuration** of the ZigChain node.
43
+ Fetches the **current node runtime configuration**.
50
44
 
51
- This includes application-level configuration such as:
45
+ This includes:
52
46
 
53
- * API settings
54
- * gRPC settings
55
- * pruning options
56
- * minimum gas prices
57
- * other node runtime parameters
47
+ * Minimum gas price
48
+ * Pruning strategy settings
49
+ * Halt height configuration
50
+ * Other core node parameters
58
51
 
59
- ### Usage Example
52
+ This is **node-level configuration**, not consensus state.
53
+
54
+ ## Parameters
55
+
56
+ None.
57
+
58
+ ## Usage Example
60
59
 
61
60
  ```ts
62
61
  const config = await runtime.fetchConfig()
63
62
  console.dir(config, { depth: null })
64
63
  ```
65
64
 
66
- ### When to use
65
+ ## Example Response
67
66
 
68
- * Debug node behavior
69
- * Verify network configuration
70
- * Inspect gas, API, or service settings
67
+ ```json
68
+ {
69
+ "minimum_gas_price": "0.002500000000000000uzig",
70
+ "pruning_keep_recent": "100",
71
+ "pruning_interval": "10",
72
+ "halt_height": "0"
73
+ }
74
+ ```
71
75
 
72
- ---
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
73
96
 
97
+ Defines how many recent blocks the node keeps before pruning older state.
74
98
 
75
- ## Summary Table
99
+ Lower values → smaller storage
100
+ Higher values → more historical data retained
76
101
 
77
- | Function | CLI Command | Description |
78
- | --------------------------- | ------------------------------------ | -------------------------------------------------------------- |
79
- | `fetchConfig()` | `zigchaind query runtime config` | Fetches the current node and application runtime configuration |
102
+ ### pruning_interval
80
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
+ ---
81
120