From c228aa2a3cfe89938a2b96ecc92733fac58f62de Mon Sep 17 00:00:00 2001 From: emidev98 Date: Fri, 15 Dec 2023 15:02:12 +0200 Subject: [PATCH] feat: map tx events to the txInfo --- package-lock.json | 4 ++-- package.json | 2 +- src/core/TxInfo.ts | 22 ++++++++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 918c4472..fe0b9b83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.15", + "version": "2.0.0-beta.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.15", + "version": "2.0.0-beta.16", "license": "MIT", "dependencies": { "@ethersproject/bytes": "^5.7.0", diff --git a/package.json b/package.json index 2b433835..d909174d 100644 --- a/package.json +++ b/package.json @@ -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.", diff --git a/src/core/TxInfo.ts b/src/core/TxInfo.ts index 2747d886..2949353c 100644 --- a/src/core/TxInfo.ts +++ b/src/core/TxInfo.ts @@ -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; }