metaplex-foundation / mpl-token-metadata

Program to attach additional data to Fungible or Non-Fungible tokens on Solana.
https://developers.metaplex.com/token-metadata
Other
98 stars 42 forks source link

I cannot import mpl_token_metadata::instruction. #102

Open lucaslee129 opened 3 months ago

lucaslee129 commented 3 months ago

Hi, How are you, everyone. I hope this message finds you well.

I am a fresher to Solana, so now I am following the tutorial using anchor framework. But I faced the some problems while following that course.

Here is my dependencies.

[dependencies]
anchor-lang = {version = "0.29.0", features = ["init-if-needed"]}
anchor-spl = {version = "0.29.0", features = ["metadata"]}
mpl-token-metadata = "4.1.2"

I cannot import the instruction of mpl_token_metadata. Here is some of my code snipet.

...
use mpl_token_metadata::instruction::create_metadata_accounts_v3;
...

In this case, this error is occured.

use mpl_token_metadata::instruction::create_metadata_accounts_v3;
  |                         ^^^^^^^^^^^ could not find `instruction` in `mpl_token_metadata`

I am working for this error for about 4 hours, cannot find the solution.

Please help me, Thanks.

ad7090 commented 2 months ago

same issue @lucaslee129 @katopz @thlorenz @enriquefynn @febo

blockiosaurus commented 1 month ago

Token Metadata is not an Anchor program and therefore doesn't export the Instructions in the same way. For details on how to CPI into the program, please see the Metaplex docs https://developers.metaplex.com/token-metadata/mint and select Rust (CPI) in the dialect switcher for code examples.