๐Ÿš€ Quick Start

Quick Start

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:

  1. Resolves the route โ€” finds the best lending protocol (Marginfi โ†’ Kamino โ†’ Save)
  2. Derives PDAs โ€” computes program-derived accounts for the flash vault
  3. Builds the sandwich โ€” wraps your instructions between borrow and repay
  4. Signs and sends โ€” with priority fees, retries on transient errors

Execution Modes

ModeMethodLatencyNetwork CallsBest For
TurboexecuteLocal()~100ms0 HTTP + 2 RPCBots, latency-critical
Standardexecute()~180ms1 HTTP + 2 RPCGeneral use
Simulationsimulate()~50ms1 RPCTesting, 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;
  },
});