Skip to content

Commit

Permalink
chore(deps): bump @metamask/providers from 18.3.1 to 20.0.0 (#3057)
Browse files Browse the repository at this point in the history
Bumps [@metamask/providers](https://github.com/MetaMask/providers) from
18.3.1 to 20.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/MetaMask/providers/releases"><code>@​metamask/providers</code>'s
releases</a>.</em></p>
<blockquote>
<h2>20.0.0</h2>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: An <code>isConnected</code> boolean
property is now expected in the result of
<code>metamask_getProviderState</code> and
<code>metamask_chainChanged</code> events (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li><strong>BREAKING</strong>: A <code>networkVersion</code> value of
<code>loading</code> received by the <code>chainChanged</code> event
handler is now interpreted to be null. In this case, the
<code>networkChanged</code> event emits a null value as well. (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li><strong>BREAKING</strong>: The disconnect event is now tied to the
new <code>isConnected</code> property instead of the
<code>networkVersion</code> property. (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li>A change in the <code>isUnlocked</code> boolean property of the
<code>metamask_getProviderState</code> and
<code>metamask_accountsChanged</code> events (from what is in state) no
longer causes the <code>accountsChanged</code> event to be emitted (<a
href="https://redirect.github.com/MetaMask/providers/pull/405">#405</a>)</li>
<li><code>MetaMaskInpageProvider.isUnlocked()</code> will always return
true until the inpage to contentscript stream ends and the provider
enters a permanently disconnected state (<a
href="https://redirect.github.com/MetaMask/providers/pull/405">#405</a>)</li>
</ul>
<h2>19.0.0</h2>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: <code>StreamProvider</code> no longer
accepts a <code>jsonRpcStreamName</code> parameter (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Previously, this parameter was used internally to create an
ObjectMultiplex stream and substream for JSON-RPC communication</li>
<li>Now, the consumer is responsible for creating and managing the
stream multiplexing if needed</li>
<li>The provider will use the provided stream connection directly
without any multiplexing</li>
</ul>
</li>
<li><strong>BREAKING</strong>: <code>MetaMaskInpageProvider</code> no
longer accepts a <code>jsonRpcStreamName</code> parameter (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>This change is inherited from StreamProvider, as
MetaMaskInpageProvider extends StreamProvider</li>
<li>Stream multiplexing should be handled before provider
instantiation</li>
</ul>
</li>
<li><code>initializeInpageProvider</code> now handles stream
multiplexing internally (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Creates an ObjectMultiplex instance and substream using the provided
<code>jsonRpcStreamName</code></li>
<li>This maintains backwards compatibility for consumers using
<code>initializeInpageProvider</code></li>
</ul>
</li>
<li><code>createExternalExtensionProvider</code> now handles stream
multiplexing internally (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Creates an ObjectMultiplex instance and substream for JSON-RPC
communication</li>
<li>This maintains backwards compatibility for consumers using
<code>createExternalExtensionProvider</code></li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/MetaMask/providers/blob/main/CHANGELOG.md"><code>@​metamask/providers</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>[20.0.0]</h2>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: An <code>isConnected</code> boolean
property is now expected in the result of
<code>metamask_getProviderState</code> and
<code>metamask_chainChanged</code> events (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li><strong>BREAKING</strong>: A <code>networkVersion</code> value of
<code>loading</code> received by the <code>chainChanged</code> event
handler is now interpreted to be null. In this case, the
<code>networkChanged</code> event emits a null value as well. (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li><strong>BREAKING</strong>: The disconnect event is now tied to the
new <code>isConnected</code> property instead of the
<code>networkVersion</code> property. (<a
href="https://redirect.github.com/MetaMask/providers/pull/404">#404</a>)</li>
<li>A change in the <code>isUnlocked</code> boolean property of the
<code>metamask_getProviderState</code> and
<code>metamask_accountsChanged</code> events (from what is in state) no
longer causes the <code>accountsChanged</code> event to be emitted (<a
href="https://redirect.github.com/MetaMask/providers/pull/405">#405</a>)</li>
<li><code>MetaMaskInpageProvider.isUnlocked()</code> will always return
true until the inpage to contentscript stream ends and the provider
enters a permanently disconnected state (<a
href="https://redirect.github.com/MetaMask/providers/pull/405">#405</a>)</li>
</ul>
<h2>[19.0.0]</h2>
<h3>Changed</h3>
<ul>
<li><strong>BREAKING</strong>: <code>StreamProvider</code> no longer
accepts a <code>jsonRpcStreamName</code> parameter (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Previously, this parameter was used internally to create an
ObjectMultiplex stream and substream for JSON-RPC communication</li>
<li>Now, the consumer is responsible for creating and managing the
stream multiplexing if needed</li>
<li>The provider will use the provided stream connection directly
without any multiplexing</li>
</ul>
</li>
<li><strong>BREAKING</strong>: <code>MetaMaskInpageProvider</code> no
longer accepts a <code>jsonRpcStreamName</code> parameter (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>This change is inherited from StreamProvider, as
MetaMaskInpageProvider extends StreamProvider</li>
<li>Stream multiplexing should be handled before provider
instantiation</li>
</ul>
</li>
<li><code>initializeInpageProvider</code> now handles stream
multiplexing internally (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Creates an ObjectMultiplex instance and substream using the provided
<code>jsonRpcStreamName</code></li>
<li>This maintains backwards compatibility for consumers using
<code>initializeInpageProvider</code></li>
</ul>
</li>
<li><code>createExternalExtensionProvider</code> now handles stream
multiplexing internally (<a
href="https://redirect.github.com/MetaMask/providers/pull/400">#400</a>)
<ul>
<li>Creates an ObjectMultiplex instance and substream for JSON-RPC
communication</li>
<li>This maintains backwards compatibility for consumers using
<code>createExternalExtensionProvider</code></li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/MetaMask/providers/commit/e19bdf5d86b5f245f28a7ef2a1e36bee8841443b"><code>e19bdf5</code></a>
20.0.0 (<a
href="https://redirect.github.com/MetaMask/providers/issues/407">#407</a>)</li>
<li><a
href="https://github.com/MetaMask/providers/commit/bda8d7288425cfa6a460935a6fbf4e2d35bdf335"><code>bda8d72</code></a>
fix: eth_accounts / accountsChanged behavior when wallet is locked (<a
href="https://redirect.github.com/MetaMask/providers/issues/405">#405</a>)</li>
<li><a
href="https://github.com/MetaMask/providers/commit/d919ab6bf356ff0a7d4eb1a1997e3372858a2f6c"><code>d919ab6</code></a>
feat: allow <code>networkVersion</code> to be set to <code>null</code>.
fire connection events base...</li>
<li><a
href="https://github.com/MetaMask/providers/commit/11acfb0ee733743a3264313bcba4be2c34e9f62d"><code>11acfb0</code></a>
19.0.0 (<a
href="https://redirect.github.com/MetaMask/providers/issues/402">#402</a>)</li>
<li><a
href="https://github.com/MetaMask/providers/commit/df85bdf35130182ecf2ecc71cca4213cca0df2e2"><code>df85bdf</code></a>
refactor(StreamProvider): remove unnecessary stream multiplexing (<a
href="https://redirect.github.com/MetaMask/providers/issues/400">#400</a>)</li>
<li>See full diff in <a
href="https://github.com/MetaMask/providers/compare/v18.3.1...v20.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@metamask/providers&package-manager=npm_and_yarn&previous-version=18.3.1&new-version=20.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 6, 2025
1 parent cc5cc01 commit 3fa49bd
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 22 deletions.
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 @@ import {
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 @@ export class BaseSnapExecutor {
});
};

const provider = new SnapProvider(this.rpcStream, {
jsonRpcStreamName: 'metamask-provider',
rpcMiddleware: [createIdRemapMiddleware()],
const multiplex = new ObjectMultiplex();
pipeline(this.rpcStream, multiplex, this.rpcStream, (error) => {
if (error) {
logError(`Provider stream failure.`, error);
}
});

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",
"@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

0 comments on commit 3fa49bd

Please sign in to comment.