@dynamic-labs/ethereum 0.18.0-RC.8 → 0.18.0-beta.28
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 +275 -0
- package/package.json +7 -6
- package/src/ethProviderHelper.cjs +8 -0
- package/src/ethProviderHelper.d.ts +2 -0
- package/src/ethProviderHelper.js +8 -0
- package/src/index.cjs +4 -0
- package/src/index.js +2 -0
- package/src/injected/BackpackEvm.cjs +25 -0
- package/src/injected/BackpackEvm.d.ts +5 -0
- package/src/injected/BackpackEvm.js +21 -0
- package/src/injected/Rabby.cjs +15 -0
- package/src/injected/Rabby.d.ts +5 -0
- package/src/injected/Rabby.js +11 -0
- package/src/injected/index.cjs +6 -0
- package/src/injected/index.d.ts +2 -0
- package/src/injected/index.js +6 -0
- package/src/types.d.ts +1 -1
- package/src/walletConnect/fetchWalletConnectWallets.cjs +2 -0
- package/src/walletConnect/fetchWalletConnectWallets.js +2 -0
- package/src/walletConnect/walletConnect.cjs +6 -0
- package/src/walletConnect/walletConnect.d.ts +15 -0
- package/src/walletConnect/walletConnect.js +6 -0
- package/src/walletConnect/walletConnectV2.cjs +68 -35
- package/src/walletConnect/walletConnectV2.d.ts +14 -2
- package/src/walletConnect/walletConnectV2.js +68 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,279 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.18.0-beta.28](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.27...v0.18.0-beta.28) (2023-08-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* gracefully handle walletbook fallbacks ([#2812](https://github.com/dynamic-labs/DynamicAuth/issues/2812)) ([#2822](https://github.com/dynamic-labs/DynamicAuth/issues/2822)) ([8e737d6](https://github.com/dynamic-labs/DynamicAuth/commit/8e737d602d64fa2414ba136799b8878e975a40a2))
|
|
8
|
+
|
|
9
|
+
## [0.18.0-RC.27](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.26...v0.18.0-RC.27) (2023-08-03)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fixes circular dependency issues on usePromise
|
|
14
|
+
|
|
15
|
+
## [0.18.0-RC.26](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.24...v0.18.0-RC.26) (2023-08-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* displayTermsOfService prop set to false breaks message verfication (#2751)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* send wagmi settings from wagmi connector ([#2791](https://github.com/dynamic-labs/DynamicAuth/issues/2791)) ([#2800](https://github.com/dynamic-labs/DynamicAuth/issues/2800)) ([5b65605](https://github.com/dynamic-labs/DynamicAuth/commit/5b656059361a48de57e01ad2dd81de0bc9b2c7e8))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* always call onBeforeConnectSuccess callback when wallet state changes ([#2786](https://github.com/dynamic-labs/DynamicAuth/issues/2786)) ([e2eaef3](https://github.com/dynamic-labs/DynamicAuth/commit/e2eaef3da1f80cdc7dc21e902e9c033e581242d2))
|
|
30
|
+
* displayTermsOfService prop set to false breaks message verfication ([#2751](https://github.com/dynamic-labs/DynamicAuth/issues/2751)) ([6433732](https://github.com/dynamic-labs/DynamicAuth/commit/6433732fac87d641f2475d19ef743ac31130274f))
|
|
31
|
+
* ensure auto-redirect back to dapp after message signing ([#2783](https://github.com/dynamic-labs/DynamicAuth/issues/2783)) ([dba4664](https://github.com/dynamic-labs/DynamicAuth/commit/dba466473ecc2afd808cdae0fd9023d38676b01f))
|
|
32
|
+
* use css.supports only when available ([#2802](https://github.com/dynamic-labs/DynamicAuth/issues/2802)) ([7651898](https://github.com/dynamic-labs/DynamicAuth/commit/76518982a97e728ab65549f37f55b537eed4e890))
|
|
33
|
+
|
|
34
|
+
## [0.18.0-RC.25](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.24...v0.18.0-RC.25) (2023-08-01)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### ⚠ BREAKING CHANGES
|
|
38
|
+
|
|
39
|
+
* displayTermsOfService prop set to false breaks message verfication (#2751)
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* always call onBeforeConnectSuccess callback when wallet state changes ([#2786](https://github.com/dynamic-labs/DynamicAuth/issues/2786)) ([e2eaef3](https://github.com/dynamic-labs/DynamicAuth/commit/e2eaef3da1f80cdc7dc21e902e9c033e581242d2))
|
|
44
|
+
* displayTermsOfService prop set to false breaks message verfication ([#2751](https://github.com/dynamic-labs/DynamicAuth/issues/2751)) ([6433732](https://github.com/dynamic-labs/DynamicAuth/commit/6433732fac87d641f2475d19ef743ac31130274f))
|
|
45
|
+
* ensure auto-redirect back to dapp after message signing ([#2783](https://github.com/dynamic-labs/DynamicAuth/issues/2783)) ([dba4664](https://github.com/dynamic-labs/DynamicAuth/commit/dba466473ecc2afd808cdae0fd9023d38676b01f))
|
|
46
|
+
|
|
47
|
+
## [0.18.0-RC.24](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.23...v0.18.0-RC.24) (2023-08-01)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
* **QNTM-156:** onBeforeConnectSuccessConfirmation on account change ([#2782](https://github.com/dynamic-labs/DynamicAuth/issues/2782)) ([eeabcd0](https://github.com/dynamic-labs/DynamicAuth/commit/eeabcd07889b7284680dc92a83bfa1b8321fa0f5))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* **bridge:** reordering not mess connected wallets ([#2758](https://github.com/dynamic-labs/DynamicAuth/issues/2758)) ([2cdc240](https://github.com/dynamic-labs/DynamicAuth/commit/2cdc240b1f5b401880d776174646ebc9383506d2))
|
|
58
|
+
|
|
59
|
+
## [0.18.0-RC.23](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.22...v0.18.0-RC.23) (2023-07-31)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* add hook to expose link/unlink social account ([#2766](https://github.com/dynamic-labs/DynamicAuth/issues/2766)) ([06366ee](https://github.com/dynamic-labs/DynamicAuth/commit/06366eebd9917f39c0177307616bcd936f023326))
|
|
65
|
+
* show modal for duplicate emails ([#2761](https://github.com/dynamic-labs/DynamicAuth/issues/2761)) ([421235b](https://github.com/dynamic-labs/DynamicAuth/commit/421235b4c41ce682b0cf75093dff8281031121cb))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* missing dependencies and providers for MockContextProvider ([#2779](https://github.com/dynamic-labs/DynamicAuth/issues/2779)) ([15ce9af](https://github.com/dynamic-labs/DynamicAuth/commit/15ce9af40240f50878c2a4f103bdcb98d845b49b))
|
|
71
|
+
* Revert "fix: ensure metamask auto-redirect upon message signing ([#2757](https://github.com/dynamic-labs/DynamicAuth/issues/2757))" ([#2776](https://github.com/dynamic-labs/DynamicAuth/issues/2776)) ([9abe356](https://github.com/dynamic-labs/DynamicAuth/commit/9abe3568a9ba9c70a6e17f03e9746a787feae92e))
|
|
72
|
+
|
|
73
|
+
## [0.18.0-RC.22](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.21...v0.18.0-RC.22) (2023-07-28)
|
|
74
|
+
|
|
75
|
+
## [0.18.0-RC.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.20...v0.18.0-RC.21) (2023-07-28)
|
|
76
|
+
|
|
77
|
+
## [0.18.0-RC.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.19...v0.18.0-RC.20) (2023-07-27)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Features
|
|
81
|
+
|
|
82
|
+
* **QNTM-56:** add onBeforeConnectSuccessConfirmation callback ([#2753](https://github.com/dynamic-labs/DynamicAuth/issues/2753)) ([b174396](https://github.com/dynamic-labs/DynamicAuth/commit/b174396ab341cbcf11c6940e54931c0db3954d0d))
|
|
83
|
+
* **QNTM-72:** add backpack wallet ([#2702](https://github.com/dynamic-labs/DynamicAuth/issues/2702)) ([0d0ce9c](https://github.com/dynamic-labs/DynamicAuth/commit/0d0ce9c0d92118a78b5e40f64c5530246523712a))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Bug Fixes
|
|
87
|
+
|
|
88
|
+
* bump sdk version and change sdksettings api ([#2760](https://github.com/dynamic-labs/DynamicAuth/issues/2760)) ([6e3e205](https://github.com/dynamic-labs/DynamicAuth/commit/6e3e2050ed63d2df2d88d9169bc89d5f17870847))
|
|
89
|
+
* check funding enabled based on enabled onramp providers instead of onrampFunding settings ([#2662](https://github.com/dynamic-labs/DynamicAuth/issues/2662)) ([d542a9b](https://github.com/dynamic-labs/DynamicAuth/commit/d542a9b2950640e473afe378c857f4d2dd1926ff))
|
|
90
|
+
* ensure metamask auto-redirect upon message signing ([#2757](https://github.com/dynamic-labs/DynamicAuth/issues/2757)) ([a590f4b](https://github.com/dynamic-labs/DynamicAuth/commit/a590f4b054cd1de7ad400763d769b0daf4fcaad2))
|
|
91
|
+
* **QNTM-123:** use `linkedWallets` after signing the first message ([#2741](https://github.com/dynamic-labs/DynamicAuth/issues/2741)) ([7f26151](https://github.com/dynamic-labs/DynamicAuth/commit/7f26151db69b50102fd4b09ec470c8f19ce7b68f))
|
|
92
|
+
|
|
93
|
+
## [0.18.0-RC.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.18...v0.18.0-RC.19) (2023-07-25)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### ⚠ BREAKING CHANGES
|
|
97
|
+
|
|
98
|
+
* it updates the variable name isUserConnected to isFullyConnected
|
|
99
|
+
to better reflect its purpose in the codebase. user should be reserved for fully authenticated entities
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* Update WalletConnect wallet registry ([#2744](https://github.com/dynamic-labs/DynamicAuth/issues/2744)) ([46285ad](https://github.com/dynamic-labs/DynamicAuth/commit/46285adc77d12cdfe43d0ce1296308f4905fbfb5))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
* missing field handling on email verification ([#2740](https://github.com/dynamic-labs/DynamicAuth/issues/2740)) ([3a42804](https://github.com/dynamic-labs/DynamicAuth/commit/3a428049a1f56a263135d636a335e597b3195b51))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
* rename isUserConnected to isFullyConnected ([#2739](https://github.com/dynamic-labs/DynamicAuth/issues/2739)) ([951780b](https://github.com/dynamic-labs/DynamicAuth/commit/951780be79acdc5191ffb8a6a525a2701832a2ad))
|
|
112
|
+
|
|
113
|
+
## [0.18.0-RC.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.17...v0.18.0-RC.18) (2023-07-24)
|
|
114
|
+
|
|
115
|
+
### Bug Fixes
|
|
116
|
+
|
|
117
|
+
* do not call connectSuccess when already connected ([#2705](https://github.com/dynamic-labs/DynamicAuth/issues/2705)) ([12a65fb](https://github.com/dynamic-labs/DynamicAuth/commit/12a65fb5e59a38de0f5fb0e7eab3ce3d558f201f))
|
|
118
|
+
* do not proceed to authSuccess if there are still missing fields ([#2712](https://github.com/dynamic-labs/DynamicAuth/issues/2712)) ([2fb10ed](https://github.com/dynamic-labs/DynamicAuth/commit/2fb10ed7f9c28476d61856887b517bdae10b80f4))
|
|
119
|
+
* add legacy safari detection ([#2733](https://github.com/dynamic-labs/DynamicAuth/issues/2733)) ([1b21c57](https://github.com/dynamic-labs/DynamicAuth/commit/1b21c57c1fd7c458f499cc09ef60364c314b0464))
|
|
120
|
+
|
|
121
|
+
## [0.18.0-RC.17](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.16...v0.18.0-RC.17) (2023-07-24)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Features
|
|
125
|
+
|
|
126
|
+
* add ongoingVerifications object disclaiming which verifications are in progress ([#2633](https://github.com/dynamic-labs/DynamicAuth/issues/2633)) ([948c778](https://github.com/dynamic-labs/DynamicAuth/commit/948c778e5955fcf80e31ac7f368e7605cd7eb7d5))
|
|
127
|
+
* add rabby wallet support ([#2590](https://github.com/dynamic-labs/DynamicAuth/issues/2590)) ([d70c49d](https://github.com/dynamic-labs/DynamicAuth/commit/d70c49d0b348ced3ee5691fdfc19b3eef5ba79db))
|
|
128
|
+
* **DYN-2399:** send dynamicContext props from sdk to api ([#2659](https://github.com/dynamic-labs/DynamicAuth/issues/2659)) ([f06787b](https://github.com/dynamic-labs/DynamicAuth/commit/f06787bf6ec1dc69c53ee6287fd3721d47901ad1))
|
|
129
|
+
* introduce MenuList and Dropdown components to unify previously redundant implementations ([#2675](https://github.com/dynamic-labs/DynamicAuth/issues/2675)) ([dfc63a5](https://github.com/dynamic-labs/DynamicAuth/commit/dfc63a5fef2c00cf0187e7a481dc3267d44f6cc3))
|
|
130
|
+
* **QNTM-101:** add loading state to button ([#2691](https://github.com/dynamic-labs/DynamicAuth/issues/2691)) ([5a7b539](https://github.com/dynamic-labs/DynamicAuth/commit/5a7b5392c4b17cc26ecc621d11afdf37f2f10c65))
|
|
131
|
+
* update blocto version to v2 ([#2651](https://github.com/dynamic-labs/DynamicAuth/issues/2651)) ([441f85e](https://github.com/dynamic-labs/DynamicAuth/commit/441f85efa3921a57b9b282631016162902c8aabb))
|
|
132
|
+
* verify connected wallets network at runtime ([#2667](https://github.com/dynamic-labs/DynamicAuth/issues/2667)) ([8fa8dcc](https://github.com/dynamic-labs/DynamicAuth/commit/8fa8dccdfcb56d9d76d0cd00a153a95e5d52b4dc))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Bug Fixes
|
|
136
|
+
|
|
137
|
+
* correctly round balance numbers on widget ([#2625](https://github.com/dynamic-labs/DynamicAuth/issues/2625)) ([7b45483](https://github.com/dynamic-labs/DynamicAuth/commit/7b45483e7bdb458434b7787f9df930ba9acbc8e0))
|
|
138
|
+
* decrease NetworkNotSupported useEffects calls to avoid race condition ([#2731](https://github.com/dynamic-labs/DynamicAuth/issues/2731)) ([6a7baf1](https://github.com/dynamic-labs/DynamicAuth/commit/6a7baf1c63e82b27d03540d670603fe11685348a))
|
|
139
|
+
* **GVTY-58:** do not allow users to submit empty whitespace strings in onboarding form ([#2720](https://github.com/dynamic-labs/DynamicAuth/issues/2720)) ([916f27a](https://github.com/dynamic-labs/DynamicAuth/commit/916f27a5c880281245c71af3f16217cda5317c26))
|
|
140
|
+
* playwright tests were failing due to new cookies popup that overlapped sdk modal ([#2709](https://github.com/dynamic-labs/DynamicAuth/issues/2709)) ([9254777](https://github.com/dynamic-labs/DynamicAuth/commit/92547773047687fcc50ad6b895b1b59176d42af7))
|
|
141
|
+
* **QNTM-111:** call onConnectSuccess with correct wallet connector in… ([#2724](https://github.com/dynamic-labs/DynamicAuth/issues/2724)) ([159e78c](https://github.com/dynamic-labs/DynamicAuth/commit/159e78ce458762f0e2ccbaf2acbc81efde35830a))
|
|
142
|
+
* **QNTM-98:** improve connectedWallets state management and connected wallets events listeners ([#2696](https://github.com/dynamic-labs/DynamicAuth/issues/2696)) ([3a91a37](https://github.com/dynamic-labs/DynamicAuth/commit/3a91a371423f50d28640141d0ca6a643a8dcf25a))
|
|
143
|
+
* update broken safe icon ([#2713](https://github.com/dynamic-labs/DynamicAuth/issues/2713)) ([42943b4](https://github.com/dynamic-labs/DynamicAuth/commit/42943b4684c165ec103fbed0e69e691bee4d305f))
|
|
144
|
+
|
|
145
|
+
## [0.18.0-RC.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.15...v0.18.0-RC.16) (2023-07-18)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
* **QNTM-30:** add spinner to log out button ([#2663](https://github.com/dynamic-labs/DynamicAuth/issues/2663)) ([fceafbb](https://github.com/dynamic-labs/DynamicAuth/commit/fceafbb6fecf323df39ac3a8f518ba8005d4b550))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Bug Fixes
|
|
154
|
+
|
|
155
|
+
* handle edge cases for missing projectSettings for PoweredByDynamic ([#2684](https://github.com/dynamic-labs/DynamicAuth/issues/2684)) ([6f5b3d8](https://github.com/dynamic-labs/DynamicAuth/commit/6f5b3d8d1b1d4aed0dd2e73e5423f6e50347ff3d))
|
|
156
|
+
* typo in blocked view ([#2673](https://github.com/dynamic-labs/DynamicAuth/issues/2673)) ([034bdaf](https://github.com/dynamic-labs/DynamicAuth/commit/034bdafb44b767600ea7c0148f39dd026280e3b8))
|
|
157
|
+
|
|
158
|
+
## [0.18.0-RC.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.14...v0.18.0-RC.15) (2023-07-18)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Features
|
|
162
|
+
|
|
163
|
+
* add `updateConnectedWalletById` function, add `network` property to connectedWallets ([#2666](https://github.com/dynamic-labs/DynamicAuth/issues/2666)) ([3c50abf](https://github.com/dynamic-labs/DynamicAuth/commit/3c50abf964a2807c6e1af9fceeb1ca259785a21f))
|
|
164
|
+
* add magic to ethereum-all package ([#2576](https://github.com/dynamic-labs/DynamicAuth/issues/2576)) ([7676ef2](https://github.com/dynamic-labs/DynamicAuth/commit/7676ef2883b30adf2c1b521d7c1848248ceadb24))
|
|
165
|
+
* allow switching between multiwallet and single wallet on demo ([#2596](https://github.com/dynamic-labs/DynamicAuth/issues/2596)) ([dae87c1](https://github.com/dynamic-labs/DynamicAuth/commit/dae87c12d2f1be64c2ca1f232ffdf2da998b1c1e))
|
|
166
|
+
* clear values from LS that cannot be parsed ([#2542](https://github.com/dynamic-labs/DynamicAuth/issues/2542)) ([41faf5d](https://github.com/dynamic-labs/DynamicAuth/commit/41faf5dbc07937685b4d89f87ae040021c5fee00))
|
|
167
|
+
* **QNTM-82:** should not go back to "get started" view if one wallet already connected ([#2653](https://github.com/dynamic-labs/DynamicAuth/issues/2653)) ([004db41](https://github.com/dynamic-labs/DynamicAuth/commit/004db410eb11af9ba105058df4958f20633a3002))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### Bug Fixes
|
|
171
|
+
|
|
172
|
+
* **bridge:** update the wallets to connect when unlinking ([#2604](https://github.com/dynamic-labs/DynamicAuth/issues/2604)) ([4739306](https://github.com/dynamic-labs/DynamicAuth/commit/4739306c2d742e961281747427821af7c36b6cc2))
|
|
173
|
+
* network picker is broken in network switch view ([#2612](https://github.com/dynamic-labs/DynamicAuth/issues/2612)) ([c514ba4](https://github.com/dynamic-labs/DynamicAuth/commit/c514ba4f931c243bdd60329db7ed1691fc36819c))
|
|
174
|
+
* search not found icon in wrong color in dark mode ([#2656](https://github.com/dynamic-labs/DynamicAuth/issues/2656)) ([a4db736](https://github.com/dynamic-labs/DynamicAuth/commit/a4db736b8659567330dd857792cc12b17ce9d851))
|
|
175
|
+
* use dynamicauth.com for api requests ([#2649](https://github.com/dynamic-labs/DynamicAuth/issues/2649)) ([acae0af](https://github.com/dynamic-labs/DynamicAuth/commit/acae0afc2a18c41fa61b2c487ff1ceb46c5d9a1f))
|
|
176
|
+
* wallet should be disconnected when NetworkNotSupported view is ignored in connect-only mode ([#2658](https://github.com/dynamic-labs/DynamicAuth/issues/2658)) ([f3565cf](https://github.com/dynamic-labs/DynamicAuth/commit/f3565cf09a1ddcc671b596bbe23c68d35afc81b5))
|
|
177
|
+
|
|
178
|
+
## [0.18.0-RC.14](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.13...v0.18.0-RC.14) (2023-07-11)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
### ⚠ BREAKING CHANGES
|
|
182
|
+
|
|
183
|
+
* **QNTM-68:** we currently expose concatenated primary and secondary
|
|
184
|
+
wallets array as connectedWallets, this is wrong and may cause issues with
|
|
185
|
+
understanding our architecture as well as issues for customers that want
|
|
186
|
+
to have access to connectedWallets array.
|
|
187
|
+
|
|
188
|
+
* chore(QNTM-68): expose connectedWallets from DynamicContext
|
|
189
|
+
|
|
190
|
+
since, we renamed connectedWallets to linkedWallets, we now want to expose correct value
|
|
191
|
+
for connectedWallets.
|
|
192
|
+
|
|
193
|
+
* chore(QNTM-68)!: remove connectedWalletsInfo from useDynamicContext
|
|
194
|
+
* **QNTM-68:** since we're exposing connectedWallets and this variable
|
|
195
|
+
has less information there is no need in exposing it from DynamicContext
|
|
196
|
+
|
|
197
|
+
* **QNTM-68:** update connectedWallets property and expose linkedWallets ([#2644](https://github.com/dynamic-labs/DynamicAuth/issues/2644)) ([8b707c3](https://github.com/dynamic-labs/DynamicAuth/commit/8b707c3fb2e14aa25385b35768ffa355ef7117e5))
|
|
198
|
+
|
|
199
|
+
## [0.18.0-RC.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.12...v0.18.0-RC.13) (2023-07-11)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
* **DynamicContextProvider:** expose socialProviderFilter to modify social provider display order ([#2607](https://github.com/dynamic-labs/DynamicAuth/issues/2607)) ([0f03260](https://github.com/dynamic-labs/DynamicAuth/commit/0f03260e739da3e68c32a2a87a2ca629bb1f28b5))
|
|
205
|
+
* **GVTY-21:** Blocto Email provider ([#2524](https://github.com/dynamic-labs/DynamicAuth/issues/2524)) ([434ce59](https://github.com/dynamic-labs/DynamicAuth/commit/434ce598b3bc13841121b61e5ead7547d3c44eea))
|
|
206
|
+
* listen for the network change in network not supported views ([#2611](https://github.com/dynamic-labs/DynamicAuth/issues/2611)) ([957fbce](https://github.com/dynamic-labs/DynamicAuth/commit/957fbce55d7906f9d6b109838035b2c0306a4b85))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Bug Fixes
|
|
210
|
+
|
|
211
|
+
* Clean up provider re-initializing after logout ([#2632](https://github.com/dynamic-labs/DynamicAuth/issues/2632)) ([fbc2201](https://github.com/dynamic-labs/DynamicAuth/commit/fbc22013d6784061cb4fdd72e24695c89f0e2fe5))
|
|
212
|
+
* **MagicWalletConnector:** check if user is logged when getting balance ([#2614](https://github.com/dynamic-labs/DynamicAuth/issues/2614)) ([ced9d66](https://github.com/dynamic-labs/DynamicAuth/commit/ced9d66cb335c3033a18642bdd841ee6be6c1e05))
|
|
213
|
+
* **useValidateSessin:** only check for bridge on wallet connect wallets ([#2571](https://github.com/dynamic-labs/DynamicAuth/issues/2571)) ([349b659](https://github.com/dynamic-labs/DynamicAuth/commit/349b65963f1d5392f63aaa138f6498f0d17cd43f))
|
|
214
|
+
|
|
215
|
+
## [0.18.0-RC.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.11...v0.18.0-RC.12) (2023-07-07)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
### Features
|
|
219
|
+
|
|
220
|
+
* add event listeners to connect-only ([#2578](https://github.com/dynamic-labs/DynamicAuth/issues/2578)) ([42fcf09](https://github.com/dynamic-labs/DynamicAuth/commit/42fcf096ac439ec883a79bf5811b27cdc360015a))
|
|
221
|
+
* add message when search finds no wallet ([#2421](https://github.com/dynamic-labs/DynamicAuth/issues/2421)) ([694ecee](https://github.com/dynamic-labs/DynamicAuth/commit/694ecee94d9f6f636364eae4aa95ea48e3ff0e0a))
|
|
222
|
+
* allow adding either ToS or PP and enable customization for both ([#2451](https://github.com/dynamic-labs/DynamicAuth/issues/2451)) ([0dce0fe](https://github.com/dynamic-labs/DynamicAuth/commit/0dce0fe534056298cbfdd9caa694231ede00c3fc))
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### Bug Fixes
|
|
226
|
+
|
|
227
|
+
* **BridgeSummaryView:** handle primary wallet when it is not defined ([#2602](https://github.com/dynamic-labs/DynamicAuth/issues/2602)) ([8a5daa4](https://github.com/dynamic-labs/DynamicAuth/commit/8a5daa4b2ad218460ccfaab0fa68c75d0d5d569f))
|
|
228
|
+
* secondary wallets network change overrides primary wallet network ([#2603](https://github.com/dynamic-labs/DynamicAuth/issues/2603)) ([358fc45](https://github.com/dynamic-labs/DynamicAuth/commit/358fc45ecb73f31294744f7ba4dbba5779a3e1cf))
|
|
229
|
+
|
|
230
|
+
## [0.18.0-RC.11](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.10...v0.18.0-RC.11) (2023-07-07)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
### Features
|
|
234
|
+
|
|
235
|
+
* **DYN-2384:** expose useDynamicScopes hook ([#2179](https://github.com/dynamic-labs/DynamicAuth/issues/2179)) ([c224749](https://github.com/dynamic-labs/DynamicAuth/commit/c2247493d9c99dab7e41d7d8d156ae7e478973bc))
|
|
236
|
+
* **DynamicBridgeWidget:** add UI inline widget to match designs ([#2587](https://github.com/dynamic-labs/DynamicAuth/issues/2587)) ([d623aec](https://github.com/dynamic-labs/DynamicAuth/commit/d623aecda6388b67e40a3f8dabb03ca03a6f22b6))
|
|
237
|
+
* support starknet networks ([#2579](https://github.com/dynamic-labs/DynamicAuth/issues/2579)) ([a01545e](https://github.com/dynamic-labs/DynamicAuth/commit/a01545e0cf8e4e19a22dc64877d590d78647c579))
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
### Bug Fixes
|
|
241
|
+
|
|
242
|
+
* metamask getConnectedAccounts triggering an infinite loop ([#2580](https://github.com/dynamic-labs/DynamicAuth/issues/2580)) ([e025cea](https://github.com/dynamic-labs/DynamicAuth/commit/e025cea33e4a95ea2a03ac11e47a88a73db39848))
|
|
243
|
+
|
|
244
|
+
## [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)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### Features
|
|
248
|
+
|
|
249
|
+
* 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))
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
### Bug Fixes
|
|
253
|
+
|
|
254
|
+
* restore connectedWallet clearing function ([#2575](https://github.com/dynamic-labs/DynamicAuth/issues/2575)) ([8d3c41a](https://github.com/dynamic-labs/DynamicAuth/commit/8d3c41a6871037b1003270e724259f23c5f6f370))
|
|
255
|
+
|
|
256
|
+
## [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)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
### Features
|
|
260
|
+
|
|
261
|
+
* 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))
|
|
262
|
+
* **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))
|
|
263
|
+
* **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))
|
|
264
|
+
* **DynamicAuthLayout:** show connected wallet progress ([#2567](https://github.com/dynamic-labs/DynamicAuth/issues/2567)) ([a20ff6f](https://github.com/dynamic-labs/DynamicAuth/commit/a20ff6f32b360ccc699d2a271c7a96751ae87d29))
|
|
265
|
+
* **DynamicBridgeFlow:** add bridge flow ([#2543](https://github.com/dynamic-labs/DynamicAuth/issues/2543)) ([79c4c87](https://github.com/dynamic-labs/DynamicAuth/commit/79c4c870d47a0c853c292a8d913bd9be9e209a15))
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
### Bug Fixes
|
|
269
|
+
|
|
270
|
+
* 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))
|
|
271
|
+
* 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))
|
|
272
|
+
* 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))
|
|
273
|
+
* 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))
|
|
274
|
+
* **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))
|
|
275
|
+
* **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))
|
|
276
|
+
|
|
2
277
|
## [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)
|
|
3
278
|
|
|
4
279
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-beta.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"ethers": "5.7.2",
|
|
33
33
|
"eventemitter3": "5.0.1",
|
|
34
34
|
"buffer": "6.0.3",
|
|
35
|
-
"@dynamic-labs/rpc-providers": "0.18.0-
|
|
36
|
-
"@dynamic-labs/types": "0.18.0-
|
|
37
|
-
"@dynamic-labs/utils": "0.18.0-
|
|
38
|
-
"@dynamic-labs/wallet-book": "0.18.0-
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "0.18.0-
|
|
35
|
+
"@dynamic-labs/rpc-providers": "0.18.0-beta.28",
|
|
36
|
+
"@dynamic-labs/types": "0.18.0-beta.28",
|
|
37
|
+
"@dynamic-labs/utils": "0.18.0-beta.28",
|
|
38
|
+
"@dynamic-labs/wallet-book": "0.18.0-beta.28",
|
|
39
|
+
"@dynamic-labs/wallet-connector-core": "0.18.0-beta.28",
|
|
40
|
+
"@ethersproject/providers": "5.7.2"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {}
|
|
42
43
|
}
|
|
@@ -160,6 +160,8 @@ _a.installedProviderLookup([
|
|
|
160
160
|
{ flag: 'isZerion', value: false },
|
|
161
161
|
{ flag: 'isMetaMask', value: true },
|
|
162
162
|
{ flag: 'isSuperb', value: false },
|
|
163
|
+
{ flag: 'isRabby', value: false },
|
|
164
|
+
{ flag: 'isBackpack', value: false },
|
|
163
165
|
]);
|
|
164
166
|
EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
|
|
165
167
|
EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
|
|
@@ -173,6 +175,8 @@ EthProviderHelper.TrustWalletProvider = () => _a.installedProviderLookup([{ flag
|
|
|
173
175
|
EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'isPhantom', value: true }]);
|
|
174
176
|
EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
|
|
175
177
|
EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
|
|
178
|
+
EthProviderHelper.RabbyProvider = () => _a.installedProviderLookup([{ flag: 'isRabby', value: true }]);
|
|
179
|
+
EthProviderHelper.BackpackProvider = () => _a.installedProviderLookup([{ flag: 'isBackpack', value: true }]);
|
|
176
180
|
EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
177
181
|
{ flag: 'isMetaMask', value: false },
|
|
178
182
|
{ flag: 'isExodus', value: false },
|
|
@@ -186,8 +190,11 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
|
186
190
|
{ flag: 'isPhantom', value: false },
|
|
187
191
|
{ flag: 'isZerion', value: false },
|
|
188
192
|
{ flag: 'isSuperb', value: false },
|
|
193
|
+
{ flag: 'isRabby', value: false },
|
|
194
|
+
{ flag: 'isBackpack', value: false },
|
|
189
195
|
]);
|
|
190
196
|
EthProviderHelper.providers = {
|
|
197
|
+
backpack: _a.BackpackProvider,
|
|
191
198
|
bloctoinjected: _a.BloctoProvider,
|
|
192
199
|
braveevm: _a.BraveProvider,
|
|
193
200
|
coinbase: _a.CoinbaseProvider,
|
|
@@ -199,6 +206,7 @@ EthProviderHelper.providers = {
|
|
|
199
206
|
metamask: _a.MetamaskProvider,
|
|
200
207
|
opera: _a.OperaProvider,
|
|
201
208
|
phantomevm: _a.PhantomProvider,
|
|
209
|
+
rabby: _a.RabbyProvider,
|
|
202
210
|
superb: _a.SuperbProvider,
|
|
203
211
|
trust: _a.TrustWalletProvider,
|
|
204
212
|
zerion: _a.ZerionProvider,
|
|
@@ -16,6 +16,8 @@ export declare class EthProviderHelper {
|
|
|
16
16
|
static PhantomProvider: Provider;
|
|
17
17
|
static ZerionProvider: Provider;
|
|
18
18
|
static SuperbProvider: Provider;
|
|
19
|
+
static RabbyProvider: Provider;
|
|
20
|
+
static BackpackProvider: Provider;
|
|
19
21
|
static UnknownInjectedProvider: Provider;
|
|
20
22
|
static providers: {
|
|
21
23
|
[wallet: string]: Provider;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -156,6 +156,8 @@ _a.installedProviderLookup([
|
|
|
156
156
|
{ flag: 'isZerion', value: false },
|
|
157
157
|
{ flag: 'isMetaMask', value: true },
|
|
158
158
|
{ flag: 'isSuperb', value: false },
|
|
159
|
+
{ flag: 'isRabby', value: false },
|
|
160
|
+
{ flag: 'isBackpack', value: false },
|
|
159
161
|
]);
|
|
160
162
|
EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
|
|
161
163
|
EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
|
|
@@ -169,6 +171,8 @@ EthProviderHelper.TrustWalletProvider = () => _a.installedProviderLookup([{ flag
|
|
|
169
171
|
EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'isPhantom', value: true }]);
|
|
170
172
|
EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
|
|
171
173
|
EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
|
|
174
|
+
EthProviderHelper.RabbyProvider = () => _a.installedProviderLookup([{ flag: 'isRabby', value: true }]);
|
|
175
|
+
EthProviderHelper.BackpackProvider = () => _a.installedProviderLookup([{ flag: 'isBackpack', value: true }]);
|
|
172
176
|
EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
173
177
|
{ flag: 'isMetaMask', value: false },
|
|
174
178
|
{ flag: 'isExodus', value: false },
|
|
@@ -182,8 +186,11 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
|
182
186
|
{ flag: 'isPhantom', value: false },
|
|
183
187
|
{ flag: 'isZerion', value: false },
|
|
184
188
|
{ flag: 'isSuperb', value: false },
|
|
189
|
+
{ flag: 'isRabby', value: false },
|
|
190
|
+
{ flag: 'isBackpack', value: false },
|
|
185
191
|
]);
|
|
186
192
|
EthProviderHelper.providers = {
|
|
193
|
+
backpack: _a.BackpackProvider,
|
|
187
194
|
bloctoinjected: _a.BloctoProvider,
|
|
188
195
|
braveevm: _a.BraveProvider,
|
|
189
196
|
coinbase: _a.CoinbaseProvider,
|
|
@@ -195,6 +202,7 @@ EthProviderHelper.providers = {
|
|
|
195
202
|
metamask: _a.MetamaskProvider,
|
|
196
203
|
opera: _a.OperaProvider,
|
|
197
204
|
phantomevm: _a.PhantomProvider,
|
|
205
|
+
rabby: _a.RabbyProvider,
|
|
198
206
|
superb: _a.SuperbProvider,
|
|
199
207
|
trust: _a.TrustWalletProvider,
|
|
200
208
|
zerion: _a.ZerionProvider,
|
package/src/index.cjs
CHANGED
|
@@ -27,6 +27,8 @@ var PhantomEvm = require('./injected/PhantomEvm.cjs');
|
|
|
27
27
|
var Trust = require('./injected/Trust.cjs');
|
|
28
28
|
var UnknownInjectedWallet = require('./injected/UnknownInjectedWallet.cjs');
|
|
29
29
|
var Zerion = require('./injected/Zerion.cjs');
|
|
30
|
+
var Rabby = require('./injected/Rabby.cjs');
|
|
31
|
+
var BackpackEvm = require('./injected/BackpackEvm.cjs');
|
|
30
32
|
|
|
31
33
|
const EthereumWalletConnectors = (props) => [
|
|
32
34
|
...index.injectedWallets,
|
|
@@ -50,4 +52,6 @@ exports.PhantomEvm = PhantomEvm.PhantomEvm;
|
|
|
50
52
|
exports.Trust = Trust.Trust;
|
|
51
53
|
exports.UnknownInjectedWallet = UnknownInjectedWallet.UnknownInjectedWallet;
|
|
52
54
|
exports.Zerion = Zerion.Zerion;
|
|
55
|
+
exports.Rabby = Rabby.Rabby;
|
|
56
|
+
exports.BackpackEvm = BackpackEvm.BackpackEvm;
|
|
53
57
|
exports.EthereumWalletConnectors = EthereumWalletConnectors;
|
package/src/index.js
CHANGED
|
@@ -24,6 +24,8 @@ export { PhantomEvm } from './injected/PhantomEvm.js';
|
|
|
24
24
|
export { Trust } from './injected/Trust.js';
|
|
25
25
|
export { UnknownInjectedWallet } from './injected/UnknownInjectedWallet.js';
|
|
26
26
|
export { Zerion } from './injected/Zerion.js';
|
|
27
|
+
export { Rabby } from './injected/Rabby.js';
|
|
28
|
+
export { BackpackEvm } from './injected/BackpackEvm.js';
|
|
27
29
|
|
|
28
30
|
const EthereumWalletConnectors = (props) => [
|
|
29
31
|
...injectedWallets,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
+
var ethProviderHelper = require('../ethProviderHelper.cjs');
|
|
7
|
+
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
8
|
+
|
|
9
|
+
class BackpackEvm extends InjectedWalletBase {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.name = 'Backpack';
|
|
13
|
+
}
|
|
14
|
+
getConnectedAccounts() {
|
|
15
|
+
var _a;
|
|
16
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const provider = ethProviderHelper.EthProviderHelper.findProvider(this.name);
|
|
18
|
+
if (!provider)
|
|
19
|
+
return [];
|
|
20
|
+
return (_a = (yield provider.send('eth_requestAccounts', []))) !== null && _a !== void 0 ? _a : [];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.BackpackEvm = BackpackEvm;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { EthProviderHelper } from '../ethProviderHelper.js';
|
|
3
|
+
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
4
|
+
|
|
5
|
+
class BackpackEvm extends InjectedWalletBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.name = 'Backpack';
|
|
9
|
+
}
|
|
10
|
+
getConnectedAccounts() {
|
|
11
|
+
var _a;
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const provider = EthProviderHelper.findProvider(this.name);
|
|
14
|
+
if (!provider)
|
|
15
|
+
return [];
|
|
16
|
+
return (_a = (yield provider.send('eth_requestAccounts', []))) !== null && _a !== void 0 ? _a : [];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { BackpackEvm };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
|
+
|
|
7
|
+
class Rabby extends InjectedWalletBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = 'Rabby';
|
|
11
|
+
this.walletConnectorFallback = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.Rabby = Rabby;
|
package/src/injected/index.cjs
CHANGED
|
@@ -15,6 +15,8 @@ var Trust = require('./Trust.cjs');
|
|
|
15
15
|
var UnknownInjectedWallet = require('./UnknownInjectedWallet.cjs');
|
|
16
16
|
var Zerion = require('./Zerion.cjs');
|
|
17
17
|
var Superb = require('./Superb.cjs');
|
|
18
|
+
var Rabby = require('./Rabby.cjs');
|
|
19
|
+
var BackpackEvm = require('./BackpackEvm.cjs');
|
|
18
20
|
|
|
19
21
|
const injectedWallets = [
|
|
20
22
|
BloctoInjected.BloctoInjected,
|
|
@@ -30,6 +32,8 @@ const injectedWallets = [
|
|
|
30
32
|
UnknownInjectedWallet.UnknownInjectedWallet,
|
|
31
33
|
Zerion.Zerion,
|
|
32
34
|
Superb.Superb,
|
|
35
|
+
Rabby.Rabby,
|
|
36
|
+
BackpackEvm.BackpackEvm,
|
|
33
37
|
];
|
|
34
38
|
|
|
35
39
|
exports.BloctoInjected = BloctoInjected.BloctoInjected;
|
|
@@ -44,4 +48,6 @@ exports.PhantomEvm = PhantomEvm.PhantomEvm;
|
|
|
44
48
|
exports.Trust = Trust.Trust;
|
|
45
49
|
exports.UnknownInjectedWallet = UnknownInjectedWallet.UnknownInjectedWallet;
|
|
46
50
|
exports.Zerion = Zerion.Zerion;
|
|
51
|
+
exports.Rabby = Rabby.Rabby;
|
|
52
|
+
exports.BackpackEvm = BackpackEvm.BackpackEvm;
|
|
47
53
|
exports.injectedWallets = injectedWallets;
|
package/src/injected/index.d.ts
CHANGED
package/src/injected/index.js
CHANGED
|
@@ -23,6 +23,10 @@ export { UnknownInjectedWallet } from './UnknownInjectedWallet.js';
|
|
|
23
23
|
import { Zerion } from './Zerion.js';
|
|
24
24
|
export { Zerion } from './Zerion.js';
|
|
25
25
|
import { Superb } from './Superb.js';
|
|
26
|
+
import { Rabby } from './Rabby.js';
|
|
27
|
+
export { Rabby } from './Rabby.js';
|
|
28
|
+
import { BackpackEvm } from './BackpackEvm.js';
|
|
29
|
+
export { BackpackEvm } from './BackpackEvm.js';
|
|
26
30
|
|
|
27
31
|
const injectedWallets = [
|
|
28
32
|
BloctoInjected,
|
|
@@ -38,6 +42,8 @@ const injectedWallets = [
|
|
|
38
42
|
UnknownInjectedWallet,
|
|
39
43
|
Zerion,
|
|
40
44
|
Superb,
|
|
45
|
+
Rabby,
|
|
46
|
+
BackpackEvm,
|
|
41
47
|
];
|
|
42
48
|
|
|
43
49
|
export { injectedWallets };
|
package/src/types.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export type IEthereum = {
|
|
|
19
19
|
method: T;
|
|
20
20
|
} | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
|
|
21
21
|
};
|
|
22
|
-
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb';
|
|
22
|
+
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb' | 'isRabby' | 'isBackpack';
|
|
23
23
|
export type EthProviderCondition = ProviderCondition<ProviderFlag>;
|
|
@@ -139,6 +139,12 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
139
139
|
return client.accounts;
|
|
140
140
|
});
|
|
141
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
|
+
}
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
exports.WalletConnect = WalletConnect;
|
|
@@ -3,6 +3,19 @@ import { ethers } from 'ethers';
|
|
|
3
3
|
import { Chain, FetchPublicAddressOpts, WalletEventListeners } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { EvmNetwork } from '@dynamic-labs/types';
|
|
5
5
|
import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
6
|
+
type ConnectorSession = {
|
|
7
|
+
connected: boolean;
|
|
8
|
+
accounts: string[];
|
|
9
|
+
chainId: number;
|
|
10
|
+
bridge: string;
|
|
11
|
+
key: string;
|
|
12
|
+
clientId: string;
|
|
13
|
+
clientMeta: any;
|
|
14
|
+
peerId: string;
|
|
15
|
+
peerMeta: any;
|
|
16
|
+
handshakeId: number;
|
|
17
|
+
handshakeTopic: string;
|
|
18
|
+
};
|
|
6
19
|
export type WalletConnectOpts = EthWalletConnectorOpts & {
|
|
7
20
|
walletConnectV1Bridge: string;
|
|
8
21
|
walletName: string;
|
|
@@ -32,4 +45,6 @@ export declare class WalletConnect extends EthWalletConnector {
|
|
|
32
45
|
provider: ethers.providers.Web3Provider;
|
|
33
46
|
}): Promise<void>;
|
|
34
47
|
getConnectedAccounts(): Promise<string[]>;
|
|
48
|
+
getSession(): Promise<ConnectorSession | undefined>;
|
|
35
49
|
}
|
|
50
|
+
export {};
|
|
@@ -131,6 +131,12 @@ class WalletConnect extends EthWalletConnector {
|
|
|
131
131
|
return client.accounts;
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
+
getSession() {
|
|
135
|
+
var _a;
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
return (_a = this.client) === null || _a === void 0 ? void 0 : _a.session;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
export { WalletConnect };
|
|
@@ -32,6 +32,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
32
32
|
this.projectId = opts.projectId;
|
|
33
33
|
}
|
|
34
34
|
initConnection() {
|
|
35
|
+
var _a;
|
|
35
36
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
36
37
|
const { provider } = WalletConnectV2;
|
|
37
38
|
if (!provider) {
|
|
@@ -41,7 +42,9 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
41
42
|
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
const defaultChain =
|
|
45
|
+
const defaultChain = ((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)
|
|
46
|
+
? this.evmNetworks[0].chainId
|
|
47
|
+
: 1;
|
|
45
48
|
provider
|
|
46
49
|
.connect({
|
|
47
50
|
namespaces: {
|
|
@@ -66,6 +69,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
66
69
|
'eth_sign',
|
|
67
70
|
'personal_sign',
|
|
68
71
|
'eth_sendTransaction',
|
|
72
|
+
'eth_signTypedData_v4',
|
|
69
73
|
],
|
|
70
74
|
rpcMap: this.evmNetworkRpcMap(),
|
|
71
75
|
},
|
|
@@ -80,6 +84,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
80
84
|
createInitProviderPromise() {
|
|
81
85
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
82
86
|
const provider = yield Provider__default["default"].init({
|
|
87
|
+
logger: walletConnectorCore.logger.logLevel.toLowerCase() === 'debug' ? 'debug' : undefined,
|
|
83
88
|
projectId: this.projectId,
|
|
84
89
|
});
|
|
85
90
|
WalletConnectV2.provider = provider;
|
|
@@ -141,6 +146,9 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
143
148
|
(_a = listeners.onChainChange) === null || _a === void 0 ? void 0 : _a.call(listeners, String(chainId));
|
|
149
|
+
// When a user switches network from their wallet, we need the provider to change network
|
|
150
|
+
// such that any future calls to `getNetwork` will return the correct network
|
|
151
|
+
this.switchNetwork({ networkChainId: chainId });
|
|
144
152
|
}
|
|
145
153
|
else if (name === 'accountsChanged') {
|
|
146
154
|
if (!Array.isArray(data)) {
|
|
@@ -168,7 +176,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
168
176
|
}
|
|
169
177
|
getWeb3Provider() {
|
|
170
178
|
if (!WalletConnectV2.provider) {
|
|
171
|
-
|
|
179
|
+
return;
|
|
172
180
|
}
|
|
173
181
|
return new ethers.ethers.providers.Web3Provider(WalletConnectV2.provider, 'any');
|
|
174
182
|
}
|
|
@@ -222,8 +230,50 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
222
230
|
});
|
|
223
231
|
});
|
|
224
232
|
}
|
|
225
|
-
|
|
233
|
+
/**
|
|
234
|
+
* WalletConnect V2 will fail to send the sign message request if the chainId
|
|
235
|
+
* is not the same as the one in the session. This method will wait for the
|
|
236
|
+
* chainId to change and then retry the sign message request.
|
|
237
|
+
*
|
|
238
|
+
* Otherwise it will just return the result of the sign message request.
|
|
239
|
+
*
|
|
240
|
+
* @param signMessageFn - Function to sign message with provider
|
|
241
|
+
* @param messageToSign - Message to sign
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
waitForSignMessage(signMessageFn, messageToSign) {
|
|
245
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const raceConditionPromise = new Promise((resolve) => {
|
|
247
|
+
// Create listener for chain change event
|
|
248
|
+
this.setupEventListeners({
|
|
249
|
+
onChainChange: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
resolve({ success: false });
|
|
251
|
+
}),
|
|
252
|
+
});
|
|
253
|
+
signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
|
|
254
|
+
});
|
|
255
|
+
const signedMessageResult = yield raceConditionPromise;
|
|
256
|
+
if (signedMessageResult.success === false) {
|
|
257
|
+
return signMessageFn(messageToSign);
|
|
258
|
+
}
|
|
259
|
+
return signedMessageResult.signedMessage;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
getDeepLink() {
|
|
226
263
|
var _a, _b;
|
|
264
|
+
if (!this.session) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const metadata = walletBook.getWalletBookWallet(this.walletBook, this.name);
|
|
268
|
+
const deepLink = ((_a = metadata['mobile']) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata['mobile']) === null || _b === void 0 ? void 0 : _b.universal);
|
|
269
|
+
if (!deepLink) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// we need to include the session topic here because it helps the wallet
|
|
273
|
+
// auto redirect back to the dapp after signing
|
|
274
|
+
return `${deepLink}?sessionTopic=${this.session.topic}`;
|
|
275
|
+
}
|
|
276
|
+
signMessage(messageToSign) {
|
|
227
277
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
228
278
|
if (!this.session) {
|
|
229
279
|
throw new utils.DynamicError('no session');
|
|
@@ -231,29 +281,21 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
231
281
|
if (!WalletConnectV2.provider) {
|
|
232
282
|
throw new utils.DynamicError('No WalletConnect provider found to handle signing');
|
|
233
283
|
}
|
|
234
|
-
const
|
|
235
|
-
if (utils.isMobile()) {
|
|
236
|
-
const deepLink = ((_a = metadata['mobile']) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata['mobile']) === null || _b === void 0 ? void 0 : _b.universal) || '';
|
|
284
|
+
const deepLink = this.getDeepLink();
|
|
285
|
+
if (utils.isMobile() && deepLink) {
|
|
237
286
|
window.location.href = deepLink;
|
|
238
287
|
}
|
|
239
288
|
const web3Provider = this.getWeb3Provider();
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.activeAccount,
|
|
243
|
-
]);
|
|
244
|
-
try {
|
|
245
|
-
// A terrible hack to get MM to sign the message when it is on the wrong chain
|
|
246
|
-
// Since MM supports only one chain at a time, it just hangs when we call
|
|
247
|
-
// to sign, and it is not on Mainnet. For some magical reason,
|
|
248
|
-
// when we attempt to call again it just works.
|
|
249
|
-
if (this.key === 'metamask') {
|
|
250
|
-
yield this.promiseWithTimeout(7000, response);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
catch (e) {
|
|
254
|
-
walletConnectorCore.logger.debug('metmask failed to sign message');
|
|
255
|
-
throw e;
|
|
289
|
+
if (!web3Provider) {
|
|
290
|
+
throw new utils.DynamicError('No web3 provider found');
|
|
256
291
|
}
|
|
292
|
+
const signMessageFn = (messageToSign) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
return web3Provider.send('personal_sign', [
|
|
294
|
+
walletConnectorCore.utf8ToHex(messageToSign, true),
|
|
295
|
+
this.activeAccount,
|
|
296
|
+
]);
|
|
297
|
+
});
|
|
298
|
+
const response = yield this.waitForSignMessage(signMessageFn, messageToSign);
|
|
257
299
|
return response;
|
|
258
300
|
});
|
|
259
301
|
}
|
|
@@ -283,7 +325,10 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
283
325
|
}
|
|
284
326
|
try {
|
|
285
327
|
yield WalletConnectV2.provider.disconnect();
|
|
286
|
-
|
|
328
|
+
// We must unset provider on logout so that a new session can be established
|
|
329
|
+
// If we don't then the provider will still have the old session and will hang
|
|
330
|
+
WalletConnectV2.provider = undefined;
|
|
331
|
+
this.initializePromise = undefined; // Needed so we can re-initiliza the provider
|
|
287
332
|
}
|
|
288
333
|
catch (e) {
|
|
289
334
|
walletConnectorCore.logger.debug(e);
|
|
@@ -350,18 +395,6 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
350
395
|
return chains.length ? chains : undefined;
|
|
351
396
|
});
|
|
352
397
|
}
|
|
353
|
-
// a HACK for MM to sign message when the selected chain is not mainnet
|
|
354
|
-
promiseWithTimeout(ms, promise) {
|
|
355
|
-
// Create a promise that rejects in <ms> milliseconds
|
|
356
|
-
const timeout = new Promise((_, reject) => {
|
|
357
|
-
const id = setTimeout(() => {
|
|
358
|
-
clearTimeout(id);
|
|
359
|
-
reject(new utils.DynamicError(undefined, 'metamask_timeout'));
|
|
360
|
-
}, ms);
|
|
361
|
-
});
|
|
362
|
-
// Returns a race between our timeout and the passed in promise
|
|
363
|
-
return Promise.race([promise, timeout]);
|
|
364
|
-
}
|
|
365
398
|
}
|
|
366
399
|
|
|
367
400
|
exports.WalletConnectV2 = WalletConnectV2;
|
|
@@ -30,8 +30,21 @@ export declare class WalletConnectV2 extends EthWalletConnector {
|
|
|
30
30
|
supportsNetworkSwitching(): boolean;
|
|
31
31
|
setupEventListeners(listeners: WalletEventListeners): void;
|
|
32
32
|
teardownEventListeners(): void;
|
|
33
|
-
getWeb3Provider(): ethers.providers.Web3Provider;
|
|
33
|
+
getWeb3Provider(): ethers.providers.Web3Provider | undefined;
|
|
34
34
|
fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* WalletConnect V2 will fail to send the sign message request if the chainId
|
|
37
|
+
* is not the same as the one in the session. This method will wait for the
|
|
38
|
+
* chainId to change and then retry the sign message request.
|
|
39
|
+
*
|
|
40
|
+
* Otherwise it will just return the result of the sign message request.
|
|
41
|
+
*
|
|
42
|
+
* @param signMessageFn - Function to sign message with provider
|
|
43
|
+
* @param messageToSign - Message to sign
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
protected waitForSignMessage(signMessageFn: (messageToSign: string) => Promise<string | undefined>, messageToSign: string): Promise<string | undefined>;
|
|
47
|
+
getDeepLink(): string | undefined;
|
|
35
48
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
36
49
|
private clearActiveAccount;
|
|
37
50
|
private clearSession;
|
|
@@ -45,5 +58,4 @@ export declare class WalletConnectV2 extends EthWalletConnector {
|
|
|
45
58
|
}): Promise<void>;
|
|
46
59
|
getConnectedAccounts(): Promise<string[]>;
|
|
47
60
|
getSupportedNetworks(): Promise<string[] | undefined>;
|
|
48
|
-
private promiseWithTimeout;
|
|
49
61
|
}
|
|
@@ -23,6 +23,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
23
23
|
this.projectId = opts.projectId;
|
|
24
24
|
}
|
|
25
25
|
initConnection() {
|
|
26
|
+
var _a;
|
|
26
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
28
|
const { provider } = WalletConnectV2;
|
|
28
29
|
if (!provider) {
|
|
@@ -32,7 +33,9 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
32
33
|
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
const defaultChain =
|
|
36
|
+
const defaultChain = ((_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.length)
|
|
37
|
+
? this.evmNetworks[0].chainId
|
|
38
|
+
: 1;
|
|
36
39
|
provider
|
|
37
40
|
.connect({
|
|
38
41
|
namespaces: {
|
|
@@ -57,6 +60,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
57
60
|
'eth_sign',
|
|
58
61
|
'personal_sign',
|
|
59
62
|
'eth_sendTransaction',
|
|
63
|
+
'eth_signTypedData_v4',
|
|
60
64
|
],
|
|
61
65
|
rpcMap: this.evmNetworkRpcMap(),
|
|
62
66
|
},
|
|
@@ -71,6 +75,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
71
75
|
createInitProviderPromise() {
|
|
72
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
77
|
const provider = yield Provider.init({
|
|
78
|
+
logger: logger.logLevel.toLowerCase() === 'debug' ? 'debug' : undefined,
|
|
74
79
|
projectId: this.projectId,
|
|
75
80
|
});
|
|
76
81
|
WalletConnectV2.provider = provider;
|
|
@@ -132,6 +137,9 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
132
137
|
return;
|
|
133
138
|
}
|
|
134
139
|
(_a = listeners.onChainChange) === null || _a === void 0 ? void 0 : _a.call(listeners, String(chainId));
|
|
140
|
+
// When a user switches network from their wallet, we need the provider to change network
|
|
141
|
+
// such that any future calls to `getNetwork` will return the correct network
|
|
142
|
+
this.switchNetwork({ networkChainId: chainId });
|
|
135
143
|
}
|
|
136
144
|
else if (name === 'accountsChanged') {
|
|
137
145
|
if (!Array.isArray(data)) {
|
|
@@ -159,7 +167,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
159
167
|
}
|
|
160
168
|
getWeb3Provider() {
|
|
161
169
|
if (!WalletConnectV2.provider) {
|
|
162
|
-
|
|
170
|
+
return;
|
|
163
171
|
}
|
|
164
172
|
return new ethers.providers.Web3Provider(WalletConnectV2.provider, 'any');
|
|
165
173
|
}
|
|
@@ -213,8 +221,50 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
213
221
|
});
|
|
214
222
|
});
|
|
215
223
|
}
|
|
216
|
-
|
|
224
|
+
/**
|
|
225
|
+
* WalletConnect V2 will fail to send the sign message request if the chainId
|
|
226
|
+
* is not the same as the one in the session. This method will wait for the
|
|
227
|
+
* chainId to change and then retry the sign message request.
|
|
228
|
+
*
|
|
229
|
+
* Otherwise it will just return the result of the sign message request.
|
|
230
|
+
*
|
|
231
|
+
* @param signMessageFn - Function to sign message with provider
|
|
232
|
+
* @param messageToSign - Message to sign
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
waitForSignMessage(signMessageFn, messageToSign) {
|
|
236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
const raceConditionPromise = new Promise((resolve) => {
|
|
238
|
+
// Create listener for chain change event
|
|
239
|
+
this.setupEventListeners({
|
|
240
|
+
onChainChange: () => __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
resolve({ success: false });
|
|
242
|
+
}),
|
|
243
|
+
});
|
|
244
|
+
signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
|
|
245
|
+
});
|
|
246
|
+
const signedMessageResult = yield raceConditionPromise;
|
|
247
|
+
if (signedMessageResult.success === false) {
|
|
248
|
+
return signMessageFn(messageToSign);
|
|
249
|
+
}
|
|
250
|
+
return signedMessageResult.signedMessage;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
getDeepLink() {
|
|
217
254
|
var _a, _b;
|
|
255
|
+
if (!this.session) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const metadata = getWalletBookWallet(this.walletBook, this.name);
|
|
259
|
+
const deepLink = ((_a = metadata['mobile']) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata['mobile']) === null || _b === void 0 ? void 0 : _b.universal);
|
|
260
|
+
if (!deepLink) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// we need to include the session topic here because it helps the wallet
|
|
264
|
+
// auto redirect back to the dapp after signing
|
|
265
|
+
return `${deepLink}?sessionTopic=${this.session.topic}`;
|
|
266
|
+
}
|
|
267
|
+
signMessage(messageToSign) {
|
|
218
268
|
return __awaiter(this, void 0, void 0, function* () {
|
|
219
269
|
if (!this.session) {
|
|
220
270
|
throw new DynamicError('no session');
|
|
@@ -222,29 +272,21 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
222
272
|
if (!WalletConnectV2.provider) {
|
|
223
273
|
throw new DynamicError('No WalletConnect provider found to handle signing');
|
|
224
274
|
}
|
|
225
|
-
const
|
|
226
|
-
if (isMobile()) {
|
|
227
|
-
const deepLink = ((_a = metadata['mobile']) === null || _a === void 0 ? void 0 : _a.native) || ((_b = metadata['mobile']) === null || _b === void 0 ? void 0 : _b.universal) || '';
|
|
275
|
+
const deepLink = this.getDeepLink();
|
|
276
|
+
if (isMobile() && deepLink) {
|
|
228
277
|
window.location.href = deepLink;
|
|
229
278
|
}
|
|
230
279
|
const web3Provider = this.getWeb3Provider();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.activeAccount,
|
|
234
|
-
]);
|
|
235
|
-
try {
|
|
236
|
-
// A terrible hack to get MM to sign the message when it is on the wrong chain
|
|
237
|
-
// Since MM supports only one chain at a time, it just hangs when we call
|
|
238
|
-
// to sign, and it is not on Mainnet. For some magical reason,
|
|
239
|
-
// when we attempt to call again it just works.
|
|
240
|
-
if (this.key === 'metamask') {
|
|
241
|
-
yield this.promiseWithTimeout(7000, response);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
catch (e) {
|
|
245
|
-
logger.debug('metmask failed to sign message');
|
|
246
|
-
throw e;
|
|
280
|
+
if (!web3Provider) {
|
|
281
|
+
throw new DynamicError('No web3 provider found');
|
|
247
282
|
}
|
|
283
|
+
const signMessageFn = (messageToSign) => __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
return web3Provider.send('personal_sign', [
|
|
285
|
+
utf8ToHex(messageToSign, true),
|
|
286
|
+
this.activeAccount,
|
|
287
|
+
]);
|
|
288
|
+
});
|
|
289
|
+
const response = yield this.waitForSignMessage(signMessageFn, messageToSign);
|
|
248
290
|
return response;
|
|
249
291
|
});
|
|
250
292
|
}
|
|
@@ -274,7 +316,10 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
274
316
|
}
|
|
275
317
|
try {
|
|
276
318
|
yield WalletConnectV2.provider.disconnect();
|
|
277
|
-
|
|
319
|
+
// We must unset provider on logout so that a new session can be established
|
|
320
|
+
// If we don't then the provider will still have the old session and will hang
|
|
321
|
+
WalletConnectV2.provider = undefined;
|
|
322
|
+
this.initializePromise = undefined; // Needed so we can re-initiliza the provider
|
|
278
323
|
}
|
|
279
324
|
catch (e) {
|
|
280
325
|
logger.debug(e);
|
|
@@ -341,18 +386,6 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
341
386
|
return chains.length ? chains : undefined;
|
|
342
387
|
});
|
|
343
388
|
}
|
|
344
|
-
// a HACK for MM to sign message when the selected chain is not mainnet
|
|
345
|
-
promiseWithTimeout(ms, promise) {
|
|
346
|
-
// Create a promise that rejects in <ms> milliseconds
|
|
347
|
-
const timeout = new Promise((_, reject) => {
|
|
348
|
-
const id = setTimeout(() => {
|
|
349
|
-
clearTimeout(id);
|
|
350
|
-
reject(new DynamicError(undefined, 'metamask_timeout'));
|
|
351
|
-
}, ms);
|
|
352
|
-
});
|
|
353
|
-
// Returns a race between our timeout and the passed in promise
|
|
354
|
-
return Promise.race([promise, timeout]);
|
|
355
|
-
}
|
|
356
389
|
}
|
|
357
390
|
|
|
358
391
|
export { WalletConnectV2 };
|