raydium-io / raydium-sdk-V2-demo

Open-source Typescript SDK demos
50 stars 31 forks source link

Block height exceeded. #75

Closed AphobiaCat closed 1 month ago

AphobiaCat commented 1 month ago

I have configured computeBudgetConfig and dexProgramId: DEVNET_PROGRAM_ID.OPENBOOK_MARKET, but there is still a transaction timeout

ERROR 10364 nodejs.TransactionExpiredBlockheightExceededError: Signature 2Ag6REwYpHkTry3pTEb7ThpdHXNv69zxpv6sgSV3TcQuny83KmYcTNHU1bj5ne3sw82mCrZsL1AUqVGDjFSDsreG has expired: block height exceeded.

Please help solve this problem.

BR

async createMarket() {

    const raydium = await initSdk()

    // check mint info here: https://api-v3.raydium.io/mint/list
    // or get mint info by api: await raydium.token.getTokenInfo('mint address')

    const { execute, extInfo, transactions } = await raydium.marketV2.create({
      baseInfo: {
          mint: RAYMint,
          decimals: 6,
      },
      quoteInfo: {
          mint: USDCMint,
          decimals: 9,
      },
      lotSize: 1,
      tickSize: 0.01,
      // dexProgramId: OPEN_BOOK_PROGRAM,
      dexProgramId: DEVNET_PROGRAM_ID.OPENBOOK_MARKET, // devnet

      // requestQueueSpace: 5120 + 12, // optional
      // eventQueueSpace: 262144 + 12, // optional
      // orderbookQueueSpace: 65536 + 12, // optional

      txVersion,
      // optional: set up priority fee here
      computeBudgetConfig: {
              units: 600000,
              microLamports: 100000000,
      },
  })

  console.log(
      `create market total ${transactions.length} txs, market info: `,
      Object.keys(extInfo.address).reduce(
          (acc, cur) => ({
              ...acc,
              [cur]: extInfo.address[cur].toBase58(),
          }),
          {}
      )
  )

  const txIds = await execute({
      // set sequentially to true means tx will be sent when previous one confirmed
      sequentially: true,
  })

  console.log('create market txIds:', txIds)
}
cruzshia commented 1 month ago

Devnet doesn't have RAY/USDC mints, please create new one to create market

AphobiaCat commented 1 month ago

Devnet doesn't have RAY/USDC mints, please create new one to create market

Oh Thanks! That means if I need to mint SOL, I can first use a fake token instead?

cruzshia commented 1 month ago

You can get devnet sol from faucet https://faucet.solana.com/, also you need sol to do any tx, after that you can create devnet mints. Please notice that every thing in devnet is just like mainet, the only difference is you have to create your own mints, you can't fake things to by pass tx

AphobiaCat commented 1 month ago

You can get devnet sol from faucet https://faucet.solana.com/, also you need sol to do any tx, after that you can create devnet mints. Please notice that every thing in devnet is just like mainet, the only difference is you have to create your own mints, you can't fake things to by pass tx

hihi cruzshia I tried to use the two mint addresses I created on devnet as baseInfo mint and quoteInfo mint, but I still got the same error. kindly help if there are any other questions?

let base_token = new PublicKey('E5gYGvqxYvRJEGd51dQqsXPdti3YXnFyXtb4JSkuM8kc');
let quote_token = new PublicKey("E3QZcRgZrvG2QtBZCEGuPf9ctDGrRs8WgWQBdzy8ZjpF");    //replace sol in main net

baseInfo: {
  mint: base_token,
  decimals: 9,
},
quoteInfo: {
  mint: quote_token,
  decimals: 9,
},