@dynamic-labs/ethereum 2.0.0-alpha.24 → 2.0.0-alpha.26

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,32 @@
1
1
 
2
+ ## [2.0.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.25...v2.0.0-alpha.26) (2024-04-08)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * add onWalletAdded/onWalletRemoved callbacks and removed onConnect/onDisconnect/onLinkSuccess/onUnlinkSuccess (#5194)
8
+ * note:
9
+ - use "events" in favour of "eventsCallbacks"
10
+ - use "handlers.handleConnectedWallet" in favour of "eventsCallbacks.onBeforeConnectSuccessConfirmation"
11
+
12
+ ### Bug Fixes
13
+
14
+ * coinbase wallet settings ([#5233](https://github.com/dynamic-labs/DynamicAuth/issues/5233)) ([1b04411](https://github.com/dynamic-labs/DynamicAuth/commit/1b04411eb90db438f3eacf622d9c28db4c7cf532))
15
+ * remove local storage settings on logout ([#5212](https://github.com/dynamic-labs/DynamicAuth/issues/5212)) ([e686628](https://github.com/dynamic-labs/DynamicAuth/commit/e686628f602a44cd13083e7bb9afb4f50304390e))
16
+ * show app name or logo in sign message modal ([#5225](https://github.com/dynamic-labs/DynamicAuth/issues/5225)) ([a77b6ba](https://github.com/dynamic-labs/DynamicAuth/commit/a77b6ba9b5646b400ebf933949dabe06a35d1c81))
17
+ * user wallets not being cleared immediately when logout is called ([#5211](https://github.com/dynamic-labs/DynamicAuth/issues/5211)) ([a649c46](https://github.com/dynamic-labs/DynamicAuth/commit/a649c462d171cf6f8d67159df9f5f2144f315e5c))
18
+
19
+
20
+ * add onWalletAdded/onWalletRemoved callbacks and removed onConnect/onDisconnect/onLinkSuccess/onUnlinkSuccess ([#5194](https://github.com/dynamic-labs/DynamicAuth/issues/5194)) ([fdec78c](https://github.com/dynamic-labs/DynamicAuth/commit/fdec78c1c32c58c8f7dc7ffd9b877320aa4d90e0))
21
+ * rename eventsCallbacks to events ([#5196](https://github.com/dynamic-labs/DynamicAuth/issues/5196)) ([5797185](https://github.com/dynamic-labs/DynamicAuth/commit/5797185c18fa091032ef27043b63a1d5201b5e23))
22
+
23
+ ## [2.0.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2024-04-04)
24
+
25
+
26
+ ### Features
27
+
28
+ * add in-app browser deeplink for metamask ([#5176](https://github.com/dynamic-labs/DynamicAuth/issues/5176)) ([02ce607](https://github.com/dynamic-labs/DynamicAuth/commit/02ce6077ed0deeaefc7a62ee91ff72f5bce2b327)), closes [#5123](https://github.com/dynamic-labs/DynamicAuth/issues/5123)
29
+
2
30
  ## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
3
31
 
4
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "2.0.0-alpha.24",
3
+ "version": "2.0.0-alpha.26",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,17 +26,17 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@coinbase/wallet-sdk": "3.9.2",
29
+ "@coinbase/wallet-sdk": "3.9.3",
30
30
  "@walletconnect/ethereum-provider": "2.11.2",
31
31
  "eventemitter3": "5.0.1",
32
32
  "buffer": "6.0.3",
33
- "@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.24",
34
- "@dynamic-labs/turnkey": "2.0.0-alpha.24",
35
- "@dynamic-labs/types": "2.0.0-alpha.24",
36
- "@dynamic-labs/utils": "2.0.0-alpha.24",
37
- "@dynamic-labs/viem-utils": "2.0.0-alpha.24",
38
- "@dynamic-labs/wallet-book": "2.0.0-alpha.24",
39
- "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.24",
33
+ "@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.26",
34
+ "@dynamic-labs/turnkey": "2.0.0-alpha.26",
35
+ "@dynamic-labs/types": "2.0.0-alpha.26",
36
+ "@dynamic-labs/utils": "2.0.0-alpha.26",
37
+ "@dynamic-labs/viem-utils": "2.0.0-alpha.26",
38
+ "@dynamic-labs/wallet-book": "2.0.0-alpha.26",
39
+ "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.26",
40
40
  "stream": "0.0.2"
41
41
  },
42
42
  "peerDependencies": {
@@ -6,14 +6,9 @@ var _tslib = require('../../_virtual/_tslib.cjs');
6
6
  var viem = require('viem');
7
7
  var walletBook = require('@dynamic-labs/wallet-book');
8
8
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
- require('../polyfills.cjs');
10
- require('@dynamic-labs/turnkey');
11
- require('@dynamic-labs/utils');
12
9
  var ethProviderHelper = require('../ethProviderHelper.cjs');
13
10
  var EthWalletConnector = require('../EthWalletConnector.cjs');
14
- require('../walletConnect/walletConnect.cjs');
15
11
  var client = require('./client/client.cjs');
16
- require('@dynamic-labs/rpc-provider-ethereum');
17
12
 
18
13
  class Coinbase extends EthWalletConnector.EthWalletConnector {
19
14
  constructor(_a) {
@@ -1,5 +1,5 @@
1
1
  import { Chain, GetAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
- import { EthProviderHelper } from '..';
2
+ import { EthProviderHelper } from '../ethProviderHelper';
3
3
  import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
4
4
  type CoinbaseOpts = EthWalletConnectorOpts & {
5
5
  appLogoUrl?: string;
@@ -2,14 +2,9 @@ import { __rest, __awaiter } from '../../_virtual/_tslib.js';
2
2
  import { createWalletClient, custom } from 'viem';
3
3
  import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
4
4
  import { eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
5
- import '../polyfills.js';
6
- import '@dynamic-labs/turnkey';
7
- import '@dynamic-labs/utils';
8
5
  import { EthProviderHelper } from '../ethProviderHelper.js';
9
6
  import { EthWalletConnector } from '../EthWalletConnector.js';
10
- import '../walletConnect/walletConnect.js';
11
7
  import { getCoinbaseProvider, getAddress, signMessage, killCoinbaseSession } from './client/client.js';
12
- import '@dynamic-labs/rpc-provider-ethereum';
13
8
 
14
9
  class Coinbase extends EthWalletConnector {
15
10
  constructor(_a) {
@@ -26,12 +26,24 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
26
26
  return this.ethProviderHelper;
27
27
  }
28
28
  getMobileOrInstalledWallet() {
29
- if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
30
- if (!this.wallet)
31
- this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
32
- return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
29
+ var _a, _b;
30
+ if (!this.wallet) {
31
+ this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
32
+ }
33
+ if (this.isInstalledOnBrowser()) {
34
+ return this;
35
+ }
36
+ if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
37
+ this.constructorProps.deepLinkPreference !== 'universal') {
38
+ return this;
39
+ }
40
+ // this is the case where the wallet is not installed on the browser and
41
+ // it does not support WalletConnect. in this case, the SDK will instruct
42
+ // the user to download the wallet extension
43
+ if (!this.walletConnectorFallback) {
44
+ return this;
33
45
  }
34
- return this;
46
+ return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
35
47
  }
36
48
  setupEventListeners() {
37
49
  const provider = this.getWalletClient();
@@ -24,12 +24,24 @@ class InjectedWalletBase extends EthWalletConnector {
24
24
  return this.ethProviderHelper;
25
25
  }
26
26
  getMobileOrInstalledWallet() {
27
- if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
28
- if (!this.wallet)
29
- this.wallet = findWalletBookWallet(this.walletBook, this.key);
30
- return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
27
+ var _a, _b;
28
+ if (!this.wallet) {
29
+ this.wallet = findWalletBookWallet(this.walletBook, this.key);
30
+ }
31
+ if (this.isInstalledOnBrowser()) {
32
+ return this;
33
+ }
34
+ if (((_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.mobile) === null || _b === void 0 ? void 0 : _b.inAppBrowser) &&
35
+ this.constructorProps.deepLinkPreference !== 'universal') {
36
+ return this;
37
+ }
38
+ // this is the case where the wallet is not installed on the browser and
39
+ // it does not support WalletConnect. in this case, the SDK will instruct
40
+ // the user to download the wallet extension
41
+ if (!this.walletConnectorFallback) {
42
+ return this;
31
43
  }
32
- return this;
44
+ return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
33
45
  }
34
46
  setupEventListeners() {
35
47
  const provider = this.getWalletClient();
@@ -1,23 +1,10 @@
1
+ import { WalletSchema } from '@dynamic-labs/wallet-book';
1
2
  import { EthWalletConnectorOpts } from '../EthWalletConnector';
2
3
  import InjectedWalletBase from './InjectedWalletBase';
3
4
  export declare class Zerion extends InjectedWalletBase {
4
5
  name: string;
5
6
  overrideKey: string;
6
- wallet: {
7
- eip6963Config: {
8
- rdns: string;
9
- };
10
- filterFromWalletConnect: boolean;
11
- injectedConfig: {
12
- chain: string;
13
- extensionLocators: {
14
- flag: string;
15
- value: boolean;
16
- }[];
17
- windowLocations: string[];
18
- }[];
19
- name: string;
20
- };
7
+ wallet: WalletSchema;
21
8
  constructor(props: EthWalletConnectorOpts);
22
9
  isInstalledOnBrowser(): boolean;
23
10
  }
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _tslib = require('../../_virtual/_tslib.cjs');
6
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
5
7
  var InjectedWalletBase = require('./InjectedWalletBase.cjs');
6
8
  var PhantomEvm = require('./PhantomEvm.cjs');
7
9
  var ExodusEvm = require('./ExodusEvm.cjs');
@@ -39,6 +41,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
39
41
  // this is the key from the wallet book entry so that we don't purely rely on the normalized name
40
42
  this.overrideKey = key;
41
43
  }
44
+ getAddress() {
45
+ const _super = Object.create(null, {
46
+ getAddress: { get: () => super.getAddress }
47
+ });
48
+ var _a;
49
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
50
+ if (this.isInstalledOnBrowser()) {
51
+ return _super.getAddress.call(this);
52
+ }
53
+ const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
54
+ if (!inAppBrowserBase) {
55
+ const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
56
+ walletConnectorCore.logger.error(error.message);
57
+ throw error;
58
+ }
59
+ const cleanedTargetUrl = window.location.href.replace('https://', '');
60
+ window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
61
+ return undefined;
62
+ });
63
+ }
42
64
  };
43
65
  });
44
66
  };
@@ -1,3 +1,5 @@
1
+ import { __awaiter } from '../../_virtual/_tslib.js';
2
+ import { logger } from '@dynamic-labs/wallet-connector-core';
1
3
  import InjectedWalletBase from './InjectedWalletBase.js';
2
4
  import { PhantomEvm } from './PhantomEvm.js';
3
5
  import { ExodusEvm } from './ExodusEvm.js';
@@ -35,6 +37,26 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
35
37
  // this is the key from the wallet book entry so that we don't purely rely on the normalized name
36
38
  this.overrideKey = key;
37
39
  }
40
+ getAddress() {
41
+ const _super = Object.create(null, {
42
+ getAddress: { get: () => super.getAddress }
43
+ });
44
+ var _a;
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ if (this.isInstalledOnBrowser()) {
47
+ return _super.getAddress.call(this);
48
+ }
49
+ const inAppBrowserBase = (_a = this.wallet.mobile) === null || _a === void 0 ? void 0 : _a.inAppBrowser;
50
+ if (!inAppBrowserBase) {
51
+ const error = new Error(`No inAppBrowserBase found for ${this.name}.`);
52
+ logger.error(error.message);
53
+ throw error;
54
+ }
55
+ const cleanedTargetUrl = window.location.href.replace('https://', '');
56
+ window.location.href = `${inAppBrowserBase}/${cleanedTargetUrl}`;
57
+ return undefined;
58
+ });
59
+ }
38
60
  };
39
61
  });
40
62
  };