Skip to content

Commit

Permalink
feat: update log
Browse files Browse the repository at this point in the history
  • Loading branch information
nofir committed Jan 22, 2025
1 parent 8d9aeab commit e613b54
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/jobs/seaport-sync/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const fetchOrders = async (
overrideBaseUrl?: string;
contract?: string;
maxOrders?: number;
}
},
userNftTools = false
) => {
logger.debug("fetch_orders_seaport", `Seaport - Start. side=${side}`);

Expand All @@ -50,12 +51,12 @@ export const fetchOrders = async (
"X-API-KEY": _.includes(
[5, 80001, 80002, 84531, 999, 11155111],
config.chainId
) || (config.openseaApiUrl && config.openseaNftApiKey)
) || (userNftTools && config.openseaApiUrl && config.openseaNftApiKey)
? ""
: details?.apiKey || config.realtimeOpenseaApiKey,
};

if (config.openseaApiUrl && config.openseaNftApiKey) {
if (userNftTools && config.openseaApiUrl && config.openseaNftApiKey) {
headers["x-nft-api-key"] = config.openseaNftApiKey;
}

Expand Down Expand Up @@ -158,16 +159,24 @@ export const fetchOrders = async (
"fetch_orders_seaport",
JSON.stringify(
{
message: `Seaport - Rate Limited. side=${side}, cursor=${cursor}, url=${config.openseaApiUrl || url}, error=${error.message}`,
message: `Seaport - Rate Limited. userNftTools=${userNftTools}, side=${side}, cursor=${cursor}, url=${config.openseaApiUrl || url}, error=${error.message}`,
openseaApiUrl: config.openseaApiUrl,
openseaNftApiKey: config.openseaNftApiKey,
options,
responseData: error.response?.data,
responseStatus: error.response?.status,
userNftTools,
}
)
);

if (!userNftTools && config.openseaApiUrl && config.openseaNftApiKey) {
headers["x-nft-api-key"] = config.openseaNftApiKey;

await fetchOrders(side, details, true);
continue;
}

if (cursor) {
await new Promise((resolve) => setTimeout(resolve, 5000));
continue;
Expand Down

0 comments on commit e613b54

Please sign in to comment.