@dynamic-labs/ethereum 4.20.11 → 4.20.13

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
@@ -1,4 +1,25 @@
1
1
 
2
+ ### [4.20.13](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.12...v4.20.13) (2025-07-02)
3
+
4
+
5
+ ### Features
6
+
7
+ * add createWalletClient method to ZeroDevExtension ([#9036](https://github.com/dynamic-labs/dynamic-auth/issues/9036)) ([674df45](https://github.com/dynamic-labs/dynamic-auth/commit/674df45f21e76070594963c2e3b7c19ba94e3004))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * allow to retry metamask deeplink ([#9066](https://github.com/dynamic-labs/dynamic-auth/issues/9066)) ([308c0d2](https://github.com/dynamic-labs/dynamic-auth/commit/308c0d2ddd7a5c7460f31d25365687b315b0a0f4))
13
+
14
+ ### [4.20.12](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.11...v4.20.12) (2025-07-01)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * bring back braavos mobile deeplink support ([#9041](https://github.com/dynamic-labs/dynamic-auth/issues/9041)) ([90a7eb6](https://github.com/dynamic-labs/dynamic-auth/commit/90a7eb620f6bd27d4560e88fe5542a121e586bed))
20
+ * start exchange funding errors should be logged as error ([#9056](https://github.com/dynamic-labs/dynamic-auth/issues/9056)) ([ba122af](https://github.com/dynamic-labs/dynamic-auth/commit/ba122afb68c462fe8627828bd20f9cc5f92803ff))
21
+ * WC redirect on mobile ([#9063](https://github.com/dynamic-labs/dynamic-auth/issues/9063)) ([f43aa4a](https://github.com/dynamic-labs/dynamic-auth/commit/f43aa4aedea20e3baf012f4778f5e6a47c27515c))
22
+
2
23
  ### [4.20.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.10...v4.20.11) (2025-07-01)
3
24
 
4
25
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.11";
6
+ var version = "4.20.13";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.11";
2
+ var version = "4.20.13";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "4.20.11",
3
+ "version": "4.20.13",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -23,16 +23,16 @@
23
23
  "eventemitter3": "5.0.1",
24
24
  "buffer": "6.0.3",
25
25
  "@metamask/sdk": "0.33.0",
26
- "@dynamic-labs/assert-package-version": "4.20.11",
27
- "@dynamic-labs/embedded-wallet-evm": "4.20.11",
28
- "@dynamic-labs/ethereum-core": "4.20.11",
29
- "@dynamic-labs/logger": "4.20.11",
30
- "@dynamic-labs/rpc-providers": "4.20.11",
31
- "@dynamic-labs/types": "4.20.11",
32
- "@dynamic-labs/utils": "4.20.11",
33
- "@dynamic-labs/waas-evm": "4.20.11",
34
- "@dynamic-labs/wallet-book": "4.20.11",
35
- "@dynamic-labs/wallet-connector-core": "4.20.11"
26
+ "@dynamic-labs/assert-package-version": "4.20.13",
27
+ "@dynamic-labs/embedded-wallet-evm": "4.20.13",
28
+ "@dynamic-labs/ethereum-core": "4.20.13",
29
+ "@dynamic-labs/logger": "4.20.13",
30
+ "@dynamic-labs/rpc-providers": "4.20.13",
31
+ "@dynamic-labs/types": "4.20.13",
32
+ "@dynamic-labs/utils": "4.20.13",
33
+ "@dynamic-labs/waas-evm": "4.20.13",
34
+ "@dynamic-labs/wallet-book": "4.20.13",
35
+ "@dynamic-labs/wallet-connector-core": "4.20.13"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "viem": "^2.28.4"
@@ -22,29 +22,19 @@ class InjectedWalletBase extends ethereumCore.EthereumWalletConnector {
22
22
  return this._ethProviderHelper;
23
23
  }
24
24
  getMobileOrInstalledWallet() {
25
- var _a;
26
- if (this.isInstalledOnBrowser()) {
27
- return this;
28
- }
29
- // this is to handle the case where the user is in a webview.
30
- // when the user is in a webview, customers should set the deepLinkPreference prop to universal,
31
- // in which case this condition will be false, and the SDK will use WalletConnect (if available)
32
- if (((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl) &&
33
- this.mobileExperience === 'in-app-browser' &&
34
- utils.isMobile()) {
35
- return this;
36
- }
37
- // this is the case where the wallet is not installed on the browser and
38
- // it does not support WalletConnect. in this case, the SDK will instruct
39
- // the user to download the wallet extension
40
- if (!this.walletConnectorFallback) {
41
- return this;
42
- }
43
- // if there is no WC project ID, we should not use WC
44
- if (!this.constructorProps.projectId) {
45
- logger.logger.debug('[InjectedWalletBase] getMobileOrInstalledWallet - No WC project ID');
25
+ // can use WC if the wallet has WC setting in wallet book and projectId is set
26
+ const canUseWalletConnect = this.walletConnectorFallback && this.constructorProps.projectId;
27
+ logger.logger.logVerboseTroubleshootingMessage('[InjectedWalletBase] getMobileOrInstalledWallet', {
28
+ canUseWalletConnect,
29
+ isInstalledOnBrowser: this.isInstalledOnBrowser(),
30
+ projectId: this.constructorProps.projectId,
31
+ walletConnectorFallback: this.walletConnectorFallback,
32
+ });
33
+ // if the wallet is installed on the browser or WC is not available, return the injected connector
34
+ if (this.isInstalledOnBrowser() || !canUseWalletConnect) {
46
35
  return this;
47
36
  }
37
+ // if the wallet is not installed on the browser and WC is available, return the WC connector
48
38
  return new WalletConnectConnector.WalletConnectConnector(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
49
39
  }
50
40
  findProvider() {
@@ -18,29 +18,19 @@ class InjectedWalletBase extends EthereumWalletConnector {
18
18
  return this._ethProviderHelper;
19
19
  }
20
20
  getMobileOrInstalledWallet() {
21
- var _a;
22
- if (this.isInstalledOnBrowser()) {
23
- return this;
24
- }
25
- // this is to handle the case where the user is in a webview.
26
- // when the user is in a webview, customers should set the deepLinkPreference prop to universal,
27
- // in which case this condition will be false, and the SDK will use WalletConnect (if available)
28
- if (((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl) &&
29
- this.mobileExperience === 'in-app-browser' &&
30
- isMobile()) {
31
- return this;
32
- }
33
- // this is the case where the wallet is not installed on the browser and
34
- // it does not support WalletConnect. in this case, the SDK will instruct
35
- // the user to download the wallet extension
36
- if (!this.walletConnectorFallback) {
37
- return this;
38
- }
39
- // if there is no WC project ID, we should not use WC
40
- if (!this.constructorProps.projectId) {
41
- logger.debug('[InjectedWalletBase] getMobileOrInstalledWallet - No WC project ID');
21
+ // can use WC if the wallet has WC setting in wallet book and projectId is set
22
+ const canUseWalletConnect = this.walletConnectorFallback && this.constructorProps.projectId;
23
+ logger.logVerboseTroubleshootingMessage('[InjectedWalletBase] getMobileOrInstalledWallet', {
24
+ canUseWalletConnect,
25
+ isInstalledOnBrowser: this.isInstalledOnBrowser(),
26
+ projectId: this.constructorProps.projectId,
27
+ walletConnectorFallback: this.walletConnectorFallback,
28
+ });
29
+ // if the wallet is installed on the browser or WC is not available, return the injected connector
30
+ if (this.isInstalledOnBrowser() || !canUseWalletConnect) {
42
31
  return this;
43
32
  }
33
+ // if the wallet is not installed on the browser and WC is available, return the WC connector
44
34
  return new WalletConnectConnector(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
45
35
  }
46
36
  findProvider() {
@@ -20,6 +20,7 @@ var waitForConnection = require('./utils/waitForConnection.cjs');
20
20
  */
21
21
  let _metaMaskSDK = null;
22
22
  let _metaMaskDisplayUri = null;
23
+ let _metaMaskConnectUri = null;
23
24
  const eventTimeline = utils.createEventTimeline();
24
25
  const setMetaMaskDisplayUri = (displayUri) => {
25
26
  _metaMaskDisplayUri = displayUri;
@@ -93,7 +94,15 @@ class MetaMaskConnector extends InjectedWalletBase.InjectedWalletBase {
93
94
  extensionOnly: this.isInstalledOnBrowser(),
94
95
  headless: true,
95
96
  injectProvider: false,
96
- openDeeplink: utils.PlatformService.openURL,
97
+ openDeeplink: (url) => {
98
+ if (url.includes('://connect')) {
99
+ _metaMaskConnectUri = url;
100
+ }
101
+ else {
102
+ _metaMaskConnectUri = null;
103
+ }
104
+ utils.PlatformService.openURL(url);
105
+ },
97
106
  preferDesktop: !utils.isMobile(),
98
107
  readonlyRPCMap: getReadonlyRPCMap(this.evmNetworkRpcMap()),
99
108
  useDeeplink: true,
@@ -111,6 +120,7 @@ class MetaMaskConnector extends InjectedWalletBase.InjectedWalletBase {
111
120
  if (utils.isMobile()) {
112
121
  return this.metaMaskSDK.terminate().then(() => {
113
122
  _metaMaskSDK = null;
123
+ _metaMaskConnectUri = null;
114
124
  return this.createMetaMaskSDK();
115
125
  });
116
126
  }
@@ -420,6 +430,11 @@ class MetaMaskConnector extends InjectedWalletBase.InjectedWalletBase {
420
430
  getConnectionUri() {
421
431
  return _metaMaskDisplayUri !== null && _metaMaskDisplayUri !== void 0 ? _metaMaskDisplayUri : undefined;
422
432
  }
433
+ retryDeeplinkConnection() {
434
+ if (_metaMaskConnectUri) {
435
+ utils.PlatformService.openURL(_metaMaskConnectUri);
436
+ }
437
+ }
423
438
  }
424
439
  // Utils
425
440
  const getReadonlyRPCMap = (evmNetworkRpcMap) => Object.keys(evmNetworkRpcMap).reduce((acc, chainId) => (Object.assign(Object.assign({}, acc), { [viem.toHex(parseInt(chainId))]: evmNetworkRpcMap[chainId] })), {});
@@ -51,4 +51,5 @@ export declare class MetaMaskConnector extends InjectedWalletBase implements IWa
51
51
  private getIsInAppBrowser;
52
52
  private shouldDeepLinkToMetaMaskInAppBrowser;
53
53
  getConnectionUri(): string | undefined;
54
+ retryDeeplinkConnection(): void;
54
55
  }
@@ -16,6 +16,7 @@ import { waitForConnection } from './utils/waitForConnection.js';
16
16
  */
17
17
  let _metaMaskSDK = null;
18
18
  let _metaMaskDisplayUri = null;
19
+ let _metaMaskConnectUri = null;
19
20
  const eventTimeline = createEventTimeline();
20
21
  const setMetaMaskDisplayUri = (displayUri) => {
21
22
  _metaMaskDisplayUri = displayUri;
@@ -89,7 +90,15 @@ class MetaMaskConnector extends InjectedWalletBase {
89
90
  extensionOnly: this.isInstalledOnBrowser(),
90
91
  headless: true,
91
92
  injectProvider: false,
92
- openDeeplink: PlatformService.openURL,
93
+ openDeeplink: (url) => {
94
+ if (url.includes('://connect')) {
95
+ _metaMaskConnectUri = url;
96
+ }
97
+ else {
98
+ _metaMaskConnectUri = null;
99
+ }
100
+ PlatformService.openURL(url);
101
+ },
93
102
  preferDesktop: !isMobile(),
94
103
  readonlyRPCMap: getReadonlyRPCMap(this.evmNetworkRpcMap()),
95
104
  useDeeplink: true,
@@ -107,6 +116,7 @@ class MetaMaskConnector extends InjectedWalletBase {
107
116
  if (isMobile()) {
108
117
  return this.metaMaskSDK.terminate().then(() => {
109
118
  _metaMaskSDK = null;
119
+ _metaMaskConnectUri = null;
110
120
  return this.createMetaMaskSDK();
111
121
  });
112
122
  }
@@ -416,6 +426,11 @@ class MetaMaskConnector extends InjectedWalletBase {
416
426
  getConnectionUri() {
417
427
  return _metaMaskDisplayUri !== null && _metaMaskDisplayUri !== void 0 ? _metaMaskDisplayUri : undefined;
418
428
  }
429
+ retryDeeplinkConnection() {
430
+ if (_metaMaskConnectUri) {
431
+ PlatformService.openURL(_metaMaskConnectUri);
432
+ }
433
+ }
419
434
  }
420
435
  // Utils
421
436
  const getReadonlyRPCMap = (evmNetworkRpcMap) => Object.keys(evmNetworkRpcMap).reduce((acc, chainId) => (Object.assign(Object.assign({}, acc), { [toHex(parseInt(chainId))]: evmNetworkRpcMap[chainId] })), {});
@@ -93,7 +93,24 @@ class WalletConnectConnector extends ethereumCore.EthereumWalletConnector {
93
93
  }
94
94
  getAddress(opts) {
95
95
  return _tslib.__awaiter(this, void 0, void 0, function* () {
96
+ var _a, _b;
96
97
  walletConnectorCore.logger.debug('[WalletConnect] getAddress', opts);
98
+ walletConnectorCore.logger.logVerboseTroubleshootingMessage('[WalletConnectConnector] getAddress', {
99
+ inAppBrowserUrl: (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl,
100
+ isMobile: utils.isMobile(),
101
+ mobileExperience: this.mobileExperience,
102
+ });
103
+ if (utils.isMobile() &&
104
+ ((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.inAppBrowserUrl) &&
105
+ this.mobileExperience === 'in-app-browser') {
106
+ const inAppBrowserCompiledTemplate = utils.template(this.metadata.inAppBrowserUrl);
107
+ const { href } = utils.PlatformService.getUrl();
108
+ const deepLink = inAppBrowserCompiledTemplate({
109
+ encodedDappURI: encodeURIComponent(href),
110
+ });
111
+ utils.PlatformService.openURL(deepLink);
112
+ return;
113
+ }
97
114
  const provider = yield WalletConnectProvider.WalletConnectProvider.awaitAndGetProvider();
98
115
  walletConnectorCore.logger.debug('[WalletConnect] getAddress - connecting to WalletConnect', {
99
116
  provider,
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { createWalletClient, custom } from 'viem';
4
4
  import { toAccount } from 'viem/accounts';
5
5
  import { EthereumWalletConnector, chainsMap, normalizeRpcError } from '@dynamic-labs/ethereum-core';
6
- import { StorageService, parseIntSafe, DynamicError, isMobile, PlatformService } from '@dynamic-labs/utils';
6
+ import { StorageService, parseIntSafe, DynamicError, isMobile, template, PlatformService } from '@dynamic-labs/utils';
7
7
  import { logger, getDeepLink } from '@dynamic-labs/wallet-connector-core';
8
8
  import { WalletConnectProvider } from '../WalletConnectProvider/WalletConnectProvider.js';
9
9
 
@@ -89,7 +89,24 @@ class WalletConnectConnector extends EthereumWalletConnector {
89
89
  }
90
90
  getAddress(opts) {
91
91
  return __awaiter(this, void 0, void 0, function* () {
92
+ var _a, _b;
92
93
  logger.debug('[WalletConnect] getAddress', opts);
94
+ logger.logVerboseTroubleshootingMessage('[WalletConnectConnector] getAddress', {
95
+ inAppBrowserUrl: (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl,
96
+ isMobile: isMobile(),
97
+ mobileExperience: this.mobileExperience,
98
+ });
99
+ if (isMobile() &&
100
+ ((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.inAppBrowserUrl) &&
101
+ this.mobileExperience === 'in-app-browser') {
102
+ const inAppBrowserCompiledTemplate = template(this.metadata.inAppBrowserUrl);
103
+ const { href } = PlatformService.getUrl();
104
+ const deepLink = inAppBrowserCompiledTemplate({
105
+ encodedDappURI: encodeURIComponent(href),
106
+ });
107
+ PlatformService.openURL(deepLink);
108
+ return;
109
+ }
93
110
  const provider = yield WalletConnectProvider.awaitAndGetProvider();
94
111
  logger.debug('[WalletConnect] getAddress - connecting to WalletConnect', {
95
112
  provider,