Overview
MarketContextMsg describes the DEX pool and protocol used for a token’s market. It appears in:
position_opened server events
exit_signal_with_tx server events
BuildSellTxRequest (optional, to skip server side resolution)
If omitted from a build request, the server resolves the context automatically.
MarketContextMsg Schema
| Field | Type | Required | Description |
|---|
market_type | string | Yes | One of the supported market types (see below). |
pumpfun | object | No | Pump.fun bonding curve context. |
pumpswap | object | No | PumpSwap AMM context. |
meteora_dbc | object | No | Meteora DBC context. |
meteora_damm_v2 | object | No | Meteora DAMM V2 context. |
raydium_launchpad | object | No | Raydium Launchpad context. |
raydium_cpmm | object | No | Raydium CPMM context. |
Exactly one of the nested objects should be present, matching the market_type.
The market_type value uses underscores (e.g. pump_fun) while the nested object key does not (e.g. pumpfun). Match the exact casing shown in the tables below.
market_type Values
| Value | Protocol |
|---|
pump_fun | Pump.fun |
pump_swap | PumpSwap |
meteora_dbc | Meteora DBC |
meteora_damm_v2 | Meteora DAMM V2 |
raydium_launchpad | Raydium Launchpad |
raydium_cpmm | Raydium CPMM |
Nested Context Objects
PumpFunContextMsg
Empty object. Pump.fun bonding curve tokens do not require additional pool context.
{
"market_type": "pump_fun",
"pumpfun": {}
}
PumpSwapContextMsg
| Field | Type | Required | Description |
|---|
pool | string | Yes | PumpSwap pool address. |
global_config | string | No | PumpSwap global config address. |
{
"market_type": "pump_swap",
"pumpswap": {
"pool": "PoolAddr...",
"global_config": "ConfigAddr..."
}
}
MeteoraDbcContextMsg
| Field | Type | Required | Description |
|---|
pool | string | Yes | Meteora DBC pool address. |
config | string | Yes | Pool configuration address. |
quote_mint | string | Yes | Quote asset mint (SOL or other). |
{
"market_type": "meteora_dbc",
"meteora_dbc": {
"pool": "PoolAddr...",
"config": "ConfigAddr...",
"quote_mint": "So111..."
}
}
MeteoraDammV2ContextMsg
| Field | Type | Required | Description |
|---|
pool | string | Yes | Meteora DAMM V2 pool address. |
{
"market_type": "meteora_damm_v2",
"meteora_damm_v2": {
"pool": "PoolAddr..."
}
}
RaydiumLaunchpadContextMsg
| Field | Type | Required | Description |
|---|
pool | string | Yes | Raydium Launchpad pool address. |
config | string | Yes | Pool configuration address. |
platform | string | Yes | Platform address. |
quote_mint | string | Yes | Quote asset mint. |
user_quote_account | string | Yes | User’s quote token account. |
{
"market_type": "raydium_launchpad",
"raydium_launchpad": {
"pool": "PoolAddr...",
"config": "ConfigAddr...",
"platform": "PlatformAddr...",
"quote_mint": "So111...",
"user_quote_account": "QuoteATA..."
}
}
RaydiumCpmmContextMsg
| Field | Type | Required | Description |
|---|
pool | string | Yes | Raydium CPMM pool address. |
config | string | Yes | Pool configuration address. |
quote_mint | string | Yes | Quote asset mint. |
user_quote_account | string | Yes | User’s quote token account. |
{
"market_type": "raydium_cpmm",
"raydium_cpmm": {
"pool": "PoolAddr...",
"config": "ConfigAddr...",
"quote_mint": "So111...",
"user_quote_account": "QuoteATA..."
}
}
Passing Market Context in Build Requests
You can include market_context in a BuildSellTxRequest to skip server side pool resolution. This is useful when you already have the context from a position_opened or exit_signal_with_tx event.
const request: BuildSellTxRequest = {
mint: "TOKEN_MINT",
user_pubkey: "WALLET",
amount_tokens: 1_000_000,
slippage_bps: 2_000,
market_context: {
market_type: "pump_swap",
pumpswap: { pool: "PoolAddr..." },
},
};
TypeScript Type Reference
type MarketTypeMsg =
| "pump_fun"
| "pump_swap"
| "meteora_dbc"
| "meteora_damm_v2"
| "raydium_launchpad"
| "raydium_cpmm";
interface MarketContextMsg {
market_type: MarketTypeMsg;
pumpfun?: PumpFunContextMsg;
pumpswap?: PumpSwapContextMsg;
meteora_dbc?: MeteoraDbcContextMsg;
meteora_damm_v2?: MeteoraDammV2ContextMsg;
raydium_launchpad?: RaydiumLaunchpadContextMsg;
raydium_cpmm?: RaydiumCpmmContextMsg;
}