NFT Mint-Style
Mix multiple program instructions and memos; split if message-size constrained.
import { buildTransaction, transferIntent, memoIntent, BasicPolicy } from '@rlock/cpsr-sdk';
import { Connection, Keypair } from '@solana/web3.js';
async function run() {
const connection = new Connection('https://api.devnet.solana.com');
const payer = Keypair.generate();
const intents = [
memoIntent({ payer: payer.publicKey, message: 'Mint wave' }),
memoIntent({ payer: payer.publicKey, message: 'Batch 2' }),
transferIntent({ from: payer.publicKey, to: Keypair.generate().publicKey, lamports: 10_000 }),
];
const plan = await new BasicPolicy().suggest();
const { blockhash } = await connection.getLatestBlockhash('finalized');
const tx = await buildTransaction({ intents, feePlan: plan, recentBlockhash: blockhash, payer: payer.publicKey });
}
run().catch(console.error);