Skip to main content

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

FieldTypeRequiredDescription
market_typestringYesOne of the supported market types (see below).
pumpfunobjectNoPump.fun bonding curve context.
pumpswapobjectNoPumpSwap AMM context.
meteora_dbcobjectNoMeteora DBC context.
meteora_damm_v2objectNoMeteora DAMM V2 context.
raydium_launchpadobjectNoRaydium Launchpad context.
raydium_cpmmobjectNoRaydium 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

ValueProtocol
pump_funPump.fun
pump_swapPumpSwap
meteora_dbcMeteora DBC
meteora_damm_v2Meteora DAMM V2
raydium_launchpadRaydium Launchpad
raydium_cpmmRaydium CPMM

Nested Context Objects

PumpFunContextMsg

Empty object. Pump.fun bonding curve tokens do not require additional pool context.
{
  "market_type": "pump_fun",
  "pumpfun": {}
}

PumpSwapContextMsg

FieldTypeRequiredDescription
poolstringYesPumpSwap pool address.
global_configstringNoPumpSwap global config address.
{
  "market_type": "pump_swap",
  "pumpswap": {
    "pool": "PoolAddr...",
    "global_config": "ConfigAddr..."
  }
}

MeteoraDbcContextMsg

FieldTypeRequiredDescription
poolstringYesMeteora DBC pool address.
configstringYesPool configuration address.
quote_mintstringYesQuote asset mint (SOL or other).
{
  "market_type": "meteora_dbc",
  "meteora_dbc": {
    "pool": "PoolAddr...",
    "config": "ConfigAddr...",
    "quote_mint": "So111..."
  }
}

MeteoraDammV2ContextMsg

FieldTypeRequiredDescription
poolstringYesMeteora DAMM V2 pool address.
{
  "market_type": "meteora_damm_v2",
  "meteora_damm_v2": {
    "pool": "PoolAddr..."
  }
}

RaydiumLaunchpadContextMsg

FieldTypeRequiredDescription
poolstringYesRaydium Launchpad pool address.
configstringYesPool configuration address.
platformstringYesPlatform address.
quote_mintstringYesQuote asset mint.
user_quote_accountstringYesUser’s quote token account.
{
  "market_type": "raydium_launchpad",
  "raydium_launchpad": {
    "pool": "PoolAddr...",
    "config": "ConfigAddr...",
    "platform": "PlatformAddr...",
    "quote_mint": "So111...",
    "user_quote_account": "QuoteATA..."
  }
}

RaydiumCpmmContextMsg

FieldTypeRequiredDescription
poolstringYesRaydium CPMM pool address.
configstringYesPool configuration address.
quote_mintstringYesQuote asset mint.
user_quote_accountstringYesUser’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;
}