@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.
Files changed (136) hide show
  1. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  2. package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
  3. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
  4. package/cjs/components/Header/NavigationHeader.js +18 -5
  5. package/cjs/components/Insurance/InsuranceCard.js +27 -11
  6. package/cjs/components/Insurance/InsuranceCollapsed.js +1 -1
  7. package/cjs/components/Insurance/types.d.ts +1 -2
  8. package/cjs/components/NFT/NFT.js +2 -2
  9. package/cjs/components/NFT/types.d.ts +1 -1
  10. package/cjs/components/PoweredBy/PoweredBy.js +2 -3
  11. package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -1
  12. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  13. package/cjs/components/Step/Step.js +14 -4
  14. package/cjs/components/Step/StepList.d.ts +0 -1
  15. package/cjs/components/StepActions/StepActions.js +2 -19
  16. package/cjs/components/SwapButton/SwapButton.js +16 -4
  17. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  18. package/cjs/components/SwapRouteCard/SwapRouteCard.js +6 -3
  19. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  20. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  21. package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
  22. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  23. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  24. package/cjs/components/Token/Token.js +1 -1
  25. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  26. package/cjs/components/TokenList/TokenList.js +4 -2
  27. package/cjs/components/TokenList/types.d.ts +2 -3
  28. package/cjs/config/theme.js +14 -1
  29. package/cjs/config/version.d.ts +1 -1
  30. package/cjs/config/version.js +1 -1
  31. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  32. package/cjs/hooks/useProcessMessage.d.ts +2 -1
  33. package/cjs/hooks/useProcessMessage.js +23 -9
  34. package/cjs/hooks/useSwapRoutes.js +24 -11
  35. package/cjs/hooks/useToken.d.ts +1 -1
  36. package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
  37. package/cjs/hooks/useTokenBalances.d.ts +5 -5
  38. package/cjs/hooks/useTokenBalances.js +3 -14
  39. package/cjs/hooks/useTokenSearch.d.ts +2 -2
  40. package/cjs/hooks/useTokens.d.ts +2 -2
  41. package/cjs/i18n/bn.json +8 -0
  42. package/cjs/i18n/en.json +24 -2
  43. package/cjs/i18n/fr.json +8 -0
  44. package/cjs/i18n/id.json +22 -7
  45. package/cjs/i18n/ko.json +22 -7
  46. package/cjs/i18n/pt.json +8 -0
  47. package/cjs/i18n/th.json +21 -6
  48. package/cjs/i18n/uk.json +20 -12
  49. package/cjs/i18n/zh.json +8 -0
  50. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  51. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  52. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  53. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  54. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  55. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  56. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  57. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
  58. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
  59. package/cjs/pages/SwapPage/StatusBottomSheet.js +9 -3
  60. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  61. package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
  62. package/cjs/pages/SwapPage/SwapPage.js +12 -6
  63. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  64. package/cjs/providers/WalletProvider/types.d.ts +2 -2
  65. package/cjs/types/token.d.ts +2 -2
  66. package/cjs/types/widget.d.ts +7 -6
  67. package/cjs/types/widget.js +1 -0
  68. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  69. package/components/ChainSelect/ChainSelect.style.js +1 -1
  70. package/components/GasMessage/FundsSufficiencyMessage.d.ts +0 -1
  71. package/components/Header/NavigationHeader.js +18 -5
  72. package/components/Insurance/InsuranceCard.js +29 -13
  73. package/components/Insurance/InsuranceCollapsed.js +1 -1
  74. package/components/Insurance/types.d.ts +1 -2
  75. package/components/NFT/NFT.js +2 -2
  76. package/components/NFT/types.d.ts +1 -1
  77. package/components/PoweredBy/PoweredBy.js +2 -3
  78. package/components/SelectTokenButton/SelectTokenButton.js +1 -1
  79. package/components/Step/CircularProgress.d.ts +0 -1
  80. package/components/Step/Step.js +14 -4
  81. package/components/Step/StepList.d.ts +0 -1
  82. package/components/StepActions/StepActions.js +2 -19
  83. package/components/SwapButton/SwapButton.js +16 -4
  84. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  85. package/components/SwapRouteCard/SwapRouteCard.js +7 -4
  86. package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  87. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  88. package/components/SwapRoutes/SwapRoutes.js +1 -1
  89. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  90. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  91. package/components/Token/Token.js +1 -1
  92. package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  93. package/components/TokenList/TokenList.js +4 -2
  94. package/components/TokenList/types.d.ts +2 -3
  95. package/config/theme.js +14 -1
  96. package/config/version.d.ts +1 -1
  97. package/config/version.js +1 -1
  98. package/hooks/useFeaturedTokens.d.ts +1 -1
  99. package/hooks/useProcessMessage.d.ts +2 -1
  100. package/hooks/useProcessMessage.js +23 -9
  101. package/hooks/useSwapRoutes.js +24 -11
  102. package/hooks/useToken.d.ts +1 -1
  103. package/hooks/useTokenAddressBalance.d.ts +2 -2
  104. package/hooks/useTokenBalances.d.ts +5 -5
  105. package/hooks/useTokenBalances.js +3 -14
  106. package/hooks/useTokenSearch.d.ts +2 -2
  107. package/hooks/useTokens.d.ts +2 -2
  108. package/i18n/bn.json +8 -0
  109. package/i18n/en.json +24 -2
  110. package/i18n/fr.json +8 -0
  111. package/i18n/id.json +22 -7
  112. package/i18n/ko.json +22 -7
  113. package/i18n/pt.json +8 -0
  114. package/i18n/th.json +21 -6
  115. package/i18n/uk.json +20 -12
  116. package/i18n/zh.json +8 -0
  117. package/package.json +7 -7
  118. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  119. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  120. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  121. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  122. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  123. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  124. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  125. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -1
  126. package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  127. package/pages/SwapPage/StatusBottomSheet.js +11 -5
  128. package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  129. package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
  130. package/pages/SwapPage/SwapPage.js +12 -6
  131. package/pages/SwapPage/TokenValueBottomSheet.js +2 -2
  132. package/providers/WalletProvider/types.d.ts +2 -2
  133. package/tsconfig.cjs.tsbuildinfo +1 -1
  134. package/types/token.d.ts +2 -2
  135. package/types/widget.d.ts +7 -6
  136. package/types/widget.js +1 -0
package/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": "Брідж з {{from}} до {{to}} через {{tool}}",
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/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}} 链上的燃气费很低。如果启用该选项,您将获得足够的燃气费完成此次兑换。",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
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
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -43,12 +43,12 @@
43
43
  "@ethersproject/address": "^5.7.0",
44
44
  "@ethersproject/experimental": "^5.7.0",
45
45
  "@ethersproject/providers": "^5.7.2",
46
- "@lifi/sdk": "^2.0.0-beta.8",
47
- "@lifi/wallet-management": "^2.0.0-beta.1",
46
+ "@lifi/sdk": "^2.0.0-beta.11",
47
+ "@lifi/wallet-management": "^2.0.0-beta.3",
48
48
  "@mui/icons-material": "^5.11.16",
49
- "@mui/lab": "^5.0.0-alpha.127",
50
- "@mui/material": "^5.12.1",
51
- "@tanstack/react-query": "^4.29.3",
49
+ "@mui/lab": "^5.0.0-alpha.128",
50
+ "@mui/material": "^5.12.2",
51
+ "@tanstack/react-query": "^4.29.5",
52
52
  "@tanstack/react-virtual": "^3.0.0-beta.54",
53
53
  "big.js": "^6.2.1",
54
54
  "i18next": "^22.4.15",
@@ -58,7 +58,7 @@
58
58
  "react": "^18.2.0",
59
59
  "react-dom": "^18.2.0",
60
60
  "react-hook-form": "^7.43.9",
61
- "react-i18next": "^12.2.0",
61
+ "react-i18next": "^12.2.2",
62
62
  "react-intersection-observer": "^9.4.3",
63
63
  "react-router-dom": "^6.10.0",
64
64
  "react-timer-hook": "^3.0.5",
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SearchTokenInput: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SettingsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ShowDestinationWallet: () => JSX.Element | null;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SlippageInput: () => JSX.Element;
@@ -7,16 +7,19 @@ import { useTranslation } from 'react-i18next';
7
7
  import { useLocation } from 'react-router-dom';
8
8
  import { shallow } from 'zustand/shallow';
9
9
  import { Card, CardTitle } from '../../components/Card';
10
+ import { ContractComponent } from '../../components/ContractComponent';
10
11
  import { Dialog } from '../../components/Dialog';
11
12
  import { useHeaderActionStore } from '../../components/Header';
12
13
  import { Insurance } from '../../components/Insurance';
13
14
  import { getStepList } from '../../components/Step';
14
15
  import { useNavigateBack } from '../../hooks';
16
+ import { useWidgetConfig } from '../../providers';
15
17
  import { useRouteExecutionStore } from '../../stores';
16
18
  import { Container } from './SwapDetailsPage.style';
17
19
  export const SwapDetailsPage = () => {
18
20
  const { t, i18n } = useTranslation();
19
21
  const { navigateBack } = useNavigateBack();
22
+ const { variant } = useWidgetConfig();
20
23
  const { state } = useLocation();
21
24
  const [routeExecution, deleteRoute] = useRouteExecutionStore((store) => [store.routes[state?.routeId], store.deleteRoute], shallow);
22
25
  const [open, setOpen] = useState(false);
@@ -50,7 +53,7 @@ export const SwapDetailsPage = () => {
50
53
  justifyContent: 'space-between',
51
54
  }, pb: 1, children: [_jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), _jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
52
55
  timeStyle: 'short',
53
- }).format(startedAt) })] }), getStepList(routeExecution?.route), routeExecution?.route?.insurance?.state === 'INSURED' ? (_jsx(Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, _jsxs(Card, { mt: 2, children: [_jsxs(Box, { sx: {
56
+ }).format(startedAt) })] }), getStepList(routeExecution?.route), variant === 'nft' ? _jsx(ContractComponent, { mt: 2 }) : null, routeExecution?.route?.insurance?.state === 'INSURED' ? (_jsx(Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, _jsxs(Card, { mt: 2, children: [_jsxs(Box, { sx: {
54
57
  display: 'flex',
55
58
  flex: 1,
56
59
  }, children: [_jsx(CardTitle, { flex: 1, children: t('swap.supportId') }), _jsx(Box, { mr: 1, mt: 1, children: _jsx(IconButton, { size: "medium", onClick: copySupportId, children: _jsx(ContentCopyIcon, { fontSize: "small" }) }) })] }), _jsx(Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), _jsx(Box, { mt: 2, children: _jsx(Button, { href: "https://discord.com/channels/849912621360218112/863689862514343946", target: "_blank", rel: "nofollow noreferrer", fullWidth: true, children: t('button.contactSupport') }) }), _jsxs(Dialog, { open: open, onClose: toggleDialog, children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteSwap') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: toggleDialog, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
7
7
  import { BottomSheet } from '../../components/BottomSheet';
8
8
  import { useSetContentHeight } from '../../hooks';
9
9
  import { formatTokenAmount } from '../../utils';
10
- import { IconCircle, IconContainer } from './StatusBottomSheet.style';
10
+ import { CenterContainer, IconCircle } from './StatusBottomSheet.style';
11
11
  export const ExchangeRateBottomSheet = forwardRef(({ onContinue, onCancel }, ref) => {
12
12
  const [data, setData] = useState();
13
13
  const bottomSheetRef = useRef(null);
@@ -44,7 +44,7 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
44
44
  const { t } = useTranslation();
45
45
  const ref = useRef();
46
46
  useSetContentHeight(ref);
47
- return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
47
+ return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(CenterContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
48
48
  value: formatTokenAmount(data?.oldToAmount, data?.toToken.decimals, 5),
49
49
  }), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
50
50
  value: formatTokenAmount(data?.newToAmount, data?.toToken.decimals, 5),
@@ -10,16 +10,17 @@ import { useTranslation } from 'react-i18next';
10
10
  import { BottomSheet } from '../../components/BottomSheet';
11
11
  import { Token } from '../../components/Token';
12
12
  import { getProcessMessage, useChains, useNavigateBack, useTokenBalance, } from '../../hooks';
13
- import { SwapFormKey } from '../../providers';
13
+ import { SwapFormKey, useWidgetConfig } from '../../providers';
14
14
  import { RouteExecutionStatus } from '../../stores';
15
15
  import { formatTokenAmount, hasEnumFlag, navigationRoutes, shortenWalletAddress, } from '../../utils';
16
- import { IconCircle, IconContainer } from './StatusBottomSheet.style';
16
+ import { CenterContainer, IconCircle } from './StatusBottomSheet.style';
17
17
  export const StatusBottomSheet = ({ status, route, }) => {
18
18
  const { t } = useTranslation();
19
19
  const { navigateBack, navigate } = useNavigateBack();
20
20
  const ref = useRef(null);
21
21
  const { getChainById } = useChains();
22
22
  const { setValue } = useFormContext();
23
+ const { variant, contractComponent, contractCompactComponent } = useWidgetConfig();
23
24
  const toToken = {
24
25
  ...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
25
26
  amount: route.steps.at(-1)?.execution?.toAmount ??
@@ -30,6 +31,7 @@ export const StatusBottomSheet = ({ status, route, }) => {
30
31
  const clearFromAmount = () => {
31
32
  refetchAllBalances();
32
33
  setValue(SwapFormKey.FromAmount, '');
34
+ setValue(SwapFormKey.ToAmount, '');
33
35
  };
34
36
  const handleDone = () => {
35
37
  clearFromAmount();
@@ -68,7 +70,10 @@ export const StatusBottomSheet = ({ status, route, }) => {
68
70
  let handlePrimaryButton = handleDone;
69
71
  switch (status) {
70
72
  case RouteExecutionStatus.Done: {
71
- title = t('swap.success.title.swapSuccessful');
73
+ title =
74
+ variant === 'nft'
75
+ ? t('swap.success.title.purchaseSuccessful')
76
+ : t('swap.success.title.swapSuccessful');
72
77
  if (token) {
73
78
  primaryMessage = t('swap.success.message.swapSuccessful', {
74
79
  amount: token.amount,
@@ -139,8 +144,9 @@ export const StatusBottomSheet = ({ status, route, }) => {
139
144
  ref.current?.open();
140
145
  }
141
146
  }, [refetch, refetchNewBalance, status]);
142
- return (_jsx(BottomSheet, { ref: ref, children: _jsxs(Box, { p: 3, children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, { status: status, mb: 1, children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoRoundedIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
143
- hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningRoundedIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorRoundedIcon, { color: "error" })) : null] }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null] }), _jsx(Typography, { py: 1, children: primaryMessage }), secondaryMessage ? (_jsx(Typography, { py: 1, children: secondaryMessage })) : null, _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
147
+ const showContractComponent = variant === 'nft' && hasEnumFlag(status, RouteExecutionStatus.Done);
148
+ return (_jsx(BottomSheet, { ref: ref, children: _jsxs(Box, { p: 3, children: [!showContractComponent ? (_jsx(CenterContainer, { children: _jsxs(IconCircle, { status: status, mb: 1, children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoRoundedIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
149
+ hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningRoundedIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorRoundedIcon, { color: "error" })) : null] }) })) : null, _jsx(CenterContainer, { children: _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }) }), showContractComponent ? (contractCompactComponent || contractComponent) : (_jsx(CenterContainer, { children: hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null })), !showContractComponent ? (_jsx(Typography, { py: 1, children: primaryMessage })) : null, secondaryMessage ? (_jsx(Typography, { py: 1, children: secondaryMessage })) : null, _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
144
150
  ? t('button.done')
145
151
  : null, status === RouteExecutionStatus.Failed
146
152
  ? 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 IconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
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;
@@ -15,7 +15,7 @@ const getStatusColor = (status, theme) => {
15
15
  return { color: theme.palette.primary.main, alpha: 0.12, darken: 0 };
16
16
  }
17
17
  };
18
- export const IconContainer = styled(Box)(({ theme }) => ({
18
+ export const CenterContainer = styled(Box)(({ theme }) => ({
19
19
  display: 'grid',
20
20
  placeItems: 'center',
21
21
  position: 'relative',
@@ -5,6 +5,7 @@ import { useCallback, useRef, useState } from 'react';
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useLocation } from 'react-router-dom';
8
+ import { ContractComponent } from '../../components/ContractComponent';
8
9
  import { GasMessage } from '../../components/GasMessage';
9
10
  import { Insurance } from '../../components/Insurance';
10
11
  import { getStepList } from '../../components/Step';
@@ -40,7 +41,7 @@ export const SwapPage = () => {
40
41
  const handleSwapClick = async () => {
41
42
  if (status === RouteExecutionStatus.Idle) {
42
43
  const thresholdExceeded = getTokenValueLossThreshold(route);
43
- if (thresholdExceeded) {
44
+ if (thresholdExceeded && variant !== 'nft') {
44
45
  tokenValueBottomSheetRef.current?.open();
45
46
  }
46
47
  else {
@@ -58,9 +59,14 @@ export const SwapPage = () => {
58
59
  const getSwapButtonText = () => {
59
60
  switch (status) {
60
61
  case RouteExecutionStatus.Idle:
61
- return variant !== 'refuel'
62
- ? t(`button.startSwap`)
63
- : t(`button.startGasSwap`);
62
+ switch (variant) {
63
+ case 'nft':
64
+ return t('button.buyNow');
65
+ case 'refuel':
66
+ return t('button.startGasSwap');
67
+ default:
68
+ return t('button.startSwap');
69
+ }
64
70
  case RouteExecutionStatus.Failed:
65
71
  return t('button.tryAgain');
66
72
  default:
@@ -78,9 +84,9 @@ export const SwapPage = () => {
78
84
  const insuranceCoverageId = route?.steps[0].execution?.process
79
85
  .filter((process) => process.type !== 'TOKEN_ALLOWANCE')
80
86
  .find((process) => process.txHash)?.txHash ?? route?.fromAddress;
81
- return (_jsxs(Container, { children: [getStepList(route), insuranceAvailable ? (_jsx(Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route?.insurance.feeAmountUsd, insuranceCoverageId: insuranceCoverageId, onChange: setRouteId })) : null, status === RouteExecutionStatus.Idle ||
87
+ return (_jsxs(Container, { children: [getStepList(route), variant === 'nft' ? _jsx(ContractComponent, { mt: 2 }) : null, insuranceAvailable ? (_jsx(Insurance, { mt: 2, status: status, insurableRouteId: stateRouteId, feeAmountUsd: route?.insurance.feeAmountUsd, insuranceCoverageId: insuranceCoverageId, onChange: setRouteId })) : null, status === RouteExecutionStatus.Idle ||
82
88
  status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasMessage, { mt: 2, route: route }), _jsxs(Box, { mt: 2, display: "flex", children: [_jsx(SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, route: route, insurableRouteId: stateRouteId }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
83
89
  minWidth: 48,
84
90
  marginLeft: 1,
85
- }, children: _jsx(DeleteIcon, {}) }) })) : null] })] })) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null, route ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (_jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
91
+ }, children: _jsx(DeleteIcon, {}) }) })) : null] })] })) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null, route && variant !== 'nft' ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (_jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
86
92
  };
@@ -6,7 +6,7 @@ import { forwardRef, useRef } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { BottomSheet } from '../../components/BottomSheet';
8
8
  import { useSetContentHeight } from '../../hooks';
9
- import { IconCircle, IconContainer } from './StatusBottomSheet.style';
9
+ import { CenterContainer, IconCircle } from './StatusBottomSheet.style';
10
10
  export const TokenValueBottomSheet = forwardRef(({ route, onContinue, onCancel }, ref) => {
11
11
  const handleCancel = () => {
12
12
  ref.current?.close();
@@ -18,7 +18,7 @@ const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
18
18
  const { t } = useTranslation();
19
19
  const ref = useRef();
20
20
  useSetContentHeight(ref);
21
- return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.highValueLoss') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.highValueLoss') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.swapping') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.gasCost') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.receiving') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.valueLoss') }), _jsxs(Typography, { fontWeight: 600, children: [Big(route.toAmountUSD || 0)
21
+ return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(CenterContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningRoundedIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.highValueLoss') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.highValueLoss') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.swapping') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.gasCost') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.receiving') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.valueLoss') }), _jsxs(Typography, { fontWeight: 600, children: [Big(route.toAmountUSD || 0)
22
22
  .div(Big(route.fromAmountUSD || 0).plus(Big(route.gasCostUSD || 0)))
23
23
  .minus(1)
24
24
  .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 { Token } from '@lifi/sdk';
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: Token): Promise<void>;
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>;