Options
All
  • Public
  • Public/Protected
  • All
Menu

A bespoke client for NFT.Storage that uses Solana private keys to authenticate uploads of NFT assets and metadata for Metaplex NFT creators.

This client uses a metaplex-specific endpoint (https://api.nft.storage/metaplex/upload) that requires a request-specific JWT token. See SPEC.md in this repo for more details.

Hierarchy

  • NFTStorageMetaplexor

Index

Constructors

Properties

endpoint: URL

Methods

  • storeBlob(blob: Blob): Promise<string>
  • Stores a single Blob (or File) with NFT.Storage, without wrapping in a directory listing. If a File is provided, any filenames will be ignored and will not be preserved on IPFS.

    Parameters

    • blob: Blob

      a Blob or File object to store

    Returns Promise<string>

    CID string for the stored content

  • Stores a Content Archive (CAR) containing content addressed data.

    Parameters

    • cid: CID

      the root CID of the CAR.

    • car: <internal>.CarReader

      a CarReader that supplies CAR data. Must have a single root CID that matches the cid param.

    • Optional opts: <internal>.CarStorerOptions

      options to pass through to NFTStorage.storeCar

    Returns Promise<<internal>.CIDString>

    a Promise that resolves to the uploaded CID, as a CIDv1 string.

  • Stores one or more files with NFT.Storage, bundling them into an IPFS directory.

    If the files contain directory paths in their names, they MUST all share the same parent directory. E.g. 'foo/hello.txt' and 'foo/thing.json' is fine, but 'foo/hello.txt' and 'bar/thing.json' will fail.

    Parameters

    Returns Promise<string>

    CID string of the IPFS directory containing all uploaded files.

  • storeNFTFromFilesystem(metadataFilePath: string, imageFilePath?: string, opts?: { gatewayHost?: string; storeCarOptions?: <internal>.CarStorerOptions; validateSchema?: boolean }): Promise<StoreNFTResult>
  • Loads an NFT from disk and stores it with NFT.Storage. Node.js only!

    Uses loadNFTFromFilesystem to load NFT data and stores with storePreparedNFT.

    Parameters

    • metadataFilePath: string

      path to metadata.json file

    • Optional imageFilePath: string

      optional path to image file. If not provided, the image will be located using the heuristics described in loadNFTFromFilesystem.

    • opts: { gatewayHost?: string; storeCarOptions?: <internal>.CarStorerOptions; validateSchema?: boolean } = {}
      • Optional gatewayHost?: string

        the hostname of an IPFS HTTP gateway to use in metadata links. Defaults to "nftstorage.link" if not set.

      • Optional storeCarOptions?: <internal>.CarStorerOptions

        options to pass through to NFTStorage.storeCar

      • Optional validateSchema?: boolean

        if true, validate the metadata against a JSON schema before processing. off by default

    Returns Promise<StoreNFTResult>

    a StoreNFTResult object containing the CIDs and URLs for the stored NFT

  • Stores a single Blob (or File) with NFT.Storage, without wrapping in a directory listing. If a File is provided, any filenames will be ignored and will not be preserved on IPFS.

    Parameters

    • context: ServiceContext

      information required to authenticate uploads

    • blob: Blob

      a Blob or File object to store

    Returns Promise<string>

    CID string for the stored content

  • Stores a Content Archive (CAR) containing content addressed data.

    Parameters

    • context: ServiceContext

      information required to authenticate uploads

    • cid: CID

      the root CID of the CAR.

    • car: <internal>.CarReader

      a CarReader that supplies CAR data. Must have a single root CID that matches the cid param.

    • Optional opts: <internal>.CarStorerOptions

      options to pass through to NFTStorage.storeCar

    Returns Promise<<internal>.CIDString>

    a Promise that resolves to the uploaded CID, as a CIDv1 string.

  • Stores one or more files with NFT.Storage, bundling them into an IPFS directory.

    If the files contain directory paths in their names, they MUST all share the same parent directory. E.g. 'foo/hello.txt' and 'foo/thing.json' is fine, but 'foo/hello.txt' and 'bar/thing.json' will fail.

    Parameters

    Returns Promise<string>

    CID string of the IPFS directory containing all uploaded files.

  • Loads an NFT from disk and stores it with NFT.Storage. Node.js only!

    Uses loadNFTFromFilesystem to load NFT data and stores with storePreparedNFT.

    Parameters

    • context: ServiceContext

      information required to authenticate uploads

    • metadataFilePath: string

      path to metadata.json file

    • Optional imageFilePath: string

      optional path to image file. If not provided, the image will be located using the heuristics described in loadNFTFromFilesystem.

    • opts: { gatewayHost?: string; storeCarOptions?: <internal>.CarStorerOptions; validateSchema?: boolean } = {}
      • Optional gatewayHost?: string

        the hostname of an IPFS HTTP gateway to use in metadata links. Defaults to "nftstorage.link" if not set.

      • Optional storeCarOptions?: <internal>.CarStorerOptions

        options to pass through to NFTStorage.storeCar

      • Optional validateSchema?: boolean

        if true, validate the metadata against a JSON schema before processing. off by default

    Returns Promise<StoreNFTResult>

    a StoreNFTResult object containing the CIDs and URLs for the stored NFT

  • withSecretKey(key: Uint8Array, opts: { agentVersion?: string; endpoint?: URL; mintingAgent: string; solanaCluster?: string }): NFTStorageMetaplexor
  • Creates a new instance of NFTStorageMetaplexor using the given secret signing key.

    Parameters

    • key: Uint8Array

      an Ed25519 private key

    • opts: { agentVersion?: string; endpoint?: URL; mintingAgent: string; solanaCluster?: string }
      • Optional agentVersion?: string

        an optional version of the mintingAgent. See TagMintingAgentVersion for details.

      • Optional endpoint?: URL

        the URL of the NFT.Storage API. defaults to 'https://api.nft.storage' if not provided.

      • mintingAgent: string

        the "user agent" or tool used to prepare the upload. See TagMintingAgent for details.

      • Optional solanaCluster?: string

        the Solana cluster that the uploaded NFTs are to be minted on. defaults to 'devnet' if not provided.

    Returns NFTStorageMetaplexor

  • withSigner(signMessage: Signer, publicKey: Uint8Array, opts: { agentVersion?: string; endpoint?: URL; mintingAgent: string; solanaCluster?: string }): NFTStorageMetaplexor
  • Creates a new instance of NFTStorageMetaplexor using the given Signer, which is a function that accepts a Uint8Array to be signed and returns a Promise<Uint8Array> containing the signature. The Signer type is compatible with the signMessage method of Solana wallet adapters that support signing arbitrary messages.

    Parameters

    • signMessage: Signer

      a function that asynchronously returns a signature of an input message

    • publicKey: Uint8Array

      the public key that can validate signatures produced by the signer

    • opts: { agentVersion?: string; endpoint?: URL; mintingAgent: string; solanaCluster?: string }
      • Optional agentVersion?: string

        an optional version of the mintingAgent. See TagMintingAgentVersion for details.

      • Optional endpoint?: URL

        the URL of the NFT.Storage API. defaults to 'https://api.nft.storage' if not provided.

      • mintingAgent: string

        the "user agent" or tool used to prepare the upload. See TagMintingAgent for details.

      • Optional solanaCluster?: string

        the Solana cluster that the uploaded NFTs are to be minted on. defaults to 'devnet' if not provided.

    Returns NFTStorageMetaplexor

Generated using TypeDoc