Hook for purchasing multiple NFTs with financing.

import { Offer, useBuyWithFinancingBatch } from '@niftyapes/sdk'


import {FC} from 'react'
import {BigNumber} from "ethers";
import {useWaitForTransaction} from 'wagmi'
import {Offer,useBuyWithFinancingBatch} from '@niftyapes/sdk'

const App: FC = () => {

    const offer: Offer = {}; // Valid Offer

    const {data, write} = useBuyWithFinancingBatch({
        financingOffers: [offer],
        offerSignatures: ['0x232'],
        nftIds: [BigNumber.from("1234")]

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

    return (
            <button disabled={!write} onClick={() => write?.()}>
                Buy with Financing
            < /button>
            {isLoading && <div>Buying...</div>}
            {isSuccess && <div>Purchase completed: {JSON.stringify(data)}</div>}
        < /div>
export default App;


Requires a marketplace integration contract address to be added in the NiftyApes Provider, and passed an array of financing offers Offer, an array of signatures and an array of NFT IDs.

  financingOffers: Offer[];
  offerSignatures: `0x${string}`[];
  nftIds: BigNumber[];

Return Value

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