Nft owners can launch an auction on an existing marketplace.
Request
Argument Type Description createAuctionParam CreateAuction The configuration of the auction that will be created signer Signer An instance to represent the wallet account.
CreateAuction
Argument Type Description contractAddress string The nft contract address tokenId string The nft Id of the nft under contractAddress
startTime number The unix timestamp of start time of auction endTime number The unix timestamp of end time of auction paymentToken string The address of the crypto token that could be used to buy the nft on auction minimumPrice string The minimum price(wei) bidders can bid on the auction maximumPrice string The maximum price(wei) bidders can bid on the auction tokenType TokenType An enum with either 0 or 1 as the value. 0 represents ERC721, while 1 represents ERC1155 contractAddress amount string The amount of nft on auction. The amount is 1 if the nft contract is ERC721.
Certainly! Here's the provided content formatted in Markdown with tabular structure:
Response:
Field Type Description type number The EIP-2718 type of this transaction. chainId number The id of the network. nonce number The nonce used as part of the proof-of-work to mine this block. maxPriorityFeePerGas BigNumber The price (in wei) per unit of gas for this transaction. maxFeePerGas BigNumber The maximum price (in wei) per unit of gas this transaction will pay for (the combined EIP-1559 block's base fee and this transaction's priority fee). gasPrice BigNumber The price (in wei) per unit of gas this transaction will pay. gasLimit BigNumber The maximum amount of gas that this block was permitted to use. to string The address of the target. value BigNumber The amount (in wei) this transaction is sending. data string Transaction data. accessList AccessList The AccessList to include; only available for EIP-2930 and EIP-1559 transactions. hash string Transaction hash. v number Values for the transaction's signature. r string Values for the transaction's signature. s string Values for the transaction's signature. from string The sender address of the transaction. confirmations number The number of blocks that have been mined (including the initial block) since this transaction.
TypeScript
// can be native token or any ERC20 token
**const paymentToken = <DESIRED_CRYPTO_TOKEN>**
// any ERC721 or ERC1155 contract address
const nftAddress = <NFT_ADDRESS>
// any nft token Id under nftAddress
const nftId = <NFT_ID>
const createAuctionParam = {
contractAddress: nftAddress,
tokenId: nftId,
startTime: <AUCTION_START_TIME>,
endTime: <AUCTION_END_TIME>,
paymentToken: paymentToken,
minimumPrice: '0',
maximumPrice: '10000',
tokenType: 1, // 0 if nftAddress is an ERC721 address, 1 if nftAddress is ERC1155 address
amount: '2'
}
const result = await marketplaceSdk.createAuction(createAuctionParam, owner)
const saleId = await marketplaceSdk.getTotalAuctions()
Before someone bids in an auction, the auction owner can modify the auction.
Argument Type Description auctionId string The id of the auction signer Signer An instance to represent the wallet account. startTime (optional) number The unix timestamp of start time of auction endTime (optional) number The unix timestamp of end time of auction paymentToken (optional) string The address of the crypto token that could be used to buy the nft on auction minimumPrice (optional) string The minimum price(wei) bidders can bid on the auction maximumPrice (optional) string The maximum price(wei) bidders can bid on the auction amount (optional) string The amount of nft on auction. The amount is 1 if the nft contract is ERC721.
Field Type type number chainId number nonce number maxPriorityFeePerGas BigNumber maxFeePerGas BigNumber gasPrice BigNumber gasLimit BigNumber to string value BigNumber data string accessList AccessList hash string v number r string s string from string confirmations number
TypeScript
const currTime = Math.floor(Date.now() / 1000);
const paymentToken = <NEW_PAYMENT_TOKEN>
const startTime = <NEW_AUCTION_START_TIME>;
const endTime = <NEW_AUCTION_END_TIME>;
const minimumPrice = '1';
const maximumPrice = '100';
await marketplaceSdk.editAuction('1', signer, startTime, endTime, paymentToken, minimumPrice, maximumPrice, amount);
Before the auction start time, the auction owner can cancel the created auction
Argument Type Description auctionId string The Id of the auction in the marketplace signer Signer An instance to represent the wallet account.
Certainly! Here's the provided content formatted in Markdown:
Field Type Description type number The EIP-2718 type of this transaction. chainId number The id of the network. nonce number The nonce used as part of the proof-of-work to mine this block. maxPriorityFeePerGas BigNumber The price (in wei) per unit of gas for this transaction. maxFeePerGas BigNumber The maximum price (in wei) per unit of gas this transaction will pay for (the combined EIP-1559 block's base fee and this transaction's priority fee). gasPrice BigNumber The price (in wei) per unit of gas this transaction will pay. gasLimit BigNumber The maximum amount of gas that this block was permitted to use. to string The address of the target. value BigNumber The amount (in wei) this transaction is sending. data string Transaction data. accessList AccessList The AccessList to include; only available for EIP-2930 and EIP-1559 transactions. hash string Transaction hash. v number Values for the transaction's signature. r string Values for the transaction's signature. s string Values for the transaction's signature. from string The sender address of the transaction. confirmations number The number of blocks that have been mined (including the initial block) since this transaction.
TypeScript
const auctionId = '1'
await marketplaceSdk.cancelAuction(auctionId, signer)
After an auction is created, multiple buyers can bid on the auction by calling the method bid
with the specified auction Id. The buyer
with the highest bid price or the first one who bids the maximum price will be able to claim the nft on the auction after the endtime of the auction.
Argument Type Description auctionId string The id of the auction price string The bid price(wei) of the buyer signer Signer An instance to represent the buyer's wallet account.
Field Type Description type number The EIP-2718 type of this transaction. chainId number The id of the network. nonce number The nonce used as part of the proof-of-work to mine this block. maxPriorityFeePerGas BigNumber The price (in wei) per unit of gas for this transaction. maxFeePerGas BigNumber The maximum price (in wei) per unit of gas this transaction will pay for (the combined EIP-1559 block's base fee and this transaction's priority fee). gasPrice BigNumber The price (in wei) per unit of gas this transaction will pay. gasLimit BigNumber The maximum amount of gas that this block was permitted to use. to string The address of the target. value BigNumber The amount (in wei) this transaction is sending. data string Transaction data. accessList AccessList The AccessList to include; only available for EIP-2930 and EIP-1559 transactions. hash string Transaction hash. v number Values for the transaction's signature. r string Values for the transaction's signature. s string Values for the transaction's signature. from string The sender address of the transaction. confirmations number The number of blocks that have been mined (including the initial block) since this transaction.
TypeScript
const auctionId = '1'
const price = '123'
await marketplaceSdk.bid(auctionId, price, buyer)
After the auction end time has passed, the nft will be sent to the top bidder and the bidder's fund will be sent to the auction owner and feeReceiver of the marketplace.
Argument Type Description auctionId string The id of the auction signer Signer An instance to represent the buyer's wallet account.
Field Type Description type number The EIP-2718 type of this transaction. chainId number The id of the network. nonce number The nonce used as part of the proof-of-work to mine this block. maxPriorityFeePerGas BigNumber The price (in wei) per unit of gas for this transaction. maxFeePerGas BigNumber The maximum price (in wei) per unit of gas this transaction will pay for (the combined EIP-1559 block's base fee and this transaction's priority fee). gasPrice BigNumber The price (in wei) per unit of gas this transaction will pay. gasLimit BigNumber The maximum amount of gas that this block was permitted to use. to string The address of the target. value BigNumber The amount (in wei) this transaction is sending. data string Transaction data. accessList AccessList The AccessList to include; only available for EIP-2930 and EIP-1559 transactions. hash string Transaction hash. v number Values for the transaction's signature. r string Values for the transaction's signature. s string Values for the transaction's signature. from string The sender address of the transaction. confirmations number The number of blocks that have been mined (including the initial block) since this transaction.
TypeScript
const auctionId = '1'
const marketplaceSdk.claimAuctionNft(auctionId, owner)