@dynamic-labs/ethereum 2.0.0-alpha.1 → 2.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/package.json +9 -11
  3. package/src/EthWalletConnector.cjs +1 -20
  4. package/src/EthWalletConnector.d.ts +9 -10
  5. package/src/EthWalletConnector.js +3 -22
  6. package/src/coinbase/coinbase.cjs +3 -4
  7. package/src/coinbase/coinbase.d.ts +15 -14
  8. package/src/coinbase/coinbase.js +3 -4
  9. package/src/index.cjs +6 -12
  10. package/src/index.d.ts +1 -0
  11. package/src/index.js +5 -11
  12. package/src/injected/ExodusEvm.cjs +1 -0
  13. package/src/injected/ExodusEvm.d.ts +1 -0
  14. package/src/injected/ExodusEvm.js +1 -0
  15. package/src/injected/InjectedWalletBase.cjs +1 -9
  16. package/src/injected/InjectedWalletBase.js +1 -9
  17. package/src/injected/PhantomEvm.cjs +1 -0
  18. package/src/injected/PhantomEvm.d.ts +1 -0
  19. package/src/injected/PhantomEvm.js +1 -0
  20. package/src/injected/fetchInjectedWalletConnectors.d.ts +0 -1
  21. package/src/walletConnect/fetchWalletConnectWallets.cjs +14 -33
  22. package/src/walletConnect/fetchWalletConnectWallets.d.ts +2 -5
  23. package/src/walletConnect/fetchWalletConnectWallets.js +14 -33
  24. package/src/walletConnect/index.d.ts +1 -2
  25. package/src/walletConnect/walletConnect.cjs +411 -76
  26. package/src/walletConnect/walletConnect.d.ts +308 -27
  27. package/src/walletConnect/walletConnect.js +410 -76
  28. package/src/walletConnect/client/client.cjs +0 -201
  29. package/src/walletConnect/client/client.d.ts +0 -17
  30. package/src/walletConnect/client/client.js +0 -187
  31. package/src/walletConnect/client/index.d.ts +0 -1
  32. package/src/walletConnect/client/types.d.ts +0 -4
  33. package/src/walletConnect/walletConnectV2.cjs +0 -475
  34. package/src/walletConnect/walletConnectV2.d.ts +0 -333
  35. package/src/walletConnect/walletConnectV2.js +0 -466
@@ -4,7 +4,6 @@ var _tslib = require('../../_virtual/_tslib.cjs');
4
4
  var walletBook = require('@dynamic-labs/wallet-book');
5
5
  var ethProviderHelper = require('../ethProviderHelper.cjs');
6
6
  var EthWalletConnector = require('../EthWalletConnector.cjs');
7
- var walletConnectV2 = require('../walletConnect/walletConnectV2.cjs');
8
7
  var walletConnect = require('../walletConnect/walletConnect.cjs');
9
8
 
10
9
  class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
@@ -27,17 +26,10 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
27
26
  return this.ethProviderHelper;
28
27
  }
29
28
  getMobileOrInstalledWallet() {
30
- var _a, _b, _c, _d;
31
29
  if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
32
30
  if (!this.wallet)
33
31
  this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
34
- if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
35
- ((_d = (_c = (_b = this.wallet) === null || _b === void 0 ? void 0 : _b.walletConnect) === null || _c === void 0 ? void 0 : _c.sdks) === null || _d === void 0 ? void 0 : _d.includes('sign_v2'))) {
36
- return new walletConnectV2.WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
37
- }
38
- else {
39
- return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
40
- }
32
+ return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
41
33
  }
42
34
  return this;
43
35
  }
@@ -2,7 +2,6 @@ import { __awaiter } from '../../_virtual/_tslib.js';
2
2
  import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
3
3
  import { EthProviderHelper } from '../ethProviderHelper.js';
4
4
  import { EthWalletConnector } from '../EthWalletConnector.js';
5
- import { WalletConnectV2 } from '../walletConnect/walletConnectV2.js';
6
5
  import { WalletConnect } from '../walletConnect/walletConnect.js';
7
6
 
8
7
  class InjectedWalletBase extends EthWalletConnector {
@@ -25,17 +24,10 @@ class InjectedWalletBase extends EthWalletConnector {
25
24
  return this.ethProviderHelper;
26
25
  }
27
26
  getMobileOrInstalledWallet() {
28
- var _a, _b, _c, _d;
29
27
  if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
30
28
  if (!this.wallet)
31
29
  this.wallet = findWalletBookWallet(this.walletBook, this.key);
32
- if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
33
- ((_d = (_c = (_b = this.wallet) === null || _b === void 0 ? void 0 : _b.walletConnect) === null || _c === void 0 ? void 0 : _c.sdks) === null || _d === void 0 ? void 0 : _d.includes('sign_v2'))) {
34
- return new WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
35
- }
36
- else {
37
- return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
38
- }
30
+ return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
39
31
  }
40
32
  return this;
41
33
  }
@@ -11,6 +11,7 @@ class PhantomEvm extends InjectedWalletBase {
11
11
  constructor(props) {
12
12
  super(props);
13
13
  this.name = 'PhantomEvm';
14
+ this.overrideKey = 'phantomevm';
14
15
  this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
15
16
  }
16
17
  fetchPublicAddress() {
@@ -2,6 +2,7 @@ import { EthWalletConnectorOpts } from '..';
2
2
  import InjectedWalletBase from './InjectedWalletBase';
3
3
  export declare class PhantomEvm extends InjectedWalletBase {
4
4
  name: string;
5
+ overrideKey: string;
5
6
  constructor(props: EthWalletConnectorOpts);
6
7
  fetchPublicAddress(): Promise<string | undefined>;
7
8
  }
@@ -7,6 +7,7 @@ class PhantomEvm extends InjectedWalletBase {
7
7
  constructor(props) {
8
8
  super(props);
9
9
  this.name = 'PhantomEvm';
10
+ this.overrideKey = 'phantomevm';
10
11
  this.wallet = findWalletBookWallet(this.walletBook, this.key);
11
12
  }
12
13
  fetchPublicAddress() {
@@ -2,6 +2,5 @@ import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core'
2
2
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
3
3
  export declare const injectedWalletOverrides: WalletConnectorConstructor[];
4
4
  export declare const fetchInjectedWalletConnector: ({ walletBook, }: {
5
- isWalletConnectV2Enabled: boolean;
6
5
  walletBook: WalletBookSchema;
7
6
  }) => WalletConnectorConstructor[];
@@ -2,47 +2,28 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletConnectV2 = require('./walletConnectV2.cjs');
6
5
  var walletConnect = require('./walletConnect.cjs');
7
6
 
8
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
7
+ const fetchWalletConnectWallets = ({ walletBook, }) => {
9
8
  var _a;
10
- return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
11
- .filter((wallet) => wallet.walletConnect && !wallet.filterFromWalletConnect)
12
- .map((wallet) => {
13
- var _a;
9
+ return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
10
+ .filter(([, wallet]) => wallet.walletConnect && !wallet.filterFromWalletConnect)
11
+ .map(([key, wallet]) => {
14
12
  const { shortName } = wallet;
15
13
  const name = shortName || wallet.name;
16
- // justification: we filtered out null/undefined above
17
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
18
- if (isWalletConnectV2Enabled &&
19
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
20
- return class extends walletConnectV2.WalletConnectV2 {
21
- constructor(props) {
22
- super(Object.assign(Object.assign({}, props), { walletName: name }));
23
- }
24
- };
25
- }
26
- else {
27
- return class extends walletConnect.WalletConnect {
28
- constructor(props) {
29
- super(Object.assign(Object.assign({}, props), { walletName: name }));
30
- }
31
- };
32
- }
14
+ return class extends walletConnect.WalletConnect {
15
+ constructor(props) {
16
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
17
+ this.overrideKey = key;
18
+ }
19
+ };
33
20
  });
34
21
  };
35
- const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
36
- ? class extends walletConnectV2.WalletConnectV2 {
37
- constructor(props) {
38
- super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
39
- }
22
+ const getWalletConnectConnector = () => class extends walletConnect.WalletConnect {
23
+ constructor(props) {
24
+ super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
40
25
  }
41
- : class extends walletConnect.WalletConnect {
42
- constructor(props) {
43
- super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
44
- }
45
- };
26
+ };
46
27
 
47
28
  exports.fetchWalletConnectWallets = fetchWalletConnectWallets;
48
29
  exports.getWalletConnectConnector = getWalletConnectConnector;
@@ -1,9 +1,6 @@
1
1
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
2
2
  import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
3
- export declare const fetchWalletConnectWallets: ({ isWalletConnectV2Enabled, walletBook, }: {
4
- isWalletConnectV2Enabled: boolean;
3
+ export declare const fetchWalletConnectWallets: ({ walletBook, }: {
5
4
  walletBook: WalletBookSchema;
6
5
  }) => Array<WalletConnectorConstructor>;
7
- export declare const getWalletConnectConnector: ({ isWalletConnectV2Enabled, }: {
8
- isWalletConnectV2Enabled: boolean;
9
- }) => WalletConnectorConstructor;
6
+ export declare const getWalletConnectConnector: () => WalletConnectorConstructor;
@@ -1,43 +1,24 @@
1
- import { WalletConnectV2 } from './walletConnectV2.js';
2
1
  import { WalletConnect } from './walletConnect.js';
3
2
 
4
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
3
+ const fetchWalletConnectWallets = ({ walletBook, }) => {
5
4
  var _a;
6
- return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
7
- .filter((wallet) => wallet.walletConnect && !wallet.filterFromWalletConnect)
8
- .map((wallet) => {
9
- var _a;
5
+ return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
6
+ .filter(([, wallet]) => wallet.walletConnect && !wallet.filterFromWalletConnect)
7
+ .map(([key, wallet]) => {
10
8
  const { shortName } = wallet;
11
9
  const name = shortName || wallet.name;
12
- // justification: we filtered out null/undefined above
13
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14
- if (isWalletConnectV2Enabled &&
15
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
16
- return class extends WalletConnectV2 {
17
- constructor(props) {
18
- super(Object.assign(Object.assign({}, props), { walletName: name }));
19
- }
20
- };
21
- }
22
- else {
23
- return class extends WalletConnect {
24
- constructor(props) {
25
- super(Object.assign(Object.assign({}, props), { walletName: name }));
26
- }
27
- };
28
- }
10
+ return class extends WalletConnect {
11
+ constructor(props) {
12
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
13
+ this.overrideKey = key;
14
+ }
15
+ };
29
16
  });
30
17
  };
31
- const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
32
- ? class extends WalletConnectV2 {
33
- constructor(props) {
34
- super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
35
- }
18
+ const getWalletConnectConnector = () => class extends WalletConnect {
19
+ constructor(props) {
20
+ super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
36
21
  }
37
- : class extends WalletConnect {
38
- constructor(props) {
39
- super(Object.assign(Object.assign({}, props), { walletName: 'WalletConnect' }));
40
- }
41
- };
22
+ };
42
23
 
43
24
  export { fetchWalletConnectWallets, getWalletConnectConnector };
@@ -1,3 +1,2 @@
1
- export { WalletConnectV2, type WalletConnectorV2Opts } from './walletConnectV2';
2
- export { WalletConnect } from './walletConnect';
1
+ export { WalletConnect, type WalletConnectOpts } from './walletConnect';
3
2
  export { fetchWalletConnectWallets } from './fetchWalletConnectWallets';