Skip to main content

wp_solana_raydium_clmm_core/
lib.rs

1//! Raydium CLMM Core — pure (non-I/O) crate
2//!
3//! Contains all plan-layer code, quote math, PDA derivation utilities, and
4//! token-account planning logic. Has zero `solana-client` and zero `tokio`
5//! dependencies — it can be used in WASM targets, test harnesses without a
6//! Solana runtime, or by other protocol SDKs that want to compose plan
7//! functions.
8//!
9//! # Architecture
10//!
11//! - **`plan/`** — pure plan modules (increase, decrease, open, harvest)
12//! - **`quote_math`** — pure quote computation (was `instructions/common.rs`)
13//! - **`token/`** — pure token account planning types and helpers
14//! - **`utils/`** — PDA derivation, constants, tick array bitmap math
15//! - **`metadata`** — shared mint metadata types (`MintInfo`, `TokenProgram`)
16//! - **`pool_metrics`** — pure derived metrics from `PoolState`
17//! - **`position_metrics`** — pure derived metrics from a frozen
18//!   `PositionAccountBundle`
19//! - **`error`**, **`plan_error`** — error types
20
21pub mod error;
22pub mod metadata;
23pub mod plan;
24pub mod pool_metrics;
25pub mod position_metrics;
26pub mod quote_math;
27pub mod utils;
28
29// Re-export commonly used items for convenience
30pub use error::RaydiumClmmError;
31pub use plan_error::{FetchError, OrchestrateError, PlanError};
32pub use quote_math::{
33    calculate_decrease_liquidity_quote, calculate_increase_liquidity_quote, collect_fees_quote,
34    collect_rewards_quote, CollectFeesQuote, CollectRewardQuote, CollectRewardsQuote,
35};
36pub use token::{
37    account_planner::{TokenAccountInstructions, TokenAccountStrategy},
38    account_state::{MintAndAta, TokenAccountState},
39    get_current_transfer_fee,
40};
41// Re-export shared FCIS error types and pure token-account helpers from
42// wp-solana-core (matches meteora-core / orca-core). Preserves the
43// `wp_solana_raydium_clmm_core::{plan_error, token}` path shapes that
44// in-tree consumers depend on.
45pub use wp_solana_core::{plan_error, token};