@lifi/widget 3.2.1 → 3.3.0

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 (78) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/_esm/components/ActiveTransactions/ActiveTransactionItem.js +1 -1
  3. package/_esm/components/Card/CardIconButton.d.ts +4 -1
  4. package/_esm/components/Card/CardIconButton.js.map +1 -1
  5. package/_esm/components/FeeBreakdownTooltip.d.ts +0 -2
  6. package/_esm/components/FeeBreakdownTooltip.js +2 -5
  7. package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
  8. package/_esm/components/IconTypography.d.ts +3 -3
  9. package/_esm/components/IconTypography.js +2 -2
  10. package/_esm/components/IconTypography.js.map +1 -1
  11. package/_esm/components/RouteCard/RouteCardEssentials.js +10 -11
  12. package/_esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
  13. package/_esm/components/Step/DestinationWalletAddress.js +2 -2
  14. package/_esm/components/Step/DestinationWalletAddress.js.map +1 -1
  15. package/_esm/components/Step/Step.js +1 -1
  16. package/_esm/components/Step/StepProcess.js +3 -3
  17. package/_esm/components/Step/StepProcess.js.map +1 -1
  18. package/_esm/components/Step/StepTimer.js +44 -27
  19. package/_esm/components/Step/StepTimer.js.map +1 -1
  20. package/_esm/components/StepActions/StepActions.style.d.ts +0 -3
  21. package/_esm/components/StepActions/StepActions.style.js +0 -6
  22. package/_esm/components/StepActions/StepActions.style.js.map +1 -1
  23. package/_esm/components/TransactionDetails.js +4 -8
  24. package/_esm/components/TransactionDetails.js.map +1 -1
  25. package/_esm/config/version.d.ts +1 -1
  26. package/_esm/config/version.js +1 -1
  27. package/_esm/hooks/timer/useTimer.js +2 -2
  28. package/_esm/hooks/timer/useTimer.js.map +1 -1
  29. package/_esm/i18n/en.json +1 -2
  30. package/_esm/i18n/index.js +15 -15
  31. package/_esm/i18n/index.js.map +1 -1
  32. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +3 -2
  33. package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  34. package/_esm/pages/TransactionPage/TokenValueBottomSheet.d.ts +0 -1
  35. package/_esm/pages/TransactionPage/TokenValueBottomSheet.js +7 -14
  36. package/_esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
  37. package/_esm/pages/TransactionPage/TransactionPage.js +16 -8
  38. package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
  39. package/_esm/pages/TransactionPage/utils.d.ts +2 -2
  40. package/_esm/pages/TransactionPage/utils.js +9 -5
  41. package/_esm/pages/TransactionPage/utils.js.map +1 -1
  42. package/_esm/stores/routes/types.d.ts +6 -6
  43. package/_esm/stores/routes/types.js +6 -6
  44. package/_esm/stores/routes/types.js.map +1 -1
  45. package/_esm/types/events.d.ts +5 -4
  46. package/_esm/utils/converters.js +1 -1
  47. package/_esm/utils/converters.js.map +1 -1
  48. package/_esm/utils/fees.d.ts +7 -0
  49. package/_esm/utils/fees.js +14 -0
  50. package/_esm/utils/fees.js.map +1 -1
  51. package/components/ActiveTransactions/ActiveTransactionItem.tsx +1 -1
  52. package/components/Card/CardIconButton.tsx +4 -1
  53. package/components/FeeBreakdownTooltip.tsx +4 -10
  54. package/components/IconTypography.ts +2 -2
  55. package/components/RouteCard/RouteCardEssentials.tsx +19 -15
  56. package/components/Step/DestinationWalletAddress.tsx +3 -3
  57. package/components/Step/Step.tsx +1 -1
  58. package/components/Step/StepProcess.tsx +6 -6
  59. package/components/Step/StepTimer.tsx +77 -32
  60. package/components/StepActions/StepActions.style.tsx +0 -8
  61. package/components/TransactionDetails.tsx +8 -25
  62. package/config/version.ts +1 -1
  63. package/hooks/timer/useTimer.ts +4 -2
  64. package/i18n/en.json +1 -2
  65. package/i18n/index.ts +15 -15
  66. package/package.json +11 -11
  67. package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +6 -5
  68. package/pages/TransactionPage/TokenValueBottomSheet.tsx +32 -19
  69. package/pages/TransactionPage/TransactionPage.tsx +27 -10
  70. package/pages/TransactionPage/utils.ts +23 -8
  71. package/stores/routes/types.ts +6 -6
  72. package/types/events.ts +5 -4
  73. package/utils/converters.ts +1 -1
  74. package/utils/fees.ts +24 -0
  75. package/_esm/components/Step/StepProcess.style.d.ts +0 -9
  76. package/_esm/components/Step/StepProcess.style.js +0 -6
  77. package/_esm/components/Step/StepProcess.style.js.map +0 -1
  78. package/components/Step/StepProcess.style.tsx +0 -9
@@ -15,10 +15,10 @@ export interface RouteExecutionState {
15
15
  }
16
16
 
17
17
  export enum RouteExecutionStatus {
18
- Idle = 0,
19
- Pending = 1 << 0,
20
- Done = 1 << 1,
21
- Failed = 1 << 2,
22
- Partial = 1 << 3,
23
- Refunded = 1 << 4,
18
+ Idle = 1 << 0,
19
+ Pending = 1 << 1,
20
+ Done = 1 << 2,
21
+ Failed = 1 << 3,
22
+ Partial = 1 << 4,
23
+ Refunded = 1 << 5,
24
24
  }
package/types/events.ts CHANGED
@@ -37,10 +37,11 @@ export interface ContactSupport {
37
37
  }
38
38
 
39
39
  export interface RouteHighValueLossUpdate {
40
- fromAmountUsd: string;
41
- gasCostUSD?: string;
42
- toAmountUSD: string;
43
- valueLoss: string;
40
+ fromAmountUSD: number;
41
+ toAmountUSD: number;
42
+ gasCostUSD?: number;
43
+ feeCostUSD?: number;
44
+ valueLoss: number;
44
45
  }
45
46
 
46
47
  export interface RouteExecutionUpdate {
@@ -167,7 +167,7 @@ export const buildRouteFromTxHistory = (
167
167
  toAmountMin: receiving.amount ?? '',
168
168
  toAmount: receiving.amount ?? '',
169
169
  toAmountUSD: receiving.amountUSD ?? '',
170
- executionDuration: 30,
170
+ executionDuration: 0,
171
171
  },
172
172
  includedSteps: [
173
173
  {
package/utils/fees.ts CHANGED
@@ -7,6 +7,30 @@ export interface FeesBreakdown {
7
7
  token: Token;
8
8
  }
9
9
 
10
+ export const getAccumulatedFeeCostsBreakdown = (
11
+ route: RouteExtended,
12
+ included: boolean = false,
13
+ ) => {
14
+ const gasCosts = getGasCostsBreakdown(route);
15
+ const feeCosts = getFeeCostsBreakdown(route, included);
16
+ const gasCostUSD = gasCosts.reduce(
17
+ (sum, gasCost) => sum + gasCost.amountUSD,
18
+ 0,
19
+ );
20
+ const feeCostUSD = feeCosts.reduce(
21
+ (sum, feeCost) => sum + feeCost.amountUSD,
22
+ 0,
23
+ );
24
+ const combinedFeesUSD = gasCostUSD + feeCostUSD;
25
+ return {
26
+ gasCosts,
27
+ feeCosts,
28
+ gasCostUSD,
29
+ feeCostUSD,
30
+ combinedFeesUSD,
31
+ };
32
+ };
33
+
10
34
  export const getGasCostsBreakdown = (route: RouteExtended): FeesBreakdown[] => {
11
35
  return Array.from(
12
36
  route.steps
@@ -1,9 +0,0 @@
1
- export declare const LinkButton: import("@emotion/styled").StyledComponent<import("@mui/material").IconButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
2
- ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
3
- }, "color" | "children" | "sx" | "style" | "className" | "tabIndex" | "disabled" | "action" | "size" | "classes" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
4
- component?: import("react").ElementType;
5
- } & import("@mui/material").LinkOwnProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
6
- ref?: ((instance: HTMLAnchorElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
7
- }, "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "children" | "sx" | "style" | "className" | "align" | "classes" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping" | "TypographyClasses" | "underline"> & {
8
- component?: import("react").ElementType;
9
- }, {}, {}>;
@@ -1,6 +0,0 @@
1
- import { styled } from '@mui/material';
2
- import { CardIconButton } from '../Card/CardIconButton.js';
3
- export const LinkButton = styled(CardIconButton)(({ theme }) => ({
4
- padding: theme.spacing(0.5),
5
- }));
6
- //# sourceMappingURL=StepProcess.style.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StepProcess.style.js","sourceRoot":"","sources":["../../../components/Step/StepProcess.style.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,CAC9C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;CAC5B,CAAC,CACH,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { IconButtonProps, LinkProps } from '@mui/material';
2
- import { styled } from '@mui/material';
3
- import { CardIconButton } from '../Card/CardIconButton.js';
4
-
5
- export const LinkButton = styled(CardIconButton)<IconButtonProps & LinkProps>(
6
- ({ theme }) => ({
7
- padding: theme.spacing(0.5),
8
- }),
9
- );