@metamask/connect-evm 0.6.0 → 0.7.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,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0]
11
+
12
+ ### Added
13
+
14
+ - Enable specifying the integration type for analytics. Defaults to `direct`. ([#213](https://github.com/MetaMask/connect-monorepo/pull/213))
15
+ - Pass `connect-evm` package version to `createMultichainClient` via the `versions` option so it appears in analytics events ([#206](https://github.com/MetaMask/connect-monorepo/pull/206))
16
+
17
+ ### Fixed
18
+
19
+ - Fix an issue where `connect` would always return the default chain id regardless of other chains being specified. This also affected `connectWith` and `connectAndSign` ([#205](https://github.com/MetaMask/connect-monorepo/pull/205))
20
+
10
21
  ## [0.6.0]
11
22
 
12
23
  ### Added
@@ -127,7 +138,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
127
138
 
128
139
  - Initial release ([#58](https://github.com/MetaMask/connect-monorepo/pull/58))
129
140
 
130
- [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.6.0...HEAD
141
+ [Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.7.0...HEAD
142
+ [0.7.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.6.0...@metamask/connect-evm@0.7.0
131
143
  [0.6.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.5.0...@metamask/connect-evm@0.6.0
132
144
  [0.5.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.4.1...@metamask/connect-evm@0.5.0
133
145
  [0.4.1]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-evm@0.4.0...@metamask/connect-evm@0.4.1
package/README.md CHANGED
@@ -216,11 +216,11 @@ Connects to MetaMask wallet.
216
216
 
217
217
  **Parameters**
218
218
 
219
- | Name | Type | Required | Description |
220
- | ---------------------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
221
- | `options.chainIds` | `Hex[]` | No | Array of hex chain IDs to request permission for (defaults to `['0x1']` if not provided). Note: Ethereum mainnet (`0x1`) is always included in the request regardless of what is passed. |
222
- | `options.account` | `string` | No | Specific account address to connect |
223
- | `options.forceRequest` | `boolean` | No | Force a new connection request even if already connected |
219
+ | Name | Type | Required | Description |
220
+ | ---------------------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
221
+ | `options.chainIds` | `Hex[]` | No | Array of hex chain IDs to request permission for (defaults to `['0x1']` if not provided). Note: Ethereum mainnet (`0x1`) is always included in the permission request regardless of what is passed. The **first** entry in the array becomes the active chain returned by the call. |
222
+ | `options.account` | `string` | No | Specific account address to connect |
223
+ | `options.forceRequest` | `boolean` | No | Force a new connection request even if already connected |
224
224
 
225
225
  **Returns**
226
226
 
@@ -240,10 +240,10 @@ Connects and immediately signs a message using `personal_sign`.
240
240
 
241
241
  **Parameters**
242
242
 
243
- | Name | Type | Required | Description |
244
- | ------------------ | -------- | -------- | --------------------------------------------------- |
245
- | `options.message` | `string` | Yes | The message to sign after connecting |
246
- | `options.chainIds` | `Hex[]` | No | Hex chain IDs to connect to (defaults to `['0x1']`) |
243
+ | Name | Type | Required | Description |
244
+ | ------------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
245
+ | `options.message` | `string` | Yes | The message to sign after connecting |
246
+ | `options.chainIds` | `Hex[]` | No | Hex chain IDs to request permission for (defaults to `['0x1']`). The first entry becomes the active chain used for signing. |
247
247
 
248
248
  **Returns**
249
249
 
@@ -262,13 +262,13 @@ Connects and immediately invokes a method with specified parameters.
262
262
 
263
263
  **Parameters**
264
264
 
265
- | Name | Type | Required | Description |
266
- | ---------------------- | ------------------------------------------------ | -------- | --------------------------------------------------------------------------------------- |
267
- | `options.method` | `string` | Yes | The RPC method name to invoke |
268
- | `options.params` | `unknown[] \| ((account: Address) => unknown[])` | Yes | Method parameters, or a function that receives the connected account and returns params |
269
- | `options.chainIds` | `Hex[]` | No | Hex chain IDs to connect to (defaults to `['0x1']`) |
270
- | `options.account` | `string` | No | Specific account to connect |
271
- | `options.forceRequest` | `boolean` | No | Force a new connection request |
265
+ | Name | Type | Required | Description |
266
+ | ---------------------- | ------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
267
+ | `options.method` | `string` | Yes | The RPC method name to invoke |
268
+ | `options.params` | `unknown[] \| ((account: Address) => unknown[])` | Yes | Method parameters, or a function that receives the connected account and returns params |
269
+ | `options.chainIds` | `Hex[]` | No | Hex chain IDs to request permission for (defaults to `['0x1']`). The first entry becomes the active chain used for the method call. |
270
+ | `options.account` | `string` | No | Specific account to connect |
271
+ | `options.forceRequest` | `boolean` | No | Force a new connection request |
272
272
 
273
273
  **Returns**
274
274
 
@@ -334,7 +334,7 @@ ${invalidUrls.join("\n")}`
334
334
  // src/connect.ts
335
335
  var DEFAULT_CHAIN_ID = "0x1";
336
336
  var CHAIN_STORE_KEY = "cache_eth_chainId";
337
- var _core2, _provider, _sessionScopes, _eventHandlers, _sessionChangedHandler, _displayUriHandler, _removeNotificationHandler, _status, _MetamaskConnectEVM_instances, getCoreOptions_fn, createInvokeOptions_fn, trackWalletActionRequested_fn, trackWalletActionSucceeded_fn, trackWalletActionFailed_fn, getSelectedChainId_fn, requestInterceptor_fn, clearConnectionState_fn, addEthereumChain_fn, request_fn, cacheChainId_fn, onSessionChanged_fn, onChainChanged_fn, onAccountsChanged_fn, onConnect_fn, onDisconnect_fn, onDisplayUri_fn;
337
+ var _core2, _provider, _sessionScopes, _eventHandlers, _sessionChangedHandler, _displayUriHandler, _removeNotificationHandler, _status, _pendingPreferredChainId, _MetamaskConnectEVM_instances, getCoreOptions_fn, createInvokeOptions_fn, trackWalletActionRequested_fn, trackWalletActionSucceeded_fn, trackWalletActionFailed_fn, getSelectedChainId_fn, requestInterceptor_fn, clearConnectionState_fn, addEthereumChain_fn, request_fn, cacheChainId_fn, onSessionChanged_fn, onChainChanged_fn, onAccountsChanged_fn, onConnect_fn, onDisconnect_fn, onDisplayUri_fn;
338
338
  var _MetamaskConnectEVM = class _MetamaskConnectEVM {
339
339
  /**
340
340
  * Creates a new MetamaskConnectEVM instance.
@@ -362,6 +362,13 @@ var _MetamaskConnectEVM = class _MetamaskConnectEVM {
362
362
  __privateAdd(this, _removeNotificationHandler);
363
363
  /** The current connection status */
364
364
  __privateAdd(this, _status, "disconnected");
365
+ /**
366
+ * The preferred chain ID to use for the active connect() call.
367
+ * Set to the first explicit chainId passed by the caller, cleared once the
368
+ * connect event resolves. Takes priority over the cache in #getSelectedChainId
369
+ * so that an explicit chainIds request always wins over a prior cached value.
370
+ */
371
+ __privateAdd(this, _pendingPreferredChainId);
365
372
  __privateSet(this, _core2, core);
366
373
  __privateSet(this, _provider, new EIP1193Provider(
367
374
  core,
@@ -398,7 +405,7 @@ var _MetamaskConnectEVM = class _MetamaskConnectEVM {
398
405
  * @param options - The connection options
399
406
  * @param [options.account] - Optional param to specify an account to connect to
400
407
  * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session
401
- * @param [options.chainIds] - Array of chain IDs to connect to (defaults to ethereum mainnet if not provided)
408
+ * @param [options.chainIds] - Array of chain IDs to request permission for (defaults to ethereum mainnet). The first entry is used as the active chain returned by the call. Ethereum mainnet is always included in the permission request as a bootstrap fallback.
402
409
  * @returns A promise that resolves with the connected accounts and chain ID
403
410
  */
404
411
  connect() {
@@ -412,35 +419,40 @@ var _MetamaskConnectEVM = class _MetamaskConnectEVM {
412
419
  if (!chainIds || chainIds.length === 0) {
413
420
  throw new Error("chainIds must be an array of at least one chain ID");
414
421
  }
422
+ __privateSet(this, _pendingPreferredChainId, chainIds[0]);
415
423
  const caipChainIds = Array.from(
416
424
  new Set((_a = chainIds.concat(DEFAULT_CHAIN_ID)) != null ? _a : [DEFAULT_CHAIN_ID])
417
425
  ).map((id) => `eip155:${hexToNumber2(id)}`);
418
426
  const caipAccountIds = account ? caipChainIds.map((caipChainId) => `${caipChainId}:${account}`) : [];
419
427
  __privateSet(this, _status, "connecting");
420
428
  try {
421
- const result = new Promise((resolve) => {
422
- __privateGet(this, _provider).once("connect", ({ chainId, accounts }) => {
423
- logger("fulfilled-request: connect", {
424
- chainId,
425
- accounts
429
+ const result = new Promise(
430
+ (resolve) => {
431
+ __privateGet(this, _provider).once("connect", ({ chainId, accounts }) => {
432
+ logger("fulfilled-request: connect", {
433
+ chainId,
434
+ accounts
435
+ });
436
+ resolve({
437
+ accounts,
438
+ chainId
439
+ });
426
440
  });
427
- resolve({
428
- accounts,
429
- chainId
430
- });
431
- });
432
- });
441
+ }
442
+ );
433
443
  yield __privateGet(this, _core2).connect(
434
444
  caipChainIds,
435
445
  caipAccountIds,
436
446
  void 0,
437
447
  forceRequest
438
448
  );
439
- return result;
449
+ return yield result;
440
450
  } catch (error) {
441
451
  __privateSet(this, _status, "disconnected");
442
452
  logger("Error connecting to wallet", error);
443
453
  throw error;
454
+ } finally {
455
+ __privateSet(this, _pendingPreferredChainId, void 0);
444
456
  }
445
457
  });
446
458
  }
@@ -551,7 +563,6 @@ var _MetamaskConnectEVM = class _MetamaskConnectEVM {
551
563
  const method = "wallet_switchEthereumChain";
552
564
  const scope = `eip155:${hexToNumber2(chainId)}`;
553
565
  const params = [{ chainId }];
554
- yield __privateMethod(this, _MetamaskConnectEVM_instances, trackWalletActionRequested_fn).call(this, method, scope, params);
555
566
  if (this.selectedChainId === chainId) {
556
567
  return Promise.resolve();
557
568
  }
@@ -559,9 +570,9 @@ var _MetamaskConnectEVM = class _MetamaskConnectEVM {
559
570
  if (permittedChainIds.includes(chainId) && __privateGet(this, _core2).transportType === TransportType.MWP) {
560
571
  yield __privateMethod(this, _MetamaskConnectEVM_instances, cacheChainId_fn).call(this, chainId);
561
572
  __privateMethod(this, _MetamaskConnectEVM_instances, onChainChanged_fn).call(this, chainId);
562
- yield __privateMethod(this, _MetamaskConnectEVM_instances, trackWalletActionSucceeded_fn).call(this, method, scope, params);
563
573
  return Promise.resolve();
564
574
  }
575
+ yield __privateMethod(this, _MetamaskConnectEVM_instances, trackWalletActionRequested_fn).call(this, method, scope, params);
565
576
  try {
566
577
  const result = yield __privateMethod(this, _MetamaskConnectEVM_instances, request_fn).call(this, {
567
578
  method: "wallet_switchEthereumChain",
@@ -652,6 +663,7 @@ _sessionChangedHandler = new WeakMap();
652
663
  _displayUriHandler = new WeakMap();
653
664
  _removeNotificationHandler = new WeakMap();
654
665
  _status = new WeakMap();
666
+ _pendingPreferredChainId = new WeakMap();
655
667
  _MetamaskConnectEVM_instances = new WeakSet();
656
668
  /**
657
669
  * Gets the core options for analytics checks.
@@ -683,7 +695,8 @@ trackWalletActionRequested_fn = function(method, scope, params) {
683
695
  const props = yield getWalletActionAnalyticsProperties(
684
696
  coreOptions,
685
697
  __privateGet(this, _core2).storage,
686
- invokeOptions
698
+ invokeOptions,
699
+ __privateGet(this, _core2).transportType
687
700
  );
688
701
  analytics.track("mmconnect_wallet_action_requested", props);
689
702
  } catch (error) {
@@ -699,7 +712,8 @@ trackWalletActionSucceeded_fn = function(method, scope, params) {
699
712
  const props = yield getWalletActionAnalyticsProperties(
700
713
  coreOptions,
701
714
  __privateGet(this, _core2).storage,
702
- invokeOptions
715
+ invokeOptions,
716
+ __privateGet(this, _core2).transportType
703
717
  );
704
718
  analytics.track("mmconnect_wallet_action_succeeded", props);
705
719
  } catch (error) {
@@ -715,7 +729,8 @@ trackWalletActionFailed_fn = function(method, scope, params, error) {
715
729
  const props = yield getWalletActionAnalyticsProperties(
716
730
  coreOptions,
717
731
  __privateGet(this, _core2).storage,
718
- invokeOptions
732
+ invokeOptions,
733
+ __privateGet(this, _core2).transportType
719
734
  );
720
735
  const isRejection = isRejectionError(error);
721
736
  if (isRejection) {
@@ -730,6 +745,9 @@ trackWalletActionFailed_fn = function(method, scope, params, error) {
730
745
  };
731
746
  getSelectedChainId_fn = function(permittedChainIds) {
732
747
  return __async(this, null, function* () {
748
+ if (__privateGet(this, _pendingPreferredChainId) && permittedChainIds.includes(__privateGet(this, _pendingPreferredChainId))) {
749
+ return __privateGet(this, _pendingPreferredChainId);
750
+ }
733
751
  try {
734
752
  const cachedChainId = yield __privateGet(this, _core2).storage.adapter.get(CHAIN_STORE_KEY);
735
753
  if (cachedChainId) {
@@ -746,7 +764,6 @@ getSelectedChainId_fn = function(permittedChainIds) {
746
764
  };
747
765
  requestInterceptor_fn = function(request) {
748
766
  return __async(this, null, function* () {
749
- var _a;
750
767
  logger(`Intercepting request for method: ${request.method}`);
751
768
  if (IGNORED_METHODS.includes(request.method)) {
752
769
  return Promise.reject(
@@ -785,14 +802,6 @@ requestInterceptor_fn = function(request) {
785
802
  return __privateMethod(this, _MetamaskConnectEVM_instances, addEthereumChain_fn).call(this, request.params[0]);
786
803
  }
787
804
  if (isAccountsRequest(request)) {
788
- const { method } = request;
789
- const decimalChainId = hexToNumber2(
790
- (_a = __privateGet(this, _provider).selectedChainId) != null ? _a : "0x1"
791
- );
792
- const scope = `eip155:${decimalChainId}`;
793
- const params = [];
794
- yield __privateMethod(this, _MetamaskConnectEVM_instances, trackWalletActionRequested_fn).call(this, method, scope, params);
795
- yield __privateMethod(this, _MetamaskConnectEVM_instances, trackWalletActionSucceeded_fn).call(this, method, scope, params);
796
805
  return __privateGet(this, _provider).accounts;
797
806
  }
798
807
  if (isChainIdRequest(request)) {
@@ -994,7 +1003,7 @@ onDisplayUri_fn = function(uri) {
994
1003
  var MetamaskConnectEVM = _MetamaskConnectEVM;
995
1004
  function createEVMClient(options) {
996
1005
  return __async(this, null, function* () {
997
- var _a;
1006
+ var _a, _b, _c;
998
1007
  if (options.debug) {
999
1008
  enableDebug();
1000
1009
  }
@@ -1017,7 +1026,11 @@ function createEVMClient(options) {
1017
1026
  const core = yield createMultichainClient(__spreadProps(__spreadValues({}, options), {
1018
1027
  api: {
1019
1028
  supportedNetworks: supportedNetworksCaipChainId
1020
- }
1029
+ },
1030
+ analytics: {
1031
+ integrationType: (_c = (_b = options.analytics) == null ? void 0 : _b.integrationType) != null ? _c : "direct"
1032
+ },
1033
+ versions: { "connect-evm": "0.7.0" }
1021
1034
  }));
1022
1035
  return MetamaskConnectEVM.create({
1023
1036
  core,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/infura.ts","../../../src/connect.ts","../../../src/constants.ts","../../../src/logger.ts","../../../src/provider.ts","../../../src/utils/caip.ts","../../../src/utils/type-guards.ts"],"sourcesContent":["import type { RpcUrlsMap } from '@metamask/connect-multichain';\nimport { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from '@metamask/connect-multichain';\nimport type { CaipChainId, Hex } from '@metamask/utils';\nimport {\n KnownCaipNamespace,\n numberToHex,\n parseCaipChainId,\n} from '@metamask/utils';\n\nexport const getInfuraRpcUrls = (infuraAPIKey: string): RpcUrlsMap => {\n const caipMap = getInfuraRpcUrlsMultichain(infuraAPIKey);\n const hexMap = Object.entries(caipMap).reduce<Record<Hex, string>>(\n (acc, [key, url]) => {\n const { namespace, reference } = parseCaipChainId(key as CaipChainId);\n if (namespace !== KnownCaipNamespace.Eip155) {\n return acc;\n }\n const chainId = numberToHex(parseInt(reference, 10));\n acc[chainId] = url as string;\n return acc;\n },\n {},\n );\n return hexMap;\n};\n","/* eslint-disable no-restricted-syntax -- Private class properties use established patterns */\nimport { analytics } from '@metamask/analytics';\nimport { parseScopeString } from '@metamask/chain-agnostic-permission';\nimport type {\n ConnectionStatus,\n MultichainCore,\n MultichainOptions,\n Scope,\n SessionData,\n} from '@metamask/connect-multichain';\nimport {\n createMultichainClient,\n getWalletActionAnalyticsProperties,\n isRejectionError,\n TransportType,\n} from '@metamask/connect-multichain';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { IGNORED_METHODS } from './constants';\nimport { enableDebug, logger } from './logger';\nimport { EIP1193Provider } from './provider';\nimport type {\n AddEthereumChainParameter,\n Address,\n CaipAccountId,\n EventHandlers,\n Hex,\n MetamaskConnectEVMOptions,\n ProviderRequest,\n ProviderRequestInterceptor,\n} from './types';\nimport { getEthAccounts, getPermittedEthChainIds } from './utils/caip';\nimport {\n isAccountsRequest,\n isAddChainRequest,\n isChainIdRequest,\n isConnectRequest,\n isSwitchChainRequest,\n validSupportedChainsUrls,\n} from './utils/type-guards';\n\nconst DEFAULT_CHAIN_ID = '0x1';\nconst CHAIN_STORE_KEY = 'cache_eth_chainId';\n\n/** The options for the connect method */\ntype ConnectOptions = {\n /** The account to connect to */\n account?: string | undefined;\n /** Whether to force a request regardless of an existing session */\n forceRequest?: boolean;\n /** All available chain IDs in the dapp in hex format */\n chainIds?: Hex[];\n};\n\nexport type ConnectEvmStatus = 'disconnected' | 'connected' | 'connecting';\n\n/**\n * The MetamaskConnectEVM class provides an EIP-1193 compatible interface for connecting\n * to MetaMask and interacting with Ethereum Virtual Machine (EVM) networks.\n *\n * This class serves as a modern replacement for MetaMask SDK V1, offering enhanced\n * functionality and cross-platform compatibility. It wraps the Multichain SDK to provide\n * a simplified, EIP-1193 compliant API for dapp developers.\n *\n * Key features:\n * - EIP-1193 provider interface for seamless integration with existing dapp code\n * - Automatic session recovery when reloading or opening in new tabs\n * - Chain switching with automatic chain addition if not configured\n * - Event-driven architecture with support for connect, disconnect, accountsChanged, and chainChanged events\n * - Cross-platform support for browser extensions and mobile applications\n * - Built-in handling of common Ethereum methods (eth_accounts, wallet_switchEthereumChain, etc.)\n *\n * @example\n * ```typescript\n * const client = await createEVMClient({\n * dapp: { name: 'My DApp', url: 'https://mydapp.com' }\n * });\n *\n * const { accounts, chainId } = await client.connect({ chainIds: [1, 137] }); // Connect to Ethereum Mainnet, and Polygon\n *\n * const provider = client.getProvider();\n * const signedMessage = await provider.request({ method: 'personal_sign', params: ['0x0', accounts[0]] });\n * ```\n */\nexport class MetamaskConnectEVM {\n /** The core instance of the Multichain SDK */\n readonly #core: MultichainCore;\n\n /** An instance of the EIP-1193 provider interface */\n readonly #provider: EIP1193Provider;\n\n /** The session scopes currently permitted */\n #sessionScopes: SessionData['sessionScopes'] = {};\n\n /** Optional event handlers for the EIP-1193 provider events. */\n readonly #eventHandlers?: Partial<EventHandlers> | undefined;\n\n /** The handler for the wallet_sessionChanged event */\n readonly #sessionChangedHandler: (session?: SessionData) => void;\n\n /** The handler for the display_uri event */\n readonly #displayUriHandler: (uri: string) => void;\n\n /** The clean-up function for the notification handler */\n #removeNotificationHandler?: () => void;\n\n /** The current connection status */\n #status: ConnectEvmStatus = 'disconnected';\n\n /**\n * Creates a new MetamaskConnectEVM instance.\n * Use the static `create()` method instead to ensure proper async initialization.\n *\n * @param options - The options for the MetamaskConnectEVM instance\n * @param options.core - The core instance of the Multichain SDK\n * @param options.eventHandlers - Optional event handlers for EIP-1193 provider events\n */\n private constructor({ core, eventHandlers }: MetamaskConnectEVMOptions) {\n this.#core = core;\n\n this.#provider = new EIP1193Provider(\n core,\n this.#requestInterceptor.bind(this),\n );\n\n this.#eventHandlers = eventHandlers;\n\n /**\n * Handles the wallet_sessionChanged event.\n * Updates the internal connection state with the new session data.\n *\n * @param session - The session data\n */\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.#sessionChangedHandler = this.#onSessionChanged.bind(this);\n this.#core.on('wallet_sessionChanged', this.#sessionChangedHandler);\n\n /**\n * Handles the display_uri event.\n * Forwards the QR code URI to the provider for custom UI implementations.\n */\n this.#displayUriHandler = this.#onDisplayUri.bind(this);\n this.#core.on('display_uri', this.#displayUriHandler);\n\n logger('Connect/EVM constructor completed');\n }\n\n /**\n * Creates a fully initialized MetamaskConnectEVM instance.\n * This is the recommended way to instantiate the class, as it ensures\n * all async initialization (like session recovery) completes before\n * the instance is returned.\n *\n * @param options - The options for the MetamaskConnectEVM instance\n * @param options.core - The core instance of the Multichain SDK\n * @param options.eventHandlers - Optional event handlers for EIP-1193 provider events\n * @returns A promise that resolves with a fully initialized MetamaskConnectEVM instance\n */\n static async create(\n options: MetamaskConnectEVMOptions,\n ): Promise<MetamaskConnectEVM> {\n const instance = new MetamaskConnectEVM(options);\n await instance.#core.emitSessionChanged();\n return instance;\n }\n\n /**\n * Gets the core options for analytics checks.\n *\n * @returns The multichain options from the core instance\n */\n #getCoreOptions(): MultichainOptions {\n return (this.#core as any).options as MultichainOptions;\n }\n\n /**\n * Creates invoke options for analytics tracking.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n * @returns Invoke options object for analytics\n */\n #createInvokeOptions(\n method: string,\n scope: Scope,\n params: unknown[],\n ): {\n scope: Scope;\n request: { method: string; params: unknown[] };\n } {\n return {\n scope,\n request: { method, params },\n };\n }\n\n /**\n * Tracks a wallet action requested event.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n */\n async #trackWalletActionRequested(\n method: string,\n scope: Scope,\n params: unknown[],\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n );\n analytics.track('mmconnect_wallet_action_requested', props);\n } catch (error) {\n logger('Error tracking mmconnect_wallet_action_requested event', error);\n }\n }\n\n /**\n * Tracks a wallet action succeeded event.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n */\n async #trackWalletActionSucceeded(\n method: string,\n scope: Scope,\n params: unknown[],\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n );\n analytics.track('mmconnect_wallet_action_succeeded', props);\n } catch (error) {\n logger('Error tracking mmconnect_wallet_action_succeeded event', error);\n }\n }\n\n /**\n * Tracks a wallet action failed or rejected event based on the error.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n * @param error - The error that occurred\n */\n async #trackWalletActionFailed(\n method: string,\n scope: Scope,\n params: unknown[],\n error: unknown,\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n );\n const isRejection = isRejectionError(error);\n if (isRejection) {\n analytics.track('mmconnect_wallet_action_rejected', props);\n } else {\n analytics.track('mmconnect_wallet_action_failed', props);\n }\n } catch {\n logger('Error tracking wallet action rejected or failed event', error);\n }\n }\n\n /**\n * Gets the currently selected chainId from cache, or falls back to the first permitted chain.\n *\n * @param permittedChainIds - Array of permitted chain IDs in hex format\n * @returns The selected chainId (hex string)\n */\n async #getSelectedChainId(permittedChainIds: Hex[]): Promise<Hex> {\n try {\n const cachedChainId =\n await this.#core.storage.adapter.get(CHAIN_STORE_KEY);\n if (cachedChainId) {\n const chainId: Hex = JSON.parse(cachedChainId);\n\n // Validate that the cached chainId is in the permitted chains list\n if (permittedChainIds.includes(chainId)) {\n return chainId;\n }\n }\n } catch (error) {\n logger('Error retrieving cached chainId', error);\n }\n\n // Fallback to the first permitted chain if cache retrieval failed or returned an invalid chain\n return permittedChainIds[0];\n }\n\n /**\n * Connects to the wallet with the specified chain ID and optional account.\n *\n * @param options - The connection options\n * @param [options.account] - Optional param to specify an account to connect to\n * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session\n * @param [options.chainIds] - Array of chain IDs to connect to (defaults to ethereum mainnet if not provided)\n * @returns A promise that resolves with the connected accounts and chain ID\n */\n async connect({\n account,\n forceRequest,\n chainIds = [DEFAULT_CHAIN_ID],\n }: ConnectOptions = {}): Promise<{ accounts: Address[]; chainId: Hex }> {\n logger('request: connect', { account });\n\n if (!chainIds || chainIds.length === 0) {\n throw new Error('chainIds must be an array of at least one chain ID');\n }\n\n const caipChainIds = Array.from(\n new Set(chainIds.concat(DEFAULT_CHAIN_ID) ?? [DEFAULT_CHAIN_ID]),\n ).map((id) => `eip155:${hexToNumber(id)}`);\n\n const caipAccountIds = account\n ? caipChainIds.map((caipChainId) => `${caipChainId}:${account}`)\n : [];\n\n this.#status = 'connecting';\n\n try {\n // Wait for the wallet_sessionChanged event to fire and set the provider properties\n const result = new Promise((resolve) => {\n this.#provider.once('connect', ({ chainId, accounts }) => {\n logger('fulfilled-request: connect', {\n chainId,\n accounts,\n });\n resolve({\n accounts,\n chainId: chainId as Hex,\n });\n });\n });\n\n await this.#core.connect(\n caipChainIds as Scope[],\n caipAccountIds as CaipAccountId[],\n undefined,\n forceRequest,\n );\n\n return result as Promise<{ accounts: Address[]; chainId: Hex }>;\n } catch (error) {\n this.#status = 'disconnected';\n logger('Error connecting to wallet', error);\n throw error;\n }\n }\n\n /**\n * Connects to the wallet and signs a message using personal_sign.\n *\n * @param options - The connection options\n * @param options.message - The message to sign after connecting\n * @param [options.chainIds] - Optional hex chain IDs to connect to (defaults to ethereum mainnet if not provided)\n * @returns A promise that resolves with the signature\n * @throws Error if the selected account is not available after timeout\n */\n async connectAndSign({\n message,\n chainIds,\n }: {\n message: string;\n chainIds?: Hex[];\n }): Promise<string> {\n const { accounts, chainId } = await this.connect({\n chainIds: chainIds ?? [DEFAULT_CHAIN_ID],\n });\n\n const result = (await this.#provider.request({\n method: 'personal_sign',\n params: [accounts[0], message],\n })) as string;\n\n this.#eventHandlers?.connectAndSign?.({\n accounts,\n chainId,\n signResponse: result,\n });\n\n return result;\n }\n\n /**\n * Connects to the wallet and invokes a method with specified parameters.\n *\n * @param options - The options for connecting and invoking the method\n * @param options.method - The method name to invoke\n * @param options.params - The parameters to pass to the method, or a function that receives the account and returns params\n * @param [options.chainIds] - Optional hex chain IDs to connect to (defaults to ethereum mainnet if not provided)\n * @param [options.account] - Optional specific account to connect to\n * @param [options.forceRequest] - Whether to force a request regardless of an existing session\n * @returns A promise that resolves with the result of the method invocation\n * @throws Error if the selected account is not available after timeout (for methods that require an account)\n */\n async connectWith({\n method,\n params,\n chainIds,\n account,\n forceRequest,\n }: {\n method: string;\n params: unknown[] | ((account: Address) => unknown[]);\n chainIds?: Hex[];\n account?: string | undefined;\n forceRequest?: boolean;\n }): Promise<unknown> {\n const { accounts: connectedAccounts, chainId: connectedChainId } =\n await this.connect({\n chainIds: chainIds ?? [DEFAULT_CHAIN_ID],\n account,\n forceRequest,\n });\n\n const resolvedParams =\n typeof params === 'function' ? params(connectedAccounts[0]) : params;\n\n const result = await this.#provider.request({\n method,\n params: resolvedParams,\n });\n\n this.#eventHandlers?.connectWith?.({\n accounts: connectedAccounts,\n chainId: connectedChainId,\n connectWithResponse: result,\n });\n\n return result;\n }\n\n /**\n * Disconnects from the wallet by revoking the session and cleaning up event listeners.\n *\n * @returns A promise that resolves when disconnection is complete\n */\n async disconnect(): Promise<void> {\n logger('request: disconnect');\n\n const sessionScopes = this.#sessionScopes;\n const eip155Scopes = Object.keys(sessionScopes).filter((scope) => {\n const { namespace } = parseScopeString(scope as Scope);\n return namespace === 'eip155';\n });\n\n await this.#core.disconnect(eip155Scopes as Scope[]);\n this.#onDisconnect();\n this.#clearConnectionState();\n\n // Note: We intentionally do NOT remove the display_uri and wallet_sessionChanged\n // listeners here. These are instance-scoped listeners that should remain active\n // for the lifetime of the SDK instance, allowing reconnection to work properly.\n // Session-scoped listeners (like the notification handler below) are removed.\n\n this.#removeNotificationHandler?.();\n this.#removeNotificationHandler = undefined;\n\n logger('fulfilled-request: disconnect');\n }\n\n /**\n * Switches the Ethereum chain. Will track state internally whenever possible.\n *\n * @param options - The options for the switch chain request\n * @param options.chainId - The chain ID to switch to\n * @param [options.chainConfiguration] - The chain configuration to use in case the chain is not present by the wallet\n * @returns A promise that resolves when the chain has been switched\n */\n async switchChain({\n chainId,\n chainConfiguration,\n }: {\n chainId: Hex;\n chainConfiguration?: AddEthereumChainParameter;\n }): Promise<void> {\n const method = 'wallet_switchEthereumChain';\n const scope: Scope = `eip155:${hexToNumber(chainId)}`;\n const params = [{ chainId }];\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n // TODO (wenfix): better way to return here other than resolving.\n if (this.selectedChainId === chainId) {\n return Promise.resolve();\n }\n\n const permittedChainIds = getPermittedEthChainIds(this.#sessionScopes);\n\n if (\n permittedChainIds.includes(chainId) &&\n this.#core.transportType === TransportType.MWP\n ) {\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n await this.#trackWalletActionSucceeded(method, scope, params);\n return Promise.resolve();\n }\n\n try {\n const result = await this.#request({\n method: 'wallet_switchEthereumChain',\n params,\n });\n\n // When using the MWP transport, the error is returned instead of thrown,\n // so we force it into the catch block here.\n const resultWithError = result as { error?: { message: string } };\n if (resultWithError?.error) {\n throw new Error(resultWithError.error.message);\n }\n\n await this.#trackWalletActionSucceeded(method, scope, params);\n if ((result as { result: unknown }).result === null) {\n // result is successful we eagerly call onChainChanged to update the provider's selected chain ID.\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n }\n return Promise.resolve();\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n // Fallback to add the chain if its not configured in the wallet.\n if ((error as Error).message.includes('Unrecognized chain ID')) {\n return this.#addEthereumChain(chainConfiguration);\n }\n throw error;\n }\n }\n\n /**\n * Handles several EIP-1193 requests that require special handling\n * due the nature of the Multichain SDK.\n *\n * @param request - The request object containing the method and params\n * @returns The result of the request or undefined if the request is ignored\n */\n async #requestInterceptor(\n request: ProviderRequest,\n ): ReturnType<ProviderRequestInterceptor> {\n logger(`Intercepting request for method: ${request.method}`);\n\n if (IGNORED_METHODS.includes(request.method)) {\n // TODO: replace with correct method unsupported provider error\n return Promise.reject(\n new Error(\n `Method: ${request.method} is not supported by Metamask Connect/EVM`,\n ),\n );\n }\n\n if (request.method === 'wallet_revokePermissions') {\n return this.disconnect();\n }\n\n if (isConnectRequest(request)) {\n // When calling wallet_requestPermissions, we need to force a new session request to prompt\n // the user for accounts, because internally the Multichain SDK will check if\n // the user is already connected and skip the request if so, unless we\n // explicitly request a specific account. This is needed to workaround\n // wallet_requestPermissions not requesting specific accounts.\n const shouldForceConnectionRequest =\n request.method === 'wallet_requestPermissions';\n\n const { method, params } = request;\n const initiallySelectedChainId = DEFAULT_CHAIN_ID;\n const scope: Scope = `eip155:${initiallySelectedChainId}`;\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n try {\n const result = await this.connect({\n chainIds: [initiallySelectedChainId],\n forceRequest: shouldForceConnectionRequest,\n });\n await this.#trackWalletActionSucceeded(method, scope, params);\n return result;\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n throw error;\n }\n }\n\n if (isSwitchChainRequest(request)) {\n return this.switchChain({\n chainId: request.params[0].chainId as Hex,\n });\n }\n\n if (isAddChainRequest(request)) {\n return this.#addEthereumChain(request.params[0]);\n }\n\n if (isAccountsRequest(request)) {\n const { method } = request;\n const decimalChainId = hexToNumber(\n this.#provider.selectedChainId ?? '0x1',\n );\n const scope: Scope = `eip155:${decimalChainId}`;\n const params: unknown[] = [];\n\n await this.#trackWalletActionRequested(method, scope, params);\n await this.#trackWalletActionSucceeded(method, scope, params);\n\n return this.#provider.accounts;\n }\n\n if (isChainIdRequest(request)) {\n return this.#provider.selectedChainId;\n }\n\n logger('Request not intercepted, forwarding to default handler', request);\n return Promise.resolve();\n }\n\n /**\n * Clears the internal connection state: accounts and chainId\n */\n #clearConnectionState(): void {\n this.#provider.accounts = [];\n this.#provider.selectedChainId = undefined;\n }\n\n /**\n * Adds an Ethereum chain using the latest chain configuration received from\n * a switchEthereumChain request\n *\n * @param chainConfiguration - The chain configuration to use in case the chain is not present by the wallet\n * @returns Nothing\n */\n async #addEthereumChain(\n chainConfiguration?: AddEthereumChainParameter,\n ): Promise<void> {\n logger('addEthereumChain called', { chainConfiguration });\n const method = 'wallet_addEthereumChain';\n\n if (!chainConfiguration) {\n throw new Error('No chain configuration found.');\n }\n\n // Get chain ID from config or use current chain\n const chainId =\n (chainConfiguration.chainId as Hex) ||\n this.#provider.selectedChainId ||\n '0x1';\n const decimalChainId = hexToNumber(chainId);\n const scope: Scope = `eip155:${decimalChainId}`;\n const params = [chainConfiguration];\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n try {\n const result = await this.#request({\n method: 'wallet_addEthereumChain',\n params,\n });\n\n if ((result as { result: unknown }).result === null) {\n // if result is successful we eagerly call onChainChanged to update the provider's selected chain ID.\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n }\n await this.#trackWalletActionSucceeded(method, scope, params);\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n throw error;\n }\n }\n\n /**\n * Submits a request to the EIP-1193 provider\n *\n * @param request - The request object containing the method and params\n * @param request.method - The method to request\n * @param request.params - The parameters to pass to the method\n * @returns The result of the request\n */\n async #request(request: {\n method: string;\n params: unknown[];\n }): Promise<unknown> {\n logger('direct request to metamask-provider called', request);\n const result = this.#core.transport.sendEip1193Message(request);\n if (\n request.method === 'wallet_addEthereumChain' ||\n request.method === 'wallet_switchEthereumChain'\n ) {\n this.#core.openSimpleDeeplinkIfNeeded();\n }\n return result;\n }\n\n /**\n * Caches the chainId to storage for persistence across page refreshes.\n *\n * @param chainId - The hex chain ID\n */\n async #cacheChainId(chainId: Hex): Promise<void> {\n try {\n await this.#core.storage.adapter.set(\n CHAIN_STORE_KEY,\n JSON.stringify(chainId),\n );\n } catch (error) {\n logger('Error caching chainId', error);\n }\n }\n\n async #onSessionChanged(session?: SessionData): Promise<void> {\n logger('event: wallet_sessionChanged', session);\n this.#sessionScopes = session?.sessionScopes ?? {};\n const hexPermittedChainIds = getPermittedEthChainIds(this.#sessionScopes);\n if (hexPermittedChainIds.length === 0) {\n this.#onDisconnect();\n } else {\n let initialAccounts: Address[] = [];\n if (this.#core.status === 'connected') {\n const ethAccountsResponse =\n await this.#core.transport.sendEip1193Message({\n method: 'eth_accounts',\n params: [],\n });\n initialAccounts = ethAccountsResponse.result as Address[];\n } else {\n initialAccounts = getEthAccounts(this.#sessionScopes);\n }\n\n const chainId = await this.#getSelectedChainId(hexPermittedChainIds);\n\n this.#onConnect({\n chainId,\n accounts: initialAccounts,\n });\n }\n }\n\n /**\n * Handles chain change events and updates the provider's selected chain ID.\n *\n * @param chainId - The new hex chain ID\n */\n #onChainChanged(chainId: Hex): void {\n if (chainId === this.#provider.selectedChainId) {\n return;\n }\n logger('handler: chainChanged', { chainId });\n this.#provider.selectedChainId = chainId;\n this.#eventHandlers?.chainChanged?.(chainId);\n this.#provider.emit('chainChanged', chainId);\n }\n\n /**\n * Handles accounts change events and updates the provider's accounts list.\n *\n * @param accounts - The new list of permitted accounts\n */\n #onAccountsChanged(accounts: Address[]): void {\n const accountsUnchanged =\n accounts.length === this.#provider.accounts.length &&\n accounts.every((acct, idx) => acct === this.#provider.accounts[idx]);\n if (accountsUnchanged) {\n return;\n }\n logger('handler: accountsChanged', accounts);\n this.#provider.accounts = accounts;\n this.#provider.emit('accountsChanged', accounts);\n this.#eventHandlers?.accountsChanged?.(accounts);\n }\n\n /**\n * Handles connection events and emits the connect event to listeners.\n *\n * @param options - The connection options\n * @param options.chainId - The hex chain ID of the connection\n * @param options.accounts - The accounts of the connection\n */\n #onConnect({\n chainId,\n accounts,\n }: {\n chainId: Hex;\n accounts: Address[];\n }): void {\n logger('handler: connect', { chainId, accounts });\n const data = {\n chainId,\n accounts,\n };\n\n if (this.#status !== 'connected') {\n this.#status = 'connected';\n this.#provider.emit('connect', data);\n this.#eventHandlers?.connect?.(data);\n\n this.#removeNotificationHandler?.();\n\n // TODO: Verify if #core.on('metamask_accountsChanged') and #core.on('metamask_chainChanged')\n // would work here instead\n this.#removeNotificationHandler = this.#core.transport.onNotification(\n (notification) => {\n // @ts-expect-error TODO: address this\n if (notification?.method === 'metamask_accountsChanged') {\n // @ts-expect-error TODO: address this\n const notificationAccounts = notification?.params;\n logger('transport-event: accountsChanged', notificationAccounts);\n // why are we not caching the accounts here?\n this.#onAccountsChanged(notificationAccounts);\n }\n\n // @ts-expect-error TODO: address this\n if (notification?.method === 'metamask_chainChanged') {\n // @ts-expect-error TODO: address this\n const notificationChainId = notification?.params?.chainId;\n logger('transport-event: chainChanged', notificationChainId);\n // Cache the chainId for persistence across page refreshes\n this.#cacheChainId(notificationChainId).catch((error) => {\n logger('Error caching chainId in notification handler', error);\n });\n this.#onChainChanged(notificationChainId);\n }\n },\n );\n }\n\n this.#onChainChanged(chainId);\n this.#onAccountsChanged(accounts);\n }\n\n /**\n * Handles disconnection events and emits the disconnect event to listeners.\n * Also clears accounts by triggering an accountsChanged event with an empty array.\n */\n #onDisconnect(): void {\n if (this.#status === 'disconnected') {\n return;\n }\n this.#status = 'disconnected';\n\n logger('handler: disconnect');\n this.#provider.emit('disconnect');\n this.#eventHandlers?.disconnect?.();\n\n this.#onAccountsChanged([]);\n }\n\n /**\n * Handles display_uri events and emits them to the provider.\n * This allows consumers to display their own custom QR code UI.\n *\n * @param uri - The deeplink URI to be displayed as a QR code\n */\n #onDisplayUri(uri: string): void {\n if (this.#status !== 'connecting') {\n return;\n }\n\n logger('handler: display_uri', uri);\n this.#provider.emit('display_uri', uri);\n this.#eventHandlers?.displayUri?.(uri);\n }\n\n /**\n * Gets the EIP-1193 provider instance\n *\n * @returns The EIP-1193 provider instance\n */\n getProvider(): EIP1193Provider {\n return this.#provider;\n }\n\n /**\n * Gets the currently selected chain ID on the wallet\n *\n * @returns The currently selected chain ID or undefined if no chain is selected\n */\n getChainId(): Hex | undefined {\n return this.selectedChainId;\n }\n\n /**\n * Gets the currently selected account on the wallet\n *\n * @returns The currently selected account or undefined if no account is selected\n */\n getAccount(): Address | undefined {\n return this.#provider.selectedAccount;\n }\n\n // Convenience getters for the EIP-1193 provider\n /**\n * Gets the currently permitted accounts\n *\n * @returns The currently permitted accounts\n */\n get accounts(): Address[] {\n return this.#provider.accounts;\n }\n\n /**\n * Gets the currently selected account on the wallet\n *\n * @returns The currently selected account or undefined if no account is selected\n */\n get selectedAccount(): Address | undefined {\n return this.#provider.selectedAccount;\n }\n\n /**\n * Gets the currently selected chain ID on the wallet\n *\n * @returns The currently selected chain ID or undefined if no chain is selected\n */\n get selectedChainId(): Hex | undefined {\n return this.#provider.selectedChainId;\n }\n\n /**\n * Gets the current connection status\n *\n * @returns The current connection status\n */\n get status(): ConnectionStatus {\n return this.#core.status;\n }\n}\n\n/**\n * Creates a new Metamask Connect/EVM instance\n *\n * @param options - The options for the Metamask Connect/EVM layer\n * @param options.dapp - Dapp identification and branding settings\n * @param options.api - API configuration including read-only RPC map\n * @param options.api.supportedNetworks - A map of hex chain IDs to RPC URLs for read-only requests\n * @param [options.ui] - UI configuration options\n * @param [options.ui.headless] - Whether to run without UI\n * @param [options.ui.preferExtension] - Whether to prefer browser extension\n * @param [options.ui.showInstallModal] - Whether to render installation modal for desktop extension\n * @param [options.mobile] - Mobile configuration options\n * @param [options.mobile.preferredOpenLink] - Custom handler for opening deeplinks (useful for React Native, etc.)\n * @param [options.mobile.useDeeplink] - Whether to use native deeplinks instead of universal links\n * @param [options.transport] - Transport configuration (e.g., extensionId, notification handler)\n * @param [options.transport.extensionId] - Extension ID for browser extension transport\n * @param [options.transport.onNotification] - Callback for receiving transport notifications\n * @param [options.eventHandlers] - Event handlers for the Metamask Connect/EVM layer\n * @param [options.debug] - Enable debug logging\n * @returns The Metamask-Connect EVM client instance\n */\nexport async function createEVMClient(\n options: Pick<MultichainOptions, 'dapp' | 'mobile' | 'transport'> & {\n ui?: Omit<MultichainOptions['ui'], 'factory'>;\n } & {\n eventHandlers?: Partial<EventHandlers>;\n debug?: boolean;\n api: {\n supportedNetworks: Record<Hex, string>;\n };\n },\n): Promise<MetamaskConnectEVM> {\n if (options.debug) {\n enableDebug();\n }\n\n logger('Creating Metamask Connect/EVM with options:', options);\n\n // Validate that supportedNetworks is provided and not empty\n if (\n !options.api?.supportedNetworks ||\n Object.keys(options.api.supportedNetworks).length === 0\n ) {\n throw new Error(\n 'supportedNetworks is required and must contain at least one chain configuration',\n );\n }\n\n validSupportedChainsUrls(options.api.supportedNetworks, 'supportedNetworks');\n\n const supportedNetworksCaipChainId = Object.entries(\n options.api.supportedNetworks,\n ).reduce<Record<string, string>>((acc, [hexChainId, url]) => {\n const decimalChainId = parseInt(hexChainId, 16);\n const caip2ChainId = `eip155:${decimalChainId}`;\n acc[caip2ChainId] = url;\n return acc;\n }, {});\n\n try {\n const core = await createMultichainClient({\n ...options,\n api: {\n supportedNetworks: supportedNetworksCaipChainId,\n },\n });\n\n return MetamaskConnectEVM.create({\n core,\n eventHandlers: options.eventHandlers,\n supportedNetworks: options.api.supportedNetworks,\n });\n } catch (error) {\n console.error('Error creating Metamask Connect/EVM', error);\n throw error;\n }\n}\n","export const IGNORED_METHODS = [\n 'metamask_getProviderState',\n 'metamask_sendDomainMetadata',\n 'metamask_logWeb3ShimUsage',\n 'wallet_registerOnboarding',\n 'net_version',\n 'wallet_getPermissions',\n];\n\nexport const CONNECT_METHODS = [\n 'wallet_requestPermissions',\n 'eth_requestAccounts',\n];\n\nexport const ACCOUNTS_METHODS = ['eth_accounts', 'eth_coinbase'];\n\nexport const CHAIN_METHODS = ['eth_chainId'];\n\nexport const INTERCEPTABLE_METHODS = [\n ...ACCOUNTS_METHODS,\n ...IGNORED_METHODS,\n ...CONNECT_METHODS,\n ...CHAIN_METHODS,\n // These have bespoke handlers\n 'wallet_revokePermissions',\n 'wallet_switchEthereumChain',\n 'wallet_addEthereumChain',\n];\n","import {\n createLogger,\n enableDebug as debug,\n} from '@metamask/connect-multichain';\n\nconst namespace = 'metamask-connect:evm';\n\n// @ts-expect-error logger needs to be typed properly\nexport const logger = createLogger(namespace, '63');\n\nexport const enableDebug = (): void => {\n // @ts-expect-error logger needs to be typed properly\n debug(namespace);\n};\n","/* eslint-disable promise/always-return -- Legacy callback patterns */\n/* eslint-disable promise/no-callback-in-promise -- Legacy sendAsync/send API */\n/* eslint-disable consistent-return -- Legacy method returns void or Promise */\n/* eslint-disable @typescript-eslint/no-floating-promises -- Legacy fire-and-forget pattern */\n/* eslint-disable jsdoc/require-returns -- Inherited from abstract class */\nimport type { MultichainCore, Scope } from '@metamask/connect-multichain';\nimport { EventEmitter } from '@metamask/connect-multichain';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { INTERCEPTABLE_METHODS } from './constants';\nimport { logger } from './logger';\nimport type {\n Address,\n EIP1193ProviderEvents,\n Hex,\n JsonRpcCallback,\n JsonRpcRequest,\n JsonRpcResponse,\n ProviderRequest,\n ProviderRequestInterceptor,\n} from './types';\n\n/**\n * EIP-1193 Provider wrapper around the Multichain SDK.\n */\nexport class EIP1193Provider extends EventEmitter<EIP1193ProviderEvents> {\n /** The core instance of the Multichain SDK */\n readonly #core: MultichainCore;\n\n /** Interceptor function to handle specific methods */\n readonly #requestInterceptor: ProviderRequestInterceptor;\n\n /** The currently permitted accounts */\n #accounts: Address[] = [];\n\n /** The currently selected chain ID on the wallet */\n #selectedChainId?: Hex | undefined;\n\n constructor(core: MultichainCore, interceptor: ProviderRequestInterceptor) {\n super();\n this.#core = core;\n this.#requestInterceptor = interceptor;\n\n // Bind all public methods to ensure `this` context is preserved\n // when methods are extracted or passed as callbacks.\n // This eliminates the need for Proxy wrappers in consumers.\n this.request = this.request.bind(this);\n this.sendAsync = this.sendAsync.bind(this);\n this.send = this.send.bind(this);\n\n // Bind inherited EventEmitter methods\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n this.emit = this.emit.bind(this);\n this.once = this.once.bind(this);\n this.removeListener = this.removeListener.bind(this);\n this.listenerCount = this.listenerCount.bind(this);\n }\n\n /**\n * Performs a EIP-1193 request.\n *\n * @param request - The request object containing the method and params\n * @returns The result of the request\n */\n async request(request: ProviderRequest): Promise<unknown> {\n logger(\n `request: ${request.method} - chainId: ${this.selectedChainId}`,\n request.params,\n );\n /* Some methods require special handling, so we intercept them here\n * and handle them in MetamaskConnectEVM.requestInterceptor method. */\n if (INTERCEPTABLE_METHODS.includes(request.method)) {\n return this.#requestInterceptor?.(request);\n }\n\n if (!this.#selectedChainId) {\n // TODO: replace with a better error\n throw new Error('No chain ID selected');\n }\n\n const decimalChainId = hexToNumber(this.#selectedChainId);\n const scope: Scope = `eip155:${decimalChainId}`;\n\n // Validate that the chain is configured in supportedNetworks\n // This check is performed here to provide better error messages\n // The RpcClient will also validate, but this gives us a chance to provide\n // a clearer error message before the request is routed\n const coreOptions = (this.#core as any).options; // TODO: options is `protected readonly` property, this needs to be refactored so `any` type assertion is not necessary\n const supportedNetworks = coreOptions?.api?.supportedNetworks ?? {};\n if (!supportedNetworks[scope]) {\n throw new Error(\n `Chain ${scope} is not configured in supportedNetworks. Requests cannot be made to chains not explicitly configured in supportedNetworks.`,\n );\n }\n\n return this.#core.invokeMethod({\n scope,\n request: {\n method: request.method,\n params: request.params,\n },\n });\n }\n\n // Getters and setters\n public get selectedAccount(): Address | undefined {\n return this.accounts[0];\n }\n\n public set accounts(accounts: Address[]) {\n this.#accounts = accounts;\n }\n\n public get accounts(): Address[] {\n return this.#accounts;\n }\n\n public get selectedChainId(): Hex | undefined {\n return this.#selectedChainId;\n }\n\n public set selectedChainId(chainId: Hex | undefined) {\n this.#selectedChainId = chainId;\n }\n\n // ==========================================\n // Legacy compatibility methods\n // ==========================================\n\n /**\n * Alias for selectedChainId for legacy compatibility.\n * Many dApps expect a `chainId` property on the provider.\n */\n public get chainId(): Hex | undefined {\n return this.selectedChainId;\n }\n\n /**\n * Legacy method for sending JSON-RPC requests.\n *\n * @deprecated Use `request` instead. This method is provided for backwards compatibility.\n * @param request - The JSON-RPC request object\n * @param callback - Optional callback function. If provided, the method returns void.\n * @returns A promise resolving to the JSON-RPC response, or void if a callback is provided.\n */\n async sendAsync<TParams = unknown, TResult = unknown>(\n request: JsonRpcRequest<TParams>,\n callback?: JsonRpcCallback<TResult>,\n ): Promise<JsonRpcResponse<TResult> | void> {\n const id = request.id ?? 1;\n\n const promise = this.request({\n method: request.method,\n params: request.params as unknown,\n })\n .then(\n (result): JsonRpcResponse<TResult> => ({\n id,\n jsonrpc: '2.0',\n result: result as TResult,\n }),\n )\n .catch(\n (error): JsonRpcResponse<TResult> => ({\n id,\n jsonrpc: '2.0',\n error: {\n code: error.code ?? -32603,\n message: error.message ?? 'Internal error',\n data: error.data,\n },\n }),\n );\n\n if (callback) {\n promise\n .then((response) => {\n if (response.error) {\n callback(new Error(response.error.message), response);\n } else {\n callback(null, response);\n }\n })\n .catch((error) => {\n callback(error, null);\n });\n return;\n }\n\n return promise;\n }\n\n /**\n * Legacy method for sending JSON-RPC requests synchronously (callback-based).\n *\n * @deprecated Use `request` instead. This method is provided for backwards compatibility.\n * @param request - The JSON-RPC request object\n * @param callback - The callback function to receive the response\n */\n send<TParams = unknown, TResult = unknown>(\n request: JsonRpcRequest<TParams>,\n callback: JsonRpcCallback<TResult>,\n ): void {\n this.sendAsync(request, callback);\n }\n}\n","import type { InternalScopesObject } from '@metamask/chain-agnostic-permission';\nimport {\n getPermittedEthChainIds as _getPermittedEthChainIds,\n getEthAccounts as _getEthAccounts,\n} from '@metamask/chain-agnostic-permission';\nimport type { SessionData } from '@metamask/connect-multichain';\n\nimport type { Address, Hex } from '../types';\n\n/**\n * Get the Ethereum accounts from the session data\n *\n * @param sessionScopes - The session scopes\n * @returns The Ethereum accounts\n */\nexport const getEthAccounts = (\n sessionScopes: SessionData['sessionScopes'] | undefined,\n): Address[] => {\n if (!sessionScopes) {\n return [];\n }\n\n return _getEthAccounts({\n requiredScopes: sessionScopes as InternalScopesObject,\n optionalScopes: sessionScopes as InternalScopesObject,\n });\n};\n\n/**\n * Get the permitted Ethereum chain IDs from the session scopes.\n * Wrapper around getPermittedEthChainIds from @metamask/chain-agnostic-permission\n *\n * @param sessionScopes - The session scopes\n * @returns The permitted Ethereum chain IDs\n */\nexport const getPermittedEthChainIds = (\n sessionScopes: SessionData['sessionScopes'] | undefined,\n): Hex[] => {\n if (!sessionScopes) {\n return [];\n }\n\n return _getPermittedEthChainIds({\n requiredScopes: sessionScopes as InternalScopesObject,\n optionalScopes: sessionScopes as InternalScopesObject,\n });\n};\n","import type { ProviderRequest } from '../types';\n\n/**\n * Type guard for connect-like requests:\n * - wallet_requestPermissions\n * - eth_requestAccounts\n *\n * @param req - The request object to check\n * @returns True if the request is a connect-like request, false otherwise\n */\nexport function isConnectRequest(req: ProviderRequest): req is Extract<\n ProviderRequest,\n {\n method: 'wallet_requestPermissions' | 'eth_requestAccounts';\n }\n> {\n return (\n req.method === 'wallet_requestPermissions' ||\n req.method === 'eth_requestAccounts'\n );\n}\n\n/**\n * Type guard for wallet_switchEthereumChain request.\n *\n * @param req - The request object to check\n * @returns True if the request is a wallet_switchEthereumChain request, false otherwise\n */\nexport function isSwitchChainRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'wallet_switchEthereumChain' }> {\n return req.method === 'wallet_switchEthereumChain';\n}\n\n/**\n * Type guard for wallet_addEthereumChain request.\n *\n * @param req - The request object to check\n * @returns True if the request is a wallet_addEthereumChain request, false otherwise\n */\nexport function isAddChainRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'wallet_addEthereumChain' }> {\n return req.method === 'wallet_addEthereumChain';\n}\n\n/**\n * Type guard for generic accounts request:\n * - eth_accounts\n * - eth_coinbase\n *\n * @param req - The request object to check\n * @returns True if the request is a generic accounts request, false otherwise\n */\nexport function isAccountsRequest(\n req: ProviderRequest,\n): req is Extract<\n ProviderRequest,\n { method: 'eth_accounts' | 'eth_coinbase' }\n> {\n return req.method === 'eth_accounts' || req.method === 'eth_coinbase';\n}\n\n/**\n * Type guard for generic eth_chainId request.\n *\n * @param req - The request object to check\n * @returns True if the request is a eth_chainId request, false otherwise\n */\nexport function isChainIdRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'eth_chainId' }> {\n return req.method === 'eth_chainId';\n}\n\n/**\n * Validates that all values in a Record are valid URLs.\n *\n * @param record - The record to validate (e.g., supportedNetworks)\n * @param recordName - The name of the record for error messages\n * @throws Error if any values are invalid URLs\n */\nexport function validSupportedChainsUrls(\n record: Record<string, string>,\n recordName: string,\n): void {\n const invalidUrls: string[] = [];\n for (const [key, url] of Object.entries(record)) {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n } catch {\n invalidUrls.push(`${key}: ${url}`);\n }\n }\n\n if (invalidUrls.length > 0) {\n throw new Error(\n `${recordName} contains invalid URLs:\\n${invalidUrls.join('\\n')}`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,oBAAoB,kCAAkC;AAE/D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,mBAAmB,CAAC,iBAAqC;AACpE,QAAM,UAAU,2BAA2B,YAAY;AACvD,QAAM,SAAS,OAAO,QAAQ,OAAO,EAAE;AAAA,IACrC,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM;AACnB,YAAM,EAAE,WAAAA,YAAW,UAAU,IAAI,iBAAiB,GAAkB;AACpE,UAAIA,eAAc,mBAAmB,QAAQ;AAC3C,eAAO;AAAA,MACT;AACA,YAAM,UAAU,YAAY,SAAS,WAAW,EAAE,CAAC;AACnD,UAAI,OAAO,IAAI;AACf,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACA,SAAO;AACT;;;ACvBA,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAQjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAAC,oBAAmB;;;AChBrB,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AACF;AAEO,IAAM,mBAAmB,CAAC,gBAAgB,cAAc;AAExD,IAAM,gBAAgB,CAAC,aAAa;AAEpC,IAAM,wBAAwB;AAAA,EACnC,GAAG;AAAA,EACH,GAAG;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MAC1C,QAAQ,IAAI;AAAA,IACd,EAAE,OAA+B,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM;AAC3D,YAAM,iBAAiB,SAAS,YAAY,EAAE;AAC9C,YAAM,eAAe,UAAU,cAAc;AAC7C,UAAI,YAAY,IAAI;AACpB,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAEL,QAAI;AACF,YAAM,OAAO,MAAM,uBAAuB,iCACrC,UADqC;AAAA,QAExC,KAAK;AAAA,UACH,mBAAmB;AAAA,QACrB;AAAA,MACF,EAAC;AAED,aAAO,mBAAmB,OAAO;AAAA,QAC/B;AAAA,QACA,eAAe,QAAQ;AAAA,QACvB,mBAAmB,QAAQ,IAAI;AAAA,MACjC,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAM,uCAAuC,KAAK;AAC1D,YAAM;AAAA,IACR;AAAA,EACF;AAAA;","names":["namespace","hexToNumber","_a","_core","hexToNumber","namespace","_a"]}
1
+ {"version":3,"sources":["../../../src/utils/infura.ts","../../../src/connect.ts","../../../src/constants.ts","../../../src/logger.ts","../../../src/provider.ts","../../../src/utils/caip.ts","../../../src/utils/type-guards.ts"],"sourcesContent":["import type { RpcUrlsMap } from '@metamask/connect-multichain';\nimport { getInfuraRpcUrls as getInfuraRpcUrlsMultichain } from '@metamask/connect-multichain';\nimport type { CaipChainId, Hex } from '@metamask/utils';\nimport {\n KnownCaipNamespace,\n numberToHex,\n parseCaipChainId,\n} from '@metamask/utils';\n\nexport const getInfuraRpcUrls = (infuraAPIKey: string): RpcUrlsMap => {\n const caipMap = getInfuraRpcUrlsMultichain(infuraAPIKey);\n const hexMap = Object.entries(caipMap).reduce<Record<Hex, string>>(\n (acc, [key, url]) => {\n const { namespace, reference } = parseCaipChainId(key as CaipChainId);\n if (namespace !== KnownCaipNamespace.Eip155) {\n return acc;\n }\n const chainId = numberToHex(parseInt(reference, 10));\n acc[chainId] = url as string;\n return acc;\n },\n {},\n );\n return hexMap;\n};\n","/* eslint-disable no-restricted-syntax -- Private class properties use established patterns */\n/* eslint-disable @typescript-eslint/naming-convention -- __PACKAGE_VERSION__ is an esbuild define convention */\nimport { analytics } from '@metamask/analytics';\nimport { parseScopeString } from '@metamask/chain-agnostic-permission';\nimport type {\n ConnectionStatus,\n MultichainCore,\n MultichainOptions,\n Scope,\n SessionData,\n} from '@metamask/connect-multichain';\nimport {\n createMultichainClient,\n getWalletActionAnalyticsProperties,\n isRejectionError,\n TransportType,\n} from '@metamask/connect-multichain';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { IGNORED_METHODS } from './constants';\nimport { enableDebug, logger } from './logger';\nimport { EIP1193Provider } from './provider';\nimport type {\n AddEthereumChainParameter,\n Address,\n CaipAccountId,\n EventHandlers,\n Hex,\n MetamaskConnectEVMOptions,\n ProviderRequest,\n ProviderRequestInterceptor,\n} from './types';\nimport { getEthAccounts, getPermittedEthChainIds } from './utils/caip';\nimport {\n isAccountsRequest,\n isAddChainRequest,\n isChainIdRequest,\n isConnectRequest,\n isSwitchChainRequest,\n validSupportedChainsUrls,\n} from './utils/type-guards';\n\ndeclare const __PACKAGE_VERSION__: string;\n\nconst DEFAULT_CHAIN_ID = '0x1';\nconst CHAIN_STORE_KEY = 'cache_eth_chainId';\n\n/** The options for the connect method */\ntype ConnectOptions = {\n /** The account to connect to */\n account?: string | undefined;\n /** Whether to force a request regardless of an existing session */\n forceRequest?: boolean;\n /** All available chain IDs in the dapp in hex format */\n chainIds?: Hex[];\n};\n\nexport type ConnectEvmStatus = 'disconnected' | 'connected' | 'connecting';\n\n/**\n * The MetamaskConnectEVM class provides an EIP-1193 compatible interface for connecting\n * to MetaMask and interacting with Ethereum Virtual Machine (EVM) networks.\n *\n * This class serves as a modern replacement for MetaMask SDK V1, offering enhanced\n * functionality and cross-platform compatibility. It wraps the Multichain SDK to provide\n * a simplified, EIP-1193 compliant API for dapp developers.\n *\n * Key features:\n * - EIP-1193 provider interface for seamless integration with existing dapp code\n * - Automatic session recovery when reloading or opening in new tabs\n * - Chain switching with automatic chain addition if not configured\n * - Event-driven architecture with support for connect, disconnect, accountsChanged, and chainChanged events\n * - Cross-platform support for browser extensions and mobile applications\n * - Built-in handling of common Ethereum methods (eth_accounts, wallet_switchEthereumChain, etc.)\n *\n * @example\n * ```typescript\n * const client = await createEVMClient({\n * dapp: { name: 'My DApp', url: 'https://mydapp.com' }\n * });\n *\n * const { accounts, chainId } = await client.connect({ chainIds: [1, 137] }); // Connect to Ethereum Mainnet, and Polygon\n *\n * const provider = client.getProvider();\n * const signedMessage = await provider.request({ method: 'personal_sign', params: ['0x0', accounts[0]] });\n * ```\n */\nexport class MetamaskConnectEVM {\n /** The core instance of the Multichain SDK */\n readonly #core: MultichainCore;\n\n /** An instance of the EIP-1193 provider interface */\n readonly #provider: EIP1193Provider;\n\n /** The session scopes currently permitted */\n #sessionScopes: SessionData['sessionScopes'] = {};\n\n /** Optional event handlers for the EIP-1193 provider events. */\n readonly #eventHandlers?: Partial<EventHandlers> | undefined;\n\n /** The handler for the wallet_sessionChanged event */\n readonly #sessionChangedHandler: (session?: SessionData) => void;\n\n /** The handler for the display_uri event */\n readonly #displayUriHandler: (uri: string) => void;\n\n /** The clean-up function for the notification handler */\n #removeNotificationHandler?: () => void;\n\n /** The current connection status */\n #status: ConnectEvmStatus = 'disconnected';\n\n /**\n * The preferred chain ID to use for the active connect() call.\n * Set to the first explicit chainId passed by the caller, cleared once the\n * connect event resolves. Takes priority over the cache in #getSelectedChainId\n * so that an explicit chainIds request always wins over a prior cached value.\n */\n #pendingPreferredChainId: Hex | undefined;\n\n /**\n * Creates a new MetamaskConnectEVM instance.\n * Use the static `create()` method instead to ensure proper async initialization.\n *\n * @param options - The options for the MetamaskConnectEVM instance\n * @param options.core - The core instance of the Multichain SDK\n * @param options.eventHandlers - Optional event handlers for EIP-1193 provider events\n */\n private constructor({ core, eventHandlers }: MetamaskConnectEVMOptions) {\n this.#core = core;\n\n this.#provider = new EIP1193Provider(\n core,\n this.#requestInterceptor.bind(this),\n );\n\n this.#eventHandlers = eventHandlers;\n\n /**\n * Handles the wallet_sessionChanged event.\n * Updates the internal connection state with the new session data.\n *\n * @param session - The session data\n */\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.#sessionChangedHandler = this.#onSessionChanged.bind(this);\n this.#core.on('wallet_sessionChanged', this.#sessionChangedHandler);\n\n /**\n * Handles the display_uri event.\n * Forwards the QR code URI to the provider for custom UI implementations.\n */\n this.#displayUriHandler = this.#onDisplayUri.bind(this);\n this.#core.on('display_uri', this.#displayUriHandler);\n\n logger('Connect/EVM constructor completed');\n }\n\n /**\n * Creates a fully initialized MetamaskConnectEVM instance.\n * This is the recommended way to instantiate the class, as it ensures\n * all async initialization (like session recovery) completes before\n * the instance is returned.\n *\n * @param options - The options for the MetamaskConnectEVM instance\n * @param options.core - The core instance of the Multichain SDK\n * @param options.eventHandlers - Optional event handlers for EIP-1193 provider events\n * @returns A promise that resolves with a fully initialized MetamaskConnectEVM instance\n */\n static async create(\n options: MetamaskConnectEVMOptions,\n ): Promise<MetamaskConnectEVM> {\n const instance = new MetamaskConnectEVM(options);\n await instance.#core.emitSessionChanged();\n return instance;\n }\n\n /**\n * Gets the core options for analytics checks.\n *\n * @returns The multichain options from the core instance\n */\n #getCoreOptions(): MultichainOptions {\n return (this.#core as any).options as MultichainOptions;\n }\n\n /**\n * Creates invoke options for analytics tracking.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n * @returns Invoke options object for analytics\n */\n #createInvokeOptions(\n method: string,\n scope: Scope,\n params: unknown[],\n ): {\n scope: Scope;\n request: { method: string; params: unknown[] };\n } {\n return {\n scope,\n request: { method, params },\n };\n }\n\n /**\n * Tracks a wallet action requested event.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n */\n async #trackWalletActionRequested(\n method: string,\n scope: Scope,\n params: unknown[],\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n this.#core.transportType,\n );\n analytics.track('mmconnect_wallet_action_requested', props);\n } catch (error) {\n logger('Error tracking mmconnect_wallet_action_requested event', error);\n }\n }\n\n /**\n * Tracks a wallet action succeeded event.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n */\n async #trackWalletActionSucceeded(\n method: string,\n scope: Scope,\n params: unknown[],\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n this.#core.transportType,\n );\n analytics.track('mmconnect_wallet_action_succeeded', props);\n } catch (error) {\n logger('Error tracking mmconnect_wallet_action_succeeded event', error);\n }\n }\n\n /**\n * Tracks a wallet action failed or rejected event based on the error.\n *\n * @param method - The RPC method name\n * @param scope - The CAIP chain ID scope\n * @param params - The method parameters\n * @param error - The error that occurred\n */\n async #trackWalletActionFailed(\n method: string,\n scope: Scope,\n params: unknown[],\n error: unknown,\n ): Promise<void> {\n const coreOptions = this.#getCoreOptions();\n try {\n const invokeOptions = this.#createInvokeOptions(method, scope, params);\n const props = await getWalletActionAnalyticsProperties(\n coreOptions,\n this.#core.storage,\n invokeOptions,\n this.#core.transportType,\n );\n const isRejection = isRejectionError(error);\n if (isRejection) {\n analytics.track('mmconnect_wallet_action_rejected', props);\n } else {\n analytics.track('mmconnect_wallet_action_failed', props);\n }\n } catch {\n logger('Error tracking wallet action rejected or failed event', error);\n }\n }\n\n /**\n * Gets the currently selected chainId. Priority order:\n * - Explicit caller preference from an active connect() call, if permitted.\n * - Cached chainId from storage, if permitted.\n * - First permitted chain as a fallback.\n *\n * @param permittedChainIds - Array of permitted chain IDs in hex format\n * @returns The selected chainId (hex string)\n */\n async #getSelectedChainId(permittedChainIds: Hex[]): Promise<Hex> {\n // Honour an explicit caller preference set during an active connect() call\n if (\n this.#pendingPreferredChainId &&\n permittedChainIds.includes(this.#pendingPreferredChainId)\n ) {\n return this.#pendingPreferredChainId;\n }\n\n try {\n const cachedChainId =\n await this.#core.storage.adapter.get(CHAIN_STORE_KEY);\n if (cachedChainId) {\n const chainId: Hex = JSON.parse(cachedChainId);\n\n // Validate that the cached chainId is in the permitted chains list\n if (permittedChainIds.includes(chainId)) {\n return chainId;\n }\n }\n } catch (error) {\n logger('Error retrieving cached chainId', error);\n }\n\n // Fallback to the first permitted chain if cache retrieval failed or returned an invalid chain\n return permittedChainIds[0];\n }\n\n /**\n * Connects to the wallet with the specified chain ID and optional account.\n *\n * @param options - The connection options\n * @param [options.account] - Optional param to specify an account to connect to\n * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session\n * @param [options.chainIds] - Array of chain IDs to request permission for (defaults to ethereum mainnet). The first entry is used as the active chain returned by the call. Ethereum mainnet is always included in the permission request as a bootstrap fallback.\n * @returns A promise that resolves with the connected accounts and chain ID\n */\n async connect({\n account,\n forceRequest,\n chainIds = [DEFAULT_CHAIN_ID],\n }: ConnectOptions = {}): Promise<{ accounts: Address[]; chainId: Hex }> {\n logger('request: connect', { account });\n\n if (!chainIds || chainIds.length === 0) {\n throw new Error('chainIds must be an array of at least one chain ID');\n }\n\n // The first explicitly-requested chain is preferred for chain selection.\n // DEFAULT_CHAIN_ID is still included in the permission request as a bootstrap\n // fallback, but it must not win over an explicit caller request.\n this.#pendingPreferredChainId = chainIds[0];\n\n const caipChainIds = Array.from(\n new Set(chainIds.concat(DEFAULT_CHAIN_ID) ?? [DEFAULT_CHAIN_ID]),\n ).map((id) => `eip155:${hexToNumber(id)}`);\n\n const caipAccountIds = account\n ? caipChainIds.map((caipChainId) => `${caipChainId}:${account}`)\n : [];\n\n this.#status = 'connecting';\n\n try {\n // Wait for the wallet_sessionChanged event to fire and set the provider properties\n const result = new Promise<{ accounts: Address[]; chainId: Hex }>(\n (resolve) => {\n this.#provider.once('connect', ({ chainId, accounts }) => {\n logger('fulfilled-request: connect', {\n chainId,\n accounts,\n });\n resolve({\n accounts,\n chainId,\n });\n });\n },\n );\n\n await this.#core.connect(\n caipChainIds as Scope[],\n caipAccountIds as CaipAccountId[],\n undefined,\n forceRequest,\n );\n\n // Await here so the finally block always runs after #onSessionChanged\n // has consumed #pendingPreferredChainId, not before.\n return await result;\n } catch (error) {\n this.#status = 'disconnected';\n logger('Error connecting to wallet', error);\n throw error;\n } finally {\n this.#pendingPreferredChainId = undefined;\n }\n }\n\n /**\n * Connects to the wallet and signs a message using personal_sign.\n *\n * @param options - The connection options\n * @param options.message - The message to sign after connecting\n * @param [options.chainIds] - Optional hex chain IDs to connect to (defaults to ethereum mainnet if not provided)\n * @returns A promise that resolves with the signature\n * @throws Error if the selected account is not available after timeout\n */\n async connectAndSign({\n message,\n chainIds,\n }: {\n message: string;\n chainIds?: Hex[];\n }): Promise<string> {\n const { accounts, chainId } = await this.connect({\n chainIds: chainIds ?? [DEFAULT_CHAIN_ID],\n });\n\n const result = (await this.#provider.request({\n method: 'personal_sign',\n params: [accounts[0], message],\n })) as string;\n\n this.#eventHandlers?.connectAndSign?.({\n accounts,\n chainId,\n signResponse: result,\n });\n\n return result;\n }\n\n /**\n * Connects to the wallet and invokes a method with specified parameters.\n *\n * @param options - The options for connecting and invoking the method\n * @param options.method - The method name to invoke\n * @param options.params - The parameters to pass to the method, or a function that receives the account and returns params\n * @param [options.chainIds] - Optional hex chain IDs to connect to (defaults to ethereum mainnet if not provided)\n * @param [options.account] - Optional specific account to connect to\n * @param [options.forceRequest] - Whether to force a request regardless of an existing session\n * @returns A promise that resolves with the result of the method invocation\n * @throws Error if the selected account is not available after timeout (for methods that require an account)\n */\n async connectWith({\n method,\n params,\n chainIds,\n account,\n forceRequest,\n }: {\n method: string;\n params: unknown[] | ((account: Address) => unknown[]);\n chainIds?: Hex[];\n account?: string | undefined;\n forceRequest?: boolean;\n }): Promise<unknown> {\n const { accounts: connectedAccounts, chainId: connectedChainId } =\n await this.connect({\n chainIds: chainIds ?? [DEFAULT_CHAIN_ID],\n account,\n forceRequest,\n });\n\n const resolvedParams =\n typeof params === 'function' ? params(connectedAccounts[0]) : params;\n\n const result = await this.#provider.request({\n method,\n params: resolvedParams,\n });\n\n this.#eventHandlers?.connectWith?.({\n accounts: connectedAccounts,\n chainId: connectedChainId,\n connectWithResponse: result,\n });\n\n return result;\n }\n\n /**\n * Disconnects from the wallet by revoking the session and cleaning up event listeners.\n *\n * @returns A promise that resolves when disconnection is complete\n */\n async disconnect(): Promise<void> {\n logger('request: disconnect');\n\n const sessionScopes = this.#sessionScopes;\n const eip155Scopes = Object.keys(sessionScopes).filter((scope) => {\n const { namespace } = parseScopeString(scope as Scope);\n return namespace === 'eip155';\n });\n\n await this.#core.disconnect(eip155Scopes as Scope[]);\n this.#onDisconnect();\n this.#clearConnectionState();\n\n // Note: We intentionally do NOT remove the display_uri and wallet_sessionChanged\n // listeners here. These are instance-scoped listeners that should remain active\n // for the lifetime of the SDK instance, allowing reconnection to work properly.\n // Session-scoped listeners (like the notification handler below) are removed.\n\n this.#removeNotificationHandler?.();\n this.#removeNotificationHandler = undefined;\n\n logger('fulfilled-request: disconnect');\n }\n\n /**\n * Switches the Ethereum chain. Will track state internally whenever possible.\n *\n * @param options - The options for the switch chain request\n * @param options.chainId - The chain ID to switch to\n * @param [options.chainConfiguration] - The chain configuration to use in case the chain is not present by the wallet\n * @returns A promise that resolves when the chain has been switched\n */\n async switchChain({\n chainId,\n chainConfiguration,\n }: {\n chainId: Hex;\n chainConfiguration?: AddEthereumChainParameter;\n }): Promise<void> {\n const method = 'wallet_switchEthereumChain';\n const scope: Scope = `eip155:${hexToNumber(chainId)}`;\n const params = [{ chainId }];\n\n // TODO (wenfix): better way to return here other than resolving.\n if (this.selectedChainId === chainId) {\n return Promise.resolve();\n }\n\n const permittedChainIds = getPermittedEthChainIds(this.#sessionScopes);\n\n if (\n permittedChainIds.includes(chainId) &&\n this.#core.transportType === TransportType.MWP\n ) {\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n return Promise.resolve();\n }\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n try {\n const result = await this.#request({\n method: 'wallet_switchEthereumChain',\n params,\n });\n\n // When using the MWP transport, the error is returned instead of thrown,\n // so we force it into the catch block here.\n const resultWithError = result as { error?: { message: string } };\n if (resultWithError?.error) {\n throw new Error(resultWithError.error.message);\n }\n\n await this.#trackWalletActionSucceeded(method, scope, params);\n if ((result as { result: unknown }).result === null) {\n // result is successful we eagerly call onChainChanged to update the provider's selected chain ID.\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n }\n return Promise.resolve();\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n // Fallback to add the chain if its not configured in the wallet.\n if ((error as Error).message.includes('Unrecognized chain ID')) {\n return this.#addEthereumChain(chainConfiguration);\n }\n throw error;\n }\n }\n\n /**\n * Handles several EIP-1193 requests that require special handling\n * due the nature of the Multichain SDK.\n *\n * @param request - The request object containing the method and params\n * @returns The result of the request or undefined if the request is ignored\n */\n async #requestInterceptor(\n request: ProviderRequest,\n ): ReturnType<ProviderRequestInterceptor> {\n logger(`Intercepting request for method: ${request.method}`);\n\n if (IGNORED_METHODS.includes(request.method)) {\n // TODO: replace with correct method unsupported provider error\n return Promise.reject(\n new Error(\n `Method: ${request.method} is not supported by Metamask Connect/EVM`,\n ),\n );\n }\n\n if (request.method === 'wallet_revokePermissions') {\n return this.disconnect();\n }\n\n if (isConnectRequest(request)) {\n // When calling wallet_requestPermissions, we need to force a new session request to prompt\n // the user for accounts, because internally the Multichain SDK will check if\n // the user is already connected and skip the request if so, unless we\n // explicitly request a specific account. This is needed to workaround\n // wallet_requestPermissions not requesting specific accounts.\n const shouldForceConnectionRequest =\n request.method === 'wallet_requestPermissions';\n\n const { method, params } = request;\n const initiallySelectedChainId = DEFAULT_CHAIN_ID;\n const scope: Scope = `eip155:${initiallySelectedChainId}`;\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n try {\n const result = await this.connect({\n chainIds: [initiallySelectedChainId],\n forceRequest: shouldForceConnectionRequest,\n });\n await this.#trackWalletActionSucceeded(method, scope, params);\n return result;\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n throw error;\n }\n }\n\n if (isSwitchChainRequest(request)) {\n return this.switchChain({\n chainId: request.params[0].chainId as Hex,\n });\n }\n\n if (isAddChainRequest(request)) {\n return this.#addEthereumChain(request.params[0]);\n }\n\n if (isAccountsRequest(request)) {\n return this.#provider.accounts;\n }\n\n if (isChainIdRequest(request)) {\n return this.#provider.selectedChainId;\n }\n\n logger('Request not intercepted, forwarding to default handler', request);\n return Promise.resolve();\n }\n\n /**\n * Clears the internal connection state: accounts and chainId\n */\n #clearConnectionState(): void {\n this.#provider.accounts = [];\n this.#provider.selectedChainId = undefined;\n }\n\n /**\n * Adds an Ethereum chain using the latest chain configuration received from\n * a switchEthereumChain request\n *\n * @param chainConfiguration - The chain configuration to use in case the chain is not present by the wallet\n * @returns Nothing\n */\n async #addEthereumChain(\n chainConfiguration?: AddEthereumChainParameter,\n ): Promise<void> {\n logger('addEthereumChain called', { chainConfiguration });\n const method = 'wallet_addEthereumChain';\n\n if (!chainConfiguration) {\n throw new Error('No chain configuration found.');\n }\n\n // Get chain ID from config or use current chain\n const chainId =\n (chainConfiguration.chainId as Hex) ||\n this.#provider.selectedChainId ||\n '0x1';\n const decimalChainId = hexToNumber(chainId);\n const scope: Scope = `eip155:${decimalChainId}`;\n const params = [chainConfiguration];\n\n await this.#trackWalletActionRequested(method, scope, params);\n\n try {\n const result = await this.#request({\n method: 'wallet_addEthereumChain',\n params,\n });\n\n if ((result as { result: unknown }).result === null) {\n // if result is successful we eagerly call onChainChanged to update the provider's selected chain ID.\n await this.#cacheChainId(chainId);\n this.#onChainChanged(chainId);\n }\n await this.#trackWalletActionSucceeded(method, scope, params);\n } catch (error) {\n await this.#trackWalletActionFailed(method, scope, params, error);\n throw error;\n }\n }\n\n /**\n * Submits a request to the EIP-1193 provider\n *\n * @param request - The request object containing the method and params\n * @param request.method - The method to request\n * @param request.params - The parameters to pass to the method\n * @returns The result of the request\n */\n async #request(request: {\n method: string;\n params: unknown[];\n }): Promise<unknown> {\n logger('direct request to metamask-provider called', request);\n const result = this.#core.transport.sendEip1193Message(request);\n if (\n request.method === 'wallet_addEthereumChain' ||\n request.method === 'wallet_switchEthereumChain'\n ) {\n this.#core.openSimpleDeeplinkIfNeeded();\n }\n return result;\n }\n\n /**\n * Caches the chainId to storage for persistence across page refreshes.\n *\n * @param chainId - The hex chain ID\n */\n async #cacheChainId(chainId: Hex): Promise<void> {\n try {\n await this.#core.storage.adapter.set(\n CHAIN_STORE_KEY,\n JSON.stringify(chainId),\n );\n } catch (error) {\n logger('Error caching chainId', error);\n }\n }\n\n async #onSessionChanged(session?: SessionData): Promise<void> {\n logger('event: wallet_sessionChanged', session);\n this.#sessionScopes = session?.sessionScopes ?? {};\n const hexPermittedChainIds = getPermittedEthChainIds(this.#sessionScopes);\n if (hexPermittedChainIds.length === 0) {\n this.#onDisconnect();\n } else {\n let initialAccounts: Address[] = [];\n if (this.#core.status === 'connected') {\n const ethAccountsResponse =\n await this.#core.transport.sendEip1193Message({\n method: 'eth_accounts',\n params: [],\n });\n initialAccounts = ethAccountsResponse.result as Address[];\n } else {\n initialAccounts = getEthAccounts(this.#sessionScopes);\n }\n\n const chainId = await this.#getSelectedChainId(hexPermittedChainIds);\n\n this.#onConnect({\n chainId,\n accounts: initialAccounts,\n });\n }\n }\n\n /**\n * Handles chain change events and updates the provider's selected chain ID.\n *\n * @param chainId - The new hex chain ID\n */\n #onChainChanged(chainId: Hex): void {\n if (chainId === this.#provider.selectedChainId) {\n return;\n }\n logger('handler: chainChanged', { chainId });\n this.#provider.selectedChainId = chainId;\n this.#eventHandlers?.chainChanged?.(chainId);\n this.#provider.emit('chainChanged', chainId);\n }\n\n /**\n * Handles accounts change events and updates the provider's accounts list.\n *\n * @param accounts - The new list of permitted accounts\n */\n #onAccountsChanged(accounts: Address[]): void {\n const accountsUnchanged =\n accounts.length === this.#provider.accounts.length &&\n accounts.every((acct, idx) => acct === this.#provider.accounts[idx]);\n if (accountsUnchanged) {\n return;\n }\n logger('handler: accountsChanged', accounts);\n this.#provider.accounts = accounts;\n this.#provider.emit('accountsChanged', accounts);\n this.#eventHandlers?.accountsChanged?.(accounts);\n }\n\n /**\n * Handles connection events and emits the connect event to listeners.\n *\n * @param options - The connection options\n * @param options.chainId - The hex chain ID of the connection\n * @param options.accounts - The accounts of the connection\n */\n #onConnect({\n chainId,\n accounts,\n }: {\n chainId: Hex;\n accounts: Address[];\n }): void {\n logger('handler: connect', { chainId, accounts });\n const data = {\n chainId,\n accounts,\n };\n\n if (this.#status !== 'connected') {\n this.#status = 'connected';\n this.#provider.emit('connect', data);\n this.#eventHandlers?.connect?.(data);\n\n this.#removeNotificationHandler?.();\n\n // TODO: Verify if #core.on('metamask_accountsChanged') and #core.on('metamask_chainChanged')\n // would work here instead\n this.#removeNotificationHandler = this.#core.transport.onNotification(\n (notification) => {\n // @ts-expect-error TODO: address this\n if (notification?.method === 'metamask_accountsChanged') {\n // @ts-expect-error TODO: address this\n const notificationAccounts = notification?.params;\n logger('transport-event: accountsChanged', notificationAccounts);\n // why are we not caching the accounts here?\n this.#onAccountsChanged(notificationAccounts);\n }\n\n // @ts-expect-error TODO: address this\n if (notification?.method === 'metamask_chainChanged') {\n // @ts-expect-error TODO: address this\n const notificationChainId = notification?.params?.chainId;\n logger('transport-event: chainChanged', notificationChainId);\n // Cache the chainId for persistence across page refreshes\n this.#cacheChainId(notificationChainId).catch((error) => {\n logger('Error caching chainId in notification handler', error);\n });\n this.#onChainChanged(notificationChainId);\n }\n },\n );\n }\n\n this.#onChainChanged(chainId);\n this.#onAccountsChanged(accounts);\n }\n\n /**\n * Handles disconnection events and emits the disconnect event to listeners.\n * Also clears accounts by triggering an accountsChanged event with an empty array.\n */\n #onDisconnect(): void {\n if (this.#status === 'disconnected') {\n return;\n }\n this.#status = 'disconnected';\n\n logger('handler: disconnect');\n this.#provider.emit('disconnect');\n this.#eventHandlers?.disconnect?.();\n\n this.#onAccountsChanged([]);\n }\n\n /**\n * Handles display_uri events and emits them to the provider.\n * This allows consumers to display their own custom QR code UI.\n *\n * @param uri - The deeplink URI to be displayed as a QR code\n */\n #onDisplayUri(uri: string): void {\n if (this.#status !== 'connecting') {\n return;\n }\n\n logger('handler: display_uri', uri);\n this.#provider.emit('display_uri', uri);\n this.#eventHandlers?.displayUri?.(uri);\n }\n\n /**\n * Gets the EIP-1193 provider instance\n *\n * @returns The EIP-1193 provider instance\n */\n getProvider(): EIP1193Provider {\n return this.#provider;\n }\n\n /**\n * Gets the currently selected chain ID on the wallet\n *\n * @returns The currently selected chain ID or undefined if no chain is selected\n */\n getChainId(): Hex | undefined {\n return this.selectedChainId;\n }\n\n /**\n * Gets the currently selected account on the wallet\n *\n * @returns The currently selected account or undefined if no account is selected\n */\n getAccount(): Address | undefined {\n return this.#provider.selectedAccount;\n }\n\n // Convenience getters for the EIP-1193 provider\n /**\n * Gets the currently permitted accounts\n *\n * @returns The currently permitted accounts\n */\n get accounts(): Address[] {\n return this.#provider.accounts;\n }\n\n /**\n * Gets the currently selected account on the wallet\n *\n * @returns The currently selected account or undefined if no account is selected\n */\n get selectedAccount(): Address | undefined {\n return this.#provider.selectedAccount;\n }\n\n /**\n * Gets the currently selected chain ID on the wallet\n *\n * @returns The currently selected chain ID or undefined if no chain is selected\n */\n get selectedChainId(): Hex | undefined {\n return this.#provider.selectedChainId;\n }\n\n /**\n * Gets the current connection status\n *\n * @returns The current connection status\n */\n get status(): ConnectionStatus {\n return this.#core.status;\n }\n}\n\n/**\n * Creates a new Metamask Connect/EVM instance\n *\n * @param options - The options for the Metamask Connect/EVM layer\n * @param options.dapp - Dapp identification and branding settings\n * @param options.api - API configuration including read-only RPC map\n * @param options.api.supportedNetworks - A map of hex chain IDs to RPC URLs for read-only requests\n * @param [options.analytics.integrationType] - Integration type for analytics\n * @param [options.ui] - UI configuration options\n * @param [options.ui.headless] - Whether to run without UI\n * @param [options.ui.preferExtension] - Whether to prefer browser extension\n * @param [options.ui.showInstallModal] - Whether to render installation modal for desktop extension\n * @param [options.mobile] - Mobile configuration options\n * @param [options.mobile.preferredOpenLink] - Custom handler for opening deeplinks (useful for React Native, etc.)\n * @param [options.mobile.useDeeplink] - Whether to use native deeplinks instead of universal links\n * @param [options.transport] - Transport configuration (e.g., extensionId, notification handler)\n * @param [options.transport.extensionId] - Extension ID for browser extension transport\n * @param [options.transport.onNotification] - Callback for receiving transport notifications\n * @param [options.eventHandlers] - Event handlers for the Metamask Connect/EVM layer\n * @param [options.debug] - Enable debug logging\n * @returns The Metamask-Connect EVM client instance\n */\nexport async function createEVMClient(\n options: Pick<\n MultichainOptions,\n 'dapp' | 'mobile' | 'transport' | 'analytics'\n > & {\n ui?: Omit<MultichainOptions['ui'], 'factory'>;\n } & {\n eventHandlers?: Partial<EventHandlers>;\n debug?: boolean;\n api: {\n supportedNetworks: Record<Hex, string>;\n };\n },\n): Promise<MetamaskConnectEVM> {\n if (options.debug) {\n enableDebug();\n }\n\n logger('Creating Metamask Connect/EVM with options:', options);\n\n // Validate that supportedNetworks is provided and not empty\n if (\n !options.api?.supportedNetworks ||\n Object.keys(options.api.supportedNetworks).length === 0\n ) {\n throw new Error(\n 'supportedNetworks is required and must contain at least one chain configuration',\n );\n }\n\n validSupportedChainsUrls(options.api.supportedNetworks, 'supportedNetworks');\n\n const supportedNetworksCaipChainId = Object.entries(\n options.api.supportedNetworks,\n ).reduce<Record<string, string>>((acc, [hexChainId, url]) => {\n const decimalChainId = parseInt(hexChainId, 16);\n const caip2ChainId = `eip155:${decimalChainId}`;\n acc[caip2ChainId] = url;\n return acc;\n }, {});\n\n try {\n const core = await createMultichainClient({\n ...options,\n api: {\n supportedNetworks: supportedNetworksCaipChainId,\n },\n analytics: {\n integrationType: options.analytics?.integrationType ?? 'direct',\n },\n versions: { 'connect-evm': __PACKAGE_VERSION__ },\n });\n\n return MetamaskConnectEVM.create({\n core,\n eventHandlers: options.eventHandlers,\n supportedNetworks: options.api.supportedNetworks,\n });\n } catch (error) {\n console.error('Error creating Metamask Connect/EVM', error);\n throw error;\n }\n}\n","export const IGNORED_METHODS = [\n 'metamask_getProviderState',\n 'metamask_sendDomainMetadata',\n 'metamask_logWeb3ShimUsage',\n 'wallet_registerOnboarding',\n 'net_version',\n 'wallet_getPermissions',\n];\n\nexport const CONNECT_METHODS = [\n 'wallet_requestPermissions',\n 'eth_requestAccounts',\n];\n\nexport const ACCOUNTS_METHODS = ['eth_accounts', 'eth_coinbase'];\n\nexport const CHAIN_METHODS = ['eth_chainId'];\n\nexport const INTERCEPTABLE_METHODS = [\n ...ACCOUNTS_METHODS,\n ...IGNORED_METHODS,\n ...CONNECT_METHODS,\n ...CHAIN_METHODS,\n // These have bespoke handlers\n 'wallet_revokePermissions',\n 'wallet_switchEthereumChain',\n 'wallet_addEthereumChain',\n];\n","import {\n createLogger,\n enableDebug as debug,\n} from '@metamask/connect-multichain';\n\nconst namespace = 'metamask-connect:evm';\n\n// @ts-expect-error logger needs to be typed properly\nexport const logger = createLogger(namespace, '63');\n\nexport const enableDebug = (): void => {\n // @ts-expect-error logger needs to be typed properly\n debug(namespace);\n};\n","/* eslint-disable promise/always-return -- Legacy callback patterns */\n/* eslint-disable promise/no-callback-in-promise -- Legacy sendAsync/send API */\n/* eslint-disable consistent-return -- Legacy method returns void or Promise */\n/* eslint-disable @typescript-eslint/no-floating-promises -- Legacy fire-and-forget pattern */\n/* eslint-disable jsdoc/require-returns -- Inherited from abstract class */\nimport type { MultichainCore, Scope } from '@metamask/connect-multichain';\nimport { EventEmitter } from '@metamask/connect-multichain';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { INTERCEPTABLE_METHODS } from './constants';\nimport { logger } from './logger';\nimport type {\n Address,\n EIP1193ProviderEvents,\n Hex,\n JsonRpcCallback,\n JsonRpcRequest,\n JsonRpcResponse,\n ProviderRequest,\n ProviderRequestInterceptor,\n} from './types';\n\n/**\n * EIP-1193 Provider wrapper around the Multichain SDK.\n */\nexport class EIP1193Provider extends EventEmitter<EIP1193ProviderEvents> {\n /** The core instance of the Multichain SDK */\n readonly #core: MultichainCore;\n\n /** Interceptor function to handle specific methods */\n readonly #requestInterceptor: ProviderRequestInterceptor;\n\n /** The currently permitted accounts */\n #accounts: Address[] = [];\n\n /** The currently selected chain ID on the wallet */\n #selectedChainId?: Hex | undefined;\n\n constructor(core: MultichainCore, interceptor: ProviderRequestInterceptor) {\n super();\n this.#core = core;\n this.#requestInterceptor = interceptor;\n\n // Bind all public methods to ensure `this` context is preserved\n // when methods are extracted or passed as callbacks.\n // This eliminates the need for Proxy wrappers in consumers.\n this.request = this.request.bind(this);\n this.sendAsync = this.sendAsync.bind(this);\n this.send = this.send.bind(this);\n\n // Bind inherited EventEmitter methods\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n this.emit = this.emit.bind(this);\n this.once = this.once.bind(this);\n this.removeListener = this.removeListener.bind(this);\n this.listenerCount = this.listenerCount.bind(this);\n }\n\n /**\n * Performs a EIP-1193 request.\n *\n * @param request - The request object containing the method and params\n * @returns The result of the request\n */\n async request(request: ProviderRequest): Promise<unknown> {\n logger(\n `request: ${request.method} - chainId: ${this.selectedChainId}`,\n request.params,\n );\n /* Some methods require special handling, so we intercept them here\n * and handle them in MetamaskConnectEVM.requestInterceptor method. */\n if (INTERCEPTABLE_METHODS.includes(request.method)) {\n return this.#requestInterceptor?.(request);\n }\n\n if (!this.#selectedChainId) {\n // TODO: replace with a better error\n throw new Error('No chain ID selected');\n }\n\n const decimalChainId = hexToNumber(this.#selectedChainId);\n const scope: Scope = `eip155:${decimalChainId}`;\n\n // Validate that the chain is configured in supportedNetworks\n // This check is performed here to provide better error messages\n // The RpcClient will also validate, but this gives us a chance to provide\n // a clearer error message before the request is routed\n const coreOptions = (this.#core as any).options; // TODO: options is `protected readonly` property, this needs to be refactored so `any` type assertion is not necessary\n const supportedNetworks = coreOptions?.api?.supportedNetworks ?? {};\n if (!supportedNetworks[scope]) {\n throw new Error(\n `Chain ${scope} is not configured in supportedNetworks. Requests cannot be made to chains not explicitly configured in supportedNetworks.`,\n );\n }\n\n return this.#core.invokeMethod({\n scope,\n request: {\n method: request.method,\n params: request.params,\n },\n });\n }\n\n // Getters and setters\n public get selectedAccount(): Address | undefined {\n return this.accounts[0];\n }\n\n public set accounts(accounts: Address[]) {\n this.#accounts = accounts;\n }\n\n public get accounts(): Address[] {\n return this.#accounts;\n }\n\n public get selectedChainId(): Hex | undefined {\n return this.#selectedChainId;\n }\n\n public set selectedChainId(chainId: Hex | undefined) {\n this.#selectedChainId = chainId;\n }\n\n // ==========================================\n // Legacy compatibility methods\n // ==========================================\n\n /**\n * Alias for selectedChainId for legacy compatibility.\n * Many dApps expect a `chainId` property on the provider.\n */\n public get chainId(): Hex | undefined {\n return this.selectedChainId;\n }\n\n /**\n * Legacy method for sending JSON-RPC requests.\n *\n * @deprecated Use `request` instead. This method is provided for backwards compatibility.\n * @param request - The JSON-RPC request object\n * @param callback - Optional callback function. If provided, the method returns void.\n * @returns A promise resolving to the JSON-RPC response, or void if a callback is provided.\n */\n async sendAsync<TParams = unknown, TResult = unknown>(\n request: JsonRpcRequest<TParams>,\n callback?: JsonRpcCallback<TResult>,\n ): Promise<JsonRpcResponse<TResult> | void> {\n const id = request.id ?? 1;\n\n const promise = this.request({\n method: request.method,\n params: request.params as unknown,\n })\n .then(\n (result): JsonRpcResponse<TResult> => ({\n id,\n jsonrpc: '2.0',\n result: result as TResult,\n }),\n )\n .catch(\n (error): JsonRpcResponse<TResult> => ({\n id,\n jsonrpc: '2.0',\n error: {\n code: error.code ?? -32603,\n message: error.message ?? 'Internal error',\n data: error.data,\n },\n }),\n );\n\n if (callback) {\n promise\n .then((response) => {\n if (response.error) {\n callback(new Error(response.error.message), response);\n } else {\n callback(null, response);\n }\n })\n .catch((error) => {\n callback(error, null);\n });\n return;\n }\n\n return promise;\n }\n\n /**\n * Legacy method for sending JSON-RPC requests synchronously (callback-based).\n *\n * @deprecated Use `request` instead. This method is provided for backwards compatibility.\n * @param request - The JSON-RPC request object\n * @param callback - The callback function to receive the response\n */\n send<TParams = unknown, TResult = unknown>(\n request: JsonRpcRequest<TParams>,\n callback: JsonRpcCallback<TResult>,\n ): void {\n this.sendAsync(request, callback);\n }\n}\n","import type { InternalScopesObject } from '@metamask/chain-agnostic-permission';\nimport {\n getPermittedEthChainIds as _getPermittedEthChainIds,\n getEthAccounts as _getEthAccounts,\n} from '@metamask/chain-agnostic-permission';\nimport type { SessionData } from '@metamask/connect-multichain';\n\nimport type { Address, Hex } from '../types';\n\n/**\n * Get the Ethereum accounts from the session data\n *\n * @param sessionScopes - The session scopes\n * @returns The Ethereum accounts\n */\nexport const getEthAccounts = (\n sessionScopes: SessionData['sessionScopes'] | undefined,\n): Address[] => {\n if (!sessionScopes) {\n return [];\n }\n\n return _getEthAccounts({\n requiredScopes: sessionScopes as InternalScopesObject,\n optionalScopes: sessionScopes as InternalScopesObject,\n });\n};\n\n/**\n * Get the permitted Ethereum chain IDs from the session scopes.\n * Wrapper around getPermittedEthChainIds from @metamask/chain-agnostic-permission\n *\n * @param sessionScopes - The session scopes\n * @returns The permitted Ethereum chain IDs\n */\nexport const getPermittedEthChainIds = (\n sessionScopes: SessionData['sessionScopes'] | undefined,\n): Hex[] => {\n if (!sessionScopes) {\n return [];\n }\n\n return _getPermittedEthChainIds({\n requiredScopes: sessionScopes as InternalScopesObject,\n optionalScopes: sessionScopes as InternalScopesObject,\n });\n};\n","import type { ProviderRequest } from '../types';\n\n/**\n * Type guard for connect-like requests:\n * - wallet_requestPermissions\n * - eth_requestAccounts\n *\n * @param req - The request object to check\n * @returns True if the request is a connect-like request, false otherwise\n */\nexport function isConnectRequest(req: ProviderRequest): req is Extract<\n ProviderRequest,\n {\n method: 'wallet_requestPermissions' | 'eth_requestAccounts';\n }\n> {\n return (\n req.method === 'wallet_requestPermissions' ||\n req.method === 'eth_requestAccounts'\n );\n}\n\n/**\n * Type guard for wallet_switchEthereumChain request.\n *\n * @param req - The request object to check\n * @returns True if the request is a wallet_switchEthereumChain request, false otherwise\n */\nexport function isSwitchChainRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'wallet_switchEthereumChain' }> {\n return req.method === 'wallet_switchEthereumChain';\n}\n\n/**\n * Type guard for wallet_addEthereumChain request.\n *\n * @param req - The request object to check\n * @returns True if the request is a wallet_addEthereumChain request, false otherwise\n */\nexport function isAddChainRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'wallet_addEthereumChain' }> {\n return req.method === 'wallet_addEthereumChain';\n}\n\n/**\n * Type guard for generic accounts request:\n * - eth_accounts\n * - eth_coinbase\n *\n * @param req - The request object to check\n * @returns True if the request is a generic accounts request, false otherwise\n */\nexport function isAccountsRequest(\n req: ProviderRequest,\n): req is Extract<\n ProviderRequest,\n { method: 'eth_accounts' | 'eth_coinbase' }\n> {\n return req.method === 'eth_accounts' || req.method === 'eth_coinbase';\n}\n\n/**\n * Type guard for generic eth_chainId request.\n *\n * @param req - The request object to check\n * @returns True if the request is a eth_chainId request, false otherwise\n */\nexport function isChainIdRequest(\n req: ProviderRequest,\n): req is Extract<ProviderRequest, { method: 'eth_chainId' }> {\n return req.method === 'eth_chainId';\n}\n\n/**\n * Validates that all values in a Record are valid URLs.\n *\n * @param record - The record to validate (e.g., supportedNetworks)\n * @param recordName - The name of the record for error messages\n * @throws Error if any values are invalid URLs\n */\nexport function validSupportedChainsUrls(\n record: Record<string, string>,\n recordName: string,\n): void {\n const invalidUrls: string[] = [];\n for (const [key, url] of Object.entries(record)) {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n } catch {\n invalidUrls.push(`${key}: ${url}`);\n }\n }\n\n if (invalidUrls.length > 0) {\n throw new Error(\n `${recordName} contains invalid URLs:\\n${invalidUrls.join('\\n')}`,\n );\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C,UADqC;AAAA,QAExC,KAAK;AAAA,UACH,mBAAmB;AAAA,QACrB;AAAA,QACA,WAAW;AAAA,UACT,kBAAiB,mBAAQ,cAAR,mBAAmB,oBAAnB,YAAsC;AAAA,QACzD;AAAA,QACA,UAAU,EAAE,eAAe,QAAoB;AAAA,MACjD,EAAC;AAED,aAAO,mBAAmB,OAAO;AAAA,QAC/B;AAAA,QACA,eAAe,QAAQ;AAAA,QACvB,mBAAmB,QAAQ,IAAI;AAAA,MACjC,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAM,uCAAuC,KAAK;AAC1D,YAAM;AAAA,IACR;AAAA,EACF;AAAA;","names":["namespace","hexToNumber","_a","_core","hexToNumber","namespace","_a"]}
@@ -68,7 +68,7 @@ export declare class MetamaskConnectEVM {
68
68
  * @param options - The connection options
69
69
  * @param [options.account] - Optional param to specify an account to connect to
70
70
  * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session
71
- * @param [options.chainIds] - Array of chain IDs to connect to (defaults to ethereum mainnet if not provided)
71
+ * @param [options.chainIds] - Array of chain IDs to request permission for (defaults to ethereum mainnet). The first entry is used as the active chain returned by the call. Ethereum mainnet is always included in the permission request as a bootstrap fallback.
72
72
  * @returns A promise that resolves with the connected accounts and chain ID
73
73
  */
74
74
  connect({ account, forceRequest, chainIds, }?: ConnectOptions): Promise<{
@@ -175,6 +175,7 @@ export declare class MetamaskConnectEVM {
175
175
  * @param options.dapp - Dapp identification and branding settings
176
176
  * @param options.api - API configuration including read-only RPC map
177
177
  * @param options.api.supportedNetworks - A map of hex chain IDs to RPC URLs for read-only requests
178
+ * @param [options.analytics.integrationType] - Integration type for analytics
178
179
  * @param [options.ui] - UI configuration options
179
180
  * @param [options.ui.headless] - Whether to run without UI
180
181
  * @param [options.ui.preferExtension] - Whether to prefer browser extension
@@ -189,7 +190,7 @@ export declare class MetamaskConnectEVM {
189
190
  * @param [options.debug] - Enable debug logging
190
191
  * @returns The Metamask-Connect EVM client instance
191
192
  */
192
- export declare function createEVMClient(options: Pick<MultichainOptions, 'dapp' | 'mobile' | 'transport'> & {
193
+ export declare function createEVMClient(options: Pick<MultichainOptions, 'dapp' | 'mobile' | 'transport' | 'analytics'> & {
193
194
  ui?: Omit<MultichainOptions['ui'], 'factory'>;
194
195
  } & {
195
196
  eventHandlers?: Partial<EventHandlers>;
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EAGlB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,yBAAyB,EACzB,OAAO,EAEP,aAAa,EACb,GAAG,EACH,yBAAyB,EAG1B,MAAM,SAAS,CAAC;AAcjB,yCAAyC;AACzC,KAAK,cAAc,GAAG;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,WAAW,GAAG,YAAY,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,kBAAkB;;IAyB7B;;;;;;;OAOG;IACH,OAAO;IA8BP;;;;;;;;;;OAUG;WACU,MAAM,CACjB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC;IAoJ9B;;;;;;;;OAQG;IACG,OAAO,CAAC,EACZ,OAAO,EACP,YAAY,EACZ,QAA6B,GAC9B,GAAE,cAAmB,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;IA+CvE;;;;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Ae,IAAI,OAAO,GAAG,SAAS,CAEzC;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,GAAG,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,gBAAgB,CAE7B;CACF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,IAAI,CACX,iBAAiB,EACjB,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAC9C,GAAG;IACF,EAAE,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;CAC/C,GAAG;IACF,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE;QACH,iBAAiB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KACxC,CAAC;CACH,GACA,OAAO,CAAC,kBAAkB,CAAC,CAiD7B"}
@@ -18,8 +18,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
18
18
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
20
  };
21
- var _MetamaskConnectEVM_instances, _MetamaskConnectEVM_core, _MetamaskConnectEVM_provider, _MetamaskConnectEVM_sessionScopes, _MetamaskConnectEVM_eventHandlers, _MetamaskConnectEVM_sessionChangedHandler, _MetamaskConnectEVM_displayUriHandler, _MetamaskConnectEVM_removeNotificationHandler, _MetamaskConnectEVM_status, _MetamaskConnectEVM_getCoreOptions, _MetamaskConnectEVM_createInvokeOptions, _MetamaskConnectEVM_trackWalletActionRequested, _MetamaskConnectEVM_trackWalletActionSucceeded, _MetamaskConnectEVM_trackWalletActionFailed, _MetamaskConnectEVM_getSelectedChainId, _MetamaskConnectEVM_requestInterceptor, _MetamaskConnectEVM_clearConnectionState, _MetamaskConnectEVM_addEthereumChain, _MetamaskConnectEVM_request, _MetamaskConnectEVM_cacheChainId, _MetamaskConnectEVM_onSessionChanged, _MetamaskConnectEVM_onChainChanged, _MetamaskConnectEVM_onAccountsChanged, _MetamaskConnectEVM_onConnect, _MetamaskConnectEVM_onDisconnect, _MetamaskConnectEVM_onDisplayUri;
21
+ var _MetamaskConnectEVM_instances, _MetamaskConnectEVM_core, _MetamaskConnectEVM_provider, _MetamaskConnectEVM_sessionScopes, _MetamaskConnectEVM_eventHandlers, _MetamaskConnectEVM_sessionChangedHandler, _MetamaskConnectEVM_displayUriHandler, _MetamaskConnectEVM_removeNotificationHandler, _MetamaskConnectEVM_status, _MetamaskConnectEVM_pendingPreferredChainId, _MetamaskConnectEVM_getCoreOptions, _MetamaskConnectEVM_createInvokeOptions, _MetamaskConnectEVM_trackWalletActionRequested, _MetamaskConnectEVM_trackWalletActionSucceeded, _MetamaskConnectEVM_trackWalletActionFailed, _MetamaskConnectEVM_getSelectedChainId, _MetamaskConnectEVM_requestInterceptor, _MetamaskConnectEVM_clearConnectionState, _MetamaskConnectEVM_addEthereumChain, _MetamaskConnectEVM_request, _MetamaskConnectEVM_cacheChainId, _MetamaskConnectEVM_onSessionChanged, _MetamaskConnectEVM_onChainChanged, _MetamaskConnectEVM_onAccountsChanged, _MetamaskConnectEVM_onConnect, _MetamaskConnectEVM_onDisconnect, _MetamaskConnectEVM_onDisplayUri;
22
22
  /* eslint-disable no-restricted-syntax -- Private class properties use established patterns */
23
+ /* eslint-disable @typescript-eslint/naming-convention -- __PACKAGE_VERSION__ is an esbuild define convention */
23
24
  import { analytics } from '@metamask/analytics';
24
25
  import { parseScopeString } from '@metamask/chain-agnostic-permission';
25
26
  import { createMultichainClient, getWalletActionAnalyticsProperties, isRejectionError, TransportType, } from '@metamask/connect-multichain';
@@ -86,6 +87,13 @@ export class MetamaskConnectEVM {
86
87
  _MetamaskConnectEVM_removeNotificationHandler.set(this, void 0);
87
88
  /** The current connection status */
88
89
  _MetamaskConnectEVM_status.set(this, 'disconnected');
90
+ /**
91
+ * The preferred chain ID to use for the active connect() call.
92
+ * Set to the first explicit chainId passed by the caller, cleared once the
93
+ * connect event resolves. Takes priority over the cache in #getSelectedChainId
94
+ * so that an explicit chainIds request always wins over a prior cached value.
95
+ */
96
+ _MetamaskConnectEVM_pendingPreferredChainId.set(this, void 0);
89
97
  __classPrivateFieldSet(this, _MetamaskConnectEVM_core, core, "f");
90
98
  __classPrivateFieldSet(this, _MetamaskConnectEVM_provider, new EIP1193Provider(core, __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_requestInterceptor).bind(this)), "f");
91
99
  __classPrivateFieldSet(this, _MetamaskConnectEVM_eventHandlers, eventHandlers, "f");
@@ -130,7 +138,7 @@ export class MetamaskConnectEVM {
130
138
  * @param options - The connection options
131
139
  * @param [options.account] - Optional param to specify an account to connect to
132
140
  * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session
133
- * @param [options.chainIds] - Array of chain IDs to connect to (defaults to ethereum mainnet if not provided)
141
+ * @param [options.chainIds] - Array of chain IDs to request permission for (defaults to ethereum mainnet). The first entry is used as the active chain returned by the call. Ethereum mainnet is always included in the permission request as a bootstrap fallback.
134
142
  * @returns A promise that resolves with the connected accounts and chain ID
135
143
  */
136
144
  connect() {
@@ -140,6 +148,10 @@ export class MetamaskConnectEVM {
140
148
  if (!chainIds || chainIds.length === 0) {
141
149
  throw new Error('chainIds must be an array of at least one chain ID');
142
150
  }
151
+ // The first explicitly-requested chain is preferred for chain selection.
152
+ // DEFAULT_CHAIN_ID is still included in the permission request as a bootstrap
153
+ // fallback, but it must not win over an explicit caller request.
154
+ __classPrivateFieldSet(this, _MetamaskConnectEVM_pendingPreferredChainId, chainIds[0], "f");
143
155
  const caipChainIds = Array.from(new Set((_a = chainIds.concat(DEFAULT_CHAIN_ID)) !== null && _a !== void 0 ? _a : [DEFAULT_CHAIN_ID])).map((id) => `eip155:${hexToNumber(id)}`);
144
156
  const caipAccountIds = account
145
157
  ? caipChainIds.map((caipChainId) => `${caipChainId}:${account}`)
@@ -155,18 +167,23 @@ export class MetamaskConnectEVM {
155
167
  });
156
168
  resolve({
157
169
  accounts,
158
- chainId: chainId,
170
+ chainId,
159
171
  });
160
172
  });
161
173
  });
162
174
  yield __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").connect(caipChainIds, caipAccountIds, undefined, forceRequest);
163
- return result;
175
+ // Await here so the finally block always runs after #onSessionChanged
176
+ // has consumed #pendingPreferredChainId, not before.
177
+ return yield result;
164
178
  }
165
179
  catch (error) {
166
180
  __classPrivateFieldSet(this, _MetamaskConnectEVM_status, 'disconnected', "f");
167
181
  logger('Error connecting to wallet', error);
168
182
  throw error;
169
183
  }
184
+ finally {
185
+ __classPrivateFieldSet(this, _MetamaskConnectEVM_pendingPreferredChainId, undefined, "f");
186
+ }
170
187
  });
171
188
  }
172
189
  /**
@@ -268,7 +285,6 @@ export class MetamaskConnectEVM {
268
285
  const method = 'wallet_switchEthereumChain';
269
286
  const scope = `eip155:${hexToNumber(chainId)}`;
270
287
  const params = [{ chainId }];
271
- yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_trackWalletActionRequested).call(this, method, scope, params);
272
288
  // TODO (wenfix): better way to return here other than resolving.
273
289
  if (this.selectedChainId === chainId) {
274
290
  return Promise.resolve();
@@ -278,9 +294,9 @@ export class MetamaskConnectEVM {
278
294
  __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").transportType === TransportType.MWP) {
279
295
  yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_cacheChainId).call(this, chainId);
280
296
  __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_onChainChanged).call(this, chainId);
281
- yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_trackWalletActionSucceeded).call(this, method, scope, params);
282
297
  return Promise.resolve();
283
298
  }
299
+ yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_trackWalletActionRequested).call(this, method, scope, params);
284
300
  try {
285
301
  const result = yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_request).call(this, {
286
302
  method: 'wallet_switchEthereumChain',
@@ -368,7 +384,7 @@ export class MetamaskConnectEVM {
368
384
  return __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").status;
369
385
  }
370
386
  }
371
- _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new WeakMap(), _MetamaskConnectEVM_sessionScopes = new WeakMap(), _MetamaskConnectEVM_eventHandlers = new WeakMap(), _MetamaskConnectEVM_sessionChangedHandler = new WeakMap(), _MetamaskConnectEVM_displayUriHandler = new WeakMap(), _MetamaskConnectEVM_removeNotificationHandler = new WeakMap(), _MetamaskConnectEVM_status = new WeakMap(), _MetamaskConnectEVM_instances = new WeakSet(), _MetamaskConnectEVM_getCoreOptions = function _MetamaskConnectEVM_getCoreOptions() {
387
+ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new WeakMap(), _MetamaskConnectEVM_sessionScopes = new WeakMap(), _MetamaskConnectEVM_eventHandlers = new WeakMap(), _MetamaskConnectEVM_sessionChangedHandler = new WeakMap(), _MetamaskConnectEVM_displayUriHandler = new WeakMap(), _MetamaskConnectEVM_removeNotificationHandler = new WeakMap(), _MetamaskConnectEVM_status = new WeakMap(), _MetamaskConnectEVM_pendingPreferredChainId = new WeakMap(), _MetamaskConnectEVM_instances = new WeakSet(), _MetamaskConnectEVM_getCoreOptions = function _MetamaskConnectEVM_getCoreOptions() {
372
388
  return __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").options;
373
389
  }, _MetamaskConnectEVM_createInvokeOptions = function _MetamaskConnectEVM_createInvokeOptions(method, scope, params) {
374
390
  return {
@@ -380,7 +396,7 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
380
396
  const coreOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_getCoreOptions).call(this);
381
397
  try {
382
398
  const invokeOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_createInvokeOptions).call(this, method, scope, params);
383
- const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions);
399
+ const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").transportType);
384
400
  analytics.track('mmconnect_wallet_action_requested', props);
385
401
  }
386
402
  catch (error) {
@@ -392,7 +408,7 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
392
408
  const coreOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_getCoreOptions).call(this);
393
409
  try {
394
410
  const invokeOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_createInvokeOptions).call(this, method, scope, params);
395
- const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions);
411
+ const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").transportType);
396
412
  analytics.track('mmconnect_wallet_action_succeeded', props);
397
413
  }
398
414
  catch (error) {
@@ -404,7 +420,7 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
404
420
  const coreOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_getCoreOptions).call(this);
405
421
  try {
406
422
  const invokeOptions = __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_createInvokeOptions).call(this, method, scope, params);
407
- const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions);
423
+ const props = yield getWalletActionAnalyticsProperties(coreOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage, invokeOptions, __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").transportType);
408
424
  const isRejection = isRejectionError(error);
409
425
  if (isRejection) {
410
426
  analytics.track('mmconnect_wallet_action_rejected', props);
@@ -419,6 +435,11 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
419
435
  });
420
436
  }, _MetamaskConnectEVM_getSelectedChainId = function _MetamaskConnectEVM_getSelectedChainId(permittedChainIds) {
421
437
  return __awaiter(this, void 0, void 0, function* () {
438
+ // Honour an explicit caller preference set during an active connect() call
439
+ if (__classPrivateFieldGet(this, _MetamaskConnectEVM_pendingPreferredChainId, "f") &&
440
+ permittedChainIds.includes(__classPrivateFieldGet(this, _MetamaskConnectEVM_pendingPreferredChainId, "f"))) {
441
+ return __classPrivateFieldGet(this, _MetamaskConnectEVM_pendingPreferredChainId, "f");
442
+ }
422
443
  try {
423
444
  const cachedChainId = yield __classPrivateFieldGet(this, _MetamaskConnectEVM_core, "f").storage.adapter.get(CHAIN_STORE_KEY);
424
445
  if (cachedChainId) {
@@ -437,7 +458,6 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
437
458
  });
438
459
  }, _MetamaskConnectEVM_requestInterceptor = function _MetamaskConnectEVM_requestInterceptor(request) {
439
460
  return __awaiter(this, void 0, void 0, function* () {
440
- var _a;
441
461
  logger(`Intercepting request for method: ${request.method}`);
442
462
  if (IGNORED_METHODS.includes(request.method)) {
443
463
  // TODO: replace with correct method unsupported provider error
@@ -479,12 +499,6 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
479
499
  return __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_addEthereumChain).call(this, request.params[0]);
480
500
  }
481
501
  if (isAccountsRequest(request)) {
482
- const { method } = request;
483
- const decimalChainId = hexToNumber((_a = __classPrivateFieldGet(this, _MetamaskConnectEVM_provider, "f").selectedChainId) !== null && _a !== void 0 ? _a : '0x1');
484
- const scope = `eip155:${decimalChainId}`;
485
- const params = [];
486
- yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_trackWalletActionRequested).call(this, method, scope, params);
487
- yield __classPrivateFieldGet(this, _MetamaskConnectEVM_instances, "m", _MetamaskConnectEVM_trackWalletActionSucceeded).call(this, method, scope, params);
488
502
  return __classPrivateFieldGet(this, _MetamaskConnectEVM_provider, "f").accounts;
489
503
  }
490
504
  if (isChainIdRequest(request)) {
@@ -660,6 +674,7 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
660
674
  * @param options.dapp - Dapp identification and branding settings
661
675
  * @param options.api - API configuration including read-only RPC map
662
676
  * @param options.api.supportedNetworks - A map of hex chain IDs to RPC URLs for read-only requests
677
+ * @param [options.analytics.integrationType] - Integration type for analytics
663
678
  * @param [options.ui] - UI configuration options
664
679
  * @param [options.ui.headless] - Whether to run without UI
665
680
  * @param [options.ui.preferExtension] - Whether to prefer browser extension
@@ -676,7 +691,7 @@ _MetamaskConnectEVM_core = new WeakMap(), _MetamaskConnectEVM_provider = new Wea
676
691
  */
677
692
  export function createEVMClient(options) {
678
693
  return __awaiter(this, void 0, void 0, function* () {
679
- var _a;
694
+ var _a, _b, _c;
680
695
  if (options.debug) {
681
696
  enableDebug();
682
697
  }
@@ -696,7 +711,9 @@ export function createEVMClient(options) {
696
711
  try {
697
712
  const core = yield createMultichainClient(Object.assign(Object.assign({}, options), { api: {
698
713
  supportedNetworks: supportedNetworksCaipChainId,
699
- } }));
714
+ }, analytics: {
715
+ integrationType: (_c = (_b = options.analytics) === null || _b === void 0 ? void 0 : _b.integrationType) !== null && _c !== void 0 ? _c : 'direct',
716
+ }, versions: { 'connect-evm': __PACKAGE_VERSION__ } }));
700
717
  return MetamaskConnectEVM.create({
701
718
  core,
702
719
  eventHandlers: options.eventHandlers,
@@ -1 +1 @@
1
- {"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,8FAA8F;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAQvE,OAAO,EACL,sBAAsB,EACtB,kCAAkC,EAClC,gBAAgB,EAChB,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAW7C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAc5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,kBAAkB;IAyB7B;;;;;;;OAOG;IACH,YAAoB,EAAE,IAAI,EAAE,aAAa,EAA6B;;QAhCtE,8CAA8C;QACrC,2CAAsB;QAE/B,qDAAqD;QAC5C,+CAA2B;Q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AC,GAAG,CAAC,iBAAiB,CAC9B,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE;YAC1D,MAAM,cAAc,GAAG,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAChD,MAAM,YAAY,GAAG,UAAU,cAAc,EAAE,CAAC;YAChD,GAAG,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC;YACxB,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,sBAAsB,iCACpC,OAAO,KACV,GAAG,EAAE;oBACH,iBAAiB,EAAE,4BAA4B;iBAChD,EACD,SAAS,EAAE;oBACT,eAAe,EAAE,MAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,eAAe,mCAAI,QAAQ;iBAChE,EACD,QAAQ,EAAE,EAAE,aAAa,EAAE,mBAAmB,EAAE,IAChD,CAAC;YAEH,OAAO,kBAAkB,CAAC,MAAM,CAAC;gBAC/B,IAAI;gBACJ,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;aACjD,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAAA"}
@@ -230,7 +230,7 @@ declare class MetamaskConnectEVM {
230
230
  * @param options - The connection options
231
231
  * @param [options.account] - Optional param to specify an account to connect to
232
232
  * @param [options.forceRequest] - Optional param to force a connection request regardless of whether there is a pre-existing session
233
- * @param [options.chainIds] - Array of chain IDs to connect to (defaults to ethereum mainnet if not provided)
233
+ * @param [options.chainIds] - Array of chain IDs to request permission for (defaults to ethereum mainnet). The first entry is used as the active chain returned by the call. Ethereum mainnet is always included in the permission request as a bootstrap fallback.
234
234
  * @returns A promise that resolves with the connected accounts and chain ID
235
235
  */
236
236
  connect({ account, forceRequest, chainIds, }?: ConnectOptions): Promise<{
@@ -337,6 +337,7 @@ declare class MetamaskConnectEVM {
337
337
  * @param options.dapp - Dapp identification and branding settings
338
338
  * @param options.api - API configuration including read-only RPC map
339
339
  * @param options.api.supportedNetworks - A map of hex chain IDs to RPC URLs for read-only requests
340
+ * @param [options.analytics.integrationType] - Integration type for analytics
340
341
  * @param [options.ui] - UI configuration options
341
342
  * @param [options.ui.headless] - Whether to run without UI
342
343
  * @param [options.ui.preferExtension] - Whether to prefer browser extension
@@ -351,7 +352,7 @@ declare class MetamaskConnectEVM {
351
352
  * @param [options.debug] - Enable debug logging
352
353
  * @returns The Metamask-Connect EVM client instance
353
354
  */
354
- declare function createEVMClient(options: Pick<MultichainOptions, 'dapp' | 'mobile' | 'transport'> & {
355
+ declare function createEVMClient(options: Pick<MultichainOptions, 'dapp' | 'mobile' | 'transport' | 'analytics'> & {
355
356
  ui?: Omit<MultichainOptions['ui'], 'factory'>;
356
357
  } & {
357
358
  eventHandlers?: Partial<EventHandlers>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/connect-evm",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "EVM Layer for MetaMask Connect",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -55,9 +55,9 @@
55
55
  "test:watch": "vitest watch"
56
56
  },
57
57
  "dependencies": {
58
- "@metamask/analytics": "^0.2.0",
58
+ "@metamask/analytics": "^0.3.0",
59
59
  "@metamask/chain-agnostic-permission": "^1.2.2",
60
- "@metamask/connect-multichain": "^0.8.0",
60
+ "@metamask/connect-multichain": "^0.9.0",
61
61
  "@metamask/utils": "^11.8.1"
62
62
  },
63
63
  "devDependencies": {