@lifi/widget 2.6.0 → 2.6.2

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 (37) hide show
  1. package/cjs/components/BaseTransactionButton/BaseTransactionButton.d.ts +3 -0
  2. package/cjs/components/{DefaultTransactionButton/DefaultTransactionButton.js → BaseTransactionButton/BaseTransactionButton.js} +3 -3
  3. package/cjs/components/BaseTransactionButton/index.d.ts +2 -0
  4. package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/index.js +3 -3
  5. package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/types.d.ts +1 -1
  6. package/cjs/components/GasMessage/GasMessage.js +1 -4
  7. package/cjs/components/Step/CircularProgress.style.js +33 -31
  8. package/cjs/config/theme.js +19 -19
  9. package/cjs/config/version.d.ts +1 -1
  10. package/cjs/config/version.js +1 -1
  11. package/cjs/hooks/useGasSufficiency.js +3 -1
  12. package/cjs/pages/MainPage/ReviewButton.js +2 -2
  13. package/cjs/pages/TransactionPage/StartTransactionButton.js +3 -6
  14. package/cjs/pages/TransactionPage/types.d.ts +2 -2
  15. package/components/BaseTransactionButton/BaseTransactionButton.d.ts +3 -0
  16. package/components/{DefaultTransactionButton/DefaultTransactionButton.js → BaseTransactionButton/BaseTransactionButton.js} +1 -1
  17. package/components/BaseTransactionButton/index.d.ts +2 -0
  18. package/components/BaseTransactionButton/index.js +2 -0
  19. package/components/{DefaultTransactionButton → BaseTransactionButton}/types.d.ts +1 -1
  20. package/components/GasMessage/GasMessage.js +1 -4
  21. package/components/Step/CircularProgress.style.js +33 -31
  22. package/config/theme.js +20 -20
  23. package/config/version.d.ts +1 -1
  24. package/config/version.js +1 -1
  25. package/hooks/useGasSufficiency.js +4 -2
  26. package/package.json +1 -1
  27. package/pages/MainPage/ReviewButton.js +2 -2
  28. package/pages/TransactionPage/StartTransactionButton.js +3 -6
  29. package/pages/TransactionPage/types.d.ts +2 -2
  30. package/tsconfig.cjs.tsbuildinfo +1 -1
  31. package/cjs/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +0 -3
  32. package/cjs/components/DefaultTransactionButton/index.d.ts +0 -2
  33. package/components/DefaultTransactionButton/DefaultTransactionButton.d.ts +0 -3
  34. package/components/DefaultTransactionButton/index.d.ts +0 -2
  35. package/components/DefaultTransactionButton/index.js +0 -2
  36. /package/cjs/components/{DefaultTransactionButton → BaseTransactionButton}/types.js +0 -0
  37. /package/components/{DefaultTransactionButton → BaseTransactionButton}/types.js +0 -0
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { BaseTransactionButtonProps } from './types';
3
+ export declare const BaseTransactionButton: React.FC<BaseTransactionButtonProps>;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultTransactionButton = void 0;
3
+ exports.BaseTransactionButton = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const lab_1 = require("@mui/lab");
6
6
  const react_i18next_1 = require("react-i18next");
7
7
  const react_router_dom_1 = require("react-router-dom");
8
8
  const providers_1 = require("../../providers");
9
9
  const utils_1 = require("../../utils");
10
- const DefaultTransactionButton = ({ onClick, text, disabled, loading }) => {
10
+ const BaseTransactionButton = ({ onClick, text, disabled, loading, }) => {
11
11
  const { t } = (0, react_i18next_1.useTranslation)();
12
12
  const navigate = (0, react_router_dom_1.useNavigate)();
13
13
  const { walletManagement } = (0, providers_1.useWidgetConfig)();
@@ -33,4 +33,4 @@ const DefaultTransactionButton = ({ onClick, text, disabled, loading }) => {
33
33
  };
34
34
  return ((0, jsx_runtime_1.jsx)(lab_1.LoadingButton, { variant: "contained", color: "primary", onClick: handleClick, disabled: disabled, loading: loading, loadingPosition: "center", fullWidth: true, children: getButtonText() }));
35
35
  };
36
- exports.DefaultTransactionButton = DefaultTransactionButton;
36
+ exports.BaseTransactionButton = BaseTransactionButton;
@@ -0,0 +1,2 @@
1
+ export { BaseTransactionButton } from './BaseTransactionButton';
2
+ export * from './types';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DefaultTransactionButton = void 0;
18
- var DefaultTransactionButton_1 = require("./DefaultTransactionButton");
19
- Object.defineProperty(exports, "DefaultTransactionButton", { enumerable: true, get: function () { return DefaultTransactionButton_1.DefaultTransactionButton; } });
17
+ exports.BaseTransactionButton = void 0;
18
+ var BaseTransactionButton_1 = require("./BaseTransactionButton");
19
+ Object.defineProperty(exports, "BaseTransactionButton", { enumerable: true, get: function () { return BaseTransactionButton_1.BaseTransactionButton; } });
20
20
  __exportStar(require("./types"), exports);
@@ -1,4 +1,4 @@
1
- export interface DefaultTransactionButtonProps {
1
+ export interface BaseTransactionButtonProps {
2
2
  onClick?(): void;
3
3
  text?: string;
4
4
  disabled?: boolean;
@@ -4,15 +4,12 @@ exports.GasMessage = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const hooks_1 = require("../../hooks");
7
- const providers_1 = require("../../providers");
8
7
  const FundsSufficiencyMessage_1 = require("./FundsSufficiencyMessage");
9
8
  const GasSufficiencyMessage_1 = require("./GasSufficiencyMessage");
10
9
  const GasMessage = ({ route, ...props }) => {
11
10
  const { insufficientGas } = (0, hooks_1.useGasSufficiency)(route);
12
11
  const { insufficientFromToken } = (0, hooks_1.useFromTokenSufficiency)(route);
13
- const { sdkConfig } = (0, providers_1.useWidgetConfig)();
14
- const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
15
- const validInsufficientGas = insufficientGas?.length && !isMultisigSigner;
12
+ const validInsufficientGas = insufficientGas?.length;
16
13
  return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFromToken || validInsufficientGas), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFromToken ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : validInsufficientGas ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
17
14
  };
18
15
  exports.GasMessage = GasMessage;
@@ -4,20 +4,6 @@ exports.CircularProgressPending = exports.CircularIcon = void 0;
4
4
  const material_1 = require("@mui/material");
5
5
  const CircularProgress_1 = require("@mui/material/CircularProgress");
6
6
  const styles_1 = require("@mui/material/styles");
7
- const circleAnimation = (0, styles_1.keyframes)({
8
- '0%': {
9
- strokeDashoffset: 129,
10
- transform: 'rotate(0)',
11
- },
12
- '50%': {
13
- strokeDashoffset: 56,
14
- transform: 'rotate(45deg)',
15
- },
16
- '100%': {
17
- strokeDashoffset: 129,
18
- transform: 'rotate(360deg)',
19
- },
20
- });
21
7
  const getStatusColor = (theme, status, substatus) => {
22
8
  switch (status) {
23
9
  case 'ACTION_REQUIRED':
@@ -51,20 +37,36 @@ exports.CircularIcon = (0, styles_1.styled)(material_1.Box, {
51
37
  height: 32,
52
38
  borderRadius: '50%',
53
39
  }));
54
- exports.CircularProgressPending = (0, styles_1.styled)(material_1.CircularProgress)(({ theme }) => ({
55
- color: theme.palette.mode === 'light'
56
- ? theme.palette.primary.main
57
- : theme.palette.primary.light,
58
- animationDuration: '3s',
59
- position: 'absolute',
60
- left: '-2px',
61
- [`.${CircularProgress_1.circularProgressClasses.circle}`]: {
62
- animationDuration: '2s',
63
- animationTimingFunction: 'linear',
64
- animationName: circleAnimation,
65
- strokeDasharray: 129,
66
- strokeDashoffset: 129,
67
- strokeLinecap: 'round',
68
- transformOrigin: '100% 100%',
69
- },
70
- }));
40
+ const circleAnimation = (0, styles_1.keyframes) `
41
+ 0% {
42
+ stroke-dashoffset: 129;
43
+ transform: rotate(0);
44
+ }
45
+ 50% {
46
+ stroke-dashoffset: 56;
47
+ transform: rotate(45deg);
48
+ };
49
+ 100% {
50
+ stroke-dashoffset: 129;
51
+ transform: rotate(360deg);
52
+ }
53
+ `;
54
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
55
+ // in string templates. Do not convert these styles in JS object as it will break.
56
+ exports.CircularProgressPending = (0, styles_1.styled)(material_1.CircularProgress) `
57
+ color: ${({ theme }) => theme.palette.mode === 'light'
58
+ ? theme.palette.primary.main
59
+ : theme.palette.primary.light};
60
+ animation-duration: '3s';
61
+ position: 'absolute';
62
+ left: '-2px';
63
+ .${CircularProgress_1.circularProgressClasses.circle} {
64
+ animation-duration: '2s';
65
+ animation-timing-function: 'linear';
66
+ animation-name: ${circleAnimation};
67
+ stroke-dasharray: 129;
68
+ stroke-dashoffset: 129;
69
+ stroke-linecap: 'round';
70
+ transform-origin: '100% 100%';
71
+ }
72
+ `;
@@ -45,16 +45,16 @@ const shape = {
45
45
  borderRadius: 12,
46
46
  borderRadiusSecondary: 8,
47
47
  };
48
- const enterKeyframe = (0, styles_1.keyframes)({
49
- '0%': {
50
- transform: 'scale(0)',
51
- opacity: 0.05,
52
- },
53
- '100%': {
54
- transform: 'scale(1)',
55
- opacity: 0.1,
56
- },
57
- });
48
+ const enterKeyframe = (0, styles_1.keyframes) `
49
+ 0% {
50
+ transform: scale(0);
51
+ opacity: 0.05;
52
+ }
53
+ 100% {
54
+ transform: scale(1);
55
+ opacity: 0.1;
56
+ }
57
+ `;
58
58
  const createTheme = (mode, theme = {}) => {
59
59
  const primaryMainColor = theme.palette?.primary?.main ??
60
60
  palette.primary.main;
@@ -120,15 +120,15 @@ const createTheme = (mode, theme = {}) => {
120
120
  },
121
121
  MuiButtonBase: {
122
122
  styleOverrides: {
123
- root: {
124
- [`& .${ButtonBase_1.touchRippleClasses.ripple}.${ButtonBase_1.touchRippleClasses.rippleVisible}`]: {
125
- animationName: enterKeyframe,
126
- },
127
- [`& .${ButtonBase_1.touchRippleClasses.ripple}.${ButtonBase_1.touchRippleClasses.rippleVisible}`]: {
128
- opacity: 0.1,
129
- animationName: enterKeyframe,
130
- },
131
- },
123
+ // This `css()` function invokes keyframes. `styled-components` only supports keyframes
124
+ // in string templates. Do not convert these styles in JS object as it will break.
125
+ root: (0, styles_1.css) `
126
+ &
127
+ .${ButtonBase_1.touchRippleClasses.ripple}.${ButtonBase_1.touchRippleClasses.rippleVisible} {
128
+ opacity: 0.1;
129
+ animation-name: ${enterKeyframe};
130
+ }
131
+ `,
132
132
  },
133
133
  },
134
134
  MuiButton: {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "2.6.0";
2
+ export declare const version = "2.6.2";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '2.6.0';
5
+ exports.version = '2.6.2';
@@ -11,6 +11,8 @@ const useGasSufficiency = (route) => {
11
11
  const { account } = (0, providers_1.useWallet)();
12
12
  const { getChainById } = (0, _1.useChains)();
13
13
  const getTokenBalancesWithRetry = (0, _1.useGetTokenBalancesWithRetry)(account.signer?.provider);
14
+ const { sdkConfig } = (0, providers_1.useWidgetConfig)();
15
+ const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
14
16
  const { enabledAutoRefuel } = (0, stores_1.useSettings)(['enabledAutoRefuel']);
15
17
  const { enabled, isLoading: isRefuelLoading } = (0, _1.useGasRefuel)();
16
18
  const enabledRefuel = enabled && enabledAutoRefuel;
@@ -25,7 +27,7 @@ const useGasSufficiency = (route) => {
25
27
  const gasCosts = route.steps
26
28
  .filter((step) => !step.execution || step.execution.status !== 'DONE')
27
29
  .reduce((groupedGasCosts, step) => {
28
- if (step.estimate.gasCosts) {
30
+ if (step.estimate.gasCosts && !isMultisigSigner) {
29
31
  const { token } = step.estimate.gasCosts[0];
30
32
  const gasCostAmount = step.estimate.gasCosts
31
33
  .reduce((amount, gasCost) => amount.plus((0, big_js_1.default)(gasCost.amount || 0)), (0, big_js_1.default)(0))
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_hook_form_1 = require("react-hook-form");
6
6
  const react_i18next_1 = require("react-i18next");
7
7
  const react_router_dom_1 = require("react-router-dom");
8
- const DefaultTransactionButton_1 = require("../../components/DefaultTransactionButton");
8
+ const BaseTransactionButton_1 = require("../../components/BaseTransactionButton");
9
9
  const hooks_1 = require("../../hooks");
10
10
  const providers_1 = require("../../providers");
11
11
  const stores_1 = require("../../stores");
@@ -57,6 +57,6 @@ const ReviewButton = () => {
57
57
  }
58
58
  }
59
59
  };
60
- return ((0, jsx_runtime_1.jsx)(DefaultTransactionButton_1.DefaultTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
60
+ return ((0, jsx_runtime_1.jsx)(BaseTransactionButton_1.BaseTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
61
61
  };
62
62
  exports.ReviewButton = ReviewButton;
@@ -2,17 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StartInsurableTransactionButton = exports.StartTransactionButton = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const DefaultTransactionButton_1 = require("../../components/DefaultTransactionButton");
5
+ const BaseTransactionButton_1 = require("../../components/BaseTransactionButton");
6
6
  const hooks_1 = require("../../hooks");
7
- const providers_1 = require("../../providers");
8
7
  const stores_1 = require("../../stores");
9
8
  const StartTransactionButton = ({ onClick, route, text, loading, }) => {
10
- const { sdkConfig } = (0, providers_1.useWidgetConfig)();
11
- const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
12
9
  const { insufficientGas, isInitialLoading: isGasSufficiencyLoading } = (0, hooks_1.useGasSufficiency)(route);
13
10
  const { insufficientFromToken, isInitialLoading: isFromTokenSufficiencyLoading, } = (0, hooks_1.useFromTokenSufficiency)(route);
14
- const shouldDisableButton = !isMultisigSigner && (insufficientFromToken || !!insufficientGas?.length);
15
- return ((0, jsx_runtime_1.jsx)(DefaultTransactionButton_1.DefaultTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
11
+ const shouldDisableButton = insufficientFromToken || !!insufficientGas?.length;
12
+ return ((0, jsx_runtime_1.jsx)(BaseTransactionButton_1.BaseTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
16
13
  };
17
14
  exports.StartTransactionButton = StartTransactionButton;
18
15
  const StartInsurableTransactionButton = ({ onClick, text, route, loading, disabled, insurableRouteId }) => {
@@ -1,6 +1,6 @@
1
1
  import type { Route } from '@lifi/sdk';
2
- import type { DefaultTransactionButtonProps } from '../../components/DefaultTransactionButton';
3
- export interface StartTransactionButtonProps extends DefaultTransactionButtonProps {
2
+ import type { BaseTransactionButtonProps } from '../../components/BaseTransactionButton';
3
+ export interface StartTransactionButtonProps extends BaseTransactionButtonProps {
4
4
  route?: Route;
5
5
  insurableRouteId: string;
6
6
  }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { BaseTransactionButtonProps } from './types';
3
+ export declare const BaseTransactionButton: React.FC<BaseTransactionButtonProps>;
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { useNavigate } from 'react-router-dom';
5
5
  import { useWallet, useWidgetConfig } from '../../providers';
6
6
  import { navigationRoutes } from '../../utils';
7
- export const DefaultTransactionButton = ({ onClick, text, disabled, loading }) => {
7
+ export const BaseTransactionButton = ({ onClick, text, disabled, loading, }) => {
8
8
  const { t } = useTranslation();
9
9
  const navigate = useNavigate();
10
10
  const { walletManagement } = useWidgetConfig();
@@ -0,0 +1,2 @@
1
+ export { BaseTransactionButton } from './BaseTransactionButton';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export { BaseTransactionButton } from './BaseTransactionButton';
2
+ export * from './types';
@@ -1,4 +1,4 @@
1
- export interface DefaultTransactionButtonProps {
1
+ export interface BaseTransactionButtonProps {
2
2
  onClick?(): void;
3
3
  text?: string;
4
4
  disabled?: boolean;
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box, Collapse } from '@mui/material';
3
3
  import { useFromTokenSufficiency, useGasSufficiency } from '../../hooks';
4
- import { useWidgetConfig } from '../../providers';
5
4
  import { FundsSufficiencyMessage } from './FundsSufficiencyMessage';
6
5
  import { GasSufficiencyMessage } from './GasSufficiencyMessage';
7
6
  export const GasMessage = ({ route, ...props }) => {
8
7
  const { insufficientGas } = useGasSufficiency(route);
9
8
  const { insufficientFromToken } = useFromTokenSufficiency(route);
10
- const { sdkConfig } = useWidgetConfig();
11
- const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
12
- const validInsufficientGas = insufficientGas?.length && !isMultisigSigner;
9
+ const validInsufficientGas = insufficientGas?.length;
13
10
  return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFromToken || validInsufficientGas), unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: insufficientFromToken ? (_jsx(FundsSufficiencyMessage, {})) : validInsufficientGas ? (_jsx(GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
14
11
  };
@@ -1,20 +1,6 @@
1
1
  import { Box, CircularProgress as MuiCircularProgress } from '@mui/material';
2
2
  import { circularProgressClasses } from '@mui/material/CircularProgress';
3
3
  import { alpha, keyframes, styled } from '@mui/material/styles';
4
- const circleAnimation = keyframes({
5
- '0%': {
6
- strokeDashoffset: 129,
7
- transform: 'rotate(0)',
8
- },
9
- '50%': {
10
- strokeDashoffset: 56,
11
- transform: 'rotate(45deg)',
12
- },
13
- '100%': {
14
- strokeDashoffset: 129,
15
- transform: 'rotate(360deg)',
16
- },
17
- });
18
4
  const getStatusColor = (theme, status, substatus) => {
19
5
  switch (status) {
20
6
  case 'ACTION_REQUIRED':
@@ -48,20 +34,36 @@ export const CircularIcon = styled(Box, {
48
34
  height: 32,
49
35
  borderRadius: '50%',
50
36
  }));
51
- export const CircularProgressPending = styled(MuiCircularProgress)(({ theme }) => ({
52
- color: theme.palette.mode === 'light'
53
- ? theme.palette.primary.main
54
- : theme.palette.primary.light,
55
- animationDuration: '3s',
56
- position: 'absolute',
57
- left: '-2px',
58
- [`.${circularProgressClasses.circle}`]: {
59
- animationDuration: '2s',
60
- animationTimingFunction: 'linear',
61
- animationName: circleAnimation,
62
- strokeDasharray: 129,
63
- strokeDashoffset: 129,
64
- strokeLinecap: 'round',
65
- transformOrigin: '100% 100%',
66
- },
67
- }));
37
+ const circleAnimation = keyframes `
38
+ 0% {
39
+ stroke-dashoffset: 129;
40
+ transform: rotate(0);
41
+ }
42
+ 50% {
43
+ stroke-dashoffset: 56;
44
+ transform: rotate(45deg);
45
+ };
46
+ 100% {
47
+ stroke-dashoffset: 129;
48
+ transform: rotate(360deg);
49
+ }
50
+ `;
51
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
52
+ // in string templates. Do not convert these styles in JS object as it will break.
53
+ export const CircularProgressPending = styled(MuiCircularProgress) `
54
+ color: ${({ theme }) => theme.palette.mode === 'light'
55
+ ? theme.palette.primary.main
56
+ : theme.palette.primary.light};
57
+ animation-duration: '3s';
58
+ position: 'absolute';
59
+ left: '-2px';
60
+ .${circularProgressClasses.circle} {
61
+ animation-duration: '2s';
62
+ animation-timing-function: 'linear';
63
+ animation-name: ${circleAnimation};
64
+ stroke-dasharray: 129;
65
+ stroke-dashoffset: 129;
66
+ stroke-linecap: 'round';
67
+ transform-origin: '100% 100%';
68
+ }
69
+ `;
package/config/theme.js CHANGED
@@ -2,7 +2,7 @@ import { loadingButtonClasses } from '@mui/lab/LoadingButton';
2
2
  import { touchRippleClasses } from '@mui/material/ButtonBase';
3
3
  import { dialogActionsClasses } from '@mui/material/DialogActions';
4
4
  import { common } from '@mui/material/colors';
5
- import { alpha, createTheme as createMuiTheme, darken, getContrastRatio, keyframes, lighten, } from '@mui/material/styles';
5
+ import { alpha, createTheme as createMuiTheme, css, darken, getContrastRatio, keyframes, lighten, } from '@mui/material/styles';
6
6
  const palette = {
7
7
  primary: {
8
8
  main: '#3F49E1',
@@ -42,16 +42,16 @@ const shape = {
42
42
  borderRadius: 12,
43
43
  borderRadiusSecondary: 8,
44
44
  };
45
- const enterKeyframe = keyframes({
46
- '0%': {
47
- transform: 'scale(0)',
48
- opacity: 0.05,
49
- },
50
- '100%': {
51
- transform: 'scale(1)',
52
- opacity: 0.1,
53
- },
54
- });
45
+ const enterKeyframe = keyframes `
46
+ 0% {
47
+ transform: scale(0);
48
+ opacity: 0.05;
49
+ }
50
+ 100% {
51
+ transform: scale(1);
52
+ opacity: 0.1;
53
+ }
54
+ `;
55
55
  export const createTheme = (mode, theme = {}) => {
56
56
  const primaryMainColor = theme.palette?.primary?.main ??
57
57
  palette.primary.main;
@@ -117,15 +117,15 @@ export const createTheme = (mode, theme = {}) => {
117
117
  },
118
118
  MuiButtonBase: {
119
119
  styleOverrides: {
120
- root: {
121
- [`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
122
- animationName: enterKeyframe,
123
- },
124
- [`& .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible}`]: {
125
- opacity: 0.1,
126
- animationName: enterKeyframe,
127
- },
128
- },
120
+ // This `css()` function invokes keyframes. `styled-components` only supports keyframes
121
+ // in string templates. Do not convert these styles in JS object as it will break.
122
+ root: css `
123
+ &
124
+ .${touchRippleClasses.ripple}.${touchRippleClasses.rippleVisible} {
125
+ opacity: 0.1;
126
+ animation-name: ${enterKeyframe};
127
+ }
128
+ `,
129
129
  },
130
130
  },
131
131
  MuiButton: {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "2.6.0";
2
+ export declare const version = "2.6.2";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '2.6.0';
2
+ export const version = '2.6.2';
@@ -1,13 +1,15 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import Big from 'big.js';
3
3
  import { useChains, useGasRefuel, useGetTokenBalancesWithRetry } from '.';
4
- import { useWallet } from '../providers';
4
+ import { useWallet, useWidgetConfig } from '../providers';
5
5
  import { useSettings } from '../stores';
6
6
  const refetchInterval = 30000;
7
7
  export const useGasSufficiency = (route) => {
8
8
  const { account } = useWallet();
9
9
  const { getChainById } = useChains();
10
10
  const getTokenBalancesWithRetry = useGetTokenBalancesWithRetry(account.signer?.provider);
11
+ const { sdkConfig } = useWidgetConfig();
12
+ const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
11
13
  const { enabledAutoRefuel } = useSettings(['enabledAutoRefuel']);
12
14
  const { enabled, isLoading: isRefuelLoading } = useGasRefuel();
13
15
  const enabledRefuel = enabled && enabledAutoRefuel;
@@ -22,7 +24,7 @@ export const useGasSufficiency = (route) => {
22
24
  const gasCosts = route.steps
23
25
  .filter((step) => !step.execution || step.execution.status !== 'DONE')
24
26
  .reduce((groupedGasCosts, step) => {
25
- if (step.estimate.gasCosts) {
27
+ if (step.estimate.gasCosts && !isMultisigSigner) {
26
28
  const { token } = step.estimate.gasCosts[0];
27
29
  const gasCostAmount = step.estimate.gasCosts
28
30
  .reduce((amount, gasCost) => amount.plus(Big(gasCost.amount || 0)), Big(0))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
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",
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useFormState } from 'react-hook-form';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useNavigate } from 'react-router-dom';
5
- import { DefaultTransactionButton } from '../../components/DefaultTransactionButton';
5
+ import { BaseTransactionButton } from '../../components/BaseTransactionButton';
6
6
  import { useRoutes } from '../../hooks';
7
7
  import { useWidgetConfig } from '../../providers';
8
8
  import { useSetExecutableRoute, useSplitSubvariantStore } from '../../stores';
@@ -54,5 +54,5 @@ export const ReviewButton = () => {
54
54
  }
55
55
  }
56
56
  };
57
- return (_jsx(DefaultTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
57
+ return (_jsx(BaseTransactionButton, { text: getButtonText(), onClick: handleClick, disabled: currentRoute && (isValidating || !isValid) }));
58
58
  };
@@ -1,15 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { DefaultTransactionButton } from '../../components/DefaultTransactionButton';
2
+ import { BaseTransactionButton } from '../../components/BaseTransactionButton';
3
3
  import { useFromTokenSufficiency, useGasSufficiency, useRoutes, } from '../../hooks';
4
- import { useWidgetConfig } from '../../providers';
5
4
  import { useRouteExecutionStore } from '../../stores';
6
5
  export const StartTransactionButton = ({ onClick, route, text, loading, }) => {
7
- const { sdkConfig } = useWidgetConfig();
8
- const isMultisigSigner = sdkConfig?.multisigConfig?.isMultisigSigner;
9
6
  const { insufficientGas, isInitialLoading: isGasSufficiencyLoading } = useGasSufficiency(route);
10
7
  const { insufficientFromToken, isInitialLoading: isFromTokenSufficiencyLoading, } = useFromTokenSufficiency(route);
11
- const shouldDisableButton = !isMultisigSigner && (insufficientFromToken || !!insufficientGas?.length);
12
- return (_jsx(DefaultTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
8
+ const shouldDisableButton = insufficientFromToken || !!insufficientGas?.length;
9
+ return (_jsx(BaseTransactionButton, { onClick: onClick, text: text, disabled: shouldDisableButton, loading: isFromTokenSufficiencyLoading || isGasSufficiencyLoading || loading }));
13
10
  };
14
11
  export const StartInsurableTransactionButton = ({ onClick, text, route, loading, disabled, insurableRouteId }) => {
15
12
  const routeExecution = useRouteExecutionStore((state) => state.routes[insurableRouteId]);
@@ -1,6 +1,6 @@
1
1
  import type { Route } from '@lifi/sdk';
2
- import type { DefaultTransactionButtonProps } from '../../components/DefaultTransactionButton';
3
- export interface StartTransactionButtonProps extends DefaultTransactionButtonProps {
2
+ import type { BaseTransactionButtonProps } from '../../components/BaseTransactionButton';
3
+ export interface StartTransactionButtonProps extends BaseTransactionButtonProps {
4
4
  route?: Route;
5
5
  insurableRouteId: string;
6
6
  }