Closed wangke329 closed 3 weeks ago
What I created here is the amm pool.
create market total 2 txs, market info: { marketId: 'BNmYSqfcJeehdRAKrhwEiVUbm4h9aMRvMfBgF7vzwdRD', requestQueue: '5SAwe9a2NdASF7z3SBouUKcpZEJET6FQPNXtWD6W7XBh', eventQueue: 'CbUP7YLHQ3jm6yMEf7aPSHoY6LftJv9SLdA7gRgkPCKZ', bids: 'HZRTgSyy6nNoqZJZXDuBjG2GYX9kbVs5FEQWMKR4HH25', asks: 'EhhVJystGcizVQ6TxfjpCWxL4gs9KUEAaeG9KRJjpJob', baseVault: 'HQJDB2sYPfXSitBkThwLLzxignEBiXNG4Fwgw4CAstr4', quoteVault: '2mKy9HeATvzvNpjjNqhV8TUuNUokxhpW7MNTE1csru5e', baseMint: 'okDFNbhRWYi1NpQyFrR4Uzx2vR1RAMnW3N4VHs3Mint', quoteMin: 'So11111111111111111111111111111111111111112' } simulate tx string: [ 'AQIZe/XH6/hViVPEBYxIytS/Led8xez47Fy9gNVB+aUwutvgeX4+1A3BTd1rv5aj2s6iRT+KN6f4tHvEf1LcvA6AAQAFC5CkoZV3SD/t6kLxyNR61v55ZTNyYrOs7Pn7l4RoVqup87LPBx4UIba4zTp5LRctEX0SUrLd8aBPj468uvdqFUkaNrCPgevZqp3I/jLuNiNSmokSwmpVGPk9ScSZwIEkhZoobiQpaXAGBmCycwNKIX2BaDGkX932bl0rXqz3KxEsQeGCbPFE+GZjYC4fw7fptu9j8G//0mVqdwF7i+hG3wSsRUOHMTJPtEu0pYxMgeXTqYVLXEpOV9rna7+n9BdIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkL+ZOEl9eWR++mBHzU/Q1KrbUZB++aS+4Nsdaq8sPSqc5UFRGa9yuSVSxagetH/hlU+o0+qBJKSW77X/RjiuTHBpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAEdIUq1RX+Q312lXHqx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yYrOs7Pn7l4RoVqup9gk71WT187FxWLuqCrpf8bfcw8smKuRxvfw/t5PavK7LlPFEbIkWbNJoKdDxobmHIvaq8WebIF3SbRKs2BjYipoobiQpaXAGBmCycwNKIX2BaDGkX932bl0rXqz3KxEsQeGCbPFE+GZjYC4fw7fptu9j8G//0mVqdwF7i+hG3wSsRUOHMTJPtEu0pYxMgeXTqYVLXEpOV9rna7+n9BdIwPOyzwceFCG2uM06eS0XLRF9ElKy3fGgT4+OvLr3ahVJGjawj4Hr2aqdyP4y7jYjUpqJEsJqVRj5PUnEmcCBJIUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0HUagoLaYTBf4pnDe5mOWEcdsRNQNzEPi+EEWmCvbuC/mThJfXlkfvpgR81P0NSq21GQfvmkvuDbHWqvLD0qkGm4hX/quBhPtof2NGGMA12sQ53BrrO1WYoPAAAAAAAR0hSrVFf5DfXaVcerHxdYj8B+r8A5ldWNF1P+DK6x31AwgCAAF8AwAAAJCkoZV3SD/t6kLxyNR61v55ZTNyYrOs7Pn7l4RoVqupIAAAAAAAAABGTm5iUEF0TVNHYjNvdVd1NThqTkFydGtvZG1VQU1IUEDePhsAAAAADAABAAAAAAANB1GoKC2mEwX+KZw3uZjlhHHbETUDcxD4vhBFpgr27ggCAAJ8AwAAAJCkoZV3SD/t6kLxyNR61v55ZTNyYrOs7Pn7l4RoVqupIAAAAAAAAAA3ak1nUjhqNVRVdmJ1REwzRVhlU25pUUpCTm9MY3pDV0DePhsAAAAADAABAAAAAAANB1GoKC2mEwX+KZw3uZjlhHHbETUDcxD4vhBFpgr27gkKAwQFAQIGBwoLDCcAAAAAAEBCDwAAAAAAZAAAAAAAAAAAAAMAAAAAAAAAZAAAAAAAAAABGY8fTDpFImPUE7LNF+vLwaDliHNk5iYaEqgXkuoWWj4AAQU=' ] [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] { code: 'ERR_UNHANDLED_REJECTION' }
please help me!!!!
according the simulate tx string, this market BNmYSqfcJeehdRAKrhwEiVUbm4h9aMRvMfBgF7vzwdRD
has been created successfully in this tx https://explorer.solana.com/tx/3SD9yaNqdcWJssTGAc7uER1VUXA1wwTejcy1GYG69t9itdHUaifAHwyfHCQoMqQR5TipMX3CNDuy6LKoZ79YWq3
and second tx for initializing market didn't go through successfully which might cause by you didn't set enough priority fee for tx (network is congestion recently), you can try sending second tx only to initialize market only but not resent both 2 txs again.
for sure you need to check carefully the market id you want to initialize must be BNmYSqfcJeehdRAKrhwEiVUbm4h9aMRvMfBgF7vzwdRD or you need to run both 2 tx.
you also can create market by UI here to prevent coding issue.
Yes, I understand. I just want to skip the first step of creating a market and go straight to the second step of initializing the market. But I don't see the split API in the code of the SDK. These two steps are combined into a single API, market2.craete.
raydium.marketV2.create returns all data you needed so you can send or modify tx by yourself like below
const { transactions, signers } = await raydium.marketV2.create({ xxx })
const tx = transactions[1] as VersionedTransaction
tx.sign(signers[1])
const txId = await raydium.connection.sendTransaction(tx, { skipPreflight: false })
await confirmTransaction(raydium.connection, txId)
also, you can get builder from const { builder } = await raydium.marketV2.create({ xxx })
source code: https://github.com/raydium-io/raydium-sdk-V2/blob/master/src/common/txTool/txTool.ts#L127
full data here:
Okay, thank you very much for providing the information. They are very helpful to me.
We are experiencing the exact same problem as @wangke329 (on devnet) but we found out that the createMarket.ts script works fine if we use a token previously minted via Solana CLI (meaning it's an SPL Standard Token). However, when we use our own custom token which utilizes the transfer_hook functionality (based on the official Solana program examples), the market initialization fails (just as for @wangke329 and without any useful error reporting). We then tried to cut out the extensions (MetadataPointer and TransferHook) from our custom token but the problem remained the same.
FYI: Our custom token works properly, the transfer_hook extension works well, no problems at all during transferring or testing. Also, for the creation of a Market, the transfer_hook function is not even invoked. We even tested this by always returning Ok(()) in transfer_hook() just in case, to be sure.
The problem remains and we are unable to programmatically create a market using the createMarket.ts script for our token.
Can someone kindly have a look at what might be going on? Here is a test token mint address on devnet: 6hBYUFddtXwEaJD9VLajydbnm6riyn8niRfELfR3YD4W
Thanks!
After running the transactions separately and manually, the error we got was this:
'Program log: Instruction: InitializeAccount',
'Program log: Error: IncorrectProgramId',
Interestingly, since this problem does not occur with a standard SPL token but does occur with our custom token, we assume that the program id is not correctly set internally within raydium.marketV2.create(). This would explain the error.
Also, interestingly, when running raydium.token.getTokenInfo() on our custom token, we get this:
chainId: 101, address: '6hBYUFddtXwEaJD9VLajydbnm6riyn8niRfELfR3YD4W', programId: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb', logoURI: '', symbol: '6hBYUF', name: '6hBYUF', decimals: 6, tags: [], extensions: {}, priority: 0, type: 'unknown' }
How and why does your function return the wrong program id here? Because TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb is the program id of the SPL standard 2022 token program, but shouldn't it be our custom program id?
We are not sure if the same logic as in raydium.token.getTokenInfo() is applied internally when fetching information on the token, but if so, then it would explain the error?
We just found out that createMarket.ts fails on any token that runs on the SPL TOKEN 2022 standard. It only works for the regular default SPL token. Either we are missing a setting or parameter, or there is a bug in your code?
CreateMarket doesn't support 2022
I am using this demo to create a pool. When I execute the creation market, it prompts me "undefined", but I find that it deducts 1.8 SOL from me. I want to know what I can do to continue to create, instead of repeatedly deducting my 1.8 SOL?