@lifi/widget 1.14.0 → 1.15.1

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 (146) hide show
  1. package/cjs/components/Header/Header.js +2 -2
  2. package/cjs/components/Header/NavigationHeader.js +5 -7
  3. package/cjs/components/Header/WalletHeader.js +4 -5
  4. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
  5. package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
  6. package/cjs/components/SelectTokenButton/SelectTokenButton.js +3 -3
  7. package/cjs/components/{SwapInProgress/SwapInProgress.d.ts → SendToWallet/SendToWallet.d.ts} +1 -1
  8. package/cjs/components/SendToWallet/SendToWallet.js +53 -0
  9. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +19 -0
  10. package/cjs/components/SendToWallet/SendToWallet.style.js +15 -0
  11. package/cjs/components/SendToWallet/index.d.ts +1 -0
  12. package/cjs/components/{SwapInProgress → SendToWallet}/index.js +1 -1
  13. package/cjs/components/Step/StepTimer.js +1 -1
  14. package/cjs/components/SwapButton/SwapButton.js +11 -8
  15. package/cjs/components/SwapInput/FormPriceHelperText.d.ts +1 -1
  16. package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
  17. package/cjs/components/SwapInput/SwapInput.d.ts +1 -1
  18. package/cjs/components/SwapInput/SwapInput.js +4 -4
  19. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -1
  20. package/cjs/components/SwapInput/SwapInputAdornment.js +4 -4
  21. package/cjs/components/SwapRouteCard/SwapRouteCard.js +4 -3
  22. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
  23. package/cjs/components/SwapsInProgress/SwapsInProgress.d.ts +3 -0
  24. package/cjs/components/SwapsInProgress/SwapsInProgress.js +29 -0
  25. package/cjs/components/{SwapInProgress/SwapInProgress.style.d.ts → SwapsInProgress/SwapsInProgress.style.d.ts} +0 -0
  26. package/cjs/components/{SwapInProgress/SwapInProgress.style.js → SwapsInProgress/SwapsInProgress.style.js} +0 -0
  27. package/cjs/components/SwapsInProgress/index.d.ts +1 -0
  28. package/cjs/components/SwapsInProgress/index.js +17 -0
  29. package/cjs/components/TokenList/TokenList.js +10 -11
  30. package/cjs/components/TokenList/VirtualizedTokenList.js +1 -1
  31. package/cjs/components/TokenList/types.d.ts +1 -1
  32. package/cjs/config/version.d.ts +1 -1
  33. package/cjs/config/version.js +1 -1
  34. package/cjs/hooks/index.d.ts +1 -0
  35. package/cjs/hooks/index.js +1 -0
  36. package/cjs/hooks/useNavigateBack.d.ts +4 -0
  37. package/cjs/hooks/useNavigateBack.js +18 -0
  38. package/cjs/hooks/useSwapRoutes.js +18 -7
  39. package/cjs/i18n/en/translation.json +13 -8
  40. package/cjs/i18n/index.d.ts +11 -6
  41. package/cjs/pages/MainPage/MainPage.js +3 -2
  42. package/cjs/pages/SelectTokenPage/ChainSelect.d.ts +1 -1
  43. package/cjs/pages/SelectTokenPage/ChainSelect.js +11 -12
  44. package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
  45. package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +1 -1
  46. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -6
  47. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +6 -6
  48. package/cjs/pages/SettingsPage/AdvancedPreferences.js +2 -2
  49. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  50. package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
  51. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
  52. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +22 -0
  53. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +3 -2
  54. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  55. package/cjs/pages/SwapPage/StatusBottomSheet.js +4 -5
  56. package/cjs/pages/SwapPage/SwapPage.js +2 -2
  57. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  58. package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
  59. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +10 -4
  60. package/cjs/providers/SwapFormProvider/types.d.ts +3 -1
  61. package/cjs/providers/SwapFormProvider/types.js +1 -0
  62. package/cjs/providers/WalletProvider/WalletProvider.js +10 -4
  63. package/cjs/providers/WalletProvider/types.d.ts +4 -2
  64. package/cjs/providers/index.d.ts +4 -0
  65. package/cjs/providers/index.js +20 -0
  66. package/cjs/stores/settings/types.d.ts +2 -1
  67. package/cjs/stores/settings/useSettingsStore.d.ts +4 -2
  68. package/cjs/stores/settings/useSettingsStore.js +1 -0
  69. package/cjs/types/widget.d.ts +1 -0
  70. package/cjs/utils/format.js +7 -2
  71. package/components/Header/Header.js +1 -1
  72. package/components/Header/NavigationHeader.js +5 -7
  73. package/components/Header/WalletHeader.js +1 -2
  74. package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  75. package/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
  76. package/components/SelectTokenButton/SelectTokenButton.js +1 -1
  77. package/components/{SwapInProgress/SwapInProgress.d.ts → SendToWallet/SendToWallet.d.ts} +1 -1
  78. package/components/SendToWallet/SendToWallet.js +49 -0
  79. package/components/SendToWallet/SendToWallet.style.d.ts +19 -0
  80. package/components/SendToWallet/SendToWallet.style.js +12 -0
  81. package/components/SendToWallet/index.d.ts +1 -0
  82. package/components/SendToWallet/index.js +1 -0
  83. package/components/Step/StepTimer.js +1 -1
  84. package/components/SwapButton/SwapButton.js +9 -6
  85. package/components/SwapInput/FormPriceHelperText.d.ts +1 -1
  86. package/components/SwapInput/FormPriceHelperText.js +1 -1
  87. package/components/SwapInput/SwapInput.d.ts +1 -1
  88. package/components/SwapInput/SwapInput.js +1 -1
  89. package/components/SwapInput/SwapInputAdornment.d.ts +1 -1
  90. package/components/SwapInput/SwapInputAdornment.js +1 -1
  91. package/components/SwapRouteCard/SwapRouteCard.js +4 -3
  92. package/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
  93. package/components/SwapsInProgress/SwapsInProgress.d.ts +3 -0
  94. package/components/{SwapInProgress/SwapInProgress.js → SwapsInProgress/SwapsInProgress.js} +4 -4
  95. package/components/{SwapInProgress/SwapInProgress.style.d.ts → SwapsInProgress/SwapsInProgress.style.d.ts} +0 -0
  96. package/components/{SwapInProgress/SwapInProgress.style.js → SwapsInProgress/SwapsInProgress.style.js} +0 -0
  97. package/components/SwapsInProgress/index.d.ts +1 -0
  98. package/components/SwapsInProgress/index.js +1 -0
  99. package/components/TokenList/TokenList.js +1 -2
  100. package/components/TokenList/VirtualizedTokenList.js +1 -1
  101. package/components/TokenList/types.d.ts +1 -1
  102. package/config/version.d.ts +1 -1
  103. package/config/version.js +1 -1
  104. package/hooks/index.d.ts +1 -0
  105. package/hooks/index.js +1 -0
  106. package/hooks/useNavigateBack.d.ts +4 -0
  107. package/hooks/useNavigateBack.js +14 -0
  108. package/hooks/useSwapRoutes.js +18 -7
  109. package/i18n/en/translation.json +13 -8
  110. package/i18n/index.d.ts +11 -6
  111. package/package.json +9 -12
  112. package/pages/MainPage/MainPage.js +3 -2
  113. package/pages/SelectTokenPage/ChainSelect.d.ts +1 -1
  114. package/pages/SelectTokenPage/ChainSelect.js +9 -10
  115. package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
  116. package/pages/SelectTokenPage/SelectTokenPage.d.ts +1 -1
  117. package/pages/SelectTokenPage/SelectTokenPage.js +3 -7
  118. package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
  119. package/pages/SettingsPage/AdvancedPreferences.js +2 -2
  120. package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
  121. package/pages/SettingsPage/SettingsPage.js +2 -1
  122. package/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
  123. package/pages/SettingsPage/ShowDestinationWallet.js +18 -0
  124. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  125. package/pages/SwapHistoryPage/SwapHistoryPage.js +1 -1
  126. package/pages/SwapPage/StatusBottomSheet.js +4 -5
  127. package/pages/SwapPage/SwapPage.js +4 -4
  128. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  129. package/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
  130. package/providers/SwapFormProvider/SwapFormProvider.js +10 -4
  131. package/providers/SwapFormProvider/types.d.ts +3 -1
  132. package/providers/SwapFormProvider/types.js +1 -0
  133. package/providers/WalletProvider/WalletProvider.js +10 -4
  134. package/providers/WalletProvider/types.d.ts +4 -2
  135. package/providers/index.d.ts +4 -0
  136. package/providers/index.js +4 -0
  137. package/stores/settings/types.d.ts +2 -1
  138. package/stores/settings/useSettingsStore.d.ts +4 -2
  139. package/stores/settings/useSettingsStore.js +1 -0
  140. package/tsconfig.cjs.tsbuildinfo +1 -1
  141. package/types/widget.d.ts +1 -0
  142. package/utils/format.js +7 -2
  143. package/cjs/components/SwapInProgress/SwapInProgress.js +0 -29
  144. package/cjs/components/SwapInProgress/index.d.ts +0 -1
  145. package/components/SwapInProgress/index.d.ts +0 -1
  146. package/components/SwapInProgress/index.js +0 -1
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { isAddress } from '@ethersproject/address';
10
11
  import { useQuery, useQueryClient } from '@tanstack/react-query';
11
12
  import Big from 'big.js';
12
13
  import { useWatch } from 'react-hook-form';
@@ -18,7 +19,7 @@ import { useSettings } from '../stores';
18
19
  const refetchTime = 60000;
19
20
  export const useSwapRoutes = () => {
20
21
  var _a;
21
- const { account } = useWallet();
22
+ const { account, provider } = useWallet();
22
23
  const queryClient = useQueryClient();
23
24
  const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
24
25
  'slippage',
@@ -26,12 +27,13 @@ export const useSwapRoutes = () => {
26
27
  'enabledBridges',
27
28
  'enabledExchanges',
28
29
  ]);
29
- const [fromChainId, fromTokenAddress, toChainId, toTokenAddress] = useWatch({
30
+ const [fromChainId, fromTokenAddress, toChainId, toTokenAddress, toAddress] = useWatch({
30
31
  name: [
31
32
  SwapFormKey.FromChain,
32
33
  SwapFormKey.FromToken,
33
34
  SwapFormKey.ToChain,
34
35
  SwapFormKey.ToToken,
36
+ SwapFormKey.ToAddress,
35
37
  ],
36
38
  });
37
39
  const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount], 250);
@@ -53,6 +55,7 @@ export const useSwapRoutes = () => {
53
55
  fromTokenAmount,
54
56
  toChainId,
55
57
  toTokenAddress,
58
+ toAddress,
56
59
  slippage,
57
60
  enabledBridges,
58
61
  enabledExchanges,
@@ -62,16 +65,24 @@ export const useSwapRoutes = () => {
62
65
  const refetchInterval = previousDataUpdatedAt
63
66
  ? Math.min(Math.abs(refetchTime - (Date.now() - previousDataUpdatedAt)), refetchTime)
64
67
  : refetchTime;
65
- const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = useQuery(queryKey, ({ queryKey: [_, address, fromChainId, fromTokenAddress, fromTokenAmount, toChainId, toTokenAddress, slippage, enabledBridges, enabledExchanges, routePriority,], signal, }) => __awaiter(void 0, void 0, void 0, function* () {
66
- var _b;
68
+ const { data, isLoading, isFetching, isFetched, dataUpdatedAt, refetch } = useQuery(queryKey, ({ queryKey: [_, fromAddress, fromChainId, fromTokenAddress, fromTokenAmount, toChainId, toTokenAddress, toAddress, slippage, enabledBridges, enabledExchanges, routePriority,], signal, }) => __awaiter(void 0, void 0, void 0, function* () {
69
+ var _b, _c;
70
+ let toWalletAddress;
71
+ try {
72
+ toWalletAddress =
73
+ (_b = (yield (provider === null || provider === void 0 ? void 0 : provider.resolveName(toAddress)))) !== null && _b !== void 0 ? _b : (isAddress(toAddress) ? toAddress : fromAddress);
74
+ }
75
+ catch (_d) {
76
+ toWalletAddress = isAddress(toAddress) ? toAddress : fromAddress;
77
+ }
67
78
  return LiFi.getRoutes({
68
79
  fromChainId,
69
- fromAmount: Big(Number(fromTokenAmount) * Math.pow(10, ((_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 0))).toString(),
80
+ fromAmount: Big(Number(fromTokenAmount) * Math.pow(10, ((_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 0))).toString(),
70
81
  fromTokenAddress,
71
82
  toChainId,
72
83
  toTokenAddress,
73
- fromAddress: address,
74
- toAddress: address,
84
+ fromAddress,
85
+ toAddress: toWalletAddress,
75
86
  options: {
76
87
  slippage: slippage / 100,
77
88
  bridges: {
@@ -52,24 +52,26 @@
52
52
  "selectChainAndToken": "Select chain and token",
53
53
  "featuredTokens": "Featured tokens",
54
54
  "otherTokens": "Other tokens",
55
- "inProgress": "In progress",
55
+ "inProgress": "in progress",
56
+ "activeTransfers": "Active transfers",
56
57
  "couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
57
58
  "stepSwap": "Swap",
58
59
  "stepBridge": "Bridge",
59
60
  "stepSwapAndBridge": "Swap and bridge",
60
61
  "estimatedTime": "~{{value}} min.",
61
- "networkIsBusy": "Network is busy...",
62
62
  "crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
63
63
  "swapStepDetails": "Swap on {{chain}} via {{tool}}",
64
64
  "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
65
65
  "tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
66
66
  "routeId": "Route ID",
67
+ "sendToWallet": "Send to a different wallet",
68
+ "walletAddressOrEns": "Wallet address or ENS name",
67
69
  "tags": {
68
- "recommended": "Recommended",
69
- "fastest": "Fast",
70
- "cheapest": "Cheap",
71
- "safest": "Safe",
72
- "general": "General"
70
+ "RECOMMENDED": "RECOMMENDED",
71
+ "FASTEST": "FAST",
72
+ "CHEAPEST": "CHEAP",
73
+ "SAFEST": "SAFE",
74
+ "ALTERNATIVE": "ALTERNATIVE"
73
75
  },
74
76
  "success": {
75
77
  "title": {
@@ -109,7 +111,9 @@
109
111
  "transactionUnprepared": "Unable to prepare transaction.",
110
112
  "unknown": "Something went wrong.",
111
113
  "userRejectedSignatureRequest": "Signature required.",
112
- "slippageTooLarge": "Slippage too large."
114
+ "slippageTooLarge": "Slippage too large.",
115
+ "walletAddressInvalid": "Wallet address is invalid.",
116
+ "walletEnsAddressInvalid": "Wallet address is invalid or network doesn't support ENS."
113
117
  },
114
118
  "message": {
115
119
  "signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
@@ -156,6 +160,7 @@
156
160
  "fast": "Fast"
157
161
  },
158
162
  "advancedPreferences": "Advanced preferences",
163
+ "showDestinationWallet": "Show destination wallet",
159
164
  "enabledBridges": "Enabled bridges",
160
165
  "selectEnabledBridges": "Select enabled bridges",
161
166
  "enabledExchanges": "Enabled exchanges",
package/i18n/index.d.ts CHANGED
@@ -56,23 +56,25 @@ export declare const resources: {
56
56
  featuredTokens: string;
57
57
  otherTokens: string;
58
58
  inProgress: string;
59
+ activeTransfers: string;
59
60
  couldntFindTokens: string;
60
61
  stepSwap: string;
61
62
  stepBridge: string;
62
63
  stepSwapAndBridge: string;
63
64
  estimatedTime: string;
64
- networkIsBusy: string;
65
65
  crossStepDetails: string;
66
66
  swapStepDetails: string;
67
67
  tokenOnChain: string;
68
68
  tokenOnChainAmount: string;
69
69
  routeId: string;
70
+ sendToWallet: string;
71
+ walletAddressOrEns: string;
70
72
  tags: {
71
- recommended: string;
72
- fastest: string;
73
- cheapest: string;
74
- safest: string;
75
- general: string;
73
+ RECOMMENDED: string;
74
+ FASTEST: string;
75
+ CHEAPEST: string;
76
+ SAFEST: string;
77
+ ALTERNATIVE: string;
76
78
  };
77
79
  success: {
78
80
  title: {
@@ -113,6 +115,8 @@ export declare const resources: {
113
115
  unknown: string;
114
116
  userRejectedSignatureRequest: string;
115
117
  slippageTooLarge: string;
118
+ walletAddressInvalid: string;
119
+ walletEnsAddressInvalid: string;
116
120
  };
117
121
  message: {
118
122
  signatureRequired: string;
@@ -159,6 +163,7 @@ export declare const resources: {
159
163
  fast: string;
160
164
  };
161
165
  advancedPreferences: string;
166
+ showDestinationWallet: string;
162
167
  enabledBridges: string;
163
168
  selectEnabledBridges: string;
164
169
  enabledExchanges: string;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
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",
7
+ "types": "./index.d.ts",
7
8
  "lint-staged": {
8
9
  "src/**/*.{ts,tsx}": [
9
10
  "yarn run lint:fix",
@@ -38,13 +39,14 @@
38
39
  "dependencies": {
39
40
  "@emotion/react": "^11.10.0",
40
41
  "@emotion/styled": "^11.10.0",
42
+ "@ethersproject/address": "^5.7.0",
41
43
  "@ethersproject/experimental": "^5.7.0",
42
44
  "@ethersproject/providers": "^5.7.0",
43
- "@lifi/sdk": "^1.2.1",
44
- "@lifi/wallet-management": "^1.1.7",
45
- "@mui/icons-material": "^5.8.4",
46
- "@mui/lab": "^5.0.0-alpha.95",
47
- "@mui/material": "^5.10.1",
45
+ "@lifi/sdk": "^1.2.2",
46
+ "@lifi/wallet-management": "^1.1.8",
47
+ "@mui/icons-material": "^5.10.2",
48
+ "@mui/lab": "^5.0.0-alpha.96",
49
+ "@mui/material": "^5.10.2",
48
50
  "@sentry/integrations": "^7.11.1",
49
51
  "@sentry/react": "^7.11.1",
50
52
  "@sentry/tracing": "^7.11.1",
@@ -75,10 +77,5 @@
75
77
  "extends": "../../.eslintrc"
76
78
  },
77
79
  "sideEffects": false,
78
- "private": false,
79
- "types": "./index.d.ts",
80
- "exports": {
81
- "require": "./cjs/index.js",
82
- "import": "./index.js"
83
- }
80
+ "private": false
84
81
  }
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box } from '@mui/material';
3
3
  import { SelectChainAndToken } from '../../components/SelectChainAndToken';
4
- import { SwapInProgress } from '../../components/SwapInProgress';
4
+ import { SendToWallet } from '../../components/SendToWallet';
5
5
  import { SwapInput } from '../../components/SwapInput';
6
+ import { SwapsInProgress } from '../../components/SwapsInProgress';
6
7
  import { FormContainer } from './MainPage.style';
7
8
  import { MainSwapButton } from './MainSwapButton';
8
9
  import { SwapRoutes } from './SwapRoutes';
9
10
  export const MainPage = () => {
10
- return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapInProgress, { mx: 3, mt: 1, mb: 2 }), _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(MainSwapButton, {}) }))] })));
11
+ return (_jsxs(FormContainer, Object.assign({ disableGutters: true }, { children: [_jsx(SwapsInProgress, { mx: 3, mt: 1, mb: 2 }), _jsx(SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 3 }, { children: _jsx(SwapInput, { formType: "from" }) })), _jsx(SendToWallet, { mx: 3, mb: 3 }), _jsx(SwapRoutes, { mx: 3, mb: 3 }), _jsx(Box, Object.assign({ mx: 3, mb: 1 }, { children: _jsx(MainSwapButton, {}) }))] })));
11
12
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import type { SwapFormTypeProps } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormTypeProps } from '../../providers';
3
3
  export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -6,8 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import { Card, CardTitle } from '../../components/Card';
7
7
  import { Select } from '../../components/Select';
8
8
  import { useChains } from '../../hooks';
9
- import { SwapFormKey, SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
10
- import { useWidgetConfig } from '../../providers/WidgetProvider';
9
+ import { SwapFormKey, SwapFormKeyHelper, useWidgetConfig, } from '../../providers';
11
10
  export const ChainSelect = ({ formType }) => {
12
11
  const { t } = useTranslation();
13
12
  const { setValue, register } = useFormContext();
@@ -17,12 +16,12 @@ export const ChainSelect = ({ formType }) => {
17
16
  const [chainId] = useWatch({
18
17
  name: [chainKey],
19
18
  });
20
- const { onChange, onBlur, name, ref } = register(chainKey);
21
- const handleChain = (event) => {
22
- onChange(event);
23
- setValue(SwapFormKeyHelper.getTokenKey(formType), '');
24
- setValue(SwapFormKeyHelper.getAmountKey(formType), '');
25
- setValue(SwapFormKey.TokenSearchFilter, '');
26
- };
27
- return !isLoading ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ ref: ref, labelId: chainKey, name: name, MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, onBlur: onBlur, IconComponent: KeyboardArrowDownIcon }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(MenuItem, Object.assign({ value: chain.id }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key }, { children: chain.name[0] })) }), chain.name] }), chain.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 98, sx: { borderRadius: 1 } }));
19
+ const { onChange, onBlur, name, ref } = register(chainKey, {
20
+ onChange: () => {
21
+ setValue(SwapFormKeyHelper.getTokenKey(formType), '');
22
+ setValue(SwapFormKeyHelper.getAmountKey(formType), '');
23
+ setValue(SwapFormKey.TokenSearchFilter, '');
24
+ },
25
+ });
26
+ return !isLoading ? (_jsxs(Card, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ ref: ref, labelId: chainKey, name: name, MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: onChange, onBlur: onBlur, IconComponent: KeyboardArrowDownIcon }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => (_jsxs(MenuItem, Object.assign({ value: chain.id }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key }, { children: chain.name[0] })) }), chain.name] }), chain.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 98, sx: { borderRadius: 1 } }));
28
27
  };
@@ -5,7 +5,7 @@ import { useEffect } from 'react';
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { Card } from '../../components/Card';
8
- import { SwapFormKey } from '../../providers/SwapFormProvider';
8
+ import { SwapFormKey } from '../../providers';
9
9
  import { Input } from './SearchTokenInput.style';
10
10
  export const SearchTokenInput = () => {
11
11
  const { t } = useTranslation();
@@ -1,5 +1,5 @@
1
1
  import type { FC } from 'react';
2
- import type { SwapFormDirection } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormDirection } from '../../providers';
3
3
  export declare const SelectTokenPage: FC<{
4
4
  formType: SwapFormDirection;
5
5
  }>;
@@ -1,23 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Container } from '@mui/material';
3
3
  import { useLayoutEffect, useRef, useState } from 'react';
4
- import { useNavigate } from 'react-router-dom';
5
4
  import { TokenList } from '../../components/TokenList';
6
- import { useContentHeight, useScrollableOverflowHidden } from '../../hooks';
5
+ import { useContentHeight, useNavigateBack, useScrollableOverflowHidden, } from '../../hooks';
7
6
  import { ChainSelect } from './ChainSelect';
8
7
  import { SearchTokenInput } from './SearchTokenInput';
9
8
  export const SelectTokenPage = ({ formType, }) => {
10
9
  useScrollableOverflowHidden();
11
- const navigate = useNavigate();
10
+ const { navigateBack } = useNavigateBack();
12
11
  const headerRef = useRef(null);
13
12
  const contentHeight = useContentHeight();
14
13
  const [headerHeight, setHeaderHeight] = useState(0);
15
- const handleTokenClick = () => {
16
- navigate(-1);
17
- };
18
14
  useLayoutEffect(() => {
19
15
  var _a, _b;
20
16
  setHeaderHeight(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0));
21
17
  }, [contentHeight]);
22
- return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [_jsx(ChainSelect, { formType: formType }), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(SearchTokenInput, {}) }))] })), _jsx(TokenList, { height: headerHeight, onClick: handleTokenClick, formType: formType })] })));
18
+ return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [_jsx(ChainSelect, { formType: formType }), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(SearchTokenInput, {}) }))] })), _jsx(TokenList, { height: headerHeight, onClick: navigateBack, formType: formType })] })));
23
19
  };
@@ -12,14 +12,14 @@ import { supportedWallets } from '@lifi/wallet-management';
12
12
  import { Avatar, Button, Container, DialogActions, DialogContent, DialogContentText, List, ListItemAvatar, } from '@mui/material';
13
13
  import { useCallback, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { useNavigate } from 'react-router-dom';
16
15
  import { Dialog } from '../../components/Dialog';
17
- import { useWallet } from '../../providers/WalletProvider';
16
+ import { useNavigateBack } from '../../hooks';
17
+ import { useWallet } from '../../providers';
18
18
  import { WalletListItemButton, WalletListItemText, } from './SelectWalletPage.style';
19
19
  export const SelectWalletPage = () => {
20
20
  var _a;
21
21
  const { t } = useTranslation();
22
- const navigate = useNavigate();
22
+ const { navigateBack } = useNavigateBack();
23
23
  const { connect } = useWallet();
24
24
  const [walletIdentity, setWalletIdentity] = useState({ show: false });
25
25
  const closeDialog = () => {
@@ -37,9 +37,9 @@ export const SelectWalletPage = () => {
37
37
  });
38
38
  return;
39
39
  }
40
- navigate(-1);
40
+ navigateBack();
41
41
  yield connect(wallet);
42
- }), [connect, navigate]);
42
+ }), [connect, navigateBack]);
43
43
  return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsx(List, Object.assign({ sx: {
44
44
  paddingLeft: 2,
45
45
  paddingRight: 2,
@@ -12,9 +12,9 @@ export const AdvancedPreferences = () => {
12
12
  const handleAdvancedPreferences = (_, checked) => {
13
13
  setValue('advancedPreferences', checked);
14
14
  };
15
- return (_jsxs(Box, Object.assign({ px: 3, pt: 3 }, { children: [_jsxs(Box, Object.assign({ sx: {
15
+ return (_jsxs(Box, Object.assign({ px: 3, pt: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
16
16
  display: 'flex',
17
17
  justifyContent: 'space-between',
18
18
  alignItems: 'center',
19
- } }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: _jsx(Typography, Object.assign({ variant: "subtitle1", color: "text.primary", lineHeight: "normal" }, { children: t(`settings.advancedPreferences`) })) })), _jsx(Switch, { checked: advancedPreferences, onChange: handleAdvancedPreferences })] })), advancedPreferences && (_jsxs(Box, Object.assign({ mt: 3, mb: 1 }, { children: [_jsx(EnabledBridgesSelect, {}), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EnabledExchangesSelect, {}) }))] })))] })));
19
+ } }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: _jsx(Typography, Object.assign({ variant: "subtitle1", color: "text.primary", lineHeight: "normal" }, { children: t(`settings.advancedPreferences`) })) })), _jsx(Switch, { checked: advancedPreferences, onChange: handleAdvancedPreferences })] })), advancedPreferences && (_jsxs(Box, Object.assign({ mt: 2, mb: 1 }, { children: [_jsx(EnabledBridgesSelect, {}), _jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EnabledExchangesSelect, {}) }))] })))] })));
20
20
  };
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Brightness4 as Brightness4Icon, DarkMode as DarkModeIcon, LightMode as LightModeIcon, } from '@mui/icons-material';
3
3
  import { Box, ToggleButtonGroup } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { useWidgetConfig } from '../../providers/WidgetProvider';
5
+ import { useWidgetConfig } from '../../providers';
6
6
  import { useAppearance } from '../../stores';
7
7
  import { ToggleButton } from './ColorSchemeButtonGroup.style';
8
8
  export const ColorSchemeButtonGroup = () => {
@@ -4,7 +4,8 @@ import { AdvancedPreferences } from './AdvancedPreferences';
4
4
  import { ColorSchemeButtonGroup } from './ColorSchemeButtonGroup';
5
5
  import { GasPriceSelect } from './GasPriceSelect';
6
6
  import { RoutePrioritySelect } from './RoutePrioritySelect';
7
+ import { ShowDestinationWallet } from './ShowDestinationWallet';
7
8
  import { SlippageInput } from './SlippageInput';
8
9
  export const SettingsPage = () => {
9
- return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ px: 3, pt: 1 }, { children: [_jsx(ColorSchemeButtonGroup, {}), _jsx(RoutePrioritySelect, {}), _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mt: 2 }, { children: [_jsx(Box, Object.assign({ pr: 2, flex: 1 }, { children: _jsx(SlippageInput, {}) })), _jsx(GasPriceSelect, {})] }))] })), _jsx(AdvancedPreferences, {})] })));
10
+ return (_jsxs(Container, Object.assign({ disableGutters: true }, { children: [_jsxs(Box, Object.assign({ px: 3, pt: 1 }, { children: [_jsx(ColorSchemeButtonGroup, {}), _jsx(RoutePrioritySelect, {}), _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mt: 2 }, { children: [_jsx(Box, Object.assign({ pr: 2, flex: 1 }, { children: _jsx(SlippageInput, {}) })), _jsx(GasPriceSelect, {})] }))] })), _jsx(ShowDestinationWallet, {}), _jsx(AdvancedPreferences, {})] })));
10
11
  };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ShowDestinationWallet: () => JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Typography } from '@mui/material';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Switch } from '../../components/Switch';
5
+ import { useSetSettings, useSettings } from '../../stores';
6
+ export const ShowDestinationWallet = () => {
7
+ const { t } = useTranslation();
8
+ const [setValue] = useSetSettings();
9
+ const { showDestinationWallet } = useSettings(['showDestinationWallet']);
10
+ const onChange = (_, checked) => {
11
+ setValue('showDestinationWallet', checked);
12
+ };
13
+ return (_jsx(Box, Object.assign({ px: 3, pt: 2 }, { children: _jsxs(Box, Object.assign({ sx: {
14
+ display: 'flex',
15
+ justifyContent: 'space-between',
16
+ alignItems: 'center',
17
+ } }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: _jsx(Typography, Object.assign({ variant: "subtitle1", color: "text.primary", lineHeight: "normal" }, { children: t(`settings.showDestinationWallet`) })) })), _jsx(Switch, { checked: showDestinationWallet, onChange: onChange })] })) })));
18
+ };
@@ -12,19 +12,20 @@ import { ContentCopy as ContentCopyIcon, DeleteOutline as DeleteIcon, } from '@m
12
12
  import { Box, Button, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton, Typography, } from '@mui/material';
13
13
  import { Fragment, useCallback, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { useLocation, useNavigate } from 'react-router-dom';
15
+ import { useLocation } from 'react-router-dom';
16
16
  import shallow from 'zustand/shallow';
17
17
  import { Card, CardTitle } from '../../components/Card';
18
18
  import { Dialog } from '../../components/Dialog';
19
19
  import { useSetHeaderAction } from '../../components/Header';
20
20
  import { Step } from '../../components/Step';
21
21
  import { StepDivider } from '../../components/StepDivider';
22
+ import { useNavigateBack } from '../../hooks';
22
23
  import { useRouteStore } from '../../stores';
23
24
  import { Container } from './SwapDetailsPage.style';
24
25
  export const SwapDetailsPage = () => {
25
26
  var _a, _b;
26
27
  const { t } = useTranslation();
27
- const navigate = useNavigate();
28
+ const { navigateBack } = useNavigateBack();
28
29
  const setHeaderAction = useSetHeaderAction();
29
30
  const { state } = useLocation();
30
31
  const [routeExecution, deleteRoute] = useRouteStore((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow);
@@ -33,7 +34,7 @@ export const SwapDetailsPage = () => {
33
34
  setOpen((open) => !open);
34
35
  }, []);
35
36
  const handleDeleteRoute = () => {
36
- navigate(-1);
37
+ navigateBack();
37
38
  if (routeExecution) {
38
39
  deleteRoute(routeExecution.route.id);
39
40
  }
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useState } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { Dialog } from '../../components/Dialog';
7
7
  import { useSetHeaderAction } from '../../components/Header';
8
- import { useWallet } from '../../providers/WalletProvider';
8
+ import { useWallet } from '../../providers';
9
9
  import { useRouteStore } from '../../stores';
10
10
  import { useSwapHistory } from '../../stores/route';
11
11
  import { SwapHistoryEmpty } from './SwapHistoryEmpty';
@@ -4,17 +4,16 @@ import { Box, Button, Typography } from '@mui/material';
4
4
  import { useEffect, useMemo, useRef } from 'react';
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { useNavigate } from 'react-router-dom';
8
7
  import { BottomSheet } from '../../components/BottomSheet';
9
8
  import { Token } from '../../components/Token';
10
- import { useChains, useTokenBalance } from '../../hooks';
11
- import { SwapFormKey } from '../../providers/SwapFormProvider';
9
+ import { useChains, useNavigateBack, useTokenBalance } from '../../hooks';
10
+ import { SwapFormKey } from '../../providers';
12
11
  import { IconCircle, IconContainer, iconStyles, } from './StatusBottomSheet.style';
13
12
  import { getProcessMessage } from './utils';
14
13
  export const StatusBottomSheet = ({ status, route, }) => {
15
14
  var _a, _b, _c, _d, _e;
16
15
  const { t } = useTranslation();
17
- const navigate = useNavigate();
16
+ const { navigateBack } = useNavigateBack();
18
17
  const ref = useRef(null);
19
18
  const { getChainById } = useChains();
20
19
  const { token, refetch: refetchBalance } = useTokenBalance(route.toChainId, route.toToken.address);
@@ -25,7 +24,7 @@ export const StatusBottomSheet = ({ status, route, }) => {
25
24
  };
26
25
  const handleDone = () => {
27
26
  clearFromAmount();
28
- navigate(-1);
27
+ navigateBack();
29
28
  };
30
29
  const handleClose = () => {
31
30
  var _a;
@@ -2,21 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Button } from '@mui/material';
3
3
  import { Fragment } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { useLocation, useNavigate } from 'react-router-dom';
5
+ import { useLocation } from 'react-router-dom';
6
6
  import { GasSufficiencyMessage } from '../../components/GasSufficiencyMessage';
7
7
  import { Step } from '../../components/Step';
8
8
  import { StepDivider } from '../../components/StepDivider';
9
9
  import { SwapButton } from '../../components/SwapButton';
10
- import { useRouteExecution } from '../../hooks';
10
+ import { useNavigateBack, useRouteExecution } from '../../hooks';
11
11
  import { StatusBottomSheet } from './StatusBottomSheet';
12
12
  import { Container } from './SwapPage.style';
13
13
  export const SwapPage = () => {
14
14
  const { t } = useTranslation();
15
15
  const { state } = useLocation();
16
- const navigate = useNavigate();
16
+ const { navigateBack } = useNavigateBack();
17
17
  const { route, status, executeRoute, restartRoute, deleteRoute } = useRouteExecution(state === null || state === void 0 ? void 0 : state.routeId);
18
18
  const handleRemoveRoute = () => {
19
- navigate(-1);
19
+ navigateBack();
20
20
  deleteRoute();
21
21
  };
22
22
  const handleSwapClick = () => {
@@ -12,7 +12,7 @@ export const SwapRoutesPage = () => {
12
12
  const navigate = useNavigate();
13
13
  const { pathname } = useLocation();
14
14
  const setHeaderAction = useSetHeaderAction();
15
- const { routes: swapRoutes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
15
+ const { routes: swapRoutes, isLoading, isFetching, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
16
16
  const setExecutableRoute = useSetExecutableRoute();
17
17
  const handleRouteClick = (route) => {
18
18
  setExecutableRoute(route);
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const formDefaultValues: {
3
3
  fromAmount: string;
4
+ toAddress: string;
4
5
  tokenSearchFilter: string;
5
6
  };
6
7
  export declare const SwapFormProvider: React.FC<React.PropsWithChildren<{}>>;
@@ -7,15 +7,17 @@ import { useWidgetConfig } from '../WidgetProvider';
7
7
  import { SwapFormKey } from './types';
8
8
  export const formDefaultValues = {
9
9
  [SwapFormKey.FromAmount]: '',
10
+ [SwapFormKey.ToAddress]: '',
10
11
  [SwapFormKey.TokenSearchFilter]: '',
11
12
  };
12
13
  export const SwapFormProvider = ({ children, }) => {
13
14
  const { account } = useWallet();
14
- const { fromChain, fromToken, fromAmount, toChain, toToken } = useWidgetConfig();
15
+ const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress } = useWidgetConfig();
15
16
  const methods = useForm({
16
17
  defaultValues: Object.assign(Object.assign({}, formDefaultValues), { fromChain: fromChain !== null && fromChain !== void 0 ? fromChain : ChainId.ETH, fromToken, fromAmount: (typeof fromAmount === 'number'
17
18
  ? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
18
- : fromAmount) || formDefaultValues.fromAmount, toChain: toChain !== null && toChain !== void 0 ? toChain : ChainId.ETH, toToken }),
19
+ : fromAmount) || formDefaultValues.fromAmount, toChain: toChain !== null && toChain !== void 0 ? toChain : ChainId.ETH, toToken,
20
+ toAddress }),
19
21
  });
20
22
  // Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
21
23
  useEffect(() => {
@@ -23,14 +25,18 @@ export const SwapFormProvider = ({ children, }) => {
23
25
  return;
24
26
  }
25
27
  const { isDirty: isFromChainDirty, isTouched: isFromChainTouched } = methods.getFieldState(SwapFormKey.FromChain, methods.formState);
28
+ const { isDirty: isToChainDirty, isTouched: isToChainTouched } = methods.getFieldState(SwapFormKey.ToChain, methods.formState);
26
29
  if (!fromChain && !isFromChainDirty && !isFromChainTouched) {
27
30
  methods.setValue(SwapFormKey.FromChain, account.chainId, {
28
31
  shouldDirty: false,
29
32
  shouldTouch: false,
30
33
  });
31
34
  }
32
- const { isDirty: isToChainDirty, isTouched: isToChainTouched } = methods.getFieldState(SwapFormKey.ToChain, methods.formState);
33
- if (!toChain && !isToChainDirty && !isToChainTouched) {
35
+ if (!toChain &&
36
+ !isToChainDirty &&
37
+ !isToChainTouched &&
38
+ !isFromChainDirty &&
39
+ !isFromChainTouched) {
34
40
  methods.setValue(SwapFormKey.ToChain, account.chainId, {
35
41
  shouldDirty: false,
36
42
  shouldTouch: false,
@@ -4,7 +4,8 @@ export declare enum SwapFormKey {
4
4
  FromToken = "fromToken",
5
5
  TokenSearchFilter = "tokenSearchFilter",
6
6
  ToChain = "toChain",
7
- ToToken = "toToken"
7
+ ToToken = "toToken",
8
+ ToAddress = "toAddress"
8
9
  }
9
10
  export declare type SwapFormValues = {
10
11
  [SwapFormKey.FromAmount]: string;
@@ -13,6 +14,7 @@ export declare type SwapFormValues = {
13
14
  [SwapFormKey.TokenSearchFilter]: string;
14
15
  [SwapFormKey.ToChain]: number;
15
16
  [SwapFormKey.ToToken]: string;
17
+ [SwapFormKey.ToAddress]: string;
16
18
  };
17
19
  export declare type SwapFormDirection = 'from' | 'to';
18
20
  export declare const SwapFormKeyHelper: {
@@ -6,6 +6,7 @@ export var SwapFormKey;
6
6
  SwapFormKey["TokenSearchFilter"] = "tokenSearchFilter";
7
7
  SwapFormKey["ToChain"] = "toChain";
8
8
  SwapFormKey["ToToken"] = "toToken";
9
+ SwapFormKey["ToAddress"] = "toAddress";
9
10
  })(SwapFormKey || (SwapFormKey = {}));
10
11
  export const SwapFormKeyHelper = {
11
12
  getChainKey: (formType) => `${formType}Chain`,