Uniswap

Uniswap Resolver

Uniswap 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.uniswap.getBuyAmount(buyToken, sellToken, sellAmt, slippage);
ParameterTypeDescription
buyTokenaddress/stringThe buy token address or symbol.
sellTokenaddress/stringThe sell token address or symbol.
sellAmtnumberThe amount of tokens to sells.
slippagenumberThe slippage in percent eg - 1 means 1%, 10 means 10%, etc

Returns: Object of buy token details.

{
  buyAmt: 236.20778018242365,
  buyAmtRaw: "236207780182423627288",
  unitAmt: "236184159404405384925"
}
Return ParameterTypeDescription
buyAmtnumberExpected buy token amount.
buyAmtRawnumberExpected buy token amount in decimal form.
unitAmtnumberThe 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 Uniswap connector.

Get Sell amount.

Get sell token details like amount and unit amount.

dsa.uniswap.getSellAmount(buyToken, sellToken, sellAmt, slippage);
ParameterTypeDescription
buyTokenaddress/stringThe buy token address or symbol.
sellTokenaddress/stringThe sell token address or symbol.
sellAmtnumberThe amount of tokens to sells.
slippagenumberThe slippage in percent eg - 1 means 1%, 10 means 10%, etc

Returns: Object of buy token details.

{
  sellAmt: 4.234905980688704,
  sellAmtRaw: "4234905980688704170",
  unitAmt: "4235329471286773"
}
Return ParameterTypeDescription
sellAmtnumberExpected sell token amount.
sellAmtRawnumberExpected sell token amount in decimal form.
unitAmtnumberThe 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 Uniswap connector.

Get Deposit amount.

Get deposit token details like amount and unit amount.

dsa.uniswap.getDepositAmount(tokenA, tokenB, amtA);
ParameterTypeDescription
tokenAaddress/stringThe token A address/symbol
tokenBaddressThe token B address/symbol.
amtAnumberThe token A amount in decimals form.

Returns: Object of deposit token details.

{
  amountA: 1000, 
  amountB: 4.220445538525322, 
  amountB_Raw: "4220445538525322000", 
  unitAmt: "4220445538525322"
}
Return ParameterTypeDescription
amountAnumberThe amount of token A to deposit.
amountBnumberThe expected tokenB amount to deposit.
amountB_RawnumberThe expected tokenB amount to deposit in decimal form.
unitAmtnumberThe amountB / amountA with slippage. The unit amount is the minimum amount of tokenB per tokenA to deposit.

Get Withdraw amount.

Get withdraw token details like amount and unit amount.

dsa.uniswap.getWithdrawAmount(tokenA, tokenB, uniAmt, slippage);
ParameterTypeDescription
tokenAaddress/stringThe token A address or symbol
tokenBaddress/stringThe token B address or symbol.
uniAmtnumberThe uni token amount in decimals.
slippagenumberThe slippage of trade.

Returns: Object of withdraw token details.

{
  amountA: 15861.653879312871,
  amountB: 66.94324634857887,
  amountA_Raw: "15861653879312872303739",
  amountB_Raw: "66943246348578875300",
  unitAmtA: "15860067713924941017",
  unitAmtB: "66936552023944017"
}
Return ParameterTypeDescription
amountAnumberThe expected amount of tokenA to withdraw.
amountBnumberThe expected amount of tokenB to withdraw.
amountA_RawnumberThe expected tokenA amount to withdraw in decimal form.
amountB_RawnumberThe expected tokenB amount to withdraw in decimal form.
unitAmtAnumberThe unit amount is the minimum amount of tokenA per uni token to withdraw.
unitAmtBnumberThe unit amount is the minimum amount of tokenB per uni token to withdraw.

Get Position.

Fetch the Uniswap position details of an address.

dsa.uniswap.getPosition(address, tokenPair);
ParameterTypeDescription
addressaddressThe user address.
keyarrayThe token pair array. Eg: [{tokenA: _addrA, tokenB: _addrB}]

Returns: Object with all the Uniswap details.

[
  {
      amountA: 18137.821372507322, 
      amountB: 18451.728375, 
      uniTokenAmount: 0.018134598864049847
  }
]
Return ParameterTypeDescription
amountAnumberThe amount of token A.
amountBnumberThe amount of token B.
uniTokenAmountnumberThe uni token amount i.e. Uniswap token amount for a specific pool to determine the share in the pool.

If you still can't find something you're looking for or have any questions, ask them at our developers community on Telegram, Discord or simply send an Email.

Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.

Best way to stay connected with our progress.