Skip to content

Instantly share code, notes, and snippets.

@echohtp
Created April 5, 2022 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echohtp/e0bf7a1552ede7f6666a671ba4462850 to your computer and use it in GitHub Desktop.
Save echohtp/e0bf7a1552ede7f6666a671ba4462850 to your computer and use it in GitHub Desktop.
import { Metaplex as Metaplex } from "@metaplex-foundation/js-next";
import { Connection, clusterApiUrl, PublicKey } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("mainnet-beta"));
const metaplex = new Metaplex(connection);
let mint = new PublicKey("D2ZJKaWvS3FnvdxgNKcvbnRWgouuBsChEaJTtQ6dgmNH");
let nft = await metaplex.nfts().findNft({ mint });
console.log(nft);
/*
Output:
Nft {
metadataAccount: MetadataAccount {
executable: false,
owner: PublicKey {
_bn: <BN: b7065b1e3d17c45389d527f6b04c3cd58b86c731aa0fdb549b6d1bc03f82946>
},
lamports: 5616720,
data: Metadata {
key: 4,
updateAuthority: [PublicKey],
mint: [PublicKey],
data: [Object],
primarySaleHappened: true,
isMutable: true,
editionNonce: 255,
tokenStandard: null,
collection: [Object],
uses: null
},
rentEpoch: 297
},
masterEditionAccount: MasterEditionAccount {
executable: false,
owner: PublicKey {
_bn: <BN: b7065b1e3d17c45389d527f6b04c3cd58b86c731aa0fdb549b6d1bc03f82946>
},
lamports: 2853600,
data: MasterEditionV2 { key: 6, supply: <BN: 0>, maxSupply: <BN: 0> },
rentEpoch: 296
},
metadata: {
name: 'Brushstroke Forest',
symbol: '',
description: "We are collectively and individually made of the same essential materials. All that has been, and ever will be, began life as pure stardust. Discover delightfully malleable cosmic elements in harmonious alignment, resulting in 0xBanana's Winter 2021 Collection: Fundamentals.\n" +
'\n' +
'Moving vignette on digital canvas. 960x1080 pixels. ',
seller_fee_basis_points: 700,
image: 'https://bafkreig54cawlkyhlwmzupffiwzifjrdunjtosabmb5qysc6pcgk7ejhya.ipfs.dweb.link?ext=jpg',
animation_url: 'https://bafybeiazyylmemqsjta4bvuklixytbm6tro5xtsj7fxvs3vloove55zzuq.ipfs.dweb.link?ext=mp4',
attributes: [ [Object], [Object], [Object] ],
external_url: '',
properties: { files: [Array], category: 'video', creators: [Array] }
},
updateAuthority: PublicKey {
_bn: <BN: f606c9481ab2091c0df02006518ee745ad50dd2b19949d218ef4c19bb1c7a61>
},
mint: PublicKey {
_bn: <BN: b2b25816d0f70a09b29d90846e7fabe4a4ac3558f05e992ddeba6eccf761acba>
},
name: 'Brushstroke Forest',
symbol: '',
uri: 'https://bafkreiem6mtnsck6jzt7rorzvmrwwwe3mzhgkuza6cu3esni4qqayrblju.ipfs.dweb.link?ext=json',
sellerFeeBasisPoints: 700,
creators: [ { address: [PublicKey], verified: true, share: 100 } ],
primarySaleHappened: true,
isMutable: true,
editionNonce: 255,
tokenStandard: null,
collection: {
verified: true,
key: PublicKey {
_bn: <BN: 6e48dbafb0b2fd50331b4cef8f3560323190ac03caaafdd908fdba6edae29170>
}
},
uses: null,
supply: <BN: 0>,
maxSupply: <BN: 0>
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment