From 4a942f4019fc4612de53a3892fa8a420a4401e82 Mon Sep 17 00:00:00 2001 From: Oleksii Kosynskyi Date: Fri, 23 Aug 2024 10:03:15 +0300 Subject: [PATCH] Fix nextjs problem --- .../web3-eth-accounts/src/tx/transactionFactory.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/web3-eth-accounts/src/tx/transactionFactory.ts b/packages/web3-eth-accounts/src/tx/transactionFactory.ts index 98a465c0973..7d3305ec59a 100644 --- a/packages/web3-eth-accounts/src/tx/transactionFactory.ts +++ b/packages/web3-eth-accounts/src/tx/transactionFactory.ts @@ -31,15 +31,7 @@ import type { } from './types.js'; import { BaseTransaction } from './baseTransaction.js'; -let extraTxTypes: Map>; -// use the global object, to work fine even if web3-eth and web3-eth-accounts was on a different versions: -const typedGlobal = global as unknown as {extraTxTypes: Map>} -if (!typedGlobal.extraTxTypes) { - extraTxTypes = new Map(); - typedGlobal.extraTxTypes = extraTxTypes; -} else { - extraTxTypes = typedGlobal.extraTxTypes; -} +const extraTxTypes: Map> = new Map(); // eslint-disable-next-line @typescript-eslint/no-extraneous-class export class TransactionFactory { @@ -145,7 +137,7 @@ export class TransactionFactory { */ public static fromBlockBodyData(data: Uint8Array | Uint8Array[], txOptions: TxOptions = {}) { if (isUint8Array(data)) { - return this.fromSerializedData(data , txOptions); + return this.fromSerializedData(data, txOptions); } if (Array.isArray(data)) { // It is a legacy transaction