useFulfillListing

Hook for fulfilling listings.

Import

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

Usage

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

function FulfillListing({
  orderHash,
  tokenAddress,
  tokenId,
  brokerId,
  startAmount,
  currencyAddress,
}) {
  const { account } = useAccount()
  const { fulfillListing, status } = useFulfillListing()

  return (
    <>
      <button
        onClick={async () => {
          await fulfillListing({
            starknetAccount: account,
            orderHash,
            tokenAddress,
            tokenId,
            brokerId,
            amount: BigInt(startAmount),
            currencyAddress,
          })
        }}
      >
        Fulfill Listing
      </button>
      <div>Status: {status}</div>
    </>
  )
}

Return Type

import { type useFulfillListingReturnType } from '@ark-project/react'
  • Name
    fulfillListing
    Type
    (params: FulfillListingParams) => FulfillListingResult
    Description

    Mutation to fulfill a listing. See FulfillListingParams.

  • Name
    fulfillListingAsync
    Type
    (params: FulfillListingParams) => Promise<FulfillListingResult>
    Description

    Async mutation to fulfill a listing. See FulfillListingParams.

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

FulfillListingParameters and FulfillListingResponse for more details.