Hierarchy

  • NightmarketClient

Constructors

Methods

  • Accept an offer

    Parameters

    • mint: PublicKey

      Public key for the listed NFT

    • price: number

      SOL price for offer

    • seller: PublicKey

      Public key for the seller

    • buyer: PublicKey

      Public key for the buyer

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const acceptAction = await nmClient.AcceptOffer(mint, price, seller, buyer);
    if (!!acceptAction.err) {
    throw acceptAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: seller,
    recentBlockhash: blockhash,
    instructions: acceptAction.instructions,
    }).compileToV0Message(acceptAction.altAccounts);

    const transactionV0 = new VersionedTransaction(messageV0);
  • Buy a NFT via listing. Currently only support Night Market listings.

    Parameters

    • mint: PublicKey

      Public key for the listed NFT

    • price: number

      SOL price of the listing

    • seller: PublicKey

      Public key for the seller

    • buyer: PublicKey

      Public key for the buyer

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const buyListingAction = await nmClient.BuyListing(mint, price, seller, buyer);
    if (!!buyListingAction.err) {
    throw buyListingAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: buyer,
    recentBlockhash: blockhash,
    instructions: buyListingAction.instructions,
    }).compileToV0Message(buyListingAction.altAccounts);

    const transactionV0 = new VersionedTransaction(messageV0);
  • Close a listing for a NFT

    Parameters

    • mint: PublicKey

      Public key for the listed NFT

    • seller: PublicKey

      Public key for the seller

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const closeListingAction = await nmClient.CloseListing(mint, seller);
    if (!!closeListingAction.err) {
    throw closeListingAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: seller,
    recentBlockhash: blockhash,
    instructions: closeListingAction.instructions,
    }).compileToV0Message(closeListingAction.altAccounts);

    const transactionV0 = new VersionedTransaction(messageV0);
  • Close an offer

    Parameters

    • mint: PublicKey

      Public key for the NFT

    • price: number

      SOL price of offer

    • seller: PublicKey

      Public key for the seller

    • buyer: PublicKey

      Public key for the buyer

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const closeOfferAction = await nmClient.CloseOffer(mint, price, seller, buyer);
    if (!!closeOfferAction.err) {
    throw closeOfferAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: buyer,
    recentBlockhash: blockhash,
    instructions: closeOfferAction.instructions,
    }).compileToV0Message();

    const transactionV0 = new VersionedTransaction(messageV0);
  • Create a listing for a NFT

    Parameters

    • mint: PublicKey

      Public key for the NFT to list

    • price: number

      SOL price of listing

    • seller: PublicKey

      Public key for the seller

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const createListingAction = await nmClient.CreateListing(mint, price, seller);
    if (!!createListingAction.err) {
    throw createListingAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: seller,
    recentBlockhash: blockhash,
    instructions: createListingAction.instructions,
    }).compileToV0Message(createListingAction.altAccounts);

    const transactionV0 = new VersionedTransaction(messageV0);
  • Create an offer for buying a NFT

    Parameters

    • mint: PublicKey

      Public key for the NFT

    • price: number

      SOL price of the offer

    • seller: PublicKey

      Public key for the NFT owner

    • buyer: PublicKey

      Public key for the buyer

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const createOfferAction = await nmClient.CreateOffer(mint, price, seller, buyer);
    if (!!createOfferAction.err) {
    throw createOfferAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: buyer,
    recentBlockhash: blockhash,
    instructions: createOfferAction.instructions,
    }).compileToV0Message();

    const transactionV0 = new VersionedTransaction(messageV0);
  • Get the listing details for a NFT

    Parameters

    • mint: PublicKey

      Public key of the NFT

    Returns Promise<null | Listing>

    • NFT listing details

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
    const listing = await nmClient.GetListing(mint);
  • Get offers for a NFT

    Parameters

    • mint: PublicKey

      Public key of the NFT

    Returns Promise<Offer[]>

    • A list of NFT offers

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
    const offers = await nmClient.GetOffers(mint);
  • Check if the listing is local to Night Market

    Parameters

    • listing: Listing

      Listing details retrieved with GetListing

    Returns boolean

    • Whether the listing is local to Night Market

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
    const isNMListing = nmClient.IsLocalListing(listing);
  • Check if the offer is local to Night Market

    Parameters

    • offer: Offer

      Offer details retrieved with GetOffers

    Returns boolean

    • Whether the offer is local to Night Market

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
    const isNMOffer = nmClient.IsLocalOffer(offer);
  • Update a listing for a NFT

    Parameters

    • mint: PublicKey

      Public key for the listed NFT

    • price: number

      Updated SOL price of the NFT

    • seller: PublicKey

      Public key for the seller

    Returns Promise<Action>

    • Night Market action object

    Basic usage example:

    const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");

    const updateListingAction = await nmClient.UpdateListing(mint, price, seller);
    if (!!updateListingAction.err) {
    throw updateListingAction.err;
    }

    const { blockhash } = await connection.getLatestBlockhash();
    const messageV0 = new TransactionMessage({
    payerKey: seller,
    recentBlockhash: blockhash,
    instructions: updateListingAction.instructions,
    }).compileToV0Message();

    const transactionV0 = new VersionedTransaction(messageV0);

Generated using TypeDoc