From 22ebbf4e5c60c089948d538da27ef6fb6804eaaa Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Thu, 20 Oct 2022 04:48:52 -0400 Subject: [PATCH] Fixed wrong hash computed with Transaction and added toJSON. --- src.ts/transaction/transaction.ts | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src.ts/transaction/transaction.ts b/src.ts/transaction/transaction.ts index 23a7da868..38a8fb08d 100644 --- a/src.ts/transaction/transaction.ts +++ b/src.ts/transaction/transaction.ts @@ -456,9 +456,7 @@ export class Transaction implements Freezable, TransactionLike, TransactionLike, TransactionLike { + if (v == null) { return null; } + return v.toString(); + }; + + return { + type: this.type, + to: this.to, + from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON(): null, + accessList: this.accessList + }; + } + static from(tx: string | TransactionLike): Transaction { if (typeof(tx) === "string") { const payload = getBytes(tx);