Optional
endpoint: stringAccept an offer
Public key for the listed NFT
SOL price for offer
Public key for the seller
Public key for the buyer
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.
Public key for the listed NFT
SOL price of the listing
Public key for the seller
Public key for the buyer
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
Public key for the listed NFT
Public key for the seller
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
Public key for the NFT
SOL price of offer
Public key for the seller
Public key for the buyer
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
Public key for the NFT to list
SOL price of listing
Public key for the seller
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
Public key for the NFT
SOL price of the offer
Public key for the NFT owner
Public key for the buyer
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
Public key of the NFT
Basic usage example:
const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
const listing = await nmClient.GetListing(mint);
Check if the listing is local to Night Market
Listing details retrieved with GetListing
Basic usage example:
const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
const isNMListing = nmClient.IsLocalListing(listing);
Check if the offer is local to Night Market
Offer details retrieved with GetOffers
Basic usage example:
const nmClient = new NightmarketClient("YOUR RPC ENDPOINT");
const isNMOffer = nmClient.IsLocalOffer(offer);
Update a listing for a NFT
Public key for the listed NFT
Updated SOL price of the NFT
Public key for the seller
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
Solana RPC endpoint URL