Skip to content

Commit

Permalink
Merge pull request #68 from terra-money/feat/tx/events
Browse files Browse the repository at this point in the history
feat: map tx events to the txInfo
  • Loading branch information
emidev98 authored Jan 25, 2024
2 parents 84d5bb5 + d5241ea commit a03e575
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 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": "@terra-money/feather.js",
"version": "2.0.0",
"version": "2.0.1",
"description": "The JavaScript SDK for Terra and Feather chains",
"license": "MIT",
"author": "Terraform Labs, PTE.",
Expand Down
22 changes: 18 additions & 4 deletions src/core/TxInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class TxInfo {
* @param tx transaction content
* @param timestamp time of inclusion
* @param code error code
* @param info additional tx information that can be indeterminisitc
* @param events events emitted during tx execution including ANTE and POST
* @param codespace 0 if succeeded or non-zero error code
* @param data proto encoded data to HEX type of the Msg
*/
constructor(
public height: number,
Expand All @@ -31,8 +35,11 @@ export class TxInfo {
public gas_used: number,
public tx: Tx,
public timestamp: string,
public code?: number,
public codespace?: string
public code: number,
public info: string,
public events: Event[],
public codespace?: string,
public data?: string
) {}

public static fromProto(proto: TxInfo.Proto): TxInfo {
Expand All @@ -46,7 +53,10 @@ export class TxInfo {
Tx.unpackAny(proto.tx as Any),
proto.timestamp,
proto.code,
proto.codespace
proto.info,
proto.events,
proto.codespace,
proto.data
);
}

Expand All @@ -61,7 +71,10 @@ export class TxInfo {
Tx.fromData(data.tx, isClassic),
data.timestamp,
data.code,
data.codespace
data.info,
data.events,
data.codespace,
data.data
);
}
}
Expand Down Expand Up @@ -191,6 +204,7 @@ export namespace TxInfo {
gas_used: string;
tx: Tx.Data;
timestamp: string;
events: Event[];
}
export type Proto = TxResponse_pb;
}

0 comments on commit a03e575

Please sign in to comment.