@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.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicClient } from 'viem';
|
|
2
2
|
import { NetMessage } from '@net-protocol/core';
|
|
3
|
-
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, g as SeaportSubmission, h as SeaportOrderParameters, i as SeaportOrderStatusInfo, j as SeaportOrderStatus } from './types-
|
|
4
|
-
export { l as ConsiderationItem, n as CreateCollectionOfferParams, m as CreateListingParams, I as ItemType, k as OfferItem, O as OrderType } from './types-
|
|
3
|
+
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, g as SeaportSubmission, h as SeaportOrderParameters, i as SeaportOrderStatusInfo, j as SeaportOrderStatus } from './types-5kMf461x.mjs';
|
|
4
|
+
export { l as ConsiderationItem, n as CreateCollectionOfferParams, m as CreateListingParams, I as ItemType, k as OfferItem, O as OrderType } from './types-5kMf461x.mjs';
|
|
5
5
|
import { Seaport } from '@opensea/seaport-js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicClient } from 'viem';
|
|
2
2
|
import { NetMessage } from '@net-protocol/core';
|
|
3
|
-
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, g as SeaportSubmission, h as SeaportOrderParameters, i as SeaportOrderStatusInfo, j as SeaportOrderStatus } from './types-
|
|
4
|
-
export { l as ConsiderationItem, n as CreateCollectionOfferParams, m as CreateListingParams, I as ItemType, k as OfferItem, O as OrderType } from './types-
|
|
3
|
+
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, g as SeaportSubmission, h as SeaportOrderParameters, i as SeaportOrderStatusInfo, j as SeaportOrderStatus } from './types-5kMf461x.js';
|
|
4
|
+
export { l as ConsiderationItem, n as CreateCollectionOfferParams, m as CreateListingParams, I as ItemType, k as OfferItem, O as OrderType } from './types-5kMf461x.js';
|
|
5
5
|
import { Seaport } from '@opensea/seaport-js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1154,7 +1154,7 @@ var BazaarClient = class {
|
|
|
1154
1154
|
const bazaarAddress = getBazaarAddress(this.chainId);
|
|
1155
1155
|
const filter = {
|
|
1156
1156
|
appAddress: bazaarAddress,
|
|
1157
|
-
topic: nftAddress
|
|
1157
|
+
topic: nftAddress?.toLowerCase(),
|
|
1158
1158
|
maker
|
|
1159
1159
|
};
|
|
1160
1160
|
let startIndex;
|
|
@@ -1227,18 +1227,57 @@ var BazaarClient = class {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
const openListings = listings.filter((l) => l.orderStatus === 2 /* OPEN */);
|
|
1229
1229
|
const expiredListings = includeExpired ? listings.filter((l) => l.orderStatus === 1 /* EXPIRED */) : [];
|
|
1230
|
-
|
|
1231
|
-
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1230
|
+
let validOpenListings;
|
|
1232
1231
|
const beforeOwnership = openListings.length;
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1232
|
+
if (nftAddress) {
|
|
1233
|
+
const tokenIds = openListings.map((l) => l.tokenId);
|
|
1234
|
+
const owners = await bulkFetchNftOwners(this.client, nftAddress, tokenIds);
|
|
1235
|
+
validOpenListings = openListings.filter((listing, index) => {
|
|
1236
|
+
const owner = owners[index];
|
|
1237
|
+
return isListingValid(
|
|
1238
|
+
listing.orderStatus,
|
|
1239
|
+
listing.expirationDate,
|
|
1240
|
+
listing.maker,
|
|
1241
|
+
owner
|
|
1242
|
+
);
|
|
1243
|
+
});
|
|
1244
|
+
} else {
|
|
1245
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1246
|
+
for (const listing of openListings) {
|
|
1247
|
+
const key = listing.nftAddress.toLowerCase();
|
|
1248
|
+
const group = groups.get(key);
|
|
1249
|
+
if (group) {
|
|
1250
|
+
group.push(listing);
|
|
1251
|
+
} else {
|
|
1252
|
+
groups.set(key, [listing]);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
const groupEntries = Array.from(groups.entries());
|
|
1256
|
+
const ownerResults = await Promise.all(
|
|
1257
|
+
groupEntries.map(
|
|
1258
|
+
([addr, groupListings]) => bulkFetchNftOwners(
|
|
1259
|
+
this.client,
|
|
1260
|
+
addr,
|
|
1261
|
+
groupListings.map((l) => l.tokenId)
|
|
1262
|
+
)
|
|
1263
|
+
)
|
|
1240
1264
|
);
|
|
1241
|
-
|
|
1265
|
+
validOpenListings = [];
|
|
1266
|
+
groupEntries.forEach(([, groupListings], groupIndex) => {
|
|
1267
|
+
const owners = ownerResults[groupIndex];
|
|
1268
|
+
for (let i = 0; i < groupListings.length; i++) {
|
|
1269
|
+
const listing = groupListings[i];
|
|
1270
|
+
if (isListingValid(
|
|
1271
|
+
listing.orderStatus,
|
|
1272
|
+
listing.expirationDate,
|
|
1273
|
+
listing.maker,
|
|
1274
|
+
owners[i]
|
|
1275
|
+
)) {
|
|
1276
|
+
validOpenListings.push(listing);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1242
1281
|
console.log(tag, `after ownership filter: ${validOpenListings.length}/${beforeOwnership} (${beforeOwnership - validOpenListings.length} dropped)`);
|
|
1243
1282
|
const dedupedOpen = sortListingsByPrice(getBestListingPerToken(validOpenListings));
|
|
1244
1283
|
const activeTokenKeys = new Set(dedupedOpen.map((l) => `${l.nftAddress.toLowerCase()}-${l.tokenId}`));
|