Skip to content

Commit

Permalink
chore: replace web3-stream-provider with SteamProvider from @metamask…
Browse files Browse the repository at this point in the history
…/providers
  • Loading branch information
cryptodev-2s committed Dec 18, 2024
1 parent f054257 commit 97b8a45
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 37 deletions.
7 changes: 4 additions & 3 deletions app/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
40 changes: 8 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 97b8a45

Please sign in to comment.