@rango-dev/widget-embedded 0.20.1-next.2 → 0.20.1-next.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 (227) hide show
  1. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +169 -1
  2. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  3. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +4 -0
  4. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +514 -1088
  6. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  8. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +12 -0
  9. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  10. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
  11. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
  12. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
  13. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
  14. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
  15. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
  16. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +179 -0
  17. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  18. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +0 -2
  19. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  20. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/RefreshButton.d.ts +6 -0
  22. package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -0
  23. package/dist/components/Layout/Layout.d.ts +2 -3
  24. package/dist/components/Layout/Layout.d.ts.map +1 -1
  25. package/dist/components/Layout/Layout.helpers.d.ts +2 -0
  26. package/dist/components/Layout/Layout.helpers.d.ts.map +1 -0
  27. package/dist/components/Layout/Layout.styles.d.ts +14 -4
  28. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  29. package/dist/components/Layout/Layout.types.d.ts +6 -3
  30. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  31. package/dist/components/Layout/PageContainer.d.ts +166 -0
  32. package/dist/components/Layout/PageContainer.d.ts.map +1 -0
  33. package/dist/components/Layout/ScrollableArea.d.ts +164 -0
  34. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -0
  35. package/dist/components/Layout/index.d.ts +2 -0
  36. package/dist/components/Layout/index.d.ts.map +1 -1
  37. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +4 -0
  38. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  39. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +56 -0
  40. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  41. package/dist/components/NoResult/NoResult.styles.d.ts +12 -0
  42. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  43. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  44. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +16 -0
  45. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  46. package/dist/components/Quote/Quote.d.ts.map +1 -1
  47. package/dist/components/Quote/Quote.styles.d.ts +386 -2
  48. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  49. package/dist/components/Quote/Quote.types.d.ts +19 -0
  50. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  51. package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
  52. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
  53. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
  54. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
  55. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
  56. package/dist/components/Quote/QuoteSummary.styles.d.ts +8 -0
  57. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  58. package/dist/components/Quote/QuoteTrigger .d.ts +4 -0
  59. package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -0
  60. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +16 -0
  61. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  62. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +40 -0
  63. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  64. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +20 -0
  65. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  66. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +16 -0
  67. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  68. package/dist/components/SearchInput/SearchInput.styles.d.ts +4 -0
  69. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  70. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +11 -156
  71. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  72. package/dist/components/SettingsContainer/index.d.ts +1 -1
  73. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  74. package/dist/components/Slippage/Slippage.styles.d.ts +20 -0
  75. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  76. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  77. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  78. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  79. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  80. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +523 -1
  81. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  82. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
  83. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +4 -0
  84. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  85. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  86. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  87. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +4 -0
  88. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  89. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  90. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +20 -0
  91. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  92. package/dist/components/TokenList/TokenList.styles.d.ts +68 -0
  93. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  94. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +16 -0
  95. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  96. package/dist/components/WidgetEvents.d.ts.map +1 -1
  97. package/dist/constants/index.d.ts +1 -0
  98. package/dist/constants/index.d.ts.map +1 -1
  99. package/dist/constants/quote.d.ts +12 -0
  100. package/dist/constants/quote.d.ts.map +1 -0
  101. package/dist/containers/App/App.d.ts.map +1 -1
  102. package/dist/containers/App/App.styles.d.ts +4 -0
  103. package/dist/containers/App/App.styles.d.ts.map +1 -1
  104. package/dist/containers/QuoteInfo/QuoteInfo.d.ts +1 -1
  105. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  106. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +10 -314
  107. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  108. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +0 -7
  109. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  110. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  111. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -1
  112. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +5 -0
  113. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -1
  114. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  115. package/dist/hooks/useLanguage.d.ts +2 -1
  116. package/dist/hooks/useLanguage.d.ts.map +1 -1
  117. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  118. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  119. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  120. package/dist/index.d.ts +6 -6
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +2 -1
  123. package/dist/index.js.map +4 -4
  124. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  125. package/dist/pages/HistoryPage.d.ts.map +1 -1
  126. package/dist/pages/Home.d.ts.map +1 -1
  127. package/dist/pages/LanguagePage.d.ts.map +1 -1
  128. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  129. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  130. package/dist/pages/SettingsPage.d.ts.map +1 -1
  131. package/dist/pages/ThemePage.d.ts.map +1 -1
  132. package/dist/pages/WalletsPage.d.ts.map +1 -1
  133. package/dist/store/AppStore.d.ts +2 -2
  134. package/dist/store/app.d.ts +2 -2
  135. package/dist/store/slices/data.d.ts.map +1 -1
  136. package/dist/store/slices/settings.d.ts +2 -2
  137. package/dist/store/slices/settings.d.ts.map +1 -1
  138. package/dist/types/config.d.ts +16 -3
  139. package/dist/types/config.d.ts.map +1 -1
  140. package/dist/types/notification.d.ts +1 -2
  141. package/dist/types/notification.d.ts.map +1 -1
  142. package/dist/utils/configs.d.ts +8 -0
  143. package/dist/utils/configs.d.ts.map +1 -1
  144. package/dist/utils/date.d.ts.map +1 -1
  145. package/dist/utils/quote.d.ts +5 -1
  146. package/dist/utils/quote.d.ts.map +1 -1
  147. package/dist/utils/settings.d.ts +1 -1
  148. package/dist/utils/swap.d.ts +5 -1
  149. package/dist/utils/swap.d.ts.map +1 -1
  150. package/dist/utils/ui.d.ts +2 -0
  151. package/dist/utils/ui.d.ts.map +1 -1
  152. package/package.json +6 -6
  153. package/src/components/BlockchainList/BlockchainList.styles.ts +4 -3
  154. package/src/components/BlockchainList/BlockchainList.tsx +1 -1
  155. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
  156. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +25 -40
  157. package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
  158. package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
  159. package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
  160. package/src/components/HeaderButtons/HeaderButtons.styles.ts +16 -1
  161. package/src/components/HeaderButtons/HeaderButtons.types.ts +0 -2
  162. package/src/components/HeaderButtons/HomeButtons.tsx +19 -33
  163. package/src/components/HeaderButtons/RefreshButton.tsx +81 -0
  164. package/src/components/Layout/Layout.helpers.ts +16 -0
  165. package/src/components/Layout/Layout.styles.ts +17 -31
  166. package/src/components/Layout/Layout.tsx +23 -21
  167. package/src/components/Layout/Layout.types.ts +9 -8
  168. package/src/components/Layout/PageContainer.tsx +24 -0
  169. package/src/components/Layout/ScrollableArea.tsx +11 -0
  170. package/src/components/Layout/index.ts +2 -0
  171. package/src/components/NotificationContent/NotificationContent.tsx +10 -1
  172. package/src/components/Quote/Quote.styles.ts +44 -5
  173. package/src/components/Quote/Quote.tsx +10 -77
  174. package/src/components/Quote/Quote.types.ts +22 -0
  175. package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
  176. package/src/components/Quote/QuoteCostDetails.tsx +218 -0
  177. package/src/components/Quote/QuoteSummary.tsx +3 -2
  178. package/src/components/Quote/QuoteTrigger .tsx +215 -0
  179. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +0 -1
  180. package/src/components/SettingsContainer/SettingsContainer.style.ts +0 -5
  181. package/src/components/SettingsContainer/index.ts +0 -1
  182. package/src/components/Slippage/Slippage.tsx +5 -5
  183. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  184. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +12 -13
  185. package/src/components/SwapDetails/SwapDetails.helpers.tsx +43 -3
  186. package/src/components/SwapDetails/SwapDetails.styles.ts +18 -6
  187. package/src/components/SwapDetails/SwapDetails.tsx +13 -5
  188. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +13 -7
  189. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +2 -0
  190. package/src/components/SwapsGroup/SwapsGroup.tsx +18 -7
  191. package/src/components/TokenList/TokenList.styles.ts +2 -0
  192. package/src/components/TokenList/TokenList.tsx +1 -1
  193. package/src/components/WidgetEvents.tsx +2 -14
  194. package/src/constants/index.ts +1 -0
  195. package/src/constants/quote.ts +23 -0
  196. package/src/containers/App/App.styles.ts +2 -0
  197. package/src/containers/App/App.tsx +1 -4
  198. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +0 -15
  199. package/src/containers/QuoteInfo/QuoteInfo.tsx +30 -77
  200. package/src/containers/QuoteInfo/QuoteInfo.types.ts +0 -7
  201. package/src/containers/Wallets/Wallets.tsx +11 -2
  202. package/src/containers/WidgetInfo/WidgetInfo.tsx +8 -0
  203. package/src/containers/WidgetInfo/WidgetInfo.types.ts +5 -0
  204. package/src/containers/WidgetProvider/WidgetProvider.tsx +2 -1
  205. package/src/hooks/useLanguage.ts +6 -4
  206. package/src/hooks/useSwapInput.ts +6 -2
  207. package/src/hooks/useSyncStoresWithConfig.ts +17 -34
  208. package/src/index.ts +4 -2
  209. package/src/pages/ConfirmSwapPage.tsx +59 -50
  210. package/src/pages/HistoryPage.tsx +4 -11
  211. package/src/pages/Home.tsx +40 -38
  212. package/src/pages/LanguagePage.tsx +3 -4
  213. package/src/pages/LiquiditySourcePage.tsx +8 -6
  214. package/src/pages/SelectBlockchainPage.tsx +41 -41
  215. package/src/pages/SelectSwapItemsPage.tsx +45 -39
  216. package/src/pages/SettingsPage.tsx +3 -4
  217. package/src/pages/ThemePage.tsx +3 -4
  218. package/src/pages/WalletsPage.tsx +12 -13
  219. package/src/store/slices/data.ts +5 -7
  220. package/src/store/slices/settings.ts +3 -3
  221. package/src/types/config.ts +16 -3
  222. package/src/types/notification.ts +0 -7
  223. package/src/utils/configs.ts +41 -0
  224. package/src/utils/date.ts +5 -4
  225. package/src/utils/quote.ts +18 -1
  226. package/src/utils/swap.ts +35 -0
  227. package/src/utils/ui.ts +20 -0
@@ -0,0 +1,215 @@
1
+ import type { QuoteTriggerImagesProps, QuoteTriggerProps } from './Quote.types';
2
+
3
+ import { i18n } from '@lingui/core';
4
+ import {
5
+ ChevronDownIcon,
6
+ ChevronRightIcon,
7
+ Divider,
8
+ Image,
9
+ Tooltip,
10
+ Typography,
11
+ } from '@rango-dev/ui';
12
+ import React, { useEffect, useState } from 'react';
13
+
14
+ import { getContainer } from '../../utils/common';
15
+ import { getUniqueBlockchains } from '../../utils/quote';
16
+
17
+ import {
18
+ IconContainer,
19
+ ImageContainer,
20
+ MoreStep,
21
+ rowStyles,
22
+ Trigger,
23
+ } from './Quote.styles';
24
+
25
+ const MAX_STEPS = 4;
26
+ const MAX_BLOCKCHAINS = 6;
27
+ const MIN_WIDTH_WINDOW = 375;
28
+
29
+ const ImageComponent = (props: QuoteTriggerImagesProps) => {
30
+ const tooltipContainer = getContainer();
31
+ const { content, src, className, open, state } = props;
32
+ return (
33
+ <Tooltip
34
+ container={tooltipContainer}
35
+ side="bottom"
36
+ sideOffset={4}
37
+ open={open}
38
+ content={content}>
39
+ <ImageContainer className={className} state={state}>
40
+ <Image src={src} size={16} />
41
+ </ImageContainer>
42
+ </Tooltip>
43
+ );
44
+ };
45
+
46
+ export function QuoteTrigger(props: QuoteTriggerProps) {
47
+ const { quoteRef, recommended, setExpanded, steps, expanded } = props;
48
+ const tooltipContainer = getContainer();
49
+ const numberOfSteps = steps.length;
50
+ const blockchains = getUniqueBlockchains(steps);
51
+ const [isMobile, setIsMobile] = useState(false);
52
+
53
+ //choose the screen size
54
+ const handleResize = () => {
55
+ if (window.innerWidth < MIN_WIDTH_WINDOW) {
56
+ setIsMobile(true);
57
+ } else {
58
+ setIsMobile(false);
59
+ }
60
+ };
61
+
62
+ useEffect(() => {
63
+ window.addEventListener('resize', handleResize);
64
+ });
65
+
66
+ return (
67
+ <Trigger
68
+ ref={(ref) => (quoteRef.current = ref)}
69
+ recommended={recommended}
70
+ onClick={() => setExpanded((prevState) => !prevState)}>
71
+ <div className={rowStyles()}>
72
+ <Typography variant="body" size="xsmall">
73
+ {i18n.t('Via:')}
74
+ </Typography>
75
+ <Divider direction="horizontal" size={4} />
76
+ {steps.map((step, index) => {
77
+ const key = `item-${index}`;
78
+ const arrow = (
79
+ <IconContainer>
80
+ <ChevronRightIcon size={12} color="black" />
81
+ </IconContainer>
82
+ );
83
+
84
+ return isMobile ? (
85
+ <>
86
+ <ImageComponent
87
+ content={step.swapper.displayName}
88
+ src={step.swapper.image}
89
+ state={step.state}
90
+ />
91
+ {index !== numberOfSteps - 1 && <>{arrow}</>}
92
+ </>
93
+ ) : (
94
+ <React.Fragment key={key}>
95
+ {numberOfSteps <= MAX_STEPS ||
96
+ (numberOfSteps > MAX_STEPS && index < MAX_STEPS - 1) ? (
97
+ <>
98
+ <ImageComponent
99
+ content={step.swapper.displayName}
100
+ src={step.swapper.image}
101
+ state={step.state}
102
+ />
103
+ {index !== numberOfSteps - 1 && <>{arrow}</>}
104
+ </>
105
+ ) : (
106
+ index === MAX_STEPS - 1 && (
107
+ <Tooltip
108
+ container={tooltipContainer}
109
+ side="bottom"
110
+ align="right"
111
+ sideOffset={4}
112
+ content={
113
+ <div className={rowStyles()}>
114
+ {arrow}
115
+ {steps.map((step, i) => {
116
+ const key = `image-${i}`;
117
+ return (
118
+ i >= index && (
119
+ <React.Fragment key={key}>
120
+ <ImageComponent
121
+ content={step.swapper.displayName}
122
+ src={step.swapper.image}
123
+ state={step.state}
124
+ open={false}
125
+ />
126
+ {i !== numberOfSteps - 1 && <>{arrow}</>}
127
+ </React.Fragment>
128
+ )
129
+ );
130
+ })}
131
+ </div>
132
+ }>
133
+ <MoreStep
134
+ state={
135
+ steps.find(
136
+ (step, i) =>
137
+ i >= index &&
138
+ (step.state === 'error' || step.state === 'warning')
139
+ )?.state
140
+ }>
141
+ <Typography size="xsmall" variant="body">
142
+ +{numberOfSteps - index}
143
+ </Typography>
144
+ </MoreStep>
145
+ </Tooltip>
146
+ )
147
+ )}
148
+ </React.Fragment>
149
+ );
150
+ })}
151
+ </div>
152
+ <div className={rowStyles()}>
153
+ <div className="blockchains_section">
154
+ <div className={rowStyles()}>
155
+ <Typography variant="body" size="xsmall">
156
+ {i18n.t('Chains:')}
157
+ </Typography>
158
+ <Divider direction="horizontal" size={4} />
159
+ {blockchains.map((blockchain, index) => (
160
+ <>
161
+ {blockchains.length <= MAX_BLOCKCHAINS ||
162
+ (blockchains.length > MAX_BLOCKCHAINS &&
163
+ index < MAX_BLOCKCHAINS - 1) ? (
164
+ <ImageComponent
165
+ key={blockchain.displayName}
166
+ content={''}
167
+ src={blockchain.image}
168
+ open={false}
169
+ className={index !== 0 ? 'blockchainImage' : ''}
170
+ />
171
+ ) : (
172
+ index === MAX_BLOCKCHAINS - 1 && (
173
+ <Tooltip
174
+ container={tooltipContainer}
175
+ side="bottom"
176
+ align="right"
177
+ sideOffset={4}
178
+ content={
179
+ <div className={rowStyles()}>
180
+ {blockchains.map(
181
+ (chain, i) =>
182
+ i >= index && (
183
+ <ImageComponent
184
+ key={chain.displayName}
185
+ content={''}
186
+ src={chain.image}
187
+ open={false}
188
+ className={i > index ? 'blockchainImage' : ''}
189
+ />
190
+ )
191
+ )}
192
+ </div>
193
+ }>
194
+ <MoreStep className={'blockchainImage'}>
195
+ <Typography size="xsmall" variant="body">
196
+ +{blockchains.length - index}
197
+ </Typography>
198
+ </MoreStep>
199
+ </Tooltip>
200
+ )
201
+ )}
202
+ </>
203
+ ))}
204
+
205
+ <Divider direction="horizontal" size={32} />
206
+ </div>
207
+ </div>
208
+
209
+ <IconContainer orientation={expanded ? 'up' : 'down'}>
210
+ <ChevronDownIcon size={12} color="black" />
211
+ </IconContainer>
212
+ </div>
213
+ </Trigger>
214
+ );
215
+ }
@@ -2,7 +2,6 @@ import { darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Alerts = styled('div', {
4
4
  width: '100%',
5
- paddingTop: '$10',
6
5
  });
7
6
 
8
7
  export const Flex = styled('div', {
@@ -1,10 +1,5 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
- export const SettingsContainer = styled('div', {
4
- height: '100%',
5
- overflow: 'hidden',
6
- });
7
-
8
3
  export const LiquiditySourceList = styled('ul', {
9
4
  padding: '$15 $5 0',
10
5
  margin: 0,
@@ -1,5 +1,4 @@
1
1
  export {
2
- SettingsContainer,
3
2
  LiquiditySourceList,
4
3
  LiquiditySourceSuffix,
5
4
  NotFoundContainer,
@@ -72,12 +72,12 @@ export function Slippage() {
72
72
  value={customSlippage || ''}
73
73
  color="dark"
74
74
  onChange={(event) => {
75
- const parsedValue = parseFloat(event.target.value);
76
- if (
77
- !parsedValue ||
78
- (parsedValue >= MIN_SLIPPGAE && parsedValue <= MAX_SLIPPAGE)
79
- ) {
75
+ const value = event.target.value;
76
+ const parsedValue = parseFloat(value);
77
+ if (parsedValue >= MIN_SLIPPGAE && parsedValue <= MAX_SLIPPAGE) {
80
78
  setCustomSlippage(parsedValue);
79
+ } else {
80
+ setCustomSlippage(null);
81
81
  }
82
82
  }}
83
83
  suffix={
@@ -15,7 +15,7 @@ export function SlippageTooltipContent() {
15
15
  <br />
16
16
  <b>{i18n.t('Warning')}</b>:
17
17
  {i18n.t(
18
- 'This setting is applied per step, e.g. 1Inch, Thorchain, etc. and only that step will be reverted, not the whole transaction'
18
+ 'This setting is applied per step (e.g. 1Inch, Thorchain, etc) which means only the step will be reverted, not the whole transaction.'
19
19
  )}
20
20
  </Typography>
21
21
  </SlippageTooltipContainer>
@@ -1,13 +1,7 @@
1
1
  import type { SwapDetailsPlaceholderPropTypes } from './SwapDetails.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
- import {
5
- CopyIcon,
6
- IconButton,
7
- NotFound,
8
- Skeleton,
9
- Typography,
10
- } from '@rango-dev/ui';
4
+ import { Divider, NotFound, Skeleton, Typography } from '@rango-dev/ui';
11
5
  import React from 'react';
12
6
 
13
7
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
@@ -16,6 +10,7 @@ import { LoadingSwapDetails } from '../LoadingSwapDetails';
16
10
 
17
11
  import {
18
12
  Container,
13
+ datePlaceholderStyles,
19
14
  HeaderDetails,
20
15
  PlaceholderContainer,
21
16
  requestIdStyles,
@@ -26,7 +21,6 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
26
21
  const { requestId, showSkeleton } = props;
27
22
  return (
28
23
  <Layout
29
- noPadding
30
24
  header={{
31
25
  title: i18n.t('Swap and Bridge'),
32
26
  suffix: <SuffixContainer />,
@@ -42,14 +36,19 @@ export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
42
36
  <Typography variant="label" size="small" color="neutral700">
43
37
  <Skeleton width={60} height={10} variant="rounded" />
44
38
  </Typography>
45
- <IconButton variant="ghost">
46
- <CopyIcon size={16} color="gray" />
47
- </IconButton>
39
+ <Divider direction="horizontal" size={4} />
40
+ <Skeleton width={16} height={16} variant="rectangular" />
41
+ <Divider direction="horizontal" size={4} />
42
+ <Skeleton width={16} height={16} variant="rectangular" />
48
43
  </div>
49
44
  </div>
50
45
  <div className={rowStyles()}>
51
- <Typography variant="label" size="large" color="neutral700">
52
- {`${i18n.t('Created at')}:`}
46
+ <Typography
47
+ className={datePlaceholderStyles()}
48
+ variant="label"
49
+ size="large"
50
+ color="neutral700">
51
+ <Skeleton width={60} height={10} variant="rounded" />
53
52
  </Typography>
54
53
  <Typography variant="label" size="small" color="neutral700">
55
54
  <Skeleton width={60} height={10} variant="rounded" />
@@ -8,7 +8,10 @@ import {
8
8
  TOKEN_AMOUNT_MAX_DECIMALS,
9
9
  TOKEN_AMOUNT_MIN_DECIMALS,
10
10
  } from '../../constants/routing';
11
- import { getBlockchainShortNameFor } from '../../utils/meta';
11
+ import {
12
+ getBlockchainShortNameFor,
13
+ getSwapperDisplayName,
14
+ } from '../../utils/meta';
12
15
  import { numberToString } from '../../utils/numbers';
13
16
  import { isNetworkStatusInWarningState } from '../../utils/swap';
14
17
  import { SwapDetailsAlerts } from '../SwapDetailsAlerts';
@@ -16,7 +19,12 @@ import { SwapDetailsAlerts } from '../SwapDetailsAlerts';
16
19
  export const RESET_INTERVAL = 2_000;
17
20
  export const SECONDS = 60;
18
21
 
19
- export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
22
+ export const getSteps = ({
23
+ swap,
24
+ blockchains,
25
+ swappers,
26
+ ...args
27
+ }: GetStep): Step[] => {
20
28
  const hasAlreadyProceededToSign = swap.hasAlreadyProceededToSign !== false;
21
29
  return swap.steps.map((step, index) => {
22
30
  const amountToConvert =
@@ -58,7 +66,39 @@ export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
58
66
  step.outputAmount || step.expectedOutputAmountHumanReadable,
59
67
  },
60
68
  },
61
- swapper: { displayName: step.swapperId, image: step.swapperLogo ?? '' },
69
+ swapper: {
70
+ displayName: getSwapperDisplayName(step.swapperId, swappers),
71
+ image: step.swapperLogo ?? '',
72
+ type: step.swapperType,
73
+ },
74
+ internalSwaps: step.internalSwaps
75
+ ? step.internalSwaps.map((internalSwap) => {
76
+ return {
77
+ from: {
78
+ blockchain:
79
+ getBlockchainShortNameFor(
80
+ internalSwap.fromBlockchain,
81
+ blockchains
82
+ ) ?? '',
83
+ },
84
+ to: {
85
+ blockchain:
86
+ getBlockchainShortNameFor(
87
+ internalSwap.toBlockchain,
88
+ blockchains
89
+ ) ?? '',
90
+ },
91
+ swapper: {
92
+ displayName: getSwapperDisplayName(
93
+ internalSwap.swapperId,
94
+ swappers
95
+ ),
96
+ image: internalSwap.swapperLogo ?? '',
97
+ type: internalSwap.swapperType,
98
+ },
99
+ };
100
+ })
101
+ : [],
62
102
  alerts: (
63
103
  <SwapDetailsAlerts
64
104
  step={step}
@@ -1,23 +1,22 @@
1
1
  import { css, darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
+ import { ScrollableArea } from '../Layout';
4
+
3
5
  export const Container = styled('div', {
4
6
  display: 'flex',
5
- width: '100%',
6
7
  flexDirection: 'column',
7
- alignItems: 'center',
8
- height: '0',
9
8
  flexGrow: 1,
9
+ overflow: 'hidden',
10
10
  });
11
11
 
12
12
  export const HeaderDetails = styled('div', {
13
13
  width: '100%',
14
14
  });
15
15
 
16
- export const StepsList = styled('div', {
16
+ export const StepsList = styled(ScrollableArea, {
17
17
  padding: '$0 $20 $20 $20',
18
- width: '100%',
19
- overflow: 'auto',
20
18
  });
19
+
21
20
  export const Alerts = styled('div', {
22
21
  display: 'flex',
23
22
  flexDirection: 'column',
@@ -54,6 +53,10 @@ export const rowStyles = css({
54
53
  color: '$neutral500',
55
54
  });
56
55
 
56
+ export const datePlaceholderStyles = css({
57
+ padding: '$5 0',
58
+ });
59
+
57
60
  export const requestIdStyles = css({
58
61
  display: 'flex',
59
62
  justifyContent: 'center',
@@ -73,3 +76,12 @@ export const titleStepsStyles = css({
73
76
  width: '100%',
74
77
  padding: '0 $20 $10',
75
78
  });
79
+
80
+ export const StyledLink = styled('a', {
81
+ fontSize: '$16',
82
+ fontWeight: '$400',
83
+ color: '$neutral700',
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ justifyContent: 'center',
87
+ });
@@ -12,6 +12,7 @@ import {
12
12
  CopyIcon,
13
13
  Divider,
14
14
  IconButton,
15
+ LinkIcon,
15
16
  QuoteCost,
16
17
  StepDetails,
17
18
  Typography,
@@ -23,6 +24,7 @@ import { PendingSwapNetworkStatus } from 'rango-types';
23
24
  import React, { useEffect, useRef, useState } from 'react';
24
25
  import { useNavigate } from 'react-router-dom';
25
26
 
27
+ import { SCANNER_BASE_URL } from '../../constants';
26
28
  import {
27
29
  GAS_FEE_MAX_DECIMALS,
28
30
  GAS_FEE_MIN_DECIMALS,
@@ -52,7 +54,7 @@ import {
52
54
  import { getSwapDate } from '../../utils/time';
53
55
  import { getConciseAddress } from '../../utils/wallets';
54
56
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
55
- import { Layout } from '../Layout';
57
+ import { Layout, PageContainer } from '../Layout';
56
58
  import { QuoteSummary } from '../Quote';
57
59
  import {
58
60
  SwapDetailsCompleteModal,
@@ -61,12 +63,12 @@ import {
61
63
 
62
64
  import { getSteps, getStepState, RESET_INTERVAL } from './SwapDetails.helpers';
63
65
  import {
64
- Container,
65
66
  HeaderDetails,
66
67
  outputStyles,
67
68
  requestIdStyles,
68
69
  rowStyles,
69
70
  StepsList,
71
+ StyledLink,
70
72
  titleStepsStyles,
71
73
  } from './SwapDetails.styles';
72
74
 
@@ -74,6 +76,7 @@ export function SwapDetails(props: SwapDetailsProps) {
74
76
  const { swap, requestId, onDelete, onCancel: onCancelProps } = props;
75
77
  const { canSwitchNetworkTo, connect, getWalletInfo } = useWallets();
76
78
  const blockchains = useAppStore().blockchains();
79
+ const swappers = useAppStore().swappers();
77
80
  const tokens = useAppStore().tokens();
78
81
  const retry = useQuoteStore.use.retry();
79
82
  const navigate = useNavigate();
@@ -158,6 +161,7 @@ export function SwapDetails(props: SwapDetailsProps) {
158
161
  setNetworkModal: setModalState,
159
162
  message: stepMessage,
160
163
  blockchains: blockchains,
164
+ swappers: swappers,
161
165
  });
162
166
  const numberOfSteps = steps.length;
163
167
  const [firstStep, lastStep] = [swap.steps[0], swap.steps[numberOfSteps - 1]];
@@ -236,7 +240,6 @@ export function SwapDetails(props: SwapDetailsProps) {
236
240
 
237
241
  return (
238
242
  <Layout
239
- noPadding
240
243
  header={{
241
244
  title: i18n.t('Swap and Bridge'),
242
245
  onCancel:
@@ -274,7 +277,7 @@ export function SwapDetails(props: SwapDetailsProps) {
274
277
  </Button>
275
278
  )
276
279
  }>
277
- <Container>
280
+ <PageContainer compact view>
278
281
  <HeaderDetails>
279
282
  <div className={rowStyles()}>
280
283
  <Typography variant="label" size="large" color="neutral700">
@@ -289,6 +292,11 @@ export function SwapDetails(props: SwapDetailsProps) {
289
292
  onClick={handleCopy.bind(null, requestId || '')}>
290
293
  <CopyIcon size={16} color="gray" />
291
294
  </IconButton>
295
+ <StyledLink
296
+ target="_blank"
297
+ href={`${SCANNER_BASE_URL}/swap/${requestId}`}>
298
+ <LinkIcon size={16} />
299
+ </StyledLink>
292
300
  </div>
293
301
  </div>
294
302
  <div className={rowStyles()}>
@@ -390,7 +398,7 @@ export function SwapDetails(props: SwapDetailsProps) {
390
398
  );
391
399
  })}
392
400
  </StepsList>
393
- </Container>
401
+ </PageContainer>
394
402
 
395
403
  <SwapDetailsModal
396
404
  state={modalState}
@@ -24,18 +24,27 @@ export function SwapDetailsAlerts(props: SwapAlertsProps) {
24
24
  const waitingForApproval =
25
25
  step.status === 'waitingForApproval' && !hasWarning;
26
26
  const inProgress = step.status === 'running' && !hasWarning;
27
+ const waitingProgress =
28
+ (inProgress && !hasAlreadyProceededToSign) ||
29
+ (waitingForApproval && !step.explorerUrl?.length);
30
+
27
31
  return (
28
32
  <Alerts>
29
33
  {step.explorerUrl?.map((explorerUrl, index, urls) => {
30
34
  const key = index + explorerUrl.url;
31
35
  const lastUrl = index === urls.length - 1;
32
- const loading = (lastUrl && inProgress) || waitingForApproval;
36
+ const loading =
37
+ ((lastUrl && inProgress) || waitingForApproval) && !waitingProgress;
33
38
  const error = lastUrl && step.status === 'failed';
34
39
 
35
40
  return (
36
41
  <Fragment key={key}>
37
42
  <Alert
38
- type={(loading && 'loading') || (error && 'error') || 'success'}
43
+ type={
44
+ lastUrl
45
+ ? (loading && 'loading') || (error && 'error') || 'success'
46
+ : 'success'
47
+ }
39
48
  title={
40
49
  !explorerUrl.description
41
50
  ? i18n.t('View transaction')
@@ -47,7 +56,7 @@ export function SwapDetailsAlerts(props: SwapAlertsProps) {
47
56
  variant="ghost"
48
57
  size="xsmall"
49
58
  onClick={() => window.open(explorerUrl.url, '_blank')}>
50
- <LinkIcon size={16} />
59
+ <LinkIcon size={12} />
51
60
  </IconButton>
52
61
  )
53
62
  }
@@ -55,10 +64,7 @@ export function SwapDetailsAlerts(props: SwapAlertsProps) {
55
64
  </Fragment>
56
65
  );
57
66
  })}
58
- {((inProgress && !hasAlreadyProceededToSign) ||
59
- (waitingForApproval && !step.explorerUrl?.length)) && (
60
- <Alert type="loading" title={message.shortMessage} />
61
- )}
67
+ {waitingProgress && <Alert type="loading" title={message.shortMessage} />}
62
68
  {step.status !== 'failed' && hasWarning && (
63
69
  <WarningAlert
64
70
  switchNetwork={switchNetwork}
@@ -6,6 +6,7 @@ import type {
6
6
  PendingSwap,
7
7
  PendingSwapNetworkStatus,
8
8
  PendingSwapStep,
9
+ SwapperMeta,
9
10
  } from 'rango-types';
10
11
 
11
12
  export interface SwapAlertsProps extends WaningAlertsProps {
@@ -26,4 +27,5 @@ export interface FailedAlertsProps {
26
27
  export type GetStep = {
27
28
  swap: PendingSwap;
28
29
  blockchains: BlockchainMeta[];
30
+ swappers: SwapperMeta[];
29
31
  } & Omit<SwapAlertsProps, 'step' | 'hasAlreadyProceededToSign'>;
@@ -4,6 +4,10 @@ import { i18n } from '@lingui/core';
4
4
  import { Divider, SwapListItem, Typography } from '@rango-dev/ui';
5
5
  import React from 'react';
6
6
 
7
+ import {
8
+ TOKEN_AMOUNT_MAX_DECIMALS,
9
+ TOKEN_AMOUNT_MIN_DECIMALS,
10
+ } from '../../constants/routing';
7
11
  import { getContainer } from '../../utils/common';
8
12
  import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
9
13
 
@@ -18,11 +22,11 @@ export function SwapsGroup(props: PropTypes) {
18
22
 
19
23
  const loadingGroups = [
20
24
  {
21
- title: 'Today',
25
+ title: i18n.t('Today'),
22
26
  swaps,
23
27
  },
24
28
  {
25
- title: 'This month',
29
+ title: i18n.t('This month'),
26
30
  swaps,
27
31
  },
28
32
  ];
@@ -36,7 +40,7 @@ export function SwapsGroup(props: PropTypes) {
36
40
  variant="label"
37
41
  size="medium"
38
42
  className={groupStyles()}>
39
- {i18n.t(group.title)}
43
+ {group.title}
40
44
  </Typography>
41
45
  </Time>
42
46
  <Divider size={4} />
@@ -69,7 +73,7 @@ export function SwapsGroup(props: PropTypes) {
69
73
  variant="label"
70
74
  size="medium"
71
75
  className={groupStyles()}>
72
- {i18n.t(group.title)}
76
+ {group.title}
73
77
  </Typography>
74
78
  </Time>
75
79
  <Divider size={4} />
@@ -85,8 +89,8 @@ export function SwapsGroup(props: PropTypes) {
85
89
  creationTime={swap.creationTime}
86
90
  status={swap.status}
87
91
  onClick={onSwapClick}
88
- onlyShowTime={group.title === 'Today'}
89
92
  tooltipContainer={getContainer()}
93
+ onlyShowTime={group.title === i18n.t('Today')}
90
94
  swapTokenData={{
91
95
  from: {
92
96
  token: {
@@ -96,7 +100,12 @@ export function SwapsGroup(props: PropTypes) {
96
100
  blockchain: {
97
101
  image: firstStep.fromBlockchainLogo || '',
98
102
  },
99
- amount: swap.inputAmount,
103
+ amount: numberToString(
104
+ swap.inputAmount,
105
+ TOKEN_AMOUNT_MIN_DECIMALS,
106
+ TOKEN_AMOUNT_MAX_DECIMALS
107
+ ),
108
+ realAmount: formatTooltipNumbers(swap.inputAmount),
100
109
  },
101
110
  to: {
102
111
  token: {
@@ -109,7 +118,9 @@ export function SwapsGroup(props: PropTypes) {
109
118
  amount: numberToString(
110
119
  lastStep.outputAmount ||
111
120
  lastStep.expectedOutputAmountHumanReadable ||
112
- ''
121
+ '',
122
+ TOKEN_AMOUNT_MIN_DECIMALS,
123
+ TOKEN_AMOUNT_MAX_DECIMALS
113
124
  ),
114
125
  realAmount: formatTooltipNumbers(
115
126
  lastStep.outputAmount ||