Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/meteora integration #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,29 @@ reqwest = { version = "0.12.4", features = ["json", "stream"] }
serde = "1.0.199"
serde_json = "1.0.116"
serde_with = "3.8.1"
solana-account-decoder = "<1.17.0"
solana-client = "<1.17.0"
solana-sdk = "<1.17.0"
solana-transaction-status = "<1.17.0"
spl-token-2022 = { version = "0.9.0", features = ["no-entrypoint"] }
spl-token = { version = "4.0.0", features = ["no-entrypoint"] }
tokio = { version = "1.37.0", features = ["full"] }
solana-account-decoder = "=2.0.3"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill have to check out this branch and see if 2.0.3 is not going to cause shenanigans

the solana >=2 sdks were not compatible with the searcher client iirc, will lyk

Copy link
Owner

@piotrostr piotrostr Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup
image
honestly i might be dropping the direct raydium lib dependency since it sucks big time, it takes like 4 account calls to do the swap, comes with a lot of peer deps and jupiter can easily allows swapping most raydium tokens with better slipapge prot

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easier to monitor prices & pool events by using direct raydium though, yeh?

solana-client = "=2.0.3"
solana-sdk = "=2.0.3"
solana-transaction-status = "=2.0.3"
solana-zk-token-sdk = "=2.0.3"
spl-token-2022 = { version = "=4.0.0", features = ["no-entrypoint"] }
spl-token = { version = "=4.0.0", features = ["no-entrypoint"] }
tokio = { version = "1.21", features = ["full"] }
tokio-test = "0.4.4"
warp = "0.3.7"
raydium-library = { git = "https://github.com/piotrostr/raydium-library", version = "0.3.0" }
spl-associated-token-account = { version = "2.2.0", features = [
"no-entrypoint",
] }
raydium_amm = { git = "https://github.com/piotrostr/raydium-amm", default-features = false, features = [
"client",
], version = "0.3.0" }
spl-associated-token-account = { version = "2.2.0", features = ["no-entrypoint"] }
raydium_amm = { git = "https://github.com/piotrostr/raydium-amm", default-features = false, features = ["client"], version = "0.3.0" }
log = "0.4.21"
env_logger = "0.11.3"
chrono = "0.4.38"
dotenv = "0.15.0"
jito-searcher-client = { git = "https://github.com/piotrostr/searcher-examples", version = "0.1.0" }
jito-protos = { git = "https://github.com/piotrostr/searcher-examples", version = "0.1.0" }
tonic = { version = "0.10", features = [
"tls",
"tls-roots",
"tls-webpki-roots",
] }
timed = "0.2.1"
ctrlc = "3.4.4"
flexi_logger = { version = "0.28.0", features = ["async"] }
futures-util = "0.3.30"
bs58 = "0.5.1"
actix-web = "4.5.1"
csv = "1.3.0"
mongodb = { version = "2.8.2", features = [
"async-std-runtime",
], default-features = false }
mongodb = { version = "2.7.0", features = ["async-std-runtime"], default-features = false }
base64 = "0.22.1"
console-subscriber = "0.2.0"
flame = "0.2.2"
Expand All @@ -66,3 +52,10 @@ borsh = "0.10.3"
indicatif = "0.17"
rig-core = "0.6.0"
thiserror = "2.0.9"
commons = { git = "https://github.com/MeteoraAg/dlmm-sdk.git", package = "commons", version = "0.3.0" }
timed = "0.2.1"
jito-searcher-client = { git = "https://github.com/piotrostr/searcher-examples", version = "0.1.0" }
jito-protos = { git = "https://github.com/piotrostr/searcher-examples", version = "0.1.0" }
tonic = { version = "0.10", features = ["tls", "tls-roots", "tls-webpki-roots"] }
digest = "=0.10.7"
solana-program = "=2.0.3"
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
## Features

- 🔍 Real-time transaction monitoring
- 💱 Multi-DEX swap execution (Pump.fun, Jupiter V6 API or Raydium)
- 💱 Multi-DEX swap execution:
- Pump.fun
- Jupiter V6 API
- Raydium
- Meteora (DLMM)
- 🚀 Blazingly fast transactions thanks to Jito MEV bundles
- 📊 Price tracking and metrics
- 🧰 Token management utilities
Expand Down Expand Up @@ -78,12 +82,40 @@ cargo run -- listen \
### Token Swapping

```bash
# Swap using Raydium
cargo run -- swap \
--input-mint sol \
--output-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10000000
--amount 10000000 \
--dex raydium

# Swap using Meteora
cargo run -- swap \
--input-mint sol \
--output-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10000000 \
--dex meteora

# Swap using Jupiter
cargo run -- swap \
--input-mint sol \
--output-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10000000 \
--dex jupiter

# Swap using Pump.fun
cargo run -- swap \
--input-mint sol \
--output-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10000000 \
--dex pump
```

Common options:
- `--slippage`: Maximum allowed slippage in basis points (e.g., 100 = 1%)
- `--yes`: Skip confirmation prompt
- `--amm-pool-id`: Specify AMM pool ID (required for Raydium)

> [!WARNING]
> Default configuration is set for mainnet with small transactions. Ensure proper configuration for testnet usage and carefully review code before execution.

Expand Down Expand Up @@ -126,3 +158,7 @@ Profile swap performance using DTrace to produce a flamegraph:

<img width="1210" alt="image" src="https://github.com/piotrostr/listen/assets/63755291/699405b7-adf0-448b-89c1-ba71152dc72b">

## License

MIT License - see [LICENSE](LICENSE) for details

10 changes: 7 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ pub enum Command {
#[arg(long)]
signature: String,
},
/// Swap command for executing token swaps
///
/// Supported DEXes:
/// - "raydium": Raydium DEX
/// - "meteora": Meteora DEX (DLMM)
/// - "jupiter": Jupiter Aggregator
Swap {
#[arg(long)]
input_mint: String,
#[arg(long)]
output_mint: String,
Expand All @@ -154,8 +159,7 @@ pub enum Command {
dex: Option<String>,
#[arg(long)]
amm_pool_id: Option<String>,

#[clap(short, long, action = clap::ArgAction::SetTrue)]
#[arg(long)]
yes: Option<bool>,
},
}
4 changes: 4 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use solana_sdk::{pubkey, pubkey::Pubkey};
use std::str::FromStr;


pub const SOLANA_PROGRAM_ID: Pubkey = pubkey!("So11111111111111111111111111111111111111112");
Expand All @@ -19,6 +20,9 @@ pub const JITO_TIP_PUBKEY: Pubkey = pubkey!("Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6Q

pub const RAYDIUM_AMM_PUBKEY: Pubkey = pubkey!("5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"); // TODO: dublicate of RAYDIUM_AUTHORITY_V4_PUBKEY

// Meteora program ID
pub const METEORA_PROGRAM_ID: Pubkey = pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo");

// TODO
// another rug method is as in case of Fwnf2vDqbHv6GH4eXQHpYmqSMynHrW2yBz8dXxExE5Kq
// initial launch with LP burn, mint/freeze revoked but a large instant buy
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub mod jito;
pub mod jup;
pub mod listener;
pub mod listener_service;
pub mod meteora;
pub mod orca;
pub mod prometheus;
pub mod provider;
Expand Down
Loading