-
Notifications
You must be signed in to change notification settings - Fork 143
Description
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