@lifi/widget 2.0.0-beta.2 → 2.0.0-beta.4
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/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
- package/cjs/components/Header/NavigationHeader.js +18 -5
- package/cjs/components/Insurance/InsuranceCard.js +27 -11
- package/cjs/components/Insurance/InsuranceCollapsed.js +1 -1
- package/cjs/components/Insurance/types.d.ts +1 -2
- package/cjs/components/NFT/NFT.js +2 -2
- package/cjs/components/NFT/types.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +2 -3
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/cjs/components/Step/CircularProgress.d.ts +0 -1
- package/cjs/components/Step/Step.js +14 -4
- package/cjs/components/Step/StepList.d.ts +0 -1
- package/cjs/components/StepActions/StepActions.js +2 -19
- package/cjs/components/SwapButton/SwapButton.js +16 -4
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +6 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/cjs/components/Token/Token.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.js +4 -2
- package/cjs/components/TokenList/types.d.ts +2 -3
- package/cjs/config/theme.js +14 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useProcessMessage.d.ts +2 -1
- package/cjs/hooks/useProcessMessage.js +23 -9
- package/cjs/hooks/useSwapRoutes.js +24 -11
- package/cjs/hooks/useToken.d.ts +1 -1
- package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
- package/cjs/hooks/useTokenBalances.d.ts +5 -5
- package/cjs/hooks/useTokenBalances.js +3 -14
- package/cjs/hooks/useTokenSearch.d.ts +2 -2
- package/cjs/hooks/useTokens.d.ts +2 -2
- package/cjs/i18n/bn.json +8 -0
- package/cjs/i18n/en.json +24 -2
- package/cjs/i18n/fr.json +8 -0
- package/cjs/i18n/id.json +22 -7
- package/cjs/i18n/ko.json +22 -7
- package/cjs/i18n/pt.json +8 -0
- package/cjs/i18n/th.json +21 -6
- package/cjs/i18n/uk.json +20 -12
- package/cjs/i18n/zh.json +8 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +9 -3
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
- package/cjs/pages/SwapPage/SwapPage.js +12 -6
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
- package/cjs/providers/WalletProvider/types.d.ts +2 -2
- package/cjs/types/token.d.ts +2 -2
- package/cjs/types/widget.d.ts +7 -6
- package/cjs/types/widget.js +1 -0
- package/components/ChainSelect/ChainSelect.d.ts +0 -1
- package/components/ChainSelect/ChainSelect.style.js +1 -1
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
- package/components/Header/NavigationHeader.js +18 -5
- package/components/Insurance/InsuranceCard.js +29 -13
- package/components/Insurance/InsuranceCollapsed.js +1 -1
- package/components/Insurance/types.d.ts +1 -2
- package/components/NFT/NFT.js +2 -2
- package/components/NFT/types.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.js +2 -3
- package/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/components/Step/CircularProgress.d.ts +0 -1
- package/components/Step/Step.js +14 -4
- package/components/Step/StepList.d.ts +0 -1
- package/components/StepActions/StepActions.js +2 -19
- package/components/SwapButton/SwapButton.js +16 -4
- package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
- package/components/SwapRouteCard/SwapRouteCard.js +7 -4
- package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +1 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
- package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/components/Token/Token.js +1 -1
- package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/components/TokenList/TokenList.js +4 -2
- package/components/TokenList/types.d.ts +2 -3
- package/config/theme.js +14 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useFeaturedTokens.d.ts +1 -1
- package/hooks/useProcessMessage.d.ts +2 -1
- package/hooks/useProcessMessage.js +23 -9
- package/hooks/useSwapRoutes.js +24 -11
- package/hooks/useToken.d.ts +1 -1
- package/hooks/useTokenAddressBalance.d.ts +2 -2
- package/hooks/useTokenBalances.d.ts +5 -5
- package/hooks/useTokenBalances.js +3 -14
- package/hooks/useTokenSearch.d.ts +2 -2
- package/hooks/useTokens.d.ts +2 -2
- package/i18n/bn.json +8 -0
- package/i18n/en.json +24 -2
- package/i18n/fr.json +8 -0
- package/i18n/id.json +22 -7
- package/i18n/ko.json +22 -7
- package/i18n/pt.json +8 -0
- package/i18n/th.json +21 -6
- package/i18n/uk.json +20 -12
- package/i18n/zh.json +8 -0
- package/package.json +7 -7
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
- package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
- package/pages/SettingsPage/SettingsPage.d.ts +0 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
- package/pages/SettingsPage/SlippageInput.d.ts +0 -1
- package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/pages/SwapPage/StatusBottomSheet.js +11 -5
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
- package/pages/SwapPage/SwapPage.js +12 -6
- package/pages/SwapPage/TokenValueBottomSheet.js +2 -2
- package/providers/WalletProvider/types.d.ts +2 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/token.d.ts +2 -2
- package/types/widget.d.ts +7 -6
- package/types/widget.js +1 -0
package/cjs/i18n/th.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"done": "เสร็จสิ้น",
|
|
13
13
|
"getGas": "รับแก็ส",
|
|
14
14
|
"hide": "ซ่อน",
|
|
15
|
+
"learnMore": "เรียนรู้เพิ่มเติม",
|
|
15
16
|
"lifiSwap": "การแลกเปลี่ยนของ LI.FI",
|
|
16
17
|
"light": "สว่าง",
|
|
17
18
|
"max": "สูงสุด",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"startSwap": "เริ่มต้นการแลกเปลี่ยน",
|
|
30
31
|
"swap": "การแลกเปลี่ยน",
|
|
31
32
|
"tryAgain": "ลองใหม่",
|
|
33
|
+
"viewCoverage": "ดูความคุ้มครอง",
|
|
32
34
|
"viewOnExplorer": "ดูในการสำรวจ"
|
|
33
35
|
},
|
|
34
36
|
"format": {
|
|
@@ -104,14 +106,22 @@
|
|
|
104
106
|
"gasFeeEstimated": "ค่าแก๊สโดยประมาณ",
|
|
105
107
|
"gasFeePaid": "จ่ายค่าทำเนียมแล้ว",
|
|
106
108
|
"inProgress": "กำลังดำเนินการ",
|
|
109
|
+
"insurance": {
|
|
110
|
+
"bridgeExploits": "การบริดจ์ทำงานผิดปกติ แฮ็กหรือหาผลประโยชน์",
|
|
111
|
+
"insure": "ประกัน 100% ของโทเค็นระหว่างการโอน",
|
|
112
|
+
"insured": "คุณได้รับการประกันโทเค็น 100% ระหว่างการโอน",
|
|
113
|
+
"slippageError": "เกิดข้อผิดพลาดในการคลาดเคลื่อนของโทเค็นที่ได้รับ"
|
|
114
|
+
},
|
|
107
115
|
"info": {
|
|
108
116
|
"message": {
|
|
117
|
+
"autoRefuel": "คุณใช้แก็ส {{chainName}} เหลือน้อย เมื่อดำเนินการต่อ คุณจะได้รับแก็สเพียงพอสำหรับการแลกเปลี่ยนให้เสร็จสมบูรณ์",
|
|
109
118
|
"emptyActiveSwaps": "การแลกเปลี่ยนที่กำลังดำเนินการจะปรากฏที่นี่. เมื่อเสร็จสิ้น, จะพบประวัติการแลกเปลี่ยน.",
|
|
110
119
|
"emptySwapHistory": "ประวัติการแลกเปลี่ยนจะถูกเก็บไว้ในเครื่องเท่านั้นและจะถูกลบหากคุณล้างข้อมูลเบราว์เซอร์ของคุณ.",
|
|
111
120
|
"emptyTokenList": "เราไม่พบโทเค็นใน {{chainName}} เชนหรือคุณไม่มีโทเค็น. โปรดลองอีกครั้งหรือเลือกเชนอื่น.",
|
|
112
121
|
"routeNotFound": "ลองจับคู่แลกเปลี่ยนโทเค็นใหม่."
|
|
113
122
|
},
|
|
114
123
|
"title": {
|
|
124
|
+
"autoRefuel": "รับแก็ส",
|
|
115
125
|
"emptyActiveSwaps": "ไม่พบการแลกเปลี่ยนที่ใช้งานอยู่.",
|
|
116
126
|
"emptySwapHistory": "ไม่พบการแลกเปลี่ยนล่าสุด.",
|
|
117
127
|
"routeNotFound": "ไม่พบเส้นทาง"
|
|
@@ -154,6 +164,7 @@
|
|
|
154
164
|
"quotedAmount": "จำนวนทั้งหมดที่เสนอ",
|
|
155
165
|
"rateChange": "อัตราแลกเปลี่ยน",
|
|
156
166
|
"receiving": "ได้รับ",
|
|
167
|
+
"refuelStepDetails": "รับแก๊สผ่าน {{tool}}",
|
|
157
168
|
"routes": "คุณได้รับ",
|
|
158
169
|
"selectChain": "เชน",
|
|
159
170
|
"selectChainAndToken": "เลือกเชนและโทเค็น",
|
|
@@ -162,6 +173,7 @@
|
|
|
162
173
|
"sendToWallet": "ส่งไปยังกระเป๋าเงินอื่น",
|
|
163
174
|
"sentToAddress": "ส่งไปยัง {{address}}",
|
|
164
175
|
"stepBridge": "บริดจ์",
|
|
176
|
+
"stepDetails": "{{tool}} โดย LI.FI",
|
|
165
177
|
"stepSwap": "แลกเปลี่ยน",
|
|
166
178
|
"stepSwapAndBridge": "แลกเปลี่ยนและบริดจ์",
|
|
167
179
|
"success": {
|
|
@@ -180,11 +192,13 @@
|
|
|
180
192
|
"swapStepDetails": "แลกเปลี่ยนบน {{chain}} ผ่าน {{tool}}",
|
|
181
193
|
"swapping": "การแลกเปลี่ยน",
|
|
182
194
|
"tags": {
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
195
|
+
"cheapest": "ราคาถูก",
|
|
196
|
+
"fastest": "รวดเร็ว",
|
|
197
|
+
"insurable": "การประกัน",
|
|
198
|
+
"insurance": "การประกัน",
|
|
199
|
+
"insured": "ประกัน",
|
|
200
|
+
"recommended": "แนะนำ",
|
|
201
|
+
"safest": "ปลอดภัย"
|
|
188
202
|
},
|
|
189
203
|
"to": "ถึง",
|
|
190
204
|
"tokenOnChain": "{{tokenSymbol}} บน {{chainName}}",
|
|
@@ -198,7 +212,7 @@
|
|
|
198
212
|
"deleteSwapHistory": "ประวัติการแลกเปลี่ยนจะถูกจัดเก็บไว้ในเครื่องเท่านั้นและไม่สามารถกู้คืนได้หากคุณลบออก",
|
|
199
213
|
"highValueLoss": "มูลค่าของโทเค็นที่ได้รับนั้นต่ำกว่าโทเค็นที่แลกเปลี่ยนและต้นทุนการทำธุรกรรมอย่างมาก.",
|
|
200
214
|
"insufficientFunds": "คุณมีเงินไม่เพียงพอที่จะดำเนินการแลกเปลี่ยน.",
|
|
201
|
-
"insufficientGas": "คุณต้องเพิ่มอย่างน้อย:",
|
|
215
|
+
"insufficientGas": "คุณมีแก๊สไม่เพียงพอที่จะแลกเปลี่ยนให้เสร็จสมบูรณ์ คุณต้องเพิ่มอย่างน้อย:",
|
|
202
216
|
"rateChanged": "อัตราแลกเปลี่ยนมีการเปลี่ยนแปลง คุณจะยอมรับอัตราใหม่.",
|
|
203
217
|
"resetSettings": "การดำเนินการนี้จะรีเซ็ตลำดับความสำคัญของเส้นทาง การคลาดเลื่อน ค่าแก็ส บริดจ์ที่เปิดใช้งานและการแลกเปลี่ยน"
|
|
204
218
|
},
|
|
@@ -214,6 +228,7 @@
|
|
|
214
228
|
}
|
|
215
229
|
},
|
|
216
230
|
"tooltip": {
|
|
231
|
+
"additionalProviderFee": "บริดจ์เพิ่มเติม DEX และค่าบริการ",
|
|
217
232
|
"estimatedNetworkFee": "ค่าธรรรมเนียมโดยประมาณของเครือข่าย",
|
|
218
233
|
"estimatedTime": "เวลาดำเนินการแลกเปลี่ยนโดยประมาณเป็นนาที.",
|
|
219
234
|
"notFound": {
|
package/cjs/i18n/uk.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"done": "Готово",
|
|
13
13
|
"getGas": "Отримати газ",
|
|
14
14
|
"hide": "Сховати",
|
|
15
|
+
"learnMore": "Докладніше",
|
|
15
16
|
"lifiSwap": "LI.FI Swap",
|
|
16
17
|
"light": "Світла",
|
|
17
18
|
"max": "макс",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"startSwap": "Почати своп",
|
|
30
31
|
"swap": "Своп",
|
|
31
32
|
"tryAgain": "Спробувати ще раз",
|
|
33
|
+
"viewCoverage": "Переглянути покриття",
|
|
32
34
|
"viewOnExplorer": "Переглянути в оглядачі"
|
|
33
35
|
},
|
|
34
36
|
"format": {
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"title": "Мова"
|
|
57
59
|
},
|
|
58
60
|
"settings": {
|
|
59
|
-
"enabledBridges": "Увімкнені
|
|
61
|
+
"enabledBridges": "Увімкнені бриджі",
|
|
60
62
|
"enabledExchanges": "Увімкнені обмінники",
|
|
61
63
|
"gasPrice": {
|
|
62
64
|
"fast": "Швидко",
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"slippage": "Прослизання"
|
|
70
72
|
},
|
|
71
73
|
"swap": {
|
|
72
|
-
"crossStepDetails": "
|
|
74
|
+
"crossStepDetails": "Бридж з {{from}} до {{to}} через {{tool}}",
|
|
73
75
|
"currentAmount": "Поточна сума",
|
|
74
76
|
"error": {
|
|
75
77
|
"message": {
|
|
@@ -104,6 +106,12 @@
|
|
|
104
106
|
"gasFeeEstimated": "орієнтована комісія за газ",
|
|
105
107
|
"gasFeePaid": "оплата за газ",
|
|
106
108
|
"inProgress": "в процесі",
|
|
109
|
+
"insurance": {
|
|
110
|
+
"bridgeExploits": "Збої в роботі бриджу, зломи чи експлойти",
|
|
111
|
+
"insure": "Застрахуйте 100% токенів транзакції.",
|
|
112
|
+
"insured": "Ви застрахували 100% токенів транзакції:",
|
|
113
|
+
"slippageError": "Помилка в прослизанні для отриманих токенів"
|
|
114
|
+
},
|
|
107
115
|
"info": {
|
|
108
116
|
"message": {
|
|
109
117
|
"autoRefuel": "У вас замало {{chainName}} газу. Продовжуючи, ви отримаєте достатньо газу, щоб завершити обмін.",
|
|
@@ -127,15 +135,15 @@
|
|
|
127
135
|
"process": {
|
|
128
136
|
"crossChain": {
|
|
129
137
|
"actionRequired": "Будь ласка, підпишіть транзакцію",
|
|
130
|
-
"done": "
|
|
131
|
-
"pending": "Очікування
|
|
132
|
-
"started": "Підготовка
|
|
138
|
+
"done": "Бридж транзакцію схвалено",
|
|
139
|
+
"pending": "Очікування бридж транзакції",
|
|
140
|
+
"started": "Підготовка бридж транзакції"
|
|
133
141
|
},
|
|
134
142
|
"receivingChain": {
|
|
135
|
-
"done": "
|
|
136
|
-
"partial": "
|
|
143
|
+
"done": "Бридж завершено",
|
|
144
|
+
"partial": "Бридж частково завершено",
|
|
137
145
|
"pending": "В очікуванні чейна що приймає",
|
|
138
|
-
"refunded": "
|
|
146
|
+
"refunded": "Бридж транзакція відшкодована"
|
|
139
147
|
},
|
|
140
148
|
"swap": {
|
|
141
149
|
"actionRequired": "Будь ласка, підпишіть транзакцію",
|
|
@@ -164,10 +172,10 @@
|
|
|
164
172
|
"sendToAddress": "Відправити на {{address}}",
|
|
165
173
|
"sendToWallet": "Надіслати на інший гаманець",
|
|
166
174
|
"sentToAddress": "Відправлено на {{address}}",
|
|
167
|
-
"stepBridge": "
|
|
175
|
+
"stepBridge": "Бридж",
|
|
168
176
|
"stepDetails": "{{tool}} через LI.FI",
|
|
169
177
|
"stepSwap": "Своп",
|
|
170
|
-
"stepSwapAndBridge": "Своп та
|
|
178
|
+
"stepSwapAndBridge": "Своп та бридж",
|
|
171
179
|
"success": {
|
|
172
180
|
"message": {
|
|
173
181
|
"swapPartiallySuccessful": "Ми намагалися завершити своп, але {{tool}} не вистачило ліквідності токену {{tokenSymbol}}.",
|
|
@@ -206,7 +214,7 @@
|
|
|
206
214
|
"insufficientFunds": "У вас недостатньо коштів для здійснення свопу.",
|
|
207
215
|
"insufficientGas": "Для завершення свопа у вас недостатньо газу. Вам необхідно додати хоча б:",
|
|
208
216
|
"rateChanged": "Курс обміну змінився. Продовжуючи своп, ви приймете новий курс.",
|
|
209
|
-
"resetSettings": "Це скине пріоритет вашого маршруту, прослизання, ціну газу, увімкнені
|
|
217
|
+
"resetSettings": "Це скине пріоритет вашого маршруту, прослизання, ціну газу, увімкнені бриджі та обмінники."
|
|
210
218
|
},
|
|
211
219
|
"title": {
|
|
212
220
|
"deleteActiveSwaps": "Видалити всі активні свопи?",
|
|
@@ -220,7 +228,7 @@
|
|
|
220
228
|
}
|
|
221
229
|
},
|
|
222
230
|
"tooltip": {
|
|
223
|
-
"additionalProviderFee": "Додаткові комісії
|
|
231
|
+
"additionalProviderFee": "Додаткові комісії бриджів, обмінників та послуг.",
|
|
224
232
|
"estimatedNetworkFee": "Орієнтовна мережева плата.",
|
|
225
233
|
"estimatedTime": "Орієнтовний час виконання свопу в хвилинах.",
|
|
226
234
|
"notFound": {
|
package/cjs/i18n/zh.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"done": "已完成",
|
|
13
13
|
"getGas": "开始兑换燃气费",
|
|
14
14
|
"hide": "隐藏",
|
|
15
|
+
"learnMore": "了解更多",
|
|
15
16
|
"lifiSwap": "LI.FI兑换",
|
|
16
17
|
"light": "浅色主题",
|
|
17
18
|
"max": "最大",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"startSwap": "开始兑换",
|
|
30
31
|
"swap": "兑换",
|
|
31
32
|
"tryAgain": "重试",
|
|
33
|
+
"viewCoverage": "查看我们的覆盖范围",
|
|
32
34
|
"viewOnExplorer": "在区块链浏览器上查看"
|
|
33
35
|
},
|
|
34
36
|
"format": {
|
|
@@ -104,6 +106,12 @@
|
|
|
104
106
|
"gasFeeEstimated": "预估燃气费",
|
|
105
107
|
"gasFeePaid": "已支付燃气费",
|
|
106
108
|
"inProgress": "进行中",
|
|
109
|
+
"insurance": {
|
|
110
|
+
"bridgeExploits": "跨链桥故障、被黑或者被利用漏洞",
|
|
111
|
+
"insure": "为跨链代币提供100%的保障",
|
|
112
|
+
"insured": "您已经对100%的跨链代币投保:",
|
|
113
|
+
"slippageError": "目标链代币的滑点错误"
|
|
114
|
+
},
|
|
107
115
|
"info": {
|
|
108
116
|
"message": {
|
|
109
117
|
"autoRefuel": "您在 {{chainName}} 链上的燃气费很低。如果启用该选项,您将获得足够的燃气费完成此次兑换。",
|
|
@@ -10,16 +10,19 @@ const react_i18next_1 = require("react-i18next");
|
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
11
|
const shallow_1 = require("zustand/shallow");
|
|
12
12
|
const Card_1 = require("../../components/Card");
|
|
13
|
+
const ContractComponent_1 = require("../../components/ContractComponent");
|
|
13
14
|
const Dialog_1 = require("../../components/Dialog");
|
|
14
15
|
const Header_1 = require("../../components/Header");
|
|
15
16
|
const Insurance_1 = require("../../components/Insurance");
|
|
16
17
|
const Step_1 = require("../../components/Step");
|
|
17
18
|
const hooks_1 = require("../../hooks");
|
|
19
|
+
const providers_1 = require("../../providers");
|
|
18
20
|
const stores_1 = require("../../stores");
|
|
19
21
|
const SwapDetailsPage_style_1 = require("./SwapDetailsPage.style");
|
|
20
22
|
const SwapDetailsPage = () => {
|
|
21
23
|
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
22
24
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
25
|
+
const { variant } = (0, providers_1.useWidgetConfig)();
|
|
23
26
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
24
27
|
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state?.routeId], store.deleteRoute], shallow_1.shallow);
|
|
25
28
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
@@ -53,7 +56,7 @@ const SwapDetailsPage = () => {
|
|
|
53
56
|
justifyContent: 'space-between',
|
|
54
57
|
}, pb: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
|
|
55
58
|
timeStyle: 'short',
|
|
56
|
-
}).format(startedAt) })] }), (0, Step_1.getStepList)(routeExecution?.route), routeExecution?.route?.insurance?.state === 'INSURED' ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, (0, jsx_runtime_1.jsxs)(Card_1.Card, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
59
|
+
}).format(startedAt) })] }), (0, Step_1.getStepList)(routeExecution?.route), variant === 'nft' ? (0, jsx_runtime_1.jsx)(ContractComponent_1.ContractComponent, { mt: 2 }) : null, routeExecution?.route?.insurance?.state === 'INSURED' ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, (0, jsx_runtime_1.jsxs)(Card_1.Card, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
57
60
|
display: 'flex',
|
|
58
61
|
flex: 1,
|
|
59
62
|
}, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('swap.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(material_1.Button, { href: "https://discord.com/channels/849912621360218112/863689862514343946", target: "_blank", rel: "nofollow noreferrer", fullWidth: true, children: t('button.contactSupport') }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('swap.warning.title.deleteSwap') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
@@ -47,7 +47,7 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
|
47
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
48
48
|
const ref = (0, react_1.useRef)();
|
|
49
49
|
(0, hooks_1.useSetContentHeight)(ref);
|
|
50
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.CenterContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.quotedAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
51
51
|
value: (0, utils_1.formatTokenAmount)(data?.oldToAmount, data?.toToken.decimals, 5),
|
|
52
52
|
}), ' ', data?.toToken.symbol] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.currentAmount') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [t('format.number', {
|
|
53
53
|
value: (0, utils_1.formatTokenAmount)(data?.newToAmount, data?.toToken.decimals, 5),
|
|
@@ -23,6 +23,7 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
23
23
|
const ref = (0, react_1.useRef)(null);
|
|
24
24
|
const { getChainById } = (0, hooks_1.useChains)();
|
|
25
25
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
26
|
+
const { variant, contractComponent, contractCompactComponent } = (0, providers_1.useWidgetConfig)();
|
|
26
27
|
const toToken = {
|
|
27
28
|
...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
|
|
28
29
|
amount: route.steps.at(-1)?.execution?.toAmount ??
|
|
@@ -33,6 +34,7 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
33
34
|
const clearFromAmount = () => {
|
|
34
35
|
refetchAllBalances();
|
|
35
36
|
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
37
|
+
setValue(providers_1.SwapFormKey.ToAmount, '');
|
|
36
38
|
};
|
|
37
39
|
const handleDone = () => {
|
|
38
40
|
clearFromAmount();
|
|
@@ -71,7 +73,10 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
71
73
|
let handlePrimaryButton = handleDone;
|
|
72
74
|
switch (status) {
|
|
73
75
|
case stores_1.RouteExecutionStatus.Done: {
|
|
74
|
-
title =
|
|
76
|
+
title =
|
|
77
|
+
variant === 'nft'
|
|
78
|
+
? t('swap.success.title.purchaseSuccessful')
|
|
79
|
+
: t('swap.success.title.swapSuccessful');
|
|
75
80
|
if (token) {
|
|
76
81
|
primaryMessage = t('swap.success.message.swapSuccessful', {
|
|
77
82
|
amount: token.amount,
|
|
@@ -142,8 +147,9 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
142
147
|
ref.current?.open();
|
|
143
148
|
}
|
|
144
149
|
}, [refetch, refetchNewBalance, status]);
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
const showContractComponent = variant === 'nft' && (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done);
|
|
151
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, { ref: ref, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, children: [!showContractComponent ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, { status: status, mb: 1, children: [status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InfoRounded_1.default, { color: "primary" })) : null, status === stores_1.RouteExecutionStatus.Done ? ((0, jsx_runtime_1.jsx)(Done_1.default, { color: "success" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Partial) ||
|
|
152
|
+
(0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Refunded) ? ((0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" })) : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Failed) ? ((0, jsx_runtime_1.jsx)(ErrorRounded_1.default, { color: "error" })) : null] }) })) : null, (0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent || contractComponent) : ((0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.CenterContainer, { children: (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done) ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: toToken, py: 1, disableDescription: true })) : null })), !showContractComponent ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: primaryMessage })) : null, secondaryMessage ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: secondaryMessage })) : null, (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsxs)(material_1.Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === stores_1.RouteExecutionStatus.Idle ? t('button.ok') : null, (0, utils_1.hasEnumFlag)(status, stores_1.RouteExecutionStatus.Done)
|
|
147
153
|
? t('button.done')
|
|
148
154
|
: null, status === stores_1.RouteExecutionStatus.Failed
|
|
149
155
|
? t('button.seeDetails')
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Theme } from '@mui/material';
|
|
3
3
|
import { RouteExecutionStatus } from '../../stores';
|
|
4
4
|
type StatusColor = RouteExecutionStatus | 'warning';
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const CenterContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
|
|
6
6
|
children?: import("react").ReactNode;
|
|
7
7
|
component?: import("react").ElementType<any> | undefined;
|
|
8
8
|
ref?: import("react").Ref<unknown> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IconCircle = exports.
|
|
3
|
+
exports.IconCircle = exports.CenterContainer = void 0;
|
|
4
4
|
const material_1 = require("@mui/material");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const stores_1 = require("../../stores");
|
|
@@ -18,7 +18,7 @@ const getStatusColor = (status, theme) => {
|
|
|
18
18
|
return { color: theme.palette.primary.main, alpha: 0.12, darken: 0 };
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.CenterContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
22
22
|
display: 'grid',
|
|
23
23
|
placeItems: 'center',
|
|
24
24
|
position: 'relative',
|
|
@@ -8,6 +8,7 @@ const react_1 = require("react");
|
|
|
8
8
|
const react_hook_form_1 = require("react-hook-form");
|
|
9
9
|
const react_i18next_1 = require("react-i18next");
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
|
+
const ContractComponent_1 = require("../../components/ContractComponent");
|
|
11
12
|
const GasMessage_1 = require("../../components/GasMessage");
|
|
12
13
|
const Insurance_1 = require("../../components/Insurance");
|
|
13
14
|
const Step_1 = require("../../components/Step");
|
|
@@ -43,7 +44,7 @@ const SwapPage = () => {
|
|
|
43
44
|
const handleSwapClick = async () => {
|
|
44
45
|
if (status === stores_1.RouteExecutionStatus.Idle) {
|
|
45
46
|
const thresholdExceeded = (0, TokenValueBottomSheet_1.getTokenValueLossThreshold)(route);
|
|
46
|
-
if (thresholdExceeded) {
|
|
47
|
+
if (thresholdExceeded && variant !== 'nft') {
|
|
47
48
|
tokenValueBottomSheetRef.current?.open();
|
|
48
49
|
}
|
|
49
50
|
else {
|
|
@@ -61,9 +62,14 @@ const SwapPage = () => {
|
|
|
61
62
|
const getSwapButtonText = () => {
|
|
62
63
|
switch (status) {
|
|
63
64
|
case stores_1.RouteExecutionStatus.Idle:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
switch (variant) {
|
|
66
|
+
case 'nft':
|
|
67
|
+
return t('button.buyNow');
|
|
68
|
+
case 'refuel':
|
|
69
|
+
return t('button.startGasSwap');
|
|
70
|
+
default:
|
|
71
|
+
return t('button.startSwap');
|
|
72
|
+
}
|
|
67
73
|
case stores_1.RouteExecutionStatus.Failed:
|
|
68
74
|
return t('button.tryAgain');
|
|
69
75
|
default:
|
|
@@ -81,10 +87,10 @@ const SwapPage = () => {
|
|
|
81
87
|
const insuranceCoverageId = route?.steps[0].execution?.process
|
|
82
88
|
.filter((process) => process.type !== 'TOKEN_ALLOWANCE')
|
|
83
89
|
.find((process) => process.txHash)?.txHash ?? route?.fromAddress;
|
|
84
|
-
return ((0, jsx_runtime_1.jsxs)(SwapPage_style_1.Container, { children: [(0, Step_1.getStepList)(route), insuranceAvailable ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route?.insurance.feeAmountUsd, insuranceCoverageId: insuranceCoverageId, onChange: setRouteId })) : null, status === stores_1.RouteExecutionStatus.Idle ||
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)(SwapPage_style_1.Container, { children: [(0, Step_1.getStepList)(route), variant === 'nft' ? (0, jsx_runtime_1.jsx)(ContractComponent_1.ContractComponent, { mt: 2 }) : null, insuranceAvailable ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route?.insurance.feeAmountUsd, insuranceCoverageId: insuranceCoverageId, onChange: setRouteId })) : null, status === stores_1.RouteExecutionStatus.Idle ||
|
|
85
91
|
status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GasMessage_1.GasMessage, { mt: 2, route: route }), (0, jsx_runtime_1.jsxs)(material_1.Box, { mt: 2, display: "flex", children: [(0, jsx_runtime_1.jsx)(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, route: route, insurableRouteId: stateRouteId }), status === stores_1.RouteExecutionStatus.Failed ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleRemoveRoute, sx: {
|
|
86
92
|
minWidth: 48,
|
|
87
93
|
marginLeft: 1,
|
|
88
|
-
}, children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }) })) : null] })] })) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null, route ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? ((0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
|
|
94
|
+
}, children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }) })) : null] })] })) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null, route && variant !== 'nft' ? ((0, jsx_runtime_1.jsx)(TokenValueBottomSheet_1.TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? ((0, jsx_runtime_1.jsx)(ExchangeRateBottomSheet_1.ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
|
|
89
95
|
};
|
|
90
96
|
exports.SwapPage = SwapPage;
|
|
@@ -21,7 +21,7 @@ const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
|
21
21
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
22
|
const ref = (0, react_1.useRef)();
|
|
23
23
|
(0, hooks_1.useSetContentHeight)(ref);
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { p: 3, ref: ref, children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.CenterContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, { status: "warning", mb: 1, children: (0, jsx_runtime_1.jsx)(WarningRounded_1.default, { color: "warning" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.highValueLoss') })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { py: 1, children: t('swap.warning.message.highValueLoss') }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.swapping') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.gasCost') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.receiving') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.valueLoss') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { fontWeight: 600, children: [(0, big_js_1.default)(route.toAmountUSD || 0)
|
|
25
25
|
.div((0, big_js_1.default)(route.fromAmountUSD || 0).plus((0, big_js_1.default)(route.gasCostUSD || 0)))
|
|
26
26
|
.minus(1)
|
|
27
27
|
.mul(100)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Signer } from '@ethersproject/abstract-signer';
|
|
2
2
|
import type { Provider } from '@ethersproject/providers';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StaticToken } from '@lifi/sdk';
|
|
4
4
|
import type { Wallet } from '@lifi/wallet-management';
|
|
5
5
|
export interface WalletContextProps {
|
|
6
6
|
account: WalletAccount;
|
|
7
7
|
provider?: Provider;
|
|
8
8
|
addChain(chainId: number): Promise<boolean>;
|
|
9
|
-
addToken(chainId: number, token:
|
|
9
|
+
addToken(chainId: number, token: StaticToken): Promise<void>;
|
|
10
10
|
disconnect(wallet?: Wallet): void;
|
|
11
11
|
switchChain(chainId: number): Promise<boolean>;
|
|
12
12
|
connect(wallet?: Wallet | undefined): Promise<void>;
|
package/cjs/types/token.d.ts
CHANGED
package/cjs/types/widget.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Signer } from '@ethersproject/abstract-signer';
|
|
2
|
-
import type { ChainKey, ConfigUpdate, Order, RouteOptions,
|
|
2
|
+
import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken } from '@lifi/sdk';
|
|
3
3
|
import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
|
|
4
4
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
5
5
|
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
@@ -16,7 +16,8 @@ export declare enum HiddenUI {
|
|
|
16
16
|
Appearance = "appearance",
|
|
17
17
|
Language = "language",
|
|
18
18
|
PoweredBy = "poweredBy",
|
|
19
|
-
ToAddress = "toAddress"
|
|
19
|
+
ToAddress = "toAddress",
|
|
20
|
+
History = "history"
|
|
20
21
|
}
|
|
21
22
|
export type HiddenUIType = `${HiddenUI}`;
|
|
22
23
|
export declare enum RequiredUI {
|
|
@@ -34,7 +35,7 @@ export interface WidgetWalletManagement {
|
|
|
34
35
|
connect(): Promise<Signer>;
|
|
35
36
|
disconnect(): Promise<void>;
|
|
36
37
|
switchChain?(chainId: number): Promise<Signer>;
|
|
37
|
-
addToken?(token:
|
|
38
|
+
addToken?(token: StaticToken, chainId: number): Promise<void>;
|
|
38
39
|
addChain?(chainId: number): Promise<boolean>;
|
|
39
40
|
signer?: Signer;
|
|
40
41
|
}
|
|
@@ -96,9 +97,9 @@ export interface WidgetConfig {
|
|
|
96
97
|
deny?: number[];
|
|
97
98
|
};
|
|
98
99
|
tokens?: {
|
|
99
|
-
featured?:
|
|
100
|
-
allow?:
|
|
101
|
-
deny?:
|
|
100
|
+
featured?: StaticToken[];
|
|
101
|
+
allow?: BaseToken[];
|
|
102
|
+
deny?: BaseToken[];
|
|
102
103
|
};
|
|
103
104
|
languages?: {
|
|
104
105
|
default?: LanguageKey;
|
package/cjs/types/widget.js
CHANGED
|
@@ -15,6 +15,7 @@ var HiddenUI;
|
|
|
15
15
|
HiddenUI["Language"] = "language";
|
|
16
16
|
HiddenUI["PoweredBy"] = "poweredBy";
|
|
17
17
|
HiddenUI["ToAddress"] = "toAddress";
|
|
18
|
+
HiddenUI["History"] = "history";
|
|
18
19
|
// ToToken = 'toToken',
|
|
19
20
|
})(HiddenUI = exports.HiddenUI || (exports.HiddenUI = {}));
|
|
20
21
|
var RequiredUI;
|
|
@@ -9,7 +9,7 @@ export const ChainCard = styled(Card)({
|
|
|
9
9
|
});
|
|
10
10
|
export const ChainContainer = styled(Box)(({ theme }) => ({
|
|
11
11
|
display: 'grid',
|
|
12
|
-
gridTemplateColumns: 'repeat(
|
|
12
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
|
|
13
13
|
gridAutoRows: '56px',
|
|
14
14
|
justifyContent: 'space-between',
|
|
15
15
|
gap: theme.spacing(1.5),
|
|
@@ -7,12 +7,13 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
8
8
|
import { useNavigateBack } from '../../hooks';
|
|
9
9
|
import { useWallet, useWidgetConfig } from '../../providers';
|
|
10
|
+
import { HiddenUI } from '../../types';
|
|
10
11
|
import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
|
|
11
12
|
import { HeaderAppBar } from './Header.style';
|
|
12
13
|
import { useHeaderActionStore } from './useHeaderActionStore';
|
|
13
14
|
export const NavigationHeader = () => {
|
|
14
15
|
const { t } = useTranslation();
|
|
15
|
-
const { variant } = useWidgetConfig();
|
|
16
|
+
const { variant, hiddenUI } = useWidgetConfig();
|
|
16
17
|
const { navigate, navigateBack } = useNavigateBack();
|
|
17
18
|
const { account } = useWallet();
|
|
18
19
|
const { element } = useHeaderActionStore();
|
|
@@ -34,8 +35,12 @@ export const NavigationHeader = () => {
|
|
|
34
35
|
return t(`settings.enabledExchanges`);
|
|
35
36
|
case navigationRoutes.swapHistory:
|
|
36
37
|
return t(`header.swapHistory`);
|
|
37
|
-
case navigationRoutes.fromToken:
|
|
38
|
+
case navigationRoutes.fromToken: {
|
|
39
|
+
if (variant === 'nft') {
|
|
40
|
+
return t(`header.payWith`);
|
|
41
|
+
}
|
|
38
42
|
return t(`header.from`);
|
|
43
|
+
}
|
|
39
44
|
case navigationRoutes.toToken:
|
|
40
45
|
return t(`header.to`);
|
|
41
46
|
case navigationRoutes.fromChain:
|
|
@@ -46,10 +51,18 @@ export const NavigationHeader = () => {
|
|
|
46
51
|
return t(`header.routes`);
|
|
47
52
|
case navigationRoutes.activeSwaps:
|
|
48
53
|
return t(`header.activeSwaps`);
|
|
49
|
-
case navigationRoutes.swapExecution:
|
|
54
|
+
case navigationRoutes.swapExecution: {
|
|
55
|
+
if (variant === 'nft') {
|
|
56
|
+
return t(`header.purchase`);
|
|
57
|
+
}
|
|
50
58
|
return t(`header.swap`);
|
|
51
|
-
|
|
59
|
+
}
|
|
60
|
+
case navigationRoutes.swapDetails: {
|
|
61
|
+
if (variant === 'nft') {
|
|
62
|
+
return t(`header.purchaseDetails`);
|
|
63
|
+
}
|
|
52
64
|
return t(`header.swapDetails`);
|
|
65
|
+
}
|
|
53
66
|
default: {
|
|
54
67
|
switch (variant) {
|
|
55
68
|
case 'nft':
|
|
@@ -62,7 +75,7 @@ export const NavigationHeader = () => {
|
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
77
|
};
|
|
65
|
-
return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
|
|
78
|
+
return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive && !hiddenUI?.includes(HiddenUI.History) ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
|
|
66
79
|
marginRight: -1.25,
|
|
67
80
|
}, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }));
|
|
68
81
|
};
|