Hooks
useERC1155SaleContractCheckout
Hook for managing the ERC-1155 sale contract checkout
Import
Usage
Return Type: UseERC1155SaleContractCheckoutReturnType
The hook returns an object with the following properties:
Properties
openCheckoutModal
() => void
Function to open the checkout modal with the configured ERC-1155 purchase.
closeCheckoutModal
() => void
Function to close the checkout modal.
selectPaymentSettings
SelectPaymentSettings | undefined
The current payment settings configuration for the modal.
isLoading
boolean
Whether the contract data is still loading.
isError
boolean
Whether there was an error loading the contract data.
Parameters
The hook accepts a configuration object with the following properties:
Parameter | Type | Description |
---|---|---|
chain | number | Chain ID where the sale contract is deployed |
contractAddress | string | Address of the ERC-1155 sale contract |
wallet | string | Address of the wallet that will receive the NFTs |
collectionAddress | string | Address of the ERC-1155 token contract |
items | Array<{tokenId: string, quantity: string}> | Array of token IDs and quantities to purchase |
onSuccess | (txnHash: string) => void | (Optional) Callback function when the transaction is successful |
onError | (error: Error) => void | (Optional) Callback function when an error occurs |
onClose | () => void | (Optional) Callback function when the modal is closed |
Notes
This hook simplifies the process of purchasing ERC-1155 tokens by automatically:
- Fetching price information from the sale contract
- Determining payment options (crypto, credit card, etc.)
- Generating the proper transaction data
- Opening and managing the checkout modal
Deprecation Notice
The useERC1155SaleContractPaymentModal
hook is deprecated. Use useERC1155SaleContractCheckout
instead.
Was this page helpful?