2

I want to create a market ID and pool on Raydium using JS/TS.

The transaction has been completed, but it does not appear on Solscan.

edited:

Create Market Transactions : [ '3zBEqtsNTcnio8wxZHmKXqgS4GNL7BXibzHmLVYKZZjTZfWxuDyya6xBWubyTXoEX7yys4QUvvRBeFQXorHjyHmi', '3AXtbuaMrVZtWYgC5MVh9U3zAR9crrN4dFZK73shXBsncPTM65EUofjp9AiqMSX3UBdytVLQXnrZkAkPqpa7KRcm' ]

Market ID : PublicKey [PublicKey(HrRmmPNb4YzSk85z4y3PEmdrey3nYbYvkSzT5U9Fi5ue)] { _bn: <BN: fa6475c5a17175376f64f74f83250182d376f5d22da0191dd36ee5d390b81785> }

Here is the code for creating marketID

async function createMarket() {
    try {
        const createMarketInstruments = await MarketV2.makeCreateMarketInstructionSimple({
            connection,
            wallet: userWallet.publicKey,
            baseInfo: {
                mint: new PublicKey('6dPMkw1325CQZ5HAknCrr4PBRsJHL46kFAcwXmCVDhqv'),
                decimals: 6
            },
            quoteInfo: {
                mint: new PublicKey('GkpuJkzdV13qGaif9ZHFnfodiDHY6pz7jBhvnCaLJP2g'),
                decimals: 6
            },
            lotSize: 1, 
            tickSize: 0.01,
            dexProgramId: DEVNET_PROGRAM_ID.OPENBOOK_MARKET,
            makeTxVersion: TxVersion.V0,
        })
        const txids = await buildAndSendTx(createMarketInstruments.innerTransactions, { skipPreflight: true })
    console.log('Create Market Transactions :', txids)
        return marketId
    }
    catch (err) {
        console.log("err: ", err)
        return err
    }
}

2 Answers 2

2

here's some links for your reference.

https://github.com/raydium-io/raydium-sdk-V1-demo/blob/master/src/utilsCreateMarket.ts https://github.com/raydium-io/raydium-sdk-V1-demo/blob/master/src/ammCreatePool.ts

here's my working example

const {
    MarketV2,
    MAINNET_PROGRAM_ID,
    DEVNET_PROGRAM_ID
} = require('@raydium-io/raydium-sdk')

const {
    connection,
    makeTxVersion,
} = require('../config.js')
const { buildAndSendTx } = require('./util')

async function createMarket(input) {
    const RAYDIUM_PROGRAM_ID = process.env.NETWORK == 'mainnet' ? MAINNET_PROGRAM_ID : DEVNET_PROGRAM_ID

    // -------- step 1: make instructions --------
    const createMarketInstruments = await MarketV2.makeCreateMarketInstructionSimple({
        connection,
        wallet: input.wallet.publicKey,
        baseInfo: input.baseToken,
        quoteInfo: input.quoteToken,
        lotSize: input.lotSize, // default 1
        tickSize: input.tickSize, // default 0.01
        dexProgramId: RAYDIUM_PROGRAM_ID.OPENBOOK_MARKET,
        makeTxVersion,
    })

    marketId = createMarketInstruments.address.marketId

    txids = await buildAndSendTx(createMarketInstruments.innerTransactions, { skipPreflight: true })
    console.log('Market Created')
    console.log('Create Market Transactions :', txids)
    console.log('Market Address :', marketId)

    return marketId
}

module.exports = {
    createMarket
};
10
  • Hi Thanks for sharing, I recently used this but got the error, I'm using devnet and can't understand. Error processing Instruction 5: custom program error: 0x1000694
    – Bobz
    Commented Feb 12 at 13:28
  • you might be interacting with wrong program when creating market, kindly edit the post to share the tx with the issue, and the parameters you're passing to create the market. Commented Feb 12 at 23:00
  • Thanks for the code snippet - it's working but the transaction can't show on Solscan. check the question I edit
    – Bobz
    Commented Feb 13 at 7:03
  • I believe the issue might be related to the Devnet network not displaying the transaction on solscan.
    – Bobz
    Commented Feb 13 at 10:44
  • I see, It seems there's some issue with devnet atm, it doesn't work on my side either. let us give it some time and try later. Commented Feb 13 at 10:53
0

Is the problem solved? I tried to use the demo they provided, modified the baseToken to my token address, and the quoteToken to DEFAULT_TOKEN.WSOL, but errors were reported. On devnet https://github.com/raydium-io/raydium-sdk-V1-demo/blob/master/src/utilsCreateMarket.ts https://github.com/raydium-io/raydium-sdk-V1-demo/blob /master/src/ammCreatePool.ts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.