GetAmountsOut

Sushiswap Action Plugin - GetAmountsOut

Description

Given an input asset amount and an array of token addresses, calculates all subsequent maximum output token amounts.

Method

getAmountsOut(uint256, address[])

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Sushiswap Router address

Method Parameters

NamePlugin TypeDescription

amountIn

FctValue

Input asset amount

path

FctAddressList

Path of the trade

Returned Values

NamePlugin TypeDescription

firstAmount

FctValue

First amount out

lastAmount

FctValue

Last amount out

Example

Example with initParams

const getAmountsOut = new Sushiswap.getters.GetAmountsOut({
 chainId: 1,
 initParams: {
   to: "0x..." // Sushiswap Router
   methodParams: {
     amountIn: "...",
     path: ["0x...", "0x..."],
   }
 }
})

Example without initParams

const getAmountsOut = new Sushiswap.getters.GetAmountsOut({ 
  chainId: 1
})

getAmountsOut.input.set({
   to: "0x..." // Sushiswap Router
   methodParams: {
     amountIn: "...",
     path: ["0x...", "0x..."],
   }
})

Learn more

Learn more about Sushiswap GetAmountsOut function here

Last updated