Skip to main content

Can iI create aan ATA of PDA account?

I get this error:

thisThis is my struct:

hereHere is vester. It is a PDA which is used to store some other data

EDIT :.

I use Exactlyexactly the same method given in one answer, but still I get the same error. One

One extra thing is that my mintis 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>>,

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's

Here are the logs:

hereHere the owner is tokenProgram, but for a PDA it could be different.

I tried to do the same thing in JSJavaScript:

But I still get the same error HERE.

Can i create a ATA of PDA account?

I get this error

this is my struct

here is vester is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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>>,

I followed previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error  , when the systemProgram tries to create the actual ATA. Here's the logs

here the owner is tokenProgram, but for a PDA it could be different.

I tried to do the same thing in JS

still same error HERE

Can I create an ATA of PDA account?

I get this error:

This is my struct:

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 mintis 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>>,

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:

Here the owner is tokenProgram, but for a PDA it could be different.

I tried to do the same thing in JavaScript:

But I still get the same error HERE.

added 643 characters in body
Source Link

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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error , when the systemProgram tries to create the actual ATA. Here's 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 JS

 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 }
    );

still same error HERE

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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error , when the systemProgram tries to create the actual ATA. Here's 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 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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error , when the systemProgram tries to create the actual ATA. Here's 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 JS

 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 }
    );

still same error HERE

added 615 characters in body
Source Link

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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error , when the systemProgram tries to create the actual ATA. Here's 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 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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 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 is a PDA which is used to store some other data

EDIT :

I use Exactly the same method given in one answer, still the same error. One extra thing is that my mintis 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 previous process which was successfully executed when the senderTokens was ATA of Payer instead of PDA, so according to that my program throws error , when the systemProgram tries to create the actual ATA. Here's 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.

added 428 characters in body
Source Link
Loading
Became Hot Network Question
Source Link
Loading