@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.
- package/README.md +1 -1
- package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
- package/dist/circuit/ChainCircuitApi.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.map +1 -1
- package/dist/distribution/ChainDistributionApi.js +0 -1
- package/dist/distribution/ChainDistributionApi.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- 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/upgrade/ChainUpgradeApi.d.ts.map +1 -1
- 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/docs/block.md +325 -38
- package/docs/circuit.md +164 -35
- package/docs/dex.md +313 -63
- package/docs/distribution.md +664 -93
- package/docs/evidence.md +117 -122
- package/docs/factory.md +308 -62
- package/docs/gov.md +268 -70
- package/docs/ibc/ibcChannel.md +736 -249
- package/docs/ibc/ibcClient.md +608 -139
- package/docs/ibc-transfer.md +349 -90
- package/docs/interchain-accounts.md +151 -48
- package/docs/mint.md +173 -36
- package/docs/runtime.md +81 -42
- package/docs/slashing.md +209 -61
- package/docs/staking.md +534 -411
- package/docs/tokenwrapper.md +221 -64
- package/docs/txs.md +447 -0
- package/docs/upgrade.md +281 -58
- package/docs/validator-set.md +177 -0
- package/package.json +1 -1
- package/docs/comet-validator-set.md +0 -70
package/docs/circuit.md
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
# Circuit Module
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
68
|
+
# 1️⃣ getAccountPermissions
|
|
24
69
|
|
|
25
|
-
|
|
70
|
+
## Method
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
async getAccountPermissions(address: string)
|
|
74
|
+
```
|
|
26
75
|
|
|
27
|
-
|
|
76
|
+
## CLI Equivalent
|
|
28
77
|
|
|
29
78
|
```bash
|
|
30
79
|
zigchaind query circuit account <address>
|
|
31
80
|
```
|
|
32
81
|
|
|
33
|
-
|
|
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
|
|
97
|
+
const account = await circuitApi.getAccountPermissions(address)
|
|
98
|
+
console.dir(account, { depth: null })
|
|
37
99
|
```
|
|
38
100
|
|
|
39
|
-
|
|
101
|
+
## Example Response
|
|
40
102
|
|
|
41
|
-
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"permission": {
|
|
106
|
+
"level": "LEVEL_SUPER_ADMIN",
|
|
107
|
+
"limit_type_urls": []
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
42
111
|
|
|
43
|
-
|
|
112
|
+
## Response Field Explanation
|
|
44
113
|
|
|
45
|
-
|
|
114
|
+
### `permission`
|
|
46
115
|
|
|
47
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
141
|
+
# 2️⃣ getAllAccountPermissions
|
|
142
|
+
|
|
143
|
+
## Method
|
|
59
144
|
|
|
60
|
-
|
|
145
|
+
```ts
|
|
146
|
+
async getAllAccountPermissions()
|
|
147
|
+
```
|
|
61
148
|
|
|
62
|
-
|
|
149
|
+
## CLI Equivalent
|
|
63
150
|
|
|
64
151
|
```bash
|
|
65
152
|
zigchaind query circuit accounts
|
|
66
153
|
```
|
|
67
154
|
|
|
68
|
-
|
|
155
|
+
## Description
|
|
69
156
|
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
161
|
+
## Parameters
|
|
75
162
|
|
|
76
|
-
|
|
163
|
+
None.
|
|
77
164
|
|
|
78
|
-
|
|
165
|
+
## Usage Example
|
|
79
166
|
|
|
80
167
|
```ts
|
|
81
|
-
const
|
|
82
|
-
console.
|
|
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
|
-
|
|
194
|
+
### `accounts`
|
|
89
195
|
|
|
90
|
-
|
|
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
|
+
---
|