Add DeliverTxResponse.events

This commit is contained in:
Simon Warta 2022-10-24 17:06:51 +02:00
parent e62e461f85
commit f2cfb3136a
4 changed files with 14 additions and 1 deletions

View File

@ -12,7 +12,8 @@ and this project adheres to
supporting batch RPC requests ([#1300]). supporting batch RPC requests ([#1300]).
- @cosmjs/encoding: Add `lossy` parameter to `fromUtf8` allowing the use of a - @cosmjs/encoding: Add `lossy` parameter to `fromUtf8` allowing the use of a
replacement charater instead of throwing. replacement charater instead of throwing.
- @cosmjs/stargate: Add structured `Events`s to `IndexTx.events`. - @cosmjs/stargate: Add structured `Events`s to `IndexTx.events` and
`DeliverTxResponse.events`.
## [0.29.2] - 2022-10-13 ## [0.29.2] - 2022-10-13

View File

@ -284,6 +284,7 @@ export class CosmWasmClient {
height: result.height, height: result.height,
rawLog: result.rawLog, rawLog: result.rawLog,
transactionHash: txId, transactionHash: txId,
events: result.events,
gasUsed: result.gasUsed, gasUsed: result.gasUsed,
gasWanted: result.gasWanted, gasWanted: result.gasWanted,
} }

View File

@ -42,6 +42,7 @@ const resultFailure = {
rawLog: rawLog:
"failed to execute message; message index: 0: 1855527000ufct is smaller than 20000000000000000000000ufct: insufficient funds", "failed to execute message; message index: 0: 1855527000ufct is smaller than 20000000000000000000000ufct: insufficient funds",
transactionHash: "FDC4FB701AABD465935F7D04AE490D1EF5F2BD4B227601C4E98B57EB077D9B7D", transactionHash: "FDC4FB701AABD465935F7D04AE490D1EF5F2BD4B227601C4E98B57EB077D9B7D",
events: [],
gasUsed: 54396, gasUsed: 54396,
gasWanted: 200000, gasWanted: 200000,
}; };
@ -51,6 +52,7 @@ const resultSuccess = {
rawLog: rawLog:
'[{"events":[{"type":"message","attributes":[{"key":"action","value":"send"},{"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},{"key":"module","value":"bank"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"firma12er8ls2sf5zess3jgjxz59xat9xtf8hz0hk6n4"},{"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},{"key":"amount","value":"2000000ufct"}]}]}]', '[{"events":[{"type":"message","attributes":[{"key":"action","value":"send"},{"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},{"key":"module","value":"bank"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"firma12er8ls2sf5zess3jgjxz59xat9xtf8hz0hk6n4"},{"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},{"key":"amount","value":"2000000ufct"}]}]}]',
transactionHash: "C0B416CA868C55C2B8C1BBB8F3CFA233854F13A5CB15D3E9599F50CAF7B3D161", transactionHash: "C0B416CA868C55C2B8C1BBB8F3CFA233854F13A5CB15D3E9599F50CAF7B3D161",
events: [],
gasUsed: 61556, gasUsed: 61556,
gasWanted: 200000, gasWanted: 200000,
}; };

View File

@ -107,6 +107,14 @@ export interface DeliverTxResponse {
/** Error code. The transaction suceeded iff code is 0. */ /** Error code. The transaction suceeded iff code is 0. */
readonly code: number; readonly code: number;
readonly transactionHash: string; readonly transactionHash: string;
readonly events: readonly Event[];
/**
* A string-based log document.
*
* This currently seems to merge attributes of multiple events into one event per type
* (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events`
* field instead.
*/
readonly rawLog?: string; readonly rawLog?: string;
readonly data?: readonly MsgData[]; readonly data?: readonly MsgData[];
readonly gasUsed: number; readonly gasUsed: number;
@ -426,6 +434,7 @@ export class StargateClient {
? { ? {
code: result.code, code: result.code,
height: result.height, height: result.height,
events: result.events,
rawLog: result.rawLog, rawLog: result.rawLog,
transactionHash: txId, transactionHash: txId,
gasUsed: result.gasUsed, gasUsed: result.gasUsed,