@dynamic-labs/ethereum 0.18.0-RC.0 → 0.18.0-RC.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,161 @@
1
1
 
2
+ ## [0.18.0-RC.10](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.9...v0.18.0-RC.10) (2023-07-06)
3
+
4
+
5
+ ### Features
6
+
7
+ * Update handleUnlink to support connected only wallets ([#2573](https://github.com/dynamic-labs/DynamicAuth/issues/2573)) ([07438c9](https://github.com/dynamic-labs/DynamicAuth/commit/07438c9580b830aa68fcc6a06ea4050a3743a501))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * restore connectedWallet clearing function ([#2575](https://github.com/dynamic-labs/DynamicAuth/issues/2575)) ([8d3c41a](https://github.com/dynamic-labs/DynamicAuth/commit/8d3c41a6871037b1003270e724259f23c5f6f370))
13
+
14
+ ## [0.18.0-RC.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.8...v0.18.0-RC.9) (2023-07-04)
15
+
16
+
17
+ ### Features
18
+
19
+ * add Network Not Supported prompt to connect-only & show prompt before sign in connect-sign mode ([#2474](https://github.com/dynamic-labs/DynamicAuth/issues/2474)) ([8d5bfa9](https://github.com/dynamic-labs/DynamicAuth/commit/8d5bfa97ca4da50e06ce258a38a63e7407a795f6))
20
+ * **DYN-2602:** add ability to unlink connected wallet ([#2494](https://github.com/dynamic-labs/DynamicAuth/issues/2494)) ([389861b](https://github.com/dynamic-labs/DynamicAuth/commit/389861bc0281baec379b1593e529cef3467f3326))
21
+ * **DYN-2604:** add chainId property to walletsByChain object ([#2405](https://github.com/dynamic-labs/DynamicAuth/issues/2405)) ([d9b42f7](https://github.com/dynamic-labs/DynamicAuth/commit/d9b42f7b1d53dac1ed0228ecb5e56a44c6abd8d2))
22
+ * **DynamicAuthLayout:** show connected wallet progress ([#2567](https://github.com/dynamic-labs/DynamicAuth/issues/2567)) ([a20ff6f](https://github.com/dynamic-labs/DynamicAuth/commit/a20ff6f32b360ccc699d2a271c7a96751ae87d29))
23
+ * **DynamicBridgeFlow:** add bridge flow ([#2543](https://github.com/dynamic-labs/DynamicAuth/issues/2543)) ([79c4c87](https://github.com/dynamic-labs/DynamicAuth/commit/79c4c870d47a0c853c292a8d913bd9be9e209a15))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * don't force required chain to eth in case is not enabled ([#2537](https://github.com/dynamic-labs/DynamicAuth/issues/2537)) ([b01d6c9](https://github.com/dynamic-labs/DynamicAuth/commit/b01d6c9e91e9971e82739c5a2c900de4768f977c))
29
+ * log out if there's any session sync issue ([#2545](https://github.com/dynamic-labs/DynamicAuth/issues/2545)) ([29972fa](https://github.com/dynamic-labs/DynamicAuth/commit/29972fad1067f5550a61f6e2cd9adcaf811fd268))
30
+ * persist chain to WalletConnect session when changed in wallet ([#2556](https://github.com/dynamic-labs/DynamicAuth/issues/2556)) ([fc9ec35](https://github.com/dynamic-labs/DynamicAuth/commit/fc9ec3501de1e3235adee4df95b296dc22cce23e))
31
+ * WC2 sign-message on non-selected chain ([#2544](https://github.com/dynamic-labs/DynamicAuth/issues/2544)) ([48a4384](https://github.com/dynamic-labs/DynamicAuth/commit/48a4384f77c29775e0c28ed335956cfbd6f89ca3))
32
+ * **wcv2:** add eth_signTypedData_v4 to optional methods ([#2527](https://github.com/dynamic-labs/DynamicAuth/issues/2527)) ([b99474b](https://github.com/dynamic-labs/DynamicAuth/commit/b99474b81b083134762be0fe9554a6f049b3edda))
33
+ * **wcv2:** allow getWeb3Provider to wait to provider init ([#2523](https://github.com/dynamic-labs/DynamicAuth/issues/2523)) ([d9c7fee](https://github.com/dynamic-labs/DynamicAuth/commit/d9c7fee10d2a6c766043515e19829fd7e3d5b2ef))
34
+
35
+ ## [0.18.0-RC.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.7...v0.18.0-RC.8) (2023-06-29)
36
+
37
+
38
+ ### Features
39
+
40
+ * add support for custom walletconnect v1 bridge ([#2487](https://github.com/dynamic-labs/DynamicAuth/issues/2487)) ([5b0ca2e](https://github.com/dynamic-labs/DynamicAuth/commit/5b0ca2e4e8aa241ed13e4f38346c31da8479a6c4))
41
+ * **DYN-2623:** improve error message on sign cancellation for wallets ([#2493](https://github.com/dynamic-labs/DynamicAuth/issues/2493)) ([081c515](https://github.com/dynamic-labs/DynamicAuth/commit/081c515c9d28d6fa4c0eaac388ee421a7b23144b))
42
+
43
+
44
+ ### Bug Fixes
45
+
46
+ * clearing the activeAccount value ([#2469](https://github.com/dynamic-labs/DynamicAuth/issues/2469)) ([ff75bde](https://github.com/dynamic-labs/DynamicAuth/commit/ff75bde938a4178541568b79754f773607b9d87f))
47
+ * don't initialize provider if it's already initialized ([#2490](https://github.com/dynamic-labs/DynamicAuth/issues/2490)) ([878d38f](https://github.com/dynamic-labs/DynamicAuth/commit/878d38f5c8d7d7448c65e58b25cefd9f3518217e))
48
+ * more wcv2 improvements ([#2475](https://github.com/dynamic-labs/DynamicAuth/issues/2475)) ([13baa84](https://github.com/dynamic-labs/DynamicAuth/commit/13baa84218d6259d02df7d8c387b40dc3cb11ce5)), closes [#2469](https://github.com/dynamic-labs/DynamicAuth/issues/2469) [#2470](https://github.com/dynamic-labs/DynamicAuth/issues/2470) [#2471](https://github.com/dynamic-labs/DynamicAuth/issues/2471) [#2477](https://github.com/dynamic-labs/DynamicAuth/issues/2477) [#2479](https://github.com/dynamic-labs/DynamicAuth/issues/2479) [#2471](https://github.com/dynamic-labs/DynamicAuth/issues/2471) [#2476](https://github.com/dynamic-labs/DynamicAuth/issues/2476)
49
+ * multiple improvements for WC2 ([#2458](https://github.com/dynamic-labs/DynamicAuth/issues/2458)) ([0813af2](https://github.com/dynamic-labs/DynamicAuth/commit/0813af2aafa8019868117084efe8ae147ac24581))
50
+ * revert changes since latest wcv2 improvements ([#2473](https://github.com/dynamic-labs/DynamicAuth/issues/2473)) ([3375371](https://github.com/dynamic-labs/DynamicAuth/commit/337537101a13d67b860748b62f172eba01d0b461)), closes [#2471](https://github.com/dynamic-labs/DynamicAuth/issues/2471) [#2470](https://github.com/dynamic-labs/DynamicAuth/issues/2470) [#2469](https://github.com/dynamic-labs/DynamicAuth/issues/2469)
51
+ * sync issue within connect-only mode ([#2496](https://github.com/dynamic-labs/DynamicAuth/issues/2496)) ([44af274](https://github.com/dynamic-labs/DynamicAuth/commit/44af274618c30fe65ec95739cd16a8ddde08e34e))
52
+ * typo in terms of service ([#2401](https://github.com/dynamic-labs/DynamicAuth/issues/2401)) ([5b195e5](https://github.com/dynamic-labs/DynamicAuth/commit/5b195e54479d9a88bd017fc45f2f2455d1caedc4))
53
+ * **wc_v1_bridget:** disable WC v2 when WC v1 bridge is set ([#2505](https://github.com/dynamic-labs/DynamicAuth/issues/2505)) ([b3f0a68](https://github.com/dynamic-labs/DynamicAuth/commit/b3f0a6895095bb37c635984fc970b52446e04f56))
54
+ * wc2 android improvements ([#2488](https://github.com/dynamic-labs/DynamicAuth/issues/2488)) ([f60ef9c](https://github.com/dynamic-labs/DynamicAuth/commit/f60ef9c1dd672f78199eee40edbe2707c043e1b5))
55
+ * **wcv2:** make sure to clear active account when ending session ([#2471](https://github.com/dynamic-labs/DynamicAuth/issues/2471)) ([b766df3](https://github.com/dynamic-labs/DynamicAuth/commit/b766df39a7e4dabc54fda9131b7bd9b53895cf2f))
56
+ * **wcv2:** use native or universal link when signing message ([#2502](https://github.com/dynamic-labs/DynamicAuth/issues/2502)) ([6e3e3fb](https://github.com/dynamic-labs/DynamicAuth/commit/6e3e3fbb58fb9e3eb314e6631ac2123237f41e8c))
57
+
58
+ ## [0.18.0-RC.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.6...v0.18.0-RC.7) (2023-06-23)
59
+
60
+
61
+ ### Features
62
+
63
+ * add bridge connect button ([#2399](https://github.com/dynamic-labs/DynamicAuth/issues/2399)) ([6987eea](https://github.com/dynamic-labs/DynamicAuth/commit/6987eeae8f49a5d077de6c4343b83ecbb1fc8b89))
64
+ * add useTimeout, useInterval and useIsomorphicLayoutEffect hooks ([#2418](https://github.com/dynamic-labs/DynamicAuth/issues/2418)) ([3ed8595](https://github.com/dynamic-labs/DynamicAuth/commit/3ed859526a6ec982b61a4335a9a63512d0e631e3))
65
+ * **DYN-2411:** WalletLockedView when user has valid jwt and all of their wallets are disconnected ([#2273](https://github.com/dynamic-labs/DynamicAuth/issues/2273)) ([2e6d0d6](https://github.com/dynamic-labs/DynamicAuth/commit/2e6d0d6ed734eb628bd05b6ad64560c496ad915f))
66
+ * **DYN-2598:** add powered by, update copy and paddings in the select wallet chain layout ([#2391](https://github.com/dynamic-labs/DynamicAuth/issues/2391)) ([f2a7924](https://github.com/dynamic-labs/DynamicAuth/commit/f2a79241dcf1ea5720242c2cc65a6fcd077ea0e9))
67
+ * **solana:** add logic to get network based on genesis hash ([#2402](https://github.com/dynamic-labs/DynamicAuth/issues/2402)) ([b76c626](https://github.com/dynamic-labs/DynamicAuth/commit/b76c62660bae334aef84678db5d8349a3d575630))
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * better handling of the CB wallet provider ([#2376](https://github.com/dynamic-labs/DynamicAuth/issues/2376)) ([720e510](https://github.com/dynamic-labs/DynamicAuth/commit/720e510d0793c530d06db5eaa1d5a7be608703bb))
73
+ * clear AUTH_USER when there is no AUTH_TOKEN on LS ([#2423](https://github.com/dynamic-labs/DynamicAuth/issues/2423)) ([bf1e1c0](https://github.com/dynamic-labs/DynamicAuth/commit/bf1e1c0f8a7a7a852c67ef363613deecacdad92e))
74
+ * set auth mode to connect-and-sign when verifiying wallet ([#2369](https://github.com/dynamic-labs/DynamicAuth/issues/2369)) ([666aa69](https://github.com/dynamic-labs/DynamicAuth/commit/666aa6954d19551a354af933a69ab8eeee7a98b5))
75
+ * use getAuthTokenValue in initExpirationTime ([#2422](https://github.com/dynamic-labs/DynamicAuth/issues/2422)) ([fa8ff78](https://github.com/dynamic-labs/DynamicAuth/commit/fa8ff78d64421ca4447794fe9af53c175adf94c3))
76
+
77
+ ## [0.18.0-RC.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.5...v0.18.0-RC.6) (2023-06-20)
78
+
79
+
80
+ ### Features
81
+
82
+ * add export keys option for magic wallets ([#2377](https://github.com/dynamic-labs/DynamicAuth/issues/2377)) ([6b40f53](https://github.com/dynamic-labs/DynamicAuth/commit/6b40f538f207691b54fe2f245ed6018c467b83fe))
83
+
84
+
85
+ ### Bug Fixes
86
+
87
+ * add polyfill for css layers ([#2386](https://github.com/dynamic-labs/DynamicAuth/issues/2386)) ([3d489f5](https://github.com/dynamic-labs/DynamicAuth/commit/3d489f59d676864134a94d031697e0f83fc0d742))
88
+
89
+ ## [0.18.0-RC.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.4...v0.18.0-RC.5) (2023-06-20)
90
+
91
+
92
+ ### Bug Fixes
93
+
94
+ * remove process variable declaration ([#2389](https://github.com/dynamic-labs/DynamicAuth/issues/2389)) ([3c05121](https://github.com/dynamic-labs/DynamicAuth/commit/3c05121473850444f2c8393fa6e98e10d58870bc))
95
+ * wallet book singleton class to initalize when walletBook is undefined ([#2392](https://github.com/dynamic-labs/DynamicAuth/issues/2392)) ([7e07137](https://github.com/dynamic-labs/DynamicAuth/commit/7e0713712321439ee48e0c9ec88fef8c9aecd9cf))
96
+
97
+ ## [0.18.0-RC.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.3...v0.18.0-RC.4) (2023-06-20)
98
+
99
+
100
+ ### ⚠ BREAKING CHANGES
101
+
102
+ * **DYN-1260:** integrate wallets group view with group logic (#2305)
103
+
104
+ ### Features
105
+
106
+ * **DYN-1260:** integrate wallets group view with group logic ([#2305](https://github.com/dynamic-labs/DynamicAuth/issues/2305)) ([d5adb41](https://github.com/dynamic-labs/DynamicAuth/commit/d5adb411f263d1583abe5102e60d02573c6bf416))
107
+
108
+
109
+ ### Bug Fixes
110
+
111
+ * **DYN-2507:** too long network name shrinks users avatar ([#2383](https://github.com/dynamic-labs/DynamicAuth/issues/2383)) ([8586c3b](https://github.com/dynamic-labs/DynamicAuth/commit/8586c3be5a499118b7229eb7a3702d3350642107))
112
+ * hide wallet menu items that are not needed ([#2375](https://github.com/dynamic-labs/DynamicAuth/issues/2375)) ([35a6723](https://github.com/dynamic-labs/DynamicAuth/commit/35a67234da47f1a992a94c17e445b1fcba1c700f))
113
+ * use overflow auto to avoid showing the disabled scrollbar on gecko browser ([#2382](https://github.com/dynamic-labs/DynamicAuth/issues/2382)) ([16a7db4](https://github.com/dynamic-labs/DynamicAuth/commit/16a7db49e5b154bc6a4ea263c8a8c8a92cf1d810))
114
+ * use primary color for wallet group item copy ([#2384](https://github.com/dynamic-labs/DynamicAuth/issues/2384)) ([3fe439e](https://github.com/dynamic-labs/DynamicAuth/commit/3fe439ea2a271bc4b24b145db3f70774e221723e))
115
+
116
+ ## [0.18.0-RC.3](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.2...v0.18.0-RC.3) (2023-06-16)
117
+
118
+
119
+ ### Features
120
+
121
+ * add skeleton to walletlistfooter ([#2361](https://github.com/dynamic-labs/DynamicAuth/issues/2361)) ([676be6c](https://github.com/dynamic-labs/DynamicAuth/commit/676be6c108dff8df7175f0587cf0568658276e4e))
122
+
123
+
124
+ ### Bug Fixes
125
+
126
+ * **local-storage:** load auth token when stringified ([#2368](https://github.com/dynamic-labs/DynamicAuth/issues/2368)) ([3a54266](https://github.com/dynamic-labs/DynamicAuth/commit/3a54266fde3cd1f7362ccc490f89b8925132271b))
127
+
128
+ ## [0.18.0-RC.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.1...v0.18.0-RC.2) (2023-06-16)
129
+
130
+
131
+ ### Features
132
+
133
+ * add Dynamic Bridge widget ([#2316](https://github.com/dynamic-labs/DynamicAuth/issues/2316)) ([0e71a88](https://github.com/dynamic-labs/DynamicAuth/commit/0e71a88c6dd740583448ed7b45fa335aaa736079))
134
+ * add search bar to bridge wallets view ([#2357](https://github.com/dynamic-labs/DynamicAuth/issues/2357)) ([a8415fc](https://github.com/dynamic-labs/DynamicAuth/commit/a8415fc744216660a78c1443962711699e45429a))
135
+ * bridge flow improvements ([#2367](https://github.com/dynamic-labs/DynamicAuth/issues/2367)) ([38a44be](https://github.com/dynamic-labs/DynamicAuth/commit/38a44be417fd1363b0d8e45ec1834f9aaf680427))
136
+ * **Bridge:** add bridge navigation component ([#2340](https://github.com/dynamic-labs/DynamicAuth/issues/2340)) ([1e9adae](https://github.com/dynamic-labs/DynamicAuth/commit/1e9adaed3682bc9a7aab385221818946cad397f2))
137
+ * **Bridge:** integrate dynamic bridge ui ([#2354](https://github.com/dynamic-labs/DynamicAuth/issues/2354)) ([1465bf8](https://github.com/dynamic-labs/DynamicAuth/commit/1465bf8717cbc9905285c2d867bc3e1d0cd1114b))
138
+ * **DYN-2519:** create state for multiple connected wallets ([#2326](https://github.com/dynamic-labs/DynamicAuth/issues/2326)) ([fc05aa4](https://github.com/dynamic-labs/DynamicAuth/commit/fc05aa4d91b0af8950c5da84c69130557ba36b09)), closes [#2319](https://github.com/dynamic-labs/DynamicAuth/issues/2319)
139
+ * **MultiWalletStepSelectorModal:** add modal to connect multiple wallets ([#2348](https://github.com/dynamic-labs/DynamicAuth/issues/2348)) ([39ce0b2](https://github.com/dynamic-labs/DynamicAuth/commit/39ce0b26fdf6494a4e1ba7867e80bf399d11631f))
140
+ * use wallet-book from CDN ([#2352](https://github.com/dynamic-labs/DynamicAuth/issues/2352)) ([9d1498f](https://github.com/dynamic-labs/DynamicAuth/commit/9d1498f2aec4bb9f3e3d6b386d9cafea3a33bd58))
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * handle email only without primary wallet state ([#2342](https://github.com/dynamic-labs/DynamicAuth/issues/2342)) ([98583bb](https://github.com/dynamic-labs/DynamicAuth/commit/98583bb8820ac80967bf1059cbaf47d04bfd603a))
146
+ * s3 cp for walletbook json ([8127b79](https://github.com/dynamic-labs/DynamicAuth/commit/8127b790333b36f40a2cc230a576c01aaad42196))
147
+ * setting initial view when error in auth flow ([#2345](https://github.com/dynamic-labs/DynamicAuth/issues/2345)) ([85dcefb](https://github.com/dynamic-labs/DynamicAuth/commit/85dcefb54be498b540904b381b53f9ea7e0cd024))
148
+ * typo in github action ([d746bc0](https://github.com/dynamic-labs/DynamicAuth/commit/d746bc01981a3263e3ab4f654debf77b408cda3a))
149
+ * **widget:** add fallback icon when oauth provider does not exist ([#2349](https://github.com/dynamic-labs/DynamicAuth/issues/2349)) ([bd2a505](https://github.com/dynamic-labs/DynamicAuth/commit/bd2a505724affd6f5356c0c4f31586ffd188e539))
150
+
151
+ ## [0.18.0-RC.1](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.0...v0.18.0-RC.1) (2023-06-14)
152
+
153
+
154
+ ### Bug Fixes
155
+
156
+ * await setEmailInput in handleSubmit for LoginWithemailForm ([#2336](https://github.com/dynamic-labs/DynamicAuth/issues/2336)) ([05b1fe0](https://github.com/dynamic-labs/DynamicAuth/commit/05b1fe09abaa1563fb187cf410b1e0e991f29c60))
157
+ * don't remove project settings from ls if there's a connected wallet ([#2329](https://github.com/dynamic-labs/DynamicAuth/issues/2329)) ([bc2f627](https://github.com/dynamic-labs/DynamicAuth/commit/bc2f627a80d0a8e6a4637dc60c699ffd07362a19))
158
+
2
159
  ## [0.18.0-RC.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0...v0.18.0-RC.0) (2023-06-14)
3
160
 
4
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.18.0-RC.0",
3
+ "version": "0.18.0-RC.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -28,14 +28,15 @@
28
28
  "dependencies": {
29
29
  "@walletconnect/client": "1.8.0",
30
30
  "@walletconnect/ethereum-provider": "1.8.0",
31
- "@walletconnect/universal-provider": "2.8.0",
31
+ "@walletconnect/universal-provider": "2.8.3",
32
32
  "ethers": "5.7.2",
33
+ "eventemitter3": "5.0.1",
33
34
  "buffer": "6.0.3",
34
- "@dynamic-labs/rpc-providers": "0.18.0-RC.0",
35
- "@dynamic-labs/types": "0.18.0-RC.0",
36
- "@dynamic-labs/utils": "0.18.0-RC.0",
37
- "@dynamic-labs/wallet-book": "0.18.0-RC.0",
38
- "@dynamic-labs/wallet-connector-core": "0.18.0-RC.0"
35
+ "@dynamic-labs/rpc-providers": "0.18.0-RC.10",
36
+ "@dynamic-labs/types": "0.18.0-RC.10",
37
+ "@dynamic-labs/utils": "0.18.0-RC.10",
38
+ "@dynamic-labs/wallet-book": "0.18.0-RC.10",
39
+ "@dynamic-labs/wallet-connector-core": "0.18.0-RC.10"
39
40
  },
40
41
  "peerDependencies": {}
41
42
  }
@@ -32,6 +32,9 @@ class EthProviderHelper {
32
32
  if (window.zerionWallet) {
33
33
  ethereumProviders.push(window.zerionWallet);
34
34
  }
35
+ if (window.coinbaseWalletExtension) {
36
+ ethereumProviders.push(window.coinbaseWalletExtension);
37
+ }
35
38
  if (window.superb) {
36
39
  ethereumProviders.push(window.superb);
37
40
  }
@@ -28,6 +28,9 @@ class EthProviderHelper {
28
28
  if (window.zerionWallet) {
29
29
  ethereumProviders.push(window.zerionWallet);
30
30
  }
31
+ if (window.coinbaseWalletExtension) {
32
+ ethereumProviders.push(window.coinbaseWalletExtension);
33
+ }
31
34
  if (window.superb) {
32
35
  ethereumProviders.push(window.superb);
33
36
  }
package/src/index.cjs CHANGED
@@ -4,13 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('./polyfills.cjs');
6
6
  var index = require('./injected/index.cjs');
7
- require('@walletconnect/universal-provider');
7
+ require('./walletConnect/walletConnectV2.cjs');
8
+ require('@walletconnect/ethereum-provider');
8
9
  require('ethers');
9
10
  require('@dynamic-labs/wallet-connector-core');
10
11
  require('@dynamic-labs/wallet-book');
11
12
  require('@dynamic-labs/utils');
12
13
  var EthWalletConnector = require('./EthWalletConnector.cjs');
13
- require('@walletconnect/ethereum-provider');
14
14
  var constants = require('./constants.cjs');
15
15
  require('@walletconnect/client');
16
16
  var fetchWalletConnectWallets = require('./walletConnect/fetchWalletConnectWallets.cjs');
package/src/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from './injected';
4
4
  export * from './EthWalletConnector';
5
5
  export * from './ethProviderHelper';
6
6
  export * from './constants';
7
+ export * from './types';
7
8
  export declare const EthereumWalletConnectors: (props: any) => WalletConnectorConstructor[];
package/src/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import './polyfills.js';
2
2
  import { injectedWallets } from './injected/index.js';
3
3
  export { injectedWallets } from './injected/index.js';
4
- import '@walletconnect/universal-provider';
4
+ import './walletConnect/walletConnectV2.js';
5
+ import '@walletconnect/ethereum-provider';
5
6
  import 'ethers';
6
7
  import '@dynamic-labs/wallet-connector-core';
7
8
  import '@dynamic-labs/wallet-book';
8
9
  import '@dynamic-labs/utils';
9
10
  export { EthWalletConnector } from './EthWalletConnector.js';
10
- import '@walletconnect/ethereum-provider';
11
11
  export { INFURA_ID } from './constants.js';
12
12
  import '@walletconnect/client';
13
13
  import { fetchWalletConnectWallets, getWalletConnectConnector } from './walletConnect/fetchWalletConnectWallets.js';
@@ -17,7 +17,7 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
17
17
  getMobileOrInstalledWallet() {
18
18
  var _a, _b, _c;
19
19
  if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
20
- const wallet = walletBook.getWalletBookWallet(this.name);
20
+ const wallet = walletBook.getWalletBookWallet(this.walletBook, this.name);
21
21
  if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
22
22
  ((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
23
23
  return new walletConnectV2.WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
@@ -15,7 +15,7 @@ class InjectedWalletBase extends EthWalletConnector {
15
15
  getMobileOrInstalledWallet() {
16
16
  var _a, _b, _c;
17
17
  if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
18
- const wallet = getWalletBookWallet(this.name);
18
+ const wallet = getWalletBookWallet(this.walletBook, this.name);
19
19
  if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
20
20
  ((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
21
21
  return new WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
package/src/types.d.ts CHANGED
@@ -7,13 +7,14 @@ declare global {
7
7
  ethereum?: IEthereum;
8
8
  phantom?: IWindowPhantom;
9
9
  zerionWallet?: IEthereum;
10
+ coinbaseWalletExtension?: IEthereum;
10
11
  superb?: IEthereum;
11
12
  }
12
13
  }
13
14
  export type IEthereum = {
14
15
  [key in ProviderFlag]: boolean;
15
16
  } & {
16
- providers: object[];
17
+ providers?: object[];
17
18
  request: <T extends string>(params: {
18
19
  method: T;
19
20
  } | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
@@ -0,0 +1 @@
1
+ export declare const isString: (value: unknown) => value is string;
@@ -0,0 +1 @@
1
+ export declare const last: <T = unknown>(array: T[]) => T | undefined;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
6
+
7
+ const parseIntSafe = (value, radix = 10) => {
8
+ try {
9
+ const int = parseInt(String(value), radix);
10
+ if (isNaN(int)) {
11
+ walletConnectorCore.logger.error(`Error parsing ${value}`);
12
+ return undefined;
13
+ }
14
+ return int;
15
+ }
16
+ catch (e) {
17
+ walletConnectorCore.logger.error(`Error parsing ${value} to int: ${e}`);
18
+ }
19
+ return undefined;
20
+ };
21
+
22
+ exports.parseIntSafe = parseIntSafe;
@@ -0,0 +1 @@
1
+ export declare const parseIntSafe: (value: string | number, radix?: number) => number | undefined;
@@ -0,0 +1,18 @@
1
+ import { logger } from '@dynamic-labs/wallet-connector-core';
2
+
3
+ const parseIntSafe = (value, radix = 10) => {
4
+ try {
5
+ const int = parseInt(String(value), radix);
6
+ if (isNaN(int)) {
7
+ logger.error(`Error parsing ${value}`);
8
+ return undefined;
9
+ }
10
+ return int;
11
+ }
12
+ catch (e) {
13
+ logger.error(`Error parsing ${value} to int: ${e}`);
14
+ }
15
+ return undefined;
16
+ };
17
+
18
+ export { parseIntSafe };
@@ -12,12 +12,12 @@ 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, settings) => {
15
+ const initClient = (name, bridge, settings) => {
16
16
  const storageId = `walletconnect-${name}`;
17
17
  const session = localStorage.getItem(storageId);
18
18
  const clientArgs = session
19
19
  ? { session: JSON.parse(session), storageId }
20
- : { bridge: 'https://bridge.walletconnect.org', storageId };
20
+ : { bridge, storageId };
21
21
  return new Client__default["default"](Object.assign(Object.assign({}, clientArgs), settings));
22
22
  };
23
23
  /**
@@ -2,7 +2,7 @@ import Client from '@walletconnect/client';
2
2
  import { ethers } from 'ethers';
3
3
  import { FetchPublicAddressOpts, PayloadParams, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
4
4
  import { WalletSchema } from '@dynamic-labs/wallet-book';
5
- export declare const initClient: (name: string, settings?: any) => Client;
5
+ export declare const initClient: (name: string, bridge: string, settings?: any) => Client;
6
6
  /**
7
7
  * Attach event handlers to WalletConnect events.
8
8
  */
@@ -4,12 +4,12 @@ import { Contract, ethers } from 'ethers';
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, settings) => {
7
+ const initClient = (name, bridge, settings) => {
8
8
  const storageId = `walletconnect-${name}`;
9
9
  const session = localStorage.getItem(storageId);
10
10
  const clientArgs = session
11
11
  ? { session: JSON.parse(session), storageId }
12
- : { bridge: 'https://bridge.walletconnect.org', storageId };
12
+ : { bridge, storageId };
13
13
  return new Client(Object.assign(Object.assign({}, clientArgs), settings));
14
14
  };
15
15
  /**
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletBook = require('@dynamic-labs/wallet-book');
6
5
  var walletConnectV2 = require('./walletConnectV2.cjs');
7
6
  var walletConnect = require('./walletConnect.cjs');
8
7
 
@@ -16,31 +15,34 @@ const filteredWalletConnectWallets = [
16
15
  'Keplr',
17
16
  'Zerion',
18
17
  ];
19
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, }) => Object.values(walletBook.useWalletBook().wallets)
20
- .filter((wallet) => wallet.walletConnect &&
21
- !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
22
- .map((wallet) => {
18
+ const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
23
19
  var _a;
24
- const { shortName } = wallet;
25
- const name = shortName || wallet.name;
26
- // justification: we filtered out null/undefined above
27
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
- if (isWalletConnectV2Enabled &&
29
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
30
- return class extends walletConnectV2.WalletConnectV2 {
31
- constructor(props) {
32
- super(Object.assign(Object.assign({}, props), { walletName: name }));
33
- }
34
- };
35
- }
36
- else {
37
- return class extends walletConnect.WalletConnect {
38
- constructor(props) {
39
- super(Object.assign(Object.assign({}, props), { walletName: name }));
40
- }
41
- };
42
- }
43
- });
20
+ return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
21
+ .filter((wallet) => wallet.walletConnect &&
22
+ !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
23
+ .map((wallet) => {
24
+ var _a;
25
+ const { shortName } = wallet;
26
+ const name = shortName || wallet.name;
27
+ // justification: we filtered out null/undefined above
28
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29
+ if (isWalletConnectV2Enabled &&
30
+ ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
31
+ return class extends walletConnectV2.WalletConnectV2 {
32
+ constructor(props) {
33
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
34
+ }
35
+ };
36
+ }
37
+ else {
38
+ return class extends walletConnect.WalletConnect {
39
+ constructor(props) {
40
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
41
+ }
42
+ };
43
+ }
44
+ });
45
+ };
44
46
  const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
45
47
  ? class extends walletConnectV2.WalletConnectV2 {
46
48
  constructor(props) {
@@ -1,7 +1,9 @@
1
+ import { WalletBookSchema } from '@dynamic-labs/wallet-book';
1
2
  import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
3
  export declare const filteredWalletConnectWallets: string[];
3
- export declare const fetchWalletConnectWallets: ({ isWalletConnectV2Enabled, }: {
4
+ export declare const fetchWalletConnectWallets: ({ isWalletConnectV2Enabled, walletBook, }: {
4
5
  isWalletConnectV2Enabled: boolean;
6
+ walletBook: WalletBookSchema;
5
7
  }) => Array<WalletConnectorConstructor>;
6
8
  export declare const getWalletConnectConnector: ({ isWalletConnectV2Enabled, }: {
7
9
  isWalletConnectV2Enabled: boolean;
@@ -1,4 +1,3 @@
1
- import { useWalletBook } from '@dynamic-labs/wallet-book';
2
1
  import { WalletConnectV2 } from './walletConnectV2.js';
3
2
  import { WalletConnect } from './walletConnect.js';
4
3
 
@@ -12,31 +11,34 @@ const filteredWalletConnectWallets = [
12
11
  'Keplr',
13
12
  'Zerion',
14
13
  ];
15
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, }) => Object.values(useWalletBook().wallets)
16
- .filter((wallet) => wallet.walletConnect &&
17
- !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
18
- .map((wallet) => {
14
+ const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
19
15
  var _a;
20
- const { shortName } = wallet;
21
- const name = shortName || wallet.name;
22
- // justification: we filtered out null/undefined above
23
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
- if (isWalletConnectV2Enabled &&
25
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
26
- return class extends WalletConnectV2 {
27
- constructor(props) {
28
- super(Object.assign(Object.assign({}, props), { walletName: name }));
29
- }
30
- };
31
- }
32
- else {
33
- return class extends WalletConnect {
34
- constructor(props) {
35
- super(Object.assign(Object.assign({}, props), { walletName: name }));
36
- }
37
- };
38
- }
39
- });
16
+ return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
17
+ .filter((wallet) => wallet.walletConnect &&
18
+ !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
19
+ .map((wallet) => {
20
+ var _a;
21
+ const { shortName } = wallet;
22
+ const name = shortName || wallet.name;
23
+ // justification: we filtered out null/undefined above
24
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
25
+ if (isWalletConnectV2Enabled &&
26
+ ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
27
+ return class extends WalletConnectV2 {
28
+ constructor(props) {
29
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
30
+ }
31
+ };
32
+ }
33
+ else {
34
+ return class extends WalletConnect {
35
+ constructor(props) {
36
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
37
+ }
38
+ };
39
+ }
40
+ });
41
+ };
40
42
  const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
41
43
  ? class extends WalletConnectV2 {
42
44
  constructor(props) {
@@ -18,20 +18,24 @@ var WalletConnectProvider__default = /*#__PURE__*/_interopDefaultLegacy(WalletCo
18
18
 
19
19
  class WalletConnect extends EthWalletConnector.EthWalletConnector {
20
20
  constructor(_a) {
21
- var { walletName } = _a, props = _tslib.__rest(_a, ["walletName"]);
21
+ var { walletConnectV1Bridge, walletName } = _a, props = _tslib.__rest(_a, ["walletConnectV1Bridge", "walletName"]);
22
22
  super(props);
23
23
  this.supportedChains = ['EVM', 'ETH'];
24
24
  this.connectedChain = 'EVM';
25
+ this.bridge = 'https://bridge.walletconnect.org';
25
26
  this.canConnectViaQrCode = true;
26
27
  this.isWalletConnect = true;
27
28
  this.switchNetworkOnlyFromWallet = false;
28
29
  this.name = walletName;
30
+ if (walletConnectV1Bridge) {
31
+ this.bridge = walletConnectV1Bridge;
32
+ }
29
33
  }
30
34
  getClient() {
31
35
  if (this.client) {
32
36
  return this.client;
33
37
  }
34
- this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.clientOptions);
38
+ this.client = client.initClient(walletConnectorCore.normalizeWalletName(this.name), this.bridge, this.clientOptions);
35
39
  return this.client;
36
40
  }
37
41
  supportsNetworkSwitching() {
@@ -65,7 +69,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
65
69
  }
66
70
  fetchPublicAddress(opts) {
67
71
  return _tslib.__awaiter(this, void 0, void 0, function* () {
68
- return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
72
+ return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.walletBook, this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
69
73
  var _a;
70
74
  (_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
71
75
  this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
@@ -74,7 +78,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
74
78
  }
75
79
  getDeepLink() {
76
80
  var _a;
77
- const wallet = walletBook.getWalletBookWallet(this.name);
81
+ const wallet = walletBook.getWalletBookWallet(this.walletBook, this.name);
78
82
  if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
79
83
  return undefined;
80
84
  }
@@ -86,7 +90,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
86
90
  }
87
91
  signMessage(messageToSign) {
88
92
  return _tslib.__awaiter(this, void 0, void 0, function* () {
89
- return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.name), this.getClient(),
93
+ return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.name), this.getClient(),
90
94
  // don't call getRpcProvider until we really need to
91
95
  () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
92
96
  });
@@ -118,7 +122,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
118
122
  }
119
123
  if (utils.isMobile()) {
120
124
  const deepLink = walletConnectorCore.getDeepLink({
121
- metadata: walletBook.getWalletBookWallet(this.name),
125
+ metadata: walletBook.getWalletBookWallet(this.walletBook, this.name),
122
126
  mode: 'regular',
123
127
  uri: client.uri,
124
128
  });
@@ -135,6 +139,12 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
135
139
  return client.accounts;
136
140
  });
137
141
  }
142
+ getSession() {
143
+ var _a;
144
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
145
+ return (_a = this.client) === null || _a === void 0 ? void 0 : _a.session;
146
+ });
147
+ }
138
148
  }
139
149
 
140
150
  exports.WalletConnect = WalletConnect;