Skip to content

Commit

Permalink
Fix nextjs problem (#7216)
Browse files Browse the repository at this point in the history
* Fix nextjs problem

* add changelog
  • Loading branch information
avkos committed Aug 23, 2024
1 parent e746566 commit 0b75589
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
## [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)
6 changes: 5 additions & 1 deletion packages/web3-eth-accounts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
## [Unreleased]

### Fixed
- Revert `TransactionFactory.registerTransactionType` if there is a version mistatch between `web3-eth` and `web3-eth-accounts` and fix nextjs problem. (#7216)

12 changes: 2 additions & 10 deletions packages/web3-eth-accounts/src/tx/transactionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,7 @@ import type {
} from './types.js';
import { BaseTransaction } from './baseTransaction.js';

let extraTxTypes: Map<Numbers, typeof BaseTransaction<unknown>>;
// 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<Numbers, typeof BaseTransaction<unknown>>}
if (!typedGlobal.extraTxTypes) {
extraTxTypes = new Map();
typedGlobal.extraTxTypes = extraTxTypes;
} else {
extraTxTypes = typedGlobal.extraTxTypes;
}
const extraTxTypes: Map<Numbers, typeof BaseTransaction<unknown>> = new Map();

// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class TransactionFactory {
Expand Down Expand Up @@ -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
Expand Down

1 comment on commit 0b75589

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 0b75589 Previous: e746566 Ratio
processingTx 21778 ops/sec (±6.02%) 23728 ops/sec (±7.13%) 1.09
processingContractDeploy 37125 ops/sec (±6.62%) 40637 ops/sec (±7.66%) 1.09
processingContractMethodSend 14868 ops/sec (±10.20%) 16949 ops/sec (±7.02%) 1.14
processingContractMethodCall 27609 ops/sec (±6.05%) 28367 ops/sec (±7.27%) 1.03
abiEncode 40195 ops/sec (±8.19%) 46116 ops/sec (±6.72%) 1.15
abiDecode 27790 ops/sec (±7.70%) 31091 ops/sec (±7.58%) 1.12
sign 1546 ops/sec (±0.83%) 1587 ops/sec (±0.92%) 1.03
verify 363 ops/sec (±2.56%) 372 ops/sec (±2.74%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.