make preparedAmount capped to ghstBalance raw value
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
9b1c8c0f09
commit
175d964b9f
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user