DumpsterDumpster Docs
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);

for (const event of parser.parseLogs(logs)) {
  if (event.name === 'tradeEvent') {
    console.log(event.data.mint.toBase58());
    console.log(event.data.isBuy);
    console.log(event.data.grossGorAmount.toString());
  }
}

Common Dumpster events:

  • CreateEvent
  • TradeEvent
  • CompleteEvent
  • MigrateEvent
  • TransferCreatorEvent
  • SetCreatorEvent
  • CollectCreatorFeeEvent

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);

for (const event of parser.parseLogs(logs)) {
  if (event.name === 'buyEvent') {
    console.log(event.data.pool.toBase58());
    console.log(event.data.baseAmountOut.toString());
    console.log(event.data.coinCreator.toBase58());
  }
}

Common DumpsterSwap events:

  • PoolCreatedEvent
  • BuyEvent
  • SellEvent
  • DepositEvent
  • WithdrawEvent
  • TransferCoinCreatorEvent
  • CollectCoinCreatorFeeEvent

Interpret creator handovers

Use the protocol handover event rules. A fully unchanged call emits no handover event, but an administrative pool-only repair emits SetCreatorEvent even when its curve oldCreator and newCreator are equal. syncedToPool records successful checked synchronization, not necessarily a changed pool recipient.

Accept handover events only from successful confirmed transactions. Correlate the nested Swap change with its outer curve operation, and do not count log/event-CPI copies as separate events. Preserve distinct handover instructions within the same transaction; a transaction signature alone is not an operation identifier. An emitted log from failed execution is not proof of ownership transfer.

Account reads may reveal historical disagreement between the curve and pool. Keep that evidence visible instead of rewriting history from the latest creator field or treating an absent no-op event as a failed transaction.

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. Anchor's parser returns an iterable of events; it does not take a callback. Check the transaction result before using its logs, and do not count a log and its event-CPI copy as two trades. See Curve trade fees for the event fields.

Typical sources:

  • connection.getTransaction(...)
  • websocket subscriptions
  • your own indexer pipeline

On this page