OKX DEX API on Solana: Router Swaps, Routes, Commissions
OKX DEX runs a swap aggregation router on Solana, program proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u. It splits a trade across Solana venues and settles it in one transaction. Bitquery records each routed swap in the Solana DEXTrades and DEXTradeByTokens cubes under ProtocolFamily: "OKX" and ProtocolName: "dex_solana_v3". In the hour to 10:00 UTC on 2026-10-26 the router carried about 15,000 trades worth $3.3 million.
Two things shape every query on this page:
- The user's wallet is in
Trade.Buy.Account.Owner. Apps that sign for their users, such as FOMO, appear asTransaction.Signer, so the signer is not always the trader. - A routed swap produces more than one trade row. The OKX row is the user's trade; the pools along the route appear as separate rows with their own protocol names. Filter on
ProtocolFamily: "OKX"to count each user trade once.
Every example runs in the Bitquery IDE. To stream one, change query to subscription and remove limit and orderBy. For other Solana aggregators, see the DFlow API and the Jupiter API.
Latest OKX DEX swaps on Solana
query OkxDexSolanaLatestSwaps {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProtocolFamily: {is: "OKX"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Trade {
Buy {
Amount
AmountInUSD
Account {
Owner
}
Currency {
Symbol
MintAddress
}
}
Sell {
Amount
AmountInUSD
Currency {
Symbol
MintAddress
}
}
Dex {
ProtocolName
ProgramAddress
}
}
}
}
}
Apps and bots using the OKX DEX router
Groups the last hour of router trades by transaction signer. Many distinct user wallets under one signer means an app that signs for its users; one wallet means a wallet or bot trading for itself.
query OkxDexSolanaSigners {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descendingByField: "trades"}
where: {Trade: {Dex: {ProtocolFamily: {is: "OKX"}}}, Block: {Time: {since_relative: {minutes_ago: 60}}}, Transaction: {Result: {Success: true}}}
) {
Transaction {
Signer
}
trades: count
users: uniq(of: Trade_Buy_Account_Owner)
volume_usd: sum(of: Trade_Buy_AmountInUSD)
}
}
}
Most traded tokens through the OKX DEX router
Ranks tokens by USD volume in the last hour, leaving out SOL and USDC.
query OkxDexSolanaTopTokens {
Solana {
DEXTradeByTokens(
limit: {count: 20}
orderBy: {descendingByField: "volume_usd"}
where: {Trade: {Dex: {ProtocolFamily: {is: "OKX"}}, Currency: {MintAddress: {notIn: ["So11111111111111111111111111111111111111112", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]}}}, Block: {Time: {since_relative: {minutes_ago: 60}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Currency {
Symbol
MintAddress
}
}
trades: count
volume_usd: sum(of: Trade_Side_AmountInUSD)
}
}
}
OKX DEX trades of one wallet
Replace the address with the wallet you want.
query OkxDexSolanaWalletTrades {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProtocolFamily: {is: "OKX"}}, Buy: {Account: {Owner: {is: "6fXBfTmEUJiKiXZ7mJp29usqzids9LADGRDzoaaxTSsA"}}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Trade {
Buy {
Amount
AmountInUSD
Currency {
Symbol
}
}
Sell {
Amount
Currency {
Symbol
}
}
}
}
}
}
Route legs: which venue filled each part
The router logs a SwapEvent for every leg. The dex argument is a JSON enum naming the venue and instruction, for example PumpfunammBuy2, and amount_in / amount_out are the leg's amounts in each token's smallest unit.
query OkxDexSolanaRouteLegs {
Solana {
Instructions(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Instruction: {Program: {Address: {is: "proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u"}, Method: {is: "SwapEvent"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
}
Instruction {
Program {
Arguments {
Name
Value {
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
... on Solana_ABI_Json_Value_Arg {
json
}
}
}
}
}
}
}
}
Commissions on OKX DEX swaps
Apps that integrate the router can take a commission. The router logs it in SwapWithFeesCpiEvent2 (single commission account) and SwapWithFeeCpiEventV3 (several commission levels). This query keeps events where commission_amount is above zero. Each row names the source and destination mints, the token-account owners, the commission_amount, the commission_account and, where set, a platform fee and a trim amount.
query OkxDexSolanaCommissions {
Solana {
Instructions(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Instruction: {Program: {Address: {is: "proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u"}, Method: {is: "SwapWithFeesCpiEvent2"}, Arguments: {includes: {Name: {is: "commission_amount"}, Value: {BigInteger: {gt: "0"}}}}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Instruction {
Program {
Arguments {
Name
Value {
... on Solana_ABI_Address_Value_Arg {
address
}
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
... on Solana_ABI_Integer_Value_Arg {
integer
}
... on Solana_ABI_Boolean_Value_Arg {
bool
}
}
}
}
}
}
}
}
SwapWithFeeCpiEventV3 carries multi-level commissions as JSON lists (commission_rates, commission_amounts, commission_accounts) with a total_commission_amount; in the sample on 2026-10-26 its commissions were zero.
Pitfalls
- Count user trades on the OKX row only. The pool rows of the same transaction repeat the trade.
- Signer is not the user for app trades. Use
Trade.Buy.Account.Owner. - Instruction data covers about 8 hours. The route-leg and commission queries read
Instructions, which is real-time only.
Frequently Asked Questions
Does OKX DEX have a router on Solana?
Yes. The OKX DEX aggregation router is program proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u. Bitquery records its swaps with ProtocolFamily OKX and ProtocolName dex_solana_v3.
How do I get OKX DEX swaps on Solana?
Query Solana DEXTrades with Trade.Dex.ProtocolFamily equal to OKX. Each row is one user trade with amounts, USD value and the user's wallet in Trade.Buy.Account.Owner.
How do I see OKX DEX commissions?
Read SwapWithFeesCpiEvent2 and SwapWithFeeCpiEventV3 instructions on the router program. They log the commission amount and account for each swap.
Ready to run this in production?
Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.