useCreateCollectionOffer

Hook for creating a collection offer.

Import

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

Usage

import { useCreateCollectionOffer } from '@ark-project/react'
import { useAccount } from '@starknet-react/core'

function App({ tokenAddress, startAmount, brokerId, currencyAddress }) {
  const { account } = useAccount()
  const { createCollectionOffer, data, isLoading, isSuccess } =
    useCreateCollectionOffer()

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

Return Type

import { type UseCreateCollectionOfferReturnType } from '@ark-project/react'
  • Name
    createCollectionOffer
    Type
    (params: CreateCollectionOfferParams) => CreateCollectionOfferResult
    Description

    Mutation to create a collection offer. See CreateCollectionOfferParams.

  • Name
    createCollectionOfferAsync
    Type
    (params: CreateCollectionOfferParams) => Promise<CreateCollectionOfferResult>
    Description

    Async mutation to create a collection offer. See CreateCollectionOfferParams.

  • Name
    data
    Type
    CreateCollectionOfferResult
    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

CreateCollectionOfferParameters and CreateCollectionOfferResponse for more details.