SwapExactETHForTokens

Sushiswap Action Plugin - SwapExactETHForTokens

Description

Swaps an exact amount of ETH for as many output tokens as possible, along the route determined by the path.

Method

swapExactETHForTokens(uint256, address[], address, uint256)

Input Parameters

Method Parameters

Example

Example with initParams

const swapExactETHForTokens = new Sushiswap.actions.SwapExactETHForTokens({
 chainId: 1,
 initParams: {
   to: "0x..." // Sushiswap Router
   value: "...",
   methodParams: {
     amountOutMin: "...",
     path: ["0x...", "0x..."],
     to: "0x...",
     deadline: "..."
   }
 }
})

Example without initParams

const swapExactETHForTokens = new Sushiswap.actions.SwapExactETHForTokens({ 
   chainId: 1
})

await swapExactETHForTokens.input.set({
   to: "0x..." // Sushiswap Router
   value: "...",
   methodParams: {
     amountOutMin: "...",
     path: ["0x...", "0x..."],
     to: "0x...",
     deadline: "..."
   }
})

Learn more

Learn more about Sushiswap SwapExactETHForTokens function here

Last updated