BuyDirectListingButton

This button is used with thirdweb Marketplace v3 contract, for buying NFT(s) from a listing.

Under the hood, it prepares a transaction using the buyFromListing extension and then pass it to a <TransactionButton />

Since it uses the TransactionButton, it can take in any props that can be passed to the TransactionButton

Example

import { BuyDirectListingButton } from "thirdweb/react";
<BuyDirectListingButton
contractAddress="0x..." // contract address of the marketplace v3
chain={...} // the chain which the marketplace contract is deployed on
client={...} // thirdweb client
listingId={100n} // the listingId or the item you want to buy
quantity={1n} // optional - see the docs to learn more
>
Buy NFT
</BuyDirectListingButton>

For error handling & callbacks on transaction-sent and transaction-confirmed, please refer to the TransactionButton docs.

function BuyDirectListingButton(
): Element;

Parameters

Type

let props: Omit<TransactionButtonProps, "transaction"> & {
chain: Chain;
client: ThirdwebClient;
contractAddress: string;
listingId: bigint;
quantity?: bigint;
};

Returns

let returnType: Element;
<TransactionButton />