Hook for cancelling active offer.

import { Offer, useCancelOffer } from "@niftyapes/sdk";

Usage

import React from "react";
import { Offer, useCancelOffer } from "@niftyapes/sdk";

interface Props {
  offer: Offer;
}

const CancelOffer: React.FC<Props> = ({ offer }) => {
  const { write } = useCancelOffer({ offer });

  if (offer.status === "ACTIVE") {
    return <button onClick={() => write?.()}>Cancel Offer</button>;
  }

  return null;
};

export default CancelOffer;

Configuration

The hook requires a valid Offer and a signature.

{
  offer: Offer;
}

Return Value

{
  data?: TransactionResponse
  error?: Error
  isError: boolean
  isIdle: boolean
  isLoading: boolean
  isSuccess: boolean
  write: (() => void) | undefined
  status: 'idle' | 'error' | 'loading' | 'success'
}