Class MarketplaceAuction

Handles auction listings

Hierarchy

  • MarketplaceAuction

Constructors

Properties

buyoutListing: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Buyout Auction

      Parameters

      • Rest ...args: [listingId: BigNumberish]

      Returns Promise<TResult>

      Remarks

      Buy a specific direct listing from the marketplace.

      Example

      // The listing ID of the asset you want to buy
      const listingId = 0;

      await contract.auction.buyoutListing(listingId);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [listingId: BigNumberish]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

cancelListing: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Cancel Auction Listing

      Parameters

      • Rest ...args: [listingId: BigNumberish]

      Returns Promise<TResult>

      Remarks

      Cancel an auction listing on the marketplace

      Example

      // The listing ID of the auction listing you want to cancel
      const listingId = "0";

      await contract.auction.cancelListing(listingId);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [listingId: BigNumberish]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

closeListing: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Close the Auction for the buyer or the seller

      Parameters

      • Rest ...args: [listingId: BigNumberish, closeFor?: string]

      Returns Promise<TResult>

      Remarks

      Closes the Auction and executes the sale for the buyer or the seller.

      Example

      // The listing ID of the auction listing you want to close
      const listingId = "0";
      await contract.auction.closeListing(listingId);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [listingId: BigNumberish, closeFor?: string]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

contractWrapper: ContractWrapper<Marketplace>
createListing: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Create Auction

      Parameters

      Returns Promise<TResult>

      Remarks

      Create a new auction where people can bid on an asset.

      Example

      // Data of the auction you want to create
      const auction = {
      // 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 people would have to bid to instantly buy the asset
      buyoutPricePerToken: "10",
      // the minimum bid that will be accepted for the token
      reservePricePerToken: "1.5",
      }

      const tx = await contract.auction.createListing(auction);
      const receipt = tx.receipt; // the transaction receipt
      const id = tx.id; // the id of the newly created listing
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>)
createListingsBatch: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId[]>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

encoder: ContractEncoder<Marketplace>
executeSale: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Execute the Auction Sale

      Parameters

      • Rest ...args: [listingId: BigNumberish]

      Returns Promise<TResult>

      Remarks

      Closes the Auction and executes the sale for both parties.

      Example

      // The listing ID of the auction listing you want to close
      const listingId = "0";
      await contract.auction.executeSale(listingId);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [listingId: BigNumberish]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

makeBid: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Bid On Auction

      Parameters

      • Rest ...args: [listingId: BigNumberish, pricePerToken: string | number]

      Returns Promise<TResult>

      Remarks

      Make a bid on an auction listing

      Example

      // 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 pricePerToken = 1;

      await contract.auction.makeBid(listingId, pricePerToken);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [listingId: BigNumberish, pricePerToken: string | number]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

storage: ThirdwebStorage<IpfsUploadBatchOptions>
updateListing: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Update an Auction listing with new metadata

      Parameters

      Returns Promise<TResult>

  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

Methods

  • returns the minimum bid a user can place to outbid the previous highest bid

    Parameters

    • listingId: BigNumberish

      the listing id of the auction

    Returns Promise<{
        decimals: number;
        displayValue: string;
        name: string;
        symbol: string;
        value: BigNumber;
    }>

  • Get Auction Winner

    Parameters

    • listingId: BigNumberish

    Returns Promise<string>

    Remarks

    Get the winner of the auction after an auction ends.

    Example

    // The listing ID of the auction that closed
    const listingId = 0;

    contract.auction.
    .getWinner(listingId)
    .then((auctionWinner) => console.log(auctionWinner))
    .catch((err) => console.error(err));
  • Get Highest Bid

    Parameters

    • listingId: BigNumberish

    Returns Promise<undefined | Offer>

    Remarks

    Get the current highest bid of an active auction.

    Example

    // The listing ID of the auction that closed
    const listingId = 0;

    contract.auction.
    .getWinningBid(listingId)
    .then((offer) => console.log(offer))
    .catch((err) => console.error(err));

Generated using TypeDoc