Skip to content

Commit

Permalink
Merge pull request #37 from initia-labs/feat/evt
Browse files Browse the repository at this point in the history
feat: add events in TxInfo
  • Loading branch information
joon9823 authored Jan 8, 2024
2 parents 3fddb17 + 22ad0a8 commit 2c4bf66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia.js",
"version": "0.1.24",
"version": "0.1.25",
"description": "The JavaScript SDK for Initia",
"license": "MIT",
"author": "InitiaLabs",
Expand Down
2 changes: 2 additions & 0 deletions src/client/lcd/api/TxAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
PublicKey,
num,
TxLog,
Event,
} from '../../../core';
import { hashToHex } from '../../../util';
import { LCDClient } from '../LCDClient';
Expand Down Expand Up @@ -92,6 +93,7 @@ export namespace BlockTxBroadcastResult {
info: string;
data: string;
timestamp: string;
events: Event[];
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/core/tx/TxInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export class TxInfo {
* @param gas_used actual gas consumption
* @param tx transaction content
* @param timestamp time of inclusion
* @param events events
* @param code error code
* @param codespace error codespace
*/
constructor(
public height: number,
Expand All @@ -31,6 +33,7 @@ export class TxInfo {
public gas_used: number,
public tx: Tx,
public timestamp: string,
public events: Event[],
public code?: number,
public codespace?: string
) {}
Expand All @@ -45,6 +48,7 @@ export class TxInfo {
proto.gasUsed.toNumber(),
Tx.unpackAny(proto.tx as Any),
proto.timestamp,
proto.events,
proto.code,
proto.codespace
);
Expand All @@ -60,6 +64,7 @@ export class TxInfo {
Number.parseInt(data.gas_used),
Tx.fromData(data.tx),
data.timestamp,
data.events,
data.code,
data.codespace
);
Expand Down Expand Up @@ -193,6 +198,7 @@ export namespace TxInfo {
gas_used: string;
tx: Tx.Data;
timestamp: string;
events: Event[];
}
export type Proto = TxResponse_pb;
}

0 comments on commit 2c4bf66

Please sign in to comment.