1inch

1inch Resolver to get buy and sell details. You can view details like source code, ABIs on Etherscan.

Get buy amount

Get buy token details like amount and unit amount

dsa.oneInch.getBuyAmount(buyToken, sellToken, sellAmt, slippage, distribution, disableDexes);

Parameter

Type

Description

buyToken

address

The buy token symbol.

sellToken

address

The sell token symbol.

sellAmt

number

The amount of tokens to sells.

slippage

number

The slippage in percent eg - 1 means 1%, 10 means 10%, etc

distribution

array

(Optional) If not defined, default will be used. The distribution of DEXs to swap accross

disableDexes

number

(Optional) If not all DEXs will stay enabled. The number of DEXs to disable.

Returns: Object of sell token details

{
  buyAmt: "2208.0499999999997",
  buyAmtRaw: "2208050000000000000000",
  unitAmt: "216388900000000000000",
  distribution: ["0", "0", ..]
}

Return Parameter

Type

Description

buyAmt

number/string

Expected buy token amount.

buyAmtRaw

number/string

Expected buy token amount in decimal form.

unitAmt

number/string

The unit amount is the minimum amount of buy token expected per sell token. It is calculated with the help of slippage. The parameter is passed directly in the kyber connector.

distribution

array

The distribution of swap across differnt DEXs.

Last updated