@rango-dev/widget-embedded 0.20.1-next.17 → 0.20.1-next.18

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 (35) hide show
  1. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +460 -1112
  2. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  3. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  4. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts +5 -0
  5. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -0
  6. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +654 -0
  7. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -0
  8. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts +10 -0
  9. package/dist/components/CustomCollapsible/CustomCollapsible.types.d.ts.map +1 -0
  10. package/dist/components/Quote/Quote.d.ts.map +1 -1
  11. package/dist/components/Quote/Quote.types.d.ts +4 -0
  12. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  13. package/dist/components/Quote/QuoteCostDetails.d.ts +4 -0
  14. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -0
  15. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +806 -0
  16. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -0
  17. package/dist/constants/quote.d.ts +12 -0
  18. package/dist/constants/quote.d.ts.map +1 -0
  19. package/dist/index.js +2 -1
  20. package/dist/index.js.map +4 -4
  21. package/dist/utils/swap.d.ts +5 -1
  22. package/dist/utils/swap.d.ts.map +1 -1
  23. package/package.json +2 -2
  24. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +27 -96
  25. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +24 -39
  26. package/src/components/CustomCollapsible/CustomCollapsible.styles.ts +75 -0
  27. package/src/components/CustomCollapsible/CustomCollapsible.tsx +55 -0
  28. package/src/components/CustomCollapsible/CustomCollapsible.types.ts +10 -0
  29. package/src/components/Quote/Quote.styles.ts +1 -1
  30. package/src/components/Quote/Quote.tsx +3 -19
  31. package/src/components/Quote/Quote.types.ts +5 -0
  32. package/src/components/Quote/QuoteCostDetails.styles.ts +50 -0
  33. package/src/components/Quote/QuoteCostDetails.tsx +218 -0
  34. package/src/constants/quote.ts +23 -0
  35. package/src/utils/swap.ts +35 -0
@@ -1,7 +1,8 @@
1
+ import type { FeesGroup } from '../constants/quote';
1
2
  import type { FetchStatus } from '../store/slices/data';
2
3
  import type { ConvertedToken, QuoteError, QuoteWarning, RecommendedSlippages, SwapButtonState, Wallet } from '../types';
3
4
  import type { WalletType } from '@rango-dev/wallets-shared';
4
- import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapResult, Token } from 'rango-sdk';
5
+ import type { BestRouteRequest, BestRouteResponse, BlockchainMeta, RecommendedSlippage, SwapFee, SwapResult, Token } from 'rango-sdk';
5
6
  import type { PendingSwap, PendingSwapStep } from 'rango-types';
6
7
  import BigNumber from 'bignumber.js';
7
8
  export declare function getOutputRatio(inputUsdValue: BigNumber | null, outputUsdValue: BigNumber | null): number;
@@ -27,6 +28,9 @@ export declare function requiredWallets(quote: BestRouteResponse | null): string
27
28
  export declare const getUsdPrice: (blockchain: string, symbol: string, address: string | null, allTokens: Token[]) => number | null;
28
29
  export declare function getUsdFeeOfStep(step: SwapResult, allTokens: Token[]): BigNumber;
29
30
  export declare function getTotalFeeInUsd(swaps: SwapResult[], allTokens: Token[]): BigNumber;
31
+ export declare function getUsdFee(fee: SwapFee): BigNumber;
32
+ export declare function getTotalFeesInUsd(fees: SwapFee[]): BigNumber;
33
+ export declare function getFeesGroup(swaps: SwapResult[]): FeesGroup;
30
34
  export declare function hasHighFee(totalFeeInUsd: BigNumber | null): boolean;
31
35
  export declare function hasSlippageError(slippages: (RecommendedSlippage | null)[] | undefined): boolean;
32
36
  export declare function checkSlippageErrors(quote: BestRouteResponse): RecommendedSlippages | null;
@@ -1 +1 @@
1
- {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../src/utils/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,MAAM,EACP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,SAAS,MAAM,cAAc,CAAC;AAoBrC,wBAAgB,cAAc,CAC5B,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,cAAc,EAAE,SAAS,GAAG,IAAI,UAejC;AAED,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,SAAS,GAAG,IAAI,EAC/B,WAAW,EAAE,MAAM,GAClB,OAAO,CAQT;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAgBtE;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG;IAC9D,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;CACxB,CAkFA;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,eAAe,EAAE,WAAW,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC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OAAO,CAMT;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;CACrD,CAyCA;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,WAAW,GACvB,cAAc,CAkBhB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,WAMvD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EACjB,qBAAqB,EAAE,OAAO,EAC9B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,eAAe,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACxD,oBAAoB,CAAC,EAAE,cAAc,uBActC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.20.1-next.17",
3
+ "version": "0.20.1-next.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,7 +25,7 @@
25
25
  "@rango-dev/queue-manager-core": "^0.25.0",
26
26
  "@rango-dev/queue-manager-rango-preset": "^0.25.1-next.1",
27
27
  "@rango-dev/queue-manager-react": "^0.24.0",
28
- "@rango-dev/ui": "^0.26.1-next.9",
28
+ "@rango-dev/ui": "^0.26.1-next.10",
29
29
  "@rango-dev/wallets-react": "^0.11.1-next.1",
30
30
  "@rango-dev/wallets-shared": "^0.25.1-next.1",
31
31
  "bignumber.js": "^9.1.1",
@@ -1,34 +1,12 @@
1
- import * as Collapsible from '@radix-ui/react-collapsible';
2
1
  import {
3
2
  Button,
4
3
  css,
5
4
  darkTheme,
6
5
  IconButton,
7
- keyframes,
8
6
  styled,
9
7
  TextField,
10
8
  } from '@rango-dev/ui';
11
9
 
12
- export const EXPANDABLE_TRANSITION_DURATION = 300;
13
-
14
- const slideDown = keyframes({
15
- from: {
16
- height: 0,
17
- },
18
- to: {
19
- height: 'var(--radix-collapsible-content-height)',
20
- },
21
- });
22
-
23
- const slideUp = keyframes({
24
- from: {
25
- height: 'var(--radix-collapsible-content-height)',
26
- },
27
- to: {
28
- height: 0,
29
- },
30
- });
31
-
32
10
  export const Title = styled('div', {
33
11
  display: 'flex',
34
12
  flexDirection: 'column',
@@ -93,16 +71,6 @@ export const ShowMoreWallets = styled(WalletButton, {
93
71
  alignSelf: 'stretch',
94
72
  minHeight: '93px',
95
73
  });
96
-
97
- export const Trigger = styled(Collapsible.Trigger, {
98
- padding: '$0',
99
- border: 'none',
100
- outline: 'none',
101
- width: '100%',
102
- backgroundColor: 'transparent',
103
- fontFamily: 'inherit',
104
- });
105
-
106
74
  export const ShowMoreHeader = styled('div', {
107
75
  padding: '$20',
108
76
  display: 'flex',
@@ -132,20 +100,36 @@ export const walletsListStyles = css({
132
100
  height: '100%',
133
101
  });
134
102
 
135
- export const CollapsibleRoot = styled(Collapsible.Root, {
136
- backgroundColor: '$neutral200',
137
- borderRadius: '$sm',
138
- variants: {
139
- selected: {
140
- true: {
141
- outlineWidth: 1,
142
- outlineColor: '$secondary500',
143
- outlineStyle: 'solid',
144
- },
145
- },
103
+ export const CustomDestination = styled('div', {
104
+ padding: '$10 $0',
105
+ '& .button__content': {
106
+ display: 'flex',
107
+ alignItems: 'center',
146
108
  },
109
+ '& .alarms': { paddingTop: '$5' },
110
+ '& .collapsible_content': {
111
+ backgroundColor: '$neutral100',
112
+ },
113
+ '& .collapsible_root': {
114
+ backgroundColor: '$neutral200',
115
+ },
116
+ });
117
+
118
+ export const alarmsStyles = css({
119
+ paddingTop: '$5',
120
+ });
121
+
122
+ export const ConfirmButton = styled('div', {
123
+ display: 'flex',
124
+ });
125
+
126
+ export const StyledTextField = styled(TextField, {
127
+ backgroundColor: '$neutral100',
128
+ padding: '$0 $15 $15 $15',
147
129
  });
148
130
 
131
+ export const Wallets = styled('div', { overflow: 'visible', width: '100%' });
132
+
149
133
  export const CustomDestinationButton = styled(Button, {
150
134
  width: '100%',
151
135
  borderRadius: '$sm !important',
@@ -174,56 +158,3 @@ export const CustomDestinationButton = styled(Button, {
174
158
  outline: 0,
175
159
  },
176
160
  });
177
-
178
- export const CustomDestination = styled('div', {
179
- padding: '$10 $0',
180
- '& .button__content': {
181
- display: 'flex',
182
- alignItems: 'center',
183
- },
184
- '& .alarms': { paddingTop: '5px' },
185
- });
186
-
187
- export const alarmsStyles = css({
188
- paddingTop: '5px',
189
- });
190
-
191
- export const ExpandedIcon = styled('div', {
192
- transition: `all ${EXPANDABLE_TRANSITION_DURATION}ms ease`,
193
- variants: {
194
- orientation: {
195
- down: {
196
- transform: 'rotate(0)',
197
- },
198
- up: {
199
- transform: 'rotate(180deg)',
200
- },
201
- },
202
- },
203
- });
204
-
205
- export const ConfirmButton = styled('div', {
206
- display: 'flex',
207
- });
208
-
209
- export const StyledTextField = styled(TextField, {
210
- backgroundColor: '$neutral100',
211
- padding: '$0 $15 $15 $15',
212
- });
213
-
214
- export const CollapsibleContent = styled(Collapsible.Content, {
215
- backgroundColor: '$neutral100',
216
- overflow: 'hidden',
217
- variants: {
218
- open: {
219
- true: {
220
- animation: `${slideDown} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
221
- },
222
- false: {
223
- animation: `${slideUp} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
224
- },
225
- },
226
- },
227
- });
228
-
229
- export const Wallets = styled('div', { overflow: 'visible', width: '100%' });
@@ -15,7 +15,7 @@ import {
15
15
  Typography,
16
16
  WalletIcon,
17
17
  } from '@rango-dev/ui';
18
- import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
18
+ import React, { useEffect, useState } from 'react';
19
19
  import { useNavigate } from 'react-router-dom';
20
20
 
21
21
  import { RANGO_SWAP_BOX_ID } from '../../constants';
@@ -26,23 +26,20 @@ import { useQuoteStore } from '../../store/quote';
26
26
  import { useWalletsStore } from '../../store/wallets';
27
27
  import { getBlockchainShortNameFor } from '../../utils/meta';
28
28
  import { confirmSwapDisabled } from '../../utils/swap';
29
+ import { CustomCollapsible } from '../CustomCollapsible/CustomCollapsible';
30
+ import { ExpandedIcon } from '../CustomCollapsible/CustomCollapsible.styles';
29
31
 
30
32
  import { getRequiredWallets, isValidAddress } from './ConfirmWallets.helpers';
31
33
  import {
32
34
  alarmsStyles,
33
- CollapsibleContent,
34
- CollapsibleRoot,
35
35
  ConfirmButton,
36
36
  CustomDestination,
37
37
  CustomDestinationButton,
38
- EXPANDABLE_TRANSITION_DURATION,
39
- ExpandedIcon,
40
38
  ListContainer,
41
39
  NavigateBack,
42
40
  ShowMoreHeader,
43
41
  StyledTextField,
44
42
  Title,
45
- Trigger,
46
43
  Wallets,
47
44
  WalletsContainer,
48
45
  walletsListStyles,
@@ -76,7 +73,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
76
73
  const [showCustomDestination, setShowCustomDestination] = useState(
77
74
  !!customDestination
78
75
  );
79
- const customDestinationRef = useRef<HTMLDivElement | null>(null);
80
76
 
81
77
  const requiredWallets = getRequiredWallets(quote);
82
78
 
@@ -231,14 +227,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
231
227
  );
232
228
  }, [connectedWallets.length]);
233
229
 
234
- useLayoutEffect(() => {
235
- if (showCustomDestination && customDestinationRef.current) {
236
- setTimeout(() => {
237
- customDestinationRef?.current?.scrollIntoView({ behavior: 'smooth' });
238
- }, EXPANDABLE_TRANSITION_DURATION);
239
- }
240
- }, [showCustomDestination]);
241
-
242
230
  const modalContainer = document.getElementById(
243
231
  RANGO_SWAP_BOX_ID
244
232
  ) as HTMLDivElement;
@@ -394,10 +382,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
394
382
  {!isLastWallet && <Divider size={32} />}
395
383
  {isLastWallet && config?.customDestination && (
396
384
  <CustomDestination>
397
- <CollapsibleRoot
398
- ref={customDestinationRef}
399
- selected={showCustomDestination}
400
- open={showCustomDestination}
385
+ <CustomCollapsible
401
386
  onOpenChange={(checked) => {
402
387
  if (!checked) {
403
388
  resetCustomDestination();
@@ -423,11 +408,11 @@ export function ConfirmWalletsModal(props: PropTypes) {
423
408
  );
424
409
  }
425
410
  }
426
- }}>
427
- <Trigger
428
- onClick={() =>
429
- setShowCustomDestination((prevState) => !prevState)
430
- }>
411
+ }}
412
+ hasSelected
413
+ open={showCustomDestination}
414
+ triggerAnchor="top"
415
+ trigger={
431
416
  <CustomDestinationButton
432
417
  fullWidth
433
418
  variant="default"
@@ -447,21 +432,21 @@ export function ConfirmWalletsModal(props: PropTypes) {
447
432
  </Typography>
448
433
  </div>
449
434
  </CustomDestinationButton>
450
- </Trigger>
451
- <CollapsibleContent open={showCustomDestination}>
452
- <>
453
- <Divider size={4} />
454
- <StyledTextField
455
- autoFocus
456
- placeholder={i18n.t('Your destination address')}
457
- value={destination}
458
- onChange={(e) => {
459
- setDestination(e.target.value);
460
- }}
461
- />
462
- </>
463
- </CollapsibleContent>
464
- </CollapsibleRoot>
435
+ }
436
+ onClickTrigger={() =>
437
+ setShowCustomDestination((prev) => !prev)
438
+ }>
439
+ <Divider size={4} />
440
+ <StyledTextField
441
+ autoFocus
442
+ placeholder={i18n.t('Your destination address')}
443
+ value={destination}
444
+ onChange={(e) => {
445
+ setDestination(e.target.value);
446
+ }}
447
+ />
448
+ </CustomCollapsible>
449
+
465
450
  {isAddressMatched && (
466
451
  <div className={alarmsStyles()}>
467
452
  <Alert
@@ -0,0 +1,75 @@
1
+ import * as Collapsible from '@radix-ui/react-collapsible';
2
+ import { keyframes, styled } from '@rango-dev/ui';
3
+
4
+ export const EXPANDABLE_TRANSITION_DURATION = 300;
5
+
6
+ const slideDown = keyframes({
7
+ from: {
8
+ height: 0,
9
+ },
10
+ to: {
11
+ height: 'var(--radix-collapsible-content-height)',
12
+ },
13
+ });
14
+
15
+ const slideUp = keyframes({
16
+ from: {
17
+ height: 'var(--radix-collapsible-content-height)',
18
+ },
19
+ to: {
20
+ height: 0,
21
+ },
22
+ });
23
+
24
+ export const CollapsibleRoot = styled(Collapsible.Root, {
25
+ borderRadius: '$sm',
26
+ variants: {
27
+ selected: {
28
+ true: {
29
+ outlineWidth: 1,
30
+ outlineColor: '$secondary500',
31
+ outlineStyle: 'solid',
32
+ },
33
+ },
34
+ },
35
+ });
36
+
37
+ export const Trigger = styled(Collapsible.Trigger, {
38
+ padding: '$0',
39
+ border: 'none',
40
+ outline: 'none',
41
+ width: '100%',
42
+ backgroundColor: 'transparent',
43
+ fontFamily: 'inherit',
44
+ cursor: 'pointer',
45
+ });
46
+
47
+ export const CollapsibleContent = styled(Collapsible.Content, {
48
+ overflow: 'hidden',
49
+ variants: {
50
+ open: {
51
+ true: {
52
+ animation: `${slideDown} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
53
+ },
54
+ false: {
55
+ animation: `${slideUp} ${EXPANDABLE_TRANSITION_DURATION}ms ease-out`,
56
+ },
57
+ },
58
+ },
59
+ });
60
+
61
+ export const ExpandedIcon = styled('div', {
62
+ transition: `all ${EXPANDABLE_TRANSITION_DURATION}ms ease`,
63
+ display: 'flex',
64
+ alignItems: 'center',
65
+ variants: {
66
+ orientation: {
67
+ down: {
68
+ transform: 'rotate(0)',
69
+ },
70
+ up: {
71
+ transform: 'rotate(180deg)',
72
+ },
73
+ },
74
+ },
75
+ });
@@ -0,0 +1,55 @@
1
+ import type { PropTypes } from './CustomCollapsible.types';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import React, { useLayoutEffect, useRef } from 'react';
5
+
6
+ import {
7
+ CollapsibleContent,
8
+ CollapsibleRoot,
9
+ EXPANDABLE_TRANSITION_DURATION,
10
+ Trigger,
11
+ } from './CustomCollapsible.styles';
12
+
13
+ export function CustomCollapsible(props: PropsWithChildren<PropTypes>) {
14
+ const {
15
+ open,
16
+ hasSelected,
17
+ onOpenChange,
18
+ children,
19
+ onClickTrigger,
20
+ trigger,
21
+ triggerAnchor,
22
+ } = props;
23
+ const ref = useRef<HTMLDivElement | null>(null);
24
+
25
+ useLayoutEffect(() => {
26
+ if (open && ref.current) {
27
+ setTimeout(() => {
28
+ ref?.current?.scrollIntoView({ behavior: 'smooth' });
29
+ }, EXPANDABLE_TRANSITION_DURATION);
30
+ }
31
+ }, [open]);
32
+
33
+ return (
34
+ <CollapsibleRoot
35
+ ref={ref}
36
+ className="collapsible_root"
37
+ selected={hasSelected && open}
38
+ open={open}
39
+ onOpenChange={onOpenChange}>
40
+ {triggerAnchor === 'top' && (
41
+ <Trigger className="collapsible_trigger" onClick={onClickTrigger}>
42
+ {trigger}
43
+ </Trigger>
44
+ )}
45
+ <CollapsibleContent className="collapsible_content" open={open}>
46
+ {children}
47
+ </CollapsibleContent>
48
+ {triggerAnchor === 'bottom' && (
49
+ <Trigger className="collapsible_trigger" onClick={onClickTrigger}>
50
+ {trigger}
51
+ </Trigger>
52
+ )}
53
+ </CollapsibleRoot>
54
+ );
55
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export type PropTypes = {
4
+ open: boolean;
5
+ hasSelected?: boolean;
6
+ onOpenChange?: (checked: boolean) => void;
7
+ onClickTrigger: () => void;
8
+ trigger: ReactNode;
9
+ triggerAnchor: 'top' | 'bottom';
10
+ };
@@ -1,7 +1,7 @@
1
1
  import * as Collapsible from '@radix-ui/react-collapsible';
2
2
  import { css, darkTheme, Image, styled, Typography } from '@rango-dev/ui';
3
3
 
4
- import { CollapsibleContent } from '../ConfirmWalletsModal/ConfirmWallets.styles';
4
+ import { CollapsibleContent } from '../CustomCollapsible/CustomCollapsible.styles';
5
5
 
6
6
  export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
7
7
 
@@ -7,7 +7,6 @@ import {
7
7
  Alert,
8
8
  Divider,
9
9
  InfoIcon,
10
- QuoteCost,
11
10
  StepDetails,
12
11
  TokenAmount,
13
12
  Tooltip,
@@ -17,8 +16,6 @@ import BigNumber from 'bignumber.js';
17
16
  import React, { useLayoutEffect, useRef, useState } from 'react';
18
17
 
19
18
  import {
20
- GAS_FEE_MAX_DECIMALS,
21
- GAS_FEE_MIN_DECIMALS,
22
19
  PERCENTAGE_CHANGE_MAX_DECIMALS,
23
20
  PERCENTAGE_CHANGE_MIN_DECIMALS,
24
21
  TOKEN_AMOUNT_MAX_DECIMALS,
@@ -37,14 +34,8 @@ import {
37
34
  getBlockchainShortNameFor,
38
35
  getSwapperDisplayName,
39
36
  } from '../../utils/meta';
40
- import {
41
- formatTooltipNumbers,
42
- numberToString,
43
- secondsToString,
44
- totalArrivalTime,
45
- } from '../../utils/numbers';
37
+ import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
46
38
  import { getPriceImpact, getPriceImpactLevel } from '../../utils/quote';
47
- import { getTotalFeeInUsd } from '../../utils/swap';
48
39
 
49
40
  import {
50
41
  BasicInfoOutput,
@@ -59,6 +50,7 @@ import {
59
50
  SummaryContainer,
60
51
  summaryStyles,
61
52
  } from './Quote.styles';
53
+ import { QuoteCostDetails } from './QuoteCostDetails';
62
54
  import { QuoteSummary } from './QuoteSummary';
63
55
  import { QuoteTrigger } from './QuoteTrigger ';
64
56
 
@@ -72,19 +64,12 @@ export function Quote(props: QuoteProps) {
72
64
  type,
73
65
  recommended = true,
74
66
  } = props;
75
- const tokens = useAppStore().tokens();
76
67
  const blockchains = useAppStore().blockchains();
77
68
  const swappers = useAppStore().swappers();
78
69
 
79
70
  const [expanded, setExpanded] = useState(props.expanded);
80
71
  const quoteRef = useRef<HTMLButtonElement | null>(null);
81
72
  const prevExpanded = useRef(expanded);
82
- const totalFee = numberToString(
83
- getTotalFeeInUsd(quote.result?.swaps ?? [], tokens),
84
- GAS_FEE_MIN_DECIMALS,
85
- GAS_FEE_MAX_DECIMALS
86
- );
87
- const totalTime = secondsToString(totalArrivalTime(quote.result?.swaps));
88
73
  const roundedInput = numberToString(
89
74
  input.value,
90
75
  TOKEN_AMOUNT_MIN_DECIMALS,
@@ -278,7 +263,6 @@ export function Quote(props: QuoteProps) {
278
263
  const steps = getQuoteSteps(quote.result?.swaps ?? []);
279
264
  const numberOfSteps = steps.length;
280
265
  const tooltipContainer = getContainer();
281
-
282
266
  useLayoutEffect(() => {
283
267
  if (expanded && !prevExpanded.current && quoteRef.current) {
284
268
  setTimeout(() => {
@@ -295,7 +279,7 @@ export function Quote(props: QuoteProps) {
295
279
  listItem={type === 'list-item'}
296
280
  basic={type === 'basic'}>
297
281
  <div className={summaryStyles()}>
298
- <QuoteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
282
+ <QuoteCostDetails steps={numberOfSteps} quote={quote} />
299
283
  {type === 'basic' && (
300
284
  <div className={basicInfoStyles()}>
301
285
  <FrameIcon>
@@ -30,3 +30,8 @@ export type QuoteTriggerImagesProps = {
30
30
  open?: boolean;
31
31
  className?: string;
32
32
  };
33
+
34
+ export type QuoteCostDetailsProps = {
35
+ quote: BestRouteResponse;
36
+ steps: number;
37
+ };
@@ -0,0 +1,50 @@
1
+ import { css, styled } from '@rango-dev/ui';
2
+
3
+ export const FeeSection = styled('div', {
4
+ display: 'flex',
5
+ justifyContent: 'space-between',
6
+ alignItems: 'center',
7
+ padding: '$5 0',
8
+ '&.total_payable_fee': {
9
+ padding: '$12 0',
10
+ },
11
+ });
12
+
13
+ export const Line = styled('div', {
14
+ width: '100%',
15
+ borderTop: '1px solid $neutral300',
16
+ margin: '$10 0',
17
+ });
18
+
19
+ export const ModalContainer = styled('div', {
20
+ padding: '$20 0',
21
+ display: 'flex',
22
+ flexDirection: 'column',
23
+ '& .collapsible_trigger': {
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ },
27
+ });
28
+
29
+ export const ModalHeader = styled('div', {
30
+ padding: '$20 $20 $10',
31
+ textAlign: 'center',
32
+ position: 'relative',
33
+ '._icon-button': {
34
+ position: 'absolute',
35
+ zIndex: 10,
36
+ top: '$16',
37
+ right: '$16',
38
+ },
39
+ });
40
+ export const trigger = css({
41
+ display: 'flex',
42
+ flexDirection: 'row',
43
+ alignItems: 'center',
44
+ padding: '$5',
45
+ '&:hover': {
46
+ '& ._typography, & svg': {
47
+ color: '$secondary',
48
+ },
49
+ },
50
+ });