๐Ÿ”ฌ Simulation

Simulation

Dry-run any flash loan without spending SOL. Uses Solana's simulateTransaction with sigVerify: false to test against live on-chain state.

โ„น๏ธ Note
Simulation uses instructions[] (not onFunds) โ€” you pass your pre-built instructions directly.

Real-Time Fee Calculation

All fees displayed in the dashboard and returned by the API are calculated in real-time by the VAEA scanner. For synthetic routes, the scanner compares the fair market price (Jupiter Price API) against the actual execution price (Jupiter Quote) every 10 seconds.

ComponentMethodUpdate Frequency
VAEA FeeFixed 3 bps (SDK) / 5 bps (UI)Constant
Swap Cost (Direct)None โ€” borrowed directlyN/A
Swap Cost (Synthetic)Price-vs-Quote: 1 - (quote_rate / fair_rate)~60s per token
Total FeeVAEA fee + swap costLive
๐Ÿ’ก Tip
The /v1/quote endpoint returns the exact fee breakdown for any token and amount. Use it to show users their real cost before execution.

Code Examples

Simulate a direct route (SOL) and a synthetic route (WIF) to see the fee difference:

// Direct route โ€” fixed 0.03% fee
const solSim = await flash.simulate({
  token: 'SOL',
  amount: 5000,
  instructions: [myArbInstruction],
  slippageBps: 50,
  maxFeeBps: 15,  // fee guard: abort if fee > 0.15%
});

// Synthetic route โ€” real-time fee from Jupiter quote
const wifSim = await flash.simulate({
  token: 'WIF',
  amount: 50000,
  instructions: [myArbInstruction],
  maxFeeBps: 30,  // higher guard for synthetic
});

if (solSim.success) {
  console.log('SOL simulation passed! CU:', solSim.computeUnits);
  console.log('Fee:', solSim.feeBreakdown.total_fee_pct, '%');
}
if (wifSim.success) {
  console.log('WIF simulation passed! CU:', wifSim.computeUnits);
  console.log('Fee:', wifSim.feeBreakdown.total_fee_pct, '%');
}

Response Schema

FieldTypeDescription
successbooleanWhether simulation passed successfully
computeUnitsnumberExact CU consumed โ€” use to set compute budget
feeBreakdownFeeBreakdownDetailed fee: vaea_fee, swap_fee, total_fee_pct, total_fee_usd
logsstring[]Full program execution logs
errorstring | undefinedError details if simulation failed (JSON)

Use Cases

Strategy Testing
Validate new arb strategies against live state without risk
CU Estimation
Get exact compute units to optimize your compute budget request
Fee Verification
Confirm real-time fees match your profitability threshold before execution
CI/CD
Run simulated flash loans in your test suite on every commit
๐Ÿ’ก Tip
The SDK automatically adds a 1.4M CU budget limit and uses replaceRecentBlockhash: true โ€” no wallet signing required.