Uniswap
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.
Note: Price is depends on the route, so with direct route of two tokens you may not get the best price
Parameter | Type | Description |
buyToken | address/string | The buy token address or symbol. |
sellToken | address/string | The sell token address or symbol. |
sellAmt | number | The amount of tokens to sells. |
slippage | number | The slippage in percent eg - 1 means 1%, 10 means 10%, etc |
Returns: Object
of buy token details.
Return Parameter | Type | Description |
buyAmt | number | Expected buy token amount. |
buyAmtRaw | number | Expected buy token amount in decimal form. |
unitAmt | number | 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 Uniswap connector. |
Get Sell amount
Get sell token details like amount and unit amount.
Note: Price is depends on the route, so with direct route of two tokens you may not get the best price
Parameter | Type | Description |
buyToken | address/string | The buy token address or symbol. |
sellToken | address/string | The sell token address or symbol. |
buyAmt | number | The amount of tokens to buy. |
slippage | number | The slippage in percent eg - 1 means 1%, 10 means 10%, etc |
Returns: Object
of buy token details
Return Parameter | Type | Description |
sellAmt | number | Expected sell token amount. |
sellAmtRaw | number | Expected sell token amount in decimal form. |
unitAmt | number | 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 Uniswap connector. |
Get Deposit amount.
Get deposit token details like amount and unit amount.
Parameter | Type | Description |
tokenA | address/string | The token A address/symbol |
tokenB | address | The token B address/symbol. |
amtA | number | The token A amount in decimals form. |
Returns: Object
of deposit token details
Return Parameter | Type | Description |
amountA | number | The amount of token A to deposit. |
amountB | number | The expected tokenB amount to deposit. |
amountB_Raw | number | The expected tokenB amount to deposit in decimal form. |
unitAmt | number | The 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
Parameter | Type | Description |
tokenA | address/string | The token A address or symbol |
tokenB | address/string | The token B address or symbol. |
uniAmt | number | The uni token amount in decimals. |
slippage | number | The slippage of trade. |
Returns: Object
of withdraw token details
Return Parameter | Type | Description |
amountA | number | The expected amount of tokenA to withdraw. |
amountB | number | The expected amount of tokenB to withdraw. |
amountA_Raw | number | The expected tokenA amount to withdraw in decimal form. |
amountB_Raw | number | The expected tokenB amount to withdraw in decimal form. |
unitAmtA | number | The unit amount is the minimum amount of tokenA per uni token to withdraw. |
unitAmtB | number | The unit amount is the minimum amount of tokenB per uni token to withdraw. |
Get Position
Fetch the Uniswap position details of an address
Parameter | Type | Description |
address | address | The user address. |
key | array | The token pair array. Eg: [{tokenA: _addrA, tokenB: _addrB}] |
Returns: Object
with all the Uniswap details
Return Parameter | Type | Description |
amountA | number | The amount of token A. |
amountB | number | The amount of token B. |
uniTokenAmount | number | The uni token amount i.e. Uniswap token amount for a specific pool to determine the share in the pool. |
Last updated