OKX DEX pricing data and EVM transaction data belong to different response layers. A route display should not be treated as a wallet request.
The quote reference describes price and route discovery. The swap reference documents GET /api/v6/dex/aggregator/swap, with route information in routerResult and executable fields in tx inside the response data.
Validate the envelope before the fields
Check the HTTP result, provider result code and expected data shape before reading the transaction. A successful transport response alone should not enable the confirmation button. Preserve provider errors as structured diagnostics.
In an EVM adapter, validate the returned sender, destination, calldata and native value against the current request. Keep gas and fee quantities in integer-compatible representations. Do not pass a Solana-oriented response through an EVM transaction parser merely because both came from the same provider.
Bind construction to the caller
The swap request includes the wallet execution context and slippage setting. Pass the actual account that will interact with the router, and represent a different output recipient explicitly where supported. A form account change invalidates the built payload.
After checking balance and permission prerequisites, simulate the transaction that will actually be submitted. A route estimate is useful for display but does not substitute for validating that concrete execution context.
Handle additional signing data deliberately
The swap schema can return signing-related information. Implement only the documented mode your adapter supports, and reject an unexpected signing branch instead of ignoring it.
Keep fixtures for a provider error, empty data, a quote-only response, a valid EVM transaction and an unsupported signing mode. The first three should never be normalized into an empty transaction that reaches the wallet.
Sources & verification (2)
Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.
- Get Quotes
v6 quote schema, chainIndex, amount units and native sentinel
https://web3.okx.com/onchainos/dev-docs/trade/dex-get-quote - Swap
v6 swap response and transaction fields
https://web3.okx.com/onchainos/dev-docs/trade/dex-swap