@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
package/docs/bank.md
CHANGED
|
@@ -1,7 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
# Bank Module
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
## What is the Bank Module?
|
|
4
|
+
|
|
5
|
+
The **Bank module** is a core Cosmos SDK module responsible for managing **token balances and transfers** on the blockchain.
|
|
6
|
+
|
|
7
|
+
In **ZigChain**, every token you hold — whether the native `uzig` or any factory-created token — is tracked and queryable through this module.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Important Terminology
|
|
12
|
+
|
|
13
|
+
### Denom
|
|
14
|
+
|
|
15
|
+
A **denom** (denomination) is the unique identifier for a token on ZigChain.
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
```
|
|
19
|
+
uzig
|
|
20
|
+
coin.zig1zpnw5dtzzttmgtdjgtywt08wnlyyskpuupy3cfw8mytlslx54j9sgz6w4n.oroswap
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
There are two categories of denoms on ZigChain:
|
|
24
|
+
|
|
25
|
+
| Type | Example | Description |
|
|
26
|
+
| ---- | ------- | ----------- |
|
|
27
|
+
| Native | `uzig` | The base chain token |
|
|
28
|
+
| Factory token | `coin.<creator-address>.<name>` | Tokens created via the token factory module |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### uzig
|
|
33
|
+
|
|
34
|
+
The base denomination of ZigChain's native token.
|
|
35
|
+
|
|
36
|
+
`1 ZIG = 1,000,000 uzig`
|
|
37
|
+
|
|
38
|
+
Most balance queries return amounts in `uzig`.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Balance
|
|
43
|
+
|
|
44
|
+
The amount of a specific denom held by an address.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### Total Supply
|
|
49
|
+
|
|
50
|
+
The total circulating amount of a denom across all accounts on the chain.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Pagination
|
|
55
|
+
|
|
56
|
+
Many bank queries return paginated responses when results are large (e.g. total supply across 1800+ denoms). The `pagination` object in the response contains a `next_key` for fetching subsequent pages.
|
|
5
57
|
|
|
6
58
|
---
|
|
7
59
|
|
|
@@ -13,303 +65,910 @@ import {
|
|
|
13
65
|
getNetworkEndpoints,
|
|
14
66
|
Network,
|
|
15
67
|
} from '@zuhaibnoor/zigchain-sdk'
|
|
16
|
-
```
|
|
17
68
|
|
|
18
|
-
```ts
|
|
19
69
|
const endpoints = getNetworkEndpoints(Network.Testnet)
|
|
20
70
|
const bankApi = new ChainBankApi(endpoints)
|
|
71
|
+
|
|
72
|
+
const address = 'zig1svkn4sqrlz8r6krq96ty6kze54n2ec03u0vat5'
|
|
21
73
|
```
|
|
22
74
|
|
|
23
75
|
---
|
|
24
76
|
|
|
25
|
-
|
|
77
|
+
# 1️⃣ fetchBalances
|
|
26
78
|
|
|
27
|
-
|
|
79
|
+
## Method
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
async fetchBalances(address: string)
|
|
83
|
+
```
|
|
28
84
|
|
|
29
|
-
|
|
85
|
+
## CLI Equivalent
|
|
30
86
|
|
|
31
87
|
```bash
|
|
32
|
-
zigchaind query bank
|
|
88
|
+
zigchaind query bank balances <address>
|
|
33
89
|
```
|
|
34
90
|
|
|
35
|
-
|
|
91
|
+
## Description
|
|
36
92
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
93
|
+
Fetches **all token balances** held by an account across every denom.
|
|
94
|
+
|
|
95
|
+
This returns every denom the address holds — both native tokens and factory-created tokens.
|
|
96
|
+
|
|
97
|
+
## Parameters
|
|
98
|
+
|
|
99
|
+
| Name | Type | Description |
|
|
100
|
+
| ------- | ------ | --------------------------------- |
|
|
101
|
+
| address | string | Bech32 address of the account to query |
|
|
40
102
|
|
|
41
|
-
|
|
103
|
+
|
|
104
|
+
## Usage Example
|
|
42
105
|
|
|
43
106
|
```ts
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
107
|
+
const balances = await bankApi.fetchBalances(address)
|
|
108
|
+
console.dir(balances, { depth: null })
|
|
109
|
+
```
|
|
48
110
|
|
|
49
|
-
|
|
111
|
+
## Example Response
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"balances": [
|
|
116
|
+
{
|
|
117
|
+
"denom": "coin.zig1zpnw5dtzzttmgtdjgtywt08wnlyyskpuupy3cfw8mytlslx54j9sgz6w4n.oroswap",
|
|
118
|
+
"amount": "222026"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"denom": "uzig",
|
|
122
|
+
"amount": "443143284"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"pagination": {
|
|
126
|
+
"next_key": null,
|
|
127
|
+
"total": "2"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
50
130
|
```
|
|
51
131
|
|
|
132
|
+
## Response Field Explanation
|
|
133
|
+
|
|
134
|
+
### `balances`
|
|
135
|
+
|
|
136
|
+
Array of token balances held by the account.
|
|
137
|
+
|
|
138
|
+
Each entry contains:
|
|
139
|
+
|
|
140
|
+
| Field | Description |
|
|
141
|
+
| ------ | ------------------------------------------ |
|
|
142
|
+
| denom | Token identifier (native or factory token) |
|
|
143
|
+
| amount | Token amount as a string integer |
|
|
144
|
+
|
|
145
|
+
## When to Use
|
|
146
|
+
|
|
147
|
+
* Displaying a wallet's full token portfolio
|
|
148
|
+
* Checking if an address holds a particular token
|
|
149
|
+
* Building wallet dashboards or block explorer account pages
|
|
150
|
+
|
|
52
151
|
---
|
|
53
152
|
|
|
54
|
-
|
|
153
|
+
# 2️⃣ fetchBalance
|
|
55
154
|
|
|
56
|
-
|
|
155
|
+
## Method
|
|
57
156
|
|
|
58
|
-
|
|
157
|
+
```ts
|
|
158
|
+
async fetchBalance(address: string, denom: string)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## CLI Equivalent
|
|
59
162
|
|
|
60
163
|
```bash
|
|
61
|
-
zigchaind query bank
|
|
164
|
+
zigchaind query bank balance <address> <denom>
|
|
62
165
|
```
|
|
63
166
|
|
|
64
|
-
|
|
167
|
+
## Description
|
|
65
168
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
169
|
+
Fetches the balance of a **single specific denom** for an account.
|
|
170
|
+
|
|
171
|
+
Use this when you only need to check one token rather than fetching all balances with `fetchBalances`. This is more efficient for targeted lookups.
|
|
172
|
+
|
|
173
|
+
## Parameters
|
|
69
174
|
|
|
70
|
-
|
|
175
|
+
| Name | Type | Description |
|
|
176
|
+
| ------- | ------ | --------------------------------------------- |
|
|
177
|
+
| address | string | Bech32 address of the account to query |
|
|
178
|
+
| denom | string | Token identifier to query the balance of |
|
|
179
|
+
|
|
180
|
+
## Usage Example
|
|
71
181
|
|
|
72
182
|
```ts
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
183
|
+
const balance = await bankApi.fetchBalance(address, 'uzig')
|
|
184
|
+
console.dir(balance, { depth: null })
|
|
185
|
+
```
|
|
76
186
|
|
|
77
|
-
|
|
187
|
+
## Example Response
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"balance": {
|
|
192
|
+
"denom": "uzig",
|
|
193
|
+
"amount": "443143284"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
78
196
|
```
|
|
79
197
|
|
|
198
|
+
## Response Field Explanation
|
|
199
|
+
|
|
200
|
+
### `balance`
|
|
201
|
+
|
|
202
|
+
| Field | Description |
|
|
203
|
+
| ------ | ------------------------------------- |
|
|
204
|
+
| denom | The queried token denomination |
|
|
205
|
+
| amount | Token amount held, as a string integer |
|
|
206
|
+
|
|
207
|
+
> ⚠️ If the account holds none of the queried denom, `amount` will be `"0"` rather than an error.
|
|
208
|
+
|
|
209
|
+
### `fetchBalance` vs `fetchBalances`
|
|
210
|
+
|
|
211
|
+
| Feature | fetchBalance | fetchBalances |
|
|
212
|
+
| --------------------- | -------------------------- | -------------------------- |
|
|
213
|
+
| Targets specific denom | ✅ Yes | ❌ Returns all denoms |
|
|
214
|
+
| Response size | Minimal | Larger (all tokens) |
|
|
215
|
+
| Use case | Single token lookup | Full portfolio view |
|
|
216
|
+
|
|
217
|
+
## When to Use
|
|
218
|
+
|
|
219
|
+
* Checking if an account has enough of a specific token before a transaction
|
|
220
|
+
* Displaying a single token balance in a UI
|
|
221
|
+
* Gas or fee balance checks
|
|
222
|
+
* Targeted balance monitoring
|
|
223
|
+
|
|
80
224
|
---
|
|
81
225
|
|
|
82
|
-
|
|
226
|
+
# 3️⃣ fetchTotalSupply
|
|
227
|
+
|
|
228
|
+
## Method
|
|
83
229
|
|
|
84
|
-
|
|
230
|
+
```ts
|
|
231
|
+
async fetchTotalSupply()
|
|
232
|
+
```
|
|
85
233
|
|
|
86
|
-
|
|
234
|
+
## CLI Equivalent
|
|
87
235
|
|
|
88
236
|
```bash
|
|
89
237
|
zigchaind query bank total-supply
|
|
90
238
|
```
|
|
91
239
|
|
|
92
|
-
|
|
240
|
+
## Description
|
|
93
241
|
|
|
94
|
-
|
|
95
|
-
fetchTotalSupply()
|
|
96
|
-
```
|
|
242
|
+
Fetches the **total circulating supply of every token** registered on the chain.
|
|
97
243
|
|
|
98
|
-
|
|
244
|
+
This returns a paginated list of all denoms and their total supply across all accounts. On ZigChain testnet, this spans 1800+ denoms including the native token and all factory-created tokens.
|
|
245
|
+
|
|
246
|
+
## Parameters
|
|
247
|
+
|
|
248
|
+
None.
|
|
249
|
+
|
|
250
|
+
## Usage Example
|
|
99
251
|
|
|
100
252
|
```ts
|
|
101
253
|
const supply = await bankApi.fetchTotalSupply()
|
|
102
|
-
console.
|
|
254
|
+
console.dir(supply, { depth: null })
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Example Response
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"supply": [
|
|
262
|
+
{
|
|
263
|
+
"denom": "abc",
|
|
264
|
+
"amount": "200000000000000000000"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"denom": "coin.zig108xf844zaf34609lugw69z5urkrutxlu78jfrr09v2d7wqqhptzsz97tk7.night",
|
|
268
|
+
"amount": "14853334"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"denom": "uzig",
|
|
272
|
+
"amount": "9827461000000"
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"pagination": {
|
|
276
|
+
"next_key": "Y29pbi56aWcxMHh2YzN0a3FyZHl5bTZlcDlscnQ1MDA1bXJ3dnc2cm1sNjZxdjdqeHduemxwcWZtdzdrc3E3bjdubS5wb3dlcg==",
|
|
277
|
+
"total": "1829"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
103
280
|
```
|
|
104
281
|
|
|
282
|
+
## Response Field Explanation
|
|
283
|
+
|
|
284
|
+
### `supply`
|
|
285
|
+
|
|
286
|
+
Array of all token denominations and their total supply.
|
|
287
|
+
|
|
288
|
+
Each entry contains:
|
|
289
|
+
|
|
290
|
+
| Field | Description |
|
|
291
|
+
| ------ | ------------------------------------------------------------ |
|
|
292
|
+
| denom | Token identifier |
|
|
293
|
+
| amount | Total supply of this token across all accounts, as a string |
|
|
294
|
+
|
|
295
|
+
### `pagination`
|
|
296
|
+
|
|
297
|
+
| Field | Description |
|
|
298
|
+
| -------- | ------------------------------------------------------------------------------- |
|
|
299
|
+
| next_key | Base64-encoded cursor for the next page. `null` when all results are returned |
|
|
300
|
+
| total | Total number of distinct denoms registered on the chain |
|
|
301
|
+
|
|
302
|
+
> ⚠️ ZigChain testnet has 1800+ registered denoms. The response is paginated — `next_key` will be non-null if there are more results beyond the current page.
|
|
303
|
+
|
|
304
|
+
## When to Use
|
|
305
|
+
|
|
306
|
+
* Chain analytics and supply dashboards
|
|
307
|
+
* Verifying a token exists on-chain before interacting with it
|
|
308
|
+
* Monitoring total supply changes over time
|
|
309
|
+
* Building block explorer overview pages
|
|
310
|
+
|
|
105
311
|
---
|
|
106
312
|
|
|
107
|
-
|
|
313
|
+
# 4️⃣ fetchSupplyOf
|
|
314
|
+
|
|
315
|
+
## Method
|
|
108
316
|
|
|
109
|
-
|
|
317
|
+
```ts
|
|
318
|
+
async fetchSupplyOf(denom: string)
|
|
319
|
+
```
|
|
110
320
|
|
|
111
|
-
|
|
321
|
+
## CLI Equivalent
|
|
112
322
|
|
|
113
323
|
```bash
|
|
114
324
|
zigchaind query bank total-supply-of <denom>
|
|
115
325
|
```
|
|
116
326
|
|
|
117
|
-
|
|
327
|
+
## Description
|
|
118
328
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
329
|
+
Fetches the **total circulating supply of a single specific denom**.
|
|
330
|
+
|
|
331
|
+
This is the targeted alternative to `fetchTotalSupply` — use this when you only need the supply of one token rather than pulling the entire paginated list of all 1800+ denoms.
|
|
332
|
+
|
|
333
|
+
## Parameters
|
|
122
334
|
|
|
123
|
-
|
|
335
|
+
| Name | Type | Description |
|
|
336
|
+
| ----- | ------ | ---------------------------------------- |
|
|
337
|
+
| denom | string | Token identifier to query the supply of |
|
|
338
|
+
|
|
339
|
+
## Usage Example
|
|
124
340
|
|
|
125
341
|
```ts
|
|
126
342
|
const supplyOf = await bankApi.fetchSupplyOf('uzig')
|
|
127
|
-
console.
|
|
343
|
+
console.dir(supplyOf, { depth: null })
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Example Response
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"amount": {
|
|
351
|
+
"denom": "uzig",
|
|
352
|
+
"amount": "2323139530948522"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
128
355
|
```
|
|
129
356
|
|
|
357
|
+
## Response Field Explanation
|
|
358
|
+
|
|
359
|
+
### `amount`
|
|
360
|
+
|
|
361
|
+
| Field | Description |
|
|
362
|
+
| ------ | ----------------------------------------------------------- |
|
|
363
|
+
| denom | The queried token denomination |
|
|
364
|
+
| amount | Total supply of this token across all accounts, as a string |
|
|
365
|
+
|
|
366
|
+
### `fetchSupplyOf` vs `fetchTotalSupply`
|
|
367
|
+
|
|
368
|
+
| Feature | fetchSupplyOf | fetchTotalSupply |
|
|
369
|
+
| ----------------------- | --------------------- | -------------------------- |
|
|
370
|
+
| Targets specific denom | ✅ Yes | ❌ Returns all denoms |
|
|
371
|
+
| Response size | Minimal | Large (paginated) |
|
|
372
|
+
| Use case | Single token supply | Full chain supply overview |
|
|
373
|
+
|
|
374
|
+
## When to Use
|
|
375
|
+
|
|
376
|
+
* Checking the total supply of a specific token
|
|
377
|
+
* Supply monitoring for a particular denom
|
|
378
|
+
* Token analytics dashboards
|
|
379
|
+
|
|
130
380
|
---
|
|
131
381
|
|
|
132
|
-
|
|
382
|
+
# 5️⃣ fetchDenomMetadata
|
|
383
|
+
|
|
384
|
+
## Method
|
|
133
385
|
|
|
134
|
-
|
|
386
|
+
```ts
|
|
387
|
+
async fetchDenomMetadata(denom: string)
|
|
388
|
+
```
|
|
135
389
|
|
|
136
|
-
|
|
390
|
+
## CLI Equivalent
|
|
137
391
|
|
|
138
392
|
```bash
|
|
139
393
|
zigchaind query bank denom-metadata <denom>
|
|
140
394
|
```
|
|
141
395
|
|
|
142
|
-
|
|
396
|
+
## Description
|
|
143
397
|
|
|
144
|
-
|
|
145
|
-
fetchDenomMetadata(denom: string)
|
|
146
|
-
```
|
|
398
|
+
Fetches the **registered metadata** for a specific token denomination.
|
|
147
399
|
|
|
148
|
-
|
|
400
|
+
Metadata describes how a token is represented to humans — its name, symbol, display unit, and the full hierarchy of denominations at different exponents.
|
|
401
|
+
|
|
402
|
+
## Parameters
|
|
403
|
+
|
|
404
|
+
| Name | Type | Description |
|
|
405
|
+
| ----- | ------ | --------------------------------------------- |
|
|
406
|
+
| denom | string | Base denomination to query metadata for (e.g. `uzig`) |
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
## Usage Example
|
|
149
410
|
|
|
150
411
|
```ts
|
|
151
412
|
const metadata = await bankApi.fetchDenomMetadata('uzig')
|
|
152
|
-
console.
|
|
413
|
+
console.dir(metadata, { depth: null })
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## Example Response
|
|
417
|
+
|
|
418
|
+
```json
|
|
419
|
+
{
|
|
420
|
+
"metadata": {
|
|
421
|
+
"description": "ZIGChain Test Native Token",
|
|
422
|
+
"denom_units": [
|
|
423
|
+
{ "denom": "uzig", "exponent": 0, "aliases": ["microzig"] },
|
|
424
|
+
{ "denom": "mzig", "exponent": 3, "aliases": ["millizig"] },
|
|
425
|
+
{ "denom": "zig", "exponent": 6, "aliases": [] }
|
|
426
|
+
],
|
|
427
|
+
"base": "uzig",
|
|
428
|
+
"display": "zig",
|
|
429
|
+
"name": "ZIG",
|
|
430
|
+
"symbol": "ZIG",
|
|
431
|
+
"uri": "",
|
|
432
|
+
"uri_hash": ""
|
|
433
|
+
}
|
|
434
|
+
}
|
|
153
435
|
```
|
|
154
436
|
|
|
437
|
+
## Response Field Explanation
|
|
438
|
+
|
|
439
|
+
### `metadata`
|
|
440
|
+
|
|
441
|
+
| Field | Description |
|
|
442
|
+
| ----------- | ----------------------------------------------------------------------- |
|
|
443
|
+
| description | Human-readable description of the token |
|
|
444
|
+
| denom_units | Array of denomination representations at different decimal exponents |
|
|
445
|
+
| base | The smallest, indivisible unit of the token (used in all on-chain math) |
|
|
446
|
+
| display | The recommended unit to show in UIs |
|
|
447
|
+
| name | Full token name |
|
|
448
|
+
| symbol | Short ticker symbol |
|
|
449
|
+
| uri | Optional URI pointing to additional token metadata (e.g. logo) |
|
|
450
|
+
| uri_hash | Hash of the URI content for integrity verification |
|
|
451
|
+
|
|
452
|
+
### `denom_units`
|
|
453
|
+
|
|
454
|
+
Defines the denomination hierarchy. Each entry represents the same token at a different decimal scale.
|
|
455
|
+
|
|
456
|
+
| Field | Description |
|
|
457
|
+
| -------- | ------------------------------------------------------ |
|
|
458
|
+
| denom | Name of this unit |
|
|
459
|
+
| exponent | Power of 10 relative to the base denom |
|
|
460
|
+
| aliases | Alternative names for this unit |
|
|
461
|
+
|
|
462
|
+
For `uzig` specifically:
|
|
463
|
+
|
|
464
|
+
| Unit | Exponent | Meaning |
|
|
465
|
+
| ----- | -------- | -------------------------------- |
|
|
466
|
+
| uzig | 0 | Base unit — 1 uzig |
|
|
467
|
+
| mzig | 3 | 1 mzig = 1,000 uzig |
|
|
468
|
+
| zig | 6 | 1 zig = 1,000,000 uzig (display) |
|
|
469
|
+
|
|
470
|
+
> Always use the `base` denom for on-chain operations and the `display` denom for showing amounts to end users.
|
|
471
|
+
|
|
472
|
+
## When to Use
|
|
473
|
+
|
|
474
|
+
* Displaying token amounts in human-readable form
|
|
475
|
+
* Getting the token symbol and name for a UI
|
|
476
|
+
* Resolving decimal precision for amount formatting
|
|
477
|
+
* Token info pages on block explorers
|
|
478
|
+
|
|
155
479
|
---
|
|
156
480
|
|
|
157
|
-
|
|
481
|
+
# 6️⃣ fetchDenomOwners
|
|
482
|
+
|
|
483
|
+
## Method
|
|
158
484
|
|
|
159
|
-
|
|
485
|
+
```ts
|
|
486
|
+
async fetchDenomOwners(denom: string)
|
|
487
|
+
```
|
|
160
488
|
|
|
161
|
-
|
|
489
|
+
## CLI Equivalent
|
|
162
490
|
|
|
163
491
|
```bash
|
|
164
492
|
zigchaind query bank denom-owners <denom>
|
|
165
493
|
```
|
|
166
494
|
|
|
167
|
-
|
|
495
|
+
## Description
|
|
168
496
|
|
|
169
|
-
|
|
170
|
-
fetchDenomOwners(denom: string)
|
|
171
|
-
```
|
|
497
|
+
Fetches **all accounts that hold a non-zero balance** of a specific denom, along with the amount each holds.
|
|
172
498
|
|
|
173
|
-
|
|
499
|
+
This is a full holder list query. For widely held tokens like `uzig`, this can return a very large paginated dataset — `uzig` has over 129,000 holders on testnet.
|
|
500
|
+
|
|
501
|
+
## Parameters
|
|
502
|
+
|
|
503
|
+
| Name | Type | Description |
|
|
504
|
+
| ----- | ------ | ------------------------------------------------ |
|
|
505
|
+
| denom | string | Token identifier to query the holder list for |
|
|
506
|
+
|
|
507
|
+
## Usage Example
|
|
174
508
|
|
|
175
509
|
```ts
|
|
176
510
|
const owners = await bankApi.fetchDenomOwners('uzig')
|
|
177
|
-
console.
|
|
511
|
+
console.dir(owners, { depth: null })
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## Example Response
|
|
515
|
+
|
|
516
|
+
```json
|
|
517
|
+
{
|
|
518
|
+
"denom_owners": [
|
|
519
|
+
{
|
|
520
|
+
"address": "zig1qqqxk89xs2hnm59cuwdej6f4r8l9552nth4tj4",
|
|
521
|
+
"balance": { "denom": "uzig", "amount": "99255569" }
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"address": "zig1qqqk3yl9dgfh88mg2hlcanjh2easyu6u6lk2m5",
|
|
525
|
+
"balance": { "denom": "uzig", "amount": "199106024" }
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
"pagination": {
|
|
529
|
+
"next_key": "FAAs0VsyF6XXIzu1kVs/+aGFecf2",
|
|
530
|
+
"total": "129756"
|
|
531
|
+
}
|
|
532
|
+
}
|
|
178
533
|
```
|
|
179
534
|
|
|
535
|
+
## Response Field Explanation
|
|
536
|
+
|
|
537
|
+
### `denom_owners`
|
|
538
|
+
|
|
539
|
+
Array of all accounts holding this token.
|
|
540
|
+
|
|
541
|
+
Each entry contains:
|
|
542
|
+
|
|
543
|
+
| Field | Description |
|
|
544
|
+
| --------------- | -------------------------------------------- |
|
|
545
|
+
| address | Bech32 address of the token holder |
|
|
546
|
+
| balance.denom | The queried denomination |
|
|
547
|
+
| balance.amount | Amount held by this address, as a string |
|
|
548
|
+
|
|
549
|
+
### `pagination`
|
|
550
|
+
|
|
551
|
+
| Field | Description |
|
|
552
|
+
| -------- | -------------------------------------------------------------------------------- |
|
|
553
|
+
| next_key | Base64-encoded cursor for the next page. `null` when all results are returned |
|
|
554
|
+
| total | Total number of accounts holding this denom |
|
|
555
|
+
|
|
556
|
+
> ⚠️ For native tokens like `uzig`, this list can exceed 100,000 entries. Always check `pagination.next_key` and handle multi-page responses if you need the complete dataset.
|
|
557
|
+
|
|
558
|
+
## When to Use
|
|
559
|
+
|
|
560
|
+
* Building token holder leaderboards
|
|
561
|
+
* Analytics on token distribution and concentration
|
|
562
|
+
* Checking whether a specific address holds a given token
|
|
563
|
+
|
|
180
564
|
---
|
|
181
565
|
|
|
182
|
-
|
|
566
|
+
# 7️⃣ fetchAllDenomsMetadata
|
|
567
|
+
|
|
568
|
+
## Method
|
|
183
569
|
|
|
184
|
-
|
|
570
|
+
```ts
|
|
571
|
+
async fetchAllDenomsMetadata()
|
|
572
|
+
```
|
|
185
573
|
|
|
186
|
-
|
|
574
|
+
## CLI Equivalent
|
|
187
575
|
|
|
188
576
|
```bash
|
|
189
577
|
zigchaind query bank denoms-metadata
|
|
190
578
|
```
|
|
191
579
|
|
|
192
|
-
|
|
580
|
+
## Description
|
|
193
581
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
582
|
+
Fetches **metadata for all registered token denominations** on the chain in a single paginated response.
|
|
583
|
+
|
|
584
|
+
This is the bulk version of `fetchDenomMetadata` — instead of querying one denom at a time, this returns metadata for every denom that has registered metadata on-chain. On ZigChain testnet, this spans nearly 3,000 entries including native tokens and factory-created tokens.
|
|
585
|
+
|
|
586
|
+
> ⚠️ Not every denom has registered metadata. Denoms without metadata will not appear in this response.
|
|
197
587
|
|
|
198
|
-
|
|
588
|
+
## Parameters
|
|
589
|
+
|
|
590
|
+
None.
|
|
591
|
+
|
|
592
|
+
## Usage Example
|
|
199
593
|
|
|
200
594
|
```ts
|
|
201
595
|
const allMetadata = await bankApi.fetchAllDenomsMetadata()
|
|
202
|
-
console.
|
|
203
|
-
```
|
|
596
|
+
console.dir(allMetadata, { depth: null })
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## Example Response
|
|
600
|
+
|
|
601
|
+
```json
|
|
602
|
+
{
|
|
603
|
+
"metadatas": [
|
|
604
|
+
{
|
|
605
|
+
"description": "ZIGChain Test Native Token",
|
|
606
|
+
"denom_units": [
|
|
607
|
+
{ "denom": "uzig", "exponent": 0, "aliases": ["microzig"] },
|
|
608
|
+
{ "denom": "zig", "exponent": 6, "aliases": [] }
|
|
609
|
+
],
|
|
610
|
+
"base": "uzig",
|
|
611
|
+
"display": "zig",
|
|
612
|
+
"name": "ZIG",
|
|
613
|
+
"symbol": "ZIG",
|
|
614
|
+
"uri": "",
|
|
615
|
+
"uri_hash": ""
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"description": "Cool denom: coin.zig10xvc3tkqrdyym6ep9lrt5005mrwvw6rml66qv7jxwnzlpqfmw7ksq7n7nm.callumdi",
|
|
619
|
+
"denom_units": [
|
|
620
|
+
{
|
|
621
|
+
"denom": "coin.zig10xvc3tkqrdyym6ep9lrt5005mrwvw6rml66qv7jxwnzlpqfmw7ksq7n7nm.callumdi",
|
|
622
|
+
"exponent": 0,
|
|
623
|
+
"aliases": []
|
|
624
|
+
},
|
|
625
|
+
{ "denom": "callumdi", "exponent": 6, "aliases": [] }
|
|
626
|
+
],
|
|
627
|
+
"base": "coin.zig10xvc3tkqrdyym6ep9lrt5005mrwvw6rml66qv7jxwnzlpqfmw7ksq7n7nm.callumdi",
|
|
628
|
+
"display": "coin.zig10xvc3tkqrdyym6ep9lrt5005mrwvw6rml66qv7jxwnzlpqfmw7ksq7n7nm.callumdi",
|
|
629
|
+
"name": "callumdi",
|
|
630
|
+
"symbol": "modiad",
|
|
631
|
+
"uri": "https://memesfun.mypinata.cloud/ipfs/bafkreifb4n6bkfvrh25rl6rpvoq7yva5b4xjut3tqidjyxishhgyi67ohi",
|
|
632
|
+
"uri_hash": "2943831a20722913d07baf10952816d85671b1f773120005cc0063056ff980bd"
|
|
633
|
+
}
|
|
634
|
+
],
|
|
635
|
+
"pagination": {
|
|
636
|
+
"next_key": "Y29pbi56aWcxMHh2YzN0a3FyZHl5bTZlcDlscnQ1MDA1bXJ3dnc2cm1sNjZxdjdqeHduemxwcWZtdzdrc3E3bjdubS5jaGVja2luZ2Jp",
|
|
637
|
+
"total": "2963"
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
## Response Field Explanation
|
|
643
|
+
|
|
644
|
+
### `metadatas`
|
|
645
|
+
|
|
646
|
+
Array of metadata entries for all registered denoms. Each entry has the same structure as the response from `fetchDenomMetadata`.
|
|
647
|
+
|
|
648
|
+
| Field | Description |
|
|
649
|
+
| ----------- | -------------------------------------------------------------------- |
|
|
650
|
+
| description | Human-readable description of the token |
|
|
651
|
+
| denom_units | Denomination hierarchy at different decimal exponents |
|
|
652
|
+
| base | Smallest indivisible unit — used for all on-chain operations |
|
|
653
|
+
| display | Recommended unit to show in UIs |
|
|
654
|
+
| name | Full token name |
|
|
655
|
+
| symbol | Short ticker symbol |
|
|
656
|
+
| uri | Optional link to token image or extended metadata (e.g. IPFS) |
|
|
657
|
+
| uri_hash | Hash of the URI content for integrity verification |
|
|
658
|
+
|
|
659
|
+
### `pagination`
|
|
660
|
+
|
|
661
|
+
| Field | Description |
|
|
662
|
+
| -------- | ----------------------------------------------------------------------------- |
|
|
663
|
+
| next_key | Base64-encoded cursor for the next page. `null` when all results are returned |
|
|
664
|
+
| total | Total number of denoms with registered metadata on the chain |
|
|
665
|
+
|
|
666
|
+
### `fetchDenomMetadata` vs `fetchAllDenomsMetadata`
|
|
667
|
+
|
|
668
|
+
| Feature | fetchDenomMetadata | fetchAllDenomsMetadata |
|
|
669
|
+
| --------------------- | ------------------------- | ------------------------------ |
|
|
670
|
+
| Targets specific denom | ✅ Yes | ❌ Returns all denoms |
|
|
671
|
+
| Response size | Minimal | Large (paginated, 2963+ items) |
|
|
672
|
+
| Use case | Single token info lookup | Full metadata index |
|
|
673
|
+
|
|
674
|
+
## When to Use
|
|
675
|
+
|
|
676
|
+
* Building a token registry or explorer index
|
|
677
|
+
* Populating token lists with names, symbols and icons
|
|
678
|
+
* Indexing all factory token metadata
|
|
679
|
+
* Resolving display units and decimal precision for all tokens at once
|
|
204
680
|
|
|
205
681
|
---
|
|
206
682
|
|
|
207
|
-
|
|
683
|
+
# 8️⃣ fetchSendEnabled
|
|
684
|
+
|
|
685
|
+
## Method
|
|
208
686
|
|
|
209
|
-
|
|
687
|
+
```ts
|
|
688
|
+
async fetchSendEnabled()
|
|
689
|
+
```
|
|
210
690
|
|
|
211
|
-
|
|
691
|
+
## CLI Equivalent
|
|
212
692
|
|
|
213
693
|
```bash
|
|
214
694
|
zigchaind query bank send-enabled
|
|
215
695
|
```
|
|
216
696
|
|
|
217
|
-
|
|
697
|
+
## Description
|
|
218
698
|
|
|
219
|
-
|
|
220
|
-
fetchSendEnabled()
|
|
221
|
-
```
|
|
699
|
+
Fetches the list of **per-denom send restrictions** configured on the chain.
|
|
222
700
|
|
|
223
|
-
**
|
|
701
|
+
By default, all tokens are sendable. This endpoint only returns entries for denoms where the default has been **explicitly overridden** — either to disable sending for a normally-enabled denom, or enable it for a restricted one.
|
|
702
|
+
|
|
703
|
+
The overall default send behaviour is governed by `fetchParams` (`default_send_enabled`).
|
|
704
|
+
|
|
705
|
+
## Parameters
|
|
706
|
+
|
|
707
|
+
None.
|
|
708
|
+
|
|
709
|
+
## Usage Example
|
|
224
710
|
|
|
225
711
|
```ts
|
|
226
712
|
const sendEnabled = await bankApi.fetchSendEnabled()
|
|
227
|
-
console.
|
|
713
|
+
console.dir(sendEnabled, { depth: null })
|
|
228
714
|
```
|
|
229
715
|
|
|
716
|
+
## Example Response
|
|
717
|
+
|
|
718
|
+
```json
|
|
719
|
+
{
|
|
720
|
+
"send_enabled": [],
|
|
721
|
+
"pagination": {
|
|
722
|
+
"next_key": null,
|
|
723
|
+
"total": "0"
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
## Response Field Explanation
|
|
729
|
+
|
|
730
|
+
### `send_enabled`
|
|
731
|
+
|
|
732
|
+
Array of per-denom send override entries.
|
|
733
|
+
|
|
734
|
+
An **empty array** means no denoms have had their default send behaviour overridden — this is the normal healthy state of the chain.
|
|
735
|
+
|
|
736
|
+
If entries are present, each would contain:
|
|
737
|
+
|
|
738
|
+
| Field | Description |
|
|
739
|
+
| ------- | -------------------------------------------------------- |
|
|
740
|
+
| denom | Token denomination with a send override applied |
|
|
741
|
+
| enabled | `true` if sending is explicitly enabled, `false` if disabled |
|
|
742
|
+
|
|
743
|
+
### `pagination`
|
|
744
|
+
|
|
745
|
+
| Field | Description |
|
|
746
|
+
| -------- | ----------------------------------------------------- |
|
|
747
|
+
| next_key | Cursor for next page. `null` if no more results |
|
|
748
|
+
| total | Number of denoms with explicit send overrides |
|
|
749
|
+
|
|
750
|
+
> On ZigChain testnet, `send_enabled` is empty and `total` is `0` — meaning all tokens follow the default send behaviour defined in bank params (`default_send_enabled: true`).
|
|
751
|
+
|
|
752
|
+
## When to Use
|
|
753
|
+
|
|
754
|
+
* Verifying whether a specific token can be transferred
|
|
755
|
+
* Chain governance monitoring for send restriction changes
|
|
756
|
+
|
|
230
757
|
---
|
|
231
758
|
|
|
232
|
-
|
|
759
|
+
# 9️⃣ fetchSpendableBalance
|
|
760
|
+
|
|
761
|
+
## Method
|
|
233
762
|
|
|
234
|
-
|
|
235
|
-
|
|
763
|
+
```ts
|
|
764
|
+
async fetchSpendableBalance(address: string, denom: string)
|
|
765
|
+
```
|
|
236
766
|
|
|
237
|
-
|
|
767
|
+
## CLI Equivalent
|
|
238
768
|
|
|
239
769
|
```bash
|
|
240
770
|
zigchaind query bank spendable-balance <address> <denom>
|
|
241
771
|
```
|
|
242
772
|
|
|
243
|
-
|
|
773
|
+
## Description
|
|
244
774
|
|
|
245
|
-
|
|
246
|
-
fetchSpendableBalance(address: string, denom: string)
|
|
247
|
-
```
|
|
775
|
+
Fetches the **spendable balance** of a specific denom for an account.
|
|
248
776
|
|
|
249
|
-
**
|
|
777
|
+
The spendable balance is the portion of an account's holdings that is **immediately available** for use. It excludes any tokens that are locked, bonded or otherwise restricted.
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
## Parameters
|
|
781
|
+
|
|
782
|
+
| Name | Type | Description |
|
|
783
|
+
| ------- | ------ | --------------------------------------------- |
|
|
784
|
+
| address | string | Bech32 address of the account to query |
|
|
785
|
+
| denom | string | Token denomination to query spendable balance for |
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
## Usage Example
|
|
250
790
|
|
|
251
791
|
```ts
|
|
252
|
-
const spendable = await bankApi.fetchSpendableBalance(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
792
|
+
const spendable = await bankApi.fetchSpendableBalance(address, 'uzig')
|
|
793
|
+
console.dir(spendable, { depth: null })
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
## Example Response
|
|
256
797
|
|
|
257
|
-
|
|
798
|
+
```json
|
|
799
|
+
{
|
|
800
|
+
"balance": {
|
|
801
|
+
"denom": "uzig",
|
|
802
|
+
"amount": "443143284"
|
|
803
|
+
}
|
|
804
|
+
}
|
|
258
805
|
```
|
|
259
806
|
|
|
807
|
+
## Response Field Explanation
|
|
808
|
+
|
|
809
|
+
### `balance`
|
|
810
|
+
|
|
811
|
+
| Field | Description |
|
|
812
|
+
| ------ | --------------------------------------------------------- |
|
|
813
|
+
| denom | The queried token denomination |
|
|
814
|
+
| amount | Spendable (unlocked, available) amount, as a string |
|
|
815
|
+
|
|
816
|
+
### `fetchBalance` vs `fetchSpendableBalance`
|
|
817
|
+
|
|
818
|
+
| Feature | fetchBalance | fetchSpendableBalance |
|
|
819
|
+
| -------------------- | ------------------------- | ------------------------------- |
|
|
820
|
+
| Includes locked tokens | ✅ Yes (total balance) | ❌ No (available only) |
|
|
821
|
+
| Useful for vesting accounts | ❌ May overstate | ✅ Accurate available amount |
|
|
822
|
+
| Use case | Total holdings inspection | Transaction pre-flight checks |
|
|
823
|
+
|
|
824
|
+
## When to Use
|
|
825
|
+
|
|
826
|
+
* Checking available funds before sending a transaction
|
|
827
|
+
* Wallet UIs displaying spendable vs total balance
|
|
828
|
+
|
|
260
829
|
---
|
|
261
830
|
|
|
262
|
-
|
|
831
|
+
# 🔟 fetchSpendableBalances
|
|
263
832
|
|
|
264
|
-
|
|
833
|
+
## Method
|
|
265
834
|
|
|
266
|
-
|
|
835
|
+
```ts
|
|
836
|
+
async fetchSpendableBalances(address: string)
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
## CLI Equivalent
|
|
267
840
|
|
|
268
841
|
```bash
|
|
269
842
|
zigchaind query bank spendable-balances <address>
|
|
270
843
|
```
|
|
271
844
|
|
|
272
|
-
|
|
845
|
+
## Description
|
|
273
846
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
847
|
+
Fetches the **spendable balance across all denoms** for an account.
|
|
848
|
+
|
|
849
|
+
This is the bulk version of `fetchSpendableBalance` — instead of querying one denom at a time, it returns all spendable token balances for the address in a single paginated response.
|
|
850
|
+
|
|
851
|
+
For standard accounts, this will match `fetchBalances`. For vesting accounts, amounts may differ.
|
|
852
|
+
|
|
853
|
+
## Parameters
|
|
277
854
|
|
|
278
|
-
|
|
855
|
+
| Name | Type | Description |
|
|
856
|
+
| ------- | ------ | -------------------------------------- |
|
|
857
|
+
| address | string | Bech32 address of the account to query |
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
## Usage Example
|
|
279
862
|
|
|
280
863
|
```ts
|
|
281
|
-
const spendableBalances = await bankApi.fetchSpendableBalances(
|
|
282
|
-
|
|
283
|
-
|
|
864
|
+
const spendableBalances = await bankApi.fetchSpendableBalances(address)
|
|
865
|
+
console.dir(spendableBalances, { depth: null })
|
|
866
|
+
```
|
|
284
867
|
|
|
285
|
-
|
|
868
|
+
## Example Response
|
|
869
|
+
|
|
870
|
+
```json
|
|
871
|
+
{
|
|
872
|
+
"balances": [
|
|
873
|
+
{
|
|
874
|
+
"denom": "coin.zig1zpnw5dtzzttmgtdjgtywt08wnlyyskpuupy3cfw8mytlslx54j9sgz6w4n.oroswap",
|
|
875
|
+
"amount": "222026"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"denom": "uzig",
|
|
879
|
+
"amount": "443143284"
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
"pagination": {
|
|
883
|
+
"next_key": null,
|
|
884
|
+
"total": "2"
|
|
885
|
+
}
|
|
886
|
+
}
|
|
286
887
|
```
|
|
287
888
|
|
|
889
|
+
## Response Field Explanation
|
|
890
|
+
|
|
891
|
+
### `balances`
|
|
892
|
+
|
|
893
|
+
Array of spendable token balances across all held denoms.
|
|
894
|
+
|
|
895
|
+
| Field | Description |
|
|
896
|
+
| ------ | ------------------------------------------------ |
|
|
897
|
+
| denom | Token denomination |
|
|
898
|
+
| amount | Spendable (unlocked, available) amount as string |
|
|
899
|
+
|
|
900
|
+
### `pagination`
|
|
901
|
+
|
|
902
|
+
| Field | Description |
|
|
903
|
+
| -------- | ----------------------------------------------------- |
|
|
904
|
+
| next_key | Cursor for next page. `null` if no more results |
|
|
905
|
+
| total | Total number of spendable denom balances |
|
|
906
|
+
|
|
907
|
+
## When to Use
|
|
908
|
+
|
|
909
|
+
* Full portfolio view showing only available funds
|
|
910
|
+
|
|
288
911
|
---
|
|
289
912
|
|
|
290
|
-
|
|
913
|
+
# 1️⃣1️⃣ fetchParams
|
|
914
|
+
|
|
915
|
+
## Method
|
|
291
916
|
|
|
292
|
-
|
|
917
|
+
```ts
|
|
918
|
+
async fetchParams()
|
|
919
|
+
```
|
|
293
920
|
|
|
294
|
-
|
|
921
|
+
## CLI Equivalent
|
|
295
922
|
|
|
296
923
|
```bash
|
|
297
924
|
zigchaind query bank params
|
|
298
|
-
zigchaind query bank params --height <H>
|
|
299
925
|
```
|
|
300
926
|
|
|
301
|
-
|
|
927
|
+
## Description
|
|
302
928
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
929
|
+
Fetches the **Bank module parameters** configured at chain level.
|
|
930
|
+
|
|
931
|
+
These are governance-controlled settings that define the default token transfer behaviour for the entire chain. Currently, the key parameter is `default_send_enabled` which acts as the chain-wide default for whether tokens can be sent.
|
|
306
932
|
|
|
307
|
-
|
|
933
|
+
## Parameters
|
|
934
|
+
|
|
935
|
+
None.
|
|
936
|
+
|
|
937
|
+
## Usage Example
|
|
308
938
|
|
|
309
939
|
```ts
|
|
310
940
|
const params = await bankApi.fetchParams()
|
|
311
|
-
console.
|
|
941
|
+
console.dir(params, { depth: null })
|
|
312
942
|
```
|
|
313
943
|
|
|
944
|
+
## Example Response
|
|
945
|
+
|
|
946
|
+
```json
|
|
947
|
+
{
|
|
948
|
+
"params": {
|
|
949
|
+
"send_enabled": [],
|
|
950
|
+
"default_send_enabled": true
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
## Response Field Explanation
|
|
956
|
+
|
|
957
|
+
### `params`
|
|
958
|
+
|
|
959
|
+
| Field | Description |
|
|
960
|
+
| -------------------- | ------------------------------------------------------------------------------ |
|
|
961
|
+
| send_enabled | Array of per-denom send overrides. Empty means no overrides are set |
|
|
962
|
+
| default_send_enabled | Chain-wide default — `true` means all tokens are sendable unless overridden |
|
|
963
|
+
|
|
964
|
+
> `default_send_enabled: true` combined with an empty `send_enabled` array means **all tokens on the chain are freely transferable** with no restrictions. This is the normal operating state of ZigChain.
|
|
965
|
+
|
|
966
|
+
## When to Use
|
|
967
|
+
|
|
968
|
+
* Checking the chain-wide default transfer policy
|
|
969
|
+
* Governance monitoring for parameter change proposals
|
|
970
|
+
* Building chain configuration or status dashboards
|
|
971
|
+
* Security auditing of token transfer rules
|
|
972
|
+
|
|
314
973
|
---
|
|
315
974
|
|