diff --git a/CHANGELOG.md b/CHANGELOG.md index f1d03c99583..76a773377c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2689,4 +2689,9 @@ If there are any bugs, improvements, optimizations or any new feature proposal f - The returnred properties of `contract.deploy(...)` are structured with a newly created class named `DeployerMethodClass`. (#7197) - Add a missed accepted type for the `abi` parameter, at `dataInputEncodeMethodHelper` and `getSendTxParams`. (#7197) -## [Unreleased] \ No newline at end of file +## [Unreleased] +### Fixed + +#### web3-eth-accounts + +- Revert `TransactionFactory.registerTransactionType` if there is a version mistatch between `web3-eth` and `web3-eth-accounts` and fix nextjs problem. (#7216) diff --git a/packages/web3-eth-accounts/CHANGELOG.md b/packages/web3-eth-accounts/CHANGELOG.md index 5562856ff53..d800a7663f6 100644 --- a/packages/web3-eth-accounts/CHANGELOG.md +++ b/packages/web3-eth-accounts/CHANGELOG.md @@ -177,4 +177,8 @@ Documentation: ### Fixed - Fix `TransactionFactory.registerTransactionType` not working, if there is a version mistatch between `web3-eth` and `web3-eth-accounts` by saving `extraTxTypes` at `globals`. (#7197) -## [Unreleased] \ No newline at end of file +## [Unreleased] + +### Fixed +- Revert `TransactionFactory.registerTransactionType` if there is a version mistatch between `web3-eth` and `web3-eth-accounts` and fix nextjs problem. (#7216) + 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