@metamask/connect-evm 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0]
11
+
12
+ ### Added
13
+
14
+ - Validate `@metamask/connect-multichain` peer version at runtime and warn on mismatch ([#253](https://github.com/MetaMask/connect-monorepo/pull/253))
15
+ - Announce the MMConnect-managed EIP-1193 provider through EIP-6963 by default when native MetaMask has not already announced, with `skipAutoAnnounce` and `announceProvider()` for manual control. ([#304](https://github.com/MetaMask/connect-monorepo/pull/304))
16
+
17
+ ### Changed
18
+
19
+ - **BREAKING:** `@metamask/connect-multichain` is now a peer dependency.
20
+ Add it to your own `dependencies` (e.g. `npm install @metamask/connect-multichain`)
21
+ — it is no longer installed transitively.
22
+ - Adopts breaking removal of the public `transport` accessor in `@metamask/connect-multichain`. ([#318](https://github.com/MetaMask/connect-monorepo/pull/318))
23
+
24
+ ### Removed
25
+
26
+ - **BREAKING** Remove the `transport.onNotification` option from `createEVMClient()`. The option was a fan-out of typed events already exposed via the EIP-1193 provider (`accountsChanged`, `chainChanged`, `connect`, `disconnect`, `display_uri`) and via `eventHandlers`. Migrate to those listeners instead ([#318](https://github.com/MetaMask/connect-monorepo/pull/318))
27
+
28
+ ### Fixed
29
+
30
+ - MWP-backed EIP-1193 requests now surface wallet errors through rejected promises consistently with the default transport, so `EvmClient.switchChain()` no longer has to handle returned error payloads. ([#311](https://github.com/MetaMask/connect-monorepo/pull/311))
31
+ - Return spec-compatible values from additional intercepted EIP-1193 provider requests: `wallet_requestPermissions` now resolves to requested permissions, while successful `wallet_switchEthereumChain` and `wallet_addEthereumChain` requests resolve to `null`. ([#310](https://github.com/MetaMask/connect-monorepo/pull/310))
32
+
33
+ ## [1.4.0]
34
+
35
+ ### Added
36
+
37
+ - Add an `analytics.enabled` option to `createEVMClient()`. Consumers can set it to `false` to disable dapp-side analytics events and wallet correlation metadata. ([#303](https://github.com/MetaMask/connect-monorepo/pull/303))
38
+
10
39
  ## [1.3.1]
11
40
 
12
41
  ### Fixed
@@ -233,7 +262,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
233
262
 
234
263
  - Initial release ([#58](https://github.com/MetaMask/connect-monorepo/pull/58))
235
264
 
236
- [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.3.1...HEAD
265
+ [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@2.0.0...HEAD
266
+ [2.0.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.4.0...@metamask/connect-evm@2.0.0
267
+ [1.4.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.3.1...@metamask/connect-evm@1.4.0
237
268
  [1.3.1]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.3.0...@metamask/connect-evm@1.3.1
238
269
  [1.3.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.2.0...@metamask/connect-evm@1.3.0
239
270
  [1.2.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.1.0...@metamask/connect-evm@1.2.0
package/README.md CHANGED
@@ -46,6 +46,9 @@ const client = await createEVMClient({
46
46
  },
47
47
  });
48
48
 
49
+ // The MMConnect-managed provider is announced through EIP-6963 by default.
50
+ // Pass `skipAutoAnnounce: true` to opt out and call `client.announceProvider()` manually.
51
+
49
52
  // Connect to MetaMask
50
53
  let accounts, chainId;
51
54
  try {
@@ -165,21 +168,23 @@ Factory function to create a new MetaMask Connect EVM instance.
165
168
 
166
169
  #### Parameters
167
170
 
168
- | Option | Type | Required | Description |
169
- | -------------------------- | --------------------------------------------- | -------- | ---------------------------------------------------- |
170
- | `dapp.name` | `string` | Yes | Name of your dApp |
171
- | `api.supportedNetworks` | `Record<Hex, string>` | Yes | Map of hex chain IDs to RPC URLs |
172
- | `dapp.url` | `string` | No | URL of your dApp |
173
- | `dapp.iconUrl` | `string` | No | Icon URL for your dApp |
174
- | `ui.headless` | `boolean` | No | Run without UI (for custom QR implementations) |
175
- | `ui.preferExtension` | `boolean` | No | Prefer browser extension over mobile (default: true) |
176
- | `ui.showInstallModal` | `boolean` | No | Show installation modal for desktop |
177
- | `mobile.preferredOpenLink` | `(deeplink: string, target?: string) => void` | No | Custom deeplink handler |
178
- | `mobile.useDeeplink` | `boolean` | No | Use `metamask://` instead of universal links |
179
- | `transport.extensionId` | `string` | No | Custom extension ID |
180
- | `transport.onNotification` | `(notification: unknown) => void` | No | Notification handler |
181
- | `eventHandlers` | `Partial<EventHandlers>` | No | Event handlers for provider events |
182
- | `debug` | `boolean` | No | Enable debug logging |
171
+ | Option | Type | Required | Description |
172
+ | --------------------------- | --------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
173
+ | `dapp.name` | `string` | Yes | Name of your dApp |
174
+ | `api.supportedNetworks` | `Record<Hex, string>` | Yes | Map of hex chain IDs to RPC URLs |
175
+ | `dapp.url` | `string` | No | URL of your dApp |
176
+ | `dapp.iconUrl` | `string` | No | Icon URL for your dApp |
177
+ | `ui.headless` | `boolean` | No | Run without UI (for custom QR implementations) |
178
+ | `ui.preferExtension` | `boolean` | No | Prefer browser extension over mobile (default: true) |
179
+ | `ui.showInstallModal` | `boolean` | No | Show installation modal for desktop |
180
+ | `mobile.preferredOpenLink` | `(deeplink: string, target?: string) => void` | No | Custom deeplink handler |
181
+ | `mobile.useDeeplink` | `boolean` | No | Use `metamask://` instead of universal links |
182
+ | `analytics.enabled` | `boolean` | No | Enables dapp-side analytics. Defaults to `true`; set to `false` to disable analytics events and wallet correlation metadata. |
183
+ | `analytics.integrationType` | `string` | No | Integration type for analytics |
184
+ | `transport.extensionId` | `string` | No | Custom extension ID |
185
+ | `eventHandlers` | `Partial<EventHandlers>` | No | Event handlers for provider events |
186
+ | `skipAutoAnnounce` | `boolean` | No | Skip automatic EIP-6963 provider announcement |
187
+ | `debug` | `boolean` | No | Enable debug logging |
183
188
 
184
189
  #### Returns
185
190
 
@@ -304,6 +309,22 @@ None.
304
309
  await client.disconnect();
305
310
  ```
306
311
 
312
+ ##### `announceProvider()`
313
+
314
+ Announces the MMConnect-managed EIP-1193 provider through EIP-6963 unless a native MetaMask provider has already announced with `rdns` `io.metamask` or `io.metamask.mobile`. This is called automatically by `createEVMClient()` unless `skipAutoAnnounce: true` is set. The first call may take up to 300 ms while native providers are requested.
315
+
316
+ **Parameters**
317
+
318
+ None.
319
+
320
+ **Returns**
321
+
322
+ `Promise<void>`
323
+
324
+ ```typescript
325
+ await client.announceProvider();
326
+ ```
327
+
307
328
  ##### `switchChain(options)`
308
329
 
309
330
  Switches to a different chain. Will attempt to add the chain if not configured in the wallet.