INNER CODE UNIT · JavaScript
onMint
pamgarcia1993/robinhood-lp-bot · legacy/bot.js:110
async function onMint(mid, mode = "single") {
const st = pending.get(chatId);
if (!st?.chosen || !st.ethAmt) return;
const inR = mode === "inrange";
await edit(mid, `⏳ <b>Minting ${st.ethAmt} ETH…</b> ${inR ? "(wrap → swap → approve → mint)" : "(wrap → approve → mint)"}`);
try {
const r = await CH.openPosition(st.token, st.chosen.pool, st.ethAmt, { mode });
pending.delete(chatId);
await send([
`✅ <b>${st.meta.symbol} #${r.tokenId ?? "?"}</b> [v3] ${inR ? "🎯 IN-RANGE" : "🛡 single-side"}`,
r.wrapHash ? `wrap: <a href="${exp(r.wrapHash)}">tx</a>` : "",
r.swapHash ? `swap ${r.swappedPct}% → ${st.meta.symbol}: <a href="${exp(r.swapHash)}">tx</a>` : "",
`range tick ${r.tickLower}..${r.tickUpper}`,
`📊 entry MCAP ${CH.fmtMcap(r.entryMcap)} · ${r.side}`,
`deposit ~${Number(r.depositEth).toFixed(5)}Ξ`,
`mint: <a href="${exp(r.txHash)}">tx</a>`,
].filter(Boolean).join("\n"));
} catch (e) {