Skip to content

Commit 9cbf2a7

Browse files
committed
small fix for the token update
1 parent 23f7c36 commit 9cbf2a7

3 files changed

Lines changed: 89 additions & 53 deletions

File tree

src/Dashboard/comp/SendTokens.jsx

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Divider,
77
IconButton,
88
useTheme,
9+
Tooltip,
910
} from "@mui/material";
1011
import Input from "../../common/Input/Input.jsx";
1112
import { useSnackbar } from "notistack";
@@ -173,28 +174,30 @@ const SendTokens = () => {
173174
</Grid>
174175
<Grid item container justifyContent="center">
175176
{/* 1 */}
176-
<Grid item>
177-
<Grid container direction="column">
178-
<Grid item>
179-
<IconButton
180-
color="primary"
181-
component="span"
182-
style={{
183-
backgroundColor: theme.palette.primary.main,
184-
color: "#fff",
185-
}}
186-
disabled
187-
>
188-
<FileDownloadOutlinedIcon />
189-
</IconButton>
190-
</Grid>
191-
<Grid item>
192-
<Typography variant="body1" align="center" sx={{ mt: 1 }}>
193-
Buy
194-
</Typography>
177+
<Tooltip title="Coming soon" placement="top">
178+
<Grid item>
179+
<Grid container direction="column">
180+
<Grid item>
181+
<IconButton
182+
color="primary"
183+
component="span"
184+
style={{
185+
backgroundColor: theme.palette.primary.main,
186+
color: "#fff",
187+
}}
188+
disabled
189+
>
190+
<FileDownloadOutlinedIcon />
191+
</IconButton>
192+
</Grid>
193+
<Grid item>
194+
<Typography variant="body1" align="center" sx={{ mt: 1 }}>
195+
Buy
196+
</Typography>
197+
</Grid>
195198
</Grid>
196199
</Grid>
197-
</Grid>
200+
</Tooltip>
198201
{/* 2 */}
199202
<Grid item sx={{ ml: 4 }}>
200203
<Grid container direction="column">
@@ -219,28 +222,30 @@ const SendTokens = () => {
219222
</Grid>
220223
</Grid>
221224
{/* 3 */}
222-
<Grid item sx={{ ml: 4 }}>
223-
<Grid container direction="column">
224-
<Grid item>
225-
<IconButton
226-
color="primary"
227-
component="span"
228-
style={{
229-
backgroundColor: theme.palette.primary.main,
230-
color: "#fff",
231-
}}
232-
disabled
233-
>
234-
<SwapHorizontalCircleOutlinedIcon />
235-
</IconButton>
236-
</Grid>
237-
<Grid item>
238-
<Typography variant="body1" sx={{ mt: 1 }}>
239-
Swap
240-
</Typography>
225+
<Tooltip title="Coming soon" placement="top">
226+
<Grid item sx={{ ml: 4 }}>
227+
<Grid container direction="column">
228+
<Grid item>
229+
<IconButton
230+
color="primary"
231+
component="span"
232+
style={{
233+
backgroundColor: theme.palette.primary.main,
234+
color: "#fff",
235+
}}
236+
disabled
237+
>
238+
<SwapHorizontalCircleOutlinedIcon />
239+
</IconButton>
240+
</Grid>
241+
<Grid item>
242+
<Typography variant="body1" sx={{ mt: 1 }}>
243+
Swap
244+
</Typography>
245+
</Grid>
241246
</Grid>
242247
</Grid>
243-
</Grid>
248+
</Tooltip>
244249
</Grid>
245250
</Grid>
246251
{/* <Grid

src/Dashboard/helper/Assets.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ import { useEffect } from "react";
1010
import { removeToken } from "../../redux/projects/projectSlice";
1111
import SendIcon from "@mui/icons-material/Send";
1212
import AssetsSend from "./assetsHelper/AssetsSend.jsx";
13+
import { editCustomToken } from "../../redux/projects/projectSlice";
14+
import { NODE_URL } from "../../services/helper/config";
1315

1416
const Assets = () => {
1517
const styles = DashboardStyles();
1618
const dispatch = useDispatch();
19+
20+
const { privateKey, walletAddress } = useSelector((state) => state?.project);
21+
const provider = new ethers.providers.JsonRpcProvider(NODE_URL);
22+
const signer = new ethers.Wallet(privateKey, provider);
23+
1724
const [loading, setLoading] = useState(false);
1825
let [activeAddress, setActiveAddress] = useState("");
1926
const { tokenContractAddress } = useSelector((state) => state?.project);
@@ -40,6 +47,30 @@ const Assets = () => {
4047
setTokenObj(val);
4148
};
4249

50+
const updateData = async (addr) => {
51+
console.log(addr,"addraddr")
52+
let contract = new ethers.Contract(addr ? addr : "", abi, signer);
53+
const decimals = await contract.decimals();
54+
const symbol = await contract.symbol();
55+
const balance = await contract.balanceOf(walletAddress);
56+
console.log(balance, symbol, decimals, "kdhwkdhwdkhwdkhd");
57+
dispatch(
58+
editCustomToken({
59+
data: {
60+
tokenDecimal: decimals,
61+
tokenSymbol: symbol,
62+
balance: balance,
63+
address: contract.address,
64+
},
65+
})
66+
);
67+
}
68+
69+
useEffect(() => {
70+
if(tokenContractAddress.length){
71+
tokenContractAddress.map((token) => updateData(token.address));
72+
}
73+
}, []);
4374
return (
4475
<Grid container direction="column">
4576
{tokenObj?.map((token, i) => {

src/Dashboard/helper/assetsHelper/AssetsSend.jsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ const AssetsSend = ({ open, handleClose, addr }) => {
102102
walletAddress: "",
103103
amount: "",
104104
});
105-
const decimals = await contract.decimals();
106-
const symbol = await contract.symbol();
107-
const balance = await contract.balanceOf(walletAddress);
108-
dispatch(
109-
editCustomToken({
110-
data: {
111-
tokenDecimal: decimals,
112-
tokenSymbol: symbol,
113-
balance: balance,
114-
address: contract.address,
115-
},
116-
})
117-
);
105+
// const decimals = await contract.decimals();
106+
// const symbol = await contract.symbol();
107+
// const balance = await contract.balanceOf(walletAddress);
108+
// dispatch(
109+
// editCustomToken({
110+
// data: {
111+
// tokenDecimal: decimals,
112+
// tokenSymbol: symbol,
113+
// balance: balance,
114+
// address: contract.address,
115+
// },
116+
// })
117+
// );
118118
}
119119
} catch (error) {
120120
setLoading(false);

0 commit comments

Comments
 (0)