useFulfillCollectionOffer

Hook for fulfilling collection offers.

Import

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

Usage

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

const FulfillOfferComponent = ({
  starknetAccount,
  orderHash,
  tokenAddress,
  tokenId,
  brokerId,
}) => {
  const { fulfillCollectionOffer, status } = useFulfillCollectionOffer()

  return (
    <div>
      <button
        onClick={() => {
          fulfillCollectionOffer({
            starknetAccount: starknetAccount,
            fulfillOfferInfo: {
              orderHash: '0x...',
              tokenAddress: '0x...',
              tokenId: BigInt(1),
              brokerId: '0x...',
            },
            approveInfo: {
              tokenAddress: '0x...',
              tokenId: BigInt(1),
            },
          })
        }}
      >
        Fulfill Offer
      </button>
      <div>Status: {status}</div>
    </div>
  )
}

Return Type

fulfillCollectionOffer

(variables: FulfillCollectionOfferParameters) => void

The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.

  • variables

    FulfillCollectionOfferParameters

    The variables object to pass to the fulfillCollectionOffer action.

status

'idle' | 'loading' | 'success' | 'error'

  • idle if the mutation has not been executed yet.
  • loading if the mutation is currently executing.
  • error if the last mutation attempt resulted in an error.
  • success if the last mutation attempt was successful.

Actions

FulfillCollectionOfferParameters and FulfillCollectionOfferResponse for more details.