Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: map tx events to the txInfo #68

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-beta.15",
"version": "2.0.0-beta.16",
"description": "The JavaScript SDK for Terra and Feather chains",
"license": "MIT",
"author": "Terraform Labs, PTE.",
22 changes: 18 additions & 4 deletions src/core/TxInfo.ts
Original file line number Diff line number Diff line change
@@ -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,
@@ -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 {
@@ -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
);
}

@@ -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
);
}
}
@@ -191,6 +204,7 @@ export namespace TxInfo {
gas_used: string;
tx: Tx.Data;
timestamp: string;
events: Event[];
}
export type Proto = TxResponse_pb;
}