Hooks
useCreateBid

useCreateBid

Hook for participating in an auction.

import { useCreateBid } from '@public-assembly/builder-utils'

Usage

import { useCreateBid } from '@public-assembly/builder-utils'
 
function App({ bidAmount }: { bidAmount: string }) {
  const { createBid, createBidLoading, createBidSuccess } = useCreateBid({
    bidAmount: bidAmount,
  })
 
  return (
    <>
      <button onClick={() => createBid?.()}>Create bid</button>
      <p>Bid successful?: {createBidSuccess}</p>
      <p>Bid error?: {createBidError}</p>
      <p>Bid loading?: {createBidLoading}</p>
      <p>Bid transaction: {createBidTx}</p>
    </>
  )
}

Returns

{
  createBid: (() => void) | undefined
  createBidSuccess: boolean
  createBidError: boolean
  createBidLoading: boolean
  createBidTx: : TransactionReceipt<bigint, number, "success" | "reverted", TransactionType> | undefined
}