Fees
Resolve active fee tiers, compute trade fees, and prepare recipient lists without hardcoding assumptions.
SDK
Fee helpers
Calculate Curve fees from stored rates, resolve AMM tiers and select protocol recipients. Helpers consume supplied snapshots; they do not fetch live settings.
Curve fees
CurveFees has protocolFeeBps and creatorFeeBps in FeeConfig.curveFees. Read those stored rates directly:
const { protocolFeeBps, creatorFeeBps } = feeConfig.curveFees;Values use denominator 100,000, not 10,000: protocol 950 and creator 300 represent the normal initial 0.95% + 0.30% choice. They are configurable u16 values with combined maximum 100,000. No LP rate or first-buy/market-cap selector applies to Curve trades. See the protocol rules.
getFee({ feeConfig, bondingCurve, amount }) returns totalFeeBps, feeAmount and applicable fees: CurveFees. amount is fee-exclusive principal in lamports. Each component rounds upward independently; an explicit default Curve creator suppresses only the creator component. Missing creator or malformed rates reject instead of receiving a default.
newBondingCurve(global, creator) requires the intended creator. AMM fee APIs use a separate fee schedule.
Quotes do not guarantee execution
Use the Curve quote helpers to check principal, fees and reserves, not getFee alone. A valid quote does not verify wallet funds, account deposits or fee recipients, and does not guarantee a later fill.
Administer fee settings
Use the existing getDumpsterFeeProgram(connection).methods surface:
initialize(feeTiers, flatFees, curveFees)requires explicit Curve settings and accountsfeeConfig,authority,systemProgram,programandprogramData. The signing/paying authority must be DumpsterFees' current upgrade authority;programDatamust belong to that program.updateCurveFees(curveFees)uses accountsfeeConfigand signing storedauthority; it preserves AMM tiers and flat fees.updateTiers(feeTiers, flatFees)changes only AMM settings.getFees(marketCap, isCanonical)still queries that AMM schedule, not Curve rates.
Rates are shared across active curves, not snapshotted at creation. Finish the method builder with .accountsStrict(...) and .instruction() to obtain an unsigned instruction; signing and submission remain your responsibility.
Resolve AMM fees
Resolve the current AMM fee tier for a pool:
const fees = getAmmFees({
feeConfig,
pool,
baseReserves,
quoteReserves,
baseMintSupply,
});These pure helpers use the supplied snapshot, not live RPC state. computeFeesBps remains the lower-level market-cap schedule selector; it does not read the independent Curve section. Non-canonical pools use flat fees; canonical pools also fall back to flat fees when the schedule is empty or their cap is below its first threshold. AMM fee behavior is unchanged.
Pick a protocol fee recipient
Get the curve protocol fee recipient used in explicit trade instruction building:
const feeRecipient = getFeeRecipient(global);The SDK returns the first nondefault entry in global.feeRecipients, in stored order, or falls back to a nondefault global.feeRecipient. If neither exists, it throws Error('No fee recipients configured') instead of returning an empty destination. Selection reads the supplied object without RPC and does not certify the rest of the configuration.
For Swap, dumpsterSwapSdk.getProtocolFeeRecipient(globalConfig) similarly selects the first nondefault list entry and throws Error('No protocol fee recipients configured') if none exists.
These are trading selectors. Migration requires the curve's primary global.feeRecipient, not the optional-first trading choice. See protocol recipient rules and selection errors.
Normalize recipient arrays for config updates
Normalize recipient arrays into the order expected by the program:
const recipients = sortFeeRecipients(rawRecipients);It sorts nondefault recipients by public-key bytes and moves empty slots to the end, preserving the input length and duplicates. It does not add missing slots, deduplicate entries or validate configuration readiness. Supply seven optional slots for curve configuration or eight slots for Swap, and follow the configuration rules.
Keep units and configuration separate
Curve rates are directly configured; AMM tiers are reserve-aware. Both use fee units of 1/100,000, and either can change through its authorized update. Neither pure helper output nor a decoded rate guarantees later transaction execution.