From 4d555872c1f491dce279d28c24d693abe5435e51 Mon Sep 17 00:00:00 2001 From: Yasir Shariff Date: Tue, 24 Oct 2023 21:04:31 +0300 Subject: [PATCH 1/2] fix: txn_result gas burnt --- packages/js/src/transaction-result.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/js/src/transaction-result.ts b/packages/js/src/transaction-result.ts index 6bca9c34..88c90815 100644 --- a/packages/js/src/transaction-result.ts +++ b/packages/js/src/transaction-result.ts @@ -221,7 +221,9 @@ export class TransactionResult { } get gas_burnt(): Gas { - return Gas.from(this.result.transaction_outcome.outcome.gas_burnt); + return Gas.from(this.result.transaction_outcome.outcome.gas_burnt + this.receipts_outcomes.reduce((acc, cur) => { + return acc + cur.outcome.gas_burnt; + }, 0)); } receiptFailureMessagesContain(pattern: string | RegExp): boolean { From 51fed8dd22af01c319b3b0298efb6a3f936dcb49 Mon Sep 17 00:00:00 2001 From: Yasir Shariff Date: Tue, 24 Oct 2023 23:06:22 +0300 Subject: [PATCH 2/2] upd linting --- packages/js/dist/transaction-result.d.ts | 2 +- packages/js/dist/transaction-result.d.ts.map | 2 +- packages/js/dist/transaction-result.js | 3 ++- packages/js/dist/transaction-result.js.map | 2 +- packages/js/src/transaction-result.ts | 5 ++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/js/dist/transaction-result.d.ts b/packages/js/dist/transaction-result.d.ts index 36c4b2d5..ddc62f2a 100644 --- a/packages/js/dist/transaction-result.d.ts +++ b/packages/js/dist/transaction-result.d.ts @@ -62,5 +62,5 @@ export declare class TransactionError extends Error { constructor(result: TransactionResult); parse(): ExecutionOutcome; } -export declare type TxResult = TransactionResult; +export type TxResult = TransactionResult; //# sourceMappingURL=transaction-result.d.ts.map \ No newline at end of file diff --git a/packages/js/dist/transaction-result.d.ts.map b/packages/js/dist/transaction-result.d.ts.map index 2ad9b9b4..88e97788 100644 --- a/packages/js/dist/transaction-result.d.ts.map +++ b/packages/js/dist/transaction-result.d.ts.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AK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,MAAM,EAAE,iBAAiB;IAIrC,KAAK,IAAI,gBAAgB;CAG1B;AAED,oBAAY,QAAQ,GAAG,iBAAiB,CAAC"} \ No newline at end of file +{"version":3,"file":"transaction-result.d.ts","sourceRoot":"","sources":["../src/transaction-result.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,SAAS,EACV,MAAM,SAAS,CAAC;AAmBjB,qBAAa,cAAc;IACN,OAAO,EAAE,gBAAgB;gBAAzB,OAAO,EAAE,gBAAgB;IAE5C,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAE7C;IAED,IAAI,MAAM,IAAI,eAAe,GAAG,oBAAoB,CAEnD;IAED,IAAI,SAAS,IAAI,OAAO,CAMvB;IAED,IAAI,SAAS,IAAI,OAAO,CAMvB;IAED,IAAI,eAAe,IAAI,eAAe,CAErC;IAED,WAAW,IAAI,GAAG;IAQlB,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAMrC;IAED,IAAI,gBAAgB,IAAI,cAAc,GAAG,SAAS,CAMjD;IAED,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,IAAI,IAAI,MAAM,EAAE,CAEnB;IAED,IAAI,SAAS,IAAI,GAAG,CAEnB;CACF;AAED,qBAAa,iB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AAI,GAAG,CAGnB;IAED,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAIhE,WAAW,CAAC,CAAC,KAAK,CAAC;IAQnB,oBAAoB,IAAI,GAAG,EAAE;IAI7B,OAAO,IAAI,MAAM;CAGlB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,MAAM,EAAE,iBAAiB;IAIrC,KAAK,IAAI,gBAAgB;CAG1B;AAED,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC"} \ No newline at end of file diff --git a/packages/js/dist/transaction-result.js b/packages/js/dist/transaction-result.js index 41f15acf..71313fa4 100644 --- a/packages/js/dist/transaction-result.js +++ b/packages/js/dist/transaction-result.js @@ -165,7 +165,8 @@ class TransactionResult { return this.receiptFailures.map(failure => JSON.stringify(failure)); } get gas_burnt() { - return near_units_1.Gas.from(this.result.transaction_outcome.outcome.gas_burnt); + const receipts_gas = this.receipts_outcomes.reduce((acc, cur) => acc + cur.outcome.gas_burnt, 0); + return near_units_1.Gas.from(this.result.transaction_outcome.outcome.gas_burnt + receipts_gas); } receiptFailureMessagesContain(pattern) { return this.receiptFailureMessages.some(includes(pattern)); diff --git a/packages/js/dist/transaction-result.js.map b/packages/js/dist/transaction-result.js.map index 610bfc9e..5f497c2e 100644 --- a/packages/js/dist/transaction-result.js.map +++ b/packages/js/dist/transaction-result.js.map @@ -1 +1 @@ -{"version":3,"file":"transaction-result.js","sourceRoot":"","sources":["../src/transaction-result.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,2CAA+B;AAe/B,SAAS,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AAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1L,CAAC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,MAAyB;QACnC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAqB,CAAC;IACtD,CAAC;CACF;AARD,4CAQC"} \ No newline at end of file +{"version":3,"file":"transaction-result.js","sourceRoot":"","sources":["../src/transaction-result.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,2CAA+B;AAe/B,SAAS,QAAQ,CAAC,OAAwB;IACxC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,UAAU,CAAI,KAAa;IAClC,MAAM,MAAM,GAAG,eAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAM,CAAC;KAChC;IAAC,MAAM;QACN,OAAO,MAAM,CAAC;KACf;AACH,CAAC;AAED,MAAa,cAAc;IACzB,YAAmB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;IAAG,CAAC;IAEhD,IAAI,QAAQ;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI,SAAS;QACX,IAAI,OAAO,IAAI,C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M,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,OAAO;QACL,OAAO,IAAI,IAAI,CAAC,UAAU,eAAe,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,0BAA0B,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;IACtJ,CAAC;CACF;AA7ID,8CA6IC;AAYD,SAAS,0BAA0B,CAAC,EAAsB,EAAE,WAAoB;IAC9E,OAAO,GAAG,EAAE,CAAC,SAAS,OAAO,EAAE,CAAC,WAAW,WAAW,EAAE,CAAC,KAAK,UAAU,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1L,CAAC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,MAAyB;QACnC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAqB,CAAC;IACtD,CAAC;CACF;AARD,4CAQC"} \ No newline at end of file diff --git a/packages/js/src/transaction-result.ts b/packages/js/src/transaction-result.ts index 88c90815..ceb3dde1 100644 --- a/packages/js/src/transaction-result.ts +++ b/packages/js/src/transaction-result.ts @@ -221,9 +221,8 @@ export class TransactionResult { } get gas_burnt(): Gas { - return Gas.from(this.result.transaction_outcome.outcome.gas_burnt + this.receipts_outcomes.reduce((acc, cur) => { - return acc + cur.outcome.gas_burnt; - }, 0)); + const receipts_gas = this.receipts_outcomes.reduce((acc, cur) => acc + cur.outcome.gas_burnt, 0); + return Gas.from(this.result.transaction_outcome.outcome.gas_burnt + receipts_gas); } receiptFailureMessagesContain(pattern: string | RegExp): boolean {