@lifi/widget 1.1.1 → 1.2.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.
- package/App.js +2 -1
- package/AppDrawer.d.ts +1 -1
- package/AppProvider.d.ts +1 -1
- package/AppProvider.js +7 -2
- package/components/Header/Header.js +1 -1
- package/components/Header/NavigationHeader.js +5 -3
- package/components/Header/WalletHeader.js +1 -1
- package/components/Initializer.d.ts +2 -0
- package/components/Initializer.js +5 -0
- package/components/StepToken.js +1 -1
- package/components/SwapButton/SwapButton.js +5 -2
- package/components/SwapInProgress/SwapInProgress.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +2 -1
- package/components/TextFitter/TextFitter.js +9 -5
- package/fonts/Inter-Black.woff +0 -0
- package/fonts/Inter-Black.woff2 +0 -0
- package/fonts/Inter-BlackItalic.woff +0 -0
- package/fonts/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter-Bold.woff +0 -0
- package/fonts/Inter-Bold.woff2 +0 -0
- package/fonts/Inter-BoldItalic.woff +0 -0
- package/fonts/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter-ExtraBold.woff +0 -0
- package/fonts/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter-ExtraBoldItalic.woff +0 -0
- package/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter-ExtraLight.woff +0 -0
- package/fonts/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter-ExtraLightItalic.woff +0 -0
- package/fonts/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter-Italic.woff +0 -0
- package/fonts/Inter-Italic.woff2 +0 -0
- package/fonts/Inter-Light.woff +0 -0
- package/fonts/Inter-Light.woff2 +0 -0
- package/fonts/Inter-LightItalic.woff +0 -0
- package/fonts/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter-Medium.woff +0 -0
- package/fonts/Inter-Medium.woff2 +0 -0
- package/fonts/Inter-MediumItalic.woff +0 -0
- package/fonts/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter-Regular.woff +0 -0
- package/fonts/Inter-Regular.woff2 +0 -0
- package/fonts/Inter-SemiBold.woff +0 -0
- package/fonts/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter-SemiBoldItalic.woff +0 -0
- package/fonts/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter-Thin.woff +0 -0
- package/fonts/Inter-Thin.woff2 +0 -0
- package/fonts/Inter-ThinItalic.woff +0 -0
- package/fonts/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter-italic.var.woff2 +0 -0
- package/fonts/Inter-roman.var.woff2 +0 -0
- package/fonts/Inter.var.woff2 +0 -0
- package/fonts/inter.css +200 -0
- package/hooks/index.d.ts +1 -3
- package/hooks/index.js +1 -3
- package/hooks/useContentHeight.js +18 -10
- package/hooks/useHasSufficientBalance.js +1 -1
- package/hooks/useInitializer.d.ts +1 -0
- package/hooks/useInitializer.js +5 -0
- package/hooks/{useRouteExecution/useRouteExecution.d.ts → useRouteExecution.d.ts} +1 -1
- package/hooks/{useRouteExecution/useRouteExecution.js → useRouteExecution.js} +5 -5
- package/hooks/useSwapRoutes.js +9 -7
- package/hooks/useTools.d.ts +1 -0
- package/hooks/useTools.js +14 -0
- package/i18n/en/translation.json +134 -136
- package/i18n/index.d.ts +0 -2
- package/icons/LiFiFullLogo.svg +10 -0
- package/icons/LiFiLogo.svg +5 -0
- package/package.json +7 -6
- package/pages/SelectTokenPage/ChainSelect.js +1 -1
- package/pages/SettingsPage/AdvancedPreferences.js +5 -4
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +11 -6
- package/pages/SettingsPage/EnabledExchangesSelect.js +10 -6
- package/pages/SettingsPage/GasPriceSelect.js +4 -4
- package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
- package/pages/SettingsPage/SlippageInput.js +7 -10
- package/pages/SwapPage/ExecutionItem.js +1 -1
- package/pages/SwapPage/StatusBottomSheet.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/pages/SwapPage/StepItem.js +1 -1
- package/pages/SwapPage/StepTimer.js +3 -2
- package/pages/SwapRoutesPage/SwapRoutesPage.js +2 -1
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +0 -3
- package/providers/SwapFormProvider/SwapFormProvider.js +0 -3
- package/providers/SwapFormProvider/types.d.ts +0 -19
- package/providers/SwapFormProvider/types.js +0 -9
- package/providers/ThemeProvider/ThemeProvider.js +1 -1
- package/providers/WidgetProvider/WidgetProvider.js +3 -5
- package/providers/WidgetProvider/types.d.ts +3 -3
- package/stores/index.d.ts +2 -0
- package/stores/index.js +2 -0
- package/stores/route/index.d.ts +5 -0
- package/stores/route/index.js +5 -0
- package/{hooks/useRouteExecution → stores/route}/types.d.ts +0 -0
- package/{hooks/useRouteExecution → stores/route}/types.js +0 -0
- package/stores/route/useCurrentRoute.d.ts +2 -0
- package/stores/route/useCurrentRoute.js +5 -0
- package/stores/route/useExecutingRoutes.d.ts +1 -0
- package/stores/route/useExecutingRoutes.js +4 -0
- package/{hooks/useRouteExecution → stores/route}/useRouteStore.d.ts +3 -5
- package/{hooks/useRouteExecution → stores/route}/useRouteStore.js +16 -26
- package/stores/route/useSetExecutableRoute.d.ts +1 -0
- package/stores/route/useSetExecutableRoute.js +4 -0
- package/stores/settings/index.d.ts +5 -0
- package/stores/settings/index.js +5 -0
- package/stores/settings/types.d.ts +23 -0
- package/stores/settings/types.js +1 -0
- package/stores/settings/useAppearance.d.ts +2 -0
- package/stores/settings/useAppearance.js +7 -0
- package/stores/settings/useSetSettings.d.ts +5 -0
- package/stores/settings/useSetSettings.js +5 -0
- package/stores/settings/useSettings.d.ts +2 -0
- package/stores/settings/useSettings.js +8 -0
- package/stores/settings/useSettingsStore.d.ts +25 -0
- package/stores/settings/useSettingsStore.js +84 -0
- package/types/widget.d.ts +31 -23
- package/utils/format.d.ts +1 -1
- package/utils/format.js +1 -1
- package/utils/routes.d.ts +1 -0
- package/utils/routes.js +7 -6
- package/hooks/useBridges.d.ts +0 -1
- package/hooks/useBridges.js +0 -12
- package/hooks/useExchanges.d.ts +0 -1
- package/hooks/useExchanges.js +0 -12
- package/hooks/useRouteExecution/index.d.ts +0 -3
- package/hooks/useRouteExecution/index.js +0 -3
- package/hooks/useSettings/index.d.ts +0 -2
- package/hooks/useSettings/index.js +0 -2
- package/hooks/useSettings/types.d.ts +0 -5
- package/hooks/useSettings/types.js +0 -1
- package/hooks/useSettings/useSettingsStore.d.ts +0 -13
- package/hooks/useSettings/useSettingsStore.js +0 -22
- package/i18n/react-i18next.d.ts +0 -9
- package/pages/MainPage/SendToRecipientForm.d.ts +0 -2
- package/pages/MainPage/SendToRecipientForm.js +0 -20
- package/react-app-env.d.ts +0 -1
package/hooks/useSwapRoutes.js
CHANGED
|
@@ -14,23 +14,25 @@ import { useDebouncedWatch, useToken } from '.';
|
|
|
14
14
|
import { LiFi } from '../lifi';
|
|
15
15
|
import { SwapFormKey } from '../providers/SwapFormProvider';
|
|
16
16
|
import { useWallet } from '../providers/WalletProvider';
|
|
17
|
-
import { useCurrentRoute } from '
|
|
17
|
+
import { useCurrentRoute, useSettings } from '../stores';
|
|
18
18
|
const refetchTime = 60000;
|
|
19
19
|
export const useSwapRoutes = () => {
|
|
20
20
|
var _a;
|
|
21
21
|
const { account } = useWallet();
|
|
22
22
|
const queryClient = useQueryClient();
|
|
23
23
|
const [currentRoute, setCurrentRoute] = useCurrentRoute();
|
|
24
|
-
const
|
|
24
|
+
const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
|
|
25
|
+
'slippage',
|
|
26
|
+
'routePriority',
|
|
27
|
+
'enabledBridges',
|
|
28
|
+
'enabledExchanges',
|
|
29
|
+
]);
|
|
30
|
+
const [fromChainId, fromTokenAddress, toChainId, toTokenAddress] = useWatch({
|
|
25
31
|
name: [
|
|
26
32
|
SwapFormKey.FromChain,
|
|
27
33
|
SwapFormKey.FromToken,
|
|
28
34
|
SwapFormKey.ToChain,
|
|
29
35
|
SwapFormKey.ToToken,
|
|
30
|
-
SwapFormKey.Slippage,
|
|
31
|
-
SwapFormKey.EnabledBridges,
|
|
32
|
-
SwapFormKey.EnabledExchanges,
|
|
33
|
-
SwapFormKey.RoutePriority,
|
|
34
36
|
],
|
|
35
37
|
});
|
|
36
38
|
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount], 500);
|
|
@@ -42,7 +44,7 @@ export const useSwapRoutes = () => {
|
|
|
42
44
|
Boolean(toTokenAddress) &&
|
|
43
45
|
Boolean(fromTokenAmount) &&
|
|
44
46
|
!isNaN(fromTokenAmount) &&
|
|
45
|
-
!isNaN(slippage);
|
|
47
|
+
!Number.isNaN(slippage);
|
|
46
48
|
const queryKey = [
|
|
47
49
|
'routes',
|
|
48
50
|
account.address,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTools: () => import("@lifinance/types").ToolsResponse | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import { useQuery } from 'react-query';
|
|
3
|
+
import { LiFi } from '../lifi';
|
|
4
|
+
import { useSettingsStore } from '../stores';
|
|
5
|
+
export const useTools = () => {
|
|
6
|
+
const initializeTools = useSettingsStore((state) => state.initializeTools);
|
|
7
|
+
const { data } = useQuery(['tools'], ({ signal }) => LiFi.getTools(undefined, { signal }), {
|
|
8
|
+
onSuccess(data) {
|
|
9
|
+
initializeTools('Bridges', data.bridges.map((bridge) => bridge.key));
|
|
10
|
+
initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
return data;
|
|
14
|
+
};
|
package/i18n/en/translation.json
CHANGED
|
@@ -1,142 +1,140 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"header": {
|
|
3
|
+
"walletConnected": "Wallet connected",
|
|
4
|
+
"connectWallet": "Connect wallet",
|
|
5
|
+
"selectWallet": "Select your wallet",
|
|
6
|
+
"swap": "Swap",
|
|
7
|
+
"from": "Swap from",
|
|
8
|
+
"to": "Swap to",
|
|
9
|
+
"settings": "Settings",
|
|
10
|
+
"routes": "You get"
|
|
11
|
+
},
|
|
12
|
+
"button": {
|
|
13
|
+
"swap": "Swap",
|
|
14
|
+
"connectWallet": "Connect wallet",
|
|
15
|
+
"switchChain": "Switch chain",
|
|
16
|
+
"startSwap": "Start the swap",
|
|
17
|
+
"restartSwap": "Restart swap",
|
|
18
|
+
"removeSwap": "Remove swap",
|
|
19
|
+
"done": "Done",
|
|
20
|
+
"okay": "Okay",
|
|
21
|
+
"seeDetails": "See details",
|
|
22
|
+
"tryAgain": "Try again",
|
|
23
|
+
"light": "Light",
|
|
24
|
+
"dark": "Dark",
|
|
25
|
+
"auto": "Auto",
|
|
26
|
+
"ok": "Ok",
|
|
27
|
+
"hide": "Hide",
|
|
28
|
+
"max": "max",
|
|
29
|
+
"lifiSwap": "LI.FI Swap"
|
|
30
|
+
},
|
|
31
|
+
"swap": {
|
|
32
|
+
"from": "From",
|
|
33
|
+
"to": "To",
|
|
34
|
+
"amount": "You pay",
|
|
35
|
+
"maxAmount": "/ {{amount}}",
|
|
36
|
+
"routes": "You get",
|
|
37
|
+
"approximateCurrency": "\u2248 {{value, currency(currency: USD)}}",
|
|
38
|
+
"currency": "{{value, currency(currency: USD)}}",
|
|
39
|
+
"sendToRecipient": "Send to recipient",
|
|
40
|
+
"addressConfirmation": "I confirm that the address above is correct",
|
|
41
|
+
"gas": "gas fee",
|
|
42
|
+
"minutes": "minutes",
|
|
43
|
+
"tokenSearch": "Search your token",
|
|
44
|
+
"selectChain": "Chain",
|
|
45
|
+
"selectToken": "Token",
|
|
46
|
+
"selectChainAndToken": "Select chain and token",
|
|
47
|
+
"inProgress": "In progress",
|
|
48
|
+
"couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
|
|
49
|
+
"insufficientFunds": "Insufficient funds",
|
|
50
|
+
"insufficientGasOnStartChain": "Insufficient gas on start chain",
|
|
51
|
+
"insufficientGasOnDestinationChain": "Insufficient gas on destination chain",
|
|
52
|
+
"insufficientGasOnDestinationChainTooltip": "The selected route requires a swap on the chain you are transferring to. You need to have gas on that chain to pay for the transaction there.",
|
|
53
|
+
"stepSwap": "Swap",
|
|
54
|
+
"stepBridge": "Bridge",
|
|
55
|
+
"stepSwapAndBridge": "Swap and bridge",
|
|
56
|
+
"estimatedTime": "~{{value}} min.",
|
|
57
|
+
"networkIsBusy": "Network is busy...",
|
|
58
|
+
"crossStepDetails": "Bridge {{from}} to {{to}} via {{tool}}",
|
|
59
|
+
"swapStepDetails": "Swap on {{value}}",
|
|
60
|
+
"tags": {
|
|
61
|
+
"recommended": "Recommended",
|
|
62
|
+
"fastest": "Fast",
|
|
63
|
+
"cheapest": "Cheap",
|
|
64
|
+
"safest": "Safe",
|
|
65
|
+
"general": "General"
|
|
11
66
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"done": "Done",
|
|
20
|
-
"okay": "Okay",
|
|
21
|
-
"seeDetails": "See details",
|
|
22
|
-
"tryAgain": "Try again",
|
|
23
|
-
"light": "Light",
|
|
24
|
-
"dark": "Dark",
|
|
25
|
-
"auto": "Auto",
|
|
26
|
-
"ok": "Ok",
|
|
27
|
-
"hide": "Hide",
|
|
28
|
-
"max": "max",
|
|
29
|
-
"lifiSwap": "LI.FI Swap"
|
|
67
|
+
"success": {
|
|
68
|
+
"title": {
|
|
69
|
+
"fundsReceived": "Funds received"
|
|
70
|
+
},
|
|
71
|
+
"message": {
|
|
72
|
+
"fundsReceived": "You now have {{amount}} {{tokenSymbol}} in your wallet on {{chainName}} chain."
|
|
73
|
+
}
|
|
30
74
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"selectChain": "Chain",
|
|
46
|
-
"selectToken": "Token",
|
|
47
|
-
"selectChainAndToken": "Select chain and token",
|
|
48
|
-
"inProgress": "In progress",
|
|
49
|
-
"couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
|
|
50
|
-
"insufficientFunds": "Insufficient funds",
|
|
51
|
-
"insufficientGasOnStartChain": "Insufficient gas on start chain",
|
|
52
|
-
"insufficientGasOnDestinationChain": "Insufficient gas on destination chain",
|
|
53
|
-
"insufficientGasOnDestinationChainTooltip": "The selected route requires a swap on the chain you are transferring to. You need to have gas on that chain to pay for the transaction there.",
|
|
54
|
-
"stepSwap": "Swap",
|
|
55
|
-
"stepBridge": "Bridge",
|
|
56
|
-
"stepSwapAndBridge": "Swap and bridge",
|
|
57
|
-
"estimatedTime": "~{{value}} min.",
|
|
58
|
-
"networkIsBusy": "Network is busy...",
|
|
59
|
-
"crossStepDetails": "Bridge {{from}} to {{to}} via {{tool}}",
|
|
60
|
-
"swapStepDetails": "Swap on {{value}}",
|
|
61
|
-
"tags": {
|
|
62
|
-
"recommended": "Recommended",
|
|
63
|
-
"fastest": "Fast",
|
|
64
|
-
"cheapest": "Cheap",
|
|
65
|
-
"safest": "Safe",
|
|
66
|
-
"general": "General"
|
|
67
|
-
},
|
|
68
|
-
"success": {
|
|
69
|
-
"title": {
|
|
70
|
-
"fundsReceived": "Funds received"
|
|
71
|
-
},
|
|
72
|
-
"message": {
|
|
73
|
-
"fundsReceived": "You now have {{amount}} {{tokenSymbol}} in your wallet on {{chainName}} chain."
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"error": {
|
|
77
|
-
"title": {
|
|
78
|
-
"chainSwitch": "Chain switch required.",
|
|
79
|
-
"transactionFailed": "Transaction has failed.",
|
|
80
|
-
"transactionUnderpriced": "Transaction is underpriced.",
|
|
81
|
-
"transactionUnprepared": "Unable to prepare transaction.",
|
|
82
|
-
"unknown": "Something went wrong.",
|
|
83
|
-
"userRejectedSignatureRequest": "Signature required."
|
|
84
|
-
},
|
|
85
|
-
"message": {
|
|
86
|
-
"signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
87
|
-
"transactionFailed": "Please check the block explorer for more information.",
|
|
88
|
-
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}})."
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"process": {
|
|
92
|
-
"tokenAllowance": {
|
|
93
|
-
"started": "Setting token allowance.",
|
|
94
|
-
"pending": "Waiting for token allowance approval.",
|
|
95
|
-
"done": "Token allowance approved."
|
|
96
|
-
},
|
|
97
|
-
"switchChain": {
|
|
98
|
-
"pending": "Chain switch required.",
|
|
99
|
-
"done": "Chain switched successfully."
|
|
100
|
-
},
|
|
101
|
-
"swap": {
|
|
102
|
-
"started": "Preparing swap.",
|
|
103
|
-
"actionRequired": "Please sign the transaction.",
|
|
104
|
-
"pending": "Swapping.",
|
|
105
|
-
"done": "Swap completed."
|
|
106
|
-
},
|
|
107
|
-
"crossChain": {
|
|
108
|
-
"started": "Preparing transaction.",
|
|
109
|
-
"actionRequired": "Please sign the transaction.",
|
|
110
|
-
"pending": "Waiting for transaction.",
|
|
111
|
-
"done": "Transaction approved."
|
|
112
|
-
},
|
|
113
|
-
"receivingChain": {
|
|
114
|
-
"pending": "Waiting for receiving chain.",
|
|
115
|
-
"done": "Funds received."
|
|
116
|
-
}
|
|
117
|
-
}
|
|
75
|
+
"error": {
|
|
76
|
+
"title": {
|
|
77
|
+
"chainSwitch": "Chain switch required.",
|
|
78
|
+
"transactionFailed": "Transaction has failed.",
|
|
79
|
+
"transactionUnderpriced": "Transaction is underpriced.",
|
|
80
|
+
"transactionUnprepared": "Unable to prepare transaction.",
|
|
81
|
+
"unknown": "Something went wrong.",
|
|
82
|
+
"userRejectedSignatureRequest": "Signature required."
|
|
83
|
+
},
|
|
84
|
+
"message": {
|
|
85
|
+
"signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
|
|
86
|
+
"transactionFailed": "Please check the block explorer for more information.",
|
|
87
|
+
"transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}})."
|
|
88
|
+
}
|
|
118
89
|
},
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
90
|
+
"process": {
|
|
91
|
+
"tokenAllowance": {
|
|
92
|
+
"started": "Setting token allowance.",
|
|
93
|
+
"pending": "Waiting for token allowance approval.",
|
|
94
|
+
"done": "Token allowance approved."
|
|
95
|
+
},
|
|
96
|
+
"switchChain": {
|
|
97
|
+
"pending": "Chain switch required.",
|
|
98
|
+
"done": "Chain switched successfully."
|
|
99
|
+
},
|
|
100
|
+
"swap": {
|
|
101
|
+
"started": "Preparing swap.",
|
|
102
|
+
"actionRequired": "Please sign the transaction.",
|
|
103
|
+
"pending": "Swapping.",
|
|
104
|
+
"done": "Swap completed."
|
|
105
|
+
},
|
|
106
|
+
"crossChain": {
|
|
107
|
+
"started": "Preparing transaction.",
|
|
108
|
+
"actionRequired": "Please sign the transaction.",
|
|
109
|
+
"pending": "Waiting for transaction.",
|
|
110
|
+
"done": "Transaction approved."
|
|
111
|
+
},
|
|
112
|
+
"receivingChain": {
|
|
113
|
+
"pending": "Waiting for receiving chain.",
|
|
114
|
+
"done": "Funds received."
|
|
115
|
+
}
|
|
141
116
|
}
|
|
117
|
+
},
|
|
118
|
+
"settings": {
|
|
119
|
+
"routePriority": "Route priority",
|
|
120
|
+
"slippage": "Slippage",
|
|
121
|
+
"gasPrice": {
|
|
122
|
+
"title": "Gas price",
|
|
123
|
+
"slow": "Slow",
|
|
124
|
+
"normal": "Normal",
|
|
125
|
+
"fast": "Fast"
|
|
126
|
+
},
|
|
127
|
+
"advancedPreferences": "Advanced preferences",
|
|
128
|
+
"enabledBridges": "Enabled bridges",
|
|
129
|
+
"selectEnabledBridges": "Select enabled bridges",
|
|
130
|
+
"enabledExchanges": "Enabled exchanges",
|
|
131
|
+
"selectEnabledExchanges": "Select enabled exchanges",
|
|
132
|
+
"resetToDefault": "Reset to default"
|
|
133
|
+
},
|
|
134
|
+
"wallet": {
|
|
135
|
+
"extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
|
|
136
|
+
},
|
|
137
|
+
"tooltip": {
|
|
138
|
+
"progressToNextUpdate": "Displayed data will auto-refresh after {{value}} seconds. Click this circle to update manually."
|
|
139
|
+
}
|
|
142
140
|
}
|
package/i18n/index.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export declare const resources: {
|
|
|
40
40
|
approximateCurrency: string;
|
|
41
41
|
currency: string;
|
|
42
42
|
sendToRecipient: string;
|
|
43
|
-
recipientsAddress: string;
|
|
44
43
|
addressConfirmation: string;
|
|
45
44
|
gas: string;
|
|
46
45
|
minutes: string;
|
|
@@ -129,7 +128,6 @@ export declare const resources: {
|
|
|
129
128
|
fast: string;
|
|
130
129
|
};
|
|
131
130
|
advancedPreferences: string;
|
|
132
|
-
bridgePrioritization: string;
|
|
133
131
|
enabledBridges: string;
|
|
134
132
|
selectEnabledBridges: string;
|
|
135
133
|
enabledExchanges: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="84" height="32" viewBox="0 0 84 32" fill="inherit"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M50.6689 20.5714H42.6849V8H39V24H50.6689V20.5714Z" />
|
|
4
|
+
<path d="M53.0717 24H56.7566V8H53.0717V24Z" />
|
|
5
|
+
<path d="M59.5088 24H63.0117V20.48H59.5088V24Z" />
|
|
6
|
+
<path d="M69.4396 17.76H77.1506V14.6057H69.4396V11.2457H77.8103V8H65.7547V24H69.4396V17.76Z" />
|
|
7
|
+
<path d="M80.3151 24H84V8H80.3151V24Z" />
|
|
8
|
+
<path d="M14.6163 21.6947L5.1336 23.89C4.78772 23.9766 4.52832 24.3232 4.52832 24.6698V31.1978C4.52832 31.7467 4.96066 32.0933 5.50829 31.9777L18.7379 28.9159C19.2856 28.8004 19.5162 28.2805 19.2856 27.7894L16.8933 22.8501C16.5186 22.0702 16.8933 21.2614 17.7291 21.0881L26.376 19.0084C26.9813 18.864 27.5001 18.2285 27.5001 17.593V11.5561C27.5001 11.0073 27.0677 10.6318 26.5201 10.7762L14.0398 13.7514C13.2616 13.9247 12.9157 14.6757 13.2616 15.3978L15.4521 19.9327C15.8268 20.7126 15.4521 21.4925 14.6163 21.6947Z" />
|
|
9
|
+
<path d="M8.36225 5.3748L10.841 10.4585C11.1581 11.1229 10.841 11.8161 10.1204 11.9606L5.53762 13.0293C4.96116 13.1737 4.5 13.7514 4.5 14.3291V19.7884C4.5 20.7127 5.24939 21.2904 6.1429 21.0882L10.4087 20.1061C10.9851 19.9906 11.4463 19.384 11.4463 18.8063L11.4751 13.2026C11.4751 12.4227 12.1092 11.6428 12.8586 11.4695L26.8376 8.11886C27.1835 8.03221 27.4429 7.68559 27.4429 7.33897V0.810981C27.4429 0.262168 27.0106 -0.113336 26.4629 0.0310883L8.90988 4.24829C8.36225 4.36383 8.13167 4.88375 8.36225 5.3748Z" />
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="inherit"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M14.6163 21.6947L5.1336 23.89C4.78772 23.9766 4.52832 24.3232 4.52832 24.6698V31.1978C4.52832 31.7467 4.96066 32.0933 5.50829 31.9777L18.7379 28.9159C19.2856 28.8004 19.5162 28.2805 19.2856 27.7894L16.8933 22.8501C16.5186 22.0702 16.8933 21.2614 17.7291 21.0881L26.376 19.0084C26.9813 18.864 27.5001 18.2285 27.5001 17.593V11.5561C27.5001 11.0073 27.0677 10.6318 26.5201 10.7762L14.0398 13.7514C13.2616 13.9247 12.9157 14.6757 13.2616 15.3978L15.4521 19.9327C15.8268 20.7126 15.4521 21.4925 14.6163 21.6947Z" />
|
|
4
|
+
<path d="M8.36225 5.3748L10.841 10.4585C11.1581 11.1229 10.841 11.8161 10.1204 11.9606L5.53762 13.0293C4.96116 13.1737 4.5 13.7514 4.5 14.3291V19.7884C4.5 20.7127 5.24939 21.2904 6.1429 21.0882L10.4087 20.1061C10.9851 19.9906 11.4463 19.384 11.4463 18.8063L11.4751 13.2026C11.4751 12.4227 12.1092 11.6428 12.8586 11.4695L26.8376 8.11886C27.1835 8.03221 27.4429 7.68559 27.4429 7.33897V0.810981C27.4429 0.262168 27.0106 -0.113336 26.4629 0.0310883L8.90988 4.24829C8.36225 4.36383 8.13167 4.88375 8.36225 5.3748Z" />
|
|
5
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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
|
"sideEffects": false,
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/lifinance/widget/issues"
|
|
25
25
|
},
|
|
26
|
+
"license": "MIT",
|
|
26
27
|
"keywords": [
|
|
27
28
|
"widget",
|
|
28
29
|
"lifi-widget",
|
|
@@ -36,11 +37,11 @@
|
|
|
36
37
|
"lifi"
|
|
37
38
|
],
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@emotion/react": "^11.9.
|
|
40
|
-
"@emotion/styled": "^11.
|
|
40
|
+
"@emotion/react": "^11.9.3",
|
|
41
|
+
"@emotion/styled": "^11.9.3",
|
|
41
42
|
"@ethersproject/experimental": "^5.6.2",
|
|
42
43
|
"@ethersproject/providers": "^5.6.8",
|
|
43
|
-
"@lifi/wallet-management": "^1.0.
|
|
44
|
+
"@lifi/wallet-management": "^1.0.2",
|
|
44
45
|
"@lifinance/sdk": "^1.0.0-beta.11",
|
|
45
46
|
"@mui/icons-material": "^5.8.3",
|
|
46
47
|
"@mui/lab": "^5.0.0-alpha.85",
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
"immer": "^9.0.14",
|
|
51
52
|
"react": "^18.1.0",
|
|
52
53
|
"react-dom": "^18.1.0",
|
|
53
|
-
"react-hook-form": "^7.
|
|
54
|
-
"react-i18next": "^11.
|
|
54
|
+
"react-hook-form": "^7.32.0",
|
|
55
|
+
"react-i18next": "^11.17.1",
|
|
55
56
|
"react-query": "^4.0.0-beta.23",
|
|
56
57
|
"react-resize-detector": "^7.1.1",
|
|
57
58
|
"react-router-dom": "^6.3.0",
|
|
@@ -21,5 +21,5 @@ export const ChainSelect = ({ formType }) => {
|
|
|
21
21
|
setValue(SwapFormKeyHelper.getTokenKey(formType), '');
|
|
22
22
|
setValue(SwapFormKeyHelper.getAmountKey(formType), '');
|
|
23
23
|
};
|
|
24
|
-
return !isLoading ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ labelId: "label", MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, 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:
|
|
24
|
+
return !isLoading ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`swap.selectChain`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ labelId: "label", MenuProps: { elevation: 2 }, defaultValue: formType === 'from' ? fromChain : toChain, value: chainId, onChange: handleChain, 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 } }));
|
|
25
25
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Typography } from '@mui/material';
|
|
3
|
-
import { useState } from 'react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
5
4
|
import { Switch } from '../../components/Switch';
|
|
5
|
+
import { useSetSettings, useSettings } from '../../stores';
|
|
6
6
|
import { EnabledBridgesSelect } from './EnabledBridgesSelect';
|
|
7
7
|
import { EnabledExchangesSelect } from './EnabledExchangesSelect';
|
|
8
8
|
export const AdvancedPreferences = () => {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
|
-
const [
|
|
10
|
+
const [setValue] = useSetSettings();
|
|
11
|
+
const { advancedPreferences } = useSettings(['advancedPreferences']);
|
|
11
12
|
const handleAdvancedPreferences = (_, checked) => {
|
|
12
|
-
|
|
13
|
+
setValue('advancedPreferences', checked);
|
|
13
14
|
};
|
|
14
15
|
return (_jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
15
16
|
display: 'flex',
|
|
16
17
|
justifyContent: 'space-between',
|
|
17
18
|
alignItems: 'center',
|
|
18
|
-
} }, { 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, {
|
|
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
20
|
};
|
|
@@ -2,8 +2,8 @@ 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 { useAppearance } from '../../hooks';
|
|
6
5
|
import { useWidgetConfig } from '../../providers/WidgetProvider';
|
|
6
|
+
import { useAppearance } from '../../stores';
|
|
7
7
|
import { ToggleButton } from './ColorSchemeButtonGroup.style';
|
|
8
8
|
export const ColorSchemeButtonGroup = () => {
|
|
9
9
|
const { t } = useTranslation();
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
3
3
|
import { Box, Chip, FormControl, MenuItem, Skeleton } from '@mui/material';
|
|
4
|
-
import { useFormContext } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import shallow from 'zustand/shallow';
|
|
6
6
|
import { CardContainer, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useTools } from '../../hooks';
|
|
9
|
+
import { useSettingsStore } from '../../stores';
|
|
10
10
|
export const EnabledBridgesSelect = () => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { t } = useTranslation();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
return bridges.length ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.enabledBridges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`),
|
|
13
|
+
const tools = useTools();
|
|
14
|
+
const [enabledBridges, setTools] = useSettingsStore((state) => [state.enabledBridges, state.setTools], shallow);
|
|
15
|
+
return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.enabledBridges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`), MenuProps: { elevation: 2 }, IconComponent: KeyboardArrowDownIcon, value: enabledBridges !== null && enabledBridges !== void 0 ? enabledBridges : [], onChange: (event) => {
|
|
16
|
+
if (tools === null || tools === void 0 ? void 0 : tools.bridges) {
|
|
17
|
+
setTools('Bridges', event.target.value, tools.bridges);
|
|
18
|
+
}
|
|
19
|
+
}, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => (_jsx(Chip, { label: value }, value))) }))) }, { children: (_a = tools === null || tools === void 0 ? void 0 : tools.bridges) === null || _a === void 0 ? void 0 : _a.map((bridge) => (_jsx(MenuItem, Object.assign({ value: bridge.key }, { children: bridge.key }), bridge.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 134, sx: { borderRadius: 1 } }));
|
|
15
20
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
3
3
|
import { Box, Chip, FormControl, MenuItem, Skeleton } from '@mui/material';
|
|
4
|
-
import { useFormContext } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import shallow from 'zustand/shallow';
|
|
6
6
|
import { CardContainer, CardTitle } from '../../components/Card';
|
|
7
7
|
import { Select } from '../../components/Select';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useTools } from '../../hooks';
|
|
9
|
+
import { useSettingsStore } from '../../stores';
|
|
10
10
|
export const EnabledExchangesSelect = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
return exchanges.length ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.enabledExchanges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledExchanges`),
|
|
12
|
+
const tools = useTools();
|
|
13
|
+
const [enabledExchanges, setTools] = useSettingsStore((state) => [state.enabledExchanges, state.setTools], shallow);
|
|
14
|
+
return (tools === null || tools === void 0 ? void 0 : tools.exchanges.length) ? (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.enabledExchanges`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledExchanges`), value: enabledExchanges !== null && enabledExchanges !== void 0 ? enabledExchanges : [], onChange: (event) => {
|
|
15
|
+
if (tools === null || tools === void 0 ? void 0 : tools.exchanges) {
|
|
16
|
+
setTools('Exchanges', event.target.value, tools.exchanges);
|
|
17
|
+
}
|
|
18
|
+
}, MenuProps: { elevation: 2 }, IconComponent: KeyboardArrowDownIcon, renderValue: (selected) => (_jsx(Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => (_jsx(Chip, { label: value }, value))) }))) }, { children: tools === null || tools === void 0 ? void 0 : tools.exchanges.map((exchange) => (_jsx(MenuItem, Object.assign({ value: exchange.key }, { children: exchange.key }), exchange.key))) })) }))] })) : (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 206, sx: { borderRadius: 1 } }));
|
|
15
19
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
3
3
|
import { FormControl, MenuItem } from '@mui/material';
|
|
4
|
-
import { useFormContext } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { CardContainer, CardTitle } from '../../components/Card';
|
|
7
6
|
import { Select } from '../../components/Select';
|
|
8
|
-
import {
|
|
7
|
+
import { useSetSettings, useSettings } from '../../stores';
|
|
9
8
|
export const GasPriceSelect = () => {
|
|
10
9
|
const { t } = useTranslation();
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const [setValue] = useSetSettings();
|
|
11
|
+
const { gasPrice } = useSettings(['gasPrice']);
|
|
12
|
+
return (_jsxs(CardContainer, Object.assign({ flex: 1 }, { children: [_jsx(CardTitle, { children: t(`settings.gasPrice.title`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsxs(Select, Object.assign({ MenuProps: { elevation: 2 }, value: gasPrice, onChange: (event) => setValue('gasPrice', event.target.value), IconComponent: KeyboardArrowDownIcon, dense: true }, { children: [_jsx(MenuItem, Object.assign({ value: "slow" }, { children: t(`settings.gasPrice.slow`) })), _jsx(MenuItem, Object.assign({ value: "normal" }, { children: t(`settings.gasPrice.normal`) })), _jsx(MenuItem, Object.assign({ value: "fast" }, { children: t(`settings.gasPrice.fast`) }))] })) }))] })));
|
|
13
13
|
};
|
|
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Orders } from '@lifinance/sdk';
|
|
3
3
|
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@mui/icons-material';
|
|
4
4
|
import { FormControl, MenuItem } from '@mui/material';
|
|
5
|
-
import { useFormContext } from 'react-hook-form';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import { CardContainer, CardTitle } from '../../components/Card';
|
|
8
7
|
import { Select } from '../../components/Select';
|
|
9
|
-
import {
|
|
8
|
+
import { useSetSettings, useSettings } from '../../stores';
|
|
10
9
|
export const RoutePrioritySelect = () => {
|
|
11
10
|
const { t } = useTranslation();
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
const [setValue] = useSetSettings();
|
|
12
|
+
const { routePriority } = useSettings(['routePriority']);
|
|
13
|
+
return (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.routePriority`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Select, Object.assign({ MenuProps: { elevation: 2 }, value: routePriority, onChange: (event) => setValue('routePriority', event.target.value), IconComponent: KeyboardArrowDownIcon, dense: true }, { children: Orders.map((order) => (_jsx(MenuItem, Object.assign({ value: order }, { children: t(`swap.tags.${order.toLowerCase()}`) }), order))) })) }))] }));
|
|
14
14
|
};
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FormControl, InputAdornment } from '@mui/material';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
import { useFormContext, useWatch } from 'react-hook-form';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { CardContainer, CardTitle } from '../../components/Card';
|
|
7
6
|
import { Input } from '../../components/Input';
|
|
8
|
-
import {
|
|
7
|
+
import { useSetSettings, useSettings } from '../../stores';
|
|
9
8
|
import { formatSlippage } from '../../utils/format';
|
|
10
9
|
export const SlippageInput = () => {
|
|
11
10
|
const { t } = useTranslation();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
const defaultValue = useRef(value);
|
|
11
|
+
const [setValue] = useSetSettings();
|
|
12
|
+
const { slippage } = useSettings(['slippage']);
|
|
13
|
+
const defaultValue = useRef(slippage);
|
|
17
14
|
const handleChange = (event) => {
|
|
18
15
|
const { value } = event.target;
|
|
19
|
-
setValue(
|
|
16
|
+
setValue('slippage', formatSlippage(value, defaultValue.current, true));
|
|
20
17
|
};
|
|
21
18
|
const handleBlur = (event) => {
|
|
22
19
|
const { value } = event.target;
|
|
23
|
-
setValue(
|
|
20
|
+
setValue('slippage', formatSlippage(value, defaultValue.current));
|
|
24
21
|
};
|
|
25
22
|
return (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t(`settings.slippage`) }), _jsx(FormControl, Object.assign({ fullWidth: true }, { children: _jsx(Input, { size: "small", placeholder: t(`settings.slippage`), endAdornment: _jsx(InputAdornment, Object.assign({ position: "end" }, { children: "%" })), autoComplete: "off", inputProps: {
|
|
26
23
|
inputMode: 'decimal',
|
|
27
|
-
}, onChange: handleChange, onBlur: handleBlur, value:
|
|
24
|
+
}, onChange: handleChange, onBlur: handleBlur, value: slippage }) }))] }));
|
|
28
25
|
};
|
|
@@ -13,7 +13,7 @@ export const ExecutionItem = ({ step, process }) => {
|
|
|
13
13
|
return (_jsxs(Box, Object.assign({ px: 2, py: 1 }, { children: [_jsxs(Box, Object.assign({ sx: {
|
|
14
14
|
display: 'flex',
|
|
15
15
|
alignItems: 'center',
|
|
16
|
-
} }, { children: [_jsx(CircularProgress, { status: process.status }), _jsx(Typography, Object.assign({ ml: 2, fontWeight: process.error ?
|
|
16
|
+
} }, { children: [_jsx(CircularProgress, { status: process.status }), _jsx(Typography, Object.assign({ ml: 2, fontSize: 14, fontWeight: process.error ? 600 : 400 }, { children: title })), process.txLink ? (_jsx(Box, Object.assign({ ml: 2, sx: {
|
|
17
17
|
display: 'flex',
|
|
18
18
|
flex: 1,
|
|
19
19
|
justifyContent: 'flex-end',
|