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", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.2.3", "version": "0.2.4",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -220,7 +220,11 @@ const Bridge = ({ chainId, address, config, connect }) => {
const preparedAmount = useMemo(() => { const preparedAmount = useMemo(() => {
try { 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 { } catch {
return 0n; return 0n;
} }
@ -247,11 +251,9 @@ const Bridge = ({ chainId, address, config, connect }) => {
} else { } else {
setIsPending(true); setIsPending(true);
console.log(preparedAmount) const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
console.log(ghstBalance)
// const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
await ghstBalanceRefetch(); await ghstBalanceRefetch();
setReceiver(""); setReceiver("");
setAmount(""); setAmount("");
setIsPending(false); setIsPending(false);