How to Achieve Desired Routing
/quote
protocols
and routingPreference
fields. We recommend specifying the desired swap routing by specifying all protocols
which you feel comfortable using and leaving the routingPreference
field blank.
protocols
field is used to specify the protocols from which pricing will be considered and through which your swap may eventually be executed. The possible values for the field are V2
, V3
, V4
, UNISWAPX_V2
, and UNISWAPX_V3
routingPreference
field is used to specify the preferred matching strategy. The possible values for the field are BEST_PRICE
and FASTEST
routingPreference
field previously supported additional values. These additional values are now deprecated (see the sunset notice). For more information, see the migration section below.protocols
and routingPreference
fields, see the field descriptions in the /quote. A summary is provided below:
protocols
as V2
, V3
, and/or V4
.protocols
as UNISWAPX_V2
or UNISWAPX_V3
. Note that multiple UniswapX protocols may not be specified in the same request.protocols
or routingPreference
. Note that wrapping/unwrapping is not supported through UniswapX protocols at all and a request to wrap/unwrap when protocols
is set to any UniswapX protocol will fail.protocols
specified, set routingPreference
to BEST_PRICE
protocols
specified, set routingPreference
to FASTEST
. (Note that this will not consider private liquidity available via the UniswapX protocols.)routingPreference
field which is not BEST_PRICE
or FASTEST
, you are using a deprecated method of specifying your swap routing. You must migrate to specifying the protocols you have whitelisted in the protocols
field. A mapping of deprecated routingPreference
values to new protocols
fields are presented in the following table, assuming you permit all protocols values today:
routingPreference Legacy Value | Equivalent protocols Value |
---|---|
CLASSIC | V2, V3, V4 |
UNISWAPX_V2 | UNISWAPX_V2 |
BEST_PRICE_V2 | V2, V3, V4, UNISWAPX_V2 |
V2_ONLY | V2 |
V3_ONLY | V3 |
routingPreference
protocols
and routingPreference