@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,294 @@
|
|
|
1
|
+
# Token Wrapper Module
|
|
2
|
+
|
|
3
|
+
## What is the Token Wrapper Module?
|
|
4
|
+
|
|
5
|
+
The **Token Wrapper module** is a ZigChain module that handles **wrapping and unwrapping tokens** transferred via IBC.
|
|
6
|
+
|
|
7
|
+
It acts as a controlled gateway between ZigChain and a counterparty chain. Tokens that arrive via IBC are held by the module and a corresponding wrapped representation is issued on ZigChain. When tokens are sent back out, the wrapped tokens are burned and the originals are released.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Important Terminology
|
|
12
|
+
|
|
13
|
+
### Token Wrapping
|
|
14
|
+
|
|
15
|
+
The process of converting an IBC-received token into a ZigChain-native wrapped representation. The original IBC token is held in custody by the module while the wrapped version circulates on ZigChain.
|
|
16
|
+
|
|
17
|
+
### Unwrapping
|
|
18
|
+
|
|
19
|
+
The reverse process — burning the wrapped token on ZigChain and releasing the original IBC token back to the counterparty chain.
|
|
20
|
+
|
|
21
|
+
### IBC Denom
|
|
22
|
+
|
|
23
|
+
A token received via IBC has a denom in the format:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
ibc/<hash>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The hash is derived from the channel and original denom path, making each IBC token globally unique on the receiving chain.
|
|
30
|
+
|
|
31
|
+
### Native vs Counterparty
|
|
32
|
+
|
|
33
|
+
| Term | Description |
|
|
34
|
+
| ------------------- | ------------------------------------------------------- |
|
|
35
|
+
| Native (ZigChain) | ZigChain's side of the IBC connection |
|
|
36
|
+
| Counterparty | The remote chain on the other end of the IBC channel |
|
|
37
|
+
|
|
38
|
+
### IBC Channel
|
|
39
|
+
|
|
40
|
+
The specific IBC channel this module uses for transfers. Each direction has its own channel ID.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
native_channel = 'channel-0' (ZigChain's channel)
|
|
44
|
+
counterparty_channel = 'channel-612' (remote chain's channel)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Client ID
|
|
48
|
+
|
|
49
|
+
The IBC light client ID tracking the counterparty chain's state.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
native_client_id = '07-tendermint-0'
|
|
53
|
+
counterparty_client_id = '07-tendermint-1163'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Operator Address
|
|
59
|
+
|
|
60
|
+
The address authorized to manage and configure the Token Wrapper module. A `proposed_operator_address` indicates a pending operator transfer that has not yet been accepted.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### Pauser Addresses
|
|
65
|
+
|
|
66
|
+
Addresses authorized to **pause** the Token Wrapper module in an emergency. When paused, wrapping and unwrapping are disabled to protect users.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### Total Transfers
|
|
71
|
+
|
|
72
|
+
Cumulative counters tracking the total volume of tokens moved through the module in each direction since deployment.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Setup
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import {
|
|
80
|
+
ChainTokenWrapperApi,
|
|
81
|
+
getNetworkEndpoints,
|
|
82
|
+
Network,
|
|
83
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
84
|
+
|
|
85
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
86
|
+
const tokenWrapperApi = new ChainTokenWrapperApi(endpoints)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
# 1️⃣ fetchModuleInfo
|
|
92
|
+
|
|
93
|
+
## Method
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
async fetchModuleInfo()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## CLI Equivalent
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
zigchaind query tokenwrapper module-info
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Description
|
|
106
|
+
|
|
107
|
+
Fetches the **full configuration and current state** of the Token Wrapper module.
|
|
108
|
+
|
|
109
|
+
This is the most comprehensive query for this module — it returns the module's on-chain address and current token balances, the operator and pauser configuration, the IBC channel and client details connecting ZigChain to the counterparty chain, the wrapped token denom, and whether the module is currently enabled.
|
|
110
|
+
|
|
111
|
+
## Parameters
|
|
112
|
+
|
|
113
|
+
None.
|
|
114
|
+
|
|
115
|
+
## Usage Example
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const moduleInfo = await tokenWrapperApi.fetchModuleInfo()
|
|
119
|
+
console.dir(moduleInfo, { depth: null })
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Example Response
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"module_address": "zig1hdq87rzf327fwz8rw9rnmchj7qa3uxrpxds2fw",
|
|
127
|
+
"balances": [
|
|
128
|
+
{
|
|
129
|
+
"denom": "ibc/2CC0B1B7A981ACC74854717F221008484603BB8360E81B262411B0D830EDE9B0",
|
|
130
|
+
"amount": "1028"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"denom": "ibc/B6863C1B541063B17C757293EC2E45BD2984AAC8CADD5ED7EDC2DA58B99445DC",
|
|
134
|
+
"amount": "261743802259999999900"
|
|
135
|
+
},
|
|
136
|
+
{ "denom": "uzig", "amount": "20166055" }
|
|
137
|
+
],
|
|
138
|
+
"operator_address": "zig1fw7yrucw09guffffdac64c3x5yc6rtlpt0nm5a",
|
|
139
|
+
"proposed_operator_address": "zig126kn23lxurns83w2n59a7e0v2wprjdrrfv4xw8",
|
|
140
|
+
"pauser_addresses": [
|
|
141
|
+
"zig19n4c3nmegkt06e0zj0yydhppfe6pzz53y3zxlz",
|
|
142
|
+
"zig155tasjju2zne3dnnh8ns2zqqcpfuljmke8hedt"
|
|
143
|
+
],
|
|
144
|
+
"token_wrapper_enabled": true,
|
|
145
|
+
"native_client_id": "07-tendermint-0",
|
|
146
|
+
"counterparty_client_id": "07-tendermint-1163",
|
|
147
|
+
"native_port": "transfer",
|
|
148
|
+
"counterparty_port": "transfer",
|
|
149
|
+
"native_channel": "channel-0",
|
|
150
|
+
"counterparty_channel": "channel-612",
|
|
151
|
+
"denom": "unit-zig",
|
|
152
|
+
"decimal_difference": 12
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Response Field Explanation
|
|
157
|
+
|
|
158
|
+
### Module Identity and State
|
|
159
|
+
|
|
160
|
+
| Field | Description |
|
|
161
|
+
| ------------------------- | ----------------------------------------------------------------------------------- |
|
|
162
|
+
| module_address | On-chain address of the Token Wrapper module — holds IBC tokens in custody |
|
|
163
|
+
| token_wrapper_enabled | `true` if wrapping and unwrapping are currently active. `false` means paused |
|
|
164
|
+
| denom | The name of the wrapped token representation on ZigChain |
|
|
165
|
+
| decimal_difference | Decimal scaling factor between the wrapped and original token (12 = 10^12 scale) |
|
|
166
|
+
|
|
167
|
+
### `balances`
|
|
168
|
+
|
|
169
|
+
The current token holdings of the module's custody address. These are the IBC tokens being held in reserve plus any native `uzig` for operational use.
|
|
170
|
+
|
|
171
|
+
| Field | Description |
|
|
172
|
+
| ------ | --------------------------------------------------------- |
|
|
173
|
+
| denom | Token denomination (`ibc/<hash>` or native denom) |
|
|
174
|
+
| amount | Amount currently held in the module's custody account |
|
|
175
|
+
|
|
176
|
+
### Access Control
|
|
177
|
+
|
|
178
|
+
| Field | Description |
|
|
179
|
+
| ------------------------- | -------------------------------------------------------------------------------- |
|
|
180
|
+
| operator_address | Address with authority to configure the module |
|
|
181
|
+
| proposed_operator_address | Pending operator transfer — this address has been proposed but not yet accepted |
|
|
182
|
+
| pauser_addresses | Addresses that can pause the module in an emergency (2 pausers on testnet) |
|
|
183
|
+
|
|
184
|
+
### IBC Connection Configuration
|
|
185
|
+
|
|
186
|
+
| Field | Description |
|
|
187
|
+
| ----------------------- | -------------------------------------------------------------------- |
|
|
188
|
+
| native_client_id | ZigChain's IBC light client tracking the counterparty chain |
|
|
189
|
+
| counterparty_client_id | Counterparty chain's IBC light client tracking ZigChain |
|
|
190
|
+
| native_port | IBC port on ZigChain's side (always `transfer`) |
|
|
191
|
+
| counterparty_port | IBC port on the counterparty chain's side (always `transfer`) |
|
|
192
|
+
| native_channel | ZigChain's IBC channel ID for this connection (`channel-0`) |
|
|
193
|
+
| counterparty_channel | Counterparty chain's IBC channel ID (`channel-612`) |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
# 2️⃣ fetchParams
|
|
198
|
+
|
|
199
|
+
## Method
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
async fetchParams()
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## CLI Equivalent
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
zigchaind query tokenwrapper params
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Description
|
|
212
|
+
|
|
213
|
+
Fetches the **Token Wrapper module parameters**.
|
|
214
|
+
|
|
215
|
+
On ZigChain testnet, the params object is currently empty — all configuration is managed directly through the module info rather than a separate params structure. This endpoint is included for completeness and forward compatibility as the module evolves.
|
|
216
|
+
|
|
217
|
+
## Parameters
|
|
218
|
+
|
|
219
|
+
None.
|
|
220
|
+
|
|
221
|
+
## Usage Example
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
const params = await tokenWrapperApi.fetchParams()
|
|
225
|
+
console.dir(params, { depth: null })
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Example Response
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"params": {}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Response Field Explanation
|
|
237
|
+
|
|
238
|
+
| Field | Description |
|
|
239
|
+
| ------ | ------------------------------------------------------------------------ |
|
|
240
|
+
| params | Module parameter object. Currently empty on ZigChain testnet |
|
|
241
|
+
|
|
242
|
+
> The Token Wrapper module's operational configuration (channel IDs, operator address, pauser addresses, enabled state) is stored directly in module state and returned by `fetchModuleInfo`. The `params` endpoint is reserved for governance-controlled parameters that may be added in future module versions.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
# 3️⃣ fetchTotalTransfers
|
|
247
|
+
|
|
248
|
+
## Method
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
async fetchTotalTransfers()
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## CLI Equivalent
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
zigchaind query tokenwrapper total-transfers
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Description
|
|
261
|
+
|
|
262
|
+
Fetches the **cumulative transfer volume** through the Token Wrapper module since its deployment — the total amount of tokens that have been wrapped (transferred in) and unwrapped (transferred out).
|
|
263
|
+
|
|
264
|
+
This provides a lifetime volume metric for the bridge, useful for analytics and monitoring net flow direction.
|
|
265
|
+
|
|
266
|
+
## Parameters
|
|
267
|
+
|
|
268
|
+
None.
|
|
269
|
+
|
|
270
|
+
## Usage Example
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
const totals = await tokenWrapperApi.fetchTotalTransfers()
|
|
274
|
+
console.dir(totals, { depth: null })
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Example Response
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"total_transferred_in": "490615709",
|
|
282
|
+
"total_transferred_out": "191529021"
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Response Field Explanation
|
|
287
|
+
|
|
288
|
+
| Field | Description |
|
|
289
|
+
| ---------------------- | ---------------------------------------------------------------------------- |
|
|
290
|
+
| total_transferred_in | Cumulative amount of tokens wrapped (received from counterparty chain) |
|
|
291
|
+
| total_transferred_out | Cumulative amount of tokens unwrapped (sent back to counterparty chain) |
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
---
|