@net-protocol/bazaar 0.1.1 → 0.1.2
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 +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +45 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -32
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.js +80 -55
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +80 -55
- package/dist/react.mjs.map +1 -1
- package/dist/{types--4_RIuQ5.d.mts → types-KQgBECzI.d.mts} +14 -0
- package/dist/{types--4_RIuQ5.d.ts → types-KQgBECzI.d.ts} +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -361,6 +361,7 @@ var ERC721_OWNER_OF_HELPER_ADDRESS = "0x000000aa4eFa2e5A4a6002C7F08B6e8Ec8cf1dDa
|
|
|
361
361
|
var ERC20_BULK_BALANCE_CHECKER_ADDRESS = "0x000000b50a9f2923f2db931391824f6d1278f712";
|
|
362
362
|
var NET_SEAPORT_ZONE_ADDRESS = "0x000000007F8c58fbf215bF91Bda7421A806cf3ae";
|
|
363
363
|
var NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS = "0x000000B799ec6D7aCC1B578f62bFc324c25DFC5A";
|
|
364
|
+
var NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS = "0x000000bC63761cbb05305632212e2f3AE2BE7a9B";
|
|
364
365
|
var BAZAAR_CHAIN_CONFIGS = {
|
|
365
366
|
// Base Mainnet
|
|
366
367
|
8453: {
|
|
@@ -786,6 +787,7 @@ function parseListingFromMessage(message, chainId) {
|
|
|
786
787
|
}
|
|
787
788
|
const priceWei = getTotalConsiderationAmount(parameters);
|
|
788
789
|
const tokenId = offerItem.identifierOrCriteria.toString();
|
|
790
|
+
const targetFulfiller = parameters.zone.toLowerCase() === NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS.toLowerCase() && parameters.zoneHash !== "0x0000000000000000000000000000000000000000000000000000000000000000" ? parameters.zoneHash : void 0;
|
|
789
791
|
return {
|
|
790
792
|
maker: parameters.offerer,
|
|
791
793
|
nftAddress: offerItem.token,
|
|
@@ -802,7 +804,8 @@ function parseListingFromMessage(message, chainId) {
|
|
|
802
804
|
orderComponents: {
|
|
803
805
|
...parameters,
|
|
804
806
|
counter: submission.counter
|
|
805
|
-
}
|
|
807
|
+
},
|
|
808
|
+
targetFulfiller
|
|
806
809
|
};
|
|
807
810
|
} catch {
|
|
808
811
|
return null;
|
|
@@ -1048,25 +1051,30 @@ var BazaarClient = class {
|
|
|
1048
1051
|
* Results are deduplicated (one per token) and sorted by price (lowest first)
|
|
1049
1052
|
*/
|
|
1050
1053
|
async getListings(options) {
|
|
1051
|
-
const { nftAddress, excludeMaker, maxMessages = 200 } = options;
|
|
1054
|
+
const { nftAddress, excludeMaker, maker, maxMessages = 200 } = options;
|
|
1052
1055
|
const bazaarAddress = getBazaarAddress(this.chainId);
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1056
|
+
const filter = {
|
|
1057
|
+
appAddress: bazaarAddress,
|
|
1058
|
+
topic: nftAddress.toLowerCase(),
|
|
1059
|
+
maker
|
|
1060
|
+
};
|
|
1061
|
+
let startIndex;
|
|
1062
|
+
let endIndex;
|
|
1063
|
+
if (options.startIndex != null && options.endIndex != null) {
|
|
1064
|
+
startIndex = options.startIndex;
|
|
1065
|
+
endIndex = options.endIndex;
|
|
1066
|
+
} else {
|
|
1067
|
+
const count = await this.netClient.getMessageCount({ filter });
|
|
1068
|
+
if (count === 0) {
|
|
1069
|
+
return [];
|
|
1057
1070
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
return [];
|
|
1071
|
+
startIndex = Math.max(0, count - maxMessages);
|
|
1072
|
+
endIndex = count;
|
|
1061
1073
|
}
|
|
1062
|
-
const startIndex = Math.max(0, count - maxMessages);
|
|
1063
1074
|
const messages = await this.netClient.getMessages({
|
|
1064
|
-
filter
|
|
1065
|
-
appAddress: bazaarAddress,
|
|
1066
|
-
topic: nftAddress.toLowerCase()
|
|
1067
|
-
},
|
|
1075
|
+
filter,
|
|
1068
1076
|
startIndex,
|
|
1069
|
-
endIndex
|
|
1077
|
+
endIndex
|
|
1070
1078
|
});
|
|
1071
1079
|
let listings = [];
|
|
1072
1080
|
for (const message of messages) {
|
|
@@ -1299,25 +1307,30 @@ var BazaarClient = class {
|
|
|
1299
1307
|
* all valid listings are returned (grouped by maker in the UI).
|
|
1300
1308
|
*/
|
|
1301
1309
|
async getErc20Listings(options) {
|
|
1302
|
-
const { tokenAddress, excludeMaker, maxMessages = 200 } = options;
|
|
1310
|
+
const { tokenAddress, excludeMaker, maker, maxMessages = 200 } = options;
|
|
1303
1311
|
const erc20BazaarAddress = getErc20BazaarAddress(this.chainId);
|
|
1304
|
-
const
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1312
|
+
const filter = {
|
|
1313
|
+
appAddress: erc20BazaarAddress,
|
|
1314
|
+
topic: tokenAddress.toLowerCase(),
|
|
1315
|
+
maker
|
|
1316
|
+
};
|
|
1317
|
+
let startIndex;
|
|
1318
|
+
let endIndex;
|
|
1319
|
+
if (options.startIndex != null && options.endIndex != null) {
|
|
1320
|
+
startIndex = options.startIndex;
|
|
1321
|
+
endIndex = options.endIndex;
|
|
1322
|
+
} else {
|
|
1323
|
+
const count = await this.netClient.getMessageCount({ filter });
|
|
1324
|
+
if (count === 0) {
|
|
1325
|
+
return [];
|
|
1308
1326
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
return [];
|
|
1327
|
+
startIndex = Math.max(0, count - maxMessages);
|
|
1328
|
+
endIndex = count;
|
|
1312
1329
|
}
|
|
1313
|
-
const startIndex = Math.max(0, count - maxMessages);
|
|
1314
1330
|
const messages = await this.netClient.getMessages({
|
|
1315
|
-
filter
|
|
1316
|
-
appAddress: erc20BazaarAddress,
|
|
1317
|
-
topic: tokenAddress.toLowerCase()
|
|
1318
|
-
},
|
|
1331
|
+
filter,
|
|
1319
1332
|
startIndex,
|
|
1320
|
-
endIndex
|
|
1333
|
+
endIndex
|
|
1321
1334
|
});
|
|
1322
1335
|
let listings = [];
|
|
1323
1336
|
for (const message of messages) {
|
|
@@ -1354,8 +1367,8 @@ var BazaarClient = class {
|
|
|
1354
1367
|
const uniqueMakers = [...new Set(listings.map((l) => l.maker))];
|
|
1355
1368
|
const balances = await bulkFetchErc20Balances(this.client, tokenAddress, uniqueMakers);
|
|
1356
1369
|
const balanceMap = /* @__PURE__ */ new Map();
|
|
1357
|
-
uniqueMakers.forEach((
|
|
1358
|
-
balanceMap.set(
|
|
1370
|
+
uniqueMakers.forEach((maker2, index) => {
|
|
1371
|
+
balanceMap.set(maker2.toLowerCase(), balances[index]);
|
|
1359
1372
|
});
|
|
1360
1373
|
listings = listings.filter((listing) => {
|
|
1361
1374
|
const balance = balanceMap.get(listing.maker.toLowerCase()) || BigInt(0);
|
|
@@ -1483,6 +1496,6 @@ var BazaarClient = class {
|
|
|
1483
1496
|
}
|
|
1484
1497
|
};
|
|
1485
1498
|
|
|
1486
|
-
export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, BazaarClient, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, ItemType, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, OrderType, SEAPORT_CANCEL_ABI, SeaportOrderStatus, bulkFetchErc20Balances, bulkFetchNftOwners, bulkFetchOrderStatuses, computeOrderHash, createBalanceMap, createOrderStatusMap, createOwnershipMap, createSeaportInstance, decodeSeaportSubmission, formatPrice, getBazaarAddress, getBazaarChainConfig, getBazaarSupportedChainIds, getBestCollectionOffer, getBestListingPerToken, getCollectionOffersAddress, getCurrencySymbol, getErc20BazaarAddress, getErc20OffersAddress, getFeeCollectorAddress, getHighEthAddress, getNftFeeBps, getOrderStatusFromInfo, getSeaportAddress, getSeaportOrderFromMessageData, getTotalConsiderationAmount, getWrappedNativeCurrency, isBazaarSupportedOnChain, isCollectionOfferValid, isErc20ListingValid, isErc20OfferValid, isListingValid, parseCollectionOfferFromMessage, parseErc20ListingFromMessage, parseErc20OfferFromMessage, parseListingFromMessage, sortErc20ListingsByPricePerToken, sortErc20OffersByPricePerToken, sortListingsByPrice, sortOffersByPrice };
|
|
1499
|
+
export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, BazaarClient, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, ItemType, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, OrderType, SEAPORT_CANCEL_ABI, SeaportOrderStatus, bulkFetchErc20Balances, bulkFetchNftOwners, bulkFetchOrderStatuses, computeOrderHash, createBalanceMap, createOrderStatusMap, createOwnershipMap, createSeaportInstance, decodeSeaportSubmission, formatPrice, getBazaarAddress, getBazaarChainConfig, getBazaarSupportedChainIds, getBestCollectionOffer, getBestListingPerToken, getCollectionOffersAddress, getCurrencySymbol, getErc20BazaarAddress, getErc20OffersAddress, getFeeCollectorAddress, getHighEthAddress, getNftFeeBps, getOrderStatusFromInfo, getSeaportAddress, getSeaportOrderFromMessageData, getTotalConsiderationAmount, getWrappedNativeCurrency, isBazaarSupportedOnChain, isCollectionOfferValid, isErc20ListingValid, isErc20OfferValid, isListingValid, parseCollectionOfferFromMessage, parseErc20ListingFromMessage, parseErc20OfferFromMessage, parseListingFromMessage, sortErc20ListingsByPricePerToken, sortErc20OffersByPricePerToken, sortListingsByPrice, sortOffersByPrice };
|
|
1487
1500
|
//# sourceMappingURL=index.mjs.map
|
|
1488
1501
|
//# sourceMappingURL=index.mjs.map
|