Created
October 18, 2025 14:09
-
-
Save siexp/f2267ff0ee68884c5ec1ae8e38c28ddd to your computer and use it in GitHub Desktop.
raydium SDK create mint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const createMint = async () => { | |
| const raydium = await initSdk() | |
| const programId = DEVNET_PROGRAM_ID.LAUNCHPAD_PROGRAM // devent: DEVNET_PROGRAM_ID.LAUNCHPAD_PROGRAM | |
| // тут можно переберать адреса пока не получите тот что нужен | |
| const pair = Keypair.generate() | |
| const mintA = pair.publicKey | |
| const configId = getPdaLaunchpadConfigId(programId, NATIVE_MINT, 0, 0).publicKey | |
| const configData = await raydium.connection.getAccountInfo(configId) | |
| if (!configData) throw new Error('config not found') | |
| const configInfo = LaunchpadConfig.decode(configData.data) | |
| const mintBInfo = await raydium.token.getTokenInfo(configInfo.mintB) | |
| const inAmount = new BN(1000) | |
| const { execute, transactions, extInfo } = await raydium.launchpad.createLaunchpad({ | |
| programId, | |
| mintA, | |
| decimals: 6, | |
| name: 'new launchpad mint', | |
| symbol: 'NLP', | |
| migrateType: 'amm', | |
| uri: // Вот это ссылка на json metadata https://developers.metaplex.com/token-metadata/token-standard#the-fungible-standard | |
| // пример https://raw.githubusercontent.com/solana-developers/program-examples/new-examples/tokens/tokens/.assets/spl-token.json | |
| configId, | |
| configInfo, | |
| mintBDecimals: mintBInfo.decimals, // default 9 | |
| platformId: new PublicKey('BBLa8QnHbN41pEJUzFdtdPKZTAiSmAssWpHYk7M7abUo'), | |
| txVersion: TxVersion.V0, | |
| slippage: new BN(100), // means 1% | |
| buyAmount: inAmount, | |
| createOnly: true, // true means create mint only, false will "create and buy together" | |
| // обязательно чтобы пара подписала эту транзу | |
| extraSigners: [pair], | |
| }) | |
| try { | |
| const sentInfo = await execute({ sequentially: true }) | |
| console.log('poolId: ', extInfo.swapInfo.amountB) | |
| console.log(sentInfo) | |
| } catch (e: any) { | |
| console.log(e) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment