useCreateAuction

Hook for creating auction listings.

Import

import { useCreateAuction } from '@ark-project/react'

Usage

import { useCreateAuction } from '@ark-project/react'

function App({ tokenAddress, tokenId, startAmount }) {
  const { createAuction, data, isLoading, isSuccess } = useCreateAuction()

  return (
    <>
      <button
        onClick={async () => {
          await createauction({
            account,
            tokenAddress,
            tokenId,
            startAmount: BigInt(startAmount),
          })
        }}
      >
        Create Listing
      </button>
      {isLoading && <p>Loading...</p>}
      {isSuccess && <div>{data.orderHash}</div>}
    </>
  )
}

Return Type

import { type UseCancelReturnType } from '@ark-project/react'
  • Name
    createAuction
    Type
    (params: CreateAuctionParams) => CreateAuctionResult
    Description

    Mutation to create an auction. See CreateAuctionParams.

  • Name
    cancelAsync
    Type
    (params: CreateAuctionParams) => Promise<CreateAuctionResult>
    Description

    Async mutation to create an auction. See CreateAuctionParams.

  • Name
    data
    Type
    CreateAuctionResult
    Description

    The data returned from the mutation.

Parameters

  • Name
    config (optional)
    Type
    Config | undefined
    Description

    Config to use instead of retrieving from the nearest ArkProvider.

Actions

CreateListingParameters and CreateAuctionResponse for more details.