Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove networkId #191

Merged
merged 7 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
jiexi marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"test": "jest",
"test:watch": "jest --watchAll"
},
"resolutions": {
"@metamask/controller-utils@^4.1.0": "npm:@metamask-previews/[email protected]",
"@metamask/network-controller@^10.3.0": "npm:@metamask-previews/[email protected]"
jiexi marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
Expand Down
1 change: 0 additions & 1 deletion src/SmartTransactionsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ describe('SmartTransactionsController', () => {
releaseLock: jest.fn(),
};
}),
getNetwork: jest.fn(() => '1'),
provider: jest.fn(),
confirmExternalTransaction: confirmExternalMock,
trackMetaMetricsEvent: trackMetaMetricsEventSpy,
Expand Down
7 changes: 0 additions & 7 deletions src/SmartTransactionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export default class SmartTransactionsController extends BaseController<

private getNonceLock: any;

private getNetwork: any;

public ethersProvider: any;

public confirmExternalTransaction: any;
Expand All @@ -92,7 +90,6 @@ export default class SmartTransactionsController extends BaseController<
{
onNetworkStateChange,
getNonceLock,
getNetwork,
provider,
confirmExternalTransaction,
trackMetaMetricsEvent,
Expand All @@ -101,7 +98,6 @@ export default class SmartTransactionsController extends BaseController<
listener: (networkState: NetworkState) => void,
) => void;
getNonceLock: any;
getNetwork: any;
provider: any;
confirmExternalTransaction: any;
trackMetaMetricsEvent: any;
Expand Down Expand Up @@ -131,7 +127,6 @@ export default class SmartTransactionsController extends BaseController<
};

this.getNonceLock = getNonceLock;
this.getNetwork = getNetwork;
this.ethersProvider = new Web3Provider(provider);
this.confirmExternalTransaction = confirmExternalTransaction;
this.trackMetaMetricsEvent = trackMetaMetricsEvent;
Expand Down Expand Up @@ -554,7 +549,6 @@ export default class SmartTransactionsController extends BaseController<
},
);
const time = Date.now();
const metamaskNetworkId = this.getNetwork();
let preTxBalance;
try {
const preTxBalanceBN = await this.ethersProvider.getBalance(
Expand All @@ -575,7 +569,6 @@ export default class SmartTransactionsController extends BaseController<
this.updateSmartTransaction({
chainId,
nonceDetails,
metamaskNetworkId,
jiexi marked this conversation as resolved.
Show resolved Hide resolved
preTxBalance,
status: SmartTransactionStatuses.PENDING,
time,
Expand Down
1 change: 0 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe('default export', () => {
onNetworkStateChange: jest.fn(),
getNonceLock: null,
provider: jest.fn(),
getNetwork: jest.fn(() => '1'),
confirmExternalTransaction: jest.fn(),
trackMetaMetricsEvent: jest.fn(),
});
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export type SmartTransaction = {
destinationTokenDecimals?: string;
destinationTokenSymbol?: string;
history?: any;
metamaskNetworkId?: string;
nonceDetails?: any;
origin?: string;
preTxBalance?: string;
Expand Down
110 changes: 47 additions & 63 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,32 @@ __metadata:
languageName: node
linkType: hard

"@metamask-previews/base-controller@npm:3.2.0-preview.3dbf14f":
version: 3.2.0-preview.3dbf14f
resolution: "@metamask-previews/base-controller@npm:3.2.0-preview.3dbf14f"
dependencies:
"@metamask/utils": ^6.2.0
immer: ^9.0.6
checksum: f7d359f31c65273eec95405d31f64618d6d8b5641fbda3de53806d4eaaac71a8c7715642300c36e694fcc3aadb989551363611e8714bb2c5308c6007d2d3fb15
languageName: node
linkType: hard

"@metamask-previews/controller-utils@npm:4.3.1-preview.3dbf14f, @metamask/controller-utils@npm:@metamask-previews/[email protected]":
version: 4.3.1-preview.3dbf14f
resolution: "@metamask-previews/controller-utils@npm:4.3.1-preview.3dbf14f"
dependencies:
"@metamask/eth-query": ^3.0.1
"@metamask/utils": ^6.2.0
"@spruceid/siwe-parser": 1.1.3
eth-ens-namehash: ^2.0.8
eth-rpc-errors: ^4.0.2
ethereumjs-util: ^7.0.10
ethjs-unit: ^0.1.6
fast-deep-equal: ^3.1.3
checksum: 2ab29816be29de54b754d8c53631a709d4b51b5ba5b5fc2723e8de2c4df0dd2d3cabc7e3205ab1955958986c7ac46ff4118b670f73b2384217958e170b87dc66
languageName: node
linkType: hard

"@metamask/auto-changelog@npm:^3.1.0":
version: 3.2.0
resolution: "@metamask/auto-changelog@npm:3.2.0"
Expand All @@ -1130,23 +1156,6 @@ __metadata:
languageName: node
linkType: hard

"@metamask/controller-utils@npm:^4.1.0":
version: 4.2.0
resolution: "@metamask/controller-utils@npm:4.2.0"
dependencies:
"@metamask/utils": ^5.0.2
"@spruceid/siwe-parser": 1.1.3
babel-runtime: ^6.26.0
eth-ens-namehash: ^2.0.8
eth-query: ^2.1.2
eth-rpc-errors: ^4.0.2
ethereumjs-util: ^7.0.10
ethjs-unit: ^0.1.6
fast-deep-equal: ^3.1.3
checksum: e71779577c37038e6e605a43ef6b9c1af82e0b3887a72c01f48ae1e4e2005116fc9d09c8b690139478c04dd2929e227642c5fd80cfbc81814d667c415c714228
languageName: node
linkType: hard

"@metamask/eslint-config-jest@npm:^10.0.0":
version: 10.0.0
resolution: "@metamask/eslint-config-jest@npm:10.0.0"
Expand Down Expand Up @@ -1196,7 +1205,7 @@ __metadata:
languageName: node
linkType: hard

"@metamask/eth-json-rpc-infura@npm:^8.0.0":
"@metamask/eth-json-rpc-infura@npm:^8.1.1":
version: 8.1.1
resolution: "@metamask/eth-json-rpc-infura@npm:8.1.1"
dependencies:
Expand Down Expand Up @@ -1236,6 +1245,16 @@ __metadata:
languageName: node
linkType: hard

"@metamask/eth-query@npm:^3.0.1":
version: 3.0.1
resolution: "@metamask/eth-query@npm:3.0.1"
dependencies:
json-rpc-random-id: ^1.0.0
xtend: ^4.0.1
checksum: b9a323dff67328eace7d54fc8b0bc4dd763bf15760870656cbd5aad5380d1ee4489fb5c59506290d5f77cf55e74e530ee97b52702a329f1090ec03a6158434b7
languageName: node
linkType: hard

"@metamask/eth-sig-util@npm:^5.0.0":
version: 5.1.0
resolution: "@metamask/eth-sig-util@npm:5.1.0"
Expand All @@ -1250,26 +1269,25 @@ __metadata:
languageName: node
linkType: hard

"@metamask/network-controller@npm:^10.3.0":
version: 10.3.0
resolution: "@metamask/network-controller@npm:10.3.0"
"@metamask/network-controller@npm:@metamask-previews/[email protected]":
version: 12.1.1-preview.3dbf14f
resolution: "@metamask-previews/network-controller@npm:12.1.1-preview.3dbf14f"
dependencies:
"@metamask/base-controller": ^3.0.0
"@metamask/controller-utils": ^4.1.0
"@metamask/eth-json-rpc-infura": ^8.0.0
"@metamask-previews/base-controller": 3.2.0-preview.3dbf14f
"@metamask-previews/controller-utils": 4.3.1-preview.3dbf14f
"@metamask/eth-json-rpc-infura": ^8.1.1
"@metamask/eth-json-rpc-middleware": ^11.0.0
"@metamask/eth-json-rpc-provider": ^1.0.0
"@metamask/eth-query": ^3.0.1
"@metamask/swappable-obj-proxy": ^2.1.0
"@metamask/utils": ^5.0.2
"@metamask/utils": ^6.2.0
async-mutex: ^0.2.6
babel-runtime: ^6.26.0
eth-block-tracker: ^7.0.1
eth-query: ^2.1.2
eth-rpc-errors: ^4.0.2
immer: ^9.0.6
json-rpc-engine: ^6.1.0
uuid: ^8.3.2
checksum: 0c48625af9c18be3ed2a433209db770bab02e667e251be1ef4c1f61a62c25907536ff740712bdfd799ac923a4a6bb9df5430ead8d4215507bbf30dcc7a40d53c
checksum: e5add66f972d8961d6f6076ecccdaba364853743c80fe6c27b207f1e905737f74cbc7afeca539cd18d1376671160637cc358190bb1b935714330abcd551db508
languageName: node
linkType: hard

Expand Down Expand Up @@ -1347,7 +1365,7 @@ __metadata:
languageName: node
linkType: hard

"@metamask/utils@npm:^5.0.1, @metamask/utils@npm:^5.0.2":
"@metamask/utils@npm:^5.0.1":
version: 5.0.2
resolution: "@metamask/utils@npm:5.0.2"
dependencies:
Expand Down Expand Up @@ -2307,16 +2325,6 @@ __metadata:
languageName: node
linkType: hard

"babel-runtime@npm:^6.26.0":
version: 6.26.0
resolution: "babel-runtime@npm:6.26.0"
dependencies:
core-js: ^2.4.0
regenerator-runtime: ^0.11.0
checksum: 8aeade94665e67a73c1ccc10f6fd42ba0c689b980032b70929de7a6d9a12eb87ef51902733f8fefede35afea7a5c3ef7e916a64d503446c1eedc9e3284bd3d50
languageName: node
linkType: hard

"balanced-match@npm:^1.0.0":
version: 1.0.0
resolution: "balanced-match@npm:1.0.0"
Expand Down Expand Up @@ -2905,13 +2913,6 @@ __metadata:
languageName: node
linkType: hard

"core-js@npm:^2.4.0":
version: 2.6.12
resolution: "core-js@npm:2.6.12"
checksum: 44fa9934a85f8c78d61e0c8b7b22436330471ffe59ec5076fe7f324d6e8cf7f824b14b1c81ca73608b13bdb0fef035bd820989bf059767ad6fa13123bb8bd016
languageName: node
linkType: hard

"core-util-is@npm:1.0.2":
version: 1.0.2
resolution: "core-util-is@npm:1.0.2"
Expand Down Expand Up @@ -3765,16 +3766,6 @@ __metadata:
languageName: node
linkType: hard

"eth-query@npm:^2.1.2":
version: 2.1.2
resolution: "eth-query@npm:2.1.2"
dependencies:
json-rpc-random-id: ^1.0.0
xtend: ^4.0.1
checksum: 83daa0e28452c54722aec78cd24d036bad5b6e7c08035d98e10d4bea11f71662f12cab63ebd8a848d4df46ad316503d54ecccb41c9244d2ea8b29364b0a20201
languageName: node
linkType: hard

"eth-rpc-errors@npm:^4.0.2, eth-rpc-errors@npm:^4.0.3":
version: 4.0.3
resolution: "eth-rpc-errors@npm:4.0.3"
Expand Down Expand Up @@ -7288,13 +7279,6 @@ __metadata:
languageName: node
linkType: hard

"regenerator-runtime@npm:^0.11.0":
version: 0.11.1
resolution: "regenerator-runtime@npm:0.11.1"
checksum: 3c97bd2c7b2b3247e6f8e2147a002eb78c995323732dad5dc70fac8d8d0b758d0295e7015b90d3d444446ae77cbd24b9f9123ec3a77018e81d8999818301b4f4
languageName: node
linkType: hard

"regex-not@npm:^1.0.0, regex-not@npm:^1.0.2":
version: 1.0.2
resolution: "regex-not@npm:1.0.2"
Expand Down