Class MarketplaceV3DirectListings<TContract>

Handles direct listings

Type Parameters

  • TContract extends DirectListingsLogic

Hierarchy

  • MarketplaceV3DirectListings

Implements

  • DetectableFeature

Constructors

Properties

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

Type declaration

    • (...args): Promise<TResult>
    • Approve buyer for a reserved direct listing

      Parameters

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

      Returns Promise<TResult>

      Remarks

      Approve a buyer to buy from a reserved listing.

      Example

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

      await contract.directListings.approveBuyerForReservedListing(listingId, "{{wallet_address}}");

      Twfeature

      DirectListings

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

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Approve a currency for a direct listing

      Parameters

      • Rest ...args: [listingId: BigNumberish, currencyContractAddress: string, pricePerTokenInCurrency: BigNumberish]

      Returns Promise<TResult>

      Example

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

      await contract.directListings.approveCurrencyForListing(listingId, currencyContractAddress, pricePerTokenInCurrency);

      Twfeature

      DirectListings

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

        • Rest ...args: [listingId: BigNumberish, currencyContractAddress: string, pricePerTokenInCurrency: BigNumberish]

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

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

Type declaration

    • (...args): Promise<TResult>
    • Buy direct listing for a specific wallet

      Parameters

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

      Returns Promise<TResult>

      Remarks

      Buy from a specific direct listing from the marketplace.

      Example

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

      await contract.directListings.buyFromListing(listingId, quantityDesired, "{{wallet_address}}");

      Twfeature

      DirectListings

  • 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.directListings.cancelListing(listingId);

      Twfeature

      DirectListings

  • 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<DirectListingsLogic>
createListing: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Create new direct listing

      Parameters

      • Rest ...args: [listing: {
            assetContractAddress: string;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            isReservedListing?: boolean;
            pricePerToken: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            tokenId: Object;
        }]

      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",
      // 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,
      // The price to pay per unit of NFTs listed.
      pricePerToken: 1.5,
      // when should the listing open up for offers
      startTimestamp: new Date(Date.now()),
      // how long the listing will be open for
      endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
      // Whether the listing is reserved for a specific set of buyers.
      isReservedListing: false
      }

      const tx = await contract.directListings.createListing(listing);
      const receipt = tx.receipt; // the transaction receipt
      const id = tx.id; // the id of the newly created listing

      Twfeature

      DirectListings

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

        • Rest ...args: [listing: {
              assetContractAddress: string;
              currencyContractAddress?: string;
              endTimestamp?: number | Date;
              isReservedListing?: boolean;
              pricePerToken: string | number;
              quantity?: string | number | bigint | BigNumber;
              startTimestamp?: number | Date;
              tokenId: Object;
          }]

        Returns Promise<Transaction<TransactionResultWithId>>

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

Type declaration

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

      Parameters

      • Rest ...args: [listings: {
            assetContractAddress: string;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            isReservedListing?: boolean;
            pricePerToken: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            tokenId: Object;
        }[]]

      Returns Promise<TResult>

      Remarks

      Create a batch of new listings on the marketplace

      Example

      const listings = [...];
      const tx = await contract.directListings.createListingsBatch(listings);
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId[]>>)
      • (...args): Promise<Transaction<TransactionResultWithId[]>>
      • Parameters

        • Rest ...args: [listings: {
              assetContractAddress: string;
              currencyContractAddress?: string;
              endTimestamp?: number | Date;
              isReservedListing?: boolean;
              pricePerToken: string | number;
              quantity?: string | number | bigint | BigNumber;
              startTimestamp?: number | Date;
              tokenId: Object;
          }[]]

        Returns Promise<Transaction<TransactionResultWithId[]>>

encoder: ContractEncoder<DirectListingsLogic>
estimator: GasCostEstimator<DirectListingsLogic>
events: ContractEvents<DirectListingsLogic>
featureName: "DirectListings" = FEATURE_DIRECT_LISTINGS.name
interceptor: ContractInterceptor<DirectListingsLogic>
revokeBuyerApprovalForReservedListing: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Revoke approval of a buyer for a reserved direct listing

      Parameters

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

      Returns Promise<TResult>

      Example

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

      await contract.directListings.revokeBuyerApprovalForReservedListing(listingId, "{{wallet_address}}");
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

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

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

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

Type declaration

    • (...args): Promise<TResult>
    • Revoke approval of a currency for a direct listing

      Parameters

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

      Returns Promise<TResult>

      Example

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

      await contract.directListings.revokeCurrencyApprovalForListing(listingId, currencyContractAddress);

      Twfeature

      DirectListings

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

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

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

storage: ThirdwebStorage<IpfsUploadBatchOptions>
updateListing: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Update a direct listing

      Parameters

      • Rest ...args: [listingId: BigNumberish, listing: {
            assetContractAddress: string;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            isReservedListing?: boolean;
            pricePerToken: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            tokenId: Object;
        }]

      Returns Promise<TResult>

      Example

      // Data of the listing you want to update

      const listingId = 0; // ID of the listing you want to update

      const listing = {
      // address of the contract the asset you want to list is on
      assetContractAddress: "0x...", // should be same as original listing
      // token ID of the asset you want to list
      tokenId: "0", // should be same as original listing
      // 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,
      // The price to pay per unit of NFTs listed.
      pricePerToken: 1.5,
      // when should the listing open up for offers
      startTimestamp: new Date(Date.now()), // can't change this if listing already active
      // how long the listing will be open for
      endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
      // Whether the listing is reserved for a specific set of buyers.
      isReservedListing: false
      }

      const tx = await contract.directListings.updateListing(listingId, listing);
      const receipt = tx.receipt; // the transaction receipt
      const id = tx.id; // the id of the newly created listing

      Twfeature

      DirectListings

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

        • Rest ...args: [listingId: BigNumberish, listing: {
              assetContractAddress: string;
              currencyContractAddress?: string;
              endTimestamp?: number | Date;
              isReservedListing?: boolean;
              pricePerToken: string | number;
              quantity?: string | number | bigint | BigNumber;
              startTimestamp?: number | Date;
              tokenId: Object;
          }]

        Returns Promise<Transaction<TransactionResultWithId>>

Methods

  • Check price per token for an approved currency

    Parameters

    • listingId: BigNumberish

      the listing id

    • currencyContractAddress: string

      currency contract address

    Returns Promise<BigNumberish>

    Example

    const listingId = 0;
    const currencyContractAddress = '0x1234';
    const price = await contract.directListings.currencyPriceForListing(listingId, currencyContractAddress);

    Twfeature

    DirectListings

  • Check if a buyer is approved for a specific direct listing

    Parameters

    • listingId: BigNumberish
    • buyer: string

    Returns Promise<boolean>

    Example

    const listingId = 0;
    const isBuyerApproved = await contract.directListings.isBuyerApprovedForListing(listingId, "{{wallet_address}}");

    @param listingId - the listing id
    @param buyer - buyer address
    @twfeature DirectListings
  • Check if a currency is approved for a specific direct listing

    Parameters

    • listingId: BigNumberish

      the listing id

    • currency: string

      currency address

    Returns Promise<boolean>

    Example

    const listingId = 0;
    const currencyContractAddress = '0x1234';
    const isApproved = await contract.directListings.isCurrencyApprovedForListing(listingId, currencyContractAddress);

    Twfeature

    DirectListings

Generated using TypeDoc