Class MarketplaceDirect

Handles direct listings

Hierarchy

  • MarketplaceDirect

Constructors

Properties

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

Type declaration

    • (...args): Promise<TResult>
    • Accept an offer on a direct listing

      Parameters

      • Rest ...args: [listingId: BigNumberish, addressOfOfferor: string]

      Returns Promise<TResult>

      Remarks

      Accept an offer on a direct 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 offeror = "0x...";

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

        • Rest ...args: [listingId: BigNumberish, addressOfOfferor: string]

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

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

Type declaration

    • (...args): Promise<TResult>
    • Buy a Listing

      Parameters

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

      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;
      // Quantity of the asset you want to buy
      const quantityDesired = 1;

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

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

        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 Direct Listing

      Parameters

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

      Returns Promise<TResult>

      Remarks

      Cancel a direct listing on the marketplace

      Example

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

      await contract.direct.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">>>

contractWrapper: ContractWrapper<Marketplace>
createListing: {
    prepare: ((...args) => Promise<Transaction<{
        id: BigNumber;
        receipt: TransactionReceipt;
    }>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Create Direct Listing

      Parameters

      Returns Promise<TResult>

      Remarks

      Create a new listing on the marketplace where people can buy an asset directly.

      Example

      // Data of the listing you want to create
      const listing = {
      // 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 the asset will be sold for
      buyoutPricePerToken: "1.5",
      }

      const tx = await contract.direct.createListing(listing);
      const receipt = tx.receipt; // the transaction receipt
      const id = tx.id; // the id of the newly created listing
  • prepare: ((...args) => Promise<Transaction<{
        id: BigNumber;
        receipt: TransactionReceipt;
    }>>)
      • (...args): Promise<Transaction<{
            id: BigNumber;
            receipt: TransactionReceipt;
        }>>
      • Parameters

        Returns Promise<Transaction<{
            id: BigNumber;
            receipt: TransactionReceipt;
        }>>

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

Type declaration

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

Type declaration

    • (...args): Promise<TResult>
    • Make an offer for a Direct Listing

      Parameters

      • Rest ...args: [listingId: BigNumberish, quantityDesired: BigNumberish, currencyContractAddress: string, pricePerToken: string | number, expirationDate?: Date]

      Returns Promise<TResult>

      Remarks

      Make an offer on a direct listing

      Example

      import { ChainId, NATIVE_TOKENS } from "@thirdweb-dev/sdk";

      // The listing ID of the asset you want to offer on
      const listingId = 0;
      // The price you are willing to offer per token
      const pricePerToken = 1;
      // The quantity of tokens you want to receive for this offer
      const quantity = 1;
      // The address of the currency you are making the offer in (must be ERC-20)
      const currencyContractAddress = NATIVE_TOKENS[ChainId.Rinkeby].wrapped.address

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

        • Rest ...args: [listingId: BigNumberish, quantityDesired: BigNumberish, currencyContractAddress: string, pricePerToken: string | number, expirationDate?: Date]

        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 a Direct listing with new metadata.

      Note: cannot update a listing with a new quantity of 0. Use cancelDirectListing to remove a listing instead.

      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

Generated using TypeDoc