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

chore(deps): bump @metamask/providers from 18.3.1 to 20.0.0 #3057

Merged
merged 4 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions packages/snaps-execution-environments/coverage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"branches": 81.08,
"functions": 89.54,
"lines": 90.92,
"statements": 89.95
"branches": 80.53,
"functions": 88.96,
"lines": 90.69,
"statements": 89.74
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-execution-environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@metamask/json-rpc-engine": "^10.0.2",
"@metamask/object-multiplex": "^2.1.0",
"@metamask/post-message-stream": "^9.0.0",
"@metamask/providers": "^18.3.1",
"@metamask/providers": "^20.0.0",
"@metamask/rpc-errors": "^7.0.2",
"@metamask/snaps-sdk": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
/// <reference path="../../../../node_modules/ses/types.d.ts" />
import { createIdRemapMiddleware } from '@metamask/json-rpc-engine';
import ObjectMultiplex from '@metamask/object-multiplex';
import type { RequestArguments, StreamProvider } from '@metamask/providers';
import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors';
import type { SnapsEthereumProvider, SnapsProvider } from '@metamask/snaps-sdk';
Expand Down Expand Up @@ -33,6 +34,7 @@
JsonRpcIdStruct,
} from '@metamask/utils';
import type { Duplex } from 'readable-stream';
import { pipeline } from 'readable-stream';

import { log } from '../logging';
import type { CommandMethodsMapping } from './commands';
Expand Down Expand Up @@ -369,11 +371,20 @@
});
};

const provider = new SnapProvider(this.rpcStream, {
jsonRpcStreamName: 'metamask-provider',
rpcMiddleware: [createIdRemapMiddleware()],
const multiplex = new ObjectMultiplex();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this in the extension?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did, and this works.

pipeline(this.rpcStream, multiplex, this.rpcStream, (error) => {
if (error) {
logError(`Provider stream failure.`, error);

Check warning on line 377 in packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts

View check run for this annotation

Codecov / codecov/patch

packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts#L376-L377

Added lines #L376 - L377 were not covered by tests
}
});

const provider = new SnapProvider(
multiplex.createStream('metamask-provider'),
{
rpcMiddleware: [createIdRemapMiddleware()],
},
);

provider.initializeSync();

const snap = this.createSnapGlobal(provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function getMockedStreamProvider(): SnapsEthereumProvider {
const rpcStream = mux.createStream(SNAP_STREAM_NAMES.JSON_RPC);

const provider = new StreamProvider(rpcStream, {
jsonRpcStreamName: 'metamask-provider',
rpcMiddleware: [createIdRemapMiddleware()],
logger: SILENT_LOGGER,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
"dependencies": {
"@metamask/key-tree": "^10.0.2",
"@metamask/providers": "^18.3.1",
"@metamask/providers": "^20.0.0",
Copy link
Member

@FrederikBolding FrederikBolding Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in scope, but we can probably remove this type dep at this point. Since we control the request function entirely

"@metamask/rpc-errors": "^7.0.2",
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^11.1.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/test-snaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/providers": "^18.3.1",
"@metamask/providers": "^20.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@swc/core": "1.3.78",
"@swc/jest": "^0.2.26",
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5391,9 +5391,9 @@ __metadata:
languageName: unknown
linkType: soft

"@metamask/providers@npm:^18.3.1":
version: 18.3.1
resolution: "@metamask/providers@npm:18.3.1"
"@metamask/providers@npm:^20.0.0":
version: 20.0.0
resolution: "@metamask/providers@npm:20.0.0"
dependencies:
"@metamask/json-rpc-engine": "npm:^10.0.2"
"@metamask/json-rpc-middleware-stream": "npm:^8.0.6"
Expand All @@ -5408,7 +5408,7 @@ __metadata:
readable-stream: "npm:^3.6.2"
peerDependencies:
webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0
checksum: 10/0e21ba9cce926a49dedbfe30fc964cd2349ee6bf9156f525fb894dcbc147a3ae480384884131a6b1a0a508989b547d8c8d2aeb3d10e11f67a8ee5230c45631a8
checksum: 10/b958d03a9380d86e605db239109a3debcc1ffde90371abe5beb82a5bed46c7718303a2bb92ec269eae16eff145b9ebbfcb3445a2b6bad4f297a590ee725a5bad
languageName: node
linkType: hard

Expand Down Expand Up @@ -5824,7 +5824,7 @@ __metadata:
"@metamask/json-rpc-engine": "npm:^10.0.2"
"@metamask/object-multiplex": "npm:^2.1.0"
"@metamask/post-message-stream": "npm:^9.0.0"
"@metamask/providers": "npm:^18.3.1"
"@metamask/providers": "npm:^20.0.0"
"@metamask/rpc-errors": "npm:^7.0.2"
"@metamask/snaps-sdk": "workspace:^"
"@metamask/snaps-utils": "workspace:^"
Expand Down Expand Up @@ -6045,7 +6045,7 @@ __metadata:
"@metamask/eslint-config-nodejs": "npm:^12.1.0"
"@metamask/eslint-config-typescript": "npm:^12.1.0"
"@metamask/key-tree": "npm:^10.0.2"
"@metamask/providers": "npm:^18.3.1"
"@metamask/providers": "npm:^20.0.0"
"@metamask/rpc-errors": "npm:^7.0.2"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^11.1.0"
Expand Down Expand Up @@ -6415,7 +6415,7 @@ __metadata:
"@metamask/network-example-snap": "workspace:^"
"@metamask/notification-example-snap": "workspace:^"
"@metamask/preinstalled-example-snap": "workspace:^"
"@metamask/providers": "npm:^18.3.1"
"@metamask/providers": "npm:^20.0.0"
"@metamask/send-flow-example-snap": "workspace:^"
"@metamask/signature-insights-example-snap": "workspace:^"
"@metamask/snaps-utils": "workspace:^"
Expand Down
Loading