forked from astroport-fi/astroport-classic-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuctionUnlockLpNotification.tsx
33 lines (28 loc) · 983 Bytes
/
AuctionUnlockLpNotification.tsx
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
32
33
import React, { FC, useEffect } from "react";
import { TxInfo } from "@terra-money/terra.js";
import { Text } from "@chakra-ui/react";
import num from "libs/num";
import { useQueryClient } from "react-query";
import { getEventsByType, handleTinyAmount } from "modules/common";
import { ONE_TOKEN } from "constants/constants";
type Props = {
txInfo: TxInfo;
};
const AuctionUnlockLpNotification: FC<Props> = ({ txInfo }) => {
const queryClient = useQueryClient();
const eventsByType = getEventsByType(txInfo);
const amount = eventsByType?.wasm.lp_withdrawn[0];
const displayAmount = handleTinyAmount(
num(amount).div(ONE_TOKEN).dp(6).toNumber()
);
useEffect(() => {
queryClient.invalidateQueries("userInfo");
queryClient.invalidateQueries("balance");
}, []);
return (
<Text textStyle={["small", "medium"]}>
Unlock {displayAmount} LP tokens from the ASTRO-USTC Bootstrap Pool
</Text>
);
};
export default AuctionUnlockLpNotification;