@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/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as Listing, C as CollectionOffer, E as Erc20Offer, d as Erc20Listing } from './types
|
|
1
|
+
import { L as Listing, C as CollectionOffer, E as Erc20Offer, d as Erc20Listing } from './types-KQgBECzI.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* React hook for fetching NFT listings from Bazaar
|
|
@@ -11,8 +11,14 @@ interface UseBazaarListingsOptions {
|
|
|
11
11
|
nftAddress: `0x${string}`;
|
|
12
12
|
/** Exclude listings from this address */
|
|
13
13
|
excludeMaker?: `0x${string}`;
|
|
14
|
+
/** Only include listings from this address */
|
|
15
|
+
maker?: `0x${string}`;
|
|
14
16
|
/** Maximum number of messages to fetch (default: 200) */
|
|
15
17
|
maxMessages?: number;
|
|
18
|
+
/** Override start index for message range */
|
|
19
|
+
startIndex?: number;
|
|
20
|
+
/** Override end index for message range */
|
|
21
|
+
endIndex?: number;
|
|
16
22
|
/** Whether the query is enabled (default: true) */
|
|
17
23
|
enabled?: boolean;
|
|
18
24
|
}
|
|
@@ -58,7 +64,7 @@ interface UseBazaarListingsResult {
|
|
|
58
64
|
* );
|
|
59
65
|
* ```
|
|
60
66
|
*/
|
|
61
|
-
declare function useBazaarListings({ chainId, nftAddress, excludeMaker, maxMessages, enabled, }: UseBazaarListingsOptions): UseBazaarListingsResult;
|
|
67
|
+
declare function useBazaarListings({ chainId, nftAddress, excludeMaker, maker, maxMessages, startIndex: startIndexOverride, endIndex: endIndexOverride, enabled, }: UseBazaarListingsOptions): UseBazaarListingsResult;
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
70
|
* React hook for fetching collection offers from Bazaar
|
|
@@ -186,8 +192,14 @@ interface UseBazaarErc20ListingsOptions {
|
|
|
186
192
|
tokenAddress: `0x${string}`;
|
|
187
193
|
/** Exclude listings from this address */
|
|
188
194
|
excludeMaker?: `0x${string}`;
|
|
195
|
+
/** Only include listings from this address */
|
|
196
|
+
maker?: `0x${string}`;
|
|
189
197
|
/** Maximum number of messages to fetch (default: 200) */
|
|
190
198
|
maxMessages?: number;
|
|
199
|
+
/** Override start index for message range */
|
|
200
|
+
startIndex?: number;
|
|
201
|
+
/** Override end index for message range */
|
|
202
|
+
endIndex?: number;
|
|
191
203
|
/** Whether the query is enabled (default: true) */
|
|
192
204
|
enabled?: boolean;
|
|
193
205
|
}
|
|
@@ -234,6 +246,6 @@ interface UseBazaarErc20ListingsResult {
|
|
|
234
246
|
* }
|
|
235
247
|
* ```
|
|
236
248
|
*/
|
|
237
|
-
declare function useBazaarErc20Listings({ chainId, tokenAddress, excludeMaker, maxMessages, enabled, }: UseBazaarErc20ListingsOptions): UseBazaarErc20ListingsResult;
|
|
249
|
+
declare function useBazaarErc20Listings({ chainId, tokenAddress, excludeMaker, maker, maxMessages, startIndex: startIndexOverride, endIndex: endIndexOverride, enabled, }: UseBazaarErc20ListingsOptions): UseBazaarErc20ListingsResult;
|
|
238
250
|
|
|
239
251
|
export { type UseBazaarCollectionOffersOptions, type UseBazaarCollectionOffersResult, type UseBazaarErc20ListingsOptions, type UseBazaarErc20ListingsResult, type UseBazaarErc20OffersOptions, type UseBazaarErc20OffersResult, type UseBazaarListingsOptions, type UseBazaarListingsResult, useBazaarCollectionOffers, useBazaarErc20Listings, useBazaarErc20Offers, useBazaarListings };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as Listing, C as CollectionOffer, E as Erc20Offer, d as Erc20Listing } from './types
|
|
1
|
+
import { L as Listing, C as CollectionOffer, E as Erc20Offer, d as Erc20Listing } from './types-KQgBECzI.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* React hook for fetching NFT listings from Bazaar
|
|
@@ -11,8 +11,14 @@ interface UseBazaarListingsOptions {
|
|
|
11
11
|
nftAddress: `0x${string}`;
|
|
12
12
|
/** Exclude listings from this address */
|
|
13
13
|
excludeMaker?: `0x${string}`;
|
|
14
|
+
/** Only include listings from this address */
|
|
15
|
+
maker?: `0x${string}`;
|
|
14
16
|
/** Maximum number of messages to fetch (default: 200) */
|
|
15
17
|
maxMessages?: number;
|
|
18
|
+
/** Override start index for message range */
|
|
19
|
+
startIndex?: number;
|
|
20
|
+
/** Override end index for message range */
|
|
21
|
+
endIndex?: number;
|
|
16
22
|
/** Whether the query is enabled (default: true) */
|
|
17
23
|
enabled?: boolean;
|
|
18
24
|
}
|
|
@@ -58,7 +64,7 @@ interface UseBazaarListingsResult {
|
|
|
58
64
|
* );
|
|
59
65
|
* ```
|
|
60
66
|
*/
|
|
61
|
-
declare function useBazaarListings({ chainId, nftAddress, excludeMaker, maxMessages, enabled, }: UseBazaarListingsOptions): UseBazaarListingsResult;
|
|
67
|
+
declare function useBazaarListings({ chainId, nftAddress, excludeMaker, maker, maxMessages, startIndex: startIndexOverride, endIndex: endIndexOverride, enabled, }: UseBazaarListingsOptions): UseBazaarListingsResult;
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
70
|
* React hook for fetching collection offers from Bazaar
|
|
@@ -186,8 +192,14 @@ interface UseBazaarErc20ListingsOptions {
|
|
|
186
192
|
tokenAddress: `0x${string}`;
|
|
187
193
|
/** Exclude listings from this address */
|
|
188
194
|
excludeMaker?: `0x${string}`;
|
|
195
|
+
/** Only include listings from this address */
|
|
196
|
+
maker?: `0x${string}`;
|
|
189
197
|
/** Maximum number of messages to fetch (default: 200) */
|
|
190
198
|
maxMessages?: number;
|
|
199
|
+
/** Override start index for message range */
|
|
200
|
+
startIndex?: number;
|
|
201
|
+
/** Override end index for message range */
|
|
202
|
+
endIndex?: number;
|
|
191
203
|
/** Whether the query is enabled (default: true) */
|
|
192
204
|
enabled?: boolean;
|
|
193
205
|
}
|
|
@@ -234,6 +246,6 @@ interface UseBazaarErc20ListingsResult {
|
|
|
234
246
|
* }
|
|
235
247
|
* ```
|
|
236
248
|
*/
|
|
237
|
-
declare function useBazaarErc20Listings({ chainId, tokenAddress, excludeMaker, maxMessages, enabled, }: UseBazaarErc20ListingsOptions): UseBazaarErc20ListingsResult;
|
|
249
|
+
declare function useBazaarErc20Listings({ chainId, tokenAddress, excludeMaker, maker, maxMessages, startIndex: startIndexOverride, endIndex: endIndexOverride, enabled, }: UseBazaarErc20ListingsOptions): UseBazaarErc20ListingsResult;
|
|
238
250
|
|
|
239
251
|
export { type UseBazaarCollectionOffersOptions, type UseBazaarCollectionOffersResult, type UseBazaarErc20ListingsOptions, type UseBazaarErc20ListingsResult, type UseBazaarErc20OffersOptions, type UseBazaarErc20OffersResult, type UseBazaarListingsOptions, type UseBazaarListingsResult, useBazaarCollectionOffers, useBazaarErc20Listings, useBazaarErc20Offers, useBazaarListings };
|
package/dist/react.js
CHANGED
|
@@ -185,6 +185,7 @@ var BULK_SEAPORT_ORDER_STATUS_FETCHER_ADDRESS = "0x0000009112ABCE652674b4fE3eD9C
|
|
|
185
185
|
var ERC721_OWNER_OF_HELPER_ADDRESS = "0x000000aa4eFa2e5A4a6002C7F08B6e8Ec8cf1dDa";
|
|
186
186
|
var ERC20_BULK_BALANCE_CHECKER_ADDRESS = "0x000000b50a9f2923f2db931391824f6d1278f712";
|
|
187
187
|
var NET_SEAPORT_COLLECTION_OFFER_ZONE_ADDRESS = "0x000000B799ec6D7aCC1B578f62bFc324c25DFC5A";
|
|
188
|
+
var NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS = "0x000000bC63761cbb05305632212e2f3AE2BE7a9B";
|
|
188
189
|
var BAZAAR_CHAIN_CONFIGS = {
|
|
189
190
|
// Base Mainnet
|
|
190
191
|
8453: {
|
|
@@ -577,6 +578,7 @@ function parseListingFromMessage(message, chainId) {
|
|
|
577
578
|
}
|
|
578
579
|
const priceWei = getTotalConsiderationAmount(parameters);
|
|
579
580
|
const tokenId = offerItem.identifierOrCriteria.toString();
|
|
581
|
+
const targetFulfiller = parameters.zone.toLowerCase() === NET_SEAPORT_PRIVATE_ORDER_ZONE_ADDRESS.toLowerCase() && parameters.zoneHash !== "0x0000000000000000000000000000000000000000000000000000000000000000" ? parameters.zoneHash : void 0;
|
|
580
582
|
return {
|
|
581
583
|
maker: parameters.offerer,
|
|
582
584
|
nftAddress: offerItem.token,
|
|
@@ -593,7 +595,8 @@ function parseListingFromMessage(message, chainId) {
|
|
|
593
595
|
orderComponents: {
|
|
594
596
|
...parameters,
|
|
595
597
|
counter: submission.counter
|
|
596
|
-
}
|
|
598
|
+
},
|
|
599
|
+
targetFulfiller
|
|
597
600
|
};
|
|
598
601
|
} catch {
|
|
599
602
|
return null;
|
|
@@ -831,25 +834,30 @@ var BazaarClient = class {
|
|
|
831
834
|
* Results are deduplicated (one per token) and sorted by price (lowest first)
|
|
832
835
|
*/
|
|
833
836
|
async getListings(options) {
|
|
834
|
-
const { nftAddress, excludeMaker, maxMessages = 200 } = options;
|
|
837
|
+
const { nftAddress, excludeMaker, maker, maxMessages = 200 } = options;
|
|
835
838
|
const bazaarAddress = getBazaarAddress(this.chainId);
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
839
|
+
const filter = {
|
|
840
|
+
appAddress: bazaarAddress,
|
|
841
|
+
topic: nftAddress.toLowerCase(),
|
|
842
|
+
maker
|
|
843
|
+
};
|
|
844
|
+
let startIndex;
|
|
845
|
+
let endIndex;
|
|
846
|
+
if (options.startIndex != null && options.endIndex != null) {
|
|
847
|
+
startIndex = options.startIndex;
|
|
848
|
+
endIndex = options.endIndex;
|
|
849
|
+
} else {
|
|
850
|
+
const count = await this.netClient.getMessageCount({ filter });
|
|
851
|
+
if (count === 0) {
|
|
852
|
+
return [];
|
|
840
853
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
return [];
|
|
854
|
+
startIndex = Math.max(0, count - maxMessages);
|
|
855
|
+
endIndex = count;
|
|
844
856
|
}
|
|
845
|
-
const startIndex = Math.max(0, count - maxMessages);
|
|
846
857
|
const messages = await this.netClient.getMessages({
|
|
847
|
-
filter
|
|
848
|
-
appAddress: bazaarAddress,
|
|
849
|
-
topic: nftAddress.toLowerCase()
|
|
850
|
-
},
|
|
858
|
+
filter,
|
|
851
859
|
startIndex,
|
|
852
|
-
endIndex
|
|
860
|
+
endIndex
|
|
853
861
|
});
|
|
854
862
|
let listings = [];
|
|
855
863
|
for (const message of messages) {
|
|
@@ -1082,25 +1090,30 @@ var BazaarClient = class {
|
|
|
1082
1090
|
* all valid listings are returned (grouped by maker in the UI).
|
|
1083
1091
|
*/
|
|
1084
1092
|
async getErc20Listings(options) {
|
|
1085
|
-
const { tokenAddress, excludeMaker, maxMessages = 200 } = options;
|
|
1093
|
+
const { tokenAddress, excludeMaker, maker, maxMessages = 200 } = options;
|
|
1086
1094
|
const erc20BazaarAddress = getErc20BazaarAddress(this.chainId);
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1095
|
+
const filter = {
|
|
1096
|
+
appAddress: erc20BazaarAddress,
|
|
1097
|
+
topic: tokenAddress.toLowerCase(),
|
|
1098
|
+
maker
|
|
1099
|
+
};
|
|
1100
|
+
let startIndex;
|
|
1101
|
+
let endIndex;
|
|
1102
|
+
if (options.startIndex != null && options.endIndex != null) {
|
|
1103
|
+
startIndex = options.startIndex;
|
|
1104
|
+
endIndex = options.endIndex;
|
|
1105
|
+
} else {
|
|
1106
|
+
const count = await this.netClient.getMessageCount({ filter });
|
|
1107
|
+
if (count === 0) {
|
|
1108
|
+
return [];
|
|
1091
1109
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
return [];
|
|
1110
|
+
startIndex = Math.max(0, count - maxMessages);
|
|
1111
|
+
endIndex = count;
|
|
1095
1112
|
}
|
|
1096
|
-
const startIndex = Math.max(0, count - maxMessages);
|
|
1097
1113
|
const messages = await this.netClient.getMessages({
|
|
1098
|
-
filter
|
|
1099
|
-
appAddress: erc20BazaarAddress,
|
|
1100
|
-
topic: tokenAddress.toLowerCase()
|
|
1101
|
-
},
|
|
1114
|
+
filter,
|
|
1102
1115
|
startIndex,
|
|
1103
|
-
endIndex
|
|
1116
|
+
endIndex
|
|
1104
1117
|
});
|
|
1105
1118
|
let listings = [];
|
|
1106
1119
|
for (const message of messages) {
|
|
@@ -1137,8 +1150,8 @@ var BazaarClient = class {
|
|
|
1137
1150
|
const uniqueMakers = [...new Set(listings.map((l) => l.maker))];
|
|
1138
1151
|
const balances = await bulkFetchErc20Balances(this.client, tokenAddress, uniqueMakers);
|
|
1139
1152
|
const balanceMap = /* @__PURE__ */ new Map();
|
|
1140
|
-
uniqueMakers.forEach((
|
|
1141
|
-
balanceMap.set(
|
|
1153
|
+
uniqueMakers.forEach((maker2, index) => {
|
|
1154
|
+
balanceMap.set(maker2.toLowerCase(), balances[index]);
|
|
1142
1155
|
});
|
|
1143
1156
|
listings = listings.filter((listing) => {
|
|
1144
1157
|
const balance = balanceMap.get(listing.maker.toLowerCase()) || BigInt(0);
|
|
@@ -1271,13 +1284,17 @@ function useBazaarListings({
|
|
|
1271
1284
|
chainId,
|
|
1272
1285
|
nftAddress,
|
|
1273
1286
|
excludeMaker,
|
|
1287
|
+
maker,
|
|
1274
1288
|
maxMessages = 200,
|
|
1289
|
+
startIndex: startIndexOverride,
|
|
1290
|
+
endIndex: endIndexOverride,
|
|
1275
1291
|
enabled = true
|
|
1276
1292
|
}) {
|
|
1277
1293
|
const [listings, setListings] = react.useState([]);
|
|
1278
1294
|
const [isProcessing, setIsProcessing] = react.useState(false);
|
|
1279
1295
|
const [processingError, setProcessingError] = react.useState();
|
|
1280
1296
|
const [refetchTrigger, setRefetchTrigger] = react.useState(0);
|
|
1297
|
+
const hasRangeOverride = startIndexOverride != null && endIndexOverride != null;
|
|
1281
1298
|
const isSupported = react.useMemo(
|
|
1282
1299
|
() => isBazaarSupportedOnChain(chainId),
|
|
1283
1300
|
[chainId]
|
|
@@ -1289,19 +1306,18 @@ function useBazaarListings({
|
|
|
1289
1306
|
const filter = react.useMemo(
|
|
1290
1307
|
() => ({
|
|
1291
1308
|
appAddress: bazaarAddress,
|
|
1292
|
-
topic: nftAddress.toLowerCase()
|
|
1309
|
+
topic: nftAddress.toLowerCase(),
|
|
1310
|
+
maker
|
|
1293
1311
|
}),
|
|
1294
|
-
[bazaarAddress, nftAddress]
|
|
1312
|
+
[bazaarAddress, nftAddress, maker]
|
|
1295
1313
|
);
|
|
1296
1314
|
const { count: totalCount, isLoading: isLoadingCount } = react$1.useNetMessageCount({
|
|
1297
1315
|
chainId,
|
|
1298
1316
|
filter,
|
|
1299
|
-
enabled: enabled && isSupported
|
|
1317
|
+
enabled: enabled && isSupported && !hasRangeOverride
|
|
1300
1318
|
});
|
|
1301
|
-
const startIndex =
|
|
1302
|
-
|
|
1303
|
-
[totalCount, maxMessages]
|
|
1304
|
-
);
|
|
1319
|
+
const startIndex = hasRangeOverride ? startIndexOverride : Math.max(0, totalCount - maxMessages);
|
|
1320
|
+
const endIndex = hasRangeOverride ? endIndexOverride : totalCount;
|
|
1305
1321
|
const {
|
|
1306
1322
|
messages,
|
|
1307
1323
|
isLoading: isLoadingMessages,
|
|
@@ -1311,8 +1327,8 @@ function useBazaarListings({
|
|
|
1311
1327
|
chainId,
|
|
1312
1328
|
filter,
|
|
1313
1329
|
startIndex,
|
|
1314
|
-
endIndex
|
|
1315
|
-
enabled: enabled && isSupported && totalCount > 0
|
|
1330
|
+
endIndex,
|
|
1331
|
+
enabled: enabled && isSupported && (hasRangeOverride || totalCount > 0)
|
|
1316
1332
|
});
|
|
1317
1333
|
react.useEffect(() => {
|
|
1318
1334
|
if (!isSupported || !enabled) {
|
|
@@ -1332,7 +1348,10 @@ function useBazaarListings({
|
|
|
1332
1348
|
const validListings = await client.getListings({
|
|
1333
1349
|
nftAddress,
|
|
1334
1350
|
excludeMaker,
|
|
1335
|
-
|
|
1351
|
+
maker,
|
|
1352
|
+
maxMessages,
|
|
1353
|
+
startIndex: hasRangeOverride ? startIndexOverride : void 0,
|
|
1354
|
+
endIndex: hasRangeOverride ? endIndexOverride : void 0
|
|
1336
1355
|
});
|
|
1337
1356
|
if (!cancelled) {
|
|
1338
1357
|
setListings(validListings);
|
|
@@ -1352,14 +1371,14 @@ function useBazaarListings({
|
|
|
1352
1371
|
return () => {
|
|
1353
1372
|
cancelled = true;
|
|
1354
1373
|
};
|
|
1355
|
-
}, [chainId, nftAddress, excludeMaker, maxMessages, messages, isSupported, enabled, refetchTrigger]);
|
|
1374
|
+
}, [chainId, nftAddress, excludeMaker, maker, maxMessages, startIndexOverride, endIndexOverride, hasRangeOverride, messages, isSupported, enabled, refetchTrigger]);
|
|
1356
1375
|
const refetch = () => {
|
|
1357
1376
|
refetchMessages();
|
|
1358
1377
|
setRefetchTrigger((t) => t + 1);
|
|
1359
1378
|
};
|
|
1360
1379
|
return {
|
|
1361
1380
|
listings,
|
|
1362
|
-
isLoading: isLoadingCount || isLoadingMessages || isProcessing,
|
|
1381
|
+
isLoading: (hasRangeOverride ? false : isLoadingCount) || isLoadingMessages || isProcessing,
|
|
1363
1382
|
error: messagesError || processingError,
|
|
1364
1383
|
refetch
|
|
1365
1384
|
};
|
|
@@ -1563,13 +1582,17 @@ function useBazaarErc20Listings({
|
|
|
1563
1582
|
chainId,
|
|
1564
1583
|
tokenAddress,
|
|
1565
1584
|
excludeMaker,
|
|
1585
|
+
maker,
|
|
1566
1586
|
maxMessages = 200,
|
|
1587
|
+
startIndex: startIndexOverride,
|
|
1588
|
+
endIndex: endIndexOverride,
|
|
1567
1589
|
enabled = true
|
|
1568
1590
|
}) {
|
|
1569
1591
|
const [listings, setListings] = react.useState([]);
|
|
1570
1592
|
const [isProcessing, setIsProcessing] = react.useState(false);
|
|
1571
1593
|
const [processingError, setProcessingError] = react.useState();
|
|
1572
1594
|
const [refetchTrigger, setRefetchTrigger] = react.useState(0);
|
|
1595
|
+
const hasRangeOverride = startIndexOverride != null && endIndexOverride != null;
|
|
1573
1596
|
const isSupported = react.useMemo(
|
|
1574
1597
|
() => isBazaarSupportedOnChain(chainId),
|
|
1575
1598
|
[chainId]
|
|
@@ -1581,19 +1604,18 @@ function useBazaarErc20Listings({
|
|
|
1581
1604
|
const filter = react.useMemo(
|
|
1582
1605
|
() => ({
|
|
1583
1606
|
appAddress: erc20BazaarAddress,
|
|
1584
|
-
topic: tokenAddress.toLowerCase()
|
|
1607
|
+
topic: tokenAddress.toLowerCase(),
|
|
1608
|
+
maker
|
|
1585
1609
|
}),
|
|
1586
|
-
[erc20BazaarAddress, tokenAddress]
|
|
1610
|
+
[erc20BazaarAddress, tokenAddress, maker]
|
|
1587
1611
|
);
|
|
1588
1612
|
const { count: totalCount, isLoading: isLoadingCount } = react$1.useNetMessageCount({
|
|
1589
1613
|
chainId,
|
|
1590
1614
|
filter,
|
|
1591
|
-
enabled: enabled && isSupported
|
|
1615
|
+
enabled: enabled && isSupported && !hasRangeOverride
|
|
1592
1616
|
});
|
|
1593
|
-
const startIndex =
|
|
1594
|
-
|
|
1595
|
-
[totalCount, maxMessages]
|
|
1596
|
-
);
|
|
1617
|
+
const startIndex = hasRangeOverride ? startIndexOverride : Math.max(0, totalCount - maxMessages);
|
|
1618
|
+
const endIndex = hasRangeOverride ? endIndexOverride : totalCount;
|
|
1597
1619
|
const {
|
|
1598
1620
|
messages,
|
|
1599
1621
|
isLoading: isLoadingMessages,
|
|
@@ -1603,8 +1625,8 @@ function useBazaarErc20Listings({
|
|
|
1603
1625
|
chainId,
|
|
1604
1626
|
filter,
|
|
1605
1627
|
startIndex,
|
|
1606
|
-
endIndex
|
|
1607
|
-
enabled: enabled && isSupported && totalCount > 0
|
|
1628
|
+
endIndex,
|
|
1629
|
+
enabled: enabled && isSupported && (hasRangeOverride || totalCount > 0)
|
|
1608
1630
|
});
|
|
1609
1631
|
react.useEffect(() => {
|
|
1610
1632
|
if (!isSupported || !enabled) {
|
|
@@ -1624,7 +1646,10 @@ function useBazaarErc20Listings({
|
|
|
1624
1646
|
const validListings = await client.getErc20Listings({
|
|
1625
1647
|
tokenAddress,
|
|
1626
1648
|
excludeMaker,
|
|
1627
|
-
|
|
1649
|
+
maker,
|
|
1650
|
+
maxMessages,
|
|
1651
|
+
startIndex: hasRangeOverride ? startIndexOverride : void 0,
|
|
1652
|
+
endIndex: hasRangeOverride ? endIndexOverride : void 0
|
|
1628
1653
|
});
|
|
1629
1654
|
if (!cancelled) {
|
|
1630
1655
|
setListings(validListings);
|
|
@@ -1644,14 +1669,14 @@ function useBazaarErc20Listings({
|
|
|
1644
1669
|
return () => {
|
|
1645
1670
|
cancelled = true;
|
|
1646
1671
|
};
|
|
1647
|
-
}, [chainId, tokenAddress, excludeMaker, maxMessages, messages, isSupported, enabled, refetchTrigger]);
|
|
1672
|
+
}, [chainId, tokenAddress, excludeMaker, maker, maxMessages, startIndexOverride, endIndexOverride, hasRangeOverride, messages, isSupported, enabled, refetchTrigger]);
|
|
1648
1673
|
const refetch = () => {
|
|
1649
1674
|
refetchMessages();
|
|
1650
1675
|
setRefetchTrigger((t) => t + 1);
|
|
1651
1676
|
};
|
|
1652
1677
|
return {
|
|
1653
1678
|
listings,
|
|
1654
|
-
isLoading: isLoadingCount || isLoadingMessages || isProcessing,
|
|
1679
|
+
isLoading: (hasRangeOverride ? false : isLoadingCount) || isLoadingMessages || isProcessing,
|
|
1655
1680
|
error: messagesError || processingError,
|
|
1656
1681
|
refetch
|
|
1657
1682
|
};
|