Fulfilling an order

Fulfilling an order is the process of allowing a buyer to purchase an NFT that is listed for sale, or accepting a trade offer from another user.

Fulfill a listing

import { useFulfillOrder } from '@cranetech/sdk'

// Pass in the listed NFT
export const FulfillOrderButton = ({ nftData }) => {
  const fulfillOrder = useCreateSellOrder()

  const fulfillERC721Order = async () => {
    const { order, isPending, isSuccess, isError } = await fulfillOrder({
      tokenAddress: nftData.tokenAddress,
      tokenId: nftData.tokenId,
    })
  }

  return (
    <div>
      <button onClick={fulfillERC721Order}>Fulfill ERC721 Listing</button>
    </div>
  )
}

Return Value

Return Value

{
	txn: ContractTransaction, // Ethers object with transaction hash
	isSuccess: boolean,
	isPending: boolean,
	isError:boolean,
	error: Error,
}