@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
package/docs/circuit.md CHANGED
@@ -1,7 +1,50 @@
1
1
  # Circuit Module
2
2
 
3
- The **ChainCircuitApi** lets you query **account-level transaction permissions** for the circuit module.
4
- It is mainly used to check which accounts are **blocked or restricted** from sending transactions on the chain.
3
+ ## What is the Circuit Module?
4
+
5
+ The **Circuit module** provides a **transaction permission and circuit breaker** system for ZigChain.
6
+
7
+ It allows designated super-admin accounts to selectively disable specific message types on the chain — acting as an emergency brake. This is a governance and safety mechanism, not something that affects normal users under typical chain operation.
8
+
9
+ ---
10
+
11
+ ## Important Terminology
12
+
13
+ ### Circuit Breaker
14
+
15
+ A **circuit breaker** is a safety mechanism that allows authorized accounts to disable specific transaction types on the chain without requiring a full governance vote. This is used in emergency situations — for example, if a vulnerability is discovered in a particular module.
16
+
17
+ ---
18
+
19
+ ### Permission Level
20
+
21
+ Each account in the circuit module is assigned a **permission level** that defines what authority they have over circuit controls.
22
+
23
+ | Level | Description |
24
+ | ------------------- | --------------------------------------------------------------------------- |
25
+ | `LEVEL_NONE_UNSPECIFIED` | No circuit permissions — standard account |
26
+ | `LEVEL_SOME_MSGS` | Can disable a specific limited set of message types only |
27
+ | `LEVEL_ALL_MSGS` | Can disable any message type on the chain |
28
+ | `LEVEL_SUPER_ADMIN` | Full control — can disable messages and grant/revoke permissions to others |
29
+
30
+ ---
31
+
32
+ ### Limit Type URLs
33
+
34
+ When a permission level is `LEVEL_SOME_MSGS`, the `limit_type_urls` field specifies exactly which message types that account is authorized to circuit-break.
35
+
36
+ An empty `limit_type_urls` combined with `LEVEL_SUPER_ADMIN` means the account has **unrestricted** circuit breaker authority — no specific limits apply.
37
+
38
+ Example of a type URL:
39
+ ```
40
+ /cosmos.bank.v1beta1.MsgSend
41
+ ```
42
+
43
+ ---
44
+
45
+ ### Disabled List
46
+
47
+ The set of message type URLs that are currently disabled (circuit-broken) on the chain. Any transaction containing a disabled message type will be rejected until the circuit is reset.
5
48
 
6
49
  ---
7
50
 
@@ -16,78 +59,164 @@ import {
16
59
 
17
60
  const endpoints = getNetworkEndpoints(Network.Testnet)
18
61
  const circuitApi = new ChainCircuitApi(endpoints)
62
+
63
+ const address = 'zig15yk64u7zc9g9k2yr2wmzeva5qgwxps6y8c2amk'
19
64
  ```
20
65
 
21
66
  ---
22
67
 
23
- ## `getAccountPermissions`
68
+ # 1️⃣ getAccountPermissions
24
69
 
25
- Fetch the **circuit permissions for a specific account**.
70
+ ## Method
71
+
72
+ ```ts
73
+ async getAccountPermissions(address: string)
74
+ ```
26
75
 
27
- **CLI equivalent**
76
+ ## CLI Equivalent
28
77
 
29
78
  ```bash
30
79
  zigchaind query circuit account <address>
31
80
  ```
32
81
 
33
- **Method**
82
+ ## Description
83
+
84
+ Fetches the **circuit breaker permissions** assigned to a specific account.
85
+
86
+ This tells you what level of circuit authority an account holds and, if applicable, which message types they are restricted to controlling. Most regular accounts will have no circuit permissions at all — only specifically designated addresses will appear in the circuit module with elevated levels.
87
+
88
+ ## Parameters
89
+
90
+ | Name | Type | Description |
91
+ | ------- | ------ | ----------------------------------------------------- |
92
+ | address | string | Bech32 address of the account to query permissions for |
93
+
94
+ ## Usage Example
34
95
 
35
96
  ```ts
36
- getAccountPermissions(address: string)
97
+ const account = await circuitApi.getAccountPermissions(address)
98
+ console.dir(account, { depth: null })
37
99
  ```
38
100
 
39
- **Parameters**
101
+ ## Example Response
40
102
 
41
- * `address: string` – The account address to query.
103
+ ```json
104
+ {
105
+ "permission": {
106
+ "level": "LEVEL_SUPER_ADMIN",
107
+ "limit_type_urls": []
108
+ }
109
+ }
110
+ ```
42
111
 
43
- **Returns**
112
+ ## Response Field Explanation
44
113
 
45
- * `CircuitAccountResponse` – Contains whether the account is blocked or restricted.
114
+ ### `permission`
46
115
 
47
- **Example**
116
+ | Field | Description |
117
+ | ---------------- | --------------------------------------------------------------------------------- |
118
+ | level | Permission level assigned to this account |
119
+ | limit_type_urls | Specific message type URLs this account can circuit-break. Empty if unrestricted |
48
120
 
49
- ```ts
50
- const address = 'zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5'
51
- const permissions = await circuitApi.getAccountPermissions(address)
52
- console.log(`Circuit permissions for ${address}:`)
53
- console.dir(permissions, { depth: null })
54
- ```
121
+ ### Permission Level Values
122
+
123
+ | Value | Meaning |
124
+ | ------------------------ | -------------------------------------------------------------------- |
125
+ | `LEVEL_NONE_UNSPECIFIED` | No circuit permissions |
126
+ | `LEVEL_SOME_MSGS` | Can only circuit-break the specific types listed in `limit_type_urls` |
127
+ | `LEVEL_ALL_MSGS` | Can circuit-break any message type |
128
+ | `LEVEL_SUPER_ADMIN` | Full authority — can circuit-break messages and manage permissions |
129
+
130
+ > In the example above, `LEVEL_SUPER_ADMIN` with an empty `limit_type_urls` means this account has unrestricted circuit breaker authority over the entire chain.
131
+
132
+ ## When to Use
133
+
134
+ * Verifying whether a specific address holds circuit breaker authority
135
+ * Auditing which accounts can perform emergency interventions
136
+ * Security reviews of chain admin key holders
137
+ * Building governance monitoring tools
55
138
 
56
139
  ---
57
140
 
58
- ## `getAllAccountPermissions`
141
+ # 2️⃣ getAllAccountPermissions
142
+
143
+ ## Method
59
144
 
60
- Fetch **all accounts with circuit restrictions or permissions**.
145
+ ```ts
146
+ async getAllAccountPermissions()
147
+ ```
61
148
 
62
- **CLI equivalent**
149
+ ## CLI Equivalent
63
150
 
64
151
  ```bash
65
152
  zigchaind query circuit accounts
66
153
  ```
67
154
 
68
- **Method**
155
+ ## Description
69
156
 
70
- ```ts
71
- getAllAccountPermissions()
72
- ```
157
+ Fetches **all accounts** that have been assigned circuit breaker permissions on the chain.
158
+
159
+ On ZigChain testnet, only one account currently holds circuit permissions (`LEVEL_SUPER_ADMIN`). This reflects the typical setup where circuit authority is granted to a small number of trusted admin addresses for emergency use.
73
160
 
74
- **Returns**
161
+ ## Parameters
75
162
 
76
- * `CircuitAccountsResponse` – Contains a list of all accounts and their circuit permission status.
163
+ None.
77
164
 
78
- **Example**
165
+ ## Usage Example
79
166
 
80
167
  ```ts
81
- const allPermissions = await circuitApi.getAllAccountPermissions()
82
- console.log('All accounts with circuit permissions:')
83
- console.dir(allPermissions, { depth: null })
168
+ const accounts = await circuitApi.getAllAccountPermissions()
169
+ console.dir(accounts, { depth: null })
84
170
  ```
85
171
 
86
- ---
172
+ ## Example Response
173
+
174
+ ```json
175
+ {
176
+ "accounts": [
177
+ {
178
+ "address": "zig15yk64u7zc9g9k2yr2wmzeva5qgwxps6y8c2amk",
179
+ "permissions": {
180
+ "level": "LEVEL_SUPER_ADMIN",
181
+ "limit_type_urls": []
182
+ }
183
+ }
184
+ ],
185
+ "pagination": {
186
+ "next_key": null,
187
+ "total": "1"
188
+ }
189
+ }
190
+ ```
191
+
192
+ ## Response Field Explanation
87
193
 
88
- ## Notes
194
+ ### `accounts`
89
195
 
90
- * Useful for **auditing and monitoring** restricted accounts.
91
- * The `getAllAccountPermissions` method may return large datasets if many accounts are restricted.
196
+ Array of all accounts holding circuit breaker permissions.
92
197
 
198
+ Each entry contains:
93
199
 
200
+ | Field | Description |
201
+ | --------------------------- | ------------------------------------------------------------------------ |
202
+ | address | Bech32 address of the account with circuit permissions |
203
+ | permissions.level | Permission level assigned to this account |
204
+ | permissions.limit_type_urls | Message types this account can control. Empty if unrestricted |
205
+
206
+ ### `pagination`
207
+
208
+ | Field | Description |
209
+ | -------- | -------------------------------------------------------------------- |
210
+ | next_key | Cursor for next page. `null` if all results are returned |
211
+ | total | Total number of accounts with circuit permissions on the chain |
212
+
213
+ > On ZigChain testnet, `total` is `"1"` — only one super admin account exists. A healthy, normally-operating chain will typically have a very small number of circuit-permissioned accounts.
214
+
215
+ ## When to Use
216
+
217
+ * Full audit of all accounts with emergency chain intervention authority
218
+ * Verifying the complete set of circuit admins
219
+ * Chain governance and security dashboards
220
+ * Monitoring for unexpected changes to the circuit permission list
221
+
222
+ ---