@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 CHANGED
@@ -1,5 +1,5 @@
1
- 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, W as WriteTransactionConfig, S as SeaportOrderComponents, e as SeaportSubmission, f as SeaportOrderParameters, g as SeaportOrderStatusInfo, h as SeaportOrderStatus } from './types--4_RIuQ5.mjs';
2
- export { j as ConsiderationItem, l as CreateCollectionOfferParams, k as CreateListingParams, I as ItemType, i as OfferItem, O as OrderType } from './types--4_RIuQ5.mjs';
1
+ 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, W as WriteTransactionConfig, S as SeaportOrderComponents, e as SeaportSubmission, f as SeaportOrderParameters, g as SeaportOrderStatusInfo, h as SeaportOrderStatus } from './types-KQgBECzI.mjs';
2
+ export { j as ConsiderationItem, l as CreateCollectionOfferParams, k as CreateListingParams, I as ItemType, i as OfferItem, O as OrderType } from './types-KQgBECzI.mjs';
3
3
  import { Seaport } from '@opensea/seaport-js';
4
4
  import { PublicClient } from 'viem';
5
5
  import { NetMessage } from '@net-protocol/core';
@@ -159,6 +159,7 @@ declare const ERC721_OWNER_OF_HELPER_ADDRESS: "0x000000aa4eFa2e5A4a6002C7F08B6e8
159
159
  declare const ERC20_BULK_BALANCE_CHECKER_ADDRESS: "0x000000b50a9f2923f2db931391824f6d1278f712";
160
160
  declare const NET_SEAPORT_ZONE_ADDRESS: "0x000000007F8c58fbf215bF91Bda7421A806cf3ae";
161
161
  declare const NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS: "0x000000B799ec6D7aCC1B578f62bFc324c25DFC5A";
162
+ declare const NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS: "0x000000bC63761cbb05305632212e2f3AE2BE7a9B";
162
163
  /**
163
164
  * Get bazaar configuration for a chain
164
165
  */
@@ -966,4 +967,4 @@ declare function parseErc20ListingFromMessage(message: NetMessage, chainId: numb
966
967
  */
967
968
  declare function sortErc20ListingsByPricePerToken(listings: Erc20Listing[]): Erc20Listing[];
968
969
 
969
- export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, type BazaarChainConfig, BazaarClient, CollectionOffer, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, Erc20Listing, Erc20Offer, GetCollectionOffersOptions, GetErc20ListingsOptions, GetErc20OffersOptions, GetListingsOptions, Listing, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, SEAPORT_CANCEL_ABI, SeaportOrderComponents, SeaportOrderParameters, SeaportOrderStatus, SeaportOrderStatusInfo, SeaportSubmission, type WrappedNativeCurrency, WriteTransactionConfig, 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 };
970
+ export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, type BazaarChainConfig, BazaarClient, CollectionOffer, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, Erc20Listing, Erc20Offer, GetCollectionOffersOptions, GetErc20ListingsOptions, GetErc20OffersOptions, GetListingsOptions, Listing, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, SEAPORT_CANCEL_ABI, SeaportOrderComponents, SeaportOrderParameters, SeaportOrderStatus, SeaportOrderStatusInfo, SeaportSubmission, type WrappedNativeCurrency, WriteTransactionConfig, 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- 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, W as WriteTransactionConfig, S as SeaportOrderComponents, e as SeaportSubmission, f as SeaportOrderParameters, g as SeaportOrderStatusInfo, h as SeaportOrderStatus } from './types--4_RIuQ5.js';
2
- export { j as ConsiderationItem, l as CreateCollectionOfferParams, k as CreateListingParams, I as ItemType, i as OfferItem, O as OrderType } from './types--4_RIuQ5.js';
1
+ 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, W as WriteTransactionConfig, S as SeaportOrderComponents, e as SeaportSubmission, f as SeaportOrderParameters, g as SeaportOrderStatusInfo, h as SeaportOrderStatus } from './types-KQgBECzI.js';
2
+ export { j as ConsiderationItem, l as CreateCollectionOfferParams, k as CreateListingParams, I as ItemType, i as OfferItem, O as OrderType } from './types-KQgBECzI.js';
3
3
  import { Seaport } from '@opensea/seaport-js';
4
4
  import { PublicClient } from 'viem';
5
5
  import { NetMessage } from '@net-protocol/core';
@@ -159,6 +159,7 @@ declare const ERC721_OWNER_OF_HELPER_ADDRESS: "0x000000aa4eFa2e5A4a6002C7F08B6e8
159
159
  declare const ERC20_BULK_BALANCE_CHECKER_ADDRESS: "0x000000b50a9f2923f2db931391824f6d1278f712";
160
160
  declare const NET_SEAPORT_ZONE_ADDRESS: "0x000000007F8c58fbf215bF91Bda7421A806cf3ae";
161
161
  declare const NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS: "0x000000B799ec6D7aCC1B578f62bFc324c25DFC5A";
162
+ declare const NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS: "0x000000bC63761cbb05305632212e2f3AE2BE7a9B";
162
163
  /**
163
164
  * Get bazaar configuration for a chain
164
165
  */
@@ -966,4 +967,4 @@ declare function parseErc20ListingFromMessage(message: NetMessage, chainId: numb
966
967
  */
967
968
  declare function sortErc20ListingsByPricePerToken(listings: Erc20Listing[]): Erc20Listing[];
968
969
 
969
- export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, type BazaarChainConfig, BazaarClient, CollectionOffer, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, Erc20Listing, Erc20Offer, GetCollectionOffersOptions, GetErc20ListingsOptions, GetErc20OffersOptions, GetListingsOptions, Listing, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, SEAPORT_CANCEL_ABI, SeaportOrderComponents, SeaportOrderParameters, SeaportOrderStatus, SeaportOrderStatusInfo, SeaportSubmission, type WrappedNativeCurrency, WriteTransactionConfig, 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 };
970
+ export { BAZAAR_COLLECTION_OFFERS_ABI, BAZAAR_SUBMISSION_ABI, BAZAAR_V2_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ABI, BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS, type BazaarChainConfig, BazaarClient, CollectionOffer, ERC20_BULK_BALANCE_CHECKER_ABI, ERC20_BULK_BALANCE_CHECKER_ADDRESS, ERC721_OWNER_OF_HELPER_ABI, ERC721_OWNER_OF_HELPER_ADDRESS, Erc20Listing, Erc20Offer, GetCollectionOffersOptions, GetErc20ListingsOptions, GetErc20OffersOptions, GetListingsOptions, Listing, NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS, NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS, NET_SEAPORT_ZONE_ADDRESS, SEAPORT_CANCEL_ABI, SeaportOrderComponents, SeaportOrderParameters, SeaportOrderStatus, SeaportOrderStatusInfo, SeaportSubmission, type WrappedNativeCurrency, WriteTransactionConfig, 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 };
package/dist/index.js CHANGED
@@ -363,6 +363,7 @@ var ERC721_OWNER_OF_HELPER_ADDRESS = "0x000000aa4eFa2e5A4a6002C7F08B6e8Ec8cf1dDa
363
363
  var ERC20_BULK_BALANCE_CHECKER_ADDRESS = "0x000000b50a9f2923f2db931391824f6d1278f712";
364
364
  var NET_SEAPORT_ZONE_ADDRESS = "0x000000007F8c58fbf215bF91Bda7421A806cf3ae";
365
365
  var NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS = "0x000000B799ec6D7aCC1B578f62bFc324c25DFC5A";
366
+ var NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS = "0x000000bC63761cbb05305632212e2f3AE2BE7a9B";
366
367
  var BAZAAR_CHAIN_CONFIGS = {
367
368
  // Base Mainnet
368
369
  8453: {
@@ -788,6 +789,7 @@ function parseListingFromMessage(message, chainId) {
788
789
  }
789
790
  const priceWei = getTotalConsiderationAmount(parameters);
790
791
  const tokenId = offerItem.identifierOrCriteria.toString();
792
+ const targetFulfiller = parameters.zone.toLowerCase() === NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS.toLowerCase() && parameters.zoneHash !== "0x0000000000000000000000000000000000000000000000000000000000000000" ? parameters.zoneHash : void 0;
791
793
  return {
792
794
  maker: parameters.offerer,
793
795
  nftAddress: offerItem.token,
@@ -804,7 +806,8 @@ function parseListingFromMessage(message, chainId) {
804
806
  orderComponents: {
805
807
  ...parameters,
806
808
  counter: submission.counter
807
- }
809
+ },
810
+ targetFulfiller
808
811
  };
809
812
  } catch {
810
813
  return null;
@@ -1050,25 +1053,30 @@ var BazaarClient = class {
1050
1053
  * Results are deduplicated (one per token) and sorted by price (lowest first)
1051
1054
  */
1052
1055
  async getListings(options) {
1053
- const { nftAddress, excludeMaker, maxMessages = 200 } = options;
1056
+ const { nftAddress, excludeMaker, maker, maxMessages = 200 } = options;
1054
1057
  const bazaarAddress = getBazaarAddress(this.chainId);
1055
- const count = await this.netClient.getMessageCount({
1056
- filter: {
1057
- appAddress: bazaarAddress,
1058
- topic: nftAddress.toLowerCase()
1058
+ const filter = {
1059
+ appAddress: bazaarAddress,
1060
+ topic: nftAddress.toLowerCase(),
1061
+ maker
1062
+ };
1063
+ let startIndex;
1064
+ let endIndex;
1065
+ if (options.startIndex != null && options.endIndex != null) {
1066
+ startIndex = options.startIndex;
1067
+ endIndex = options.endIndex;
1068
+ } else {
1069
+ const count = await this.netClient.getMessageCount({ filter });
1070
+ if (count === 0) {
1071
+ return [];
1059
1072
  }
1060
- });
1061
- if (count === 0) {
1062
- return [];
1073
+ startIndex = Math.max(0, count - maxMessages);
1074
+ endIndex = count;
1063
1075
  }
1064
- const startIndex = Math.max(0, count - maxMessages);
1065
1076
  const messages = await this.netClient.getMessages({
1066
- filter: {
1067
- appAddress: bazaarAddress,
1068
- topic: nftAddress.toLowerCase()
1069
- },
1077
+ filter,
1070
1078
  startIndex,
1071
- endIndex: count
1079
+ endIndex
1072
1080
  });
1073
1081
  let listings = [];
1074
1082
  for (const message of messages) {
@@ -1301,25 +1309,30 @@ var BazaarClient = class {
1301
1309
  * all valid listings are returned (grouped by maker in the UI).
1302
1310
  */
1303
1311
  async getErc20Listings(options) {
1304
- const { tokenAddress, excludeMaker, maxMessages = 200 } = options;
1312
+ const { tokenAddress, excludeMaker, maker, maxMessages = 200 } = options;
1305
1313
  const erc20BazaarAddress = getErc20BazaarAddress(this.chainId);
1306
- const count = await this.netClient.getMessageCount({
1307
- filter: {
1308
- appAddress: erc20BazaarAddress,
1309
- topic: tokenAddress.toLowerCase()
1314
+ const filter = {
1315
+ appAddress: erc20BazaarAddress,
1316
+ topic: tokenAddress.toLowerCase(),
1317
+ maker
1318
+ };
1319
+ let startIndex;
1320
+ let endIndex;
1321
+ if (options.startIndex != null && options.endIndex != null) {
1322
+ startIndex = options.startIndex;
1323
+ endIndex = options.endIndex;
1324
+ } else {
1325
+ const count = await this.netClient.getMessageCount({ filter });
1326
+ if (count === 0) {
1327
+ return [];
1310
1328
  }
1311
- });
1312
- if (count === 0) {
1313
- return [];
1329
+ startIndex = Math.max(0, count - maxMessages);
1330
+ endIndex = count;
1314
1331
  }
1315
- const startIndex = Math.max(0, count - maxMessages);
1316
1332
  const messages = await this.netClient.getMessages({
1317
- filter: {
1318
- appAddress: erc20BazaarAddress,
1319
- topic: tokenAddress.toLowerCase()
1320
- },
1333
+ filter,
1321
1334
  startIndex,
1322
- endIndex: count
1335
+ endIndex
1323
1336
  });
1324
1337
  let listings = [];
1325
1338
  for (const message of messages) {
@@ -1356,8 +1369,8 @@ var BazaarClient = class {
1356
1369
  const uniqueMakers = [...new Set(listings.map((l) => l.maker))];
1357
1370
  const balances = await bulkFetchErc20Balances(this.client, tokenAddress, uniqueMakers);
1358
1371
  const balanceMap = /* @__PURE__ */ new Map();
1359
- uniqueMakers.forEach((maker, index) => {
1360
- balanceMap.set(maker.toLowerCase(), balances[index]);
1372
+ uniqueMakers.forEach((maker2, index) => {
1373
+ balanceMap.set(maker2.toLowerCase(), balances[index]);
1361
1374
  });
1362
1375
  listings = listings.filter((listing) => {
1363
1376
  const balance = balanceMap.get(listing.maker.toLowerCase()) || BigInt(0);
@@ -1497,6 +1510,7 @@ exports.ERC721_OWNER_OF_HELPER_ABI = ERC721_OWNER_OF_HELPER_ABI;
1497
1510
  exports.ERC721_OWNER_OF_HELPER_ADDRESS = ERC721_OWNER_OF_HELPER_ADDRESS;
1498
1511
  exports.ItemType = ItemType;
1499
1512
  exports.NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS = NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS;
1513
+ exports.NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS = NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS;
1500
1514
  exports.NET_SEAPORT_ZONE_ADDRESS = NET_SEAPORT_ZONE_ADDRESS;
1501
1515
  exports.OrderType = OrderType;
1502
1516
  exports.SEAPORT_CANCEL_ABI = SEAPORT_CANCEL_ABI;