Batch Buy NFTs
Buy multiple NFTs in a single transaction.
NFT Swap SDK supports buying multiple NFTs in an a single atomic transaction using 0x v4.
This can be useful if you're building a shopping-cart feature for your users. A user can select multiple NFTs they would like to purchase, and when they are ready to purchase, call the
batchBuyNftsmethod to checkout.
To use the batch fill feature, pass in an array of signed orders the taker would like to fill.
const fillTx = await nftSwap.batchBuyNfts([
revertIfIncomplete: (boolean) Revert the transaction if only some (but not all) of the orders are filled. When set to
truethis is the equivalent of a
fillOrKilltype of order. Defaults to false.
- Example: If only four of five provided orders are filled (the fifth one expired or was filled by someone else previously), this allows you to revert or continue with the transaction.
There are a limitations to be aware of when using the
- Array of signed orders must be either all ERC721s or ERC1155s. They cannot be a mix of [ERC721, ERC1155]. This is a constraint at the smart contract level.
Also, keep in mind this is only for NFT sell orders (i.e. the taker is buying NFTs). As such, only pass the
batchBuyNftsNFT sell orders.