When I try to send my SPL tokens I get this error:
OrderRow.js:72 TokenAccountNotFoundError
at unpackAccount (account.ts:170:1)
at getAccount (account.ts:103:1)
at async getOrCreateAssociatedTokenAccount (getOrCreateAssociatedTokenAccount.ts:79:1)
at async transferTokens (OrderRow.js:39:1)
This is the code I'm trying to run:
const fromTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
fromPublicKey,
tokenPublicKey,
fromPublicKey,
signTransaction
);
const toTokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
fromPublicKey,
tokenPublicKey,
toPublicKey,
signTransaction
);
const transaction = new web3.Transaction().add(
createTransferInstruction(
fromTokenAccount.address,
toTokenAccount.address,
fromPublicKey,
parseInt(amount * Math.pow(10, 9)),
[],
TOKEN_PROGRAM_ID,
)
);
It fails in the toTokenAccount function
Thanks in advance for your help