I've been struggling for a while with a transferV1 transaction from the mpl-token-metadata library using the Umi interface. Many examples here and there show how to do it with the classic spl-token protocol, but I have the feeling that when it comes to token-2022, things get complicated...
The bottom line is that I'm "simply" trying to make a transaction that involves a "payment" of a defined amount, but in spl-token-2022, which is why I turned to transferV1 but maybe I'm going about it the wrong way. Instruction 2: custom program error: 0x39
umi.use(walletAdapterIdentity(wallet))
const sign = createSignerFromKeypair(umi, upgAuth);
umi.use(signerIdentity(sign, false));
let sourceATA = findAssociatedTokenPda(umi, { mint: TOKEN_REWARD, owner: umi.payer.publicKey, tokenProgramId: TOKEN_2022_PROGRAM_ID });
let destATA = findAssociatedTokenPda(umi, { mint: TOKEN_REWARD, owner: umi.identity.publicKey, tokenProgramId: TOKEN_2022_PROGRAM_ID });
sourceATA = new PublicKey(sourceATA[0]);
destATA = new PublicKey(destATA[0]);
transactions = transactions.add(
transferV1(umi, {
mint: TOKEN_REWARD,
authority: umi.payer,
tokenOwner: sourceATA,
destinationOwner: destATA,
tokenStandard: TokenStandard.Fungible,
splTokenProgram: TOKEN_2022_PROGRAM_ID,
amount: 10,
})
);
Everytime it ends up with the following error :
Error: failed to send transaction: Transaction simulation failed: custom program error: 0x39 [...]
0x39 = Incorrect account owner
What i'm i doing wrong ?