Accept an offer on a direct listing
Rest
...args: [listingId: BigNumberish, addressOfOfferor: string]Accept an offer on a direct listing
// The listing ID of the asset you want to bid on
const listingId = 0;
// The price you are willing to bid for a single token of the listing
const offeror = "0x...";
await contract.direct.acceptOffer(listingId, offeror);
Rest
...args: [listingId: BigNumberish, addressOfOfferor: string]Buy a Listing
Rest
...args: [listingId: BigNumberish, quantityDesired: BigNumberish, receiver?: string]Buy a specific direct listing from the marketplace.
// The listing ID of the asset you want to buy
const listingId = 0;
// Quantity of the asset you want to buy
const quantityDesired = 1;
await contract.direct.buyoutListing(listingId, quantityDesired);
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.direct.cancelListing(listingId);
Rest
...args: [listingId: BigNumberish]Private
contractCreate Direct Listing
Rest
...args: [listing: NewDirectListing]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",
// when should the listing open up for offers
startTimestamp: new Date(),
// how long the listing will be open for
listingDurationInSeconds: 86400,
// 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,
// how much the asset will be sold for
buyoutPricePerToken: "1.5",
}
const tx = await contract.direct.createListing(listing);
const receipt = tx.receipt; // the transaction receipt
const id = tx.id; // the id of the newly created listing
Rest
...args: [listing: NewDirectListing]Create a batch of new listings
Rest
...args: [listings: NewDirectListing[]]Create a batch of new listings on the marketplace
const listings = [...];
const tx = await contract.direct.createListingsBatch(listings);
Rest
...args: [listings: NewDirectListing[]]Make an offer for a Direct Listing
Rest
...args: [listingId: BigNumberish, quantityDesired: BigNumberish, currencyContractAddress: string, pricePerToken: string | number, expirationDate?: Date]Make an offer on a direct listing
import { ChainId, NATIVE_TOKENS } from "@thirdweb-dev/sdk";
// The listing ID of the asset you want to offer on
const listingId = 0;
// The price you are willing to offer per token
const pricePerToken = 1;
// The quantity of tokens you want to receive for this offer
const quantity = 1;
// The address of the currency you are making the offer in (must be ERC-20)
const currencyContractAddress = NATIVE_TOKENS[ChainId.Rinkeby].wrapped.address
await contract.direct.makeOffer(
listingId,
quantity,
currencyContractAddress,
pricePerToken
);
Rest
...args: [listingId: BigNumberish, quantityDesired: BigNumberish, currencyContractAddress: string, pricePerToken: string | number, expirationDate?: Date]Private
storageUpdate a Direct listing with new metadata.
Note: cannot update a listing with a new quantity of 0. Use cancelDirectListing
to remove a listing instead.
Rest
...args: [listing: DirectListing]Rest
...args: [listing: DirectListing]Get a direct listing by id
the listing id
the Direct listing object
Private
validateThrows error if listing could not be found
Listing to check for
Generated using TypeDoc
Handles direct listings