@lifi/widget 1.29.6 → 1.30.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/cjs/components/Card/CardTitle.d.ts +3 -1
- package/cjs/components/Card/CardTitle.js +7 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/cjs/components/Header/WalletHeader.js +2 -2
- package/cjs/components/SendToWallet/SendToWallet.js +18 -10
- package/cjs/components/SendToWallet/SendToWalletButton.js +3 -2
- package/cjs/components/Step/CircularProgress.d.ts +1 -0
- package/cjs/components/Step/StepList.d.ts +1 -0
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/en.json +1 -0
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/cjs/pages/MainPage/MainSwapButton.js +1 -1
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/cjs/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/cjs/types/widget.d.ts +5 -0
- package/cjs/types/widget.js +5 -1
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +1 -2
- package/components/Card/CardTitle.d.ts +3 -1
- package/components/Card/CardTitle.js +7 -1
- package/components/ChainSelect/ChainSelect.d.ts +1 -0
- package/components/Header/WalletHeader.js +2 -2
- package/components/SendToWallet/SendToWallet.js +18 -10
- package/components/SendToWallet/SendToWalletButton.js +3 -2
- package/components/Step/CircularProgress.d.ts +1 -0
- package/components/Step/StepList.d.ts +1 -0
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/i18n/en.json +1 -0
- package/package.json +11 -11
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
- package/pages/MainPage/MainSwapButton.js +1 -1
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
- package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
- package/pages/SettingsPage/SettingsPage.d.ts +1 -0
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
- package/pages/SettingsPage/SlippageInput.d.ts +1 -0
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/providers/SwapFormProvider/FormUpdater.js +2 -0
- package/providers/SwapFormProvider/SwapFormProvider.d.ts +5 -0
- package/providers/SwapFormProvider/SwapFormProvider.js +6 -3
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +5 -0
- package/types/widget.js +4 -0
- package/utils/format.d.ts +1 -1
- package/utils/format.js +1 -2
|
@@ -50,9 +50,9 @@ const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
|
|
|
50
50
|
const ref = useRef();
|
|
51
51
|
useSetContentHeight(ref);
|
|
52
52
|
return (_jsxs(Box, Object.assign({ p: 3, ref: ref }, { children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: _jsx(WarningIcon, { color: "warning" }) })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.rateChanged') }))] }), _jsx(Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.rateChanged') })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
|
|
53
|
-
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.oldToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals),
|
|
53
|
+
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.oldToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
|
|
54
54
|
}), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
|
|
55
|
-
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.newToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals),
|
|
55
|
+
value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.newToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
|
|
56
56
|
}), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.rateChange') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [Big((data === null || data === void 0 ? void 0 : data.newToAmount) || 0)
|
|
57
57
|
.div(Big((data === null || data === void 0 ? void 0 : data.oldToAmount) || 0))
|
|
58
58
|
.minus(1)
|
|
@@ -44,6 +44,8 @@ export const FormUpdater = ({ defaultValues }) => {
|
|
|
44
44
|
setValue,
|
|
45
45
|
toChain,
|
|
46
46
|
]);
|
|
47
|
+
// Makes widget config options reactive to changes
|
|
48
|
+
// Acts similar to values property from useForm, but includes additional logic for chains
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
Object.keys(defaultValues).forEach((key) => {
|
|
49
51
|
if (previousDefaultValues.current[key] !== defaultValues[key]) {
|
|
@@ -3,5 +3,10 @@ export declare const formDefaultValues: {
|
|
|
3
3
|
fromAmount: string;
|
|
4
4
|
toAddress: string;
|
|
5
5
|
tokenSearchFilter: string;
|
|
6
|
+
contractOutputsToken: string;
|
|
7
|
+
toContractAddress: string;
|
|
8
|
+
toContractCallData: string;
|
|
9
|
+
ToContractGasLimit: string;
|
|
10
|
+
toAmount: string;
|
|
6
11
|
};
|
|
7
12
|
export declare const SwapFormProvider: React.FC<React.PropsWithChildren<{}>>;
|
|
@@ -9,6 +9,11 @@ export const formDefaultValues = {
|
|
|
9
9
|
[SwapFormKey.FromAmount]: '',
|
|
10
10
|
[SwapFormKey.ToAddress]: '',
|
|
11
11
|
[SwapFormKey.TokenSearchFilter]: '',
|
|
12
|
+
[SwapFormKey.ContractOutputsToken]: '',
|
|
13
|
+
[SwapFormKey.ToContractAddress]: '',
|
|
14
|
+
[SwapFormKey.ToContractCallData]: '',
|
|
15
|
+
[SwapFormKey.ToContractGasLimit]: '',
|
|
16
|
+
[SwapFormKey.ToAmount]: '',
|
|
12
17
|
};
|
|
13
18
|
export const SwapFormProvider = ({ children, }) => {
|
|
14
19
|
const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress, buildSwapUrl, } = useWidgetConfig();
|
|
@@ -16,10 +21,8 @@ export const SwapFormProvider = ({ children, }) => {
|
|
|
16
21
|
fromToken, fromAmount: (typeof fromAmount === 'number'
|
|
17
22
|
? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
|
|
18
23
|
: fromAmount) || formDefaultValues.fromAmount, toChain,
|
|
19
|
-
toToken,
|
|
20
|
-
toAddress })), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
|
|
24
|
+
toToken, toAddress: toAddress || formDefaultValues.toAddress })), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
|
|
21
25
|
const methods = useForm({
|
|
22
|
-
// TODO: revisit after RHF release values support
|
|
23
26
|
// values,
|
|
24
27
|
defaultValues,
|
|
25
28
|
});
|