make preparedAmount capped to ghstBalance raw value

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-08-11 21:18:28 +03:00
parent 9b1c8c0f09
commit 175d964b9f
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.2.3",
"version": "0.2.4",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -220,7 +220,11 @@ const Bridge = ({ chainId, address, config, connect }) => {
const preparedAmount = useMemo(() => {
try {
return BigInt(parseFloat(amount) * Math.pow(10, 18));
const result = BigInt(parseFloat(amount) * Math.pow(10, 18));
if (result > ghstBalance._value) {
return ghstBalance._value;
}
return result;
} catch {
return 0n;
}
@ -247,11 +251,9 @@ const Bridge = ({ chainId, address, config, connect }) => {
} else {
setIsPending(true);
console.log(preparedAmount)
console.log(ghstBalance)
// const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
await ghstBalanceRefetch();
setReceiver("");
setAmount("");
setIsPending(false);