QUICK START
Deposit, watch a cycle, withdraw. 3 minutes.
ESEC is live on devnet at FxausMaH3TWJkUeVPpLbYY55rVMztSKr6KtZ1jRFdrRw. The SDK is an alpha TypeScript client. Get devnet USDC, deposit, watch a cycle on the dashboard, withdraw.
1. Install the SDK
npm install @esec/sdk @solana/web3.js2. Connect
import { EsecClient } from "@esec/sdk";
import { Connection, Keypair } from "@solana/web3.js";
const connection = new Connection("https://api.devnet.solana.com");
const wallet = Keypair.fromSecretKey(/* your secret */);
const cascade = new EsecClient({
connection,
wallet,
cluster: "devnet",
});3. Deposit
// Deposit 100 USDC into the SOL cluster vault.
// LP tokens (CASC-SOL) are minted to your wallet pro-rata.
const sig = await esec.deposit({
asset: "USDC",
amount: 100 * 1e6, // raw token units, USDC has 6 decimals
});
console.log("deposit tx:", sig);noteDeposit is only valid when the vault is in
Idle state. If the vault is currently Deployed, the SDK throwsVaultNotIdle. Wait for the cycle to close.4. Watch a cycle
// Subscribe to cluster signals + vault state transitions.
cascade.subscribeReceipts((receipt) => {
console.log("cycle close:", {
asset: receipt.asset,
deployPrice: receipt.deployPrice,
exitPrice: receipt.exitPrice,
pnl: receipt.pnlSigned,
reason: receipt.reason, // "Recovery" | "StopLoss" | "Timeout"
durationSlots: receipt.exitSlot - receipt.deploySlot,
});
});5. Withdraw
// Burn 50 CASC-SOL, receive USDC pro-rata minus 0.1% withdraw fee.
const sig = await cascade.withdraw({
asset: "USDC",
lpAmount: 50 * 1e6,
});
console.log("withdraw tx:", sig);tipWithdraw is also only valid while the vault is
Idle. On-chain stop-loss ensures the vault returns to Idle within bounded time, so you are never permanently locked out.Next
Read Concepts for the full vault lifecycle, or jump to Instructions for the raw on-chain reference.