From 97b8a456f8d933541338486f84fdb803513bd5fe Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Wed, 18 Dec 2024 22:25:29 +0100 Subject: [PATCH] chore: replace web3-stream-provider with SteamProvider from @metamask/providers --- app/scripts/ui.js | 7 ++++--- package.json | 3 +-- yarn.lock | 40 ++++++++-------------------------------- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/app/scripts/ui.js b/app/scripts/ui.js index 794037e12761..44ef365dd8ca 100644 --- a/app/scripts/ui.js +++ b/app/scripts/ui.js @@ -13,7 +13,7 @@ import browser from 'webextension-polyfill'; import Eth from '@metamask/ethjs'; import EthQuery from '@metamask/eth-query'; -import StreamProvider from 'web3-stream-provider'; +import { StreamProvider } from '@metamask/providers'; import log from 'loglevel'; // TODO: Remove restricted import // eslint-disable-next-line import/no-restricted-paths @@ -357,8 +357,9 @@ function connectToAccountManager(connectionStream) { * @param {PortDuplexStream} connectionStream - PortStream instance establishing a background connection */ function setupWeb3Connection(connectionStream) { - const providerStream = new StreamProvider(); - providerStream.pipe(connectionStream).pipe(providerStream); + const providerStream = new StreamProvider(connectionStream, { + jsonRpcStreamName: 'metamask-provider', + }); connectionStream.on('error', console.error.bind(console)); providerStream.on('error', console.error.bind(console)); global.ethereumProvider = providerStream; diff --git a/package.json b/package.json index 261ddd874484..2f25a0b244c4 100644 --- a/package.json +++ b/package.json @@ -301,7 +301,7 @@ "@metamask/eth-query": "^4.0.0", "@metamask/eth-sig-util": "^7.0.1", "@metamask/eth-snap-keyring": "^7.0.0", - "@metamask/eth-token-tracker": "^9.0.0", + "@metamask/eth-token-tracker": "^10.0.1", "@metamask/eth-trezor-keyring": "^3.1.3", "@metamask/etherscan-link": "^3.0.0", "@metamask/ethjs": "^0.6.0", @@ -436,7 +436,6 @@ "unicode-confusables": "^0.1.1", "uri-js": "^4.4.1", "uuid": "^8.3.2", - "web3-stream-provider": "^5.0.0", "zxcvbn": "^4.4.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 7bfb4b6e4336..ba2e0bdd8443 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5208,19 +5208,6 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-block-tracker@npm:^10.0.0": - version: 10.0.0 - resolution: "@metamask/eth-block-tracker@npm:10.0.0" - dependencies: - "@metamask/eth-json-rpc-provider": "npm:^4.0.0" - "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.1.0" - json-rpc-random-id: "npm:^1.0.1" - pify: "npm:^5.0.0" - checksum: 10/c035482544830d2b2d07db9a6b2002f387c2df2d25c0eb82a381a11de9efbf35f7b6e35fc868cc46424d1a13a75dde4c8146dbbc9d48155a0d882625b20cfca0 - languageName: node - linkType: hard - "@metamask/eth-block-tracker@npm:^11.0.3": version: 11.0.3 resolution: "@metamask/eth-block-tracker@npm:11.0.3" @@ -5291,7 +5278,7 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-json-rpc-provider@npm:^4.0.0, @metamask/eth-json-rpc-provider@npm:^4.1.5, @metamask/eth-json-rpc-provider@npm:^4.1.6": +"@metamask/eth-json-rpc-provider@npm:^4.1.5, @metamask/eth-json-rpc-provider@npm:^4.1.6": version: 4.1.6 resolution: "@metamask/eth-json-rpc-provider@npm:4.1.6" dependencies: @@ -5393,11 +5380,11 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-token-tracker@npm:^9.0.0": - version: 9.0.0 - resolution: "@metamask/eth-token-tracker@npm:9.0.0" +"@metamask/eth-token-tracker@npm:^10.0.1": + version: 10.0.1 + resolution: "@metamask/eth-token-tracker@npm:10.0.1" dependencies: - "@metamask/eth-block-tracker": "npm:^10.0.0" + "@metamask/eth-block-tracker": "npm:^11.0.3" "@metamask/ethjs-contract": "npm:^0.4.1" "@metamask/ethjs-query": "npm:^0.7.1" "@metamask/safe-event-emitter": "npm:^3.0.0" @@ -5406,7 +5393,7 @@ __metadata: human-standard-token-abi: "npm:^2.0.0" peerDependencies: "@babel/runtime": ^7.21.0 - checksum: 10/5cf3afefe435b708e2f0e624e5920b24d8b2271c8406580623096049b2ebc314895cafefa51714e757c84064ae02cea015f9fbcf455804893a4b36bb3ff19289 + checksum: 10/4111d17f1a9da98897d40fcc42e28302fb2b85868b30c5fef889e5ec0bdeee2d5e22cf5756d02036ef6525820a4f545803d9da8ebb0dcd1668a532b7182aaea3 languageName: node linkType: hard @@ -6474,7 +6461,7 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.3.0": +"@metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.3.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: @@ -26567,7 +26554,7 @@ __metadata: "@metamask/eth-query": "npm:^4.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" "@metamask/eth-snap-keyring": "npm:^7.0.0" - "@metamask/eth-token-tracker": "npm:^9.0.0" + "@metamask/eth-token-tracker": "npm:^10.0.1" "@metamask/eth-trezor-keyring": "npm:^3.1.3" "@metamask/etherscan-link": "npm:^3.0.0" "@metamask/ethjs": "npm:^0.6.0" @@ -26908,7 +26895,6 @@ __metadata: vinyl-sourcemaps-apply: "npm:^0.2.1" wait-on: "npm:^7.0.1" watchify: "npm:^4.0.0" - web3-stream-provider: "npm:^5.0.0" webextension-polyfill: "npm:^0.8.0" webpack: "npm:^5.96.1" webpack-cli: "npm:^5.1.4" @@ -37304,16 +37290,6 @@ __metadata: languageName: node linkType: hard -"web3-stream-provider@npm:^5.0.0": - version: 5.0.0 - resolution: "web3-stream-provider@npm:5.0.0" - dependencies: - readable-stream: "npm:^3.6.2" - uuid: "npm:^9.0.0" - checksum: 10/33f9fc359b381dbe20818027018de281cc0be452cb86ebf09eae80c0bfac18e4149498033f44ee7bfaf8d9017335621d9c9db42186c0f60872a0f76df9f50657 - languageName: node - linkType: hard - "webextension-polyfill@npm:>=0.10.0 <1.0, webextension-polyfill@npm:^0.12.0": version: 0.12.0 resolution: "webextension-polyfill@npm:0.12.0"