+3
-6
apps/web/src/components/Account/CreatorCoin/Trade.tsx
+3
-6
apps/web/src/components/Account/CreatorCoin/Trade.tsx
···
44
44
const [tokenBalance, setTokenBalance] = useState<bigint>(0n);
45
45
const [estimatedOut, setEstimatedOut] = useState<string>("");
46
46
47
-
// balances
48
47
useEffect(() => {
49
48
(async () => {
50
49
if (!address) return;
···
60
59
]);
61
60
setEthBalance(eth);
62
61
setTokenBalance(token as bigint);
63
-
} catch {
64
-
// ignore
65
-
}
62
+
} catch {}
66
63
})();
67
64
}, [address, coin.address, publicClient]);
68
65
69
-
const tokenDecimals = 18; // ZORA20 tokens have 18 decimals
66
+
const tokenDecimals = 18;
70
67
71
68
const setPercentAmount = (pct: number) => {
72
69
const decimals = 6;
73
70
if (mode === "buy") {
74
71
const available = Number(formatEther(ethBalance));
75
-
const gasReserve = 0.0002; // leave a tiny bit for gas on Base
72
+
const gasReserve = 0.0002;
76
73
const baseAmt = (available * pct) / 100;
77
74
const amt = pct === 100 ? Math.max(baseAmt - gasReserve, 0) : baseAmt;
78
75
setAmount(amt.toFixed(decimals));
-2
apps/web/vite.config.mjs
-2
apps/web/vite.config.mjs