Skip to content

Commit

Permalink
diag
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 25, 2024
1 parent e869160 commit 6b45f13
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,19 +817,29 @@ export const main = async (argv: any, version?: string) => {
const res = results[i];
if (res.status === "fulfilled") {
lastReadOrdersMap[i].skip += res.value.count;
await handleAddOrderbookOwnersProfileMap(
orderbooksOwnersProfileMap,
res.value.addOrders.map((v) => v.order),
config.viemClient as any as ViemClient,
tokens,
options.ownerProfile,
roundSpan,
);
await handleRemoveOrderbookOwnersProfileMap(
orderbooksOwnersProfileMap,
res.value.removeOrders.map((v) => v.order),
roundSpan,
);
try {
await handleAddOrderbookOwnersProfileMap(
orderbooksOwnersProfileMap,
res.value.addOrders.map((v) => v.order),
config.viemClient as any as ViemClient,
tokens,
options.ownerProfile,
roundSpan,
);
} catch {
// eslint-disable-next-line no-console
console.log("bad1");
}
try {
await handleRemoveOrderbookOwnersProfileMap(
orderbooksOwnersProfileMap,
res.value.removeOrders.map((v) => v.order),
roundSpan,
);
} catch {
// eslint-disable-next-line no-console
console.log("bad2");
}
}
}
} catch {
Expand Down
2 changes: 2 additions & 0 deletions src/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ export async function handleRemoveOrderbookOwnersProfileMap(
ordersDetails: SgOrder[],
span?: Span,
) {
// eslint-disable-next-line no-console
console.log("bruh");
const changes: Record<string, string[]> = {};
for (let i = 0; i < ordersDetails.length; i++) {
const orderDetails = ordersDetails[i];
Expand Down
8 changes: 8 additions & 0 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,14 @@ export async function getOrderChanges(
}
}
if (event.__typename === "RemoveOrder") {
// eslint-disable-next-line no-console
console.log("abcd");
if (typeof event?.order?.active === "boolean" && !event.order.active) {
// eslint-disable-next-line no-console
console.log("abcd1");
if (!removeOrders.find((e) => e.order.id === event.order.id)) {
// eslint-disable-next-line no-console
console.log("abcd2");
removeOrders.unshift({
order: event.order as SgOrder,
timestamp: Number(tx.timestamp),
Expand All @@ -312,5 +318,7 @@ export async function getOrderChanges(
});
}
});
// eslint-disable-next-line no-console
console.log(removeOrders);
return { addOrders, removeOrders, count };
}

0 comments on commit 6b45f13

Please sign in to comment.