ProjectOpenSea/seaport

【Criteria-based orders】how to fufill criteria-based order when i want to buy two or more tokenid from merkletree ?

bwhour opened this issue · 5 comments

bwhour commented
image

Hi, seaport-team, if i want to buy the two tokenids in criteria-based order in one fullfillAdvancedOrder, how should i write the paramter ? when i wrote like this, it revert with _revertCriteriaNotEnabledForItem

*it("Criteria-based offer item ERC721 (standard)", async () => {
// Seller mints nfts
const [nftId, secondNFTId, thirdNFTId] = await mint721s(seller, 3);

  const tokenIds = [nftId, secondNFTId, thirdNFTId];

  // Seller approves marketplace contract to transfer NFTs
  await set721ApprovalForAll(seller, marketplaceContract.address, true);

  const { root, proofs } = merkleTree(tokenIds);
  console.log("merkleRoot : " + root);
  const offer = [getTestItem721WithCriteria(root, toBN(2), toBN(2))];

  const consideration = [
    getItemETH(parseEther("10"), parseEther("10"), seller.address),
    getItemETH(parseEther("1"), parseEther("1"), zone.address),
    getItemETH(parseEther("1"), parseEther("1"), owner.address),
  ];

  const criteriaResolvers = [
    buildResolver(0, 0, 0, secondNFTId, proofs[secondNFTId.toString()]),
    buildResolver(0, 0, 0, thirdNFTId, proofs[thirdNFTId.toString()]),
  ];*
bwhour commented

the criteriaResolvers with one buildResolver, it works. but i want to buy secondNFTId and thirdNFTId , how to fill them ?

ryanio commented

you have to increment orderIndex

bwhour commented

increment

orderIndex is related to offer Items, currently there is only one offer. the orderIndex should be zero.

ryanio commented

oh only one order? ok then you have to increment the item index in the resolver

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.