Hook for managing the buy modal interface for collectible purchases
useBuyModal
hook:useLowestListing
hook from marketplace-sdk. If there is no lowestListing with the given parameters, it means there is no orderId available, and therefore the item cannot be bought.callbacks
object with the following properties:
Parameter | Type | Description |
---|---|---|
callbacks.onSuccess | ({ hash, orderId }: { hash?: Hash; orderId?: string }) => void | Optional callback function called when the purchase is successful |
callbacks.onError | (error: Error) => void | Optional callback function called when an error occurs during the purchase |
callbacks.successActionButtons | Array<{ label: string; action: () => void }> | Optional array of action buttons to show on success |
(args: BuyModalProps) => void
Opens the buy modal with the specified parameters. The BuyModalProps
can be either ShopBuyModalProps
or MarketplaceBuyModalProps
depending on the purchase type.
For market purchases (Secondary sales):
BuyModalBaseProps
:
() => void
Closes the buy modal.
useBuyModal
hook provides a convenient way to manage the buy modal interface for collectible purchases. It handles: