Skip to content

Commit

Permalink
refactor: remove global network from transaction controller (#4920)
Browse files Browse the repository at this point in the history
- Remove the following constructor options:
  - `blockTracker`
  - `isMultichainEnabled`
  - `onNetworkStateChange`
  - `provider`
- Require `networkClientId` option in calls to `addTransaction`.
- Make `networkClientId` required in `TransactionMeta` type.
- Remove global instances of:
  - `PendingTransactionTracker`
  - `IncomingTransactionHelper`
  - `NonceTracker`.
- Replace `wipeTransactions` method arguments with object containing optional `chainId` and `address` properties.
- Require `networkClientId` argument in:
  - `getNonceLock`
  - `estimateGas`
  - `estimateGasBuffered`
- Remove `filterToCurrentNetwork` option from `getTransactions` method.
- Add `networkClientId` argument to `handleMethodData` method.
- Add `MethodDataHelper` to encapsulate `handleMethodData` method logic.
- Replace `getProvider` and `getEthQuery` methods with
`getNetworkClient` method in `MultichainTrackingHelper`.
- Created nested debug loggers per chain in `PendingTransactionTracker` and `IncomingTransactionHelper`.
- Create dedicated debug logger for `MultichainTrackingHelper` with additional logs.
  • Loading branch information
matthewwalsh0 authored Nov 26, 2024
1 parent c1d954a commit ddbd5db
Show file tree
Hide file tree
Showing 30 changed files with 1,361 additions and 1,753 deletions.
19 changes: 19 additions & 0 deletions packages/transaction-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- **BREAKING:** Remove global network usage ([#4920](https://github.com/MetaMask/core/pull/4920))
- Add required `networkClientId` argument to `handleMethodData` method.

### Changed

- **BREAKING:** Remove global network usage ([#4920](https://github.com/MetaMask/core/pull/4920))
- Require `networkClientId` option in `addTransaction` method.
- Require `networkClientId` property in `TransactionMeta` type.
- Change `wipeTransactions` method arguments to optional object containing `address` and `chainId` properties.
- Require `networkClientId` argument in `estimateGas`, `estimateGasBuffered` and `getNonceLock` methods.

### Removed

- **BREAKING:** Remove global network usage ([#4920](https://github.com/MetaMask/core/pull/4920))
- Remove the `blockTracker`, `isMultichainEnabled`, `onNetworkStateChange` and `provider` constructor options.
- Remove `filterToCurrentNetwork` option from `getTransactions` method.

## [40.1.0]

### Added
Expand Down
8 changes: 4 additions & 4 deletions packages/transaction-controller/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = merge(baseConfig, {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 93.57,
functions: 97.56,
lines: 98.38,
statements: 98.39,
branches: 93.23,
functions: 97.61,
lines: 98.26,
statements: 98.28,
},
},

Expand Down
Loading

0 comments on commit ddbd5db

Please sign in to comment.