@net-protocol/bazaar 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +50 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +5 -4
- package/dist/react.d.ts +5 -4
- package/dist/react.js +52 -13
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +52 -13
- package/dist/react.mjs.map +1 -1
- package/dist/{types-BwfAmxpu.d.mts → types-5kMf461x.d.mts} +2 -2
- package/dist/{types-BwfAmxpu.d.ts → types-5kMf461x.d.ts} +2 -2
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -932,7 +932,7 @@ var BazaarClient = class {
|
|
|
932
932
|
const bazaarAddress = getBazaarAddress(this.chainId);
|
|
933
933
|
const filter = {
|
|
934
934
|
appAddress: bazaarAddress,
|
|
935
|
-
topic: nftAddress
|
|
935
|
+
topic: nftAddress?.toLowerCase(),
|
|
936
936
|
maker
|
|
937
937
|
};
|
|
938
938
|
let startIndex;
|
|
@@ -1005,18 +1005,57 @@ var BazaarClient = class {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
const openListings = listings.filter((l) => l.orderStatus === 2 /* OPEN */);
|
|
1007
1007
|
const expiredListings = includeExpired ? listings.filter((l) => l.orderStatus === 1 /* EXPIRED */) : [];
|
|
1008
|
-
|
|
1009
|
-
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1008
|
+
let validOpenListings;
|
|
1010
1009
|
const beforeOwnership = openListings.length;
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1010
|
+
if (nftAddress) {
|
|
1011
|
+
const tokenIds = openListings.map((l) => l.tokenId);
|
|
1012
|
+
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1013
|
+
validOpenListings = openListings.filter((listing, index) => {
|
|
1014
|
+
const owner = owners[index];
|
|
1015
|
+
return isListingValid(
|
|
1016
|
+
listing.orderStatus,
|
|
1017
|
+
listing.expirationDate,
|
|
1018
|
+
listing.maker,
|
|
1019
|
+
owner
|
|
1020
|
+
);
|
|
1021
|
+
});
|
|
1022
|
+
} else {
|
|
1023
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1024
|
+
for (const listing of openListings) {
|
|
1025
|
+
const key = listing.nftAddress.toLowerCase();
|
|
1026
|
+
const group = groups.get(key);
|
|
1027
|
+
if (group) {
|
|
1028
|
+
group.push(listing);
|
|
1029
|
+
} else {
|
|
1030
|
+
groups.set(key, [listing]);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
const groupEntries = Array.from(groups.entries());
|
|
1034
|
+
const ownerResults = await Promise.all(
|
|
1035
|
+
groupEntries.map(
|
|
1036
|
+
([addr, groupListings]) => bulkFetchNftOwners(
|
|
1037
|
+
this.client,
|
|
1038
|
+
addr,
|
|
1039
|
+
groupListings.map((l) => l.tokenId)
|
|
1040
|
+
)
|
|
1041
|
+
)
|
|
1018
1042
|
);
|
|
1019
|
-
|
|
1043
|
+
validOpenListings = [];
|
|
1044
|
+
groupEntries.forEach(([, groupListings], groupIndex) => {
|
|
1045
|
+
const owners = ownerResults[groupIndex];
|
|
1046
|
+
for (let i = 0; i < groupListings.length; i++) {
|
|
1047
|
+
const listing = groupListings[i];
|
|
1048
|
+
if (isListingValid(
|
|
1049
|
+
listing.orderStatus,
|
|
1050
|
+
listing.expirationDate,
|
|
1051
|
+
listing.maker,
|
|
1052
|
+
owners[i]
|
|
1053
|
+
)) {
|
|
1054
|
+
validOpenListings.push(listing);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1020
1059
|
console.log(tag, `after ownership filter: ${validOpenListings.length}/${beforeOwnership} (${beforeOwnership - validOpenListings.length} dropped)`);
|
|
1021
1060
|
const dedupedOpen = sortListingsByPrice(getBestListingPerToken(validOpenListings));
|
|
1022
1061
|
const activeTokenKeys = new Set(dedupedOpen.map((l) => `${l.nftAddress.toLowerCase()}-${l.tokenId}`));
|
|
@@ -1561,7 +1600,7 @@ function useBazaarListings({
|
|
|
1561
1600
|
const filter = useMemo(
|
|
1562
1601
|
() => ({
|
|
1563
1602
|
appAddress: bazaarAddress,
|
|
1564
|
-
topic: nftAddress
|
|
1603
|
+
topic: nftAddress?.toLowerCase(),
|
|
1565
1604
|
maker
|
|
1566
1605
|
}),
|
|
1567
1606
|
[bazaarAddress, nftAddress, maker]
|
|
@@ -1585,7 +1624,7 @@ function useBazaarListings({
|
|
|
1585
1624
|
endIndex,
|
|
1586
1625
|
enabled: enabled && isSupported && (hasRangeOverride || totalCount > 0)
|
|
1587
1626
|
});
|
|
1588
|
-
const TAG = `[useBazaarListings chain=${chainId} nft=${nftAddress
|
|
1627
|
+
const TAG = `[useBazaarListings chain=${chainId} nft=${nftAddress?.slice(0, 10) ?? "all"}]`;
|
|
1589
1628
|
useEffect(() => {
|
|
1590
1629
|
console.log(TAG, {
|
|
1591
1630
|
enabled,
|