-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature-tx-info.tsx
More file actions
31 lines (28 loc) · 1008 Bytes
/
feature-tx-info.tsx
File metadata and controls
31 lines (28 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { useFormContext } from 'react-hook-form';
import { useSimulationMint } from 'features/adjustment/mint/hooks';
import { Loader, Text } from '@lidofinance/lido-ui';
import { AmountInfo, InfoRow, Wrapper } from './styles';
export const FeatureTxInfo = () => {
const { watch } = useFormContext();
const [token, amount, recipient] = watch(['token', 'amount', 'recipient']);
const { isLoading, data, isError } = useSimulationMint({
token,
amount,
recipient,
});
// TODO: add error
return (
<Wrapper>
<InfoRow>
<Text size="xxs" color="secondary">
Transaction cost
</Text>
{isLoading && <Loader size="small" />}
{/*TODO: replace static by real data*/}
{data?.result && !isLoading && <AmountInfo>{data?.result}</AmountInfo>}
{isError && !isLoading && <AmountInfo>Is not available</AmountInfo>}
{!isLoading && !data?.result && !isError && <AmountInfo>-</AmountInfo>}
</InfoRow>
</Wrapper>
);
};