@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,137 @@
|
|
|
1
|
+
# Token Wrapper Module
|
|
2
|
+
|
|
3
|
+
The **Token Wrapper module** keeps track of ZIG tokens that move **out of ZigChain to other blockchains** and come **back again**.
|
|
4
|
+
It helps the chain maintain balance by **locking tokens when they leave** and **unlocking them when they return**, so no extra tokens are ever created.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## How Token Wrapping Works (Simple Explanation)
|
|
9
|
+
|
|
10
|
+
1. You send **ZIG tokens out of ZigChain**
|
|
11
|
+
2. Those ZIG tokens are **locked** on ZigChain
|
|
12
|
+
3. You receive **wrapped ZIG** on another chain
|
|
13
|
+
4. If wrapped ZIG comes back:
|
|
14
|
+
|
|
15
|
+
* Wrapped tokens are **destroyed**
|
|
16
|
+
* Original ZIG tokens are **unlocked**
|
|
17
|
+
|
|
18
|
+
If wrapped ZIG is **spent on the other chain and never returned**,
|
|
19
|
+
the corresponding ZIG **remains locked forever** on ZigChain.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import {
|
|
27
|
+
ChainTokenWrapperApi,
|
|
28
|
+
getNetworkEndpoints,
|
|
29
|
+
Network
|
|
30
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
31
|
+
|
|
32
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
33
|
+
const tokenWrapperApi = new ChainTokenWrapperApi(endpoints)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## `fetchModuleInfo`
|
|
39
|
+
|
|
40
|
+
Returns basic information about the Token Wrapper module.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
**Method**
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
fetchModuleInfo()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Example**
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const info = await tokenWrapperApi.fetchModuleInfo()
|
|
53
|
+
console.log(info)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Use case**
|
|
57
|
+
|
|
58
|
+
* Verify that the Token Wrapper module is available and active on the chain
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## `fetchParams`
|
|
63
|
+
|
|
64
|
+
Fetches the **configuration parameters** of the Token Wrapper module.
|
|
65
|
+
|
|
66
|
+
**Method**
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
fetchParams()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Example**
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const params = await tokenWrapperApi.fetchParams()
|
|
76
|
+
console.log(params)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Use case**
|
|
80
|
+
|
|
81
|
+
* Check whether token wrapping is enabled
|
|
82
|
+
* Inspect module behavior settings
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## `fetchTotalTransfers`
|
|
87
|
+
|
|
88
|
+
Returns the **total amount of ZIG tokens**:
|
|
89
|
+
|
|
90
|
+
* Sent **out of ZigChain**
|
|
91
|
+
* Returned **back to ZigChain**
|
|
92
|
+
|
|
93
|
+
**Method**
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
fetchTotalTransfers()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Example**
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
const totals = await tokenWrapperApi.fetchTotalTransfers()
|
|
103
|
+
console.log(totals)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**What this tells you**
|
|
107
|
+
|
|
108
|
+
* How much ZIG is currently **locked**
|
|
109
|
+
* How much ZIG has **returned**
|
|
110
|
+
* Helps audit cross-chain token movement
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Real-World Example
|
|
115
|
+
|
|
116
|
+
* You send **10 ZIG** out of ZigChain
|
|
117
|
+
* ZigChain **locks 10 ZIG**
|
|
118
|
+
* You receive **10 wrapped ZIG** on another chain
|
|
119
|
+
* You spend **5 wrapped ZIG**
|
|
120
|
+
* You return **5 wrapped ZIG** back
|
|
121
|
+
|
|
122
|
+
Result:
|
|
123
|
+
|
|
124
|
+
* **5 ZIG unlocked and returned**
|
|
125
|
+
* **5 ZIG remain locked forever** (because they were spent)
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Summary Table
|
|
130
|
+
|
|
131
|
+
| Function | Purpose |
|
|
132
|
+
| --------------------- | ----------------------------------------------- |
|
|
133
|
+
| `fetchModuleInfo` | Shows basic info about the Token Wrapper module |
|
|
134
|
+
| `fetchParams` | Displays module configuration settings |
|
|
135
|
+
| `fetchTotalTransfers` | Shows total ZIG moved out and returned |
|
|
136
|
+
|
|
137
|
+
|
package/docs/txs.md
ADDED
|
File without changes
|
package/docs/upgrade.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Upgrade Module
|
|
2
|
+
|
|
3
|
+
The **ChainUpgradeApi** lets you query on-chain upgrade information.
|
|
4
|
+
|
|
5
|
+
It is used to fetch the **current upgrade plan**, **upgrade authority**, and **module versions**, which helps track scheduled chain upgrades and module migration states.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
ChainUpgradeApi,
|
|
14
|
+
getNetworkEndpoints,
|
|
15
|
+
Network,
|
|
16
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
17
|
+
|
|
18
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
19
|
+
const upgradeApi = new ChainUpgradeApi(endpoints)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## `fetchCurrentPlan()`
|
|
25
|
+
|
|
26
|
+
Fetch the **currently scheduled upgrade plan** (if one exists).
|
|
27
|
+
|
|
28
|
+
**CLI equivalent**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
zigchaind query upgrade plan
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Method**
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
fetchCurrentPlan()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Example**
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const plan = await upgradeApi.fetchCurrentPlan()
|
|
44
|
+
console.dir(plan, { depth: null })
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## `fetchAuthority()`
|
|
50
|
+
|
|
51
|
+
Fetch the **upgrade authority address**.
|
|
52
|
+
|
|
53
|
+
This is typically the governance module account that has permission to schedule upgrades.
|
|
54
|
+
|
|
55
|
+
**CLI equivalent**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
zigchaind query upgrade authority
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Method**
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
fetchAuthority()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Example**
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const authority = await upgradeApi.fetchAuthority()
|
|
71
|
+
console.log(authority)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## `fetchModuleVersions()`
|
|
77
|
+
|
|
78
|
+
Fetch the **module consensus versions** currently running on-chain.
|
|
79
|
+
|
|
80
|
+
This is useful during upgrades to verify module migrations.
|
|
81
|
+
|
|
82
|
+
**CLI equivalent**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
zigchaind query upgrade module-versions
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Method**
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
fetchModuleVersions()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Example**
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const versions = await upgradeApi.fetchModuleVersions()
|
|
98
|
+
console.dir(versions, { depth: null })
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Example (Full)
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import {
|
|
107
|
+
ChainUpgradeApi,
|
|
108
|
+
getNetworkEndpoints,
|
|
109
|
+
Network
|
|
110
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
111
|
+
|
|
112
|
+
async function main() {
|
|
113
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
114
|
+
const upgradeApi = new ChainUpgradeApi(endpoints)
|
|
115
|
+
|
|
116
|
+
console.log('--- Current Upgrade Plan ---')
|
|
117
|
+
const plan = await upgradeApi.fetchCurrentPlan()
|
|
118
|
+
console.dir(plan, { depth: null })
|
|
119
|
+
|
|
120
|
+
console.log('\n--- Upgrade Authority ---')
|
|
121
|
+
const authority = await upgradeApi.fetchAuthority()
|
|
122
|
+
console.log(authority)
|
|
123
|
+
|
|
124
|
+
console.log('\n--- Module Versions ---')
|
|
125
|
+
const versions = await upgradeApi.fetchModuleVersions()
|
|
126
|
+
console.dir(versions, { depth: null })
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
main()
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|