GetAmountsIn

Sushiswap Action Plugin - GetAmountsIn

Description

Given an output asset amount and an array of token addresses, calculates all preceding minimum input token amounts

Method

getAmountsOut(uint256, address[])

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Sushiswap Router address

Method Parameters

NamePlugin TypeDescription

amountOut

FctValue

Output asset amount

path

FctAddressList

Path of the trade

Returned Values

NamePlugin TypeDescription

firstAmount

FctValue

First amount in

lastAmount

FctValue

Last amount in

Example

Example with initParams

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

Example without initParams

const getAmountsIn = new Sushiswap.getters.GetAmountsIn({ 
  chainId: 1
})

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

Learn more

Learn more about Sushiswap GetAmountsIn function here

Last updated