@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/block-results.md
CHANGED
|
@@ -1,7 +1,103 @@
|
|
|
1
1
|
# Block Results
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
## What are the Block Results?
|
|
4
|
+
|
|
5
|
+
The **Block Results** provides access to the **execution results of a specific block** on ZigChain.
|
|
6
|
+
|
|
7
|
+
While other modules query the current state of the chain (balances, accounts, validators), the Block Results module lets you look back at what actually *happened* in a given block — every transaction that was processed, every event emitted, and every state change that occurred.
|
|
8
|
+
|
|
9
|
+
> ⚠️ **Important:** This module uses the **RPC endpoint**, not the LCD endpoint used by all other modules. This is handled automatically by the SDK — no extra configuration is needed.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Important Terminology
|
|
14
|
+
|
|
15
|
+
### Block
|
|
16
|
+
|
|
17
|
+
A **block** is a unit of the blockchain containing an ordered set of transactions. Each block is identified by a unique sequential **height**.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### Block Height
|
|
22
|
+
|
|
23
|
+
The position of a block in the chain, starting from `1`. Every new block increments the height by `1`.
|
|
24
|
+
|
|
25
|
+
Example:
|
|
26
|
+
```
|
|
27
|
+
height = 2990050
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Transaction Result (`txs_results`)
|
|
33
|
+
|
|
34
|
+
The execution outcome of each transaction included in the block.
|
|
35
|
+
|
|
36
|
+
Each result includes:
|
|
37
|
+
|
|
38
|
+
- Whether the transaction **succeeded or failed** (`code`)
|
|
39
|
+
- **Gas** consumed vs requested
|
|
40
|
+
- **Events** emitted during execution
|
|
41
|
+
- An **error log** if the transaction failed
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Transaction Code
|
|
46
|
+
|
|
47
|
+
A numeric result code indicating transaction success or failure.
|
|
48
|
+
|
|
49
|
+
| Code | Meaning |
|
|
50
|
+
| ---- | ------- |
|
|
51
|
+
| `0` | Success — transaction executed without errors |
|
|
52
|
+
| Any non-zero | Failure — see `log` for the error message |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### Events
|
|
57
|
+
|
|
58
|
+
**Events** are structured log entries emitted during block and transaction execution. They are the primary way to track on-chain activity such as token transfers, contract executions, reward distributions, and fee payments.
|
|
59
|
+
|
|
60
|
+
Each event has a `type` and an array of `attributes` (key-value pairs).
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### Common Event Types
|
|
65
|
+
|
|
66
|
+
| Event Type | Description |
|
|
67
|
+
| ------------------- | ---------------------------------------------------- |
|
|
68
|
+
| `coin_spent` | Tokens were debited from an address |
|
|
69
|
+
| `coin_received` | Tokens were credited to an address |
|
|
70
|
+
| `transfer` | A token transfer occurred between addresses |
|
|
71
|
+
| `message` | A message was processed (action, sender, etc.) |
|
|
72
|
+
| `tx` | Transaction-level metadata (fee, signature, acc_seq) |
|
|
73
|
+
| `execute` | A CosmWasm contract was executed |
|
|
74
|
+
| `wasm` | Events emitted from within a CosmWasm contract |
|
|
75
|
+
| `coinbase` | New tokens were minted |
|
|
76
|
+
| `mint` | Block-level inflation minting details |
|
|
77
|
+
| `commission` | Validator commission was distributed |
|
|
78
|
+
| `rewards` | Staking rewards were distributed to validators |
|
|
79
|
+
| `denom_minted_and_sent` | Factory module minted and transferred tokens |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### Finalize Block Events (`finalize_block_events`)
|
|
84
|
+
|
|
85
|
+
Events that occur at the **block level** rather than within individual transactions. These cover system-level operations that happen automatically each block, such as:
|
|
86
|
+
|
|
87
|
+
- Inflation minting
|
|
88
|
+
- Fee collection
|
|
89
|
+
- Staking reward and commission distribution to validators
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Gas
|
|
94
|
+
|
|
95
|
+
| Field | Description |
|
|
96
|
+
| ------------ | ------------------------------------------------------------ |
|
|
97
|
+
| `gas_wanted` | Maximum gas the transaction sender authorized |
|
|
98
|
+
| `gas_used` | Actual gas consumed during execution |
|
|
99
|
+
|
|
100
|
+
> If `gas_used` approaches `gas_wanted`, the transaction may have been close to running out of gas.
|
|
5
101
|
|
|
6
102
|
---
|
|
7
103
|
|
|
@@ -20,45 +116,256 @@ const blockResultsApi = new ChainBlockResultsApi(endpoints)
|
|
|
20
116
|
|
|
21
117
|
---
|
|
22
118
|
|
|
23
|
-
|
|
119
|
+
# 1️⃣ fetchBlockResults
|
|
24
120
|
|
|
25
|
-
|
|
121
|
+
## Method
|
|
26
122
|
|
|
27
|
-
|
|
123
|
+
```ts
|
|
124
|
+
async fetchBlockResults(height: number)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## CLI Equivalent
|
|
28
128
|
|
|
29
129
|
```bash
|
|
30
130
|
zigchaind query block-results <height>
|
|
31
131
|
```
|
|
32
132
|
|
|
33
|
-
|
|
133
|
+
---
|
|
34
134
|
|
|
35
|
-
|
|
36
|
-
fetchBlockResults(height: number)
|
|
37
|
-
```
|
|
135
|
+
## Description
|
|
38
136
|
|
|
39
|
-
**
|
|
137
|
+
Fetches the **full execution results for a specific block** by height.
|
|
40
138
|
|
|
41
|
-
|
|
139
|
+
This includes every transaction result processed in that block, all events emitted at the transaction level, all events emitted at the block level (finalize block events), validator updates, and consensus parameter updates.
|
|
42
140
|
|
|
43
|
-
|
|
141
|
+
This is the most detailed view available for what happened at a specific point in chain history.
|
|
44
142
|
|
|
45
|
-
|
|
143
|
+
> ⚠️ This function queries the **RPC endpoint** internally, unlike all other SDK modules which use the LCD endpoint.
|
|
46
144
|
|
|
47
|
-
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Parameters
|
|
148
|
+
|
|
149
|
+
| Name | Type | Required | Description |
|
|
150
|
+
| ------ | ------ | -------- | ---------------------------------- |
|
|
151
|
+
| height | number | ✅ Yes | Block height to fetch results for |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Usage Example
|
|
48
156
|
|
|
49
157
|
```ts
|
|
50
|
-
const
|
|
51
|
-
const results = await blockResultsApi.fetchBlockResults(height)
|
|
52
|
-
console.log(`Block Results at height ${height}:`)
|
|
158
|
+
const results = await blockResultsApi.fetchBlockResults(2990050)
|
|
53
159
|
console.dir(results, { depth: null })
|
|
54
160
|
```
|
|
55
161
|
|
|
162
|
+
## Example Response
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"jsonrpc": "2.0",
|
|
167
|
+
"id": -1,
|
|
168
|
+
"result": {
|
|
169
|
+
"height": "2990050",
|
|
170
|
+
"txs_results": [
|
|
171
|
+
{
|
|
172
|
+
"code": 0,
|
|
173
|
+
"data": "Ei4KLC9jb3Ntd2FzbS53YXNtLnYxLk1zZ0V4ZWN1dGVDb250cmFjdFJlc3BvbnNl",
|
|
174
|
+
"log": "",
|
|
175
|
+
"info": "",
|
|
176
|
+
"gas_wanted": "286320",
|
|
177
|
+
"gas_used": "245458",
|
|
178
|
+
"events": [
|
|
179
|
+
{
|
|
180
|
+
"type": "transfer",
|
|
181
|
+
"attributes": [
|
|
182
|
+
{ "key": "recipient", "value": "zig17xpfvakm2amg962yls6f84z3kell8c5l3nxjf4", "index": true },
|
|
183
|
+
{ "key": "sender", "value": "zig1eyrwj20cujzwrln2gztmxgfx2vkp0l6le3xf2z", "index": true },
|
|
184
|
+
{ "key": "amount", "value": "8590uzig", "index": true }
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "wasm",
|
|
189
|
+
"attributes": [
|
|
190
|
+
{ "key": "_contract_address", "value": "zig15jqg0hmp9n06q0as7uk3x9xkwr9k3r7yh4ww2uc0hek8zlryrgmsamk4qg", "index": true },
|
|
191
|
+
{ "key": "action", "value": "provide_liquidity", "index": true },
|
|
192
|
+
{ "key": "share", "value": "285", "index": true }
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"codespace": ""
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"code": 5,
|
|
200
|
+
"data": null,
|
|
201
|
+
"log": "failed to execute message; message index: 0: Operation exceeds max spread limit: execute wasm contract failed",
|
|
202
|
+
"gas_wanted": "500000",
|
|
203
|
+
"gas_used": "212387",
|
|
204
|
+
"events": [...],
|
|
205
|
+
"codespace": "wasm"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"finalize_block_events": [
|
|
209
|
+
{
|
|
210
|
+
"type": "mint",
|
|
211
|
+
"attributes": [
|
|
212
|
+
{ "key": "bonded_ratio", "value": "0.043487338234004096", "index": true },
|
|
213
|
+
{ "key": "inflation", "value": "0.013406523098689013", "index": true },
|
|
214
|
+
{ "key": "annual_provisions", "value": "31088831973883.453729872137993930", "index": true },
|
|
215
|
+
{ "key": "amount", "value": "2464550", "index": true }
|
|
216
|
+
]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"type": "rewards",
|
|
220
|
+
"attributes": [
|
|
221
|
+
{ "key": "amount", "value": "619572.861060342856543622uzig", "index": true },
|
|
222
|
+
{ "key": "validator", "value": "zigvaloper1pwwymlyeyfcz3pjvcegvz8tj3yf0pr3wqqhrwk", "index": true }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"validator_updates": null,
|
|
227
|
+
"consensus_param_updates": {
|
|
228
|
+
"block": { "max_bytes": "5000000", "max_gas": "100000000" },
|
|
229
|
+
"evidence": {
|
|
230
|
+
"max_age_num_blocks": "100000",
|
|
231
|
+
"max_age_duration": "172800000000000",
|
|
232
|
+
"max_bytes": "1048576"
|
|
233
|
+
},
|
|
234
|
+
"validator": { "pub_key_types": ["ed25519"] }
|
|
235
|
+
},
|
|
236
|
+
"app_hash": "PPCXOVQT5jIl2vYJvYUjDbgYe36WtCVdzuNx3mmF+dk="
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Response Field Explanation
|
|
244
|
+
|
|
245
|
+
### Top-level wrapper
|
|
246
|
+
|
|
247
|
+
| Field | Description |
|
|
248
|
+
| ------- | ------------------------------------------------ |
|
|
249
|
+
| jsonrpc | JSON-RPC protocol version (always `"2.0"`) |
|
|
250
|
+
| id | Request ID (always `-1` for SDK queries) |
|
|
251
|
+
| result | The actual block results payload |
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
### `result`
|
|
256
|
+
|
|
257
|
+
| Field | Description |
|
|
258
|
+
| ------------------------ | -------------------------------------------------------------------- |
|
|
259
|
+
| height | Block height this result corresponds to |
|
|
260
|
+
| txs_results | Array of execution results, one per transaction in the block |
|
|
261
|
+
| finalize_block_events | Block-level events (inflation, rewards, commissions) |
|
|
262
|
+
| validator_updates | Any validator set changes applied at this block. `null` if none |
|
|
263
|
+
| consensus_param_updates | Consensus configuration active at this block |
|
|
264
|
+
| app_hash | Application state hash after this block was applied |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### `txs_results[]` — Per-Transaction Result
|
|
269
|
+
|
|
270
|
+
| Field | Description |
|
|
271
|
+
| ----------- | ------------------------------------------------------------------------ |
|
|
272
|
+
| code | `0` = success. Any non-zero = failure |
|
|
273
|
+
| data | Base64-encoded protobuf response from the message handler |
|
|
274
|
+
| log | Empty on success. Contains the error message on failure |
|
|
275
|
+
| info | Optional additional info string |
|
|
276
|
+
| gas_wanted | Gas limit set by the transaction sender |
|
|
277
|
+
| gas_used | Actual gas consumed during execution |
|
|
278
|
+
| events | Array of events emitted by this transaction |
|
|
279
|
+
| codespace | Module namespace for the error code. Empty on success |
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
### `events[]` — Event Structure
|
|
284
|
+
|
|
285
|
+
Each event (at both transaction and block level) follows this structure:
|
|
286
|
+
|
|
287
|
+
| Field | Description |
|
|
288
|
+
| ---------- | ---------------------------------------------------- |
|
|
289
|
+
| type | Event category (e.g. `transfer`, `wasm`, `mint`) |
|
|
290
|
+
| attributes | Array of key-value pairs describing the event detail |
|
|
291
|
+
|
|
292
|
+
Each attribute contains:
|
|
293
|
+
|
|
294
|
+
| Field | Description |
|
|
295
|
+
| ----- | ------------------------------------------------------ |
|
|
296
|
+
| key | Attribute name |
|
|
297
|
+
| value | Attribute value |
|
|
298
|
+
| index | Whether this attribute is indexed for event search |
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
### `finalize_block_events[]` — Block-Level Events
|
|
303
|
+
|
|
304
|
+
These events fire automatically each block regardless of transactions. Common block-level events and their attributes:
|
|
305
|
+
|
|
306
|
+
**`mint`** — Inflation tokens minted this block
|
|
307
|
+
|
|
308
|
+
| Attribute | Description |
|
|
309
|
+
| ------------------ | ---------------------------------------- |
|
|
310
|
+
| bonded_ratio | Fraction of supply currently staked |
|
|
311
|
+
| inflation | Current annual inflation rate |
|
|
312
|
+
| annual_provisions | Projected annual token emission |
|
|
313
|
+
| amount | Tokens minted this block (in `uzig`) |
|
|
314
|
+
|
|
315
|
+
**`commission`** — Validator commission distributed
|
|
316
|
+
|
|
317
|
+
| Attribute | Description |
|
|
318
|
+
| --------- | ----------------------------------- |
|
|
319
|
+
| amount | Commission amount paid |
|
|
320
|
+
| validator | Validator operator address |
|
|
321
|
+
|
|
322
|
+
**`rewards`** — Staking rewards distributed
|
|
323
|
+
|
|
324
|
+
| Attribute | Description |
|
|
325
|
+
| --------- | ------------------------------------- |
|
|
326
|
+
| amount | Total rewards distributed |
|
|
327
|
+
| validator | Validator operator address |
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### `consensus_param_updates`
|
|
332
|
+
|
|
333
|
+
Active consensus configuration for this block.
|
|
334
|
+
|
|
335
|
+
| Field | Description |
|
|
336
|
+
| ------------------------------ | --------------------------------------------------- |
|
|
337
|
+
| block.max_bytes | Maximum block size in bytes |
|
|
338
|
+
| block.max_gas | Maximum gas allowed per block |
|
|
339
|
+
| evidence.max_age_num_blocks | How many blocks back evidence remains valid |
|
|
340
|
+
| evidence.max_age_duration | Time duration evidence remains valid (nanoseconds) |
|
|
341
|
+
| evidence.max_bytes | Maximum evidence size per block |
|
|
342
|
+
| validator.pub_key_types | Accepted validator key types (e.g. `ed25519`) |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Reading a Failed Transaction
|
|
347
|
+
|
|
348
|
+
When `code` is non-zero, the `log` field contains the error reason and `codespace` identifies which module raised it:
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"code": 5,
|
|
353
|
+
"log": "failed to execute message; message index: 0: Operation exceeds max spread limit: execute wasm contract failed",
|
|
354
|
+
"codespace": "wasm"
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
> Even failed transactions consume gas and emit fee-related events (the fee is still charged).
|
|
359
|
+
|
|
56
360
|
---
|
|
57
361
|
|
|
58
|
-
##
|
|
362
|
+
## When to Use
|
|
59
363
|
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
364
|
+
* Indexing all on-chain activity for a given block
|
|
365
|
+
* Building block explorer transaction detail pages
|
|
366
|
+
* Tracking contract executions and their emitted events
|
|
367
|
+
* Monitoring validator reward and commission distribution
|
|
368
|
+
* Debugging failed transactions and identifying error reasons
|
|
369
|
+
* Auditing token flows within a specific block
|
|
63
370
|
|
|
64
371
|
---
|