Class MarketplaceV3EnglishAuctions<TContract>

Handles auctions

Type Parameters

  • TContract extends EnglishAuctionsLogic

Hierarchy

  • MarketplaceV3EnglishAuctions

Implements

  • DetectableFeature

Constructors

Properties

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

Type declaration

    • (...args): Promise<TResult>
    • Buyout an english auction

      Parameters

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

      Returns Promise<TResult>

      the transaction result

      Remarks

      Buy a specific auction from the marketplace.

      Example

      // The auction ID you want to buy
      const auctionId = 0;

      await contract.englishAuctions.buyoutAuction(auctionId);

      Twfeature

      EnglishAuctions

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

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Cancel an english auction

      Parameters

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

      Returns Promise<TResult>

      the transaction result

      Remarks

      Cancel an auction on the marketplace

      Example

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

      await contract.englishAuctions.cancelAuction(auctionId);

      Twfeature

      EnglishAuctions

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

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Close the english auction for the bidder

      Parameters

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

      Returns Promise<TResult>

      the transaction result

      Remarks

      Closes the Auction and executes the sale for the buyer.

      Example

      // The ID of the auction you want to close
      const auction = "0";
      await contract.englishAuctions.closeAuctionForBidder(auctionId);

      Twfeature

      EnglishAuctions

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

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Close the english auction for the seller

      Parameters

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

      Returns Promise<TResult>

      the transaction result

      Remarks

      Closes the Auction and executes the sale for the seller.

      Example

      // The ID of the auction you want to close
      const auctionId = "0";
      await contract.englishAuctions.closeAuctionForSeller(auctionId);

      Twfeature

      EnglishAuctions

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

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Create an english auction

      Parameters

      • Rest ...args: [auction: {
            assetContractAddress: string;
            bidBufferBps?: string | number | bigint | BigNumber;
            buyoutBidAmount: string | number;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            minimumBidAmount: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            timeBufferInSeconds?: string | number | bigint | BigNumber;
            tokenId: Object;
        }]

      Returns Promise<TResult>

      the transaction hash and the auction id

      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 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: "900", // 15 minutes by default
      // A bid must be at least this much bps greater than the current winning bid
      bidBufferBps: "500", // 5% by default
      // 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

      Twfeature

      EnglishAuctions

  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>)
      • (...args): Promise<Transaction<TransactionResultWithId>>
      • Parameters

        • Rest ...args: [auction: {
              assetContractAddress: string;
              bidBufferBps?: string | number | bigint | BigNumber;
              buyoutBidAmount: string | number;
              currencyContractAddress?: string;
              endTimestamp?: number | Date;
              minimumBidAmount: string | number;
              quantity?: string | number | bigint | BigNumber;
              startTimestamp?: number | Date;
              timeBufferInSeconds?: string | number | bigint | BigNumber;
              tokenId: Object;
          }]

        Returns Promise<Transaction<TransactionResultWithId>>

createAuctionsBatch: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId[]>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Create a batch of new auctions

      Parameters

      • Rest ...args: [listings: {
            assetContractAddress: string;
            bidBufferBps?: string | number | bigint | BigNumber;
            buyoutBidAmount: string | number;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            minimumBidAmount: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            timeBufferInSeconds?: string | number | bigint | BigNumber;
            tokenId: Object;
        }[]]

      Returns Promise<TResult>

      Remarks

      Create a batch of new auctions on the marketplace

      Example

      const auctions = [...];
      const tx = await contract.englishAuctions.createAuctionsBatch(auctions);
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId[]>>)
      • (...args): Promise<Transaction<TransactionResultWithId[]>>
      • Parameters

        • Rest ...args: [listings: {
              assetContractAddress: string;
              bidBufferBps?: string | number | bigint | BigNumber;
              buyoutBidAmount: string | number;
              currencyContractAddress?: string;
              endTimestamp?: number | Date;
              minimumBidAmount: string | number;
              quantity?: string | number | bigint | BigNumber;
              startTimestamp?: number | Date;
              timeBufferInSeconds?: string | number | bigint | BigNumber;
              tokenId: Object;
          }[]]

        Returns Promise<Transaction<TransactionResultWithId[]>>

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

Type declaration

    • (...args): Promise<TResult>
    • Close the english auction for both the seller and the bidder

      Parameters

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

      Returns Promise<TResult>

      the transaction result

      Remarks

      Closes the Auction and executes the sale for both parties.

      Example

      // The ID of the auction you want to close
      const auction = "0";
      await contract.englishAuctions.executeSale(auctionId);

      Twfeature

      EnglishAuctions

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

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

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

featureName: "EnglishAuctions" = FEATURE_ENGLISH_AUCTIONS.name
interceptor: ContractInterceptor<EnglishAuctionsLogic>
makeBid: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Bid on an english auction

      Parameters

      • Rest ...args: [auctionId: BigNumberish, bidAmount: string | number]

      Returns Promise<TResult>

      the transaction result

      Remarks

      Make a bid on an auction

      Example

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

      Twfeature

      EnglishAuctions

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

        • Rest ...args: [auctionId: BigNumberish, bidAmount: string | number]

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

storage: ThirdwebStorage<IpfsUploadBatchOptions>

Methods

  • Get the buffer for an english auction

    Parameters

    • auctionId: BigNumberish

      id of the auction

    Returns Promise<number>

    the buffer in basis points

    Example

    // The ID of the auction you want to get the buffer for
    const auctionId = "0";
    const buffer = await contract.englishAuctions.getBidBufferBps(auctionId);

    Twfeature

    EnglishAuctions

  • Get the minimum next bid for an english auction

    Parameters

    • auctionId: BigNumberish

      id of the auction

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

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

    Example

    // The ID of the auction you want to get the minimum next bid for
    const auctionId = "0";
    const minimumNextBid = await contract.englishAuctions.getMinimumNextBid(auctionId);

    Twfeature

    EnglishAuctions

  • Get the winner for a specific english auction

    Parameters

    • auctionId: BigNumberish

      the auction Id

    Returns Promise<string>

    the address of the auction winner

    Remarks

    Get the winner of the auction after an auction ends.

    Example

    // The auction ID of a closed english auction
    const auctionId = 0;
    const auctionWinner = await contract.englishAuctions.getWinner(auctionId);

    Twfeature

    EnglishAuctions

  • Get winning bid of an english auction

    Parameters

    • auctionId: BigNumberish

      the auction Id

    Returns Promise<undefined | Bid>

    Remarks

    Get the current highest bid of an active auction.

    Example

    // The ID of the auction
    const auctionId = 0;
    const winningBid = await contract.englishAuctions.getWinningBid(auctionId);

    Twfeature

    EnglishAuctions

  • Check if a bid is or will be a winning bid

    Parameters

    • auctionId: BigNumberish

      Auction Id

    • bidAmount: BigNumberish

      Amount to bid

    Returns Promise<boolean>

    true if the bid is or will be a winning bid

    Example

    const auctionId = 0;
    const bidAmount = 100;
    const isWinningBid = await contract.englishAuctions.isWinningBid(auctionId, bidAmount);

    Twfeature

    EnglishAuctions

Generated using TypeDoc