Comments (24)
i met same error
const directionIn = poolKeys.quoteMint.toString() == toToken ^ TypeError: Cannot read properties of null (reading 'quoteMint')
from raydium-sdk-swap-example-typescript.
i met same error
const directionIn = poolKeys.quoteMint.toString() == toToken ^ TypeError: Cannot read properties of null (reading 'quoteMint')
@soos3d Thanks for your help on this. Its clear the community will use it to trade the latest meme craze of the hour so the acceptance tests should be tight to that use case.
I was able to swap with your default example tokens with no issues using my mainnet Chainstack RPC.
However I am seeing the same issue as others after changing the 'tokenBAddress' address. Did you change anything to get it to work? Here is an example with the Raydium token RAY
from raydium-sdk-swap-example-typescript.
i met same error
const directionIn = poolKeys.quoteMint.toString() == toToken ^ TypeError: Cannot read properties of null (reading 'quoteMint')
@soos3d Thanks for your help on this. Its clear the community will use it to trade the latest meme craze of the hour so the acceptance tests should be tight to that use case.
I was able to swap with your default example tokens with no issues using my mainnet Chainstack RPC.
However I am seeing the same issue as others after changing the 'tokenBAddress' address. Did you change anything to get it to work? Here is an example with the Raydium token RAY
Hi @youngclaude ,
quoteMint
should be an issue with the slippage. You can edit it from here: slippage line
I tried changing the slippage but nothing changes, the error persists.
I believe the problem is due to the fact that new pairs are not immediately updated in the .. mainnet.json link
from raydium-sdk-swap-example-typescript.
Hey folks π I have same issue.
I'm trying to get pool information from here https://api.raydium.io/v2/sdk/liquidity/mainnet.json
and seems Raydium is updating file not so frequently and one can't get latest deployed pool information from there.
Do you know any alternative services that provide that?
from raydium-sdk-swap-example-typescript.
I swapped the token A (HUMP). to token B (SOL) the terminal show no error and generate the transaction URL but TX-URL_SOLSCAN nothing is there
from raydium-sdk-swap-example-typescript.
even the user dont have the SOL balance on wallet the transaction getting executed and there is no check for this
true, this can be a good feature to add; feel free to contribute and open a PR if you want to implement it!
Sure, I am working on it , will update it here soon : )
from raydium-sdk-swap-example-typescript.
I have been noticing this error with new coins. Are you trying to swap newly created coins?
from raydium-sdk-swap-example-typescript.
its BOME token (ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82)
it came about 6 days ago.
from raydium-sdk-swap-example-typescript.
just tried it now and the simulation worked fine!
Raydium swap initialized
Swapping 0.01 of So11111111111111111111111111111111111111112 for ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82...
Loaded pool keys
Found pool info
{
minAmountOut: TokenAmount {
numerator: <BN: 7c19b44>,
denominator: <BN: f4240>,
currency: Token {
decimals: 6,
symbol: 'UNKNOWN',
name: 'UNKNOWN',
programId: [PublicKey [PublicKey(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)]],
mint: [PublicKey [PublicKey(ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82)]]
},
token: Token {
decimals: 6,
symbol: 'UNKNOWN',
name: 'UNKNOWN',
programId: [PublicKey [PublicKey(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)]],
mint: [PublicKey [PublicKey(ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82)]]
}
},
amountIn: TokenAmount {
numerator: <BN: 989680>,
denominator: <BN: 3b9aca00>,
currency: Token {
decimals: 9,
symbol: 'UNKNOWN',
name: 'UNKNOWN',
programId: [PublicKey [PublicKey(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)]],
mint: [PublicKey [PublicKey(So11111111111111111111111111111111111111112)]]
},
token: Token {
decimals: 9,
symbol: 'UNKNOWN',
name: 'UNKNOWN',
programId: [PublicKey [PublicKey(TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)]],
mint: [PublicKey [PublicKey(So11111111111111111111111111111111111111112)]]
}
}
}
{
context: { apiVersion: '1.17.25', slot: 255567497 },
value: {
accounts: null,
err: null,
logs: [
'Program ComputeBudget111111111111111111111111111111 invoke [1]',
'Program ComputeBudget111111111111111111111111111111 success',
'Program 11111111111111111111111111111111 invoke [1]',
'Program 11111111111111111111111111111111 success',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Instruction: InitializeAccount',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3443 of 999700 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]',
'Program log: Create',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
'Program log: Instruction: GetAccountDataSize',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 986390 compute units',
'Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program 11111111111111111111111111111111 invoke [2]',
'Program 11111111111111111111111111111111 success',
'Program log: Initialize the associated token account',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
'Program log: Instruction: InitializeImmutableOwner',
'Program log: Please upgrade to SPL Token 2022 for immutable owner support',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 979803 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
'Program log: Instruction: InitializeAccount3',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4188 of 975921 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 24807 of 996257 compute units',
'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success',
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]',
'Program log: ray_log: A4CWmAAAAAAARJvBBwAAAAABAAAAAAAAAICWmAAAAAAAeylzdg8AAACMAmQgAQAAAAjjJAgAAAAA',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
'Program log: Instruction: Transfer',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 953333 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
'Program log: Instruction: Transfer',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 945616 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 31282 of 971450 compute units',
'Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Instruction: CloseAccount',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 940168 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success'
],
returnData: null,
unitsConsumed: 62747
}
}
β¨ Done in 21.39s.
from raydium-sdk-swap-example-typescript.
I have been noticing this error with new coins. Are you trying to swap newly created coins?
This is nice tool. Thanks! I'm trying this with newly created coins and I see the same error. Is this because it attempts to read the price of the token? Why not provide an option for the user to specify?
from raydium-sdk-swap-example-typescript.
I have the same problem, it would be interesting to have a solution for swapping new tokens too
from raydium-sdk-swap-example-typescript.
i met same error
const directionIn = poolKeys.quoteMint.toString() == toToken ^ TypeError: Cannot read properties of null (reading 'quoteMint')
@soos3d Thanks for your help on this. Its clear the community will use it to trade the latest meme craze of the hour so the acceptance tests should be tight to that use case.
I was able to swap with your default example tokens with no issues using my mainnet Chainstack RPC.
However I am seeing the same issue as others after changing the 'tokenBAddress' address. Did you change anything to get it to work? Here is an example with the Raydium token RAY
Hi @youngclaude , quoteMint
should be an issue with the slippage. You can edit it from here: slippage line
from raydium-sdk-swap-example-typescript.
I'm working on adding retries to re-fetch the pools when they fail. might not fix the issue at 100%, but it should help.
from raydium-sdk-swap-example-typescript.
Yes, I think that too. Adding retry logic to fetch the pairs should make it better. I'll work on it as soon as I have some time!
from raydium-sdk-swap-example-typescript.
must there be something already existing that does this job? I can't find any other repositories or code anywhere that solves this, yet there are swaps and bots that do it
from raydium-sdk-swap-example-typescript.
Guys thanks a lot for your helps. Is there any way to test it first on devnet ?
Why my change "https://api.raydium.io/v2/sdk/liquidity/devnet.json" not works ? @soos3d could you please let me know how can i make the code compatible for Devnet ?
Doing test by Devnet is important really.
from raydium-sdk-swap-example-typescript.
Guys thanks a lot for your helps. Is there any way to test it first on devnet ?
Why my change "https://api.raydium.io/v2/sdk/liquidity/devnet.json" not works ? @soos3d could you please let me know how can i make the code compatible for Devnet ?
Doing test by Devnet is important really.
Let me look into that!
from raydium-sdk-swap-example-typescript.
I swapped the token A (HUMP). to token B (SOL) the terminal show no error and generate the transaction URL but TX-URL_SOLSCAN nothing is there
yeah this happens when the chain is really congested; the transactions are simply dropped. Unfortunately, there is not too much we can do at the moment besides increasing priority fees and sens transactions continuously until one goes throughπ₯²
from raydium-sdk-swap-example-typescript.
@soos3d adding to this code need lot of more improvement as even the user dont have the SOL balance on wallet the transaction getting executed and there is no check for this. which is wrong.
from raydium-sdk-swap-example-typescript.
even the user dont have the SOL balance on wallet the transaction getting executed and there is no check for this
true, this can be a good feature to add; feel free to contribute and open a PR if you want to implement it!
from raydium-sdk-swap-example-typescript.
hello. I don't know why it gives me this error when I exceute the swap. this error related to the pool and it's like the code can't read the pool list.
Loaded pool keys C:\raydium-sdk-swap-example-typescript\src\RaydiumSwap.ts:59 const poolData = this.allPoolKeysJson.find( ^ TypeError: Cannot read properties of undefined (reading 'find') at RaydiumSwap.findPoolInfoForTokens (C:\raydium-sdk-swap-example-typescript\src\RaydiumSwap.ts:59:43) at C:\raydium-sdk-swap-example-typescript\src\index.ts:30:32 at Generator.next () at fulfilled (C:\raydium-sdk-swap-example-typescript\src\index.ts:5:58) at processTicksAndRejections (node:internal/process/task_queues:95:5) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
here I am facing other error
throw new Error('Non-base' + BASE + ' character')
^
Error: Non-base58 character
from raydium-sdk-swap-example-typescript.
Guys thanks a lot for your helps. Is there any way to test it first on devnet ?
Why my change "https://api.raydium.io/v2/sdk/liquidity/devnet.json" not works ? @soos3d could you please let me know how can i make the code compatible for Devnet ?
Doing test by Devnet is important really.Let me look into that!
i have this issue to, is it becasue raydium does not provide the poolkeys?
from raydium-sdk-swap-example-typescript.
The TypeError: Cannot read properties of null (reading 'quoteMint' appears if the app can't load any pools keys for your tokens pairs(for example pair: SOL and USDC).
So you can write instead of
const poolInfo = raydiumSwap.findPoolInfoForTokens(swapConfig.tokenAAddress, swapConfig.tokenBAddress);
console.log('Found pool info');
this:
const poolInfo = raydiumSwap.findPoolInfoForTokens(swapConfig.tokenAAddress, swapConfig.tokenBAddress);
if (!poolInfo) {
console.error('Pool not found');
return 'Pool not found';
}
from raydium-sdk-swap-example-typescript.
I'm searching myself ho to make swap for newly created coins. Current this repo solution doesn't work for this.
I implemented this https://solana.stackexchange.com/a/10020/2840 by LIQUIDITY_STATE_LAYOUT_V4 solution too and it doesn't help. I'm thinking about yellowstone-grpc solution now.
Any ideas?
from raydium-sdk-swap-example-typescript.
Related Issues (10)
- SWAP OUT - Seems not working (Insufficient lamports) HOT 3
- Reason: 'failed to simulate for instructions' HOT 1
- The calculated exchange amount is sometimes small
- Transaction Signed but not appearing on solscan HOT 1
- Extra trading fees for the platform HOT 2
- No Transaction found in Chainstack RPC & No Transaction in Solscan even after successfully swapped ! HOT 8
- Error: connect EHOSTUNREACH 2606:4700::6810:1d22:443 at TCPConnectWrap.afterConnect [as oncomplete] HOT 1
- Error: Non-base58 character HOT 1
- Can't get response from https://api.raydium.io/v2/sdk/liquidity/mainnet.json HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raydium-sdk-swap-example-typescript.