Skip to content

A creator's fees, and the claims

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 creator-fees.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.

creator-fees.mjs
// What the coins a wallet launched have earned it, and the transactions that claim it. Sends nothing.
// CREATOR=0x… node creator-fees.mjs
const API = process.env.UPRALLY_API ?? 'https://uprally.co/api/v1';
const res = await fetch(`${API}/creators/${process.env.CREATOR}/fees`);
const json = await res.json();
if (!res.ok) throw new Error(`${json.error.code}: ${json.error.message}`);
for (const c of json.coins) console.log(c.launchpad, c.token, c.owed.eth ? `${c.owed.eth.amount} ETH` : 'nothing in ETH', `${c.steps.length} claim step(s)`);
console.log(`RESULT ${json.coins.length}`);