Skip to content

Transaction simulation failed: Error processing Instruction 0: Provided owner is not allowed. #658

@RaviWebcyst

Description

@RaviWebcyst

When swapping using add fee account its return
"SendTransactionError: Simulation failed.
Message: Transaction simulation failed: Error processing Instruction 0: Provided owner is not allowed.
Logs:
[
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
"Program log: Create",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 9429 of 200000 compute units",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL failed: Provided owner is not allowed"
]. " error

using below code

const feePayer = Keypair.fromSecretKey(privateKeyUint8Array); // secretKey must be a Uint8Array

let ata = await createAssociatedTokenAccount(
connection, // connection
feePayer,
mintPubkey, // mint
feePayer.publicKey, // owner of the token account
);

console.log("ata"+ata.toBase58());

//   const tokenMint = new PublicKey(tokenOne.address); // Replace with token's mint address (like USDC)
// const feeTokenAccount = await getAssociatedTokenAddress(tokenMint, feeAccount);

// console.log("Fee token account:", feeTokenAccount.toString());


const { swapTransaction } = await (
    await fetch("https://api.jup.ag/swap/v1/swap", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
            quoteResponse,
            userPublicKey: publicKey.toString(),
            feeAccount: feeAccount,
        }),
    })
).json();

what wrong with above code and how can i set this error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions