๐Ÿšง Fee Guard

Fee Guard

Set a maximum fee limit in basis points. Transactions exceeding your threshold are automatically rejected before sending โ€” no SOL wasted.

Usage

try {
  const sig = await flash.execute({
    token: 'mSOL',
    amount: 500,
    onFunds: async (ixs) => {
      ixs.push(myIx);
      return ixs;
    },
    maxFeeBps: 15,  // reject if fee > 0.15%
  });
} catch (err) {
  if (err.code === 'FEE_TOO_HIGH') {
    console.log(`Fee ${err.meta?.actualFeeBps} bps > max ${err.meta?.maxFeeBps} bps`);
    // Skip this opportunity
  }
}
Token CategorySuggested maxFeeBpsReasoning
Direct route (SOL, USDC)5 bpsOnly VAEA fee, no swap cost
LSTs via Sanctum (mSOL, bSOL)10 bpsLow swap cost via Sanctum
Majors via Jupiter (TRUMP)15 bpsModerate swap cost
Mid-caps via Jupiter (BONK)20 bpsHigher swap slippage possible
โš ๏ธ Warning
When using executeLocal() (Turbo Mode), fee guard is skipped because there's no API call. Use isProfitable() instead for turbo-mode cost validation.
๐Ÿ”