@dynamic-labs/ethereum 1.1.0-alpha.0 → 1.1.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 (71) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/package.json +9 -9
  3. package/src/EthWalletConnector.cjs +7 -0
  4. package/src/EthWalletConnector.js +7 -0
  5. package/src/coinbase/client/client.cjs +2 -8
  6. package/src/coinbase/client/client.js +2 -8
  7. package/src/coinbase/coinbase.cjs +27 -8
  8. package/src/coinbase/coinbase.d.ts +2 -0
  9. package/src/coinbase/coinbase.js +27 -8
  10. package/src/ethProviderHelper.cjs +1 -4
  11. package/src/ethProviderHelper.d.ts +4 -0
  12. package/src/ethProviderHelper.js +1 -4
  13. package/src/index.cjs +4 -26
  14. package/src/index.d.ts +0 -1
  15. package/src/index.js +4 -16
  16. package/src/injected/ExodusEvm.cjs +7 -4
  17. package/src/injected/ExodusEvm.d.ts +4 -2
  18. package/src/injected/ExodusEvm.js +7 -4
  19. package/src/injected/PhantomEvm.cjs +10 -13
  20. package/src/injected/PhantomEvm.d.ts +4 -2
  21. package/src/injected/PhantomEvm.js +11 -14
  22. package/src/injected/fetchInjectedWalletConnectors.cjs +13 -2
  23. package/src/injected/fetchInjectedWalletConnectors.d.ts +1 -0
  24. package/src/injected/fetchInjectedWalletConnectors.js +13 -3
  25. package/src/injected/index.d.ts +1 -11
  26. package/src/walletConnect/client/client.cjs +2 -2
  27. package/src/walletConnect/client/client.d.ts +1 -1
  28. package/src/walletConnect/client/client.js +2 -2
  29. package/src/walletConnect/walletConnect.cjs +1 -1
  30. package/src/walletConnect/walletConnect.js +2 -2
  31. package/src/injected/BloctoInjected.cjs +0 -14
  32. package/src/injected/BloctoInjected.d.ts +0 -4
  33. package/src/injected/BloctoInjected.js +0 -10
  34. package/src/injected/BraveEvm.cjs +0 -14
  35. package/src/injected/BraveEvm.d.ts +0 -4
  36. package/src/injected/BraveEvm.js +0 -10
  37. package/src/injected/Dawn.cjs +0 -14
  38. package/src/injected/Dawn.d.ts +0 -4
  39. package/src/injected/Dawn.js +0 -10
  40. package/src/injected/Frame.cjs +0 -14
  41. package/src/injected/Frame.d.ts +0 -4
  42. package/src/injected/Frame.js +0 -10
  43. package/src/injected/GameStop.cjs +0 -14
  44. package/src/injected/GameStop.d.ts +0 -4
  45. package/src/injected/GameStop.js +0 -10
  46. package/src/injected/LegacyInjectedWalletBase.cjs +0 -83
  47. package/src/injected/LegacyInjectedWalletBase.d.ts +0 -24
  48. package/src/injected/LegacyInjectedWalletBase.js +0 -81
  49. package/src/injected/Opera.cjs +0 -14
  50. package/src/injected/Opera.d.ts +0 -4
  51. package/src/injected/Opera.js +0 -10
  52. package/src/injected/Rabby.cjs +0 -15
  53. package/src/injected/Rabby.d.ts +0 -5
  54. package/src/injected/Rabby.js +0 -11
  55. package/src/injected/Superb.cjs +0 -14
  56. package/src/injected/Superb.d.ts +0 -4
  57. package/src/injected/Superb.js +0 -10
  58. package/src/injected/Trust.cjs +0 -15
  59. package/src/injected/Trust.d.ts +0 -5
  60. package/src/injected/Trust.js +0 -11
  61. package/src/injected/Zerion.cjs +0 -15
  62. package/src/injected/Zerion.d.ts +0 -5
  63. package/src/injected/Zerion.js +0 -11
  64. package/src/injected/legacyInjectedWallets.cjs +0 -48
  65. package/src/injected/legacyInjectedWallets.d.ts +0 -3
  66. package/src/injected/legacyInjectedWallets.js +0 -43
  67. package/src/legacyEthProviderHelper.cjs +0 -187
  68. package/src/legacyEthProviderHelper.d.ts +0 -34
  69. package/src/legacyEthProviderHelper.js +0 -183
  70. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
  71. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
@@ -1,11 +1,13 @@
1
1
  import { __awaiter } from '../../_virtual/_tslib.js';
2
- import { isMobile, isSamsungBrowser } from '@dynamic-labs/utils';
3
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
+ import { isMobile, handleMobileWalletRedirect } from '@dynamic-labs/utils';
3
+ import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
4
+ import InjectedWalletBase from './InjectedWalletBase.js';
4
5
 
5
- class PhantomEvm extends LegacyInjectedWalletBase {
6
- constructor() {
7
- super(...arguments);
6
+ class PhantomEvm extends InjectedWalletBase {
7
+ constructor(props) {
8
+ super(props);
8
9
  this.name = 'PhantomEvm';
10
+ this.wallet = findWalletBookWallet(this.walletBook, this.key);
9
11
  }
10
12
  fetchPublicAddress() {
11
13
  const _super = Object.create(null, {
@@ -15,16 +17,11 @@ class PhantomEvm extends LegacyInjectedWalletBase {
15
17
  if (this.isInstalledOnBrowser()) {
16
18
  return _super.fetchPublicAddress.call(this);
17
19
  }
18
- const url = encodeURIComponent(window.location.toString());
19
- const ref = encodeURIComponent(window.location.origin);
20
- // samsung browser only supports native links, not universal links
21
20
  if (isMobile()) {
22
- if (isSamsungBrowser()) {
23
- window.location.assign(`phantom://browse/${url}?ref=${ref}`);
24
- }
25
- else {
26
- window.location.assign(`https://phantom.app/ul/browse/${url}?ref=${ref}`);
27
- }
21
+ handleMobileWalletRedirect({
22
+ nativeLink: 'phantom://browse',
23
+ universalLink: 'https://phantom.app/ul/browse',
24
+ });
28
25
  }
29
26
  return undefined;
30
27
  });
@@ -3,15 +3,25 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var InjectedWalletBase = require('./InjectedWalletBase.cjs');
6
- var legacyInjectedWallets = require('./legacyInjectedWallets.cjs');
6
+ var PhantomEvm = require('./PhantomEvm.cjs');
7
+ var ExodusEvm = require('./ExodusEvm.cjs');
7
8
 
9
+ const injectedWalletOverrides = [
10
+ PhantomEvm.PhantomEvm,
11
+ ExodusEvm.ExodusEvm,
12
+ ];
13
+ const filteredInjectedWalletKeysOverrides = [
14
+ 'phantomevm',
15
+ 'coinbase',
16
+ 'exodusevm',
17
+ ];
8
18
  const fetchInjectedWalletConnector = ({ walletBook, }) => {
9
19
  var _a;
10
20
  return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
11
21
  .filter(([key, wallet]) => {
12
22
  var _a;
13
23
  return ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'evm')) &&
14
- !legacyInjectedWallets.filteredLegacyInjectedWalletKeys.includes(key);
24
+ !filteredInjectedWalletKeysOverrides.includes(key);
15
25
  })
16
26
  .map(([key, wallet]) => {
17
27
  const { shortName } = wallet;
@@ -31,3 +41,4 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
31
41
  };
32
42
 
33
43
  exports.fetchInjectedWalletConnector = fetchInjectedWalletConnector;
44
+ exports.injectedWalletOverrides = injectedWalletOverrides;
@@ -1,5 +1,6 @@
1
1
  import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
2
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
3
+ export declare const injectedWalletOverrides: WalletConnectorConstructor[];
3
4
  export declare const fetchInjectedWalletConnector: ({ walletBook, }: {
4
5
  isWalletConnectV2Enabled: boolean;
5
6
  walletBook: WalletBookSchema;
@@ -1,13 +1,23 @@
1
1
  import InjectedWalletBase from './InjectedWalletBase.js';
2
- import { filteredLegacyInjectedWalletKeys } from './legacyInjectedWallets.js';
2
+ import { PhantomEvm } from './PhantomEvm.js';
3
+ import { ExodusEvm } from './ExodusEvm.js';
3
4
 
5
+ const injectedWalletOverrides = [
6
+ PhantomEvm,
7
+ ExodusEvm,
8
+ ];
9
+ const filteredInjectedWalletKeysOverrides = [
10
+ 'phantomevm',
11
+ 'coinbase',
12
+ 'exodusevm',
13
+ ];
4
14
  const fetchInjectedWalletConnector = ({ walletBook, }) => {
5
15
  var _a;
6
16
  return Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
7
17
  .filter(([key, wallet]) => {
8
18
  var _a;
9
19
  return ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'evm')) &&
10
- !filteredLegacyInjectedWalletKeys.includes(key);
20
+ !filteredInjectedWalletKeysOverrides.includes(key);
11
21
  })
12
22
  .map(([key, wallet]) => {
13
23
  const { shortName } = wallet;
@@ -26,4 +36,4 @@ const fetchInjectedWalletConnector = ({ walletBook, }) => {
26
36
  });
27
37
  };
28
38
 
29
- export { fetchInjectedWalletConnector };
39
+ export { fetchInjectedWalletConnector, injectedWalletOverrides };
@@ -1,13 +1,3 @@
1
- export * from './BloctoInjected';
2
- export * from './BraveEvm';
3
- export * from './Dawn';
4
- export * from './ExodusEvm';
5
- export * from './Frame';
6
- export * from './GameStop';
7
- export * from './Opera';
8
1
  export * from './PhantomEvm';
9
- export * from './Trust';
10
- export * from './Zerion';
11
- export * from './Rabby';
2
+ export * from './ExodusEvm';
12
3
  export * from './fetchInjectedWalletConnectors';
13
- export * from './legacyInjectedWallets';
@@ -12,8 +12,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
 
13
13
  var Client__default = /*#__PURE__*/_interopDefaultLegacy(Client);
14
14
 
15
- const initClient = (name, bridge, settings) => {
16
- const storageId = `walletconnect-${name}`;
15
+ const initClient = (key, bridge, settings) => {
16
+ const storageId = `walletconnect-${key}`;
17
17
  const session = localStorage.getItem(storageId);
18
18
  const clientArgs = session
19
19
  ? { session: JSON.parse(session), storageId }
@@ -2,7 +2,7 @@ import Client from '@walletconnect/client';
2
2
  import { PublicClient } from 'viem';
3
3
  import { FetchPublicAddressOpts, PayloadParams, DeepLinkVariant, WalletConnector } from '@dynamic-labs/wallet-connector-core';
4
4
  import { WalletSchema } from '@dynamic-labs/wallet-book';
5
- export declare const initClient: (name: string, bridge: string, settings?: any) => Client;
5
+ export declare const initClient: (key: string, bridge: string, settings?: any) => Client;
6
6
  /**
7
7
  * Attach event handlers to WalletConnect events.
8
8
  */
@@ -4,8 +4,8 @@ import { hashMessage } from 'viem';
4
4
  import { isSameAddress, logger, performPlatformSpecificConnectionMethod, getDeepLink } from '@dynamic-labs/wallet-connector-core';
5
5
  import { isMobile } from '@dynamic-labs/utils';
6
6
 
7
- const initClient = (name, bridge, settings) => {
8
- const storageId = `walletconnect-${name}`;
7
+ const initClient = (key, bridge, settings) => {
8
+ const storageId = `walletconnect-${key}`;
9
9
  const session = localStorage.getItem(storageId);
10
10
  const clientArgs = session
11
11
  ? { session: JSON.parse(session), storageId }
@@ -36,7 +36,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
36
36
  if (this.client) {
37
37
  return this.client;
38
38
  }
39
- this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.bridge, this.clientOptions);
39
+ this.client = client.initClient(this.key, this.bridge, this.clientOptions);
40
40
  return this.client;
41
41
  }
42
42
  supportsNetworkSwitching() {
@@ -1,7 +1,7 @@
1
1
  import { __rest, __awaiter } from '../../_virtual/_tslib.js';
2
2
  import WalletConnectProvider from '@walletconnect/ethereum-provider';
3
3
  import { createWalletClient, custom } from 'viem';
4
- import { normalizeWalletName, getDeepLink } from '@dynamic-labs/wallet-connector-core';
4
+ import { getDeepLink } 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';
@@ -28,7 +28,7 @@ class WalletConnect extends EthWalletConnector {
28
28
  if (this.client) {
29
29
  return this.client;
30
30
  }
31
- this.client = initClient(normalizeWalletName(this.name), this.bridge, this.clientOptions);
31
+ this.client = initClient(this.key, this.bridge, this.clientOptions);
32
32
  return this.client;
33
33
  }
34
34
  supportsNetworkSwitching() {
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class BloctoInjected extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'bloctoInjected';
11
- }
12
- }
13
-
14
- exports.BloctoInjected = BloctoInjected;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class BloctoInjected extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class BloctoInjected extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'bloctoInjected';
7
- }
8
- }
9
-
10
- export { BloctoInjected };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class BraveEvm extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'BraveEvm';
11
- }
12
- }
13
-
14
- exports.BraveEvm = BraveEvm;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class BraveEvm extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class BraveEvm extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'BraveEvm';
7
- }
8
- }
9
-
10
- export { BraveEvm };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class Dawn extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'Dawn';
11
- }
12
- }
13
-
14
- exports.Dawn = Dawn;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class Dawn extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class Dawn extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'Dawn';
7
- }
8
- }
9
-
10
- export { Dawn };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class Frame extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'Frame';
11
- }
12
- }
13
-
14
- exports.Frame = Frame;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class Frame extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class Frame extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'Frame';
7
- }
8
- }
9
-
10
- export { Frame };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class GameStop extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'GameStop';
11
- }
12
- }
13
-
14
- exports.GameStop = GameStop;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class GameStop extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class GameStop extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'GameStop';
7
- }
8
- }
9
-
10
- export { GameStop };
@@ -1,83 +0,0 @@
1
- 'use strict';
2
-
3
- var _tslib = require('../../_virtual/_tslib.cjs');
4
- var viem = require('viem');
5
- var walletBook = require('@dynamic-labs/wallet-book');
6
- var legacyEthProviderHelper = require('../legacyEthProviderHelper.cjs');
7
- var EthWalletConnector = require('../EthWalletConnector.cjs');
8
- var walletConnectV2 = require('../walletConnect/walletConnectV2.cjs');
9
- var walletConnect = require('../walletConnect/walletConnect.cjs');
10
-
11
- class LegacyInjectedWalletBase extends EthWalletConnector.EthWalletConnector {
12
- constructor() {
13
- super(...arguments);
14
- this.supportedChains = ['ETH', 'EVM'];
15
- this.connectedChain = 'EVM';
16
- this.walletConnectorFallback = false;
17
- }
18
- getMobileOrInstalledWallet() {
19
- var _a, _b, _c;
20
- if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
21
- const wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
22
- if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
23
- ((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
24
- return new walletConnectV2.WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
25
- }
26
- else {
27
- return new walletConnect.WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
28
- }
29
- }
30
- return this;
31
- }
32
- setupEventListeners() {
33
- const provider = legacyEthProviderHelper.LegacyEthProviderHelper.findProvider(this.name);
34
- if (!provider) {
35
- return;
36
- }
37
- const publicClient = viem.createPublicClient({ transport: viem.custom(provider) });
38
- const { tearDownEventListeners } = legacyEthProviderHelper.LegacyEthProviderHelper._setupEventListeners(this.name, this, publicClient);
39
- this.teardownEventListeners = tearDownEventListeners;
40
- }
41
- getWalletClient() {
42
- return legacyEthProviderHelper.LegacyEthProviderHelper.findWalletClient(this.name);
43
- }
44
- isInstalledOnBrowser() {
45
- return legacyEthProviderHelper.LegacyEthProviderHelper.isInstalledHelper(this.name);
46
- }
47
- connect() {
48
- return _tslib.__awaiter(this, void 0, void 0, function* () {
49
- yield this.fetchPublicAddress();
50
- });
51
- }
52
- fetchPublicAddress() {
53
- return _tslib.__awaiter(this, void 0, void 0, function* () {
54
- return legacyEthProviderHelper.LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
55
- });
56
- }
57
- signMessage(messageToSign) {
58
- return _tslib.__awaiter(this, void 0, void 0, function* () {
59
- return legacyEthProviderHelper.LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
60
- });
61
- }
62
- proveOwnership(messageToSign) {
63
- return _tslib.__awaiter(this, void 0, void 0, function* () {
64
- return this.signMessage(messageToSign);
65
- });
66
- }
67
- endSession() {
68
- return _tslib.__awaiter(this, void 0, void 0, function* () {
69
- // nothing to do on browser-based metamask
70
- return;
71
- });
72
- }
73
- providerSwitchNetwork({ network, provider, }) {
74
- const _super = Object.create(null, {
75
- providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
76
- });
77
- return _tslib.__awaiter(this, void 0, void 0, function* () {
78
- return _super.providerSwitchNetwork.call(this, { network, provider });
79
- });
80
- }
81
- }
82
-
83
- module.exports = LegacyInjectedWalletBase;
@@ -1,24 +0,0 @@
1
- import { WalletClient } from 'viem';
2
- import { Chain } from '@dynamic-labs/wallet-connector-core';
3
- import { EvmNetwork } from '@dynamic-labs/types';
4
- import { EthWalletConnector } from '../EthWalletConnector';
5
- declare abstract class LegacyInjectedWalletBase extends EthWalletConnector {
6
- supportedChains: Chain[];
7
- connectedChain: Chain;
8
- publicAddress: string | undefined;
9
- walletConnectorFallback: boolean;
10
- getMobileOrInstalledWallet(): LegacyInjectedWalletBase;
11
- setupEventListeners(): void;
12
- getWalletClient(): WalletClient | undefined;
13
- isInstalledOnBrowser(): boolean;
14
- connect(): Promise<void>;
15
- fetchPublicAddress(): Promise<string | undefined>;
16
- signMessage(messageToSign: string): Promise<string | undefined>;
17
- proveOwnership(messageToSign: string): Promise<string | undefined>;
18
- endSession(): Promise<void>;
19
- providerSwitchNetwork({ network, provider, }: {
20
- network: EvmNetwork;
21
- provider: WalletClient;
22
- }): Promise<void>;
23
- }
24
- export default LegacyInjectedWalletBase;
@@ -1,81 +0,0 @@
1
- import { __awaiter } from '../../_virtual/_tslib.js';
2
- import { createPublicClient, custom } from 'viem';
3
- import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
4
- import { LegacyEthProviderHelper } from '../legacyEthProviderHelper.js';
5
- import { EthWalletConnector } from '../EthWalletConnector.js';
6
- import { WalletConnectV2 } from '../walletConnect/walletConnectV2.js';
7
- import { WalletConnect } from '../walletConnect/walletConnect.js';
8
-
9
- class LegacyInjectedWalletBase extends EthWalletConnector {
10
- constructor() {
11
- super(...arguments);
12
- this.supportedChains = ['ETH', 'EVM'];
13
- this.connectedChain = 'EVM';
14
- this.walletConnectorFallback = false;
15
- }
16
- getMobileOrInstalledWallet() {
17
- var _a, _b, _c;
18
- if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
19
- const wallet = getWalletBookWallet(this.walletBook, this.key);
20
- if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
21
- ((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
22
- return new WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
23
- }
24
- else {
25
- return new WalletConnect(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
26
- }
27
- }
28
- return this;
29
- }
30
- setupEventListeners() {
31
- const provider = LegacyEthProviderHelper.findProvider(this.name);
32
- if (!provider) {
33
- return;
34
- }
35
- const publicClient = createPublicClient({ transport: custom(provider) });
36
- const { tearDownEventListeners } = LegacyEthProviderHelper._setupEventListeners(this.name, this, publicClient);
37
- this.teardownEventListeners = tearDownEventListeners;
38
- }
39
- getWalletClient() {
40
- return LegacyEthProviderHelper.findWalletClient(this.name);
41
- }
42
- isInstalledOnBrowser() {
43
- return LegacyEthProviderHelper.isInstalledHelper(this.name);
44
- }
45
- connect() {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- yield this.fetchPublicAddress();
48
- });
49
- }
50
- fetchPublicAddress() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- return LegacyEthProviderHelper.fetchPublicAddressWithName(this.name);
53
- });
54
- }
55
- signMessage(messageToSign) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- return LegacyEthProviderHelper.signMessageWithName(messageToSign, this.name);
58
- });
59
- }
60
- proveOwnership(messageToSign) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- return this.signMessage(messageToSign);
63
- });
64
- }
65
- endSession() {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- // nothing to do on browser-based metamask
68
- return;
69
- });
70
- }
71
- providerSwitchNetwork({ network, provider, }) {
72
- const _super = Object.create(null, {
73
- providerSwitchNetwork: { get: () => super.providerSwitchNetwork }
74
- });
75
- return __awaiter(this, void 0, void 0, function* () {
76
- return _super.providerSwitchNetwork.call(this, { network, provider });
77
- });
78
- }
79
- }
80
-
81
- export { LegacyInjectedWalletBase as default };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class Opera extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'Opera';
11
- }
12
- }
13
-
14
- exports.Opera = Opera;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class Opera extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class Opera extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'Opera';
7
- }
8
- }
9
-
10
- export { Opera };
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class Rabby extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'Rabby';
11
- this.walletConnectorFallback = true;
12
- }
13
- }
14
-
15
- exports.Rabby = Rabby;
@@ -1,5 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class Rabby extends LegacyInjectedWalletBase {
3
- name: string;
4
- walletConnectorFallback: boolean;
5
- }
@@ -1,11 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class Rabby extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'Rabby';
7
- this.walletConnectorFallback = true;
8
- }
9
- }
10
-
11
- export { Rabby };
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var LegacyInjectedWalletBase = require('./LegacyInjectedWalletBase.cjs');
6
-
7
- class Superb extends LegacyInjectedWalletBase {
8
- constructor() {
9
- super(...arguments);
10
- this.name = 'Superb';
11
- }
12
- }
13
-
14
- exports.Superb = Superb;
@@ -1,4 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase';
2
- export declare class Superb extends LegacyInjectedWalletBase {
3
- name: string;
4
- }
@@ -1,10 +0,0 @@
1
- import LegacyInjectedWalletBase from './LegacyInjectedWalletBase.js';
2
-
3
- class Superb extends LegacyInjectedWalletBase {
4
- constructor() {
5
- super(...arguments);
6
- this.name = 'Superb';
7
- }
8
- }
9
-
10
- export { Superb };