Closed AphobiaCat closed 2 weeks ago
and I try
It looks like the same result
tx: 4Sa1NSVQZjeRLiWeP6A3khP8q3ZWQMv8ztpboni1Tei9uKP2fdgahGhNJeuERnP2HcgPpqD4NJST4pcSNJs3MAaD
async createPool_CPMM(base_token_str) {
const raydium = await initSdk({ loadToken: true })
// check token list here: https://api-v3.raydium.io/mint/list
// RAY
// const mintA = await raydium.token.getTokenInfo('4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R')
// USDC
// const mintB = await raydium.token.getTokenInfo('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')
// const mintA = await raydium.token.getTokenInfo(base_token_str);
// const mintB = await raydium.token.getTokenInfo(quote_token_address);
const mintA = {
address: base_token_str,
programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
decimals: 9,
};
const mintB = {
address: quote_token_address,
programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
decimals: 9,
};
/**
* you also can provide mint info directly like below, then don't have to call token info api
* {
address: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
programId: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
decimals: 6,
}
*/
const feeConfigs = await raydium.api.getCpmmConfigs()
if (raydium.cluster === 'devnet') {
feeConfigs.forEach((config) => {
config.id = getCpmmPdaAmmConfigId(DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_PROGRAM, config.index).publicKey.toBase58()
})
}
const { execute, extInfo } = await raydium.cpmm.createPool({
// poolId: // your custom publicKey, default sdk will automatically calculate pda pool id
programId: DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_PROGRAM, // devnet: DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_PROGRAM
poolFeeAccount: DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_PROGRAM, // devnet: DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_PROGRAM
mintA,
mintB,
mintAAmount: new BN(100),
mintBAmount: new BN(100),
startTime: new BN(0),
feeConfig: feeConfigs[0],
associatedOnly: false,
ownerInfo: {
useSOLBalance: true,
},
txVersion,
// optional: set up priority fee here
computeBudgetConfig: {
units: 600000,
microLamports: 100000000,
},
})
// don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute
const { txId } = await execute({ sendAndConfirm: true })
// console.log('pool created', {
// txId,
// poolKeys: Object.keys(extInfo.address).reduce(
// (acc, cur) => ({
// ...acc,
// [cur]: extInfo.address[cur].toString(),
// }),
// {}
// ),
// })
console.log("tx:", txId)
}
poolFeeAccount should be DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_FEE_ACC
poolFeeAccount should be DEVNET_PROGRAM_ID.CREATE_CPMM_POOL_FEE_ACC
Thanks!!!
pls help
after I created a token and the corresponding account in devnet, I mint a few tokens into it and then execute the following code, but there is an error
And I have tried to update the sdk, but I still have the same problem
tx:3AAk2gG846GEPbGtiMqURt8EmtpZK2tYyEeycwYNnArNADRUuqazWMbh9ENAB5dbQLKprPoTrmFdAtuQ1fAQGL7H
this is my code