useCreateDirectListing
Hook for creating a new direct listing on a Marketplace
or MarketplaceV3 smart contract.
Direct listings require the user to approve the marketplace to transfer the NFTs on their behalf as part of the listing creation process. This is because the marketplace needs permission to execute sales and transfer the NFTs to the buyer when a sale is made.
Example
Parameters
Returns
Mutation object to create a new direct listing
options
The mutation function takes an object as an argument with the following properties:
assetContractAddress (required)
The address of the NFT smart contract that you want to list.
tokenId (required)
The token ID of the NFT that you want to list.
pricePerToken (required)
The price to buy each token in the listing.
For ERC721 NFTs, this is the price to buy the NFT outright.
For ERC1155 NFTs, this is the price to
1
quantity of the NFT.
currencyContractAddress (optional)
The address of the currency you want users to pay with and make bids in.
You likely want to use the token native to the chain you are on, e.g. Ether on Ethereum.
To do that, you can import the NATIVE_TOKEN_ADDRESS
constant from @thirdweb-dev/sdk
.
The default value is NATIVE_TOKEN_ADDRESS
.
isReservedListing (optional)
When set to true, the seller must explicitly approve which wallet addresses can buy the NFT.
quantity (optional)
How many tokens to include in the listing.
For ERC721 NFTs, this is always
1
.For ERC1155 NFTs, this is the quantity of tokens to include in the listing.
startTimestamp (optional)
A Date
object for the start time of the listing.
The default value is new Date()
, which is the current time.
endTimestamp (optional)
A Date
object for the end time of the listing (when the listing will expire).