2

Currently, I'm trying to create an associated token account using solana/wallet provider (solflare ). However, when I proceed to sign the transaction, it returns an error saying that it is unable to.

This is the error Im getting: enter image description here

This is the method Im using:

enter image description here

Im able to get the associatedTokenAccount Key and provider.wallet object but initializing it seems to be an issue.

1 Answer 1

1

It looks like the parameters for createAssociatedTokenAccount are incorrect, try instead:

createAssociatedTokenAccountInstruction(
    this.provider.wallet.publicKey,
    token_acc,
    this.provider.wallet.publicKey,
    new PublicKey("So11111...2"),
    TOKEN_PROGRAM_ID,
    ASSOCIATED_TOKEN_PROGRAM_ID
)

You can also double-check that token_acc is the correct address.

More information at https://github.com/solana-labs/solana-program-library/blob/1892778b9ddb46545f0e7982065889ee7aec1bac/token/js/src/instructions/associatedTokenAccount.ts#LL17-L23C59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.