@dynamic-labs/ethereum-aa 2.0.0-alpha.9 → 2.0.1
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 +328 -0
- package/package.json +10 -9
- package/src/ZeroDevConnector.cjs +54 -27
- package/src/ZeroDevConnector.d.ts +280 -10
- package/src/ZeroDevConnector.js +56 -29
- package/src/index.cjs +7 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +7 -1
- package/src/utils/fetchChain.cjs +3 -24
- package/src/utils/fetchChain.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,332 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0...v2.0.1) (2024-04-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([#5383](https://github.com/dynamic-labs/DynamicAuth/issues/5383)) ([d031d7e](https://github.com/dynamic-labs/DynamicAuth/commit/d031d7ee5705de5ec83ef328f03633d5f3524786))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* copy and ui fixes ([#5367](https://github.com/dynamic-labs/DynamicAuth/issues/5367)) ([e39ea97](https://github.com/dynamic-labs/DynamicAuth/commit/e39ea97d98de6b7087c24f2326a5fdc07ab9c8c3))
|
|
13
|
+
* bitcoin connector improvements
|
|
14
|
+
* solana package improvements ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([#5385](https://github.com/dynamic-labs/DynamicAuth/issues/5385)) ([9010bce](https://github.com/dynamic-labs/DynamicAuth/commit/9010bcebb4b0f2d293d517347187d38accbac0d3))
|
|
15
|
+
|
|
16
|
+
## [2.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.31...v2.0.0-alpha.32) (2024-04-15)
|
|
17
|
+
|
|
18
|
+
## [2.0.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.30...v2.0.0-alpha.31) (2024-04-11)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* support adding email for recovery to existing embedded wallet ([#5128](https://github.com/dynamic-labs/DynamicAuth/issues/5128)) ([477fd81](https://github.com/dynamic-labs/DynamicAuth/commit/477fd81ac00864284d9d2183c0b8c078a0a23a2b))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* issue where customer also tries to use i18n.init ([#5267](https://github.com/dynamic-labs/DynamicAuth/issues/5267)) ([7f81f1e](https://github.com/dynamic-labs/DynamicAuth/commit/7f81f1e010fbc6408f6a5d6a37608235e947befa))
|
|
29
|
+
* smart wallet not loading correctly upon refresh when using non-embedded eoa wallet ([#5301](https://github.com/dynamic-labs/DynamicAuth/issues/5301)) ([e957317](https://github.com/dynamic-labs/DynamicAuth/commit/e9573173f6209773a0be5f4af37323f2be8d7906))
|
|
30
|
+
|
|
31
|
+
## [2.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.29...v2.0.0-alpha.30) (2024-04-11)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### ⚠ BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* add headless sms sign-in (#5274)
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
* add headless sms sign-in ([#5274](https://github.com/dynamic-labs/DynamicAuth/issues/5274)) ([fffc293](https://github.com/dynamic-labs/DynamicAuth/commit/fffc293f85447a784e8c728d1586f3555ab1fbfa))
|
|
41
|
+
|
|
42
|
+
## [2.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.28...v2.0.0-alpha.29) (2024-04-10)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### ⚠ BREAKING CHANGES
|
|
46
|
+
|
|
47
|
+
* replace sdk-api with sdk-api-core (#5280)
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* add dynamic client context ([#5250](https://github.com/dynamic-labs/DynamicAuth/issues/5250)) ([778ebe6](https://github.com/dynamic-labs/DynamicAuth/commit/778ebe6313e0bf3c9876feb6eff5bf152c15c55e))
|
|
52
|
+
* **webview-controller:** fetch manifest and render Dynamic SDK ([#5287](https://github.com/dynamic-labs/DynamicAuth/issues/5287)) ([00e84ac](https://github.com/dynamic-labs/DynamicAuth/commit/00e84acc4bdda92bad91108788f8d7882d0790d6))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* don't render modal header component if there's no content ([#5269](https://github.com/dynamic-labs/DynamicAuth/issues/5269)) ([f4d7266](https://github.com/dynamic-labs/DynamicAuth/commit/f4d72668a5243108649774c6581733655f385cab))
|
|
58
|
+
* don't show get extension button when there are no download links ([#5276](https://github.com/dynamic-labs/DynamicAuth/issues/5276)) ([e8cf660](https://github.com/dynamic-labs/DynamicAuth/commit/e8cf66076a9914881a8edda69feb2fb192ac63a3))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
* replace sdk-api with sdk-api-core ([#5280](https://github.com/dynamic-labs/DynamicAuth/issues/5280)) ([da4b695](https://github.com/dynamic-labs/DynamicAuth/commit/da4b6955a81d6bfb5c994cd62e21e9ae11a4f454))
|
|
62
|
+
|
|
63
|
+
## [2.0.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.27...v2.0.0-alpha.28) (2024-04-10)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* improve bridge connect experience on mobile ([#5283](https://github.com/dynamic-labs/DynamicAuth/issues/5283)) ([155e4a9](https://github.com/dynamic-labs/DynamicAuth/commit/155e4a99e2cf5f78a1a5e91e774acbf170d6b083))
|
|
69
|
+
|
|
70
|
+
## [2.0.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.26...v2.0.0-alpha.27) (2024-04-09)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
* coinbase improvements ([#5268](https://github.com/dynamic-labs/DynamicAuth/issues/5268)) ([c10a6de](https://github.com/dynamic-labs/DynamicAuth/commit/c10a6debcacff6cd97f2436fbde387f85faa5682))
|
|
76
|
+
* show qr code for metamask on desktop when not installed ([#5262](https://github.com/dynamic-labs/DynamicAuth/issues/5262)) ([1dcb4d9](https://github.com/dynamic-labs/DynamicAuth/commit/1dcb4d98de8a95f6b11d7bad90b9059110087385))
|
|
77
|
+
* update title of hardware wallet select screen ([#5270](https://github.com/dynamic-labs/DynamicAuth/issues/5270)) ([6e8fe17](https://github.com/dynamic-labs/DynamicAuth/commit/6e8fe17306677786ccf528b97ab673b9ae6b57b9))
|
|
78
|
+
|
|
79
|
+
## [2.0.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.25...v2.0.0-alpha.26) (2024-04-08)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### ⚠ BREAKING CHANGES
|
|
83
|
+
|
|
84
|
+
* add onWalletAdded/onWalletRemoved callbacks and removed onConnect/onDisconnect/onLinkSuccess/onUnlinkSuccess (#5194)
|
|
85
|
+
* note:
|
|
86
|
+
- use "events" in favour of "eventsCallbacks"
|
|
87
|
+
- use "handlers.handleConnectedWallet" in favour of "eventsCallbacks.onBeforeConnectSuccessConfirmation"
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* coinbase wallet settings ([#5233](https://github.com/dynamic-labs/DynamicAuth/issues/5233)) ([1b04411](https://github.com/dynamic-labs/DynamicAuth/commit/1b04411eb90db438f3eacf622d9c28db4c7cf532))
|
|
92
|
+
* remove local storage settings on logout ([#5212](https://github.com/dynamic-labs/DynamicAuth/issues/5212)) ([e686628](https://github.com/dynamic-labs/DynamicAuth/commit/e686628f602a44cd13083e7bb9afb4f50304390e))
|
|
93
|
+
* show app name or logo in sign message modal ([#5225](https://github.com/dynamic-labs/DynamicAuth/issues/5225)) ([a77b6ba](https://github.com/dynamic-labs/DynamicAuth/commit/a77b6ba9b5646b400ebf933949dabe06a35d1c81))
|
|
94
|
+
* user wallets not being cleared immediately when logout is called ([#5211](https://github.com/dynamic-labs/DynamicAuth/issues/5211)) ([a649c46](https://github.com/dynamic-labs/DynamicAuth/commit/a649c462d171cf6f8d67159df9f5f2144f315e5c))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
* add onWalletAdded/onWalletRemoved callbacks and removed onConnect/onDisconnect/onLinkSuccess/onUnlinkSuccess ([#5194](https://github.com/dynamic-labs/DynamicAuth/issues/5194)) ([fdec78c](https://github.com/dynamic-labs/DynamicAuth/commit/fdec78c1c32c58c8f7dc7ffd9b877320aa4d90e0))
|
|
98
|
+
* rename eventsCallbacks to events ([#5196](https://github.com/dynamic-labs/DynamicAuth/issues/5196)) ([5797185](https://github.com/dynamic-labs/DynamicAuth/commit/5797185c18fa091032ef27043b63a1d5201b5e23))
|
|
99
|
+
|
|
100
|
+
## [2.0.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2024-04-04)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Features
|
|
104
|
+
|
|
105
|
+
* add in-app browser deeplink for metamask ([#5176](https://github.com/dynamic-labs/DynamicAuth/issues/5176)) ([02ce607](https://github.com/dynamic-labs/DynamicAuth/commit/02ce6077ed0deeaefc7a62ee91ff72f5bce2b327)), closes [#5123](https://github.com/dynamic-labs/DynamicAuth/issues/5123)
|
|
106
|
+
|
|
107
|
+
## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### ⚠ BREAKING CHANGES
|
|
111
|
+
|
|
112
|
+
* rename otp verification callbacks (#5180)
|
|
113
|
+
* remove deprecated isVerificationInProgress flag and setter (#5089)
|
|
114
|
+
|
|
115
|
+
### Features
|
|
116
|
+
|
|
117
|
+
* allow creating embedded wallets even if user signs in with a wallet ([#5093](https://github.com/dynamic-labs/DynamicAuth/issues/5093)) ([ba2dd62](https://github.com/dynamic-labs/DynamicAuth/commit/ba2dd625e0a7bf35018cf8aac8e80bd23b4e3b0f))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
* api unit test by removing api and sdk versions for assertion ([#5168](https://github.com/dynamic-labs/DynamicAuth/issues/5168)) ([6d3b8ad](https://github.com/dynamic-labs/DynamicAuth/commit/6d3b8adebe62a4f2a7878630384348b2c491d779))
|
|
123
|
+
* bug when phone input is empty ([#5139](https://github.com/dynamic-labs/DynamicAuth/issues/5139)) ([7155b63](https://github.com/dynamic-labs/DynamicAuth/commit/7155b63518d00ba807bc321c6740b341d0a8b82f))
|
|
124
|
+
* clear error message on otp resend for sms ([#5182](https://github.com/dynamic-labs/DynamicAuth/issues/5182)) ([f40b48c](https://github.com/dynamic-labs/DynamicAuth/commit/f40b48c7f58c8e3dfe73fb124d642c3b8f193cee))
|
|
125
|
+
* link farcaster account ([#5170](https://github.com/dynamic-labs/DynamicAuth/issues/5170)) ([10fe272](https://github.com/dynamic-labs/DynamicAuth/commit/10fe272247605b5f09385f063231e2c881399cc8))
|
|
126
|
+
* show correct otp message for sms verification failure ([#5177](https://github.com/dynamic-labs/DynamicAuth/issues/5177)) ([b3bcd76](https://github.com/dynamic-labs/DynamicAuth/commit/b3bcd7694047dac55ce37babb71684a418633f95))
|
|
127
|
+
* update wagmi connector id when wallet connector changes ([#5185](https://github.com/dynamic-labs/DynamicAuth/issues/5185)) ([14fb83a](https://github.com/dynamic-labs/DynamicAuth/commit/14fb83a22c8e39095b79cc9951cae3f00f4fca2f))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
* remove deprecated isVerificationInProgress flag and setter ([#5089](https://github.com/dynamic-labs/DynamicAuth/issues/5089)) ([060fef7](https://github.com/dynamic-labs/DynamicAuth/commit/060fef70df0c497e7a9b6e67ad0bfafef52c2bbb))
|
|
131
|
+
* rename otp verification callbacks ([#5180](https://github.com/dynamic-labs/DynamicAuth/issues/5180)) ([a580eec](https://github.com/dynamic-labs/DynamicAuth/commit/a580eec02d15b46a25c01d5473e4db2db89937e2))
|
|
132
|
+
|
|
133
|
+
## [2.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2024-04-01)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### ⚠ BREAKING CHANGES
|
|
137
|
+
|
|
138
|
+
* implement proper solana embedded wallet signer (#5092)
|
|
139
|
+
* prevent adding temporary wallet connection to userWallets (#5104)
|
|
140
|
+
|
|
141
|
+
### Bug Fixes
|
|
142
|
+
|
|
143
|
+
* Multiple WC bug fixes ([#5142](https://github.com/dynamic-labs/DynamicAuth/issues/5142)) ([92236e6](https://github.com/dynamic-labs/DynamicAuth/commit/92236e6d74c28516403f6df79c539406ece3d6d0)) ([#5132](https://github.com/dynamic-labs/DynamicAuth/issues/5132)) ([99f564a](https://github.com/dynamic-labs/DynamicAuth/commit/99f564a39e35e28af0be2a03617f12aa19cbeb7f))
|
|
144
|
+
|
|
145
|
+
* Better handling of empty callback queue([#5147](https://github.com/dynamic-labs/DynamicAuth/issues/5147)) ([e2d6bf2](https://github.com/dynamic-labs/DynamicAuth/commit/e2d6bf2444ca01199796ead4136f34b81b6c9b61))
|
|
146
|
+
|
|
147
|
+
* multiple improvements to the wallet list ([#5112](https://github.com/dynamic-labs/DynamicAuth/issues/5112)) ([00eec5f](https://github.com/dynamic-labs/DynamicAuth/commit/00eec5fde70548c3d771260f3d86e5365e73878d))
|
|
148
|
+
|
|
149
|
+
* Improved scroll experience on ios ([#5152](https://github.com/dynamic-labs/DynamicAuth/issues/5152)) ([341704f](https://github.com/dynamic-labs/DynamicAuth/commit/341704f99cb6e06f253309f3a8afb1684bb8ae2a))
|
|
150
|
+
|
|
151
|
+
* better handling of multiwallet state([#5146](https://github.com/dynamic-labs/DynamicAuth/issues/5146)) ([403267b](https://github.com/dynamic-labs/DynamicAuth/commit/403267b3c268d648aba155e0b6fea31d7fdc1b56))
|
|
152
|
+
|
|
153
|
+
* show correct OTP error message ([#5135](https://github.com/dynamic-labs/DynamicAuth/issues/5135)) ([e7494ce](https://github.com/dynamic-labs/DynamicAuth/commit/e7494cee4a1b5132af91058cbcb2dae0b7eac44b))
|
|
154
|
+
|
|
155
|
+
* implement proper solana embedded wallet signer ([#5092](https://github.com/dynamic-labs/DynamicAuth/issues/5092)) ([7749b97](https://github.com/dynamic-labs/DynamicAuth/commit/7749b97db49fb9af8ae0668172f478e1f0c29665))
|
|
156
|
+
|
|
157
|
+
* prevent adding temporary wallet connection to userWallets ([#5104](https://github.com/dynamic-labs/DynamicAuth/issues/5104)) ([3c02b78](https://github.com/dynamic-labs/DynamicAuth/commit/3c02b781c997c63ff11a7f1c255b92d10962327f))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## [2.0.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2024-03-27)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### ⚠ BREAKING CHANGES
|
|
164
|
+
|
|
165
|
+
* remove isFullyConnected (#5066)
|
|
166
|
+
* remove and deprecated exported methods (#5065)
|
|
167
|
+
* remove emailOnly provider
|
|
168
|
+
|
|
169
|
+
### Features
|
|
170
|
+
|
|
171
|
+
* add method property to track which phantom connector function was called ([#5044](https://github.com/dynamic-labs/DynamicAuth/issues/5044)) ([f820cd4](https://github.com/dynamic-labs/DynamicAuth/commit/f820cd4c7e047fd5181115b4d388e54df682e5c8))
|
|
172
|
+
* add signAndSendTransaction to phantom redirect connector ([#5054](https://github.com/dynamic-labs/DynamicAuth/issues/5054)) ([694a300](https://github.com/dynamic-labs/DynamicAuth/commit/694a3003c8765098878a5c95174be5eba4509fc2))
|
|
173
|
+
* implement remaining signer methods on phantom redirect connector ([#5060](https://github.com/dynamic-labs/DynamicAuth/issues/5060)) ([29db446](https://github.com/dynamic-labs/DynamicAuth/commit/29db4464de6eea11c92a8080fed1eb3e7588b2b8))
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Bug Fixes
|
|
177
|
+
|
|
178
|
+
* add recommended wallet tags to the WalletSimpleSignIn component ([#5041](https://github.com/dynamic-labs/DynamicAuth/issues/5041)) ([aefde4d](https://github.com/dynamic-labs/DynamicAuth/commit/aefde4d927427c131dce4402eb3c705527c64e8f))
|
|
179
|
+
* display invalid phone number error ([#5103](https://github.com/dynamic-labs/DynamicAuth/issues/5103)) ([842c0ba](https://github.com/dynamic-labs/DynamicAuth/commit/842c0ba3cfe1120c166f12410efbc346d8e30ed0))
|
|
180
|
+
* ensure the user field modals uses the base widget context ([#5105](https://github.com/dynamic-labs/DynamicAuth/issues/5105)) ([aa2a545](https://github.com/dynamic-labs/DynamicAuth/commit/aa2a545bdbf6f38f4131ccdde61142389dbf5480))
|
|
181
|
+
* force aspect ratio for social icon pfps ([#5072](https://github.com/dynamic-labs/DynamicAuth/issues/5072)) ([6f611a7](https://github.com/dynamic-labs/DynamicAuth/commit/6f611a7cbe41d66796449b28af919bc93a7bae42))
|
|
182
|
+
* handle too many email verifications error ([#5051](https://github.com/dynamic-labs/DynamicAuth/issues/5051)) ([7af96df](https://github.com/dynamic-labs/DynamicAuth/commit/7af96dfb85cdc68577fdb8cc880e2fd09bcff5af))
|
|
183
|
+
* hardcode zerion provider and update walletbook to prevent showing up as metamask when not installed ([#5071](https://github.com/dynamic-labs/DynamicAuth/issues/5071)) ([3ab6c37](https://github.com/dynamic-labs/DynamicAuth/commit/3ab6c3772efe2c2e3259ca7a9dbb92e924314029))
|
|
184
|
+
* issue where ethereum is tree shaken ([#5028](https://github.com/dynamic-labs/DynamicAuth/issues/5028)) ([fda542d](https://github.com/dynamic-labs/DynamicAuth/commit/fda542db2b65a437004fe809a0ea9f90fde47b13))
|
|
185
|
+
* not clearing the loading when creating an embedded wallet ([323086f](https://github.com/dynamic-labs/DynamicAuth/commit/323086f673fb8a2108b8262181511987d0bc1d09))
|
|
186
|
+
* solflare double connection on page refresh ([#5083](https://github.com/dynamic-labs/DynamicAuth/issues/5083)) ([ef76005](https://github.com/dynamic-labs/DynamicAuth/commit/ef7600564b646cf45396287a0d6b6f1420473b04))
|
|
187
|
+
* swap out findProvider for getSigner on solflare ([#5057](https://github.com/dynamic-labs/DynamicAuth/issues/5057)) ([b78827f](https://github.com/dynamic-labs/DynamicAuth/commit/b78827f8fd87a594114908d890f58b8771123383))
|
|
188
|
+
* validate user session whenever user is connected/authenticated ([#5082](https://github.com/dynamic-labs/DynamicAuth/issues/5082)) ([432faa0](https://github.com/dynamic-labs/DynamicAuth/commit/432faa0a69b43cb7324a252a2450db3cbd3b4b12))
|
|
189
|
+
* walletconnect improvements and fixes ([#5085](https://github.com/dynamic-labs/DynamicAuth/issues/5085)) ([bb42566](https://github.com/dynamic-labs/DynamicAuth/commit/bb425666aef5071b7827ef0aa167a328493f1ae7))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
* remove and deprecated exported methods ([#5065](https://github.com/dynamic-labs/DynamicAuth/issues/5065)) ([63af7ea](https://github.com/dynamic-labs/DynamicAuth/commit/63af7ea691b2112032de332f2b3558ac6260a38d))
|
|
193
|
+
* remove emailOnly provider ([60a30bc](https://github.com/dynamic-labs/DynamicAuth/commit/60a30bc2f242de19d9c6167279fc44b7f9395ac8))
|
|
194
|
+
* remove isFullyConnected ([#5066](https://github.com/dynamic-labs/DynamicAuth/issues/5066)) ([0a662d9](https://github.com/dynamic-labs/DynamicAuth/commit/0a662d9eda19045f13c21ad1b5238ca11594fde5))
|
|
195
|
+
|
|
196
|
+
## [2.0.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.20...v2.0.0-alpha.21) (2024-03-20)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
### Features
|
|
200
|
+
|
|
201
|
+
* implement barebones signer in PhantomRedirect connector ([#5043](https://github.com/dynamic-labs/DynamicAuth/issues/5043)) ([4d7ff79](https://github.com/dynamic-labs/DynamicAuth/commit/4d7ff79acfe554d651791139b5e1d23ebafe712c))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Bug Fixes
|
|
205
|
+
|
|
206
|
+
* find embedded wallets when no chain is specified ([#5036](https://github.com/dynamic-labs/DynamicAuth/issues/5036)) ([ac50742](https://github.com/dynamic-labs/DynamicAuth/commit/ac50742c6002f48aae7b60c9ec094eb12df8dcca))
|
|
207
|
+
* ignore walletconnect chainChange event when it's the same chain ([#5029](https://github.com/dynamic-labs/DynamicAuth/issues/5029)) ([115311a](https://github.com/dynamic-labs/DynamicAuth/commit/115311a4a64ae35317b8864f93c38203566714fc))
|
|
208
|
+
|
|
209
|
+
## [2.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2024-03-19)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Bug Fixes
|
|
213
|
+
|
|
214
|
+
* prevent solflare connect popping up on page refresh when connected ([#5032](https://github.com/dynamic-labs/DynamicAuth/issues/5032)) ([28175a9](https://github.com/dynamic-labs/DynamicAuth/commit/28175a9af43f3e7f2cab30148563eaf5573477d1))
|
|
215
|
+
* show correct user identifier in onboarding view ([#5021](https://github.com/dynamic-labs/DynamicAuth/issues/5021)) ([c84747f](https://github.com/dynamic-labs/DynamicAuth/commit/c84747f01eb2a0a827ca48e62f03739d4e6df136))
|
|
216
|
+
* use address as the wallet client account ([#5037](https://github.com/dynamic-labs/DynamicAuth/issues/5037)) ([287631e](https://github.com/dynamic-labs/DynamicAuth/commit/287631e9a027e3a39ee2ad6b45ca404febd03929))
|
|
217
|
+
|
|
218
|
+
## [2.0.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2024-03-19)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
### Bug Fixes
|
|
222
|
+
|
|
223
|
+
* add localization to email form ([#5009](https://github.com/dynamic-labs/DynamicAuth/issues/5009)) ([f3c100c](https://github.com/dynamic-labs/DynamicAuth/commit/f3c100cb0b815880d11c6b619d94bfaa7330a115))
|
|
224
|
+
* include domain on signTypedData for ZeroDev connector ([#5017](https://github.com/dynamic-labs/DynamicAuth/issues/5017)) ([71c9131](https://github.com/dynamic-labs/DynamicAuth/commit/71c91311a75309810bc497c8f82981553ddc57fd))
|
|
225
|
+
* Remove Copy Address button if there is no wallet ([#4994](https://github.com/dynamic-labs/DynamicAuth/issues/4994)) ([fe1e641](https://github.com/dynamic-labs/DynamicAuth/commit/fe1e6417be2299e65ba4bcbc3347dfc27f021853))
|
|
226
|
+
|
|
227
|
+
## [2.0.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.17...v2.0.0-alpha.18) (2024-03-15)
|
|
228
|
+
|
|
229
|
+
## [2.0.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2024-03-15)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
### ⚠ BREAKING CHANGES
|
|
233
|
+
|
|
234
|
+
* rename prop canConnectViaEmail to requiresNonDynamicEmailOtp (#4991)
|
|
235
|
+
|
|
236
|
+
### Features
|
|
237
|
+
|
|
238
|
+
* allow creating embedded wallet with phone number without email ([#4953](https://github.com/dynamic-labs/DynamicAuth/issues/4953)) ([39d31cb](https://github.com/dynamic-labs/DynamicAuth/commit/39d31cbc969fff7acf53c0b6c5e5093ff846f3ea))
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
* rename prop canConnectViaEmail to requiresNonDynamicEmailOtp ([#4991](https://github.com/dynamic-labs/DynamicAuth/issues/4991)) ([e83a365](https://github.com/dynamic-labs/DynamicAuth/commit/e83a3658d4f5cf0630fc8f15be66f2d3db84ab98))
|
|
242
|
+
|
|
243
|
+
## [2.0.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.15...v2.0.0-alpha.16) (2024-03-15)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### Features
|
|
247
|
+
|
|
248
|
+
* add bundlerProvider prop to allow AA customers to select a provider ([#4975](https://github.com/dynamic-labs/DynamicAuth/issues/4975)) ([1870cef](https://github.com/dynamic-labs/DynamicAuth/commit/1870cef4f50944a86226d10f09ef7bf6595f3c95))
|
|
249
|
+
|
|
250
|
+
## [2.0.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.14...v2.0.0-alpha.15) (2024-03-15)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
### Features
|
|
254
|
+
|
|
255
|
+
* Add support for mobile farcaster signin ([#4973](https://github.com/dynamic-labs/DynamicAuth/issues/4973)) ([98261a4](https://github.com/dynamic-labs/DynamicAuth/commit/98261a47bd319cd93b36f5cdd6a9be0064887686))
|
|
256
|
+
|
|
257
|
+
## [2.0.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.13...v2.0.0-alpha.14) (2024-03-14)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
### Bug Fixes
|
|
261
|
+
|
|
262
|
+
* convert empty value when checking for gas sponsorship ([#4970](https://github.com/dynamic-labs/DynamicAuth/issues/4970)) ([8439a20](https://github.com/dynamic-labs/DynamicAuth/commit/8439a2035729150f33507b22c2678b16ae47976b))
|
|
263
|
+
* omit wallet connect on mobile ([#4954](https://github.com/dynamic-labs/DynamicAuth/issues/4954)) ([6ac29a8](https://github.com/dynamic-labs/DynamicAuth/commit/6ac29a8961dc010688425fb67a4fb621ca9f80b2))
|
|
264
|
+
|
|
265
|
+
## [2.0.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.12...v2.0.0-alpha.13) (2024-03-14)
|
|
266
|
+
|
|
267
|
+
## [2.0.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.11...v2.0.0-alpha.12) (2024-03-13)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### Features
|
|
271
|
+
|
|
272
|
+
* add sign-in with farcaster ([#4947](https://github.com/dynamic-labs/DynamicAuth/issues/4947)) ([3927d24](https://github.com/dynamic-labs/DynamicAuth/commit/3927d24392a8944997ca05431c6ab54757be62d9))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
### Bug Fixes
|
|
276
|
+
|
|
277
|
+
* wallet connect links with query params ([#4948](https://github.com/dynamic-labs/DynamicAuth/issues/4948)) ([0738130](https://github.com/dynamic-labs/DynamicAuth/commit/0738130f82473a197e035b8dd74d996bdbb24c11))
|
|
278
|
+
|
|
279
|
+
## [2.0.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.10...v2.0.0-alpha.11) (2024-03-12)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
### ⚠ BREAKING CHANGES
|
|
283
|
+
|
|
284
|
+
* rename FetchPublicAddressOpts to GetAddressOpts (#4910)
|
|
285
|
+
* remove use effect in useWalletEventListeners (#4843)
|
|
286
|
+
* rename fetchPublicAddress to getAddress (#4851)
|
|
287
|
+
|
|
288
|
+
### Features
|
|
289
|
+
|
|
290
|
+
* Add farcaster to iconic ([#4925](https://github.com/dynamic-labs/DynamicAuth/issues/4925)) ([ab282dc](https://github.com/dynamic-labs/DynamicAuth/commit/ab282dc9cdcc0fe11f014d002b056ef4d3b34234))
|
|
291
|
+
* use transaction confirmation ui on signAndSendTransaction for solana embedded wallets ([#4909](https://github.com/dynamic-labs/DynamicAuth/issues/4909)) ([d77e89e](https://github.com/dynamic-labs/DynamicAuth/commit/d77e89ecff9dfc67ed48537f541a9995b2662e1e))
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
### Bug Fixes
|
|
295
|
+
|
|
296
|
+
* add back connect button css variables ([#4922](https://github.com/dynamic-labs/DynamicAuth/issues/4922)) ([1119d62](https://github.com/dynamic-labs/DynamicAuth/commit/1119d62c2db6504952393060930524c3823e4a00))
|
|
297
|
+
* keep adaptive wallet list height ([#4916](https://github.com/dynamic-labs/DynamicAuth/issues/4916)) ([62aa54e](https://github.com/dynamic-labs/DynamicAuth/commit/62aa54e81d563082f7aa519f2ff2b5132e7dd83d))
|
|
298
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([17a143f](https://github.com/dynamic-labs/DynamicAuth/commit/17a143f87a77e56227b2517038c20cf67f8e08bf))
|
|
299
|
+
* update walletbook to fix zerion in-app browser detection issue ([#4917](https://github.com/dynamic-labs/DynamicAuth/issues/4917)) ([48b05d7](https://github.com/dynamic-labs/DynamicAuth/commit/48b05d78e4f7add09787b64505723d4eca34d3e0))
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
* remove use effect in useWalletEventListeners ([#4843](https://github.com/dynamic-labs/DynamicAuth/issues/4843)) ([2e948bb](https://github.com/dynamic-labs/DynamicAuth/commit/2e948bbca0dbdceab7460a844d0988eacd47f581))
|
|
303
|
+
* rename fetchPublicAddress to getAddress ([#4851](https://github.com/dynamic-labs/DynamicAuth/issues/4851)) ([668e7dd](https://github.com/dynamic-labs/DynamicAuth/commit/668e7dd62e1f323dbe64209b5c59c2cd0ee45d61))
|
|
304
|
+
* rename FetchPublicAddressOpts to GetAddressOpts ([#4910](https://github.com/dynamic-labs/DynamicAuth/issues/4910)) ([e5e4b1b](https://github.com/dynamic-labs/DynamicAuth/commit/e5e4b1b08a4e010afa44f8abb0bf6af7f236a86a))
|
|
305
|
+
|
|
306
|
+
## [2.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2024-03-08)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
### ⚠ BREAKING CHANGES
|
|
310
|
+
|
|
311
|
+
* rename hideEmbeddedWalletUIs prop to hideEmbeddedWalletTra… (#4892)
|
|
312
|
+
* refactor send transaction for multi chain (#4831)
|
|
313
|
+
|
|
314
|
+
### Features
|
|
315
|
+
|
|
316
|
+
* add sandbox indicator to sdk ([62fd821](https://github.com/dynamic-labs/DynamicAuth/commit/62fd821a895bb54cec4cae3d153aa0056a7e6638))
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
### Bug Fixes
|
|
320
|
+
|
|
321
|
+
* coinbase connector and auth fetcher no being set properly ([#4891](https://github.com/dynamic-labs/DynamicAuth/issues/4891)) ([328566f](https://github.com/dynamic-labs/DynamicAuth/commit/328566ff39c38d5b5761ddc655de3a5d08bb567a))
|
|
322
|
+
* fix server side rendering ([#4811](https://github.com/dynamic-labs/DynamicAuth/issues/4811)) ([063dfae](https://github.com/dynamic-labs/DynamicAuth/commit/063dfae8b6750875d2f35dd9709a1f675495f4fb))
|
|
323
|
+
* hide network ([#4885](https://github.com/dynamic-labs/DynamicAuth/issues/4885)) ([ec10c58](https://github.com/dynamic-labs/DynamicAuth/commit/ec10c588218f067e991d5830fc06ec081e4e1d18))
|
|
324
|
+
* network picker on mobile ([#4887](https://github.com/dynamic-labs/DynamicAuth/issues/4887)) ([6e0ab1b](https://github.com/dynamic-labs/DynamicAuth/commit/6e0ab1bc7d138b73373741960a501ff7cf20e3f9))
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
* refactor send transaction for multi chain ([#4831](https://github.com/dynamic-labs/DynamicAuth/issues/4831)) ([c98444b](https://github.com/dynamic-labs/DynamicAuth/commit/c98444be7935420dda3d8216d03946f5893eb82f))
|
|
328
|
+
* rename hideEmbeddedWalletUIs prop to hideEmbeddedWalletTra… ([#4892](https://github.com/dynamic-labs/DynamicAuth/issues/4892)) ([7cdf519](https://github.com/dynamic-labs/DynamicAuth/commit/7cdf5196b1cd8516de2d456163fe9071956d40d3))
|
|
329
|
+
|
|
2
330
|
## [2.0.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-03-06)
|
|
3
331
|
|
|
4
332
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,17 +26,18 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
30
|
-
"@dynamic-labs/
|
|
31
|
-
"@dynamic-labs/
|
|
32
|
-
"@dynamic-labs/
|
|
33
|
-
"@dynamic-labs/
|
|
34
|
-
"@dynamic-labs/
|
|
35
|
-
"@dynamic-labs/wallet-
|
|
29
|
+
"@dynamic-labs/sdk-api-core": "0.0.418",
|
|
30
|
+
"@dynamic-labs/ethereum": "2.0.1",
|
|
31
|
+
"@dynamic-labs/logger": "2.0.1",
|
|
32
|
+
"@dynamic-labs/types": "2.0.1",
|
|
33
|
+
"@dynamic-labs/utils": "2.0.1",
|
|
34
|
+
"@dynamic-labs/viem-utils": "2.0.1",
|
|
35
|
+
"@dynamic-labs/wallet-book": "2.0.1",
|
|
36
|
+
"@dynamic-labs/wallet-connector-core": "2.0.1"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@zerodev/presets": "^5.1.4",
|
|
39
|
-
"@zerodev/sdk": "^5.
|
|
40
|
+
"@zerodev/sdk": "^5.2.0",
|
|
40
41
|
"permissionless": "^0.0.34",
|
|
41
42
|
"viem": "^2.7.6"
|
|
42
43
|
}
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -9,6 +9,7 @@ var permissionless = require('permissionless');
|
|
|
9
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
10
|
var viemUtils = require('@dynamic-labs/viem-utils');
|
|
11
11
|
var utils = require('@dynamic-labs/utils');
|
|
12
|
+
var ethereum = require('@dynamic-labs/ethereum');
|
|
12
13
|
var fetchChain = require('./utils/fetchChain.cjs');
|
|
13
14
|
var logger = require('./utils/logger.cjs');
|
|
14
15
|
|
|
@@ -22,6 +23,13 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
22
23
|
this.isEmbeddedWallet = true;
|
|
23
24
|
this.name = 'ZeroDev';
|
|
24
25
|
this.overrideKey = 'zerodev';
|
|
26
|
+
this.walletFallback = {
|
|
27
|
+
brand: {
|
|
28
|
+
alt: 'Smart Wallet',
|
|
29
|
+
spriteId: 'smartwallet',
|
|
30
|
+
},
|
|
31
|
+
name: 'ZeroDev',
|
|
32
|
+
};
|
|
25
33
|
const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
|
|
26
34
|
if (!zeroDevProjectId) {
|
|
27
35
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
@@ -43,17 +51,26 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
43
51
|
}
|
|
44
52
|
setEoaConnector(connector) {
|
|
45
53
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
if (!connector) {
|
|
55
|
+
logger.logger.error('No EOA connector provided');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
46
58
|
this.kernelClientDeferredPromise = new utils.DeferredPromise();
|
|
47
59
|
this.eoaConnector = connector;
|
|
60
|
+
if (ethereum.isEthWalletConnector(this.eoaConnector) &&
|
|
61
|
+
!this.eoaConnector.getActiveAccount()) {
|
|
62
|
+
yield this.eoaConnector.getConnectedAccounts();
|
|
63
|
+
}
|
|
48
64
|
const signer = yield this.eoaConnector.getSigner();
|
|
49
65
|
if (!(signer === null || signer === void 0 ? void 0 : signer.account)) {
|
|
66
|
+
logger.logger.error('No signer account found');
|
|
50
67
|
return;
|
|
51
68
|
}
|
|
52
69
|
const kernelClient = yield presets.createEcdsaKernelAccountClient({
|
|
53
70
|
chain: yield fetchChain.fetchChain(this.projectId),
|
|
54
71
|
paymaster: 'NONE',
|
|
55
72
|
projectId: this.projectId,
|
|
56
|
-
provider:
|
|
73
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
57
74
|
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
58
75
|
});
|
|
59
76
|
utils.wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
@@ -66,8 +83,8 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
66
83
|
});
|
|
67
84
|
}
|
|
68
85
|
checkIsProjectChainEnabled() {
|
|
69
|
-
var _a, _b;
|
|
70
86
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
var _a, _b;
|
|
71
88
|
const client = yield this.getPublicClient();
|
|
72
89
|
const chainName = (_a = client === null || client === void 0 ? void 0 : client.chain) === null || _a === void 0 ? void 0 : _a.name;
|
|
73
90
|
const chainId = (_b = client === null || client === void 0 ? void 0 : client.chain) === null || _b === void 0 ? void 0 : _b.id;
|
|
@@ -90,7 +107,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
90
107
|
chain: yield fetchChain.fetchChain(this.projectId),
|
|
91
108
|
paymaster: 'SPONSOR',
|
|
92
109
|
projectId: this.projectId,
|
|
93
|
-
provider:
|
|
110
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
94
111
|
signer: permissionless.walletClientToSmartAccountSigner(signer),
|
|
95
112
|
});
|
|
96
113
|
utils.wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
@@ -100,16 +117,16 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
100
117
|
return this.kernelClientWithSponsorship;
|
|
101
118
|
});
|
|
102
119
|
}
|
|
103
|
-
|
|
104
|
-
var _a, _b, _c;
|
|
120
|
+
getAddress() {
|
|
105
121
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
var _a, _b, _c;
|
|
106
123
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
107
124
|
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address;
|
|
108
125
|
});
|
|
109
126
|
}
|
|
110
127
|
getConnectedAccounts() {
|
|
111
|
-
var _a, _b, _c;
|
|
112
128
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
var _a, _b, _c;
|
|
113
130
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
114
131
|
return ((_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address)
|
|
115
132
|
? [yield this.kernelClient.account.address]
|
|
@@ -117,22 +134,22 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
117
134
|
});
|
|
118
135
|
}
|
|
119
136
|
getNetwork() {
|
|
120
|
-
var _a, _b, _c;
|
|
121
137
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
var _a, _b, _c;
|
|
122
139
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
123
140
|
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
124
141
|
});
|
|
125
142
|
}
|
|
126
143
|
getTransport(provider) {
|
|
127
144
|
const transport = viemUtils.confirmationTransport({
|
|
128
|
-
onPersonalSign: (
|
|
145
|
+
onPersonalSign: (_a) => _tslib.__awaiter(this, [_a], void 0, function* ({ message }) {
|
|
129
146
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
130
147
|
return provider.signMessage({
|
|
131
148
|
account: provider.account,
|
|
132
149
|
message,
|
|
133
150
|
});
|
|
134
151
|
}),
|
|
135
|
-
onSendTransaction: (
|
|
152
|
+
onSendTransaction: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ transaction }) {
|
|
136
153
|
try {
|
|
137
154
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
138
155
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
@@ -152,28 +169,34 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
152
169
|
throw err;
|
|
153
170
|
}
|
|
154
171
|
}),
|
|
155
|
-
onSignTypedData: (
|
|
172
|
+
onSignTypedData: (_c) => _tslib.__awaiter(this, [_c], void 0, function* ({ message }) {
|
|
156
173
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
157
174
|
const signTypedData = JSON.parse(message);
|
|
158
175
|
return provider.signTypedData({
|
|
159
176
|
account: provider.account,
|
|
177
|
+
domain: signTypedData.domain,
|
|
160
178
|
message: signTypedData.message,
|
|
161
179
|
primaryType: signTypedData.primaryType,
|
|
162
180
|
types: signTypedData.types,
|
|
163
181
|
});
|
|
164
182
|
}),
|
|
165
|
-
provider,
|
|
183
|
+
provider: provider.extend(viem.publicActions),
|
|
166
184
|
transport: viem.custom(provider),
|
|
185
|
+
walletConnector: this,
|
|
167
186
|
walletUiUtils: this._walletUiUtils,
|
|
168
187
|
});
|
|
169
188
|
return transport;
|
|
170
189
|
}
|
|
171
|
-
getWalletClient() {
|
|
190
|
+
getWalletClient(chainId) {
|
|
191
|
+
var _a;
|
|
172
192
|
const provider = this.kernelClient;
|
|
173
193
|
if (!provider)
|
|
174
194
|
throw new utils.DynamicError('No provider');
|
|
175
195
|
const transport = this.getTransport(provider);
|
|
196
|
+
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
176
197
|
const walletClient = viem.createWalletClient({
|
|
198
|
+
account: address,
|
|
199
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
|
|
177
200
|
transport,
|
|
178
201
|
});
|
|
179
202
|
return walletClient;
|
|
@@ -187,18 +210,8 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
187
210
|
});
|
|
188
211
|
}
|
|
189
212
|
getSigner() {
|
|
190
|
-
var _a;
|
|
191
213
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
|
|
193
|
-
if (!provider)
|
|
194
|
-
throw new utils.DynamicError('No provider');
|
|
195
|
-
const transport = this.getTransport(provider);
|
|
196
|
-
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
197
|
-
const walletClient = viem.createWalletClient({
|
|
198
|
-
account: address,
|
|
199
|
-
transport,
|
|
200
|
-
});
|
|
201
|
-
return walletClient;
|
|
214
|
+
return this.getWalletClient();
|
|
202
215
|
});
|
|
203
216
|
}
|
|
204
217
|
canSponsorTransactionGas(transaction) {
|
|
@@ -209,9 +222,13 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
209
222
|
callData: yield this.kernelClientWithSponsorship.account.encodeCallData({
|
|
210
223
|
data: transaction.data ? transaction.data : '0x',
|
|
211
224
|
to: transaction.to,
|
|
212
|
-
|
|
225
|
+
/**
|
|
226
|
+
* if value is undefined, it will be set to 0x0 so the sponsorship
|
|
227
|
+
* check does not fail
|
|
228
|
+
*/
|
|
229
|
+
value: transaction.value && viem.isHex(transaction.value)
|
|
213
230
|
? viem.fromHex(transaction.value, 'bigint')
|
|
214
|
-
:
|
|
231
|
+
: '0x0',
|
|
215
232
|
}),
|
|
216
233
|
};
|
|
217
234
|
const result = yield this.kernelClientWithSponsorship.prepareUserOperationRequest({
|
|
@@ -236,7 +253,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
236
253
|
const rpcClient = this.kernelClient.extend(viem.publicActions);
|
|
237
254
|
if (!rpcClient)
|
|
238
255
|
throw new utils.DynamicError('No RPC client');
|
|
239
|
-
const address = yield this.
|
|
256
|
+
const address = yield this.getAddress();
|
|
240
257
|
if (!address)
|
|
241
258
|
return;
|
|
242
259
|
return viem.formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -245,7 +262,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
245
262
|
signMessage(messageToSign) {
|
|
246
263
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
247
264
|
const client = yield this.getSigner();
|
|
248
|
-
const account = yield this.
|
|
265
|
+
const account = yield this.getAddress();
|
|
249
266
|
if (!account || !client)
|
|
250
267
|
return;
|
|
251
268
|
return client.signMessage({
|
|
@@ -254,6 +271,16 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
254
271
|
});
|
|
255
272
|
});
|
|
256
273
|
}
|
|
274
|
+
createUiTransaction(from) {
|
|
275
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
const walletClient = this.getWalletClient();
|
|
277
|
+
const publicClient = yield this.getPublicClient();
|
|
278
|
+
if (!publicClient || !walletClient) {
|
|
279
|
+
throw new utils.DynamicError('No public client available');
|
|
280
|
+
}
|
|
281
|
+
return viemUtils.createViemUiTransaction({ from, publicClient, walletClient });
|
|
282
|
+
});
|
|
283
|
+
}
|
|
257
284
|
}
|
|
258
285
|
|
|
259
286
|
exports.ZeroDevConnector = ZeroDevConnector;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { KernelAccountClient } from '@zerodev/sdk';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Chain
|
|
2
|
+
import { type Provider as BundlerProvider } from '@zerodev/presets';
|
|
3
|
+
import { Account, PublicClient, Transport, WalletClient } from 'viem';
|
|
4
|
+
import { type Chain as ViemChain } from 'viem/chains';
|
|
5
|
+
import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
import { Chain, IAccountAbstractionWalletConnector, ISendBalanceWalletConnector, WalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
7
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
6
|
-
import { EvmNetwork, GenericNetwork, WalletUiUtils } from '@dynamic-labs/types';
|
|
8
|
+
import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
7
9
|
type ZeroDevConnectorProps = {
|
|
8
10
|
apiProviders: {
|
|
9
11
|
[key in ProviderEnum]?: Provider;
|
|
10
12
|
};
|
|
11
13
|
evmNetworks: GenericNetwork[];
|
|
12
14
|
walletBook: WalletBookSchema;
|
|
13
|
-
walletUiUtils: WalletUiUtils
|
|
15
|
+
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
16
|
+
bundlerProvider: BundlerProvider | undefined;
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
type IZeroDevConnector = IAccountAbstractionWalletConnector & ISendBalanceWalletConnector;
|
|
19
|
+
export declare class ZeroDevConnector extends WalletConnectorBase implements IZeroDevConnector {
|
|
16
20
|
projectId: string;
|
|
17
21
|
kernelClient: KernelAccountClient | undefined;
|
|
18
22
|
eoaConnector: WalletConnector | undefined;
|
|
@@ -22,6 +26,7 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
22
26
|
evmNetworks: EvmNetwork[];
|
|
23
27
|
private isGasSponsorshipDisabled;
|
|
24
28
|
isEmbeddedWallet: boolean;
|
|
29
|
+
static bundlerProvider: BundlerProvider | undefined;
|
|
25
30
|
/**
|
|
26
31
|
* Deferred promise that resolves when the ZeroDev provider is set.
|
|
27
32
|
* This is used to make sure that the provider is set before any other method is called.
|
|
@@ -30,6 +35,13 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
30
35
|
private kernelClientDeferredPromise;
|
|
31
36
|
name: string;
|
|
32
37
|
overrideKey: string;
|
|
38
|
+
walletFallback: {
|
|
39
|
+
brand: {
|
|
40
|
+
alt: string;
|
|
41
|
+
spriteId: string;
|
|
42
|
+
};
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
33
45
|
private _walletUiUtils;
|
|
34
46
|
constructor(opts: ZeroDevConnectorProps);
|
|
35
47
|
getEOAConnector(): WalletConnector | undefined;
|
|
@@ -38,16 +50,274 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
38
50
|
setEoaConnector(connector: WalletConnector): Promise<void>;
|
|
39
51
|
private checkIsProjectChainEnabled;
|
|
40
52
|
private getKernelClientWithSponsorshipValidation;
|
|
41
|
-
|
|
53
|
+
getAddress(): Promise<string | undefined>;
|
|
42
54
|
getConnectedAccounts(): Promise<string[]>;
|
|
43
55
|
getNetwork(): Promise<number | undefined>;
|
|
44
56
|
private getTransport;
|
|
45
|
-
getWalletClient(): WalletClient | undefined;
|
|
57
|
+
getWalletClient(chainId?: string): WalletClient<Transport, ViemChain> | undefined;
|
|
46
58
|
getPublicClient(): Promise<void | PublicClient | undefined>;
|
|
47
|
-
getSigner(): Promise<
|
|
48
|
-
|
|
59
|
+
getSigner(): Promise<{
|
|
60
|
+
account: Account | undefined;
|
|
61
|
+
batch?: {
|
|
62
|
+
multicall?: boolean | {
|
|
63
|
+
batchSize?: number | undefined;
|
|
64
|
+
wait?: number | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
cacheTime: number;
|
|
68
|
+
chain: ViemChain;
|
|
69
|
+
key: string;
|
|
70
|
+
name: string;
|
|
71
|
+
pollingInterval: number;
|
|
72
|
+
request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
|
|
73
|
+
transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
|
|
74
|
+
type: string;
|
|
75
|
+
uid: string;
|
|
76
|
+
addChain: (args: import("viem").AddChainParameters) => Promise<void>;
|
|
77
|
+
deployContract: <const abi extends import("viem").Abi | readonly unknown[], chainOverride extends ViemChain | undefined>(args: import("viem").DeployContractParameters<abi, ViemChain, Account | undefined, chainOverride>) => Promise<`0x${string}`>;
|
|
78
|
+
getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
|
|
79
|
+
getChainId: () => Promise<number>;
|
|
80
|
+
getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
|
|
81
|
+
prepareTransactionRequest: <TParameterType extends import("viem").PrepareTransactionRequestParameterType, TChainOverride extends ViemChain | undefined = undefined, TAccountOverride extends `0x${string}` | Account | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>) => Promise<import("viem").PrepareTransactionRequestReturnType<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>>;
|
|
82
|
+
requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
|
|
83
|
+
requestPermissions: (args: {
|
|
84
|
+
[x: string]: Record<string, any>;
|
|
85
|
+
eth_accounts: Record<string, any>;
|
|
86
|
+
}) => Promise<import("viem").RequestPermissionsReturnType>;
|
|
87
|
+
sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<`0x${string}`>;
|
|
88
|
+
sendTransaction: <TChainOverride_1 extends ViemChain | undefined = undefined>(args: import("viem").SendTransactionParameters<ViemChain, Account | undefined, TChainOverride_1>) => Promise<`0x${string}`>;
|
|
89
|
+
signMessage: (args: import("viem").SignMessageParameters<Account | undefined>) => Promise<`0x${string}`>;
|
|
90
|
+
signTransaction: <TChainOverride_2 extends ViemChain | undefined>(args: import("viem").SignTransactionParameters<ViemChain, Account | undefined, TChainOverride_2>) => Promise<`0x${string}`>;
|
|
91
|
+
signTypedData: <const TTypedData extends {
|
|
92
|
+
[x: string]: readonly import("viem").TypedDataParameter[];
|
|
93
|
+
[x: `string[${string}]`]: undefined;
|
|
94
|
+
[x: `function[${string}]`]: undefined;
|
|
95
|
+
[x: `address[${string}]`]: undefined;
|
|
96
|
+
[x: `bool[${string}]`]: undefined;
|
|
97
|
+
[x: `bytes[${string}]`]: undefined;
|
|
98
|
+
[x: `bytes9[${string}]`]: undefined;
|
|
99
|
+
[x: `bytes1[${string}]`]: undefined;
|
|
100
|
+
[x: `bytes32[${string}]`]: undefined;
|
|
101
|
+
[x: `bytes31[${string}]`]: undefined;
|
|
102
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
103
|
+
[x: `bytes29[${string}]`]: undefined;
|
|
104
|
+
[x: `bytes28[${string}]`]: undefined;
|
|
105
|
+
[x: `bytes27[${string}]`]: undefined;
|
|
106
|
+
[x: `bytes26[${string}]`]: undefined;
|
|
107
|
+
[x: `bytes25[${string}]`]: undefined;
|
|
108
|
+
[x: `bytes24[${string}]`]: undefined;
|
|
109
|
+
[x: `bytes23[${string}]`]: undefined;
|
|
110
|
+
[x: `bytes22[${string}]`]: undefined;
|
|
111
|
+
[x: `bytes21[${string}]`]: undefined;
|
|
112
|
+
[x: `bytes20[${string}]`]: undefined;
|
|
113
|
+
[x: `bytes19[${string}]`]: undefined;
|
|
114
|
+
[x: `bytes2[${string}]`]: undefined;
|
|
115
|
+
[x: `bytes18[${string}]`]: undefined;
|
|
116
|
+
[x: `bytes17[${string}]`]: undefined;
|
|
117
|
+
[x: `bytes16[${string}]`]: undefined;
|
|
118
|
+
[x: `bytes15[${string}]`]: undefined;
|
|
119
|
+
[x: `bytes14[${string}]`]: undefined;
|
|
120
|
+
[x: `bytes13[${string}]`]: undefined;
|
|
121
|
+
[x: `bytes12[${string}]`]: undefined;
|
|
122
|
+
[x: `bytes11[${string}]`]: undefined;
|
|
123
|
+
[x: `bytes10[${string}]`]: undefined;
|
|
124
|
+
[x: `bytes8[${string}]`]: undefined;
|
|
125
|
+
[x: `bytes7[${string}]`]: undefined;
|
|
126
|
+
[x: `bytes6[${string}]`]: undefined;
|
|
127
|
+
[x: `bytes5[${string}]`]: undefined;
|
|
128
|
+
[x: `bytes4[${string}]`]: undefined;
|
|
129
|
+
[x: `bytes3[${string}]`]: undefined;
|
|
130
|
+
[x: `int[${string}]`]: undefined;
|
|
131
|
+
[x: `int40[${string}]`]: undefined;
|
|
132
|
+
[x: `int32[${string}]`]: undefined;
|
|
133
|
+
[x: `int24[${string}]`]: undefined;
|
|
134
|
+
[x: `int16[${string}]`]: undefined;
|
|
135
|
+
[x: `int8[${string}]`]: undefined;
|
|
136
|
+
[x: `int48[${string}]`]: undefined;
|
|
137
|
+
[x: `int56[${string}]`]: undefined;
|
|
138
|
+
[x: `int64[${string}]`]: undefined;
|
|
139
|
+
[x: `int72[${string}]`]: undefined;
|
|
140
|
+
[x: `int80[${string}]`]: undefined;
|
|
141
|
+
[x: `int88[${string}]`]: undefined;
|
|
142
|
+
[x: `int96[${string}]`]: undefined;
|
|
143
|
+
[x: `int104[${string}]`]: undefined;
|
|
144
|
+
[x: `int112[${string}]`]: undefined;
|
|
145
|
+
[x: `int120[${string}]`]: undefined;
|
|
146
|
+
[x: `int128[${string}]`]: undefined;
|
|
147
|
+
[x: `int136[${string}]`]: undefined;
|
|
148
|
+
[x: `int144[${string}]`]: undefined;
|
|
149
|
+
[x: `int152[${string}]`]: undefined;
|
|
150
|
+
[x: `int160[${string}]`]: undefined;
|
|
151
|
+
[x: `int168[${string}]`]: undefined;
|
|
152
|
+
[x: `int176[${string}]`]: undefined;
|
|
153
|
+
[x: `int184[${string}]`]: undefined;
|
|
154
|
+
[x: `int192[${string}]`]: undefined;
|
|
155
|
+
[x: `int200[${string}]`]: undefined;
|
|
156
|
+
[x: `int208[${string}]`]: undefined;
|
|
157
|
+
[x: `int216[${string}]`]: undefined;
|
|
158
|
+
[x: `int224[${string}]`]: undefined;
|
|
159
|
+
[x: `int232[${string}]`]: undefined;
|
|
160
|
+
[x: `int240[${string}]`]: undefined;
|
|
161
|
+
[x: `int248[${string}]`]: undefined;
|
|
162
|
+
[x: `int256[${string}]`]: undefined;
|
|
163
|
+
[x: `uint[${string}]`]: undefined;
|
|
164
|
+
[x: `uint40[${string}]`]: undefined;
|
|
165
|
+
[x: `uint32[${string}]`]: undefined;
|
|
166
|
+
[x: `uint24[${string}]`]: undefined;
|
|
167
|
+
[x: `uint16[${string}]`]: undefined;
|
|
168
|
+
[x: `uint8[${string}]`]: undefined;
|
|
169
|
+
[x: `uint48[${string}]`]: undefined;
|
|
170
|
+
[x: `uint56[${string}]`]: undefined;
|
|
171
|
+
[x: `uint64[${string}]`]: undefined;
|
|
172
|
+
[x: `uint72[${string}]`]: undefined;
|
|
173
|
+
[x: `uint80[${string}]`]: undefined;
|
|
174
|
+
[x: `uint88[${string}]`]: undefined;
|
|
175
|
+
[x: `uint96[${string}]`]: undefined;
|
|
176
|
+
[x: `uint104[${string}]`]: undefined;
|
|
177
|
+
[x: `uint112[${string}]`]: undefined;
|
|
178
|
+
[x: `uint120[${string}]`]: undefined;
|
|
179
|
+
[x: `uint128[${string}]`]: undefined;
|
|
180
|
+
[x: `uint136[${string}]`]: undefined;
|
|
181
|
+
[x: `uint144[${string}]`]: undefined;
|
|
182
|
+
[x: `uint152[${string}]`]: undefined;
|
|
183
|
+
[x: `uint160[${string}]`]: undefined;
|
|
184
|
+
[x: `uint168[${string}]`]: undefined;
|
|
185
|
+
[x: `uint176[${string}]`]: undefined;
|
|
186
|
+
[x: `uint184[${string}]`]: undefined;
|
|
187
|
+
[x: `uint192[${string}]`]: undefined;
|
|
188
|
+
[x: `uint200[${string}]`]: undefined;
|
|
189
|
+
[x: `uint208[${string}]`]: undefined;
|
|
190
|
+
[x: `uint216[${string}]`]: undefined;
|
|
191
|
+
[x: `uint224[${string}]`]: undefined;
|
|
192
|
+
[x: `uint232[${string}]`]: undefined;
|
|
193
|
+
[x: `uint240[${string}]`]: undefined;
|
|
194
|
+
[x: `uint248[${string}]`]: undefined;
|
|
195
|
+
[x: `uint256[${string}]`]: undefined;
|
|
196
|
+
string?: undefined;
|
|
197
|
+
address?: undefined;
|
|
198
|
+
bool?: undefined;
|
|
199
|
+
bytes?: undefined;
|
|
200
|
+
bytes9?: undefined;
|
|
201
|
+
bytes1?: undefined;
|
|
202
|
+
bytes32?: undefined;
|
|
203
|
+
bytes31?: undefined;
|
|
204
|
+
bytes30?: undefined;
|
|
205
|
+
bytes29?: undefined;
|
|
206
|
+
bytes28?: undefined;
|
|
207
|
+
bytes27?: undefined;
|
|
208
|
+
bytes26?: undefined;
|
|
209
|
+
bytes25?: undefined;
|
|
210
|
+
bytes24?: undefined;
|
|
211
|
+
bytes23?: undefined;
|
|
212
|
+
bytes22?: undefined;
|
|
213
|
+
bytes21?: undefined;
|
|
214
|
+
bytes20?: undefined;
|
|
215
|
+
bytes19?: undefined;
|
|
216
|
+
bytes2?: undefined;
|
|
217
|
+
bytes18?: undefined;
|
|
218
|
+
bytes17?: undefined;
|
|
219
|
+
bytes16?: undefined;
|
|
220
|
+
bytes15?: undefined;
|
|
221
|
+
bytes14?: undefined;
|
|
222
|
+
bytes13?: undefined;
|
|
223
|
+
bytes12?: undefined;
|
|
224
|
+
bytes11?: undefined;
|
|
225
|
+
bytes10?: undefined;
|
|
226
|
+
bytes8?: undefined;
|
|
227
|
+
bytes7?: undefined;
|
|
228
|
+
bytes6?: undefined;
|
|
229
|
+
bytes5?: undefined;
|
|
230
|
+
bytes4?: undefined;
|
|
231
|
+
bytes3?: undefined;
|
|
232
|
+
int40?: undefined;
|
|
233
|
+
int32?: undefined;
|
|
234
|
+
int24?: undefined;
|
|
235
|
+
int16?: undefined;
|
|
236
|
+
int8?: undefined;
|
|
237
|
+
int48?: undefined;
|
|
238
|
+
int56?: undefined;
|
|
239
|
+
int64?: undefined;
|
|
240
|
+
int72?: undefined;
|
|
241
|
+
int80?: undefined;
|
|
242
|
+
int88?: undefined;
|
|
243
|
+
int96?: undefined;
|
|
244
|
+
int104?: undefined;
|
|
245
|
+
int112?: undefined;
|
|
246
|
+
int120?: undefined;
|
|
247
|
+
int128?: undefined;
|
|
248
|
+
int136?: undefined;
|
|
249
|
+
int144?: undefined;
|
|
250
|
+
int152?: undefined;
|
|
251
|
+
int160?: undefined;
|
|
252
|
+
int168?: undefined;
|
|
253
|
+
int176?: undefined;
|
|
254
|
+
int184?: undefined;
|
|
255
|
+
int192?: undefined;
|
|
256
|
+
int200?: undefined;
|
|
257
|
+
int208?: undefined;
|
|
258
|
+
int216?: undefined;
|
|
259
|
+
int224?: undefined;
|
|
260
|
+
int232?: undefined;
|
|
261
|
+
int240?: undefined;
|
|
262
|
+
int248?: undefined;
|
|
263
|
+
int256?: undefined;
|
|
264
|
+
uint40?: undefined;
|
|
265
|
+
uint32?: undefined;
|
|
266
|
+
uint24?: undefined;
|
|
267
|
+
uint16?: undefined;
|
|
268
|
+
uint8?: undefined;
|
|
269
|
+
uint48?: undefined;
|
|
270
|
+
uint56?: undefined;
|
|
271
|
+
uint64?: undefined;
|
|
272
|
+
uint72?: undefined;
|
|
273
|
+
uint80?: undefined;
|
|
274
|
+
uint88?: undefined;
|
|
275
|
+
uint96?: undefined;
|
|
276
|
+
uint104?: undefined;
|
|
277
|
+
uint112?: undefined;
|
|
278
|
+
uint120?: undefined;
|
|
279
|
+
uint128?: undefined;
|
|
280
|
+
uint136?: undefined;
|
|
281
|
+
uint144?: undefined;
|
|
282
|
+
uint152?: undefined;
|
|
283
|
+
uint160?: undefined;
|
|
284
|
+
uint168?: undefined;
|
|
285
|
+
uint176?: undefined;
|
|
286
|
+
uint184?: undefined;
|
|
287
|
+
uint192?: undefined;
|
|
288
|
+
uint200?: undefined;
|
|
289
|
+
uint208?: undefined;
|
|
290
|
+
uint216?: undefined;
|
|
291
|
+
uint224?: undefined;
|
|
292
|
+
uint232?: undefined;
|
|
293
|
+
uint240?: undefined;
|
|
294
|
+
uint248?: undefined;
|
|
295
|
+
uint256?: undefined;
|
|
296
|
+
} | {
|
|
297
|
+
[key: string]: unknown;
|
|
298
|
+
}, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, Account | undefined>) => Promise<`0x${string}`>;
|
|
299
|
+
switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
|
|
300
|
+
watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
|
|
301
|
+
writeContract: <const abi_1 extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi_1, "nonpayable" | "payable">, args extends import("viem").ContractFunctionArgs<abi_1, "pure" | "view", functionName>, TChainOverride_3 extends ViemChain | undefined = undefined>(args: import("viem").WriteContractParameters<abi_1, functionName, args, ViemChain, Account | undefined, TChainOverride_3>) => Promise<`0x${string}`>;
|
|
302
|
+
extend: <const client extends {
|
|
303
|
+
[x: string]: unknown;
|
|
304
|
+
account?: undefined;
|
|
305
|
+
batch?: undefined;
|
|
306
|
+
cacheTime?: undefined;
|
|
307
|
+
chain?: undefined;
|
|
308
|
+
key?: undefined;
|
|
309
|
+
name?: undefined;
|
|
310
|
+
pollingInterval?: undefined;
|
|
311
|
+
request?: undefined;
|
|
312
|
+
transport?: undefined;
|
|
313
|
+
type?: undefined;
|
|
314
|
+
uid?: undefined;
|
|
315
|
+
} & Partial<Pick<import("viem").PublicActions<Transport, ViemChain, Account | undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "prepareTransactionRequest" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<ViemChain, Account | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<ViemChain, Account | undefined>>) => client) => import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<ViemChain, Account | undefined>>;
|
|
316
|
+
} | undefined>;
|
|
317
|
+
canSponsorTransactionGas(transaction: IUITransaction): Promise<boolean>;
|
|
49
318
|
disableGasSponsorshipOnce(): void;
|
|
50
319
|
getBalance(): Promise<string | undefined>;
|
|
51
320
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
321
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
52
322
|
}
|
|
53
323
|
export {};
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
2
|
import { createEcdsaKernelAccountClient } from '@zerodev/presets';
|
|
3
|
-
import { custom, createWalletClient,
|
|
3
|
+
import { publicActions, custom, createWalletClient, isHex, fromHex, formatEther } from 'viem';
|
|
4
4
|
import { walletClientToSmartAccountSigner } from 'permissionless';
|
|
5
5
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { confirmationTransport, unFormatTransaction } from '@dynamic-labs/viem-utils';
|
|
6
|
+
import { confirmationTransport, chainsMap, unFormatTransaction, createViemUiTransaction } from '@dynamic-labs/viem-utils';
|
|
7
7
|
import { parseEvmNetworks, DynamicError, DeferredPromise, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
8
|
+
import { isEthWalletConnector } from '@dynamic-labs/ethereum';
|
|
8
9
|
import { cachedChainIdKey, fetchChain } from './utils/fetchChain.js';
|
|
9
10
|
import { logger } from './utils/logger.js';
|
|
10
11
|
|
|
@@ -18,6 +19,13 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
18
19
|
this.isEmbeddedWallet = true;
|
|
19
20
|
this.name = 'ZeroDev';
|
|
20
21
|
this.overrideKey = 'zerodev';
|
|
22
|
+
this.walletFallback = {
|
|
23
|
+
brand: {
|
|
24
|
+
alt: 'Smart Wallet',
|
|
25
|
+
spriteId: 'smartwallet',
|
|
26
|
+
},
|
|
27
|
+
name: 'ZeroDev',
|
|
28
|
+
};
|
|
21
29
|
const zeroDevProjectId = (_a = opts.apiProviders.zerodev) === null || _a === void 0 ? void 0 : _a.clientId;
|
|
22
30
|
if (!zeroDevProjectId) {
|
|
23
31
|
throw new Error('Missing ZeroDev project ID provided. Add your ZeroDev project id to your project configuration via the Dynamic Labs dashboard.');
|
|
@@ -39,17 +47,26 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
39
47
|
}
|
|
40
48
|
setEoaConnector(connector) {
|
|
41
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (!connector) {
|
|
51
|
+
logger.error('No EOA connector provided');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
42
54
|
this.kernelClientDeferredPromise = new DeferredPromise();
|
|
43
55
|
this.eoaConnector = connector;
|
|
56
|
+
if (isEthWalletConnector(this.eoaConnector) &&
|
|
57
|
+
!this.eoaConnector.getActiveAccount()) {
|
|
58
|
+
yield this.eoaConnector.getConnectedAccounts();
|
|
59
|
+
}
|
|
44
60
|
const signer = yield this.eoaConnector.getSigner();
|
|
45
61
|
if (!(signer === null || signer === void 0 ? void 0 : signer.account)) {
|
|
62
|
+
logger.error('No signer account found');
|
|
46
63
|
return;
|
|
47
64
|
}
|
|
48
65
|
const kernelClient = yield createEcdsaKernelAccountClient({
|
|
49
66
|
chain: yield fetchChain(this.projectId),
|
|
50
67
|
paymaster: 'NONE',
|
|
51
68
|
projectId: this.projectId,
|
|
52
|
-
provider:
|
|
69
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
53
70
|
signer: walletClientToSmartAccountSigner(signer),
|
|
54
71
|
});
|
|
55
72
|
wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
@@ -62,8 +79,8 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
62
79
|
});
|
|
63
80
|
}
|
|
64
81
|
checkIsProjectChainEnabled() {
|
|
65
|
-
var _a, _b;
|
|
66
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
var _a, _b;
|
|
67
84
|
const client = yield this.getPublicClient();
|
|
68
85
|
const chainName = (_a = client === null || client === void 0 ? void 0 : client.chain) === null || _a === void 0 ? void 0 : _a.name;
|
|
69
86
|
const chainId = (_b = client === null || client === void 0 ? void 0 : client.chain) === null || _b === void 0 ? void 0 : _b.id;
|
|
@@ -86,7 +103,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
86
103
|
chain: yield fetchChain(this.projectId),
|
|
87
104
|
paymaster: 'SPONSOR',
|
|
88
105
|
projectId: this.projectId,
|
|
89
|
-
provider:
|
|
106
|
+
provider: ZeroDevConnector.bundlerProvider,
|
|
90
107
|
signer: walletClientToSmartAccountSigner(signer),
|
|
91
108
|
});
|
|
92
109
|
wrapMethodWithCallback(this.kernelClientWithSponsorship, 'sendUserOperation', (original, ...args) => {
|
|
@@ -96,16 +113,16 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
96
113
|
return this.kernelClientWithSponsorship;
|
|
97
114
|
});
|
|
98
115
|
}
|
|
99
|
-
|
|
100
|
-
var _a, _b, _c;
|
|
116
|
+
getAddress() {
|
|
101
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
var _a, _b, _c;
|
|
102
119
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
103
120
|
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address;
|
|
104
121
|
});
|
|
105
122
|
}
|
|
106
123
|
getConnectedAccounts() {
|
|
107
|
-
var _a, _b, _c;
|
|
108
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
var _a, _b, _c;
|
|
109
126
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
110
127
|
return ((_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.account) === null || _c === void 0 ? void 0 : _c.address)
|
|
111
128
|
? [yield this.kernelClient.account.address]
|
|
@@ -113,22 +130,22 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
113
130
|
});
|
|
114
131
|
}
|
|
115
132
|
getNetwork() {
|
|
116
|
-
var _a, _b, _c;
|
|
117
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
var _a, _b, _c;
|
|
118
135
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
119
136
|
return (_c = (_b = this.kernelClient) === null || _b === void 0 ? void 0 : _b.chain) === null || _c === void 0 ? void 0 : _c.id;
|
|
120
137
|
});
|
|
121
138
|
}
|
|
122
139
|
getTransport(provider) {
|
|
123
140
|
const transport = confirmationTransport({
|
|
124
|
-
onPersonalSign: (
|
|
141
|
+
onPersonalSign: (_a) => __awaiter(this, [_a], void 0, function* ({ message }) {
|
|
125
142
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
126
143
|
return provider.signMessage({
|
|
127
144
|
account: provider.account,
|
|
128
145
|
message,
|
|
129
146
|
});
|
|
130
147
|
}),
|
|
131
|
-
onSendTransaction: (
|
|
148
|
+
onSendTransaction: (_b) => __awaiter(this, [_b], void 0, function* ({ transaction }) {
|
|
132
149
|
try {
|
|
133
150
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
134
151
|
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
@@ -148,28 +165,34 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
148
165
|
throw err;
|
|
149
166
|
}
|
|
150
167
|
}),
|
|
151
|
-
onSignTypedData: (
|
|
168
|
+
onSignTypedData: (_c) => __awaiter(this, [_c], void 0, function* ({ message }) {
|
|
152
169
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
153
170
|
const signTypedData = JSON.parse(message);
|
|
154
171
|
return provider.signTypedData({
|
|
155
172
|
account: provider.account,
|
|
173
|
+
domain: signTypedData.domain,
|
|
156
174
|
message: signTypedData.message,
|
|
157
175
|
primaryType: signTypedData.primaryType,
|
|
158
176
|
types: signTypedData.types,
|
|
159
177
|
});
|
|
160
178
|
}),
|
|
161
|
-
provider,
|
|
179
|
+
provider: provider.extend(publicActions),
|
|
162
180
|
transport: custom(provider),
|
|
181
|
+
walletConnector: this,
|
|
163
182
|
walletUiUtils: this._walletUiUtils,
|
|
164
183
|
});
|
|
165
184
|
return transport;
|
|
166
185
|
}
|
|
167
|
-
getWalletClient() {
|
|
186
|
+
getWalletClient(chainId) {
|
|
187
|
+
var _a;
|
|
168
188
|
const provider = this.kernelClient;
|
|
169
189
|
if (!provider)
|
|
170
190
|
throw new DynamicError('No provider');
|
|
171
191
|
const transport = this.getTransport(provider);
|
|
192
|
+
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
172
193
|
const walletClient = createWalletClient({
|
|
194
|
+
account: address,
|
|
195
|
+
chain: chainId ? chainsMap[chainId] : provider.chain,
|
|
173
196
|
transport,
|
|
174
197
|
});
|
|
175
198
|
return walletClient;
|
|
@@ -183,18 +206,8 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
183
206
|
});
|
|
184
207
|
}
|
|
185
208
|
getSigner() {
|
|
186
|
-
var _a;
|
|
187
209
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
|
|
189
|
-
if (!provider)
|
|
190
|
-
throw new DynamicError('No provider');
|
|
191
|
-
const transport = this.getTransport(provider);
|
|
192
|
-
const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
|
|
193
|
-
const walletClient = createWalletClient({
|
|
194
|
-
account: address,
|
|
195
|
-
transport,
|
|
196
|
-
});
|
|
197
|
-
return walletClient;
|
|
210
|
+
return this.getWalletClient();
|
|
198
211
|
});
|
|
199
212
|
}
|
|
200
213
|
canSponsorTransactionGas(transaction) {
|
|
@@ -205,9 +218,13 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
205
218
|
callData: yield this.kernelClientWithSponsorship.account.encodeCallData({
|
|
206
219
|
data: transaction.data ? transaction.data : '0x',
|
|
207
220
|
to: transaction.to,
|
|
208
|
-
|
|
221
|
+
/**
|
|
222
|
+
* if value is undefined, it will be set to 0x0 so the sponsorship
|
|
223
|
+
* check does not fail
|
|
224
|
+
*/
|
|
225
|
+
value: transaction.value && isHex(transaction.value)
|
|
209
226
|
? fromHex(transaction.value, 'bigint')
|
|
210
|
-
:
|
|
227
|
+
: '0x0',
|
|
211
228
|
}),
|
|
212
229
|
};
|
|
213
230
|
const result = yield this.kernelClientWithSponsorship.prepareUserOperationRequest({
|
|
@@ -232,7 +249,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
232
249
|
const rpcClient = this.kernelClient.extend(publicActions);
|
|
233
250
|
if (!rpcClient)
|
|
234
251
|
throw new DynamicError('No RPC client');
|
|
235
|
-
const address = yield this.
|
|
252
|
+
const address = yield this.getAddress();
|
|
236
253
|
if (!address)
|
|
237
254
|
return;
|
|
238
255
|
return formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -241,7 +258,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
241
258
|
signMessage(messageToSign) {
|
|
242
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
260
|
const client = yield this.getSigner();
|
|
244
|
-
const account = yield this.
|
|
261
|
+
const account = yield this.getAddress();
|
|
245
262
|
if (!account || !client)
|
|
246
263
|
return;
|
|
247
264
|
return client.signMessage({
|
|
@@ -250,6 +267,16 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
250
267
|
});
|
|
251
268
|
});
|
|
252
269
|
}
|
|
270
|
+
createUiTransaction(from) {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
const walletClient = this.getWalletClient();
|
|
273
|
+
const publicClient = yield this.getPublicClient();
|
|
274
|
+
if (!publicClient || !walletClient) {
|
|
275
|
+
throw new DynamicError('No public client available');
|
|
276
|
+
}
|
|
277
|
+
return createViemUiTransaction({ from, publicClient, walletClient });
|
|
278
|
+
});
|
|
279
|
+
}
|
|
253
280
|
}
|
|
254
281
|
|
|
255
282
|
export { ZeroDevConnector };
|
package/src/index.cjs
CHANGED
|
@@ -6,6 +6,12 @@ var ZeroDevConnector = require('./ZeroDevConnector.cjs');
|
|
|
6
6
|
var ethereumAa = require('./ethereum-aa.cjs');
|
|
7
7
|
var isZeroDevConnector = require('./utils/isZeroDevConnector.cjs');
|
|
8
8
|
|
|
9
|
+
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, } = {}) => {
|
|
10
|
+
if (bundlerProvider) {
|
|
11
|
+
ZeroDevConnector.ZeroDevConnector.bundlerProvider = bundlerProvider;
|
|
12
|
+
}
|
|
13
|
+
return ZeroDevSmartWalletConnectors;
|
|
14
|
+
};
|
|
9
15
|
const ZeroDevSmartWalletConnectors = (props) => {
|
|
10
16
|
var _a;
|
|
11
17
|
if ((_a = props.apiProviders) === null || _a === void 0 ? void 0 : _a.zerodev) {
|
|
@@ -17,3 +23,4 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
17
23
|
exports.EthereumAaConnector = ethereumAa.EthereumAaConnector;
|
|
18
24
|
exports.isZeroDevConnector = isZeroDevConnector.isZeroDevConnector;
|
|
19
25
|
exports.ZeroDevSmartWalletConnectors = ZeroDevSmartWalletConnectors;
|
|
26
|
+
exports.ZeroDevSmartWalletConnectorsWithConfig = ZeroDevSmartWalletConnectorsWithConfig;
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { Provider as BundlerProvider } from '@zerodev/presets';
|
|
1
2
|
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
2
3
|
export * from './ethereum-aa';
|
|
3
4
|
export { isZeroDevConnector } from './utils/isZeroDevConnector';
|
|
5
|
+
export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, }?: {
|
|
6
|
+
bundlerProvider?: BundlerProvider;
|
|
7
|
+
}) => (props: any) => WalletConnectorConstructor[];
|
|
4
8
|
export declare const ZeroDevSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,12 @@ import { ZeroDevConnector } from './ZeroDevConnector.js';
|
|
|
2
2
|
export { EthereumAaConnector } from './ethereum-aa.js';
|
|
3
3
|
export { isZeroDevConnector } from './utils/isZeroDevConnector.js';
|
|
4
4
|
|
|
5
|
+
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, } = {}) => {
|
|
6
|
+
if (bundlerProvider) {
|
|
7
|
+
ZeroDevConnector.bundlerProvider = bundlerProvider;
|
|
8
|
+
}
|
|
9
|
+
return ZeroDevSmartWalletConnectors;
|
|
10
|
+
};
|
|
5
11
|
const ZeroDevSmartWalletConnectors = (props) => {
|
|
6
12
|
var _a;
|
|
7
13
|
if ((_a = props.apiProviders) === null || _a === void 0 ? void 0 : _a.zerodev) {
|
|
@@ -10,4 +16,4 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
10
16
|
return [];
|
|
11
17
|
};
|
|
12
18
|
|
|
13
|
-
export { ZeroDevSmartWalletConnectors };
|
|
19
|
+
export { ZeroDevSmartWalletConnectors, ZeroDevSmartWalletConnectorsWithConfig };
|
package/src/utils/fetchChain.cjs
CHANGED
|
@@ -3,40 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
6
|
+
var viemUtils = require('@dynamic-labs/viem-utils');
|
|
7
7
|
var logger = require('./logger.cjs');
|
|
8
8
|
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var chains__namespace = /*#__PURE__*/_interopNamespace(chains);
|
|
28
|
-
|
|
29
|
-
const chainsMap = Object.values(chains__namespace).reduce((acc, chain) => (Object.assign(Object.assign({}, acc), { [chain.id]: chain })), {});
|
|
30
9
|
const cachedChainIdKey = 'dynamic_zd_chain_id';
|
|
31
10
|
const fetchChain = (projectId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
11
|
try {
|
|
33
12
|
const cachedChainId = localStorage.getItem(cachedChainIdKey);
|
|
34
13
|
if (cachedChainId) {
|
|
35
|
-
return chainsMap[cachedChainId];
|
|
14
|
+
return viemUtils.chainsMap[cachedChainId];
|
|
36
15
|
}
|
|
37
16
|
const response = yield (yield fetch(`https://prod-api.zerodev.app/projects/${projectId}`)).json();
|
|
38
17
|
localStorage.setItem(cachedChainIdKey, response.chainId);
|
|
39
|
-
return chainsMap[response.chainId];
|
|
18
|
+
return viemUtils.chainsMap[response.chainId];
|
|
40
19
|
}
|
|
41
20
|
catch (err) {
|
|
42
21
|
logger.logger.error('Failed to fetch ZeroDev project settings from ZeroDev API ' +
|
package/src/utils/fetchChain.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import { chainsMap } from '@dynamic-labs/viem-utils';
|
|
3
3
|
import { logger } from './logger.js';
|
|
4
4
|
|
|
5
|
-
const chainsMap = Object.values(chains).reduce((acc, chain) => (Object.assign(Object.assign({}, acc), { [chain.id]: chain })), {});
|
|
6
5
|
const cachedChainIdKey = 'dynamic_zd_chain_id';
|
|
7
6
|
const fetchChain = (projectId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
7
|
try {
|