SDK
Events
Parse Dumpster and DumpsterSwap logs when you need a trade feed, migration detection, or indexed activity.
SDK
Event parsing
Account fetches tell you the latest state. Events tell you what happened to get there.
Parse curve-side events
Parse Dumpster logs when you care about:
- token creation
- bonding-curve trades
- curve completion
- migration
- creator transfers
import { EventParser } from '@coral-xyz/anchor';
import { getDumpsterProgram } from '@dumpster-cash/dumpster-sdk';
const program = getDumpsterProgram(connection);
const parser = new EventParser(program.programId, program.coder);
parser.parseLogs(logs, (event) => {
if (event.name === 'TradeEvent') {
console.log(event.data.mint.toBase58());
console.log(event.data.isBuy);
console.log(event.data.grossGorAmount.toString());
}
});Common Dumpster events:
CreateEventTradeEventCompleteEventMigrateEventTransferCreatorEventSetCreatorEvent
Parse AMM-side events
Parse DumpsterSwap logs when you care about:
- pool creation
- AMM buys and sells
- deposits and withdrawals
- pool creator transfers
import { EventParser } from '@coral-xyz/anchor';
import { getDumpsterSwapProgram } from '@dumpster-cash/dumpster-sdk';
const program = getDumpsterSwapProgram(connection);
const parser = new EventParser(program.programId, program.coder);
parser.parseLogs(logs, (event) => {
if (event.name === 'BuyEvent') {
console.log(event.data.pool.toBase58());
console.log(event.data.baseAmountOut.toString());
}
});Common DumpsterSwap events:
PoolCreatedEventBuyEventSellEventDepositEventWithdrawEventTransferCoinCreatorEvent
When to parse logs instead of polling accounts
Logs are the better source when you need:
- a trade feed
- migration detection
- fee analytics
- notifications
- a time-ordered history of activity
Account fetching is better when you need:
- current reserves
- current fee config
- current pool state
- current creator vault balances
Important detail
Event parsing only works when you already have transaction logs.
Typical sources:
connection.getTransaction(...)- websocket subscriptions
- your own indexer pipeline