Skip to content

Commit

Permalink
Update @ethereumjs/tx and @ethereumjs/common (#1514)
Browse files Browse the repository at this point in the history
* chore: update @ethereumjs/tx and @ethereumjs/common

* chore: update @metamask/utils

* yarn dedupe

---------

Co-authored-by: legobt <[email protected]>
  • Loading branch information
mikesposito and legobeat authored Jul 17, 2023
1 parent 7e0a5e1 commit f23612f
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 165 deletions.
2 changes: 1 addition & 1 deletion packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/utils": "^5.0.2"
"@metamask/utils": "^6.2.0"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/approval-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@metamask/base-controller": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"eth-rpc-errors": "^4.0.2",
"immer": "^9.0.6",
"nanoid": "^3.1.31"
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@metamask/network-controller": "workspace:^",
"@metamask/preferences-controller": "workspace:^",
"@metamask/rpc-errors": "^5.1.1",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"@types/uuid": "^8.3.0",
"abort-controller": "^3.0.0",
"async-mutex": "^0.2.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/base-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"immer": "^9.0.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/controller-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"@spruceid/siwe-parser": "1.1.3",
"eth-ens-namehash": "^2.0.8",
"eth-query": "^2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ens-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/network-controller": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"ethereum-ens-network-map": "^1.0.2",
"punycode": "^2.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/gas-fee-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/network-controller": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"@types/uuid": "^8.3.0",
"eth-query": "^2.1.2",
"ethereumjs-util": "^7.0.10",
Expand Down
6 changes: 3 additions & 3 deletions packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@keystonehq/metamask-airgapped-keyring": "^0.6.1",
"@keystonehq/metamask-airgapped-keyring": "^0.13.1",
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/eth-keyring-controller": "^10.0.1",
Expand All @@ -42,8 +42,8 @@
"immer": "^9.0.6"
},
"devDependencies": {
"@ethereumjs/common": "^2.6.1",
"@ethereumjs/tx": "^3.5.2",
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@keystonehq/bc-ur-registry-eth": "^0.9.0",
"@metamask/auto-changelog": "^3.1.0",
"@metamask/scure-bip39": "^2.1.0",
Expand Down
19 changes: 8 additions & 11 deletions packages/keyring-controller/src/KeyringController.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
import { TransactionFactory } from '@ethereumjs/tx';
import { CryptoHDKey, ETHSignature } from '@keystonehq/bc-ur-registry-eth';
import { MetaMaskKeyring as QRKeyring } from '@keystonehq/metamask-airgapped-keyring';
import { ControllerMessenger } from '@metamask/base-controller';
import { isValidHexAddress, NetworkType } from '@metamask/controller-utils';
import { isValidHexAddress } from '@metamask/controller-utils';
import { keyringBuilderFactory } from '@metamask/eth-keyring-controller';
import {
normalize,
Expand Down Expand Up @@ -1457,15 +1457,12 @@ describe('KeyringController', () => {
type: 2,
},
{
common: Common.forCustomChain(
NetworkType.mainnet,
{
name: 'goerli',
chainId: parseInt('5'),
networkId: parseInt('5'),
},
'london',
),
common: Common.custom({
name: 'goerli',
chainId: parseInt('5'),
networkId: parseInt('5'),
defaultHardfork: 'london',
}),
},
);
const signedTx = await signProcessKeyringController.signTransaction(
Expand Down
2 changes: 1 addition & 1 deletion packages/message-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/eth-sig-util": "^6.0.0",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"@types/uuid": "^8.3.0",
"ethereumjs-util": "^7.0.10",
"jsonschema": "^1.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@metamask/eth-json-rpc-middleware": "^11.0.0",
"@metamask/eth-json-rpc-provider": "^1.0.0",
"@metamask/swappable-obj-proxy": "^2.1.0",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"async-mutex": "^0.2.6",
"eth-block-tracker": "^7.0.1",
"eth-query": "^2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/notification-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@metamask/base-controller": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"immer": "^9.0.6",
"nanoid": "^3.1.31"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/permission-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@metamask/approval-controller": "workspace:^",
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"@types/deep-freeze-strict": "^1.1.0",
"deep-freeze-strict": "^1.1.1",
"eth-rpc-errors": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/signature-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/message-manager": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"eth-rpc-errors": "^4.0.2",
"ethereumjs-util": "^7.0.10",
"immer": "^9.0.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/transaction-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/common": "^2.6.1",
"@ethereumjs/tx": "^3.5.2",
"@ethereumjs/common": "^3.2.0",
"@ethereumjs/tx": "^4.2.0",
"@metamask/approval-controller": "workspace:^",
"@metamask/base-controller": "workspace:^",
"@metamask/controller-utils": "workspace:^",
"@metamask/network-controller": "workspace:^",
"@metamask/utils": "^5.0.2",
"@metamask/utils": "^6.2.0",
"async-mutex": "^0.2.6",
"eth-method-registry": "1.1.0",
"eth-query": "^2.1.2",
Expand Down
17 changes: 7 additions & 10 deletions packages/transaction-controller/src/TransactionController.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable jest/expect-expect */

import Common from '@ethereumjs/common';
import { Common } from '@ethereumjs/common';
import {
ChainId,
NetworkType,
Expand Down Expand Up @@ -1586,15 +1586,12 @@ describe('TransactionController', () => {

const config = controller.getCommonConfiguration();
expect(config).toStrictEqual(
Common.forCustomChain(
NetworkType.mainnet,
{
name: undefined,
chainId,
networkId: chainId,
},
HARDFORK,
),
Common.custom({
name: undefined,
chainId,
networkId: chainId,
defaultHardfork: HARDFORK,
}),
);
},
);
Expand Down
13 changes: 5 additions & 8 deletions packages/transaction-controller/src/TransactionController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Common from '@ethereumjs/common';
import { Hardfork, Common, type ChainConfig } from '@ethereumjs/common';
import type { TypedTransaction } from '@ethereumjs/tx';
import { TransactionFactory } from '@ethereumjs/tx';
import type {
Expand Down Expand Up @@ -54,7 +54,7 @@ import {
ESTIMATE_GAS_ERROR,
} from './utils';

export const HARDFORK = 'london';
export const HARDFORK = Hardfork.London;

/**
* @type Result
Expand Down Expand Up @@ -640,17 +640,14 @@ export class TransactionController extends BaseController<
return new Common({ chain, hardfork: HARDFORK });
}

const customChainParams = {
const customChainParams: Partial<ChainConfig> = {
name,
chainId: parseInt(chainId, 16),
networkId: networkId === null ? NaN : parseInt(networkId, undefined),
defaultHardfork: HARDFORK,
};

return Common.forCustomChain(
NetworkType.mainnet,
customChainParams,
HARDFORK,
);
return Common.custom(customChainParams);
}

/**
Expand Down
Loading

0 comments on commit f23612f

Please sign in to comment.