v0.10 - Collection-based orders
Adds Collection-based orders to NFT Swap SDK. (Also can be used as 'floor-based' orders).
🔥 Under 105k gas 🔥
These orders can be filled using any NFT from a particular collection.
The SDK provides a simple API:
// Maker creates an order for any NFT from a collection (you can think of it as a 'bid')
// Specifically in this example, the maker will sell 1000 USDC for any NFT in the collection specified
const v4Erc721Order = nftSwap.buildCollectionBasedOrder(
// Selling ERC20
{
type: "ERC20",
tokenAddress: USDC_TOKEN_ADDRESS,
amount: "100000000000000", // 1000 USDC
},
// Bidding on any NFT in the collection
{
tokenAddress: NFT_CONTRACT_ADDDRESS,
type: "ERC721", // "ERC721" | "ERC1155"
},
makerWalletAddress // Maker wallet address
)
const signedOrder = await nftSwap.signOrder(v4Erc721Order)
// Later, taker can sell an NFT from the specified collection, filling the bid.
const fillTx = await nftSwap.fillSignedCollectionOrder(
signedOrder,
"11045" // Token ID from the collection to fill order with
)
https://docs.swapsdk.xyz/0x-v4/collection-based-floor-based-orders