Read a coin: holders, risk, chart
Example
This is an example. Every value in it (names, amounts, addresses) is there to show you how; change any of them to suit you. It’s read-a-coin.mjs from developers/examples, as it is. Anything that sends waits for SEND=1: there is no testnet, so a sent transaction spends real ETH.
// Everything Uprally knows about one coin: its market, who holds it, the bundled and sniper wallets, its creator// and its last hour of 5-minute candles. Sends nothing.// COIN=0x… node read-a-coin.mjs (no COIN: the newest coin whose holders are counted, else the newest coin)const API = process.env.UPRALLY_API ?? 'https://uprally.co/api/v1';const get = async (path) => { const res = await fetch(`${API}${path}`); const json = await res.json(); if (!res.ok) throw new Error(`${json.error.code}: ${json.error.message}`); return json;};
const fresh = (await get('/coins/new?limit=60')).coins;const coin = process.env.COIN ?? (fresh.find((c) => c.holders) ?? fresh[0]).address;const [info, holders, candles] = await Promise.all([get(`/coins/${coin}`), get(`/coins/${coin}/holders`), get(`/coins/${coin}/candles?tf=5m&limit=12`)]);
console.log(`${info.name} (${info.ticker}) on ${info.launchpad ?? 'no launchpad we know'}: ${info.market ? `$${Math.round(info.market.marketCapUsd ?? 0).toLocaleString()} market cap` : 'no market yet'}`);console.log(`risk: ${info.risk?.level ?? 'unknown'}${info.risk?.reasons?.length ? ` (${info.risk.reasons.map((r) => r.text ?? r).join('; ')})` : ''}`);if (holders.tracked) { const { bundled, snipers } = holders.groups; console.log(`${holders.holders} holders; top 10 hold ${holders.top10Pct}%`); console.log(`bundled: ${bundled.wallets} wallets bought ${bundled.boughtPct}%, hold ${bundled.heldPct}% (${bundled.level})`); console.log(`snipers: ${snipers.wallets} wallets bought ${snipers.boughtPct}%, hold ${snipers.heldPct}% (${snipers.level})`); if (holders.creator) console.log(`creator ${holders.creator.wallet} holds ${holders.creator.heldPct}%`);} else console.log(`holders not counted: ${holders.reason}`);const closes = candles.candles.map((c) => c[4]);console.log(`last hour, 5-minute closes in USD: ${closes.map((c) => c.toPrecision(3)).join(' ')}`);console.log(`RESULT ${coin}`);