Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

token-js: createAssociatedTokenAccountIdempotentInstruction shouldn't require client to pass in associatedToken #7178

@metaproph3t

Description

@metaproph3t

The handy createAssociatedTokenAccountIdempotentInstruction allows you create instructions that idempotently create associated token accounts. One thing that annoys me about it is that it requires me to pass in the associated token account, like so:

...
.preInstructions([
        createAssociatedTokenAccountIdempotentInstruction(
          this.provider.publicKey,
          token.getAssociatedTokenAddressSync(
            tokenMint,
            pdaOwner,
            true
          ),
          pdaOwner,
          tokenMint
)]
...

I don't see the purpose of this given that associated token accounts can always be derived by the getAssociatedTokenAddressSync. Maybe this function was written before getAssociatedTokenAddressSync existed? In any case, it would be nice if this parameter was made optional or removed entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions