Private
_chainPrivate
contractPrivate
storageStatic
contractDirect listings
Create and manage direct listings in your marketplace.
// 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
// And on the buyers side:
// 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);
Auctions
Create and manage auctions in your marketplace.
// Data of the auction you want to create
const auction = {
// address of the contract of the asset you want to auction
assetContractAddress: "0x...",
// token ID of the asset you want to auction
tokenId: "0",
// how many of the asset you want to auction
quantity: 1,
// address of the currency contract that will be used to pay for the auctioned tokens
currencyContractAddress: NATIVE_TOKEN_ADDRESS,
// the minimum bid that will be accepted for the token
minimumBidAmount: "1.5",
// how much people would have to bid to instantly buy the asset
buyoutBidAmount: "10",
// If a bid is made less than these many seconds before expiration, the expiration time is increased by this.
timeBufferInSeconds: "1000",
// A bid must be at least this much bps greater than the current winning bid
bidBufferBps: "100", // 100 bps stands for 1%
// when should the auction open up for bidding
startTimestamp: new Date(Date.now()),
// end time of auction
endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
}
const tx = await contract.englishAuctions.createAuction(auction);
const receipt = tx.receipt; // the transaction receipt
const id = tx.id; // the id of the newly created auction
// And on the buyers side:
// The auction ID of the asset you want to bid on
const auctionId = 0;
// The total amount you are willing to bid for auctioned tokens
const bidAmount = 1;
await contract.englishAuctions.makeBid(auctionId, bidAmount);
Offers
Make and manage offers.
// Data of the offer you want to make
const offer = {
// address of the contract the asset you want to make an offer for
assetContractAddress: "0x...",
// token ID of the asset you want to buy
tokenId: "0",
// how many of the asset you want to buy
quantity: 1,
// address of the currency contract that you offer to pay in
currencyContractAddress: NATIVE_TOKEN_ADDRESS,
// Total price you offer to pay for the mentioned token(s)
totalPrice: "1.5",
// Offer valid until
endTimestamp: new Date(),
}
const tx = await contract.offers.makeOffer(offer);
const receipt = tx.receipt; // the transaction receipt
const id = tx.id; // the id of the newly created offer
// And on the seller's side:
// The ID of the offer you want to accept
const offerId = 0;
await contract.offers.acceptOffer(offerId);
Private
detectFEATURE DETECTION
Private
detectPrivate
detectGenerated using TypeDoc
Create your own whitelabel marketplace that enables users to buy and sell any digital assets.
Example