DumpsterDumpster Docs
SDK

Fees

Resolve active fee tiers, compute trade fees, and prepare recipient lists without hardcoding assumptions.

SDK

Fee helpers

In most integrations, the preview layer is enough. These lower-level helpers are useful when you need to resolve the active fee tier directly, compute a fee amount from raw state, or normalize recipients for config payloads.

Resolve the active curve fee tier

Resolve the active curve tier from decoded state:

const fees = computeFeesBps({
  feeConfig,
  mintSupply: bondingCurve.tokenTotalSupply,
  quoteReserves: bondingCurve.virtualGorReserves,
  tokenReserves: bondingCurve.virtualTokenReserves,
});

The returned object gives you the active:

  • protocolFeeBps
  • creatorFeeBps
  • lpFeeBps

Compute a curve-side fee amount

Compute the fee amount for a specific curve-side quote amount:

const fee = getFee({
  feeConfig,
  mintSupply: bondingCurve.tokenTotalSupply,
  bondingCurve,
  amount: gorAmount,
});

That result includes:

  • fee.totalFeeBps
  • fee.feeAmount
  • fee.fees

Resolve AMM fees

Resolve the current AMM fee tier for a pool:

const fees = getAmmFees({
  feeConfig,
  pool,
  baseReserves,
  quoteReserves,
  baseMintSupply,
});

Canonical migrated pools follow the tiered schedule. Non-canonical pools can fall back to the flat schedule.

Pick a protocol fee recipient

Get the protocol fee recipient used in explicit instruction building:

const feeRecipient = getFeeRecipient(global);

Normalize recipient arrays for config updates

Normalize recipient arrays into the order expected by the program:

const recipients = sortFeeRecipients(rawRecipients);

It sorts the non-zero recipients and zero-pads the rest into the order the program expects.

Do not hardcode basis points

Fee tiers are reserve-aware. If you hardcode a fee number instead of resolving the current tier, your previews and bounds can drift from the protocol.

On this page