@lifi/widget 3.0.0-alpha.20 → 3.0.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.
Files changed (210) hide show
  1. package/AppProvider.tsx +6 -6
  2. package/AppRoutes.tsx +5 -0
  3. package/_cjs/AppProvider.js +1 -1
  4. package/_cjs/AppProvider.js.map +1 -1
  5. package/_cjs/AppRoutes.js +4 -0
  6. package/_cjs/AppRoutes.js.map +1 -1
  7. package/_cjs/components/AccountAvatar.js +3 -4
  8. package/_cjs/components/AccountAvatar.js.map +1 -1
  9. package/_cjs/components/Header/NavigationHeader.js +1 -0
  10. package/_cjs/components/Header/NavigationHeader.js.map +1 -1
  11. package/_cjs/components/Header/WalletHeader.js +1 -2
  12. package/_cjs/components/Header/WalletHeader.js.map +1 -1
  13. package/_cjs/components/Header/WalletMenu.js +4 -5
  14. package/_cjs/components/Header/WalletMenu.js.map +1 -1
  15. package/_cjs/components/SendToWallet/SendToWalletButton.js +5 -11
  16. package/_cjs/components/SendToWallet/SendToWalletButton.js.map +1 -1
  17. package/_cjs/components/SendToWallet/SendToWalletExpandButton.js +6 -5
  18. package/_cjs/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
  19. package/_cjs/components/Step/Step.js +1 -2
  20. package/_cjs/components/Step/Step.js.map +1 -1
  21. package/_cjs/config/theme.js +3 -0
  22. package/_cjs/config/theme.js.map +1 -1
  23. package/_cjs/config/version.d.ts +1 -1
  24. package/_cjs/config/version.js +1 -1
  25. package/_cjs/hooks/useGasSufficiency.js +15 -14
  26. package/_cjs/hooks/useGasSufficiency.js.map +1 -1
  27. package/_cjs/hooks/useRoutes.d.ts +1 -1
  28. package/_cjs/hooks/useTokenAddressBalance.d.ts +1 -1
  29. package/_cjs/hooks/useTokenBalance.d.ts +1 -1
  30. package/_cjs/hooks/useTokenBalances.d.ts +1 -1
  31. package/_cjs/i18n/bn.json +127 -74
  32. package/_cjs/i18n/de.json +52 -18
  33. package/_cjs/i18n/es.json +145 -77
  34. package/_cjs/i18n/fr.json +47 -16
  35. package/_cjs/i18n/hi.json +298 -0
  36. package/_cjs/i18n/id.json +54 -19
  37. package/_cjs/i18n/it.json +54 -19
  38. package/_cjs/i18n/ko.json +54 -19
  39. package/_cjs/i18n/pt.json +48 -17
  40. package/_cjs/i18n/th.json +54 -19
  41. package/_cjs/i18n/tr.json +47 -16
  42. package/_cjs/i18n/uk.json +47 -16
  43. package/_cjs/i18n/vi.json +54 -19
  44. package/_cjs/i18n/zh.json +47 -16
  45. package/_cjs/pages/SelectWalletPage/EVMListItemButton.js +1 -1
  46. package/_cjs/pages/SelectWalletPage/EVMListItemButton.js.map +1 -1
  47. package/_cjs/pages/SelectWalletPage/SelectWalletPage.js +30 -12
  48. package/_cjs/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
  49. package/_cjs/pages/SendToWallet/ConfirmAddressSheet.js +3 -1
  50. package/_cjs/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
  51. package/_cjs/pages/SendToWallet/SendToConfiguredWalletPage.d.ts +1 -0
  52. package/_cjs/pages/SendToWallet/SendToConfiguredWalletPage.js +74 -0
  53. package/_cjs/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -0
  54. package/_cjs/pages/SendToWallet/index.d.ts +1 -0
  55. package/_cjs/pages/SendToWallet/index.js +1 -0
  56. package/_cjs/pages/SendToWallet/index.js.map +1 -1
  57. package/_cjs/providers/WalletProvider/SDKProviders.js +8 -5
  58. package/_cjs/providers/WalletProvider/SDKProviders.js.map +1 -1
  59. package/_cjs/providers/WidgetProvider/WidgetProvider.js +4 -1
  60. package/_cjs/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  61. package/_cjs/providers/WidgetProvider/utils.d.ts +5 -0
  62. package/_cjs/providers/WidgetProvider/utils.js +21 -0
  63. package/_cjs/providers/WidgetProvider/utils.js.map +1 -0
  64. package/_cjs/stores/bookmarks/BookmarkStore.js +3 -1
  65. package/_cjs/stores/bookmarks/BookmarkStore.js.map +1 -1
  66. package/_cjs/stores/bookmarks/createBookmarkStore.d.ts +6 -1
  67. package/_cjs/stores/bookmarks/createBookmarkStore.js +12 -2
  68. package/_cjs/stores/bookmarks/createBookmarkStore.js.map +1 -1
  69. package/_cjs/stores/bookmarks/types.d.ts +2 -5
  70. package/_cjs/stores/form/FormStore.js +1 -1
  71. package/_cjs/stores/form/FormStore.js.map +1 -1
  72. package/_cjs/stores/routes/utils.js.map +1 -1
  73. package/_cjs/types/widget.d.ts +7 -1
  74. package/_cjs/utils/chainType.d.ts +1 -0
  75. package/_cjs/utils/chainType.js +2 -0
  76. package/_cjs/utils/chainType.js.map +1 -1
  77. package/_cjs/utils/converters.js +24 -0
  78. package/_cjs/utils/converters.js.map +1 -1
  79. package/_cjs/utils/index.d.ts +1 -1
  80. package/_cjs/utils/index.js +1 -1
  81. package/_cjs/utils/index.js.map +1 -1
  82. package/_cjs/utils/navigationRoutes.d.ts +1 -0
  83. package/_cjs/utils/navigationRoutes.js +3 -0
  84. package/_cjs/utils/navigationRoutes.js.map +1 -1
  85. package/_esm/AppProvider.js +1 -1
  86. package/_esm/AppProvider.js.map +1 -1
  87. package/_esm/AppRoutes.js +5 -1
  88. package/_esm/AppRoutes.js.map +1 -1
  89. package/_esm/components/AccountAvatar.js +3 -4
  90. package/_esm/components/AccountAvatar.js.map +1 -1
  91. package/_esm/components/Header/NavigationHeader.js +1 -0
  92. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  93. package/_esm/components/Header/WalletHeader.js +2 -3
  94. package/_esm/components/Header/WalletHeader.js.map +1 -1
  95. package/_esm/components/Header/WalletMenu.js +4 -5
  96. package/_esm/components/Header/WalletMenu.js.map +1 -1
  97. package/_esm/components/SendToWallet/SendToWalletButton.js +5 -11
  98. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  99. package/_esm/components/SendToWallet/SendToWalletExpandButton.js +6 -5
  100. package/_esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
  101. package/_esm/components/Step/Step.js +1 -2
  102. package/_esm/components/Step/Step.js.map +1 -1
  103. package/_esm/config/theme.js +3 -0
  104. package/_esm/config/theme.js.map +1 -1
  105. package/_esm/config/version.d.ts +1 -1
  106. package/_esm/config/version.js +1 -1
  107. package/_esm/hooks/useGasSufficiency.js +13 -12
  108. package/_esm/hooks/useGasSufficiency.js.map +1 -1
  109. package/_esm/hooks/useRoutes.d.ts +1 -1
  110. package/_esm/hooks/useTokenAddressBalance.d.ts +1 -1
  111. package/_esm/hooks/useTokenBalance.d.ts +1 -1
  112. package/_esm/hooks/useTokenBalances.d.ts +1 -1
  113. package/_esm/i18n/bn.json +127 -74
  114. package/_esm/i18n/de.json +52 -18
  115. package/_esm/i18n/es.json +145 -77
  116. package/_esm/i18n/fr.json +47 -16
  117. package/_esm/i18n/hi.json +298 -0
  118. package/_esm/i18n/id.json +54 -19
  119. package/_esm/i18n/it.json +54 -19
  120. package/_esm/i18n/ko.json +54 -19
  121. package/_esm/i18n/pt.json +48 -17
  122. package/_esm/i18n/th.json +54 -19
  123. package/_esm/i18n/tr.json +47 -16
  124. package/_esm/i18n/uk.json +47 -16
  125. package/_esm/i18n/vi.json +54 -19
  126. package/_esm/i18n/zh.json +47 -16
  127. package/_esm/pages/SelectWalletPage/EVMListItemButton.js +2 -2
  128. package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +1 -1
  129. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +27 -9
  130. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
  131. package/_esm/pages/SendToWallet/ConfirmAddressSheet.js +3 -1
  132. package/_esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
  133. package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.d.ts +1 -0
  134. package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js +70 -0
  135. package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -0
  136. package/_esm/pages/SendToWallet/index.d.ts +1 -0
  137. package/_esm/pages/SendToWallet/index.js +1 -0
  138. package/_esm/pages/SendToWallet/index.js.map +1 -1
  139. package/_esm/providers/WalletProvider/SDKProviders.js +9 -6
  140. package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  141. package/_esm/providers/WidgetProvider/WidgetProvider.js +4 -1
  142. package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  143. package/_esm/providers/WidgetProvider/utils.d.ts +5 -0
  144. package/_esm/providers/WidgetProvider/utils.js +17 -0
  145. package/_esm/providers/WidgetProvider/utils.js.map +1 -0
  146. package/_esm/stores/bookmarks/BookmarkStore.js +3 -1
  147. package/_esm/stores/bookmarks/BookmarkStore.js.map +1 -1
  148. package/_esm/stores/bookmarks/createBookmarkStore.d.ts +6 -1
  149. package/_esm/stores/bookmarks/createBookmarkStore.js +12 -2
  150. package/_esm/stores/bookmarks/createBookmarkStore.js.map +1 -1
  151. package/_esm/stores/bookmarks/types.d.ts +2 -5
  152. package/_esm/stores/form/FormStore.js +1 -1
  153. package/_esm/stores/form/FormStore.js.map +1 -1
  154. package/_esm/stores/routes/utils.js.map +1 -1
  155. package/_esm/types/widget.d.ts +7 -1
  156. package/_esm/utils/chainType.d.ts +1 -0
  157. package/_esm/utils/chainType.js +2 -0
  158. package/_esm/utils/chainType.js.map +1 -1
  159. package/_esm/utils/converters.js +24 -0
  160. package/_esm/utils/converters.js.map +1 -1
  161. package/_esm/utils/index.d.ts +1 -1
  162. package/_esm/utils/index.js +1 -1
  163. package/_esm/utils/index.js.map +1 -1
  164. package/_esm/utils/navigationRoutes.d.ts +1 -0
  165. package/_esm/utils/navigationRoutes.js +3 -0
  166. package/_esm/utils/navigationRoutes.js.map +1 -1
  167. package/components/AccountAvatar.tsx +3 -7
  168. package/components/Header/NavigationHeader.tsx +1 -0
  169. package/components/Header/WalletHeader.tsx +2 -6
  170. package/components/Header/WalletMenu.tsx +4 -8
  171. package/components/SendToWallet/SendToWalletButton.tsx +7 -13
  172. package/components/SendToWallet/SendToWalletExpandButton.tsx +9 -5
  173. package/components/Step/Step.tsx +3 -2
  174. package/config/theme.ts +3 -0
  175. package/config/version.ts +1 -1
  176. package/hooks/useGasSufficiency.ts +14 -14
  177. package/i18n/bn.json +127 -74
  178. package/i18n/de.json +52 -18
  179. package/i18n/es.json +145 -77
  180. package/i18n/fr.json +47 -16
  181. package/i18n/hi.json +298 -0
  182. package/i18n/id.json +54 -19
  183. package/i18n/it.json +54 -19
  184. package/i18n/ko.json +54 -19
  185. package/i18n/pt.json +48 -17
  186. package/i18n/th.json +54 -19
  187. package/i18n/tr.json +47 -16
  188. package/i18n/uk.json +47 -16
  189. package/i18n/vi.json +54 -19
  190. package/i18n/zh.json +47 -16
  191. package/package.json +12 -12
  192. package/pages/SelectWalletPage/EVMListItemButton.tsx +5 -5
  193. package/pages/SelectWalletPage/SelectWalletPage.tsx +36 -20
  194. package/pages/SendToWallet/ConfirmAddressSheet.tsx +3 -1
  195. package/pages/SendToWallet/SendToConfiguredWalletPage.tsx +149 -0
  196. package/pages/SendToWallet/index.ts +1 -0
  197. package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +1 -1
  198. package/providers/WalletProvider/SDKProviders.tsx +20 -11
  199. package/providers/WidgetProvider/WidgetProvider.tsx +7 -2
  200. package/providers/WidgetProvider/utils.ts +26 -0
  201. package/stores/bookmarks/BookmarkStore.tsx +3 -1
  202. package/stores/bookmarks/createBookmarkStore.ts +19 -3
  203. package/stores/bookmarks/types.ts +2 -5
  204. package/stores/form/FormStore.tsx +1 -1
  205. package/stores/routes/utils.ts +4 -10
  206. package/types/widget.ts +7 -1
  207. package/utils/chainType.ts +2 -0
  208. package/utils/converters.ts +29 -0
  209. package/utils/index.ts +1 -1
  210. package/utils/navigationRoutes.ts +3 -0
package/i18n/zh.json CHANGED
@@ -9,10 +9,15 @@
9
9
  },
10
10
  "button": {
11
11
  "auto": "自动",
12
+ "bookmark": "",
13
+ "bookmarks": "",
12
14
  "bridge": "跨链",
13
15
  "buy": "购买",
14
16
  "buyNow": "立即购买",
15
17
  "cancel": "取消",
18
+ "changeWallet": "更换钱包",
19
+ "close": "关闭",
20
+ "confirm": "",
16
21
  "connectWallet": "关联钱包",
17
22
  "contactSupport": "联系技术支持",
18
23
  "continue": "继续",
@@ -30,6 +35,7 @@
30
35
  "light": "浅色主题",
31
36
  "max": "最大",
32
37
  "ok": "确认",
38
+ "options": "",
33
39
  "removeTransaction": "删除交易",
34
40
  "reset": "重置",
35
41
  "resetSettings": "恢复默认设置",
@@ -47,6 +53,7 @@
47
53
  },
48
54
  "header": {
49
55
  "activeTransactions": "进行中的交易",
56
+ "bookmarkedWallets": "",
50
57
  "bridge": "跨链",
51
58
  "checkout": "支付",
52
59
  "exchange": "兑换",
@@ -55,8 +62,10 @@
55
62
  "payWith": "支付方式",
56
63
  "purchase": "购买",
57
64
  "purchaseDetails": "交易明细",
65
+ "recentWallets": "",
58
66
  "selectChain": "选择网络",
59
67
  "selectWallet": "选择你的钱包",
68
+ "sendToWallet": "",
60
69
  "settings": "设置",
61
70
  "swap": "兑换",
62
71
  "to": "兑换为",
@@ -71,7 +80,8 @@
71
80
  "emptyActiveTransactions": "正在进行的兑换将在这里显示。一旦完成,你可在兑换记录中找到它们。",
72
81
  "emptyTokenList": "我们无法在 {{chainName}} 链上找到这些代币,或者你的钱包内没有这些代币。请再次搜索或者选择其他链再试一次。",
73
82
  "emptyTransactionHistory": "交易记录只存储在本地,如果您清除浏览器数据,交易记录将被删除。",
74
- "routeNotFound": "导致其的原因可能是:流动性低,所选定代币的数额太低,燃气费过高,或者当前没有合适的交易路径。"
83
+ "routeNotFound": "导致其的原因可能是:流动性低,所选定代币的数额太低,燃气费过高,或者当前没有合适的交易路径。",
84
+ "fundsToExchange": ""
75
85
  },
76
86
  "title": {
77
87
  "autoRefuel": "获得燃气费",
@@ -103,7 +113,8 @@
103
113
  "insufficientFunds": "你没有足够的资金来完成这笔交易。",
104
114
  "insufficientGas": "您没有足够的燃气费来完成此次交易。您至少需要添加:",
105
115
  "rateChanged": "兑换比例已经改变,如果继续兑换,您将接受新的兑换比例。",
106
- "resetSettings": "这将重置您的路由优先级,滑点,燃气费,选中的跨链桥和链上交易所。"
116
+ "resetSettings": "这将重置您的路由优先级,滑点,燃气费,选中的跨链桥和链上交易所。",
117
+ "slippageOutsideRecommendedLimits": "过高的滑点可能会导致交易被抢跑,造成财产损失"
107
118
  },
108
119
  "title": {
109
120
  "deleteActiveTransactions": "确定要删除所有正在进行的交易吗?",
@@ -128,27 +139,28 @@
128
139
  "unknown": "请再试一次或者联系支持。"
129
140
  },
130
141
  "title": {
142
+ "addressRequired": "",
131
143
  "allowanceRequired": "余额不足",
132
144
  "balanceIsTooLow": "余额太低",
145
+ "bookmarkAlreadyExists": "",
146
+ "bookmarkNameRequired": "",
133
147
  "chainSwitch": "请切换当前网络",
148
+ "exchangeRateUpdateCanceled": "兑换率更新已取消",
134
149
  "gasLimitIsTooLow": "燃气费设置过低",
135
150
  "insufficientFunds": "资金不足",
136
151
  "signatureRejected": "交易需要签名。",
137
152
  "slippageNotMet": "滑点未满足",
138
153
  "transactionCanceled": "交易取消",
139
- "exchangeRateUpdateCanceled": "兑换率更新已取消",
140
154
  "transactionFailed": "交易失败",
141
155
  "transactionUnderpriced": "交易定价过低",
142
156
  "transactionUnprepared": "无法开始该交易",
143
157
  "unknown": "未知错误",
144
- "walletAddressInvalid": "钱包地址无效。",
158
+ "walletAddressInvalid": "",
145
159
  "walletAddressRequired": "请输入钱包地址。",
146
- "walletEnsAddressInvalid": "钱包地址或 ENS 无效,或者当前网络不支持 ENS。"
160
+ "walletChainTypeInvalid": ""
147
161
  }
148
162
  },
149
163
  "tooltip": {
150
- "additionalProviderFee": "跨链和交易所的手续费。",
151
- "estimatedNetworkFee": "预估网络手续费。",
152
164
  "estimatedTime": "预计兑换的执行时间(分钟)。",
153
165
  "notFound": {
154
166
  "text": "我们找不到这个页面。",
@@ -157,18 +169,25 @@
157
169
  "numberOfSteps": "一系列的兑换步骤,每个步骤可能包含1-2个需要签名的交易。",
158
170
  "progressToNextUpdate": "数据将在{{value}} 秒后自动刷新,点击这里可以手动更新。",
159
171
  "recommended": "一个价格低廉但是兼顾复杂性和易用性的路由方案。",
160
- "settingsModified": "设置(已修改)"
172
+ "settingsModified": "设置(已修改)",
173
+ "selectAll": "全选",
174
+ "deselectAll": "取消全选"
161
175
  },
162
176
  "main": {
163
177
  "crossStepDetails": "通过{{tool}}把资产从{{from}}链跨到{{to}}链上",
164
178
  "currentAmount": "当前余额",
165
- "estimatedTime": "{{value}}分钟",
166
179
  "featuredTokens": "精选代币",
180
+ "fees": {
181
+ "estimated": "预估费用",
182
+ "networkEstimated": "预估网络费用:",
183
+ "networkPaid": "已支付网络费用:",
184
+ "paid": "已支付费用",
185
+ "providerEstimated": "预估流动性提供商费用:",
186
+ "providerPaid": "已支付流动性提供商费用:"
187
+ },
167
188
  "from": "从",
168
189
  "fromAmount": "需要支付",
169
190
  "gasCost": "燃气费消耗",
170
- "gasFeeEstimated": "预估燃气费",
171
- "gasFeePaid": "已支付燃气费",
172
191
  "inProgress": "进行中",
173
192
  "nftStepDetails": "通过 {{tool}} 购买 NFT",
174
193
  "onChain": "在{{chainName}} 上",
@@ -238,8 +257,7 @@
238
257
  "tokenOnChain": "{{chainName}}链上的{{tokenSymbol}}",
239
258
  "tokenOnChainAmount": "{{chainName}} 链上{{amount, number(maximumFractionDigits: 9)}} 个{{tokenSymbol}}",
240
259
  "tokenSearch": "按代币名称或者地址搜索",
241
- "valueLoss": "资金损失",
242
- "walletAddressOrEns": "钱包地址或ENS名称"
260
+ "valueLoss": "资金损失"
243
261
  },
244
262
  "insurance": {
245
263
  "bridgeExploits": "跨链桥故障、被黑或者被利用漏洞",
@@ -248,8 +266,9 @@
248
266
  "slippageError": "目标链代币的滑点错误"
249
267
  },
250
268
  "settings": {
251
- "enabledBridges": "已选中的跨链桥",
252
- "enabledExchanges": "已选中的交易所",
269
+ "theme": "主题",
270
+ "enabledBridges": "跨链桥",
271
+ "enabledExchanges": "交易所",
253
272
  "gasPrice": {
254
273
  "fast": "快速",
255
274
  "normal": "正常",
@@ -257,10 +276,22 @@
257
276
  "title": "燃气费"
258
277
  },
259
278
  "routePriority": "路由优先级",
260
- "showDestinationWallet": "显示收款钱包",
279
+ "sendToWalletOption": "发送到指定的钱包地址",
261
280
  "slippage": "滑点",
281
+ "custom": "自定义",
262
282
  "resetSettings": "您正在使用自定义设置过滤可用路由。"
263
283
  },
284
+ "sendToWallet": {
285
+ "enterAddress": "",
286
+ "enterName": "",
287
+ "confirmWalletAddress": "",
288
+ "connectedWallets": "",
289
+ "bookmarkWallet": "",
290
+ "addBookmark": "",
291
+ "noBookmarkedWallets": "",
292
+ "noConnectedWallets": "",
293
+ "noRecentWallets": ""
294
+ },
264
295
  "wallet": {
265
296
  "extensionNotFound": "在选择钱包之前,请确保只有{{name}} 浏览器的扩展应用处于激活状态。"
266
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "3.0.0-alpha.20",
3
+ "version": "3.0.0-alpha.21",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
@@ -35,29 +35,29 @@
35
35
  "dependencies": {
36
36
  "@emotion/react": "^11.11.3",
37
37
  "@emotion/styled": "^11.11.0",
38
- "@lifi/sdk": "^3.0.0-alpha.51",
39
- "@lifi/wallet-management": "^3.0.0-alpha.13",
40
- "@mui/icons-material": "^5.15.6",
41
- "@mui/lab": "^5.0.0-alpha.162",
42
- "@mui/material": "^5.15.6",
38
+ "@lifi/sdk": "^3.0.0-alpha.53",
39
+ "@lifi/wallet-management": "^3.0.0-alpha.14",
40
+ "@mui/icons-material": "^5.15.7",
41
+ "@mui/lab": "^5.0.0-alpha.163",
42
+ "@mui/material": "^5.15.7",
43
43
  "@solana/wallet-adapter-base": "^0.9.23",
44
44
  "@solana/wallet-adapter-react": "^0.15.35",
45
- "@solana/wallet-adapter-wallets": "^0.19.25",
45
+ "@solana/wallet-adapter-wallets": "^0.19.26",
46
46
  "@solana/web3.js": "^1.89.1",
47
- "@tanstack/react-query": "^5.17.19",
47
+ "@tanstack/react-query": "^5.18.0",
48
48
  "@tanstack/react-virtual": "^3.0.2",
49
- "i18next": "^23.7.18",
49
+ "i18next": "^23.8.2",
50
50
  "microdiff": "^1.3.2",
51
51
  "mitt": "^3.0.1",
52
52
  "react": "^18.2.0",
53
53
  "react-dom": "^18.2.0",
54
54
  "react-i18next": "^14.0.1",
55
- "react-intersection-observer": "^9.5.3",
55
+ "react-intersection-observer": "^9.6.0",
56
56
  "react-router-dom": "^6.21.3",
57
57
  "react-timer-hook": "^3.0.7",
58
58
  "uuid": "^9.0.1",
59
- "viem": "^2.5.0",
60
- "wagmi": "^2.5.1",
59
+ "viem": "^2.7.1",
60
+ "wagmi": "^2.5.5",
61
61
  "zustand": "^4.5.0"
62
62
  },
63
63
  "peerDependencies": {
@@ -1,5 +1,8 @@
1
1
  import { ChainType } from '@lifi/sdk';
2
- import { getWalletIcon, isWalletInstalledAsync } from '@lifi/wallet-management';
2
+ import {
3
+ getConnectorIcon,
4
+ isWalletInstalledAsync,
5
+ } from '@lifi/wallet-management';
3
6
  import { Avatar, ListItemAvatar } from '@mui/material';
4
7
  import type { Connector } from 'wagmi';
5
8
  import { useConnect, useDisconnect } from 'wagmi';
@@ -51,10 +54,7 @@ export const EVMListItemButton = ({
51
54
  return (
52
55
  <ListItemButton key={connector.uid} onClick={handleEVMConnect}>
53
56
  <ListItemAvatar>
54
- <Avatar
55
- src={connector.icon || getWalletIcon(connector.id)}
56
- alt={connector.name}
57
- >
57
+ <Avatar src={getConnectorIcon(connector)} alt={connector.name}>
58
58
  {connector.name[0]}
59
59
  </Avatar>
60
60
  </ListItemAvatar>
@@ -1,3 +1,4 @@
1
+ import { ChainType } from '@lifi/sdk';
1
2
  import { isWalletInstalled } from '@lifi/wallet-management';
2
3
  import type { Theme } from '@mui/material';
3
4
  import {
@@ -17,12 +18,15 @@ import type { Connector } from 'wagmi';
17
18
  import { useConnect, useAccount as useWagmiAccount } from 'wagmi';
18
19
  import { Dialog } from '../../components/Dialog';
19
20
  import { PageContainer } from '../../components/PageContainer';
21
+ import { useWidgetConfig } from '../../providers';
22
+ import { isItemAllowed } from '../../utils';
20
23
  import { EVMListItemButton } from './EVMListItemButton';
21
24
  import { SVMListItemButton } from './SVMListItemButton';
22
25
  import { walletComparator } from './utils';
23
26
 
24
27
  export const SelectWalletPage = () => {
25
28
  const { t } = useTranslation();
29
+ const { chains } = useWidgetConfig();
26
30
  const account = useWagmiAccount();
27
31
  const { connectors } = useConnect();
28
32
  const [walletIdentity, setWalletIdentity] = useState<{
@@ -50,25 +54,31 @@ export const SelectWalletPage = () => {
50
54
  }, []);
51
55
 
52
56
  const wallets = useMemo(() => {
53
- const evmInstalled = connectors.filter(
54
- (connector) =>
55
- isWalletInstalled(connector.id) &&
56
- // We should not show already connected connectors
57
- account.connector?.id !== connector.id,
58
- );
59
- const evmNotDetected = connectors.filter(
60
- (connector) => !isWalletInstalled(connector.id),
61
- );
62
- const svmInstalled = solanaWallets?.filter(
63
- (connector) =>
64
- connector.adapter.readyState === WalletReadyState.Installed &&
65
- // We should not show already connected connectors
66
- !connector.adapter.connected,
67
- );
68
- const svmNotDetected = solanaWallets?.filter(
69
- (connector) =>
70
- connector.adapter.readyState !== WalletReadyState.Installed,
71
- );
57
+ const evmInstalled = isItemAllowed(ChainType.EVM, chains?.types)
58
+ ? connectors.filter(
59
+ (connector) =>
60
+ isWalletInstalled(connector.id) &&
61
+ // We should not show already connected connectors
62
+ account.connector?.id !== connector.id,
63
+ )
64
+ : [];
65
+ const evmNotDetected = isItemAllowed(ChainType.EVM, chains?.types)
66
+ ? connectors.filter((connector) => !isWalletInstalled(connector.id))
67
+ : [];
68
+ const svmInstalled = isItemAllowed(ChainType.SVM, chains?.types)
69
+ ? solanaWallets?.filter(
70
+ (connector) =>
71
+ connector.adapter.readyState === WalletReadyState.Installed &&
72
+ // We should not show already connected connectors
73
+ !connector.adapter.connected,
74
+ )
75
+ : [];
76
+ const svmNotDetected = isItemAllowed(ChainType.SVM, chains?.types)
77
+ ? solanaWallets?.filter(
78
+ (connector) =>
79
+ connector.adapter.readyState !== WalletReadyState.Installed,
80
+ )
81
+ : [];
72
82
 
73
83
  const installedWallets = [...evmInstalled, ...svmInstalled].sort(
74
84
  walletComparator,
@@ -82,7 +92,13 @@ export const SelectWalletPage = () => {
82
92
  }
83
93
 
84
94
  return installedWallets;
85
- }, [account.connector?.id, connectors, isDesktopView, solanaWallets]);
95
+ }, [
96
+ account.connector?.id,
97
+ chains?.types,
98
+ connectors,
99
+ isDesktopView,
100
+ solanaWallets,
101
+ ]);
86
102
 
87
103
  return (
88
104
  <PageContainer disableGutters>
@@ -41,7 +41,9 @@ export const ConfirmAddressSheet = forwardRef<
41
41
 
42
42
  const handleConfirm = () => {
43
43
  if (validatedBookmark) {
44
- setFieldValue('toAddress', validatedBookmark.address);
44
+ setFieldValue('toAddress', validatedBookmark.address, {
45
+ isTouched: true,
46
+ });
45
47
  onConfirm?.(validatedBookmark);
46
48
  setSendToWallet(true);
47
49
  handleClose();
@@ -0,0 +1,149 @@
1
+ import ContentCopyIcon from '@mui/icons-material/ContentCopy';
2
+ import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
3
+ import OpenInNewIcon from '@mui/icons-material/OpenInNew';
4
+ import { ListItemAvatar, ListItemText, MenuItem } from '@mui/material';
5
+ import { useId, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { useNavigate } from 'react-router-dom';
8
+ import { AccountAvatar } from '../../components/AccountAvatar';
9
+ import { ListItem, ListItemButton } from '../../components/ListItem';
10
+ import { Menu } from '../../components/Menu';
11
+ import { useChains, useToAddressRequirements } from '../../hooks';
12
+ import { useBookmarkActions, useFieldActions } from '../../stores';
13
+ import {
14
+ defaultChainIdsByType,
15
+ navigationRoutes,
16
+ shortenAddress,
17
+ } from '../../utils';
18
+ import {
19
+ ListContainer,
20
+ OptionsMenuButton,
21
+ SendToWalletPageContainer,
22
+ } from './SendToWalletPage.style';
23
+ import { useWidgetConfig } from '../../providers';
24
+ import type { ToAddress } from '../../types';
25
+
26
+ export const SendToConfiguredWalletPage = () => {
27
+ const { t } = useTranslation();
28
+ const navigate = useNavigate();
29
+ const { toAddresses } = useWidgetConfig();
30
+ const [selectedToAddress, setSelectedToAddress] = useState<ToAddress>();
31
+ const { requiredToChainType } = useToAddressRequirements();
32
+ const { setSelectedBookmark } = useBookmarkActions();
33
+ const { setFieldValue } = useFieldActions();
34
+ const { getChainById } = useChains();
35
+ const moreMenuId = useId();
36
+ const [moreMenuAnchorEl, setMenuAnchorEl] = useState<HTMLElement | null>();
37
+ const open = Boolean(moreMenuAnchorEl);
38
+
39
+ const handleCuratedSelected = (toAddress: ToAddress) => {
40
+ setSelectedBookmark(toAddress);
41
+ setFieldValue('toAddress', toAddress.address, { isTouched: true });
42
+ navigate(navigationRoutes.home);
43
+ };
44
+
45
+ const closeMenu = () => {
46
+ setMenuAnchorEl(null);
47
+ };
48
+
49
+ const handleMenuOpen = (el: HTMLElement, toAddress: ToAddress) => {
50
+ setMenuAnchorEl(el);
51
+ setSelectedToAddress(toAddress);
52
+ };
53
+
54
+ const handleCopyAddress = () => {
55
+ if (selectedToAddress) {
56
+ navigator.clipboard.writeText(selectedToAddress.address);
57
+ }
58
+ closeMenu();
59
+ };
60
+
61
+ const handleViewOnExplorer = () => {
62
+ if (selectedToAddress) {
63
+ const chain = getChainById(
64
+ defaultChainIdsByType[selectedToAddress.chainType],
65
+ );
66
+ window.open(
67
+ `${chain?.metamask.blockExplorerUrls[0]}address/${selectedToAddress.address}`,
68
+ '_blank',
69
+ );
70
+ }
71
+ closeMenu();
72
+ };
73
+
74
+ return (
75
+ <SendToWalletPageContainer disableGutters>
76
+ <ListContainer sx={{ minHeight: 418 }}>
77
+ {toAddresses?.map((toAddress) => (
78
+ <ListItem key={toAddress.address} sx={{ position: 'relative' }}>
79
+ <ListItemButton
80
+ disabled={
81
+ requiredToChainType &&
82
+ requiredToChainType !== toAddress.chainType
83
+ }
84
+ onClick={() => handleCuratedSelected(toAddress)}
85
+ >
86
+ <ListItemAvatar>
87
+ <AccountAvatar
88
+ chainId={defaultChainIdsByType[toAddress.chainType]}
89
+ />
90
+ </ListItemAvatar>
91
+ <ListItemText
92
+ primary={toAddress.name || shortenAddress(toAddress.address)}
93
+ secondary={
94
+ toAddress.name ? shortenAddress(toAddress.address) : undefined
95
+ }
96
+ />
97
+ </ListItemButton>
98
+ <OptionsMenuButton
99
+ aria-label={t('button.options')}
100
+ aria-controls={
101
+ open && toAddress.address === selectedToAddress?.address
102
+ ? moreMenuId
103
+ : undefined
104
+ }
105
+ aria-haspopup="true"
106
+ aria-expanded={open ? 'true' : undefined}
107
+ onClick={(e) =>
108
+ handleMenuOpen(e.target as HTMLElement, toAddress)
109
+ }
110
+ sx={{
111
+ opacity:
112
+ requiredToChainType &&
113
+ requiredToChainType !== toAddress.chainType
114
+ ? 0.5
115
+ : 1,
116
+ }}
117
+ >
118
+ <MoreHorizIcon fontSize="small" />
119
+ </OptionsMenuButton>
120
+ </ListItem>
121
+ ))}
122
+ <Menu
123
+ id={moreMenuId}
124
+ elevation={0}
125
+ anchorOrigin={{
126
+ vertical: 'bottom',
127
+ horizontal: 'right',
128
+ }}
129
+ transformOrigin={{
130
+ vertical: 'top',
131
+ horizontal: 'right',
132
+ }}
133
+ anchorEl={moreMenuAnchorEl}
134
+ open={open}
135
+ onClose={closeMenu}
136
+ >
137
+ <MenuItem onClick={handleCopyAddress}>
138
+ <ContentCopyIcon />
139
+ {t('button.copyAddress')}
140
+ </MenuItem>
141
+ <MenuItem onClick={handleViewOnExplorer}>
142
+ <OpenInNewIcon />
143
+ {t('button.viewOnExplorer')}
144
+ </MenuItem>
145
+ </Menu>
146
+ </ListContainer>
147
+ </SendToWalletPageContainer>
148
+ );
149
+ };
@@ -2,3 +2,4 @@ export * from './BookmarksPage';
2
2
  export * from './ConnectedWalletsPage';
3
3
  export * from './RecentWalletsPage';
4
4
  export * from './SendToWalletPage';
5
+ export * from './SendToConfiguredWalletPage';
@@ -1,4 +1,4 @@
1
- import { FullStatusData } from '@lifi/sdk';
1
+ import type { FullStatusData } from '@lifi/sdk';
2
2
  import ContentCopyIcon from '@mui/icons-material/ContentCopyRounded';
3
3
  import { Box, IconButton, Typography } from '@mui/material';
4
4
  import { useEffect, useMemo } from 'react';
@@ -1,5 +1,5 @@
1
1
  import type { SDKProvider } from '@lifi/sdk';
2
- import { EVM, Solana, config } from '@lifi/sdk';
2
+ import { ChainType, EVM, Solana, config } from '@lifi/sdk';
3
3
  import type { WalletAdapter } from '@solana/wallet-adapter-base';
4
4
  import { useWallet } from '@solana/wallet-adapter-react';
5
5
  import { getWalletClient, switchChain } from '@wagmi/core';
@@ -14,16 +14,25 @@ export const SDKProviders = () => {
14
14
 
15
15
  useEffect(() => {
16
16
  // Configure SDK Providers
17
- const providers: SDKProvider[] = [
18
- EVM({
19
- getWalletClient: () => getWalletClient(wagmiConfig),
20
- switchChain: async (chainId: number) => {
21
- const chain = await switchChain(wagmiConfig, { chainId });
22
- return getWalletClient(wagmiConfig, { chainId: chain.id });
23
- },
24
- }),
25
- ];
26
- if (wallet?.adapter) {
17
+ const providers: SDKProvider[] = [];
18
+ const hasConfiguredEVMProvider = sdkConfig?.providers?.some(
19
+ (provider) => provider.type === ChainType.EVM,
20
+ );
21
+ const hasConfiguredSVMProvider = sdkConfig?.providers?.some(
22
+ (provider) => provider.type === ChainType.SVM,
23
+ );
24
+ if (!hasConfiguredEVMProvider) {
25
+ providers.push(
26
+ EVM({
27
+ getWalletClient: () => getWalletClient(wagmiConfig),
28
+ switchChain: async (chainId: number) => {
29
+ const chain = await switchChain(wagmiConfig, { chainId });
30
+ return getWalletClient(wagmiConfig, { chainId: chain.id });
31
+ },
32
+ }),
33
+ );
34
+ }
35
+ if (!hasConfiguredSVMProvider) {
27
36
  providers.push(
28
37
  Solana({
29
38
  async getWalletAdapter() {
@@ -4,6 +4,7 @@ import { version } from '../../config/version';
4
4
  import { setDefaultSettings } from '../../stores';
5
5
  import { formatInputAmount } from '../../utils';
6
6
  import type { WidgetContextProps, WidgetProviderProps } from './types';
7
+ import { attemptToFindMatchingToAddressInConfig } from './utils';
7
8
 
8
9
  const initialContext: WidgetContextProps = {
9
10
  elementId: '',
@@ -60,7 +61,12 @@ export const WidgetProvider: React.FC<
60
61
  !isNaN(parseFloat(searchParams.fromAmount))
61
62
  ? formatInputAmount(searchParams.fromAmount)
62
63
  : widgetConfig.fromAmount,
63
- toAddress: searchParams.toAddress || widgetConfig.toAddress,
64
+ toAddress: searchParams.toAddress
65
+ ? attemptToFindMatchingToAddressInConfig(
66
+ searchParams.toAddress,
67
+ widgetConfig,
68
+ )
69
+ : widgetConfig.toAddress,
64
70
  integrator: widgetConfig.integrator,
65
71
  elementId,
66
72
  } as WidgetContextProps;
@@ -101,7 +107,6 @@ export const WidgetProvider: React.FC<
101
107
  };
102
108
  }
103
109
  }, [elementId, widgetConfig]);
104
-
105
110
  return (
106
111
  <WidgetContext.Provider value={value}>{children}</WidgetContext.Provider>
107
112
  );
@@ -0,0 +1,26 @@
1
+ import type { WidgetConfig } from '../../types';
2
+ import { getChainTypeFromAddress } from '../../utils';
3
+
4
+ export const attemptToFindMatchingToAddressInConfig = (
5
+ address: string,
6
+ config: WidgetConfig,
7
+ ) => {
8
+ if (config.toAddress && config.toAddress.address === address) {
9
+ return config.toAddress;
10
+ }
11
+
12
+ if (config.toAddresses?.length) {
13
+ const matchingToAddress = config.toAddresses.find(
14
+ (toAddress) => toAddress.address === address,
15
+ );
16
+
17
+ if (matchingToAddress) {
18
+ return matchingToAddress;
19
+ }
20
+ }
21
+
22
+ return {
23
+ address: address,
24
+ chainType: getChainTypeFromAddress(address),
25
+ };
26
+ };
@@ -3,6 +3,7 @@ import { shallow } from 'zustand/shallow';
3
3
  import type { PersistStoreProviderProps } from '../types';
4
4
  import { createBookmarksStore } from './createBookmarkStore';
5
5
  import type { BookmarkState, BookmarkStore } from './types';
6
+ import { useWidgetConfig } from '../../providers';
6
7
 
7
8
  export const BookmarkStoreContext = createContext<BookmarkStore | null>(null);
8
9
 
@@ -10,10 +11,11 @@ export const BookmarkStoreProvider: React.FC<PersistStoreProviderProps> = ({
10
11
  children,
11
12
  ...props
12
13
  }) => {
14
+ const { toAddress } = useWidgetConfig();
13
15
  const storeRef = useRef<BookmarkStore>();
14
16
 
15
17
  if (!storeRef.current) {
16
- storeRef.current = createBookmarksStore(props);
18
+ storeRef.current = createBookmarksStore({ ...props, toAddress });
17
19
  }
18
20
 
19
21
  return (
@@ -1,16 +1,22 @@
1
1
  import type { StateCreator } from 'zustand';
2
2
  import { persist } from 'zustand/middleware';
3
3
  import { createWithEqualityFn } from 'zustand/traditional';
4
+ import type { ToAddress } from '../../types';
4
5
  import type { PersistStoreProps } from '../types';
5
6
  import type { BookmarkState } from './types';
6
7
 
7
8
  const recentWalletsLimit = 5;
8
-
9
- export const createBookmarksStore = ({ namePrefix }: PersistStoreProps) =>
9
+ interface PersistBookmarkProps extends PersistStoreProps {
10
+ toAddress?: ToAddress;
11
+ }
12
+ export const createBookmarksStore = ({
13
+ namePrefix,
14
+ toAddress,
15
+ }: PersistBookmarkProps) =>
10
16
  createWithEqualityFn<BookmarkState>(
11
17
  persist(
12
18
  (set, get) => ({
13
- selectedBookmark: undefined,
19
+ selectedBookmark: toAddress,
14
20
  bookmarks: [],
15
21
  recentWallets: [],
16
22
  getBookmark: (address) =>
@@ -57,6 +63,16 @@ export const createBookmarksStore = ({ namePrefix }: PersistStoreProps) =>
57
63
  bookmarks: state.bookmarks,
58
64
  recentWallets: state.recentWallets,
59
65
  }),
66
+ onRehydrateStorage: () => {
67
+ return (state) => {
68
+ if (state && toAddress && !toAddress.name) {
69
+ const existingBookmark = state.getBookmark(toAddress.address);
70
+ if (existingBookmark) {
71
+ state.setSelectedBookmark(existingBookmark);
72
+ }
73
+ }
74
+ };
75
+ },
60
76
  },
61
77
  ) as StateCreator<BookmarkState, [], [], BookmarkState>,
62
78
  Object.is,