ExactInputSingle

Uniswap V3 Action Plugin - ExactInputSingle

Description

Swaps amountIn of one token for as much as possible of another token

Method

exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160))

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Swap Router address

Method Parameters

NamePlugin TypeDescription

params.tuple

FctTuple

"Params.tuple" parameters

NamePlugin TypeRequired?Description

tokenIn

FctAddress

Token to spend

tokenOut

FctAddress

Token to receive

fee

FctValue24

Fee of the pool

amountIn

FctValue

Amount to spend in the swap

amountOutMinimum

FctValue

Min amount to receive

sqrtPriceLimitX96

FctValue160

recipient

FctAddress

deadline

FctValue

Returned Values

NamePlugin TypeDescription

amountOut

FctValue

The amount of tokenOut received in the swap

Example

Example with initParams

const exactInputSingle = new UniswapV3.actions.ExactInputSingle({
 chainId: 1,
 initParams: {
   to: "0x..." // Swap router
   methodParams: {
     "params.tuple": {
       tokenIn: "...",
       tokenOut: "...",
       fee: "...",
       amountIn: "...",
       amountOutMinimum: "...",
       sqrtPriceLimitX96: "...",
       recipient: "...",
       deadline: "...",
     }
   }
 }
})

Example without initParams

const exactInputSingle = new UniswapV3.actions.ExactInputSingle({ chainId: 1 })

exactInputSingle.input.set({
   to: "0x..." // Swap router
   methodParams: {
     "params.tuple": {
       tokenIn: "...",
       tokenOut: "...",
       fee: "...",
       amountIn: "...",
       amountOutMinimum: "...",
       sqrtPriceLimitX96: "...",
       recipient: "...",
       deadline: "...",
     }
   }
})

Learn more

Learn more about Uniswap V3 ExactInputSingle function here

Last updated