Install the SDK and execute your first flash loan in 5 minutes.
Installation
npm install @vaea/flash @solana/web3.js
Initialize Client
import { VaeaFlash } from '@vaea/flash';
import { Connection, Keypair } from '@solana/web3.js';
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = Keypair.fromSecretKey(/* your key */);
const flash = new VaeaFlash({
connection,
wallet,
source: 'sdk', // 0.03% fee (vs 'ui' = 0.05%)
});
โน๏ธ Note
source: 'sdk' gives you the 0.03% fee rate. Frontend integrations use 'ui' at 0.05%.
First Flash Loan
// Turbo mode โ builds locally, zero API calls, ~100ms
const sig = await flash.executeLocal({
token: 'SOL',
amount: 1000, // borrow 1,000 SOL
onFunds: async (ixs) => {
// Your logic here: arb, liquidation, collateral swap...
ixs.push(myArbitrageInstruction);
return ixs;
},
});
console.log('Flash loan executed:', sig);
// Always clean up when done
flash.destroy();
Under the Hood
When you call executeLocal(), the SDK:
Resolves the route โ finds the best lending protocol (Marginfi โ Kamino โ Save)
Derives PDAs โ computes program-derived accounts for the flash vault
Builds the sandwich โ wraps your instructions between borrow and repay
Signs and sends โ with priority fees, retries on transient errors
Execution Modes
Mode
Method
Latency
Network Calls
Best For
Turbo
executeLocal()
~100ms
0 HTTP + 2 RPC
Bots, latency-critical
Standard
execute()
~180ms
1 HTTP + 2 RPC
General use
Simulation
simulate()
~50ms
1 RPC
Testing, dry-runs
๐ก Tip
Turbo Mode is recommended for production bots. It builds instructions locally in ~91ยตs with zero API dependency.
Devnet Testing
โ ๏ธ Warning
VAEA Flash is currently deployed on Solana Devnet. Mainnet launch is planned for April 2026.
typescript
// Program ID (devnet): HoYiwkNB7a3gmZXEkTqLkborNDc976vKEUAzBm8YpK5E
// Program ID (mainnet): Coming April 2026
// Get devnet SOL from faucet first:
// solana airdrop 2 --url devnet
const flash = new VaeaFlash({
connection: new Connection('https://api.devnet.solana.com'),
wallet: myDevnetKeypair,
source: 'sdk',
});
const sig = await flash.executeLocal({
token: 'SOL',
amount: 0.01, // small amount for testing
onFunds: async (ixs) => {
// Your test logic here
return ixs;
},
});