Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7906

I get error at step: createAssociatedTokenAccountInstruction, failed: incorrect program id for instruction

$
0
0

error

'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]','Program log: Create','Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]','Program log: Instruction: GetAccountDataSize','Program log: Error: IncorrectProgramId','Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 884 of 394635 compute units','Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: incorrect program id for instruction','Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 6249 of 400000 compute units','Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL failed: incorrect program id for instruction'

Client code.

  const secretKeyString = await fs.readFile(PROGRAM_KEYPAIR_PATH, {encoding: 'utf8'});  const secretKey = Uint8Array.from(JSON.parse(secretKeyString));  const programKeypair = Keypair.fromSecretKey(secretKey);  let programId: PublicKey = programKeypair.publicKey;  const transaction = new web3.Transaction()const triggersecretKeyString = await fs.readFile(trigger_PROGRAM_KEYPAIR_PATH, {encoding: 'utf8'});const triggersecretKey = Uint8Array.from(JSON.parse(triggersecretKeyString));const triggerKeypair = Keypair.fromSecretKey(triggersecretKey);  console.log('--LAMPORTS_PER_SOL ', LAMPORTS_PER_SOL);  const movie = new Movie("aaaa", 5, "description", triggerKeypair.publicKey)  const buffer = movie.serialize(0)  const [pda] = await PublicKey.findProgramAddress(    [triggerKeypair.publicKey.toBuffer(), Buffer.from(movie.title)], // new TextEncoder().encode(movie.title)],    programId)const [pdaCounter] = await PublicKey.findProgramAddress(    [pda.toBuffer(), Buffer.from("comment")], // new TextEncoder().encode(movie.title)],    programId)const [tokenMint] = await PublicKey.findProgramAddress(  [Buffer.from("token_mint")],  programId)const [mintAuth] = await PublicKey.findProgramAddress(  [Buffer.from("token_auth")],  programId)const userAta = await getAssociatedTokenAddress(tokenMint, triggerKeypair.publicKey, false)const ataAccount = await connection.getAccountInfo(userAta)if (!ataAccount) {  const ataInstruction = createAssociatedTokenAccountInstruction(      triggerKeypair.publicKey,      userAta,      triggerKeypair.publicKey,      tokenMint  )  //await connection.confirmTransaction(ataInstruction);  transaction.add(ataInstruction)}await sendAndConfirmTransaction(  connection,  transaction,  [triggerKeypair],);

Please help to fix it.


Viewing all articles
Browse latest Browse all 7906

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>