caelum0x bafe1da2d1 Full-stack integration: 5 Rust programs, 13 venue/yield modules, 181 tests pass
On-chain (programs/):
- driftbear_custom_adaptor (1,058 lines, deployed devnet)
- drift_vaults (15,243 lines)
- raydium_clmm (20,909 lines)
- drift_rs_sdk (55,940 lines)
- ctoken_market_program + mock (673 lines)

New TypeScript modules (ported from 19 plugins):
- JIT maker (sniper+shotgun from jit-proxy)
- Filler bot (DLOB fills from keeper-bots-v2)
- FloatingMaker (slot-based from keeper-bots-v2)
- Executor upgrades (tx simulation, Jito bundles, ALTs)
- Event stream (WebSocket + Yellowstone gRPC)
- DLOB orderbook + price impact + funding TWAP
- Ranger Data API (funding arbs, liquidation signals)
- Ranger SOR (full API: quotes, withdraw, deposit collateral)
- Sanctum LST (swap, APY, best LST selection)
- Lulo lending aggregator
- Pyth oracle cross-validation
- Helius DAS API + smart priority fees
- Flash Trade, Orca, Meteora, deBridge venue clients
- Voltr vault strategy client
- Drift insurance fund staking
- Adaptor CPI client for on-chain program
- Raydium LP strategy

All wired into strategy engine runCycle():
- 11 data sources called every cycle
- 3 background execution modules (JIT, Filler, FloatingMaker)
- Multi-venue funding rate comparison
- Lending yield optimizer across protocols
- LP yield scanning (Orca + Meteora)
- Auto-deploy idle capital to best lending protocol
- Pyth oracle cross-validation
- Realistic backtest mode (0.30% round-trip costs)

Tests: 20/20 suites, 181/181 pass
Build: zero TypeScript errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 00:40:22 +03:00

52 lines
2.0 KiB
TypeScript

import { Raydium, TxVersion } from "@raydium-io/raydium-sdk-v2";
import { Connection, Keypair, clusterApiUrl } from "@solana/web3.js";
import bs58 from "bs58";
import { adminFilePath, heliusRpcUrl } from "../variables";
import * as fs from "fs";
const adminKpFile = fs.readFileSync(adminFilePath, "utf-8");
const adminKpData = JSON.parse(adminKpFile);
const adminSecret = Uint8Array.from(adminKpData);
const adminKp = Keypair.fromSecretKey(adminSecret);
export const connection = new Connection(heliusRpcUrl); //<YOUR_RPC_URL>
// export const connection = new Connection(clusterApiUrl('devnet')) //<YOUR_RPC_URL>
export const txVersion = TxVersion.V0; // or TxVersion.LEGACY
const cluster = "mainnet"; // 'mainnet' | 'devnet'
let raydium: Raydium | undefined;
export const initSdk = async (params?: { loadToken?: boolean }) => {
if (raydium) return raydium;
if (connection.rpcEndpoint === clusterApiUrl("mainnet-beta"))
console.warn(
"using free rpc node might cause unexpected error, strongly suggest uses paid rpc node"
);
console.log(`connect to rpc ${connection.rpcEndpoint} in ${cluster}`);
raydium = await Raydium.load({
owner: adminKp.publicKey,
connection,
cluster,
disableFeatureCheck: true,
disableLoadToken: !params?.loadToken,
blockhashCommitment: "finalized",
// urlConfigs: {
// BASE_HOST: '<API_HOST>', // api url configs, currently api doesn't support devnet
// },
});
/**
* By default: sdk will automatically fetch token account data when need it or any sol balace changed.
* if you want to handle token account by yourself, set token account data after init sdk
* code below shows how to do it.
* note: after call raydium.account.updateTokenAccount, raydium will not automatically fetch token account
*/
/*
raydium.account.updateTokenAccount(await fetchTokenAccountData())
connection.onAccountChange(owner.publicKey, async () => {
raydium!.account.updateTokenAccount(await fetchTokenAccountData())
})
*/
return raydium;
};