Routing Principles
In order to get the appropriate swap routing, it is important to closely consider the values submitted through the/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.
- The
protocolsfield 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 areV2,V3,V4,UNISWAPX_V2, andUNISWAPX_V3 - The
routingPreferencefield is used to specify the preferred matching strategy. The possible values for the field areBEST_PRICEandFASTEST
protocols and routingPreference fields, see the field descriptions in the /quote. A summary is provided below:
- To perform a swap using only Uniswap protocol liquidity pools, specify
protocolsasV2,V3, and/orV4. - To perform a swap using only UniswapX protocol liquidity, specify
protocolsasUNISWAPX_V2orUNISWAPX_V3. Note that multiple UniswapX protocols may not be specified in the same request. - To perform a wrap/unwrap or bridge action, do not specify values for
protocolsorroutingPreference. Note that wrapping/unwrapping is not supported through UniswapX protocols at all and a request to wrap/unwrap whenprotocolsis set to any UniswapX protocol will fail. - To obtain the best possible pricing from all protocols or the limited set of
protocolsspecified, setroutingPreferencetoBEST_PRICE - To obtain the fastest possible quote from all protocols or the limited set of
protocolsspecified, setroutingPreferencetoFASTEST. (Note that this will not consider private liquidity available via the UniswapX protocols.)