Show HN: Open-Source Solana Trading Lib with 15 DEX Support and MEV Protection

github.com

1 points by madgik 3 hours ago

Hi HN!

I've been building trading bots on Solana for a while now, and I kept running into the same problem: every DEX has its own SDK, API quirks, and integration complexity. You'd spend days just to support all Raydium pools, then more days for Meteora pools, then even more for the new launchpads like Heaven, Sugar, Boop etc. Each one required different approaches for pool discovery, slippage handling, and transaction building.

Some of you might ask, why not using Jupiter? Well, they decided to close source their binary and make it paid 5-10k/mo, which a lot of solo devs can't handle...

So I built solana-trade - a unified library that handles all of this complexity behind a single, clean API. You can trade on like 15 different DEXs & launchpads (Pump.fun, Pump Swap, Raydium AMM/CLMM/CPMM, Orca Whirlpools, Meteora DLMM/DAMM, and many others) with the same function calls.

The architecture is modular - each DEX gets its own client that implements a common interface. The main SolanaTrade class handles provider selection, transaction building, and routing. It's all built in Typescript.

A key feature is the MEV protection integration. Rather than just supporting standard RPC, it can route transactions through Jito, Nozomi, or Astralane based on tip amounts and availability. The library automatically selects the best provider or lets you specify one explicitly.

The transaction building is fairly sophisticated - it handles compute budget optimization, priority fees, automatic pool discovery with caching, and includes a 0.15% development fee on buys (which can be disabled). Everything is designed to be production-ready rather than just a proof of concept.

I also built a CLI interface that wraps the programmatic API. You can install it globally with npm and start trading from the command line immediately, which has been useful for quick testing and automation scripts.

The technical challenge was mostly around the inconsistencies between DEX SDKs. Some use different slippage formats, others have different ways of specifying pools, and the transaction instruction building varies significantly. I ended up creating adapter patterns for each one while maintaining a consistent external interface.

It's published on NPM as "solana-trade" so you can try it right away. The CLI works out of the box for basic trading, and the programmatic API handles more complex scenarios like getting unsigned transactions for manual processing.

I'm particularly interested in feedback, and curious if there are other DEXs or features that would be valuable to add. The codebase is MIT licensed and I'd welcome contributions, especially from teams running other DEXs who might want to integrate their protocols.

NPM: https://www.npmjs.com/package/solana-trade

GitHub: https://github.com/FlorianMgs/solana-trade