@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/index.mjs
CHANGED
|
@@ -1152,7 +1152,7 @@ var BazaarClient = class {
|
|
|
1152
1152
|
const bazaarAddress = getBazaarAddress(this.chainId);
|
|
1153
1153
|
const filter = {
|
|
1154
1154
|
appAddress: bazaarAddress,
|
|
1155
|
-
topic: nftAddress
|
|
1155
|
+
topic: nftAddress?.toLowerCase(),
|
|
1156
1156
|
maker
|
|
1157
1157
|
};
|
|
1158
1158
|
let startIndex;
|
|
@@ -1225,18 +1225,57 @@ var BazaarClient = class {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
const openListings = listings.filter((l) => l.orderStatus === 2 /* OPEN */);
|
|
1227
1227
|
const expiredListings = includeExpired ? listings.filter((l) => l.orderStatus === 1 /* EXPIRED */) : [];
|
|
1228
|
-
|
|
1229
|
-
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1228
|
+
let validOpenListings;
|
|
1230
1229
|
const beforeOwnership = openListings.length;
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1230
|
+
if (nftAddress) {
|
|
1231
|
+
const tokenIds = openListings.map((l) => l.tokenId);
|
|
1232
|
+
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1233
|
+
validOpenListings = openListings.filter((listing, index) => {
|
|
1234
|
+
const owner = owners[index];
|
|
1235
|
+
return isListingValid(
|
|
1236
|
+
listing.orderStatus,
|
|
1237
|
+
listing.expirationDate,
|
|
1238
|
+
listing.maker,
|
|
1239
|
+
owner
|
|
1240
|
+
);
|
|
1241
|
+
});
|
|
1242
|
+
} else {
|
|
1243
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1244
|
+
for (const listing of openListings) {
|
|
1245
|
+
const key = listing.nftAddress.toLowerCase();
|
|
1246
|
+
const group = groups.get(key);
|
|
1247
|
+
if (group) {
|
|
1248
|
+
group.push(listing);
|
|
1249
|
+
} else {
|
|
1250
|
+
groups.set(key, [listing]);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
const groupEntries = Array.from(groups.entries());
|
|
1254
|
+
const ownerResults = await Promise.all(
|
|
1255
|
+
groupEntries.map(
|
|
1256
|
+
([addr, groupListings]) => bulkFetchNftOwners(
|
|
1257
|
+
this.client,
|
|
1258
|
+
addr,
|
|
1259
|
+
groupListings.map((l) => l.tokenId)
|
|
1260
|
+
)
|
|
1261
|
+
)
|
|
1238
1262
|
);
|
|
1239
|
-
|
|
1263
|
+
validOpenListings = [];
|
|
1264
|
+
groupEntries.forEach(([, groupListings], groupIndex) => {
|
|
1265
|
+
const owners = ownerResults[groupIndex];
|
|
1266
|
+
for (let i = 0; i < groupListings.length; i++) {
|
|
1267
|
+
const listing = groupListings[i];
|
|
1268
|
+
if (isListingValid(
|
|
1269
|
+
listing.orderStatus,
|
|
1270
|
+
listing.expirationDate,
|
|
1271
|
+
listing.maker,
|
|
1272
|
+
owners[i]
|
|
1273
|
+
)) {
|
|
1274
|
+
validOpenListings.push(listing);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1240
1279
|
console.log(tag, `after ownership filter: ${validOpenListings.length}/${beforeOwnership} (${beforeOwnership - validOpenListings.length} dropped)`);
|
|
1241
1280
|
const dedupedOpen = sortListingsByPrice(getBestListingPerToken(validOpenListings));
|
|
1242
1281
|
const activeTokenKeys = new Set(dedupedOpen.map((l) => `${l.nftAddress.toLowerCase()}-${l.tokenId}`));
|