Auction

createAuction

Nft owners can launch an auction on an existing marketplace.

Parameter

Request

ArgumentTypeDescription
createAuctionParamCreateAuctionThe configuration of the auction that will be created
signerSignerAn instance to represent the wallet account.

CreateAuction

ArgumentTypeDescription
contractAddressstringThe nft contract address
tokenIdstringThe nft Id of the nft under contractAddress
startTimenumberThe unix timestamp of start time of auction
endTimenumberThe unix timestamp of end time of auction
paymentTokenstringThe address of the crypto token that could be used to buy the nft on auction
minimumPricestringThe minimum price(wei) bidders can bid on the auction
maximumPricestringThe maximum price(wei) bidders can bid on the auction
tokenTypeTokenTypeAn enum with either 0 or 1 as the value. 0 represents ERC721, while 1 represents ERC1155 contractAddress
amountstringThe amount of nft on auction. The amount is 1 if the nft contract is ERC721.

Response

Certainly! Here's the provided content formatted in Markdown with tabular structure:

Response:

FieldTypeDescription
typenumberThe EIP-2718 type of this transaction.
chainIdnumberThe id of the network.
noncenumberThe nonce used as part of the proof-of-work to mine this block.
maxPriorityFeePerGasBigNumberThe price (in wei) per unit of gas for this transaction.
maxFeePerGasBigNumberThe 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).
gasPriceBigNumberThe price (in wei) per unit of gas this transaction will pay.
gasLimitBigNumberThe maximum amount of gas that this block was permitted to use.
tostringThe address of the target.
valueBigNumberThe amount (in wei) this transaction is sending.
datastringTransaction data.
accessListAccessListThe AccessList to include; only available for EIP-2930 and EIP-1559 transactions.
hashstringTransaction hash.
vnumberValues for the transaction's signature.
rstringValues for the transaction's signature.
sstringValues for the transaction's signature.
fromstringThe sender address of the transaction.
confirmationsnumberThe number of blocks that have been mined (including the initial block) since this transaction.

Example

// 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()

editAuction

Before someone bids in an auction, the auction owner can modify the auction.

Parameter

ArgumentTypeDescription
auctionIdstringThe id of the auction
signerSignerAn instance to represent the wallet account.
startTime (optional)numberThe unix timestamp of start time of auction
endTime (optional)numberThe unix timestamp of end time of auction
paymentToken (optional)stringThe address of the crypto token that could be used to buy the nft on auction
minimumPrice (optional)stringThe minimum price(wei) bidders can bid on the auction
maximumPrice (optional)stringThe maximum price(wei) bidders can bid on the auction
amount (optional)stringThe amount of nft on auction. The amount is 1 if the nft contract is ERC721.

Response

FieldType
typenumber
chainIdnumber
noncenumber
maxPriorityFeePerGasBigNumber
maxFeePerGasBigNumber
gasPriceBigNumber
gasLimitBigNumber
tostring
valueBigNumber
datastring
accessListAccessList
hashstring
vnumber
rstring
sstring
fromstring
confirmationsnumber

Example

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);

cancelAuction

Before the auction start time, the auction owner can cancel the created auction

ArgumentTypeDescription
auctionIdstringThe Id of the auction in the marketplace
signerSignerAn instance to represent the wallet account.

Response

Certainly! Here's the provided content formatted in Markdown:

FieldTypeDescription
typenumberThe EIP-2718 type of this transaction.
chainIdnumberThe id of the network.
noncenumberThe nonce used as part of the proof-of-work to mine this block.
maxPriorityFeePerGasBigNumberThe price (in wei) per unit of gas for this transaction.
maxFeePerGasBigNumberThe 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).
gasPriceBigNumberThe price (in wei) per unit of gas this transaction will pay.
gasLimitBigNumberThe maximum amount of gas that this block was permitted to use.
tostringThe address of the target.
valueBigNumberThe amount (in wei) this transaction is sending.
datastringTransaction data.
accessListAccessListThe AccessList to include; only available for EIP-2930 and EIP-1559 transactions.
hashstringTransaction hash.
vnumberValues for the transaction's signature.
rstringValues for the transaction's signature.
sstringValues for the transaction's signature.
fromstringThe sender address of the transaction.
confirmationsnumberThe number of blocks that have been mined (including the initial block) since this transaction.

Example

const auctionId = '1'
await marketplaceSdk.cancelAuction(auctionId, signer)

bid

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.

Parameter

ArgumentTypeDescription
auctionIdstringThe id of the auction
pricestringThe bid price(wei) of the buyer
signerSignerAn instance to represent the buyer's wallet account.

Response

FieldTypeDescription
typenumberThe EIP-2718 type of this transaction.
chainIdnumberThe id of the network.
noncenumberThe nonce used as part of the proof-of-work to mine this block.
maxPriorityFeePerGasBigNumberThe price (in wei) per unit of gas for this transaction.
maxFeePerGasBigNumberThe 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).
gasPriceBigNumberThe price (in wei) per unit of gas this transaction will pay.
gasLimitBigNumberThe maximum amount of gas that this block was permitted to use.
tostringThe address of the target.
valueBigNumberThe amount (in wei) this transaction is sending.
datastringTransaction data.
accessListAccessListThe AccessList to include; only available for EIP-2930 and EIP-1559 transactions.
hashstringTransaction hash.
vnumberValues for the transaction's signature.
rstringValues for the transaction's signature.
sstringValues for the transaction's signature.
fromstringThe sender address of the transaction.
confirmationsnumberThe number of blocks that have been mined (including the initial block) since this transaction.

Example

const auctionId = '1'
const price = '123'
await marketplaceSdk.bid(auctionId, price, buyer)

claimAuctionNft

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.

Parameter

ArgumentTypeDescription
auctionIdstringThe id of the auction
signerSignerAn instance to represent the buyer's wallet account.

Response

FieldTypeDescription
typenumberThe EIP-2718 type of this transaction.
chainIdnumberThe id of the network.
noncenumberThe nonce used as part of the proof-of-work to mine this block.
maxPriorityFeePerGasBigNumberThe price (in wei) per unit of gas for this transaction.
maxFeePerGasBigNumberThe 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).
gasPriceBigNumberThe price (in wei) per unit of gas this transaction will pay.
gasLimitBigNumberThe maximum amount of gas that this block was permitted to use.
tostringThe address of the target.
valueBigNumberThe amount (in wei) this transaction is sending.
datastringTransaction data.
accessListAccessListThe AccessList to include; only available for EIP-2930 and EIP-1559 transactions.
hashstringTransaction hash.
vnumberValues for the transaction's signature.
rstringValues for the transaction's signature.
sstringValues for the transaction's signature.
fromstringThe sender address of the transaction.
confirmationsnumberThe number of blocks that have been mined (including the initial block) since this transaction.

Example

const auctionId = '1'
const marketplaceSdk.claimAuctionNft(auctionId, owner)