// Follow Otomate launches and trade them, in about 30 lines (TypeScript, Node 18+): npm install @otomate/sdk viem // PRIVATE_KEY=0x… npx tsx quickstart.ts — uses ETH on WETH pairs; 0.001 ETH per buy. Read the docs before risking funds. import { createOtomate, otomateViemChain } from '@otomate/sdk'; import { createWalletClient, http, type Address } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`); const walletClient = createWalletClient({ account, chain: otomateViemChain('ink'), transport: http() }); // Your builder code earns you a fee on top of each trade you send (0 here; at most 200 bps). const otomate = createOtomate({ chain: 'ink', walletClient, builder: null, apiKey: process.env.OTOMATE_API_KEY }); otomate.feed({ topics: ['launch', 'trade'], cursor: process.env.CURSOR }) .on('launch', async e => { console.log(`new launch ${e.data.symbol} ${e.token} by ${e.data.creator}`); if (e.data.quote !== otomate.chain.weth) return; // WETH pairs: we pay in ETH // The launch protection charges buys in the first seconds: wait it out. const until = (e.data.launchedAt + e.data.surcharge.duration + 1) * 1000; await new Promise(r => setTimeout(r, Math.max(0, until - Date.now()))); const r = await otomate.buy(e.token as Address, 10n ** 15n); // 0.001 ETH, 1 % slippage console.log(`bought ${r.tokenAmount} for ${r.quoteAmount} wei (fee ${r.quoteFee}, burned ${r.burn}) ${r.hash}`); }) .on('trade', e => console.log(`${e.data.side} ${e.token} ${e.data.quoteRaw} wei, progress ${e.data.progressBps / 100} %`)) .on('reorg', e => console.log(`reorg: drop what you stored above block ${e.afterBlock}`)) .on('final', e => console.log(`final up to block ${e.block}`)) .on('error', e => console.error(e.message)) .start();