2

I want to transfer the spl token but cannot get getOrCreateAssociatedTokenAccount method even in the latest version of @solana/spl-token.

4
  • Could you provide a picture of your code / error?
    – Orion
    Commented Dec 24, 2022 at 12:23
  • showing us the code would be the first step to solving this issue.
    – vicyyn
    Commented Dec 24, 2022 at 13:08
  • I am getting this error Module '"@solana/spl-token"' has no exported member 'getOrCreateAssociatedTokenAccount'.
    – Aslam
    Commented Dec 24, 2022 at 15:42
  • I which version of "@solana/spl-token"' the 'getOrCreateAssociatedTokenAccount' is available ?
    – Aslam
    Commented Dec 24, 2022 at 15:43

1 Answer 1

0

Try installing @solana/spl-token with an alias name, there might be another dependency that's causing a naming conflict.

npm i name-it-what-you-want-here@npm:@solana/spl-token

It will look like this in package.json

  "dependencies": {
    "name-it-what-you-want-here": "npm:@solana/spl-token@^0.3.6"
  }

Then import with alias name to use

import { getOrCreateAssociatedTokenAccount } from "name-it-what-you-want-here" 

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.