@dynamic-labs/utils 1.1.0-alpha.2 → 1.1.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,239 @@
1
1
 
2
+ ## [1.1.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.20...v1.1.0-alpha.21) (2024-02-01)
3
+
4
+
5
+ ### Features
6
+
7
+ * add phantom redirect handling context ([#4479](https://github.com/dynamic-labs/DynamicAuth/issues/4479)) ([e0218ee](https://github.com/dynamic-labs/DynamicAuth/commit/e0218eec1a67787f5c0e7483d542a5f773e911ef))
8
+ * add signPsbt method to bitcoin wallet connectors ([dfdc0fe](https://github.com/dynamic-labs/DynamicAuth/commit/dfdc0fe0e6894c1307b286e89b43a4c58a8808f3))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * relax passkey feature detection check in sdk to avoid false nega… ([#4556](https://github.com/dynamic-labs/DynamicAuth/issues/4556)) ([4554f7d](https://github.com/dynamic-labs/DynamicAuth/commit/4554f7d7c5339859481cdecca95a9c07fae4ba5c))
14
+ * workaround braavos undefined selectedWallet on chainChange event ([#4552](https://github.com/dynamic-labs/DynamicAuth/issues/4552)) ([aa35df0](https://github.com/dynamic-labs/DynamicAuth/commit/aa35df0e894feafa0606aa1c87bd3d3879ebc594))
15
+
16
+ ## [1.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.19...v1.1.0-alpha.20) (2024-01-31)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * return all enabled chains in getSupportedNetworks instead of undefined ([#4547](https://github.com/dynamic-labs/DynamicAuth/issues/4547)) ([08e7889](https://github.com/dynamic-labs/DynamicAuth/commit/08e78896e045f24bbd96e39416a7f58006929da0))
22
+ * show modal for existing social account from other signin provider ([#4535](https://github.com/dynamic-labs/DynamicAuth/issues/4535)) ([282914a](https://github.com/dynamic-labs/DynamicAuth/commit/282914ac94b3ef5bd66e0b2265d9e414203a7406))
23
+
24
+ ## [1.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.18...v1.1.0-alpha.19) (2024-01-31)
25
+
26
+
27
+ ### Features
28
+
29
+ * add PhantomRedirect connector ([#4467](https://github.com/dynamic-labs/DynamicAuth/issues/4467)) ([75d6c95](https://github.com/dynamic-labs/DynamicAuth/commit/75d6c95940fcec185a699c2100b3e2d21a8233d5))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * lock starknet to 5.25.0 since 5.27.0 breaks the build ([#4541](https://github.com/dynamic-labs/DynamicAuth/issues/4541)) ([00b4799](https://github.com/dynamic-labs/DynamicAuth/commit/00b479977f768cb067480e2e565eabf45e1000a2))
35
+
36
+ ## [1.1.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.17...v1.1.0-alpha.18) (2024-01-30)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * catch email_associated_with_different_provider from response ([#4532](https://github.com/dynamic-labs/DynamicAuth/issues/4532)) ([52be1b4](https://github.com/dynamic-labs/DynamicAuth/commit/52be1b45af46c2b70972b99d73387eb4d7161ec6))
42
+
43
+ ## [1.1.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.16...v1.1.0-alpha.17) (2024-01-30)
44
+
45
+
46
+ ### Features
47
+
48
+ * add sendRawTransaction to BitcoinWalletConnector ([2e86c5a](https://github.com/dynamic-labs/DynamicAuth/commit/2e86c5a5245bd0fc29162ef1f7fe2fbd65245fe1))
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * properly handle AccountExistsError for signInOAuth ([#4529](https://github.com/dynamic-labs/DynamicAuth/issues/4529)) ([d37fdc3](https://github.com/dynamic-labs/DynamicAuth/commit/d37fdc310fe4b70f8948fd5ed3d058342afbe08f))
54
+
55
+ ## [1.1.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.15...v1.1.0-alpha.16) (2024-01-30)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * add fallback to getWalletBookWallet for customers still passing in name, add deprecation warn ([#4518](https://github.com/dynamic-labs/DynamicAuth/issues/4518)) ([b233ea1](https://github.com/dynamic-labs/DynamicAuth/commit/b233ea1cd640d8d9d94c52ab230787f3d869151a))
61
+ * handle braavos network change to account which doesn not exist ([#4519](https://github.com/dynamic-labs/DynamicAuth/issues/4519)) ([486020f](https://github.com/dynamic-labs/DynamicAuth/commit/486020fb09a274388ba34c8d1b37ac3a1ff3dba6))
62
+
63
+ ## [1.1.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.14...v1.1.0-alpha.15) (2024-01-28)
64
+
65
+
66
+ ### Features
67
+
68
+ * add wallet group override to wallet book ([#4488](https://github.com/dynamic-labs/DynamicAuth/issues/4488)) ([cb19ad3](https://github.com/dynamic-labs/DynamicAuth/commit/cb19ad3ea82de488752ceceeaf0e1458a388df6e))
69
+ * enable solana embedded wallets ([#4457](https://github.com/dynamic-labs/DynamicAuth/issues/4457)) ([b0c47f4](https://github.com/dynamic-labs/DynamicAuth/commit/b0c47f4475baa12f52076da46ef993c13bd2c243))
70
+ * group ArgentX wallets ([#4495](https://github.com/dynamic-labs/DynamicAuth/issues/4495)) ([b10d79a](https://github.com/dynamic-labs/DynamicAuth/commit/b10d79a668efecedca37ddb358e6adf95319650d))
71
+
72
+
73
+ ### Bug Fixes
74
+
75
+ * add support for newest backpack extension ([#4468](https://github.com/dynamic-labs/DynamicAuth/issues/4468)) ([a219f32](https://github.com/dynamic-labs/DynamicAuth/commit/a219f325be672599e50b07f6751234a7fc98286e))
76
+ * bump timeout for slower connections ([#4475](https://github.com/dynamic-labs/DynamicAuth/issues/4475)) ([7a07ff5](https://github.com/dynamic-labs/DynamicAuth/commit/7a07ff589eaaf3b28a94d277df3eedabbca60702))
77
+ * change out getWalletBookWallet for findWalletBookWallet to avoid throwing during lookup ([#4477](https://github.com/dynamic-labs/DynamicAuth/issues/4477)) ([4648040](https://github.com/dynamic-labs/DynamicAuth/commit/4648040c166e73dd2c31b0e27897713339436c2f))
78
+ * connect to wallet with wallet connect even if network is not supported ([#4465](https://github.com/dynamic-labs/DynamicAuth/issues/4465)) ([9dbca3e](https://github.com/dynamic-labs/DynamicAuth/commit/9dbca3eb4d4990ee4be642677c1604170b425dc3))
79
+ * pass id to wagmi chain override ([#4512](https://github.com/dynamic-labs/DynamicAuth/issues/4512)) ([2bf2f04](https://github.com/dynamic-labs/DynamicAuth/commit/2bf2f0487f5b1be936dd279107c11fe5d2b42666))
80
+ * switching wallet in extension caused connected flag to be false temporarily ([#4454](https://github.com/dynamic-labs/DynamicAuth/issues/4454)) ([3650f6e](https://github.com/dynamic-labs/DynamicAuth/commit/3650f6ec471a7c779f4d304ab94c9350dd55055b))
81
+
82
+ ## [1.1.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.13...v1.1.0-alpha.14) (2024-01-23)
83
+
84
+
85
+ ### Features
86
+
87
+ * add wallet-book retryable ([#4462](https://github.com/dynamic-labs/DynamicAuth/issues/4462)) ([513b1a6](https://github.com/dynamic-labs/DynamicAuth/commit/513b1a67d6c49624398ad4b0cdca4f5618c9583f))
88
+
89
+ ## [1.1.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.12...v1.1.0-alpha.13) (2024-01-23)
90
+
91
+
92
+ ### Features
93
+
94
+ * add createWalletClientFromWallet helper function ([#4416](https://github.com/dynamic-labs/DynamicAuth/issues/4416)) ([b384898](https://github.com/dynamic-labs/DynamicAuth/commit/b384898061bb3f9b38b2ed670b6650cfc1d4b429))
95
+ * add hardware wallets to wallet book ([#4445](https://github.com/dynamic-labs/DynamicAuth/issues/4445)) ([66c0f5b](https://github.com/dynamic-labs/DynamicAuth/commit/66c0f5b29a6a700099bb95a6f7622f6178e0bccf))
96
+ * add support for Argent Web and Mobile ([#4328](https://github.com/dynamic-labs/DynamicAuth/issues/4328)) ([bce20b8](https://github.com/dynamic-labs/DynamicAuth/commit/bce20b8f35a8630f2621f53a541a1acb06a38fc0))
97
+ * enable ledger for glow, solflare and backpack ([#4392](https://github.com/dynamic-labs/DynamicAuth/issues/4392)) ([fa7b992](https://github.com/dynamic-labs/DynamicAuth/commit/fa7b992f87ebc43560f87b43ac56f2cd9909b306))
98
+
99
+
100
+ ### Bug Fixes
101
+
102
+ * breaking changes script ([#4440](https://github.com/dynamic-labs/DynamicAuth/issues/4440)) ([446173d](https://github.com/dynamic-labs/DynamicAuth/commit/446173d074d652d81856c6412e304b46b1565320))
103
+ * broken help icon in create passkey view ([#4428](https://github.com/dynamic-labs/DynamicAuth/issues/4428)) ([e0ffc02](https://github.com/dynamic-labs/DynamicAuth/commit/e0ffc02ffea34b7ac3198ff6e1baf7f9907acddd))
104
+ * infinite loop when connecting with trust wallet ([#4448](https://github.com/dynamic-labs/DynamicAuth/issues/4448)) ([4e20edf](https://github.com/dynamic-labs/DynamicAuth/commit/4e20edf9abaabf20e5e9f9167b44d7f691e844f1))
105
+ * render wagmi elements based on react version ([#4453](https://github.com/dynamic-labs/DynamicAuth/issues/4453)) ([43c624c](https://github.com/dynamic-labs/DynamicAuth/commit/43c624ca996b0c51de1454910f19fdf908149938))
106
+
107
+ ## [1.1.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.11...v1.1.0-alpha.12) (2024-01-18)
108
+
109
+
110
+ ### Features
111
+
112
+ * expose setAuthMode method ([#4419](https://github.com/dynamic-labs/DynamicAuth/issues/4419)) ([7d156b3](https://github.com/dynamic-labs/DynamicAuth/commit/7d156b3e0eab9b9a80f70ff1c5201d90693ae755))
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * call onUnlinkSuccess in headless mode too ([#4412](https://github.com/dynamic-labs/DynamicAuth/issues/4412)) ([4c76af9](https://github.com/dynamic-labs/DynamicAuth/commit/4c76af9ac7c7b43883742d1289558dfcb5d612ca))
118
+ * correctly map keplr chain ids from project settings ([#4418](https://github.com/dynamic-labs/DynamicAuth/issues/4418)) ([7046364](https://github.com/dynamic-labs/DynamicAuth/commit/7046364a316f7551f0b995eaae7afea13502eb9b))
119
+ * logging in with an email linked to a third party wallet gets stuck on otp view ([#4407](https://github.com/dynamic-labs/DynamicAuth/issues/4407)) ([35bf142](https://github.com/dynamic-labs/DynamicAuth/commit/35bf142e74efeef866dbd7b8157a049cd36eeccb))
120
+
121
+ ## [1.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.10...v1.1.0-alpha.11) (2024-01-17)
122
+
123
+
124
+ ### Features
125
+
126
+ * add Leather wallet and BtcKit connector ([#4335](https://github.com/dynamic-labs/DynamicAuth/issues/4335)) ([fe3316b](https://github.com/dynamic-labs/DynamicAuth/commit/fe3316b5be9ef17eea885e99cf925ccd0f271da7))
127
+ * add solana injected wallet configuration to walletbook ([#4375](https://github.com/dynamic-labs/DynamicAuth/issues/4375)) ([3677ce5](https://github.com/dynamic-labs/DynamicAuth/commit/3677ce5ff40d0c00bfaf0daa0d5d67bc40706ee0))
128
+ * add support for unisat wallet ([#4355](https://github.com/dynamic-labs/DynamicAuth/issues/4355)) ([5b7d6b0](https://github.com/dynamic-labs/DynamicAuth/commit/5b7d6b0a9ea84811a8252b3cdf30a3a8e410180c))
129
+ * add walletbook configurations for solana injected wallets ([#4360](https://github.com/dynamic-labs/DynamicAuth/issues/4360)) ([cdc8e5f](https://github.com/dynamic-labs/DynamicAuth/commit/cdc8e5f4878cb84e26e5b33299aa8547b84b6667))
130
+ * passkey renaming frontend ([#4331](https://github.com/dynamic-labs/DynamicAuth/issues/4331)) ([4551013](https://github.com/dynamic-labs/DynamicAuth/commit/4551013d577c914cb3aedfe458ab9eaa018aceb4))
131
+
132
+
133
+ ### Bug Fixes
134
+
135
+ * correctly update wallets connected flag after wallet switch ([#4397](https://github.com/dynamic-labs/DynamicAuth/issues/4397)) ([543a830](https://github.com/dynamic-labs/DynamicAuth/commit/543a830574f0d5a78fedbb9b18233e8dfbaddd86))
136
+ * export modal header ([#4401](https://github.com/dynamic-labs/DynamicAuth/issues/4401)) ([77cf016](https://github.com/dynamic-labs/DynamicAuth/commit/77cf016fc742458988864647870149a56e991ee4))
137
+ * trigger onAuthSuccess before embedded wallet creation ([4aa341a](https://github.com/dynamic-labs/DynamicAuth/commit/4aa341a1d08332a121daddb7c2dcb09a804a4de7))
138
+ * ui issues on react 17 ([#4373](https://github.com/dynamic-labs/DynamicAuth/issues/4373)) ([93096d6](https://github.com/dynamic-labs/DynamicAuth/commit/93096d6017816a4f0ed299bf618b130d90c81514))
139
+
140
+ ## [1.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.9...v1.1.0-alpha.10) (2024-01-06)
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * pass flow network to magic client ([#4322](https://github.com/dynamic-labs/DynamicAuth/issues/4322)) ([f3adccf](https://github.com/dynamic-labs/DynamicAuth/commit/f3adccf9f8d835f6b04e4767acd0fbd2ac238379))
146
+ * prevent error message when mobile wallet app is open ([#4301](https://github.com/dynamic-labs/DynamicAuth/issues/4301)) ([2a66dcf](https://github.com/dynamic-labs/DynamicAuth/commit/2a66dcfaf8100b3d910c559d35d8b731b1cb380e))
147
+ * turnkeyWalletConnector is not an email otp connector and uses dynamic otp ([#4313](https://github.com/dynamic-labs/DynamicAuth/issues/4313)) ([e4ea56f](https://github.com/dynamic-labs/DynamicAuth/commit/e4ea56f40fdf97b3f5440b016ebd95501089cebe))
148
+
149
+ ## [1.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.8...v1.1.0-alpha.9) (2024-01-04)
150
+
151
+
152
+ ### Features
153
+
154
+ * add solana magic support ([#4258](https://github.com/dynamic-labs/DynamicAuth/issues/4258)) ([da726aa](https://github.com/dynamic-labs/DynamicAuth/commit/da726aa78466c52ee3e1f18952e4351cde754cbc))
155
+
156
+
157
+ ### Bug Fixes
158
+
159
+ * edge case with unlinking wallet ([#4285](https://github.com/dynamic-labs/DynamicAuth/issues/4285)) ([1057fe4](https://github.com/dynamic-labs/DynamicAuth/commit/1057fe47599381f5d9dc39ce4cbeca2041c70319))
160
+ * remove normalizeWalletName from DynamicAuth ([5592817](https://github.com/dynamic-labs/DynamicAuth/commit/5592817b62e345319e04cca9a98276ffad87cfc2))
161
+ * **useFetchBalance:** ensure the latest wallet balance is fetched ([#4288](https://github.com/dynamic-labs/DynamicAuth/issues/4288)) ([25dd035](https://github.com/dynamic-labs/DynamicAuth/commit/25dd035cf8893b7cd28f550026134ba0eecda142))
162
+
163
+ ## [1.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.7...v1.1.0-alpha.8) (2024-01-03)
164
+
165
+
166
+ ### Features
167
+
168
+ * add new sdk view section for text ([#4280](https://github.com/dynamic-labs/DynamicAuth/issues/4280)) ([457ae38](https://github.com/dynamic-labs/DynamicAuth/commit/457ae38cd2be8dae078f40b54ffc4704299d4ed9))
169
+ * add new setShowLinkNewWalletModal method ([f46447a](https://github.com/dynamic-labs/DynamicAuth/commit/f46447ab606f4fdbf55e5fef21dd98f8f2650e90))
170
+ * add pk export for hd wallets ([#4266](https://github.com/dynamic-labs/DynamicAuth/issues/4266)) ([44aac69](https://github.com/dynamic-labs/DynamicAuth/commit/44aac69580ed44e66eab971f87cb6061a3fadc90))
171
+ * add starknet support for sopelia ([#4248](https://github.com/dynamic-labs/DynamicAuth/issues/4248)) ([f9a0980](https://github.com/dynamic-labs/DynamicAuth/commit/f9a0980c3cd2d6d95c5dd17b179fbd0931f08b1a))
172
+ * enable hardware wallet for solana wallets ([#4275](https://github.com/dynamic-labs/DynamicAuth/issues/4275)) ([704b380](https://github.com/dynamic-labs/DynamicAuth/commit/704b380186618a5a5793e88f36ccbe84b59a2e4a))
173
+
174
+
175
+ ### Bug Fixes
176
+
177
+ * phantom solana not connecting on mobile ([#4284](https://github.com/dynamic-labs/DynamicAuth/issues/4284)) ([6ad75f1](https://github.com/dynamic-labs/DynamicAuth/commit/6ad75f152896459f5cf658227f998c246b6a572b))
178
+ * use bitcoin payment address for onramp ([#4273](https://github.com/dynamic-labs/DynamicAuth/issues/4273)) ([a2f54e8](https://github.com/dynamic-labs/DynamicAuth/commit/a2f54e812a11a91ee488eca64f14b5eeea1a8874))
179
+
180
+ ## [1.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.6...v1.1.0-alpha.7) (2023-12-28)
181
+
182
+
183
+ ### Features
184
+
185
+ * better coinbase deeplinking ux ([#4164](https://github.com/dynamic-labs/DynamicAuth/issues/4164)) ([5252608](https://github.com/dynamic-labs/DynamicAuth/commit/525260851900a33a52f129def338963400344205))
186
+
187
+
188
+ ### Bug Fixes
189
+
190
+ * don't prompt for connect when selecting bitcoin wallet if already connected ([#4265](https://github.com/dynamic-labs/DynamicAuth/issues/4265)) ([adef402](https://github.com/dynamic-labs/DynamicAuth/commit/adef402ef94270a17fab896a8585a7f2eacd3681))
191
+
192
+ ## [1.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.5...v1.1.0-alpha.6) (2023-12-27)
193
+
194
+
195
+ ### Features
196
+
197
+ * add multi-wallet-prompts-widget ([#4166](https://github.com/dynamic-labs/DynamicAuth/issues/4166)) ([151e3d2](https://github.com/dynamic-labs/DynamicAuth/commit/151e3d2e7bebbf18448e4af8eecbf660f713cd3d))
198
+
199
+
200
+ ### Bug Fixes
201
+
202
+ * coinbase solana signMessage ([#4254](https://github.com/dynamic-labs/DynamicAuth/issues/4254)) ([f0300a9](https://github.com/dynamic-labs/DynamicAuth/commit/f0300a93ed6c9ba9dfab613820d8cedbe72abb87))
203
+ * make useConnectWithEmailOtp work cross views ([#4252](https://github.com/dynamic-labs/DynamicAuth/issues/4252)) ([a097119](https://github.com/dynamic-labs/DynamicAuth/commit/a097119556c38a22f338a783f79d512b99203cf5))
204
+
205
+ ## [1.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.4...v1.1.0-alpha.5) (2023-12-21)
206
+
207
+
208
+ ### Features
209
+
210
+ * add support for xverse wallet ([#4245](https://github.com/dynamic-labs/DynamicAuth/issues/4245)) ([7b68546](https://github.com/dynamic-labs/DynamicAuth/commit/7b6854684412007bcb33896555900936395176df))
211
+ * **gvty-526:** add embedded reveal ([#4233](https://github.com/dynamic-labs/DynamicAuth/issues/4233)) ([c2d0f90](https://github.com/dynamic-labs/DynamicAuth/commit/c2d0f903f4a4646f86c71834540fd49d51a4a7ae))
212
+
213
+ ## [1.1.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.3...v1.1.0-alpha.4) (2023-12-21)
214
+
215
+
216
+ ### Features
217
+
218
+ * add bitcoin integration ([#4216](https://github.com/dynamic-labs/DynamicAuth/issues/4216)) ([9584f1c](https://github.com/dynamic-labs/DynamicAuth/commit/9584f1cc3133835049ad1c53da980192263b8f21))
219
+ * add default footer to wallet list when tos and pp not enabled ([#4224](https://github.com/dynamic-labs/DynamicAuth/issues/4224)) ([0ad81c4](https://github.com/dynamic-labs/DynamicAuth/commit/0ad81c409bcb4aafb0dc565685525d620a95efce))
220
+ * adds useConnectWithEmailOtp ([#4234](https://github.com/dynamic-labs/DynamicAuth/issues/4234)) ([4a4e50a](https://github.com/dynamic-labs/DynamicAuth/commit/4a4e50ac8651c2a249d5125ae6bcf49aaf49be8c))
221
+
222
+ ## [1.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.2...v1.1.0-alpha.3) (2023-12-19)
223
+
224
+
225
+ ### Features
226
+
227
+ * add Flow support in magic wallet connector ([#4158](https://github.com/dynamic-labs/DynamicAuth/issues/4158)) ([fbbaea7](https://github.com/dynamic-labs/DynamicAuth/commit/fbbaea76b36ceb693f6bd4f2404dfa1204e61492))
228
+ * add showDynamicUserProfile to DynamicContext ([#4214](https://github.com/dynamic-labs/DynamicAuth/issues/4214)) ([2aeb8e3](https://github.com/dynamic-labs/DynamicAuth/commit/2aeb8e3c45a3d9f87bd9196ea9b46927e02eb633))
229
+
230
+
231
+ ### Bug Fixes
232
+
233
+ * add shortname to braveevm to allow for lookups by name as well as key ([#4213](https://github.com/dynamic-labs/DynamicAuth/issues/4213)) ([969b089](https://github.com/dynamic-labs/DynamicAuth/commit/969b089be516fb57fcdc941f908c078998eb4ec0))
234
+ * solflare connect ([#4215](https://github.com/dynamic-labs/DynamicAuth/issues/4215)) ([9a4164e](https://github.com/dynamic-labs/DynamicAuth/commit/9a4164e53198f33ef7201cd4e1eff745a09e9701))
235
+ * wagmi attempt to connect to primary wallet first ([#4206](https://github.com/dynamic-labs/DynamicAuth/issues/4206)) ([9e5fc8e](https://github.com/dynamic-labs/DynamicAuth/commit/9e5fc8ef026628935ac32d3bb0c22bda35057e5d))
236
+
2
237
  ## [1.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.1...v1.1.0-alpha.2) (2023-12-18)
3
238
 
4
239
 
@@ -25,6 +25,11 @@ function __awaiter(thisArg, _arguments, P, generator) {
25
25
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26
26
  step((generator = generator.apply(thisArg, _arguments || [])).next());
27
27
  });
28
- }
28
+ }
29
+
30
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
31
+ var e = new Error(message);
32
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
33
+ };
29
34
 
30
35
  exports.__awaiter = __awaiter;
@@ -21,6 +21,11 @@ function __awaiter(thisArg, _arguments, P, generator) {
21
21
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23
23
  });
24
- }
24
+ }
25
+
26
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
27
+ var e = new Error(message);
28
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
29
+ };
25
30
 
26
31
  export { __awaiter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "1.1.0-alpha.2",
3
+ "version": "1.1.0-alpha.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,10 +26,10 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "peerDependencies": {
29
- "viem": "^1.19.13"
29
+ "viem": "^1.19.13 || ^2.2.0"
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs/logger": "1.1.0-alpha.2",
33
- "@dynamic-labs/types": "1.1.0-alpha.2"
32
+ "@dynamic-labs/logger": "1.1.0-alpha.21",
33
+ "@dynamic-labs/types": "1.1.0-alpha.21"
34
34
  }
35
35
  }
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class MissingPublicAddressError extends DynamicError.DynamicError {
8
+ constructor() {
9
+ super('Missing public address', 'missing-public-address');
10
+ }
11
+ }
12
+
13
+ exports.MissingPublicAddressError = MissingPublicAddressError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class MissingPublicAddressError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class MissingPublicAddressError extends DynamicError {
4
+ constructor() {
5
+ super('Missing public address', 'missing-public-address');
6
+ }
7
+ }
8
+
9
+ export { MissingPublicAddressError };
@@ -17,3 +17,4 @@ export * from './SocialAccountAlreadyExistsError';
17
17
  export * from './TransactionGasCannotBeSponsoredError';
18
18
  export * from './InsufficientFundsError';
19
19
  export * from './PasskeyError';
20
+ export * from './MissingPublicAddressError';
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('../errors/TransactionGasCannotBeSponsoredError.cjs');
6
+ require('../errors/InsufficientFundsError.cjs');
7
+ require('../logger/logger.cjs');
8
+ var isMobile = require('../isMobile.cjs');
9
+ require('../../_virtual/_tslib.cjs');
10
+ require('viem/chains');
11
+
12
+ const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
13
+ const url = encodeURIComponent(window.location.toString());
14
+ const ref = encodeURIComponent(window.location.origin);
15
+ // samsung browser only supports native links, not universal links
16
+ if (isMobile.isSamsungBrowser()) {
17
+ window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
18
+ }
19
+ else {
20
+ window.location.assign(`${universalLink}/${url}?ref=${ref}`);
21
+ }
22
+ };
23
+
24
+ exports.handleMobileWalletRedirect = handleMobileWalletRedirect;
@@ -0,0 +1,4 @@
1
+ export declare const handleMobileWalletRedirect: ({ nativeLink, universalLink, }: {
2
+ nativeLink: string;
3
+ universalLink: string;
4
+ }) => void;
@@ -0,0 +1,20 @@
1
+ import '../errors/TransactionGasCannotBeSponsoredError.js';
2
+ import '../errors/InsufficientFundsError.js';
3
+ import '../logger/logger.js';
4
+ import { isSamsungBrowser } from '../isMobile.js';
5
+ import '../../_virtual/_tslib.js';
6
+ import 'viem/chains';
7
+
8
+ const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
9
+ const url = encodeURIComponent(window.location.toString());
10
+ const ref = encodeURIComponent(window.location.origin);
11
+ // samsung browser only supports native links, not universal links
12
+ if (isSamsungBrowser()) {
13
+ window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
14
+ }
15
+ else {
16
+ window.location.assign(`${universalLink}/${url}?ref=${ref}`);
17
+ }
18
+ };
19
+
20
+ export { handleMobileWalletRedirect };
@@ -0,0 +1 @@
1
+ export * from './handleMobileWalletRedirect';
package/src/index.cjs CHANGED
@@ -22,6 +22,7 @@ var UserHasAccountWithEmailError = require('./errors/UserHasAccountWithEmailErro
22
22
  var SocialAccountAlreadyExistsError = require('./errors/SocialAccountAlreadyExistsError.cjs');
23
23
  var TransactionGasCannotBeSponsoredError = require('./errors/TransactionGasCannotBeSponsoredError.cjs');
24
24
  var InsufficientFundsError = require('./errors/InsufficientFundsError.cjs');
25
+ var MissingPublicAddressError = require('./errors/MissingPublicAddressError.cjs');
25
26
  var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
26
27
  var isFunction = require('./isFunction/isFunction.cjs');
27
28
  var isMobile = require('./isMobile.cjs');
@@ -34,6 +35,8 @@ var getOrMapViemChain = require('./getOrMapViemChain.cjs');
34
35
  var retryableFn = require('./retryableFn.cjs');
35
36
  var wrapMethodWithCallback = require('./wrapMethodWithCallback/wrapMethodWithCallback.cjs');
36
37
  var DeferredPromise = require('./DeferredPromise/DeferredPromise.cjs');
38
+ var handleMobileWalletRedirect = require('./handleMobileWalletRedirect/handleMobileWalletRedirect.cjs');
39
+ var uniq = require('./uniq/uniq.cjs');
37
40
 
38
41
 
39
42
 
@@ -57,6 +60,7 @@ exports.UserHasAccountWithEmailError = UserHasAccountWithEmailError.UserHasAccou
57
60
  exports.SocialAccountAlreadyExistsError = SocialAccountAlreadyExistsError.SocialAccountAlreadyExistsError;
58
61
  exports.TransactionGasCannotBeSponsoredError = TransactionGasCannotBeSponsoredError.TransactionGasCannotBeSponsoredError;
59
62
  exports.InsufficientFundsError = InsufficientFundsError.InsufficientFundsError;
63
+ exports.MissingPublicAddressError = MissingPublicAddressError.MissingPublicAddressError;
60
64
  exports.CancellablePromise = CancellablePromise.CancellablePromise;
61
65
  exports.isFunction = isFunction.isFunction;
62
66
  exports.getAndroidVersion = isMobile.getAndroidVersion;
@@ -83,3 +87,5 @@ exports.FALLBACK_UNDEFINED = retryableFn.FALLBACK_UNDEFINED;
83
87
  exports.retryableFn = retryableFn.retryableFn;
84
88
  exports.wrapMethodWithCallback = wrapMethodWithCallback.wrapMethodWithCallback;
85
89
  exports.DeferredPromise = DeferredPromise.DeferredPromise;
90
+ exports.handleMobileWalletRedirect = handleMobileWalletRedirect.handleMobileWalletRedirect;
91
+ exports.uniq = uniq.uniq;
package/src/index.d.ts CHANGED
@@ -13,3 +13,5 @@ export * from './getOrMapViemChain';
13
13
  export * from './retryableFn';
14
14
  export * from './wrapMethodWithCallback';
15
15
  export * from './DeferredPromise';
16
+ export * from './handleMobileWalletRedirect';
17
+ export * from './uniq';
package/src/index.js CHANGED
@@ -18,6 +18,7 @@ export { UserHasAccountWithEmailError } from './errors/UserHasAccountWithEmailEr
18
18
  export { SocialAccountAlreadyExistsError } from './errors/SocialAccountAlreadyExistsError.js';
19
19
  export { TransactionGasCannotBeSponsoredError } from './errors/TransactionGasCannotBeSponsoredError.js';
20
20
  export { InsufficientFundsError } from './errors/InsufficientFundsError.js';
21
+ export { MissingPublicAddressError } from './errors/MissingPublicAddressError.js';
21
22
  export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
22
23
  export { isFunction } from './isFunction/isFunction.js';
23
24
  export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
@@ -30,3 +31,5 @@ export { getChain, getOrMapViemChain, mapChain } from './getOrMapViemChain.js';
30
31
  export { FALLBACK_UNDEFINED, retryableFn } from './retryableFn.js';
31
32
  export { wrapMethodWithCallback } from './wrapMethodWithCallback/wrapMethodWithCallback.js';
32
33
  export { DeferredPromise } from './DeferredPromise/DeferredPromise.js';
34
+ export { handleMobileWalletRedirect } from './handleMobileWalletRedirect/handleMobileWalletRedirect.js';
35
+ export { uniq } from './uniq/uniq.js';
@@ -8,13 +8,22 @@ const getItemAsync = (key) => _tslib.__awaiter(void 0, void 0, void 0, function*
8
8
  if (typeof window === 'undefined') {
9
9
  return undefined;
10
10
  }
11
- return window.localStorage.getItem(key) || undefined;
11
+ const value = window.localStorage.getItem(key);
12
+ if (!value) {
13
+ return undefined;
14
+ }
15
+ try {
16
+ return JSON.parse(value);
17
+ }
18
+ catch (error) {
19
+ return value;
20
+ }
12
21
  });
13
22
  const setItemAsync = (key, value) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
14
23
  if (typeof window === 'undefined') {
15
24
  return undefined;
16
25
  }
17
- return window.localStorage.setItem(key, value);
26
+ window.localStorage.setItem(key, JSON.stringify(value));
18
27
  });
19
28
  const removeItemAsync = (key) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
20
29
  if (typeof window === 'undefined') {
@@ -1,3 +1,3 @@
1
- export declare const getItemAsync: (key: string) => Promise<string | undefined>;
2
- export declare const setItemAsync: (key: string, value: string) => Promise<void>;
1
+ export declare const getItemAsync: <T = string>(key: string) => Promise<T | undefined>;
2
+ export declare const setItemAsync: <T = string>(key: string, value: T) => Promise<void>;
3
3
  export declare const removeItemAsync: (key: string) => Promise<void>;
@@ -4,13 +4,22 @@ const getItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
4
4
  if (typeof window === 'undefined') {
5
5
  return undefined;
6
6
  }
7
- return window.localStorage.getItem(key) || undefined;
7
+ const value = window.localStorage.getItem(key);
8
+ if (!value) {
9
+ return undefined;
10
+ }
11
+ try {
12
+ return JSON.parse(value);
13
+ }
14
+ catch (error) {
15
+ return value;
16
+ }
8
17
  });
9
18
  const setItemAsync = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
10
19
  if (typeof window === 'undefined') {
11
20
  return undefined;
12
21
  }
13
- return window.localStorage.setItem(key, value);
22
+ window.localStorage.setItem(key, JSON.stringify(value));
14
23
  });
15
24
  const removeItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
16
25
  if (typeof window === 'undefined') {
@@ -8,6 +8,7 @@ const parseEvmNetworks = (networks) => {
8
8
  const clone = networks.slice();
9
9
  return clone.map((network) => {
10
10
  network.chainId = parseChainId.parseChainId(network.chainId);
11
+ network.networkId = parseChainId.parseChainId(network.networkId);
11
12
  return network;
12
13
  });
13
14
  };
@@ -4,6 +4,7 @@ const parseEvmNetworks = (networks) => {
4
4
  const clone = networks.slice();
5
5
  return clone.map((network) => {
6
6
  network.chainId = parseChainId(network.chainId);
7
+ network.networkId = parseChainId(network.networkId);
7
8
  return network;
8
9
  });
9
10
  };
@@ -3,10 +3,22 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _tslib = require('../_virtual/_tslib.cjs');
6
+ require('./errors/TransactionGasCannotBeSponsoredError.cjs');
7
+ require('./errors/InsufficientFundsError.cjs');
8
+ require('./logger/logger.cjs');
9
+ var sleep = require('./sleep/sleep.cjs');
10
+ require('viem/chains');
6
11
 
7
12
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
8
13
  const retryableFn = (fn, options = {}) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
- const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', } = options;
14
+ const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
15
+ logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
16
+ currentRetry,
17
+ fallbackValue,
18
+ maxRetries,
19
+ retryStrategy,
20
+ timeoutMs,
21
+ });
10
22
  const timeoutPromise = new Promise((_, reject) => {
11
23
  setTimeout(() => {
12
24
  reject(new Error('Timeout'));
@@ -17,7 +29,9 @@ const retryableFn = (fn, options = {}) => _tslib.__awaiter(void 0, void 0, void
17
29
  return result;
18
30
  }
19
31
  catch (err) {
32
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn caught error: ', err);
20
33
  if (currentRetry >= maxRetries) {
34
+ logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning/throwing fallback value', err, fallbackValue);
21
35
  if (fallbackValue instanceof Error) {
22
36
  throw fallbackValue;
23
37
  }
@@ -26,22 +40,30 @@ const retryableFn = (fn, options = {}) => _tslib.__awaiter(void 0, void 0, void
26
40
  }
27
41
  return fallbackValue;
28
42
  }
29
- const isTimeout = err.message === 'Timeout';
43
+ const isTimeout = (err === null || err === void 0 ? void 0 : err.message) === 'Timeout';
30
44
  const shouldRetry = retryStrategy === 'timeout-and-rejection' ||
31
45
  (retryStrategy === 'timeout-only' && isTimeout) ||
32
46
  (retryStrategy === 'rejection-only' && !isTimeout);
47
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn shouldRetry: ', shouldRetry);
33
48
  if (!shouldRetry) {
34
49
  if (fallbackValue instanceof Error) {
50
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn throwing fallbackValue error: ', fallbackValue);
35
51
  throw err;
36
52
  }
37
53
  else if (fallbackValue === FALLBACK_UNDEFINED) {
54
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning undefined');
38
55
  return undefined;
39
56
  }
57
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning fallbackValue: ', fallbackValue);
58
+ logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning fallback value', err);
40
59
  return fallbackValue;
41
60
  }
61
+ if (retryIntervalMs)
62
+ yield sleep.sleep(retryIntervalMs);
42
63
  return retryableFn(fn, {
43
64
  currentRetry: currentRetry + 1,
44
65
  fallbackValue,
66
+ logger,
45
67
  maxRetries,
46
68
  retryStrategy,
47
69
  timeoutMs,
@@ -1,3 +1,4 @@
1
+ import { Logger } from '@dynamic-labs/logger';
1
2
  export declare const FALLBACK_UNDEFINED = "FALLBACK_UNDEFINED";
2
3
  export type RetryableFnOptions<T> = {
3
4
  /** Maximum number of retry attempts before returning fallbackValue */
@@ -10,5 +11,9 @@ export type RetryableFnOptions<T> = {
10
11
  fallbackValue?: T | Error | typeof FALLBACK_UNDEFINED;
11
12
  /** Configure whether the fn should be retried only on timeout, only on rejection, or both */
12
13
  retryStrategy?: 'timeout-only' | 'rejection-only' | 'timeout-and-rejection';
14
+ /** Set the logger to be used */
15
+ logger?: Logger | typeof console;
16
+ /** Ms to wait before a retry */
17
+ retryIntervalMs?: number;
13
18
  };
14
19
  export declare const retryableFn: <T>(fn: () => Promise<T>, options?: RetryableFnOptions<T>) => Promise<T>;
@@ -1,8 +1,20 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
+ import './errors/TransactionGasCannotBeSponsoredError.js';
3
+ import './errors/InsufficientFundsError.js';
4
+ import './logger/logger.js';
5
+ import { sleep } from './sleep/sleep.js';
6
+ import 'viem/chains';
2
7
 
3
8
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
4
9
  const retryableFn = (fn, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
5
- const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', } = options;
10
+ const { maxRetries = 3, currentRetry = 0, timeoutMs = 100, fallbackValue = new Error('Max retries reached'), retryStrategy = 'timeout-only', retryIntervalMs = 0, logger, } = options;
11
+ logger === null || logger === void 0 ? void 0 : logger.debug('Configured retryableFn with options: ', {
12
+ currentRetry,
13
+ fallbackValue,
14
+ maxRetries,
15
+ retryStrategy,
16
+ timeoutMs,
17
+ });
6
18
  const timeoutPromise = new Promise((_, reject) => {
7
19
  setTimeout(() => {
8
20
  reject(new Error('Timeout'));
@@ -13,7 +25,9 @@ const retryableFn = (fn, options = {}) => __awaiter(void 0, void 0, void 0, func
13
25
  return result;
14
26
  }
15
27
  catch (err) {
28
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn caught error: ', err);
16
29
  if (currentRetry >= maxRetries) {
30
+ logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning/throwing fallback value', err, fallbackValue);
17
31
  if (fallbackValue instanceof Error) {
18
32
  throw fallbackValue;
19
33
  }
@@ -22,22 +36,30 @@ const retryableFn = (fn, options = {}) => __awaiter(void 0, void 0, void 0, func
22
36
  }
23
37
  return fallbackValue;
24
38
  }
25
- const isTimeout = err.message === 'Timeout';
39
+ const isTimeout = (err === null || err === void 0 ? void 0 : err.message) === 'Timeout';
26
40
  const shouldRetry = retryStrategy === 'timeout-and-rejection' ||
27
41
  (retryStrategy === 'timeout-only' && isTimeout) ||
28
42
  (retryStrategy === 'rejection-only' && !isTimeout);
43
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn shouldRetry: ', shouldRetry);
29
44
  if (!shouldRetry) {
30
45
  if (fallbackValue instanceof Error) {
46
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn throwing fallbackValue error: ', fallbackValue);
31
47
  throw err;
32
48
  }
33
49
  else if (fallbackValue === FALLBACK_UNDEFINED) {
50
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning undefined');
34
51
  return undefined;
35
52
  }
53
+ logger === null || logger === void 0 ? void 0 : logger.debug('retryableFn returning fallbackValue: ', fallbackValue);
54
+ logger === null || logger === void 0 ? void 0 : logger.error('Error while retrying function, returning fallback value', err);
36
55
  return fallbackValue;
37
56
  }
57
+ if (retryIntervalMs)
58
+ yield sleep(retryIntervalMs);
38
59
  return retryableFn(fn, {
39
60
  currentRetry: currentRetry + 1,
40
61
  fallbackValue,
62
+ logger,
41
63
  maxRetries,
42
64
  retryStrategy,
43
65
  timeoutMs,
@@ -0,0 +1 @@
1
+ export { uniq } from './uniq';
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * Removes duplicate elements from an array.
7
+ *
8
+ * @param {T[]} array - The array to filter for unique elements.
9
+ * @template T - The type of elements in the array.
10
+ * @returns {T[]} A new array containing only the unique elements of the given array.
11
+ *
12
+ * @example
13
+ * // returns [1, 2, 3, 4, 5]
14
+ * uniq([1, 2, 2, 3, 4, 4, 5]);
15
+ *
16
+ * @example
17
+ * // returns ['apple', 'banana', 'orange']
18
+ * uniq(['apple', 'banana', 'apple', 'orange']);
19
+ *
20
+ */
21
+ const uniq = (array) => {
22
+ const seen = new Set();
23
+ return array.filter((item) => {
24
+ if (seen.has(item)) {
25
+ return false;
26
+ }
27
+ seen.add(item);
28
+ return true;
29
+ });
30
+ };
31
+
32
+ exports.uniq = uniq;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Removes duplicate elements from an array.
3
+ *
4
+ * @param {T[]} array - The array to filter for unique elements.
5
+ * @template T - The type of elements in the array.
6
+ * @returns {T[]} A new array containing only the unique elements of the given array.
7
+ *
8
+ * @example
9
+ * // returns [1, 2, 3, 4, 5]
10
+ * uniq([1, 2, 2, 3, 4, 4, 5]);
11
+ *
12
+ * @example
13
+ * // returns ['apple', 'banana', 'orange']
14
+ * uniq(['apple', 'banana', 'apple', 'orange']);
15
+ *
16
+ */
17
+ export declare const uniq: <T>(array: T[]) => T[];
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Removes duplicate elements from an array.
3
+ *
4
+ * @param {T[]} array - The array to filter for unique elements.
5
+ * @template T - The type of elements in the array.
6
+ * @returns {T[]} A new array containing only the unique elements of the given array.
7
+ *
8
+ * @example
9
+ * // returns [1, 2, 3, 4, 5]
10
+ * uniq([1, 2, 2, 3, 4, 4, 5]);
11
+ *
12
+ * @example
13
+ * // returns ['apple', 'banana', 'orange']
14
+ * uniq(['apple', 'banana', 'apple', 'orange']);
15
+ *
16
+ */
17
+ const uniq = (array) => {
18
+ const seen = new Set();
19
+ return array.filter((item) => {
20
+ if (seen.has(item)) {
21
+ return false;
22
+ }
23
+ seen.add(item);
24
+ return true;
25
+ });
26
+ };
27
+
28
+ export { uniq };