Back to Components
|

CreateListingButton

CreateListingButton

Create marketplace listings on the Bitcoin blockchain with customizable forms, image uploads, and rich metadata

🔧

Live preview would be rendered here

Component: CreateListingButton

Install component

npm
$npm install bigblocks
import { CreateListingButton } from 'bigblocks';

export default function Marketplace() {
  const handleListingCreated = (listing: Listing) => {
    console.log('Created listing:', listing);
    console.log('Transaction ID:', listing.txid);
    
    // Navigate to listing detail page
    window.location.href = `/marketplace/listing/${listing.id}`;
  };

  const handleError = (error: MarketError) => {
    console.error('Listing creation failed:', error);
    
    if (error.code === 'INSUFFICIENT_FUNDS') {
      alert(`Need ${error.details?.required} satoshis, but only have ${error.details?.available}`);
    } else {
      alert(error.message);
    }
  };

  return (
    <CreateListingButton
      onCreateListing={handleListingCreated}
      onError={handleError}
    />
  );
}