import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://evmrpc.kasplex.org");
const FACTORY = "0x5F65Df9DCf7d764CA9d319Baf89611d289546A81";
const FACTORY_ABI = [
"function getTokenInfo(address token) view returns (tuple(uint256 tokenId, address creator, address pool, uint256 tokenReserves, uint256 kasReserves, uint256 createdAt, bool fulfilled, bool graduated, string metadataUri, uint256 paramVersion))",
"function getCurrentPrice(address token) view returns (uint256)",
"function getBondingCurveProgress(address token) view returns (uint256)",
];
const factory = new ethers.Contract(FACTORY, FACTORY_ABI, provider);
const TOKEN = "0x..."; // token address
const info = await factory.getTokenInfo(TOKEN);
const price = await factory.getCurrentPrice(TOKEN);
const progress = await factory.getBondingCurveProgress(TOKEN);
console.log("Token ID:", info.tokenId.toString());
console.log("Reserves:", ethers.formatEther(info.kasReserves), "KAS");
console.log("Price:", ethers.formatEther(price), "KAS");
console.log("Progress:", Number(progress) / 100, "%");
console.log("Graduated:", info.graduated);