solana-developers / solana-cookbook

https://solanacookbook.com/
606 stars 340 forks source link

Get NFTs from a wallet method is deprecated #308

Open byronmoore-dev opened 2 years ago

byronmoore-dev commented 2 years ago

Metaplex has deprecated multiple classes/methods in their @metaplex-foundation/mpl-token-metadata library. This has resulted in the "How to get all NFTs from a wallet" section of the Solana Cookbook being incorrect. The method findDataByOwner is deprecated.

const nftsmetadata = await Metadata.findDataByOwner(connection, ownerPublickey);

jacobcreech commented 2 years ago

Looks like it got replaced with findByOwnerV3 https://github.com/metaplex-foundation/metaplex-program-library/pull/195

Got to love versioning methods instead of a library.

byronmoore-dev commented 2 years ago

It seems that findByOwnerV3 is also deprecated, as per their documentation at this link: https://metaplex-foundation.github.io/metaplex-program-library/docs/token-metadata/classes/deprecated.Metadata.html

Calling the method results in a Metadata.findByOwnerV3 is not a function error.

albertpurnama commented 2 years ago

@byronmoore04 you can temporarily use the older version yarn add @metaplex-foundation/mpl-token-metadata@^1.2

0xdeepmehta commented 2 years ago

Metaplex changing their SDK very frequently, what the heck

kudarukuni commented 2 years ago

tried installing metaplex dependencies today and it gave me a successful message but the metaplex/js folder was empty. even tried running the ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version and gave me a cant find module error