The action hooks are essential for interacting with the Marketplace in your application. Useful for making listings, making offers, and performing buy and sell actions.
The useCreateListingModal hook is used to list an item for sale on the Marketplace. It provides the necessary functionality to create and manage a new listing.
The useBuyModal hook allows users to purchase an NFT that is listed for sale on the Marketplace. It handles the buying process and transaction execution.
Copy
import { useBuyModal } from "@0xsequence/marketplace-sdk/react";## Into your React component:const { show: showBuyModal } = useBuyModal({ onSuccess(hash) { console.log("Buy transaction sent with hash: ", hash); }, onError,});const onClickBuy = () => { showBuyModal({ chainId, collectionAddress, tokenId, order, });};return <button onClick={onClickBuy}>Buy</button>