@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,214 @@
|
|
|
1
|
+
# IBC Connection
|
|
2
|
+
|
|
3
|
+
The **IBC Connection** creates a secure link between two blockchains.
|
|
4
|
+
|
|
5
|
+
If IBC is a secure bridge system:
|
|
6
|
+
|
|
7
|
+
* **Client** → verifier
|
|
8
|
+
* **Connection** → secured bridge
|
|
9
|
+
* **Channel** → lane on the bridge
|
|
10
|
+
* **Packet** → message sent through the lane
|
|
11
|
+
|
|
12
|
+
A connection must be established before channels can be created.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Setup
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import {
|
|
20
|
+
ChainIbcConnectionApi,
|
|
21
|
+
getNetworkEndpoints,
|
|
22
|
+
Network,
|
|
23
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
24
|
+
|
|
25
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
26
|
+
const ibcConnectionApi = new ChainIbcConnectionApi(endpoints)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# What is a Connection?
|
|
32
|
+
|
|
33
|
+
A **connection** is a secure, authenticated bridge between two chains.
|
|
34
|
+
|
|
35
|
+
It is created using a handshake process:
|
|
36
|
+
|
|
37
|
+
1. INIT
|
|
38
|
+
2. TRY
|
|
39
|
+
3. ACK
|
|
40
|
+
4. CONFIRM
|
|
41
|
+
|
|
42
|
+
Once the connection state becomes `OPEN`, channels can be built on top of it.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# `fetchConnections()`
|
|
47
|
+
|
|
48
|
+
### What it does
|
|
49
|
+
|
|
50
|
+
Returns **all IBC connections** stored on ZigChain.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Why is this useful?
|
|
55
|
+
|
|
56
|
+
It lets you see:
|
|
57
|
+
|
|
58
|
+
* Which chains ZigChain is connected to
|
|
59
|
+
* Connection states (INIT, TRYOPEN, OPEN)
|
|
60
|
+
* Associated client IDs
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### CLI equivalent
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
zigchaind query ibc connection connections
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Example
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const connections = await ibcConnectionApi.fetchConnections()
|
|
76
|
+
console.dir(connections, { depth: null })
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
# `fetchConnectionEnd()`
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
fetchConnectionEnd(connectionId: string)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### What it does
|
|
88
|
+
|
|
89
|
+
Returns full details of a specific connection.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Why is it called "Connection End"?
|
|
94
|
+
|
|
95
|
+
Because the connection exists on **both chains**.
|
|
96
|
+
|
|
97
|
+
Each chain stores its own side (or "end") of the connection.
|
|
98
|
+
|
|
99
|
+
This function returns ZigChain’s side.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### It contains:
|
|
104
|
+
|
|
105
|
+
* client ID
|
|
106
|
+
* counterparty client ID
|
|
107
|
+
* connection state
|
|
108
|
+
* supported versions
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### CLI equivalent
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
zigchaind query ibc connection end <connection-id>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### Example
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const connection = await ibcConnectionApi.fetchConnectionEnd(
|
|
124
|
+
'connection-0'
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
console.dir(connection, { depth: null })
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# `fetchConnectionParams()`
|
|
133
|
+
|
|
134
|
+
### What it does
|
|
135
|
+
|
|
136
|
+
Returns the global parameters of the IBC connection module.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### What are Connection Parameters?
|
|
141
|
+
|
|
142
|
+
These are chain-wide rules that control:
|
|
143
|
+
|
|
144
|
+
* Expected "block time" (The average time it takes for a blockchain to produce a new block.)
|
|
145
|
+
* Verification timing assumptions
|
|
146
|
+
|
|
147
|
+
These parameters affect timeout behavior and security assumptions.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### CLI equivalent
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
zigchaind query ibc connection params
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### Example
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
const params = await ibcConnectionApi.fetchConnectionParams()
|
|
163
|
+
console.dir(params)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
# `fetchClientConnectionPaths()`
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
fetchClientConnectionPaths(clientId: string)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### What it does
|
|
175
|
+
|
|
176
|
+
Returns all connections that were created using a specific client.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### Why is this useful?
|
|
181
|
+
|
|
182
|
+
Remember:
|
|
183
|
+
|
|
184
|
+
Client → verifies another chain
|
|
185
|
+
Connection → built using that client
|
|
186
|
+
|
|
187
|
+
So this query answers:
|
|
188
|
+
|
|
189
|
+
> “Which bridges were created using this verifier?”
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### CLI equivalent
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
zigchaind query ibc connection path <client-id>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### Example
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
const paths = await ibcConnectionApi.fetchClientConnectionPaths(
|
|
205
|
+
'07-tendermint-0'
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
console.dir(paths)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
# IBC Transfer
|
|
2
|
+
|
|
3
|
+
## What is IBC Transfer?
|
|
4
|
+
|
|
5
|
+
The **IBC Transfer** enables ZigChain to send and receive fungible tokens across other IBC-enabled blockchains.
|
|
6
|
+
|
|
7
|
+
Instead of directly moving tokens between chains, IBC Transfer:
|
|
8
|
+
|
|
9
|
+
* Locks tokens in escrow on the source chain
|
|
10
|
+
* Mints voucher tokens on the destination chain
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Important Terminology
|
|
14
|
+
|
|
15
|
+
Before documenting functions, let’s define key terms.
|
|
16
|
+
|
|
17
|
+
### Denom
|
|
18
|
+
|
|
19
|
+
A token denomination.
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
uzig
|
|
25
|
+
uusdc
|
|
26
|
+
uatom
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
On IBC transfers, denoms can become:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
ibc/<HASH>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Denom Trace
|
|
36
|
+
|
|
37
|
+
Describes the full path a token took across chains.
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
transfer/channel-44/uusdc
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
It contains:
|
|
46
|
+
|
|
47
|
+
* Port ID
|
|
48
|
+
* Channel ID
|
|
49
|
+
* Base denom
|
|
50
|
+
|
|
51
|
+
### Denom Hash
|
|
52
|
+
|
|
53
|
+
A SHA256 hash of the full denom trace string.
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
SHA256("transfer/channel-44/uusdc")
|
|
59
|
+
=
|
|
60
|
+
5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On-chain representation:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
ibc/5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Escrow Account
|
|
70
|
+
|
|
71
|
+
An **escrow account** is a special account controlled by the IBC Transfer module that temporarily holds tokens during a cross-chain transfer.
|
|
72
|
+
|
|
73
|
+
When you send tokens to another chain, they are **locked in this escrow account** on the source chain. The tokens do not leave immediately — instead, they are safely held while the destination chain mints a corresponding voucher token.
|
|
74
|
+
|
|
75
|
+
If the transfer succeeds, the escrowed tokens remain locked.
|
|
76
|
+
If the transfer fails, the tokens are released back to the sender.
|
|
77
|
+
|
|
78
|
+
This mechanism ensures:
|
|
79
|
+
|
|
80
|
+
* No tokens are duplicated
|
|
81
|
+
* Total supply remains correct
|
|
82
|
+
* Cross-chain transfers are secure and verifiable
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Transfer Parameters
|
|
87
|
+
|
|
88
|
+
Chain-level configuration controlling:
|
|
89
|
+
|
|
90
|
+
* Whether sending is enabled
|
|
91
|
+
* Whether receiving is enabled
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
# Functions Documentation
|
|
96
|
+
|
|
97
|
+
## Setup
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import {
|
|
101
|
+
ChainIbcTransferApi,
|
|
102
|
+
getNetworkEndpoints,
|
|
103
|
+
Network
|
|
104
|
+
} from '@zuhaibnoor/zigchain-sdk'
|
|
105
|
+
|
|
106
|
+
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
107
|
+
const ibcTransferApi = new ChainIbcTransferApi(endpoints)
|
|
108
|
+
|
|
109
|
+
const hash = '5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8'
|
|
110
|
+
const portId = 'transfer'
|
|
111
|
+
const channelId = 'channel-44'
|
|
112
|
+
const denom = 'uusdc'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
# 1️⃣ fetchDenomByHash
|
|
118
|
+
|
|
119
|
+
## Method
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
async fetchDenomByHash(hash: string)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## CLI Equivalent
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
zigchaind query ibc-transfer denom <hash>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Description
|
|
132
|
+
|
|
133
|
+
Fetches the **denom trace** associated with a given IBC denom hash.
|
|
134
|
+
|
|
135
|
+
This allows you to:
|
|
136
|
+
|
|
137
|
+
* Identify the original base token
|
|
138
|
+
* See which port and channel it arrived through
|
|
139
|
+
* Reverse lookup `ibc/<hash>` tokens
|
|
140
|
+
|
|
141
|
+
## Parameters
|
|
142
|
+
|
|
143
|
+
| Name | Type | Description |
|
|
144
|
+
| ---- | ------ | -------------------------- |
|
|
145
|
+
| hash | string | IBC denom hash (no `ibc/`) |
|
|
146
|
+
|
|
147
|
+
## Usage Example
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const trace = await ibcTransferApi.fetchDenomByHash(hash)
|
|
151
|
+
console.dir(trace, { depth: null })
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Example Response
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"denom": {
|
|
161
|
+
"base": "uusdc",
|
|
162
|
+
"trace": [
|
|
163
|
+
{
|
|
164
|
+
"port_id": "transfer",
|
|
165
|
+
"channel_id": "channel-44"
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Response Field Explanation
|
|
173
|
+
|
|
174
|
+
### `denom`
|
|
175
|
+
|
|
176
|
+
Contains denom trace information.
|
|
177
|
+
|
|
178
|
+
| Field | Description |
|
|
179
|
+
| ----- | -------------------------- |
|
|
180
|
+
| base | Original token denom |
|
|
181
|
+
| trace | Array of port/channel hops |
|
|
182
|
+
|
|
183
|
+
Each trace entry includes:
|
|
184
|
+
|
|
185
|
+
| Field | Description |
|
|
186
|
+
| ---------- | ---------------------- |
|
|
187
|
+
| port_id | IBC port identifier |
|
|
188
|
+
| channel_id | IBC channel identifier |
|
|
189
|
+
|
|
190
|
+
## When to Use
|
|
191
|
+
|
|
192
|
+
* Resolving `ibc/<hash>` tokens
|
|
193
|
+
* Building explorers
|
|
194
|
+
* Wallet token metadata resolution
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
# 2️⃣ fetchDenomHash
|
|
199
|
+
|
|
200
|
+
## Method
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
async fetchDenomHash(
|
|
204
|
+
portId: string,
|
|
205
|
+
channelId: string,
|
|
206
|
+
denom: string
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## CLI Equivalent
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
zigchaind query ibc-transfer denom-hash <port> <channel> <denom>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Description
|
|
217
|
+
|
|
218
|
+
Computes and returns the **IBC denom hash** from:
|
|
219
|
+
|
|
220
|
+
* Port ID
|
|
221
|
+
* Channel ID
|
|
222
|
+
* Base denom
|
|
223
|
+
|
|
224
|
+
This produces the deterministic hash used on-chain.
|
|
225
|
+
|
|
226
|
+
## Parameters
|
|
227
|
+
|
|
228
|
+
| Name | Type | Description |
|
|
229
|
+
| --------- | ------ | ----------------------------- |
|
|
230
|
+
| portId | string | IBC port (usually `transfer`) |
|
|
231
|
+
| channelId | string | IBC channel identifier |
|
|
232
|
+
| denom | string | Base token denom |
|
|
233
|
+
|
|
234
|
+
## Usage Example
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
const denomHash = await ibcTransferApi.fetchDenomHash(
|
|
238
|
+
portId,
|
|
239
|
+
channelId,
|
|
240
|
+
denom
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
console.dir(denomHash, { depth: null })
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Example Response
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"hash": "5260516290F7883EC893AADA09A6B8CEC790F2EEF3196F440037908749785BE8"
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Response Field Explanation
|
|
255
|
+
|
|
256
|
+
| Field | Description |
|
|
257
|
+
| ----- | ------------------------------- |
|
|
258
|
+
| hash | SHA256 hash of full denom trace |
|
|
259
|
+
|
|
260
|
+
## When to Use
|
|
261
|
+
|
|
262
|
+
* Generating `ibc/<hash>` values
|
|
263
|
+
* Wallet token display logic
|
|
264
|
+
* SDK internal conversions
|
|
265
|
+
* Verifying denom determinism
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
# 3️⃣ fetchDenoms
|
|
270
|
+
|
|
271
|
+
## Method
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
async fetchDenoms()
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## CLI Equivalent
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
zigchaind query ibc-transfer denoms
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Description
|
|
284
|
+
|
|
285
|
+
Returns all registered IBC denom traces on ZigChain.
|
|
286
|
+
|
|
287
|
+
Useful for discovering:
|
|
288
|
+
|
|
289
|
+
* Imported tokens
|
|
290
|
+
* Multi-hop tokens
|
|
291
|
+
* All IBC assets on-chain
|
|
292
|
+
|
|
293
|
+
## Parameters
|
|
294
|
+
|
|
295
|
+
None.
|
|
296
|
+
|
|
297
|
+
## Usage Example
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
const denoms = await ibcTransferApi.fetchDenoms()
|
|
301
|
+
console.dir(denoms, { depth: null })
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Example Response
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"denoms": [
|
|
309
|
+
{
|
|
310
|
+
"base": "uusdc",
|
|
311
|
+
"trace": [
|
|
312
|
+
{
|
|
313
|
+
"port_id": "transfer",
|
|
314
|
+
"channel_id": "channel-44"
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
"pagination": {
|
|
320
|
+
"next_key": null,
|
|
321
|
+
"total": "15"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Response Field Explanation
|
|
329
|
+
|
|
330
|
+
### `denoms`
|
|
331
|
+
|
|
332
|
+
Array of denom traces.
|
|
333
|
+
|
|
334
|
+
Each entry includes:
|
|
335
|
+
|
|
336
|
+
| Field | Description |
|
|
337
|
+
| ----- | ------------------- |
|
|
338
|
+
| base | Original base denom |
|
|
339
|
+
| trace | Path of IBC hops |
|
|
340
|
+
|
|
341
|
+
## When to Use
|
|
342
|
+
|
|
343
|
+
* Building token explorers
|
|
344
|
+
* Indexing IBC assets
|
|
345
|
+
* Chain analytics
|
|
346
|
+
* Asset discovery tools
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
# 4️⃣ fetchEscrowAddress
|
|
351
|
+
|
|
352
|
+
## Method
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
async fetchEscrowAddress(
|
|
356
|
+
portId: string,
|
|
357
|
+
channelId: string
|
|
358
|
+
)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## CLI Equivalent
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
zigchaind query ibc-transfer escrow-address <port> <channel>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Description
|
|
368
|
+
|
|
369
|
+
Returns the escrow account address for a specific port and channel.
|
|
370
|
+
|
|
371
|
+
Tokens sent through this channel are temporarily locked here before being transferred.
|
|
372
|
+
|
|
373
|
+
## Parameters
|
|
374
|
+
|
|
375
|
+
| Name | Type | Description |
|
|
376
|
+
| --------- | ------ | ---------------------- |
|
|
377
|
+
| portId | string | IBC port identifier |
|
|
378
|
+
| channelId | string | IBC channel identifier |
|
|
379
|
+
|
|
380
|
+
## Usage Example
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
const escrow = await ibcTransferApi.fetchEscrowAddress(
|
|
384
|
+
portId,
|
|
385
|
+
channelId
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
console.dir(escrow, { depth: null })
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Example Response
|
|
392
|
+
|
|
393
|
+
```json
|
|
394
|
+
{
|
|
395
|
+
"escrow_address": "zig1hcea3h0ykw4jqyjhj3tnydsk22s06adh5y350m"
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Response Field Explanation
|
|
400
|
+
|
|
401
|
+
| Field | Description |
|
|
402
|
+
| -------------- | ----------------------------- |
|
|
403
|
+
| escrow_address | Module escrow account address |
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
# 5️⃣ fetchTransferParams
|
|
408
|
+
|
|
409
|
+
## Method
|
|
410
|
+
|
|
411
|
+
```ts
|
|
412
|
+
async fetchTransferParams()
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## CLI Equivalent
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
zigchaind query ibc-transfer params
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Description
|
|
422
|
+
|
|
423
|
+
Fetches the chain-level configuration of the IBC Transfer module.
|
|
424
|
+
|
|
425
|
+
These parameters determine whether token transfers are allowed.
|
|
426
|
+
|
|
427
|
+
## Parameters
|
|
428
|
+
|
|
429
|
+
None.
|
|
430
|
+
|
|
431
|
+
## Usage Example
|
|
432
|
+
|
|
433
|
+
```ts
|
|
434
|
+
const params = await ibcTransferApi.fetchTransferParams()
|
|
435
|
+
console.dir(params, { depth: null })
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## Example Response
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{
|
|
442
|
+
"params": {
|
|
443
|
+
"send_enabled": true,
|
|
444
|
+
"receive_enabled": true
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Response Field Explanation
|
|
450
|
+
|
|
451
|
+
### `params`
|
|
452
|
+
|
|
453
|
+
| Field | Description |
|
|
454
|
+
| --------------- | ------------------------------------------- |
|
|
455
|
+
| send_enabled | Whether outgoing IBC transfers are allowed |
|
|
456
|
+
| receive_enabled | Whether incoming IBC transfers are accepted |
|
|
457
|
+
|
|
458
|
+
## When to Use
|
|
459
|
+
|
|
460
|
+
* Checking if transfers are paused
|
|
461
|
+
* Governance audits
|
|
462
|
+
---
|
|
463
|
+
|