@metamask/connect-evm 1.4.0 → 2.1.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 +36 -1
- package/README.md +20 -1
- package/dist/browser/es/connect-evm.mjs +362 -47
- package/dist/browser/es/connect-evm.mjs.map +1 -1
- package/dist/src/connect.d.ts +11 -2
- package/dist/src/connect.d.ts.map +1 -1
- package/dist/src/connect.js +117 -22
- package/dist/src/connect.js.map +1 -1
- package/dist/src/eip6963.d.ts +80 -0
- package/dist/src/eip6963.d.ts.map +1 -0
- package/dist/src/eip6963.js +297 -0
- package/dist/src/eip6963.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/provider.d.ts.map +1 -1
- package/dist/src/provider.js +4 -0
- package/dist/src/provider.js.map +1 -1
- package/dist/src/utils/infura.js.map +1 -1
- package/dist/types/index.d.ts +21 -3
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.1.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `@metamask/connect-multichain` is no longer a peer dependency and will be installed transitively as a regular dependency ([#323](https://github.com/MetaMask/connect-monorepo/pull/323))
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `EIP1193Provider.request()` now preserves JSON-RPC error `data` on provider-facing errors when `connect-multichain` surfaces a wallet error through `RPCInvokeMethodErr`. Dapps can read revert reasons, custom-error bytes, and other wallet-provided error metadata from `error.data` alongside the original wallet `error.code` and `error.message`. ([#312](https://github.com/MetaMask/connect-monorepo/pull/312))
|
|
19
|
+
|
|
20
|
+
## [2.0.0]
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Validate `@metamask/connect-multichain` peer version at runtime and warn on mismatch ([#253](https://github.com/MetaMask/connect-monorepo/pull/253))
|
|
25
|
+
- 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))
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **BREAKING:** `@metamask/connect-multichain` is now a peer dependency.
|
|
30
|
+
Add it to your own `dependencies` (e.g. `npm install @metamask/connect-multichain`)
|
|
31
|
+
— it is no longer installed transitively.
|
|
32
|
+
- Adopts breaking removal of the public `transport` accessor in `@metamask/connect-multichain`. ([#318](https://github.com/MetaMask/connect-monorepo/pull/318))
|
|
33
|
+
|
|
34
|
+
### Removed
|
|
35
|
+
|
|
36
|
+
- **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))
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- 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))
|
|
41
|
+
- 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))
|
|
42
|
+
|
|
10
43
|
## [1.4.0]
|
|
11
44
|
|
|
12
45
|
### Added
|
|
@@ -239,7 +272,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
239
272
|
|
|
240
273
|
- Initial release ([#58](https://github.com/MetaMask/connect-monorepo/pull/58))
|
|
241
274
|
|
|
242
|
-
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.
|
|
275
|
+
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@2.1.0...HEAD
|
|
276
|
+
[2.1.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@2.0.0...@metamask/connect-evm@2.1.0
|
|
277
|
+
[2.0.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.4.0...@metamask/connect-evm@2.0.0
|
|
243
278
|
[1.4.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.3.1...@metamask/connect-evm@1.4.0
|
|
244
279
|
[1.3.1]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.3.0...@metamask/connect-evm@1.3.1
|
|
245
280
|
[1.3.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@1.2.0...@metamask/connect-evm@1.3.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 {
|
|
@@ -179,8 +182,8 @@ Factory function to create a new MetaMask Connect EVM instance.
|
|
|
179
182
|
| `analytics.enabled` | `boolean` | No | Enables dapp-side analytics. Defaults to `true`; set to `false` to disable analytics events and wallet correlation metadata. |
|
|
180
183
|
| `analytics.integrationType` | `string` | No | Integration type for analytics |
|
|
181
184
|
| `transport.extensionId` | `string` | No | Custom extension ID |
|
|
182
|
-
| `transport.onNotification` | `(notification: unknown) => void` | No | Notification handler |
|
|
183
185
|
| `eventHandlers` | `Partial<EventHandlers>` | No | Event handlers for provider events |
|
|
186
|
+
| `skipAutoAnnounce` | `boolean` | No | Skip automatic EIP-6963 provider announcement |
|
|
184
187
|
| `debug` | `boolean` | No | Enable debug logging |
|
|
185
188
|
|
|
186
189
|
#### Returns
|
|
@@ -306,6 +309,22 @@ None.
|
|
|
306
309
|
await client.disconnect();
|
|
307
310
|
```
|
|
308
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
|
+
|
|
309
328
|
##### `switchChain(options)`
|
|
310
329
|
|
|
311
330
|
Switches to a different chain. Will attempt to add the chain if not configured in the wallet.
|