Closed Sky1706 closed 3 months ago
run yarn install to update sdk, it returns in latest version. also isValidAmmPool is used to check poolInfo from api, if getRpcPoolInfo returns data means this pool is a valid amm pool, you don't have to call isValidAmmPool check again.
But while I am using getRpcPoolInfo, which returns data in computePairAmount then I got an Error adding liquidity: TypeError: Cannot read properties of undefined (reading 'decimals').
const r = raydium.liquidity.computePairAmount({
poolInfo,
amount: inputAmount,
baseIn: true,
slippage: new Percent(1, 100), // 1%
});
what's your pool id? this might cause by you are fetching wrong data from api
Pool id: 3uVW9GBTTSZjqR53y9HYo8KYDqTxC9pxcqDPAjhsLdJR
and also in demo code there's no code to fetch getRpcPoolInfo, if you pass wrong type of poolInfo to computePairAmount, it will throw error, please check
3uVW9GBTTSZjqR53y9HYo8KYDqTxC9pxcqDPAjhsLdJR this is not a valid pool id.. please make sure
I am using this getRpcPoolInfo function for devnet please correct me I am using wrong function.
3uVW9GBTTSZjqR53y9HYo8KYDqTxC9pxcqDPAjhsLdJR this is not a valid pool id.. please make sure
- pool exist in https://raydium.io/liquidity-pools/
- pool are returned by raydium api
I am creating pool on devnet
you can't use pool info from getRpcPoolInfo, if you wrote in typescript, it will throw error...
okay so is there any other function i can use to get pool info on Devnet.
// note: api doesn't support get devnet pool info you should test on mainnet, api doesn't support devent, please notice comments in code.
Yes, I go through with this comment, but I thought we could use getRpcPoolInfo on devnet.
I am using getRpcPoolInfo to get pool details but in res not getting programId.
{ status: <BN: 6>, nonce:,
maxOrder: <BN: 7>,
depth: <BN: 3>,
baseDecimal: <BN: 9>,
quoteDecimal: <BN: 9>,
state: <BN: 1>,
resetFlag: <BN: 0>,
minSize: <BN: 3b9aca00>,
volMaxCutRatio: <BN: 1f4>,
amountWaveRatio: <BN: 4c4b40>,
baseLotSize: <BN: 3b9aca00>,
quoteLotSize: <BN: 989680>,
minPriceMultiplier: <BN: 1>,
maxPriceMultiplier: <BN: 3b9aca00>,
systemDecimalValue: <BN: 3b9aca00>,
minSeparateNumerator: <BN: 5>,
minSeparateDenominator: <BN: 2710>,
tradeFeeNumerator: <BN: 19>,
tradeFeeDenominator: <BN: 2710>,
pnlNumerator: ,
pnlDenominator: <BN: 64>,
swapFeeNumerator: <BN: 19>,
swapFeeDenominator: <BN: 2710>,
baseNeedTakePnl: <BN: 0>,
quoteNeedTakePnl: <BN: 0>,
quoteTotalPnl: <BN: 0>,
baseTotalPnl: <BN: 0>,
poolOpenTime: <BN: 0>,
punishPcAmount: <BN: 0>,
punishCoinAmount: <BN: 0>,
orderbookToInitTime: <BN: 0>,
swapBaseInAmount: <BN: 0>,
swapQuoteOutAmount: <BN: 0>,
swapBase2QuoteFee: <BN: 0>,
swapQuoteInAmount: <BN: 0>,
swapBaseOutAmount: <BN: 0>,
swapQuote2BaseFee: <BN: 0>,
baseVault: PublicKey [PublicKey(FEWTEWXL3u6441ZdSJzLp1eeiWMu1YLcBkZSYN5BuzR4)] {
_bn:
},
quoteVault: PublicKey [PublicKey(GdSYWHKd3CjNimHTW9xfQtXLwkXVRWTj4iRBiJYV5DNJ)] {
_bn:
},
baseMint: PublicKey [PublicKey(So11111111111111111111111111111111111111112)] {
_bn: <BN: 69b8857feab8184fb687f634618c035dac439dc1aeb3b5598a0f00000000001>
},
quoteMint: PublicKey [PublicKey(8ZqySVBxQSn243Cu4FCp2xXyM6Cutw84ZyJAmcioTin4)] {
_bn: <BN: 706bc4b7b35d7c947392b6177ca15953f42637239784c16e9d727ebbce02f849>
},
lpMint: PublicKey [PublicKey(2y8UVSVpMUW3TApB5Lii9uMz8pKN349GmSTWT9P4SVDX)] {
_bn: <BN: 1d3ca9bfab660b18a2e8f18c57abc78d9f87e546e6b594af95133be4a8b13b9e>
},
openOrders: PublicKey [PublicKey(BoL5Jkxo199rendeQSbm1qwHL4cMVrGfsjAFX4KNo1TC)] {
_bn:
},
marketId: PublicKey [PublicKey(FZNPdpkQjRvaxDjQvs1VETGkQ2ShxdpuakZXeuf4ZWdw)] {
_bn:
},
marketProgramId: PublicKey [PublicKey(EoTcMgcDRTJVZDMZWBoU6rhYHZfkNTVEAfz3uUJRcYGj)] {
_bn:
},
targetOrders: PublicKey [PublicKey(HeP1gDLi6853afjfTRFgDGXbV9TuBdcqgcLyKvSBbPLH)] {
_bn:
},
withdrawQueue: PublicKey [PublicKey(11111111111111111111111111111111)] {
_bn: <BN: 0>
},
lpVault: PublicKey [PublicKey(11111111111111111111111111111111)] {
_bn: <BN: 0>
},
owner: PublicKey [PublicKey(Adm29NctkKwJGaaiU8CXqdV6WDTwR81JbxV8zoxn745Y)] {
_bn: <BN: 8f23dd5f0cef66174bc0330afc30a2bc999e235fafeca689e9c80aad792ee793>
},
lpReserve: <BN: 2540be400>,
padding: [ <BN: 0>, <BN: 0>, <BN: 0> ],
baseReserve: <BN: 3b9aca00>,
quoteReserve: <BN: 174876e800>,
poolPrice: 100
}
This is a console of getRpcInfo response.