@dynamic-labs/ethereum 0.17.0-RC.12 → 0.17.0-RC.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,17 @@
1
1
 
2
+ ## [0.17.0-RC.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.12...v0.17.0-RC.13) (2023-05-10)
3
+
4
+
5
+ ### Features
6
+
7
+ * discriminate magic connectors ([#2069](https://github.com/dynamic-labs/DynamicAuth/issues/2069)) ([e9f6fd1](https://github.com/dynamic-labs/DynamicAuth/commit/e9f6fd15082364612a86d6d2a091cb8bd4eccc1f))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * add popper to fix dots menu positioning ([#2075](https://github.com/dynamic-labs/DynamicAuth/issues/2075)) ([fe945bd](https://github.com/dynamic-labs/DynamicAuth/commit/fe945bd3bcc5edeecfa0a2e7e53e30dc507c6118))
13
+ * polyfill process if not defined in global ([#2088](https://github.com/dynamic-labs/DynamicAuth/issues/2088)) ([a5d8194](https://github.com/dynamic-labs/DynamicAuth/commit/a5d81942440a6fe290c15b58b942012afe42aa00))
14
+
2
15
  ## [0.17.0-RC.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.11...v0.17.0-RC.12) (2023-05-09)
3
16
 
4
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.0-RC.12",
3
+ "version": "0.17.0-RC.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,16 +26,16 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@dynamic-labs/wallet-book": "^0.0.14",
29
+ "@dynamic-labs/wallet-book": "^0.0.15",
30
30
  "@walletconnect/client": "1.8.0",
31
31
  "@walletconnect/ethereum-provider": "1.8.0",
32
32
  "@walletconnect/universal-provider": "2.4.2",
33
33
  "ethers": "5.7.2",
34
34
  "buffer": "^6.0.3",
35
- "@dynamic-labs/rpc-providers": "0.17.0-RC.12",
36
- "@dynamic-labs/types": "0.17.0-RC.12",
37
- "@dynamic-labs/utils": "0.17.0-RC.12",
38
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.12"
35
+ "@dynamic-labs/rpc-providers": "0.17.0-RC.13",
36
+ "@dynamic-labs/types": "0.17.0-RC.13",
37
+ "@dynamic-labs/utils": "0.17.0-RC.13",
38
+ "@dynamic-labs/wallet-connector-core": "0.17.0-RC.13"
39
39
  },
40
40
  "peerDependencies": {}
41
41
  }
package/src/index.cjs CHANGED
@@ -10,9 +10,9 @@ require('@dynamic-labs/wallet-connector-core');
10
10
  require('@dynamic-labs/wallet-book');
11
11
  require('@dynamic-labs/utils');
12
12
  var EthWalletConnector = require('./EthWalletConnector.cjs');
13
- require('@walletconnect/client');
14
13
  require('@walletconnect/ethereum-provider');
15
14
  var constants = require('./constants.cjs');
15
+ require('@walletconnect/client');
16
16
  var fetchWalletConnectWallets = require('./walletConnect/fetchWalletConnectWallets.cjs');
17
17
  var ethProviderHelper = require('./ethProviderHelper.cjs');
18
18
  var BloctoInjected = require('./injected/BloctoInjected.cjs');
package/src/index.js CHANGED
@@ -7,9 +7,9 @@ import '@dynamic-labs/wallet-connector-core';
7
7
  import '@dynamic-labs/wallet-book';
8
8
  import '@dynamic-labs/utils';
9
9
  export { EthWalletConnector } from './EthWalletConnector.js';
10
- import '@walletconnect/client';
11
10
  import '@walletconnect/ethereum-provider';
12
11
  export { INFURA_ID } from './constants.js';
12
+ import '@walletconnect/client';
13
13
  import { fetchWalletConnectWallets, getWalletConnectConnector } from './walletConnect/fetchWalletConnectWallets.js';
14
14
  export { EthProviderHelper } from './ethProviderHelper.js';
15
15
  export { BloctoInjected } from './injected/BloctoInjected.js';
@@ -72,26 +72,6 @@ const killWalletConnectSession = (client) => _tslib.__awaiter(void 0, void 0, vo
72
72
  walletConnectorCore.logger.debug(e);
73
73
  }
74
74
  });
75
- const getDeepLink = (uri, metadata, { removeWCUri = false, } = {}) => {
76
- var _a, _b, _c, _d;
77
- if (!utils.isMobile()) {
78
- const origin = ((_a = metadata.desktop) === null || _a === void 0 ? void 0 : _a.universal) || ((_b = metadata.desktop) === null || _b === void 0 ? void 0 : _b.native);
79
- if (removeWCUri)
80
- return origin || '';
81
- return `${origin}?uri=${encodeURIComponent(uri !== null && uri !== void 0 ? uri : '')}`;
82
- }
83
- // deeplinks for ios require special treatment
84
- // see: https://docs.walletconnect.com/mobile-linking#for-ios
85
- else if (utils.isIOS()) {
86
- const origin = ((_c = metadata.mobile) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata.mobile) === null || _d === void 0 ? void 0 : _d.native);
87
- if (removeWCUri)
88
- return origin || '';
89
- return `${origin}?uri=${encodeURIComponent(uri !== null && uri !== void 0 ? uri : '')}`;
90
- }
91
- // on android, the deeplink is simply the uri
92
- // see: https://docs.walletconnect.com/mobile-linking#for-android
93
- return uri;
94
- };
95
75
  const createSession = (client) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
96
76
  return new Promise((resolve, reject) => {
97
77
  client.on('connect', (error, payload) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -106,7 +86,7 @@ const createSession = (client) => _tslib.__awaiter(void 0, void 0, void 0, funct
106
86
  });
107
87
  const useDeepLink = (metadata, wcClient, opts) => {
108
88
  var _a, _b, _c;
109
- const deepLink = getDeepLink(wcClient.uri, metadata);
89
+ const deepLink = walletConnectorCore.getDeepLink(wcClient.uri, metadata);
110
90
  if (utils.isMobile()) {
111
91
  window.location.href = deepLink;
112
92
  }
@@ -140,7 +120,7 @@ const signWalletConnectPersonalMessage = (messageToSign, metadata, client, rpcPr
140
120
  }
141
121
  const [accountPublicAddress] = client.accounts;
142
122
  if (utils.isMobile()) {
143
- const deepLink = getDeepLink(client.uri, metadata, {
123
+ const deepLink = walletConnectorCore.getDeepLink(client.uri, metadata, {
144
124
  removeWCUri: utils.isIOS() && isCryptoWallet,
145
125
  });
146
126
  window.location.href = deepLink;
@@ -219,7 +199,6 @@ const waitForSafeTransaction = (signature, messageToSign, contract) => _tslib.__
219
199
 
220
200
  exports.createSession = createSession;
221
201
  exports.fetchWalletConnectEVMPublicAddress = fetchWalletConnectEVMPublicAddress;
222
- exports.getDeepLink = getDeepLink;
223
202
  exports.initClient = initClient;
224
203
  exports.killWalletConnectSession = killWalletConnectSession;
225
204
  exports.setupWalletConnectEventListeners = setupWalletConnectEventListeners;
@@ -12,9 +12,6 @@ export declare const teardownWalletConnectEventListeners: (client: Client) => vo
12
12
  * Initialize a client from a stored session and terminate the connection.
13
13
  */
14
14
  export declare const killWalletConnectSession: (client: Client) => Promise<void>;
15
- export declare const getDeepLink: (uri: string, metadata: WalletSchema, { removeWCUri, }?: {
16
- removeWCUri?: boolean | undefined;
17
- }) => string;
18
15
  export declare const createSession: (client: Client) => Promise<PayloadParams>;
19
16
  export declare const useDeepLink: (metadata: WalletSchema, wcClient: Client, opts?: FetchPublicAddressOpts) => void;
20
17
  export declare const fetchWalletConnectEVMPublicAddress: (metadata: WalletSchema, wcClient: Client, opts?: FetchPublicAddressOpts) => Promise<string | undefined>;
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from '../../../_virtual/_tslib.js';
2
2
  import Client from '@walletconnect/client';
3
3
  import { Contract, ethers } from 'ethers';
4
- import { isSameAddress, logger } from '@dynamic-labs/wallet-connector-core';
4
+ import { isSameAddress, logger, getDeepLink } from '@dynamic-labs/wallet-connector-core';
5
5
  import { isMobile, isIOS } from '@dynamic-labs/utils';
6
6
 
7
7
  const initClient = (name, settings) => {
@@ -64,26 +64,6 @@ const killWalletConnectSession = (client) => __awaiter(void 0, void 0, void 0, f
64
64
  logger.debug(e);
65
65
  }
66
66
  });
67
- const getDeepLink = (uri, metadata, { removeWCUri = false, } = {}) => {
68
- var _a, _b, _c, _d;
69
- if (!isMobile()) {
70
- const origin = ((_a = metadata.desktop) === null || _a === void 0 ? void 0 : _a.universal) || ((_b = metadata.desktop) === null || _b === void 0 ? void 0 : _b.native);
71
- if (removeWCUri)
72
- return origin || '';
73
- return `${origin}?uri=${encodeURIComponent(uri !== null && uri !== void 0 ? uri : '')}`;
74
- }
75
- // deeplinks for ios require special treatment
76
- // see: https://docs.walletconnect.com/mobile-linking#for-ios
77
- else if (isIOS()) {
78
- const origin = ((_c = metadata.mobile) === null || _c === void 0 ? void 0 : _c.universal) || ((_d = metadata.mobile) === null || _d === void 0 ? void 0 : _d.native);
79
- if (removeWCUri)
80
- return origin || '';
81
- return `${origin}?uri=${encodeURIComponent(uri !== null && uri !== void 0 ? uri : '')}`;
82
- }
83
- // on android, the deeplink is simply the uri
84
- // see: https://docs.walletconnect.com/mobile-linking#for-android
85
- return uri;
86
- };
87
67
  const createSession = (client) => __awaiter(void 0, void 0, void 0, function* () {
88
68
  return new Promise((resolve, reject) => {
89
69
  client.on('connect', (error, payload) => __awaiter(void 0, void 0, void 0, function* () {
@@ -209,4 +189,4 @@ const waitForSafeTransaction = (signature, messageToSign, contract) => __awaiter
209
189
  }
210
190
  });
211
191
 
212
- export { createSession, fetchWalletConnectEVMPublicAddress, getDeepLink, initClient, killWalletConnectSession, setupWalletConnectEventListeners, signWalletConnectPersonalMessage, teardownWalletConnectEventListeners, useDeepLink };
192
+ export { createSession, fetchWalletConnectEVMPublicAddress, initClient, killWalletConnectSession, setupWalletConnectEventListeners, signWalletConnectPersonalMessage, teardownWalletConnectEventListeners, useDeepLink };
@@ -78,7 +78,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
78
78
  if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
79
79
  return undefined;
80
80
  }
81
- return client.getDeepLink(this.getClient().uri, wallet, {
81
+ return walletConnectorCore.getDeepLink(this.getClient().uri, wallet, {
82
82
  removeWCUri: utils.isIOS() && walletConnectorCore.normalizeWalletName(this.name) === 'cryptocom',
83
83
  });
84
84
  }
@@ -99,7 +99,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
99
99
  providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
100
100
  });
101
101
  return _tslib.__awaiter(this, void 0, void 0, function* () {
102
- const client$1 = this.getClient();
102
+ const client = this.getClient();
103
103
  const currentNetworkId = yield this.getNetwork();
104
104
  if (currentNetworkId && currentNetworkId === network.chainId) {
105
105
  return;
@@ -111,11 +111,11 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
111
111
  if (!this.supportsNetworkSwitching()) {
112
112
  throw new utils.DynamicError('Network switching not supported');
113
113
  }
114
- if (!client$1) {
114
+ if (!client) {
115
115
  throw new utils.DynamicError('Client not found');
116
116
  }
117
117
  if (utils.isMobile()) {
118
- const deepLink = client.getDeepLink(client$1.uri, walletBook.getWalletBookWallet(this.name));
118
+ const deepLink = walletConnectorCore.getDeepLink(client.uri, walletBook.getWalletBookWallet(this.name));
119
119
  window.location.href = deepLink;
120
120
  }
121
121
  return _super.providerSwitchNetwork.call(this, { network, provider });
@@ -1,12 +1,12 @@
1
1
  import { __rest, __awaiter } from '../../_virtual/_tslib.js';
2
2
  import WalletConnectProvider from '@walletconnect/ethereum-provider';
3
3
  import { ethers } from 'ethers';
4
- import { normalizeWalletName } from '@dynamic-labs/wallet-connector-core';
4
+ import { normalizeWalletName, getDeepLink } from '@dynamic-labs/wallet-connector-core';
5
5
  import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
6
6
  import { isMobile, isIOS, DynamicError } from '@dynamic-labs/utils';
7
7
  import { EthWalletConnector } from '../EthWalletConnector.js';
8
8
  import { INFURA_ID } from '../constants.js';
9
- import { initClient, setupWalletConnectEventListeners, teardownWalletConnectEventListeners, fetchWalletConnectEVMPublicAddress, getDeepLink, signWalletConnectPersonalMessage, killWalletConnectSession } from './client/client.js';
9
+ import { initClient, setupWalletConnectEventListeners, teardownWalletConnectEventListeners, fetchWalletConnectEVMPublicAddress, signWalletConnectPersonalMessage, killWalletConnectSession } from './client/client.js';
10
10
 
11
11
  class WalletConnect extends EthWalletConnector {
12
12
  constructor(_a) {
@@ -9,7 +9,6 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
9
  var walletBook = require('@dynamic-labs/wallet-book');
10
10
  var utils = require('@dynamic-labs/utils');
11
11
  var EthWalletConnector = require('../EthWalletConnector.cjs');
12
- var client = require('./client/client.cjs');
13
12
 
14
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
14
 
@@ -18,12 +17,12 @@ var Provider__default = /*#__PURE__*/_interopDefaultLegacy(Provider);
18
17
  const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
19
18
  var _a, _b, _c;
20
19
  if (utils.isMobile()) {
21
- const deepLink = client.getDeepLink(uri, metadata);
20
+ const deepLink = walletConnectorCore.getDeepLink(uri, metadata);
22
21
  window.location.href = deepLink;
23
22
  }
24
23
  else {
25
24
  if ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
26
- const desktopUri = client.getDeepLink(uri, metadata);
25
+ const desktopUri = walletConnectorCore.getDeepLink(uri, metadata);
27
26
  (_b = opts === null || opts === void 0 ? void 0 : opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, desktopUri);
28
27
  }
29
28
  (_c = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
@@ -135,7 +134,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
135
134
  if (!utils.isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
136
135
  return undefined;
137
136
  }
138
- return client.getDeepLink(WalletConnectV2.provider.uri, wallet);
137
+ return walletConnectorCore.getDeepLink(WalletConnectV2.provider.uri, wallet);
139
138
  }
140
139
  getWeb3Provider() {
141
140
  if (!WalletConnectV2.provider) {
@@ -205,7 +204,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
205
204
  if (utils.isMobile()) {
206
205
  // for sign message, no uri is needed because the uri encodes connection details,
207
206
  // and at this point we are already connected
208
- const deepLink = client.getDeepLink('', metadata);
207
+ const deepLink = walletConnectorCore.getDeepLink('', metadata);
209
208
  window.location.href = deepLink;
210
209
  }
211
210
  // eslint-disable-next-line prefer-destructuring
@@ -1,11 +1,10 @@
1
1
  import { __awaiter } from '../../_virtual/_tslib.js';
2
2
  import Provider from '@walletconnect/universal-provider';
3
3
  import { ethers } from 'ethers';
4
- import { logger, utf8ToHex } from '@dynamic-labs/wallet-connector-core';
4
+ import { logger, getDeepLink, utf8ToHex } from '@dynamic-labs/wallet-connector-core';
5
5
  import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
6
6
  import { isMobile, DynamicError } from '@dynamic-labs/utils';
7
7
  import { EthWalletConnector } from '../EthWalletConnector.js';
8
- import { getDeepLink } from './client/client.js';
9
8
 
10
9
  const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
11
10
  var _a, _b, _c;