mpl-token-metadata
mpl-token-metadata copied to clipboard
Transaction simulation failed: Error processing Instruction 3: An account required by the instruction is missing
I am trying to create a Fungible SPL-2022 token with metaplex. I believe I'm missing some key piece of the puzzle here so help would be appreciated. My pseudo-code looks like this:
import useUmi from '@/hooks/useUmi'
import { TokenStandard, createV1, mintV1 } from '@metaplex-foundation/mpl-token-metadata'
import { percentAmount, generateSigner, signerIdentity, sol, transactionBuilder, publicKey} from '@metaplex-foundation/umi'
umi.use(signerIdentity(umi.identity));
const mint = generateSigner(umi);
const SPL_TOKEN_2022_PROGRAM_ID = publicKey(
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'
);
const transaction = transactionBuilder()
.add(createV1(umi, {
mint,
authority: umi.identity,
name: token.name,
symbol: token.symbol,
uri: metaDataUri,
sellerFeeBasisPoints: percentAmount(0),
decimals: token.decimals,
splTokenProgram: SPL_TOKEN_2022_PROGRAM_ID,
tokenOwner: umi.identity.publicKey,
tokenStandard: TokenStandard.Fungible
}))
.add(mintV1(umi, {
mint: mint.publicKey,
authority: umi.identity.publicKey,
tokenOwner: mint.publicKey,
splTokenProgram: SPL_TOKEN_2022_PROGRAM_ID,
tokenStandard: TokenStandard.Fungible
}))
transaction.sendAndConfirm(umi).then(() => {
// Do something
}).catch((error) => {
console.log(error)
});
When I run this function I receive error:
Transaction simulation failed: Error processing Instruction 3: An account required by the instruction is missing
If I skip preflight, I receive error:
{
"InstructionError": [
3,
"MissingAccount"
]
}
Can anyone help enlighten me? What am I missing here? Thanks!