INNER CODE UNIT · JavaScript
onPick
pamgarcia1993/robinhood-lp-bot · legacy/bot.js:61
async function onPick(idx, mid) {
const st = pending.get(chatId);
if (!st) return;
const p = st.pools[idx];
st.chosen = p;
st.awaitingAmount = true;
const b = await CH.balances().catch(() => null);
await edit(mid, [
`<b>${st.meta.symbol}</b> · fee ${(p.fee / 10000).toFixed(2)}% dipilih.`,
b ? `Saldo bisa di-LP: <b>${usableEth(b).toFixed(5)} ETH</b> <i>(WETH ${Number(b.weth).toFixed(4)} + ETH ${Number(b.eth).toFixed(4)})</i>` : "",
``,
`💬 <b>Ketik jumlah ETH</b> yang mau di-LP (contoh: <code>0.005</code>)`,
].filter(Boolean).join("\n"));
}
// User ngetik angka → tampilkan konfirmasi
async function onAmount(text) {
const st = pending.get(chatId);