SoLibrary
  • Solana
  • The Meme Coin Problem and Solution
  • Developing on Solana
  • From Rust To Deployment
  • Solana Blockchain Explorer
  • Building a Solana dAPP
  • Deploying a Solana dApp
  • Deploying a Solana Memecoin using CLI
  • Solana Smart Contracts
  • Send Solana via javascript functions
  • Candy Machine
  • Pump fun APIs
  • Metaplex
  • Metaplex Program Library
  • Solana Program Library
  • UMI Framework
  • Umi and Web3js Differences
  • Fetching Accounts
  • UMI Helpers
  • HTTP Requests
  • Umi's Interfaces
  • Interface implementations
  • Kinobi
  • UMI Plugins
  • Registering Programs
  • Public keys and Signers
  • Connecting RPCS
  • Serializer
  • Storage
  • Transactions
  • Web 3.JS Adapters
  • Metaplex Umi Plugins
  • Core JS SDK v1.0
  • Local Validator
  • SolScriptions
  • FAQ
  • Initialize
  • Write Inscription Data
  • Fetch
  • Clear
  • Close
  • Authority
  • Sharding
  • Getting Started using JavaScript
  • Getting started using the Inscriptions CLI
  • Core Candy Machine
  • Getting Started using JavaScript
  • Candy Guard
  • Assets
  • Creating a Core Candy Machine
  • Inserting Items
  • Updating The Core Candy Machine
  • Guard Groups
  • Special Guard Instructions
  • Fetching a Core Candy Machine
  • Minting
  • Withdrawing a Core Candy Machine
  • Address Gate Guard
  • Allocation
  • Allowlist Guard
  • Asset Burn Guard
  • Asset Burn Multi
  • Asset Payment Guard
  • Asset Payment Multi
  • Asset Mint Limit
  • Bot Tax Guard
  • End Date Guard
  • Edition
  • Freeze Sol Payment guard
  • Freeze Token Payment Guard
  • Gatekeeper Guard
  • Mint Limit Guard
  • NFT Burn Guard
  • NFT Gate Guard
  • NFT Mint Limit Guard
  • NFT Payment Guard
  • Program Gate Guard
  • Redeemed Amount Guard
  • Sol Fixed Fee Guard
  • Sol Payment Guard
  • Start Date Guard
  • Third Party Signer Guard
  • Token Burn Guard
  • Token Gate Guard
  • Token Payment Guard
  • Token2022 Payment Guard
  • Generating Custom Guard Client for Core Candy Machine
Powered by GitBook
On this page
  • Fetch inscription Metadata
  • Fetch mint inscription
  • Fetch data inscription
  • Fetch current Inscription count

Fetch

Fetching Inscription Data

PreviousWrite Inscription DataNextClear

Last updated 10 months ago

Once Inscription Accounts are their Metadata can be read from chain again. Once data is it can also be read. To fetch inscriptions you also have to use different functions according to the inscription type.

Fetch inscription Metadata

Both inscription types use a metadata account. This Account contains for example the inscriptionRank, associatedInscriptions, updateAuthorities and . The Metadata can be fetched like so:

Fetch Inscription Metadata

JavaScript

import { safeFetchInscriptionMetadataFromSeeds } from '@metaplex-foundation/mpl-inscription'

const inscriptionMetadataAccount = await safeFetchInscriptionMetadataFromSeeds(
  umi,
  {
    inscriptionAccount: inscriptionAccount.publicKey,
  }
)

console.log(inscriptionMetadataAccount)

Fetch mint inscription

To fetch the deserialized mint inscription you can use safeFetchMintInscriptionFromSeeds like so:

Fetch Mint Inscription

JavaScript

import { fetchInscription, safeFetchMintInscriptionFromSeeds, safeFetchInscriptionMetadataFromSeeds } from '@metaplex-foundation/mpl-inscription'

const mintInscription = await safeFetchMintInscriptionFromSeeds(umi, {
  mint,
})

const inscriptionMetadataAccount = await safeFetchInscriptionMetadataFromSeeds(
  umi,
  {
    inscriptionAccount: inscriptionAccount.publicKey,
  }
)

const associatedInscriptionAccount = findAssociatedInscriptionPda(umi, {
  associated_tag: inscriptionMetadataAccount.associatedInscriptions[0].tag,
  inscriptionMetadataAccount.publicKey,
})
const imageData = await fetchInscription(umi, associatedInscriptionAccount[0])

Fetch data inscription

To read Inscription Data that is not attached to NFTs a different function is used:

Fetch Inscription

JavaScript

import { fetchInscription } from '@metaplex-foundation/mpl-inscription'

const inscription = fetchInscription(umi, inscriptionAddress)

Fetch current Inscription count

The current total inscription count can be fetched like so:

Fetch current Inscription count

JavaScript

import {
  fetchAllInscriptionShard,
  findInscriptionShardPda,
} from '@metaplex-foundation/mpl-inscription'

const shardKeys: Pda[]
for (let shardNumber = 0; shardNumber < 32; shardNumber += 1) {
  shardKeys.push(findInscriptionShardPda(umi, { shardNumber }))
}

const shards = await fetchAllInscriptionShard(umi, shardKeys)
let numInscriptions = 0
shards.forEach((shard) => {
  const rank = 32 * Number(shard.count) + shard.shardNumber
  numInscriptions = Math.max(numInscriptions, rank)
})

console.log(`Currently there are ${numInscriptions} Metaplex Inscriptions`)
initialized
written
more