@metamask/connect-multichain 0.10.0 → 0.11.1

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/LICENSE +18 -20
  3. package/dist/browser/es/connect-multichain.d.mts +10 -1
  4. package/dist/browser/es/connect-multichain.mjs +109 -42
  5. package/dist/browser/es/connect-multichain.mjs.map +1 -1
  6. package/dist/browser/es/metafile-esm.json +1 -1
  7. package/dist/browser/iife/connect-multichain.d.ts +10 -1
  8. package/dist/browser/iife/connect-multichain.js +109 -42
  9. package/dist/browser/iife/connect-multichain.js.map +1 -1
  10. package/dist/browser/iife/metafile-iife.json +1 -1
  11. package/dist/browser/umd/connect-multichain.d.ts +10 -1
  12. package/dist/browser/umd/connect-multichain.js +109 -42
  13. package/dist/browser/umd/connect-multichain.js.map +1 -1
  14. package/dist/browser/umd/metafile-cjs.json +1 -1
  15. package/dist/node/cjs/connect-multichain.d.ts +10 -1
  16. package/dist/node/cjs/connect-multichain.js +109 -42
  17. package/dist/node/cjs/connect-multichain.js.map +1 -1
  18. package/dist/node/cjs/metafile-cjs.json +1 -1
  19. package/dist/node/es/connect-multichain.d.mts +10 -1
  20. package/dist/node/es/connect-multichain.mjs +109 -42
  21. package/dist/node/es/connect-multichain.mjs.map +1 -1
  22. package/dist/node/es/metafile-esm.json +1 -1
  23. package/dist/react-native/es/connect-multichain.d.mts +10 -1
  24. package/dist/react-native/es/connect-multichain.mjs +118 -43
  25. package/dist/react-native/es/connect-multichain.mjs.map +1 -1
  26. package/dist/react-native/es/metafile-esm.json +1 -1
  27. package/dist/src/domain/errors/rpc.d.ts +3 -1
  28. package/dist/src/domain/errors/rpc.d.ts.map +1 -1
  29. package/dist/src/domain/errors/rpc.js +3 -1
  30. package/dist/src/domain/errors/rpc.js.map +1 -1
  31. package/dist/src/domain/events/types/index.d.ts +7 -0
  32. package/dist/src/domain/events/types/index.d.ts.map +1 -1
  33. package/dist/src/domain/multichain/api/constants.d.ts.map +1 -1
  34. package/dist/src/domain/multichain/api/constants.js +82 -19
  35. package/dist/src/domain/multichain/api/constants.js.map +1 -1
  36. package/dist/src/domain/platform/index.js +9 -10
  37. package/dist/src/domain/platform/index.js.map +1 -1
  38. package/dist/src/index.native.d.ts.map +1 -1
  39. package/dist/src/index.native.js +9 -1
  40. package/dist/src/index.native.js.map +1 -1
  41. package/dist/src/multichain/index.d.ts.map +1 -1
  42. package/dist/src/multichain/index.js +1 -5
  43. package/dist/src/multichain/index.js.map +1 -1
  44. package/dist/src/multichain/rpc/requestRouter.d.ts.map +1 -1
  45. package/dist/src/multichain/rpc/requestRouter.js +4 -2
  46. package/dist/src/multichain/rpc/requestRouter.js.map +1 -1
  47. package/dist/src/multichain/transports/default/index.d.ts.map +1 -1
  48. package/dist/src/multichain/transports/default/index.js +9 -3
  49. package/dist/src/multichain/transports/default/index.js.map +1 -1
  50. package/dist/src/multichain/transports/mwp/index.d.ts +1 -0
  51. package/dist/src/multichain/transports/mwp/index.d.ts.map +1 -1
  52. package/dist/src/multichain/transports/mwp/index.js +1 -1
  53. package/dist/src/multichain/transports/mwp/index.js.map +1 -1
  54. package/dist/types/connect-multichain.d.ts +10 -1
  55. package/package.json +10 -7
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
+ ## [0.11.1]
11
+
12
+ ### Changed
13
+
14
+ - chore: align sub-package licenses with root ConsenSys 2022 license ([#241](https://github.com/MetaMask/connect-monorepo/pull/241))
15
+ - chore: turborepo ([#239](https://github.com/MetaMask/connect-monorepo/pull/239))
16
+
17
+ ### Fixed
18
+
19
+ - `MWPTransport.connect()` now accepts and forwards a `forceRequest` option. When `true`, `onResumeSuccess` skips the `isSameScopesAndAccounts` check and unconditionally sends `wallet_createSession`, allowing consumers to re-prompt account selection on an existing MWP session. Previously `forceRequest` was silently ignored, causing `wallet_requestPermissions` to no-op on mobile. ([#243](https://github.com/MetaMask/connect-monorepo/pull/243))
20
+ - Fix platform detection for Hermes-based React Native apps: `isReactNative()` now checks `global.navigator.product` before `window.navigator.product`, so modern RN environments where `window` is undefined correctly resolve to `PlatformType.ReactNative` instead of `PlatformType.NonBrowser`. This restores analytics for all React Native consumers — analytics were silently disabled because `#setupAnalytics()` only calls `analytics.enable()` for browser and `ReactNative` platforms ([#238](https://github.com/MetaMask/connect-monorepo/pull/238))
21
+
22
+ ## [0.11.0]
23
+
24
+ ### Changed
25
+
26
+ - `DefaultTransport` now forwards all wallet notifications instead of filtering to only `metamask_chainChanged` and `metamask_accountsChanged`, matching `MWPTransport` behavior ([#230](https://github.com/MetaMask/connect-monorepo/pull/230))
27
+ - `stateChanged` is now emitted via the `EventEmitter` so `client.on('stateChanged', cb)` fires correctly ([#230](https://github.com/MetaMask/connect-monorepo/pull/230))
28
+ - `SDKEvents` type now includes explicit entries for `metamask_accountsChanged`, `metamask_chainChanged`, and `stateChanged` ([#230](https://github.com/MetaMask/connect-monorepo/pull/230))
29
+ - Mark `@react-native-async-storage/async-storage` peer dependency as optional — web/Node consumers no longer pull in the React Native toolchain ([#234](https://github.com/MetaMask/connect-monorepo/pull/234))
30
+ - `getInfuraRpcUrls` now includes Solana mainnet and devnet CAIP chain IDs in the generated RPC URL map ([#235](https://github.com/MetaMask/connect-monorepo/pull/235))
31
+ - Updated `infuraRpcUrls` to align with Infura's currently supported networks by removing deprecated testnets (Goerli variants, Mumbai, Palm testnet, Aurora) and adding new mainnet/testnet coverage across Base, Blast, zkSync, BSC/opBNB, Scroll, Mantle, Sei, Swellchain, Unichain, Hemi, MegaETH, Monad, and Celo Sepolia ([#237](https://github.com/MetaMask/connect-monorepo/pull/237))
32
+
33
+ ### Fixed
34
+
35
+ - `RPCInvokeMethodErr` now carries the original numeric RPC code from the wallet (`rpcCode`) and the original wallet-facing message (`rpcMessage`) as separate fields, so higher layers can re-surface them without losing them inside internal error formatting. ([#232](https://github.com/MetaMask/connect-monorepo/pull/232))
36
+ - `RequestRouter` now propagates the numeric RPC error code from wallet response errors and transport exceptions into `RPCInvokeMethodErr`, ensuring the code is not dropped during error wrapping. ([#232](https://github.com/MetaMask/connect-monorepo/pull/232))
37
+ - `DefaultTransport` now attaches the numeric RPC code to errors produced from `window.postMessage` responses, so it survives the transport boundary. ([#232](https://github.com/MetaMask/connect-monorepo/pull/232))
38
+
10
39
  ## [0.10.0]
11
40
 
12
41
  ### Changed
@@ -210,7 +239,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
210
239
 
211
240
  - Initial release
212
241
 
213
- [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.10.0...HEAD
242
+ [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.11.1...HEAD
243
+ [0.11.1]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.11.0...@metamask/connect-multichain@0.11.1
244
+ [0.11.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.10.0...@metamask/connect-multichain@0.11.0
214
245
  [0.10.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.9.0...@metamask/connect-multichain@0.10.0
215
246
  [0.9.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.8.0...@metamask/connect-multichain@0.9.0
216
247
  [0.8.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.7.0...@metamask/connect-multichain@0.8.0
package/LICENSE CHANGED
@@ -1,20 +1,18 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 MetaMask
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ Copyright ConsenSys Software Inc. 2022. All rights reserved.
2
+
3
+ You acknowledge and agree that ConsenSys Software Inc. ("ConsenSys") (or ConsenSys's licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the "Program"), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.
4
+
5
+ Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository.
6
+
7
+ You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the "Resulting Program") solely for Non-Commercial Use as long as you:
8
+ 1. give prominent notice ("Notice") with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ConsenSys; and
9
+ 2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein.
10
+
11
+ "Non-Commercial Use" means each use as described in clauses (1)-(3) below, as reasonably determined by ConsenSys in its sole discretion:
12
+ 1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application;
13
+ 2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or
14
+ 3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time.
15
+
16
+ You will not use any trade mark, service mark, trade name, logo of ConsenSys or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos.
17
+
18
+ If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at metamask.license@consensys.net.
@@ -37,13 +37,22 @@ declare class RPCReadonlyRequestErr extends BaseErr<'RPC', RPCErrorCodes> {
37
37
  }
38
38
  declare class RPCInvokeMethodErr extends BaseErr<'RPC', RPCErrorCodes> {
39
39
  readonly reason: string;
40
+ readonly rpcCode?: number | undefined;
41
+ readonly rpcMessage?: string | undefined;
40
42
  static readonly code = 53;
41
- constructor(reason: string);
43
+ constructor(reason: string, rpcCode?: number | undefined, rpcMessage?: string | undefined);
42
44
  }
43
45
 
44
46
  type SDKEvents = {
45
47
  display_uri: [evt: string];
46
48
  wallet_sessionChanged: [evt: SessionData | undefined];
49
+ metamask_accountsChanged: [evt: string[]];
50
+ metamask_chainChanged: [evt: {
51
+ chainId: string;
52
+ }];
53
+ stateChanged: [
54
+ evt: 'pending' | 'loaded' | 'disconnected' | 'connected' | 'connecting'
55
+ ];
47
56
  [key: string]: [evt: unknown];
48
57
  };
49
58
  type EventTypes = SDKEvents;
@@ -112,12 +112,14 @@ var init_rpc = __esm({
112
112
  _RPCReadonlyRequestErr.code = 52;
113
113
  RPCReadonlyRequestErr = _RPCReadonlyRequestErr;
114
114
  _RPCInvokeMethodErr = class _RPCInvokeMethodErr extends BaseErr {
115
- constructor(reason) {
115
+ constructor(reason, rpcCode, rpcMessage) {
116
116
  super(
117
117
  `RPCErr${_RPCInvokeMethodErr.code}: RPC Client invoke method reason (${reason})`,
118
118
  _RPCInvokeMethodErr.code
119
119
  );
120
120
  this.reason = reason;
121
+ this.rpcCode = rpcCode;
122
+ this.rpcMessage = rpcMessage;
121
123
  }
122
124
  };
123
125
  _RPCInvokeMethodErr.code = 53;
@@ -258,35 +260,98 @@ var init_constants = __esm({
258
260
  // ###### Ethereum ######
259
261
  // Mainnet
260
262
  "eip155:1": "https://mainnet.infura.io/v3/",
261
- // Goerli
262
- "eip155:5": "https://goerli.infura.io/v3/",
263
263
  // Sepolia 11155111
264
264
  "eip155:11155111": "https://sepolia.infura.io/v3/",
265
+ // Hoodi
266
+ "eip155:560048": "https://hoodi.infura.io/v3/",
265
267
  // ###### Linea ######
266
268
  // Mainnet Alpha
267
269
  "eip155:59144": "https://linea-mainnet.infura.io/v3/",
268
- // Testnet ( linea goerli )
269
- "eip155:59140": "https://linea-goerli.infura.io/v3/",
270
+ // Sepolia
271
+ "eip155:59141": "https://linea-sepolia.infura.io/v3/",
270
272
  // ###### Polygon ######
271
273
  // Mainnet
272
274
  "eip155:137": "https://polygon-mainnet.infura.io/v3/",
273
- // Mumbai
274
- "eip155:80001": "https://polygon-mumbai.infura.io/v3/",
275
+ // Amoy
276
+ "eip155:80002": "https://polygon-amoy.infura.io/v3/",
275
277
  // ###### Optimism ######
276
278
  // Mainnet
277
279
  "eip155:10": "https://optimism-mainnet.infura.io/v3/",
278
- // Goerli
279
- "eip155:420": "https://optimism-goerli.infura.io/v3/",
280
+ // Sepolia
281
+ "eip155:11155420": "https://optimism-sepolia.infura.io/v3/",
280
282
  // ###### Arbitrum ######
281
283
  // Mainnet
282
284
  "eip155:42161": "https://arbitrum-mainnet.infura.io/v3/",
283
- // Goerli
284
- "eip155:421613": "https://arbitrum-goerli.infura.io/v3/",
285
+ // Sepolia
286
+ "eip155:421614": "https://arbitrum-sepolia.infura.io/v3/",
287
+ // ###### Base ######
288
+ // Mainnet
289
+ "eip155:8453": "https://base-mainnet.infura.io/v3/",
290
+ // Sepolia
291
+ "eip155:84532": "https://base-sepolia.infura.io/v3/",
292
+ // ###### Blast ######
293
+ // Mainnet
294
+ "eip155:81457": "https://blast-mainnet.infura.io/v3/",
295
+ // Sepolia
296
+ "eip155:168587773": "https://blast-sepolia.infura.io/v3/",
297
+ // ###### zkSync ######
298
+ // Mainnet
299
+ "eip155:324": "https://zksync-mainnet.infura.io/v3/",
300
+ // Sepolia
301
+ "eip155:300": "https://zksync-sepolia.infura.io/v3/",
302
+ // ###### BSC ######
303
+ // Mainnet
304
+ "eip155:56": "https://bsc-mainnet.infura.io/v3/",
305
+ // Testnet
306
+ "eip155:97": "https://bsc-testnet.infura.io/v3/",
307
+ // ###### opBNB ######
308
+ // Mainnet
309
+ "eip155:204": "https://opbnb-mainnet.infura.io/v3/",
310
+ // Testnet
311
+ "eip155:5611": "https://opbnb-testnet.infura.io/v3/",
312
+ // ###### Scroll ######
313
+ // Mainnet
314
+ "eip155:534352": "https://scroll-mainnet.infura.io/v3/",
315
+ // Sepolia
316
+ "eip155:534351": "https://scroll-sepolia.infura.io/v3/",
317
+ // ###### Mantle ######
318
+ // Mainnet
319
+ "eip155:5000": "https://mantle-mainnet.infura.io/v3/",
320
+ // Sepolia
321
+ "eip155:5003": "https://mantle-sepolia.infura.io/v3/",
322
+ // ###### Sei ######
323
+ // Mainnet
324
+ "eip155:1329": "https://sei-mainnet.infura.io/v3/",
325
+ // Testnet
326
+ "eip155:713715": "https://sei-testnet.infura.io/v3/",
327
+ // ###### Swellchain ######
328
+ // Mainnet
329
+ "eip155:1923": "https://swellchain-mainnet.infura.io/v3/",
330
+ // Testnet
331
+ "eip155:1924": "https://swellchain-testnet.infura.io/v3/",
332
+ // ###### Unichain ######
333
+ // Mainnet
334
+ "eip155:130": "https://unichain-mainnet.infura.io/v3/",
335
+ // Sepolia
336
+ "eip155:1301": "https://unichain-sepolia.infura.io/v3/",
337
+ // ###### Hemi ######
338
+ // Mainnet
339
+ "eip155:43111": "https://hemi-mainnet.infura.io/v3/",
340
+ // Testnet
341
+ "eip155:743111": "https://hemi-testnet.infura.io/v3/",
342
+ // ###### MegaETH ######
343
+ // Mainnet
344
+ "eip155:6342": "https://megaeth-mainnet.infura.io/v3/",
345
+ // Testnet
346
+ "eip155:6342001": "https://megaeth-testnet.infura.io/v3/",
347
+ // ###### Monad ######
348
+ // Mainnet
349
+ "eip155:143": "https://monad-mainnet.infura.io/v3/",
350
+ // Testnet
351
+ "eip155:10143": "https://monad-testnet.infura.io/v3/",
285
352
  // ###### Palm ######
286
353
  // Mainnet
287
354
  "eip155:11297108109": "https://palm-mainnet.infura.io/v3/",
288
- // Testnet
289
- "eip155:11297108099": "https://palm-testnet.infura.io/v3/",
290
355
  // ###### Avalanche C-Chain ######
291
356
  // Mainnet
292
357
  "eip155:43114": "https://avalanche-mainnet.infura.io/v3/",
@@ -297,11 +362,6 @@ var init_constants = __esm({
297
362
  // 'near:mainnet': `https://near-mainnet.infura.io/v3/`,
298
363
  // // Testnet
299
364
  // 'near:testnet': `https://near-testnet.infura.io/v3/`,
300
- // ###### Aurora ######
301
- // Mainnet
302
- "eip155:1313161554": "https://aurora-mainnet.infura.io/v3/",
303
- // Testnet
304
- "eip155:1313161555": "https://aurora-testnet.infura.io/v3/",
305
365
  // ###### StarkNet ######
306
366
  // Mainnet
307
367
  //
@@ -313,8 +373,13 @@ var init_constants = __esm({
313
373
  // ###### Celo ######
314
374
  // Mainnet
315
375
  "eip155:42220": "https://celo-mainnet.infura.io/v3/",
316
- // Alfajores Testnet
317
- "eip155:44787": "https://celo-alfajores.infura.io/v3/"
376
+ // Sepolia
377
+ "eip155:44787": "https://celo-sepolia.infura.io/v3/",
378
+ // ###### Solana ######
379
+ // Mainnet
380
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "https://solana-mainnet.infura.io/v3/",
381
+ // Devnet
382
+ "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1": "https://solana-devnet.infura.io/v3/"
318
383
  };
319
384
  RPC_HANDLED_METHODS = /* @__PURE__ */ new Set([
320
385
  "eth_blockNumber",
@@ -441,26 +506,21 @@ var init_multichain = __esm({
441
506
  // src/domain/platform/index.ts
442
507
  import Bowser from "bowser";
443
508
  function isNotBrowser() {
444
- var _a3;
445
509
  if (typeof window === "undefined") {
446
510
  return true;
447
511
  }
448
512
  if (!(window == null ? void 0 : window.navigator)) {
449
513
  return true;
450
514
  }
451
- if (typeof global !== "undefined" && ((_a3 = global == null ? void 0 : global.navigator) == null ? void 0 : _a3.product) === "ReactNative") {
452
- return true;
453
- }
454
515
  return (navigator == null ? void 0 : navigator.product) === "ReactNative";
455
516
  }
456
517
  function isReactNative() {
457
- var _a3;
458
- const hasWindowNavigator = typeof window !== "undefined" && window.navigator !== void 0;
459
- const nav = hasWindowNavigator ? window.navigator : void 0;
460
- if (!nav) {
461
- return false;
518
+ var _a3, _b;
519
+ if (typeof global !== "undefined" && ((_a3 = global == null ? void 0 : global.navigator) == null ? void 0 : _a3.product) === "ReactNative") {
520
+ return true;
462
521
  }
463
- return hasWindowNavigator && ((_a3 = window.navigator) == null ? void 0 : _a3.product) === "ReactNative";
522
+ const hasWindowNavigator = typeof window !== "undefined" && window.navigator !== void 0;
523
+ return hasWindowNavigator && ((_b = window.navigator) == null ? void 0 : _b.product) === "ReactNative";
464
524
  }
465
525
  function isMetaMaskMobileWebView() {
466
526
  return typeof window !== "undefined" && // @ts-expect-error ReactNativeWebView should be defined
@@ -1481,7 +1541,9 @@ var RequestRouter = class {
1481
1541
  if (response.error) {
1482
1542
  const { error } = response;
1483
1543
  throw new RPCInvokeMethodErr(
1484
- `RPC Request failed with code ${error.code}: ${error.message}`
1544
+ `RPC Request failed with code ${error.code}: ${error.message}`,
1545
+ error.code,
1546
+ error.message
1485
1547
  );
1486
1548
  }
1487
1549
  return response.result;
@@ -1522,6 +1584,7 @@ var RequestRouter = class {
1522
1584
  _RequestRouter_instances = new WeakSet();
1523
1585
  withAnalyticsTracking_fn = function(options, execute) {
1524
1586
  return __async(this, null, function* () {
1587
+ var _a3;
1525
1588
  yield __privateMethod(this, _RequestRouter_instances, trackWalletActionRequested_fn).call(this, options);
1526
1589
  try {
1527
1590
  const result = yield execute();
@@ -1537,7 +1600,11 @@ withAnalyticsTracking_fn = function(options, execute) {
1537
1600
  if (error instanceof RPCInvokeMethodErr) {
1538
1601
  throw error;
1539
1602
  }
1540
- throw new RPCInvokeMethodErr(error.message);
1603
+ const castError = error;
1604
+ throw new RPCInvokeMethodErr(
1605
+ (_a3 = castError.message) != null ? _a3 : "Unknown error",
1606
+ castError.code
1607
+ );
1541
1608
  }
1542
1609
  });
1543
1610
  };
@@ -1794,9 +1861,13 @@ handleResponse_fn = function(event) {
1794
1861
  __privateGet(this, _pendingRequests).delete(responseId);
1795
1862
  const response = responseData;
1796
1863
  if ("error" in response && response.error) {
1797
- pendingRequest.reject(
1798
- new Error(response.error.message || "Request failed")
1864
+ const error = new Error(
1865
+ response.error.message || "Request failed"
1799
1866
  );
1867
+ if (typeof response.error.code === "number") {
1868
+ error.code = response.error.code;
1869
+ }
1870
+ pendingRequest.reject(error);
1800
1871
  } else {
1801
1872
  pendingRequest.resolve(response);
1802
1873
  }
@@ -1809,7 +1880,7 @@ handleNotification_fn = function(event) {
1809
1880
  return;
1810
1881
  }
1811
1882
  const responseData = (_b = (_a3 = event == null ? void 0 : event.data) == null ? void 0 : _a3.data) == null ? void 0 : _b.data;
1812
- if (typeof responseData === "object" && responseData !== null && (responseData.method === "metamask_chainChanged" || responseData.method === "metamask_accountsChanged")) {
1883
+ if (typeof responseData === "object" && responseData !== null && "method" in responseData) {
1813
1884
  __privateMethod(this, _DefaultTransport_instances, notifyCallbacks_fn).call(this, responseData);
1814
1885
  }
1815
1886
  };
@@ -2186,7 +2257,7 @@ var MWPTransport = class {
2186
2257
  walletSession,
2187
2258
  proposedCaipAccountIds
2188
2259
  );
2189
- if (!hasSameScopesAndAccounts) {
2260
+ if (options.forceRequest || !hasSameScopesAndAccounts) {
2190
2261
  const optionalScopes = addValidAccounts(
2191
2262
  getOptionalScopes((_d = options == null ? void 0 : options.scopes) != null ? _d : []),
2192
2263
  getValidAccounts((_e = options == null ? void 0 : options.caipAccountIds) != null ? _e : [])
@@ -2687,7 +2758,7 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
2687
2758
  versions: __spreadValues({
2688
2759
  // typeof guard needed: Metro (React Native) bundles TS source directly,
2689
2760
  // bypassing the tsup build that substitutes __PACKAGE_VERSION__.
2690
- "connect-multichain": false ? "unknown" : "0.10.0"
2761
+ "connect-multichain": false ? "unknown" : "0.11.1"
2691
2762
  }, (_f = options.versions) != null ? _f : {})
2692
2763
  });
2693
2764
  super(allOptions);
@@ -2711,15 +2782,11 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
2711
2782
  return this._status;
2712
2783
  }
2713
2784
  set status(value) {
2714
- var _a3, _b;
2715
2785
  if (this._status === value) {
2716
2786
  return;
2717
2787
  }
2718
2788
  this._status = value;
2719
- (_b = (_a3 = this.options.transport) == null ? void 0 : _a3.onNotification) == null ? void 0 : _b.call(_a3, {
2720
- method: "stateChanged",
2721
- params: value
2722
- });
2789
+ this.emit("stateChanged", value);
2723
2790
  }
2724
2791
  get provider() {
2725
2792
  return __privateGet(this, _provider);