CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

How to get liquidity of tokens (example bnb – cake)?

I need to get liquidity of tokens. Example, bnb – cake, new token – bnb, new token – busd.

I found 2 options as I can.

First option, It use lp address.

https://bscscan.com/token/0x67efef66a55c4562144b9acfcfbc62f9e4269b3e?a=0xb1b9b4bbe8a92d535f5df2368e7fd2ecfb3a1950

use a decision

  // Ratio in % of LP tokens that are staked in the MC, vs the total number in circulation   lpTokenRatio = lpTokenBalanceMC * lpTotalSupply    // Raw amount of token in the LP, including those not staked   tokenAmountTotal = tokenBalanceLP / BIG_TEN.pow(tokenDecimals)   anyTokenAmountTotal = anyTokenBalanceLP / BIG_TEN.pow(quoteTokenDecimals)    // Amount of quoteToken in the LP that are staked in the MC   anyTokenAmountMc = anyTokenAmountTotal * lpTokenRatio    // Total staked in LP, in quote token value   lpTotalInAnyToken = quoteTokenAmountMc * new BigNumber(2)   totalLiqiudity  = lpTotalInAnyToken  * anyTokenPriceBusd 

But, I don’t know how to get new lp address.

Second option, It use https://docs.uniswap.org/sdk/2.0.0/reference/pair#getliquidityvalue, However, I saw

getLiquidityValue(   token: Token,   totalSupply: TokenAmount,   liquidity: TokenAmount,   feeOn: boolean = false,   kLast?: BigintIsh ): TokenAmount 

There is third argument is liquidity, but I think I get a liquidity.

I hope, smb know to get a liquidity.

How to get Routing info from 0x API?

I am using 0x for making the token swaps. This API is returning router address but I don’t know how to get the routing like pancakeswap Is there a way where I can get the route like this from 0x? here is the router info I am getting from 0x { "makerToken": "0x55d398326f99059ff775485246999027b3197955", "takerToken": "0xe9e7cea3dedca5984780bafc599bd69add087d56",::Listen

I am using 0x for making the token swaps. This API is returning router address but I don’t know how to get the routing like pancakeswap

enter image description here

Is there a way where I can get the route like this from 0x? here is the router info I am getting from 0x

   {         "makerToken": "0x55d398326f99059ff775485246999027b3197955",         "takerToken": "0xe9e7cea3dedca5984780bafc599bd69add087d56",         "makerAmount": "996210902076413096",         "takerAmount": "1000000000000000000",         "fillData": {             "tokenAddressPath": [                 "0xe9e7cea3dedca5984780bafc599bd69add087d56",                 "0x55d398326f99059ff775485246999027b3197955"             ],             "router": "0x10ed43c718714eb63d5aa57b78b54704e256024e"         },         "source": "PancakeSwap_V2",         "sourcePathId": "0x4ed1c8ca19dc52243f09245ad678246f8089a816c744dd0d34e1593e6434c188",         "type": 0     } 

How to get liquidity of tokens (example bnb – cake)?

Shopping cart
There are no products in the cart!
Continue shopping
0