paraswap-sdk icon indicating copy to clipboard operation
paraswap-sdk copied to clipboard

Other routes are not fetched when targeting the api/prices

Open Chandraprakash-Darji opened this issue 2 years ago • 8 comments

I have been trying to fetch the data from the apiv5 but not getting the other routes image I have also tried using the api playground image

Chandraprakash-Darji avatar Feb 20 '23 15:02 Chandraprakash-Darji

Are you passing options.otherExchangePrices: true to SDK.getRate call?

const priceRoute = await paraSwap.getRate({
      srcToken: ETH,
      destToken: DAI,
      amount: srcAmount,
      userAddress: senderAddress,
      side: SwapSide.SELL,
      options: {
        otherExchangePrices: true,
      },
    });

You can see an example in tests

In API request it translates to otherExchangePrices=true query parameter. You can see this parameter in the playground.

Velenir avatar Feb 20 '23 17:02 Velenir

@Velenir Thanks for helping out

Chandraprakash-Darji avatar Feb 22 '23 13:02 Chandraprakash-Darji

@Velenir Can you help out when I give the value of 1ETH it shows the value is small. When I check the app.paraswap.io there when we add small value lile 1ETH it multily with the "10000000000000000"

Chandraprakash-Darji avatar Feb 22 '23 13:02 Chandraprakash-Darji

Also what is srcDecimal?

Chandraprakash-Darji avatar Feb 22 '23 14:02 Chandraprakash-Darji

@mounibec can you help out?

Chandraprakash-Darji avatar Feb 23 '23 10:02 Chandraprakash-Darji

@mounibec can you help out?

Chandraprakash-Darji avatar Feb 23 '23 10:02 Chandraprakash-Darji

@mounibec can you help out?

Chandraprakash-Darji avatar Feb 23 '23 10:02 Chandraprakash-Darji

@Chandraprakash-Darji You can simple think in blockchain, there is no decimal number, so that we have to multiply the amount to (10 ** srcDecimal) before send to blockchain. Same with desc amount

nmaddp1995 avatar Feb 21 '24 09:02 nmaddp1995