Approve buyer for a reserved direct listing
Rest
...args: [listingId: BigNumberish, buyer: string]Approve a buyer to buy from a reserved listing.
// The listing ID of the direct listing you want to approve buyer for
const listingId = "0";
await contract.directListings.approveBuyerForReservedListing(listingId, "{{wallet_address}}");
DirectListings
Rest
...args: [listingId: BigNumberish, buyer: string]Approve a currency for a direct listing
Rest
...args: [listingId: BigNumberish, currencyContractAddress: string, pricePerTokenInCurrency: BigNumberish]// The listing ID of the direct listing you want to approve currency for
const listingId = "0";
await contract.directListings.approveCurrencyForListing(listingId, currencyContractAddress, pricePerTokenInCurrency);
DirectListings
Rest
...args: [listingId: BigNumberish, currencyContractAddress: string, pricePerTokenInCurrency: BigNumberish]Buy direct listing for a specific wallet
Rest
...args: [listingId: BigNumberish, quantityDesired: BigNumberish, receiver?: string]Buy from a specific direct listing from the marketplace.
// The ID of the listing you want to buy from
const listingId = 0;
// Quantity of the asset you want to buy
const quantityDesired = 1;
await contract.directListings.buyFromListing(listingId, quantityDesired, "{{wallet_address}}");
DirectListings
Rest
...args: [listingId: BigNumberish, quantityDesired: BigNumberish, receiver?: string]Cancel Direct Listing
Rest
...args: [listingId: BigNumberish]Cancel a direct listing on the marketplace
// The listing ID of the direct listing you want to cancel
const listingId = 0;
await contract.directListings.cancelListing(listingId);
DirectListings
Rest
...args: [listingId: BigNumberish]Private
contractCreate new direct listing
Rest
...args: [listing: { Create a new listing on the marketplace where people can buy an asset directly.
// Data of the listing you want to create
const listing = {
// address of the contract the asset you want to list is on
assetContractAddress: "0x...",
// token ID of the asset you want to list
tokenId: "0",
// how many of the asset you want to list
quantity: 1,
// address of the currency contract that will be used to pay for the listing
currencyContractAddress: NATIVE_TOKEN_ADDRESS,
// The price to pay per unit of NFTs listed.
pricePerToken: 1.5,
// when should the listing open up for offers
startTimestamp: new Date(Date.now()),
// how long the listing will be open for
endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
// Whether the listing is reserved for a specific set of buyers.
isReservedListing: false
}
const tx = await contract.directListings.createListing(listing);
const receipt = tx.receipt; // the transaction receipt
const id = tx.id; // the id of the newly created listing
DirectListings
Rest
...args: [listing: { Create a batch of new listings
Rest
...args: [listings: { Create a batch of new listings on the marketplace
const listings = [...];
const tx = await contract.directListings.createListingsBatch(listings);
Rest
...args: [listings: { Revoke approval of a buyer for a reserved direct listing
Rest
...args: [listingId: BigNumberish, buyer: string]// The listing ID of the direct listing you want to approve buyer for
const listingId = "0";
await contract.directListings.revokeBuyerApprovalForReservedListing(listingId, "{{wallet_address}}");
Rest
...args: [listingId: BigNumberish, buyer: string]Revoke approval of a currency for a direct listing
Rest
...args: [listingId: BigNumberish, currencyContractAddress: string]// The listing ID of the direct listing you want to revoke currency for
const listingId = "0";
await contract.directListings.revokeCurrencyApprovalForListing(listingId, currencyContractAddress);
DirectListings
Rest
...args: [listingId: BigNumberish, currencyContractAddress: string]Private
storageUpdate a direct listing
Rest
...args: [listingId: BigNumberish, listing: { // Data of the listing you want to update
const listingId = 0; // ID of the listing you want to update
const listing = {
// address of the contract the asset you want to list is on
assetContractAddress: "0x...", // should be same as original listing
// token ID of the asset you want to list
tokenId: "0", // should be same as original listing
// how many of the asset you want to list
quantity: 1,
// address of the currency contract that will be used to pay for the listing
currencyContractAddress: NATIVE_TOKEN_ADDRESS,
// The price to pay per unit of NFTs listed.
pricePerToken: 1.5,
// when should the listing open up for offers
startTimestamp: new Date(Date.now()), // can't change this if listing already active
// how long the listing will be open for
endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
// Whether the listing is reserved for a specific set of buyers.
isReservedListing: false
}
const tx = await contract.directListings.updateListing(listingId, listing);
const receipt = tx.receipt; // the transaction receipt
const id = tx.id; // the id of the newly created listing
DirectListings
Rest
...args: [listingId: BigNumberish, listing: { Private
applyOptional
filter: MarketplaceFilterWithoutOfferorCheck price per token for an approved currency
the listing id
currency contract address
const listingId = 0;
const currencyContractAddress = '0x1234';
const price = await contract.directListings.currencyPriceForListing(listingId, currencyContractAddress);
DirectListings
Get all direct listings
Optional
filter: MarketplaceFilterWithoutOfferoroptional filter parameters
the Direct listing object array
const listings = await contract.directListings.getAll();
DirectListings
Get all valid direct listings
Optional
filter: MarketplaceFilterWithoutOfferoroptional filter parameters
the Direct listing object array
A valid listing is where the listing is active, and the creator still owns & has approved Marketplace to transfer the listed NFTs.
const listings = await contract.directListings.getAllValid();
DirectListings
Get a single direct listing
the listing id
the Direct listing object
const listingId = 0;
const listing = await contract.directListings.getListing(listingId);
const listingId = 0;
const listing = await contract.directListings.getListing(listingId);
DirectListings
Check if a buyer is approved for a specific direct listing
the listing id
buyer address
const listingId = 0;
const isBuyerApproved = await contract.directListings.isBuyerApprovedForListing(listingId, "{{wallet_address}}");
DirectListings
Check if a currency is approved for a specific direct listing
the listing id
currency address
const listingId = 0;
const currencyContractAddress = '0x1234';
const isApproved = await contract.directListings.isCurrencyApprovedForListing(listingId, currencyContractAddress);
DirectListings
Private
validateThrows error if listing could not be found
Listing to check for
Generated using TypeDoc
Handles direct listings