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",
|
"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",
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user