API and SDK Reference

A hook for seizing asset in the event of a loan default

import { useSeizeAsset } from '@niftyapes/sdk'

Usage

import React from "react";
import { useSeizeAsset } from "@niftyapes/sdk";
import { BigNumber } from "ethers";
import { useWaitForTransaction } from "wagmi";

const UseSeizeAsset: React.FC = () => {
  const { data, write } = useSeizeAsset({
    nftId: BigNumber.from("2"),
    nftContractAddress: "0x5c20670e19e557930fcc76908c500ff870967087",
  });

  const { isError, isLoading, isSuccess } = useWaitForTransaction({
    hash: data?.hash,
  });

  return (
    <div>
      <button onClick={() => write?.()}>Seize Asset</button>
      {isLoading && "Seizing Asset..."}
      {isError && "Error Seizing Asset"}
      {isSuccess && "Asset Seized Successfully"}
    </div>
  );
};

export default UseSeizeAsset;

Return Value

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

Configuration

Requires a valid collection address and a token id

{
  nftContractAddress: Address;
  nftId: BigNumber;
}