Create the EIP 7702 calldata for a swap transaction (including wrap/unwrap and bridging) against the Uniswap Protocols. If the quote parameter includes the fee parameters, then the calldata will include the fee disbursement. The gas estimates will be more precise when the the response calldata would be valid if submitted on-chain.
curl --request POST \
--url https://trade-api.gateway.uniswap.org/v1/swap_7702 \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"quote": {
"input": {
"token": "<string>",
"amount": "<string>"
},
"output": {
"token": "<string>",
"amount": "<string>",
"recipient": "<string>"
},
"swapper": "<string>",
"chainId": 1,
"slippage": 123,
"tradeType": "EXACT_INPUT",
"gasFee": "<string>",
"gasFeeUSD": "<string>",
"gasFeeQuote": "<string>",
"route": [
[
{
"type": "v2-pool",
"address": "<string>",
"tokenIn": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"tokenOut": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"reserve0": {
"token": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"quotient": "<string>"
},
"reserve1": {
"token": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"quotient": "<string>"
},
"amountIn": "<string>",
"amountOut": "<string>"
}
]
],
"portionBips": 123,
"portionAmount": "<string>",
"portionRecipient": "<string>",
"routeString": "<string>",
"quoteId": "<string>",
"gasUseEstimate": "<string>",
"blockNumber": "<string>",
"gasPrice": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"txFailureReasons": [
"SIMULATION_ERROR"
],
"priceImpact": 123,
"aggregatedOutputs": [
{
"token": "<string>",
"amount": "<string>",
"recipient": "<string>",
"bps": 123,
"minAmount": "<string>"
}
]
},
"permitData": {
"domain": {},
"values": {},
"types": {}
},
"smartContractDelegationAddress": "<string>",
"includeGasInfo": false,
"deadline": 123,
"urgency": "urgent",
"simulateTransaction": true
}
'{
"requestId": "<string>",
"swap": {
"to": "<string>",
"from": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 1,
"gasLimit": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"gasPrice": "<string>"
},
"gasFee": "<string>"
}The version of the Universal Router to use for the swap journey. MUST be consistent throughout the API calls.
1.2, 2.0 Show child attributes
Show child attributes
The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
Show child attributes
The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
The wallet address which will receive the token.
The wallet address which will be used to send the token.
The slippage tolerance as a percentage up to a maximum of two decimal places. For Uniswap Protocols (v2, v3, v4), the slippage tolerance is the maximum amount the price can change between the time the transaction is submitted and the time it is executed. The slippage tolerance is a percentage of the total value of the swap.
When submitting a quote, note that slippage tolerance works differently in UniswapX swaps where it does not set a limit on the Spread in an order. See here for more information.
Note that if the trade type is EXACT_INPUT, then the slippage is in terms of the output token. If the trade type is EXACT_OUTPUT, then the slippage is in terms of the input token.
When submitting a request, slippageTolerance may not be set when autoSlippage is defined. One of slippageTolerance or autoSlippage must be defined.
The handling of the amount field. EXACT_INPUT means the requester will send the specified amount of input tokens and get a quote with a variable quantity of output tokens. EXACT_OUTPUT means the requester will receive the specified amount of output tokens and get a quote with a variable quantity of input tokens.
EXACT_INPUT, EXACT_OUTPUT The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the base unit of the chain.
The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) denominated in USDC.
The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the quoted currency (e.g. output token) in the base units of the quoted currency.
Show child attributes
The address of a contract which will be used to facilitate the swap.
Show child attributes
The symbol of the token.
"ETH"
The number of decimals supported by the token. This number is used to convert token amounts to the token's common representation.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
Show child attributes
The symbol of the token.
"ETH"
The number of decimals supported by the token. This number is used to convert token amounts to the token's common representation.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
The remaining reserve of this token in the pool.
Show child attributes
Show child attributes
The symbol of the token.
"ETH"
The number of decimals supported by the token. This number is used to convert token amounts to the token's common representation.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
The quantity of this token remaining in the pool, specified in the base units of the token.
The remaining reserve of this token in the pool.
Show child attributes
Show child attributes
The symbol of the token.
"ETH"
The number of decimals supported by the token. This number is used to convert token amounts to the token's common representation.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
A fee charged by the token specified in basis points. Field is not present if the token does not charge a fee.
The quantity of this token remaining in the pool, specified in the base units of the token.
The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
The portion of the swap that will be taken as a fee stated in basis points. The fee will be taken from the output token.
The portion of the swap that will be taken as a fee in the base units of the token. The fee will be taken from the output token.
The wallet address which will receive the fee.
The route in string format.
A unique ID for the quote.
The estimated gas use. It does NOT include the additional gas for token approvals.
The current block number.
The cost per unit of gas.
The sum of the base fee and priority fee. Subtracting maxPriorityFeePerGas from this value will yield the base fee to be paid for this transaction.
The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
The reason(s) why the transaction failed during simulation.
SIMULATION_ERROR, UNSUPPORTED_SIMULATION, SIMULATION_UNAVAILABLE, SLIPPAGE_TOO_LOW, TRANSFER_FROM_FAILED The impact the trade has on the market price of the pool, between 0-100 percent
Show child attributes
The quantity of tokens denominated in the token's base units. (For example, for an ERC20 token one token is 1x10^18 base units. For one USDC token one token is 1x10^6 base units.) This value must be greater than 0.
The wallet address which will receive the token.
The portion of the swap stated in basis points.
The minimum portion of the swap, stated in the base unit of the token, which will be output to the recipient.
The unix timestamp at which the order will be reverted if not filled.
The urgency impacts the estimated gas price of the transaction. The higher the urgency, the higher the gas price, and the faster the transaction is likely to be selected from the mempool. The default value is urgent.
normal, fast, urgent Create 7702 swap successful.
A unique ID for the request.
Show child attributes
The wallet address which will receive the token.
The wallet address which will be used to send the token.
The calldata for the transaction.
The quantity of ETH tokens approved for spending by the transaction, denominated in wei. Note that by default Uniswap Labs sets this to the maximum approvable spend.
The maximum units of gas that will be consumed by this transaction.
The sum of the base fee and priority fee. Subtracting maxPriorityFeePerGas from this value will yield the base fee to be paid for this transaction.
The maximum tip to the block builder. Adjusted based upon the urgency specified in the request.
The cost per unit of gas.
The total estimated gas cost of this transaction (eg. gasLimit multiplied by maxFeePerGas) in the base unit of the chain.
curl --request POST \
--url https://trade-api.gateway.uniswap.org/v1/swap_7702 \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"quote": {
"input": {
"token": "<string>",
"amount": "<string>"
},
"output": {
"token": "<string>",
"amount": "<string>",
"recipient": "<string>"
},
"swapper": "<string>",
"chainId": 1,
"slippage": 123,
"tradeType": "EXACT_INPUT",
"gasFee": "<string>",
"gasFeeUSD": "<string>",
"gasFeeQuote": "<string>",
"route": [
[
{
"type": "v2-pool",
"address": "<string>",
"tokenIn": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"tokenOut": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"reserve0": {
"token": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"quotient": "<string>"
},
"reserve1": {
"token": {
"address": "<string>",
"chainId": 1,
"symbol": "ETH",
"decimals": "<string>",
"buyFeeBps": "<string>",
"sellFeeBps": "<string>"
},
"quotient": "<string>"
},
"amountIn": "<string>",
"amountOut": "<string>"
}
]
],
"portionBips": 123,
"portionAmount": "<string>",
"portionRecipient": "<string>",
"routeString": "<string>",
"quoteId": "<string>",
"gasUseEstimate": "<string>",
"blockNumber": "<string>",
"gasPrice": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"txFailureReasons": [
"SIMULATION_ERROR"
],
"priceImpact": 123,
"aggregatedOutputs": [
{
"token": "<string>",
"amount": "<string>",
"recipient": "<string>",
"bps": 123,
"minAmount": "<string>"
}
]
},
"permitData": {
"domain": {},
"values": {},
"types": {}
},
"smartContractDelegationAddress": "<string>",
"includeGasInfo": false,
"deadline": 123,
"urgency": "urgent",
"simulateTransaction": true
}
'{
"requestId": "<string>",
"swap": {
"to": "<string>",
"from": "<string>",
"data": "<string>",
"value": "<string>",
"chainId": 1,
"gasLimit": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"gasPrice": "<string>"
},
"gasFee": "<string>"
}