I get this error:
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]",
"Program log: Create",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]",
"Program log: Instruction: GetAccountDataSize",
"Program log: Error: IncorrectProgramId",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 884 of 173513 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: incorrect program id for instruction",
This is my struct:
#[account(mut,seeds = [VESTERSEED],bump = vesterbump)]
pub vester: AccountLoader<'info, Vester>,
#[account(
init_if_needed,
payer = owner,
associated_token::mint = mint,
associated_token::authority = vester,
)]
Here is vester
. It is a PDA which is used to store some other data.
I use exactly the same method given in one answer, but still I get the same error.
One extra thing is that my mint
is also a program PDA,
#[account(init_if_needed,
payer = owner,
seeds = [SEED.as_ref()], bump,
mint::decimals = 6,
mint::authority = mint)]
pub mint: Box<Account<'info, Mint>>,
which works like a normal mint perfectly.
I followed the previous process which was successfully executed when the senderTokens
was ATA of Payer instead of PDA
, so according to that my program throws an error, when the systemProgram
tries to create the actual ATA.
Here are the logs:
{
"info": {
"lamports": 2039280,
"newAccount": "DP38DWTnLhi7Hv868nTLS8d7x98B8PvviioTYFXyaMGj",
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"source": "GXRZrSoaQopRYouxLWmWxsQyzgF223jnAZDbMrSXfb6P",
"space": 165
},
"type": "createAccount"
}
Here the owner is tokenProgram
, but for a PDA it could be different.
I tried to do the same thing in JavaScript:
const vester_ata = await getAssociatedTokenAddress(mint, vesterPda, true);
const transaction = new Transaction().add(
createAssociatedTokenAccountInstruction(
wallet.publicKey,
vester_ata,
vesterPda,
mint
)
);
await sendAndConfirmTransaction(
provider.connection,
transaction,
[wallet],
{ skipPreflight: true }
);
But I still get the same error HERE.