Skip to content

Commit c53e716

Browse files
committed
Fix references to updated Indexing Status data model in ENSAdmin
1 parent e40175a commit c53e716

3 files changed

Lines changed: 36 additions & 8 deletions

File tree

apps/ensadmin/src/app/mock/config-api.mock.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { deserializeENSIndexerPublicConfig } from "@ensnode/ensnode-sdk";
1+
import {
2+
deserializeENSIndexerPublicConfig,
3+
SerializedEnsApiConfigResponse,
4+
SerializedEnsIndexerConfigResponse,
5+
} from "@ensnode/ensnode-sdk";
26

3-
export const ensIndexerPublicConfig = deserializeENSIndexerPublicConfig({
7+
const serializedEnsIndexerPublicConfig = {
48
labelSet: {
59
labelSetId: "subgraph",
610
labelSetVersion: 0,
@@ -27,4 +31,17 @@ export const ensIndexerPublicConfig = deserializeENSIndexerPublicConfig({
2731
ensRainbowSchema: 3,
2832
ensNormalize: "1.11.1",
2933
},
30-
});
34+
} satisfies SerializedEnsIndexerConfigResponse;
35+
36+
export const ensIndexerPublicConfig = deserializeENSIndexerPublicConfig(
37+
serializedEnsIndexerPublicConfig,
38+
);
39+
40+
export const serializedEnsApiPublicConfig = {
41+
ensIndexerPublicConfig: serializedEnsIndexerPublicConfig,
42+
theGraphFallback: {
43+
canFallback: true,
44+
url: "https://api.thegraph.com/subgraphs/name/ensdomains/ens",
45+
},
46+
version: "0.35.0",
47+
} satisfies SerializedEnsApiConfigResponse;

apps/ensadmin/src/app/mock/indexing-stats/page.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useEffect, useState } from "react";
77
import {
88
CrossChainIndexingStatusSnapshot,
99
createRealtimeIndexingStatusProjection,
10+
EnsApiIndexingStatusResponseOk,
1011
IndexingStatusResponseCodes,
1112
IndexingStatusResponseOk,
1213
OmnichainIndexingStatusIds,
@@ -37,7 +38,7 @@ let loadingTimeoutId: number;
3738

3839
async function fetchMockedIndexingStatus(
3940
selectedVariant: Variant,
40-
): Promise<CrossChainIndexingStatusSnapshot> {
41+
): Promise<EnsApiIndexingStatusResponseOk> {
4142
// always try clearing loading timeout when performing a mocked fetch
4243
// this way we get a fresh and very long request to observe the loading state
4344
if (loadingTimeoutId) {
@@ -53,14 +54,14 @@ async function fetchMockedIndexingStatus(
5354
selectedVariant
5455
] as IndexingStatusResponseOk;
5556

56-
return response.realtimeProjection.snapshot;
57+
return response;
5758
}
5859
case "Error ResponseCode":
5960
throw new Error(
6061
"Received Indexing Status response with responseCode other than 'ok' which will not be cached.",
6162
);
6263
case "Loading":
63-
return new Promise<CrossChainIndexingStatusSnapshot>((_resolve, reject) => {
64+
return new Promise<EnsApiIndexingStatusResponseOk>((_resolve, reject) => {
6465
loadingTimeoutId = +setTimeout(reject, 5 * 60 * 1_000);
6566
});
6667
case "Loading Error":
@@ -77,10 +78,14 @@ export default function MockIndexingStatusPage() {
7778
const mockedIndexingStatus = useQuery({
7879
queryKey: ["mock", "useIndexingStatus", selectedVariant],
7980
queryFn: () => fetchMockedIndexingStatus(selectedVariant),
80-
select: (cachedSnapshot) => {
81+
select: (response) => {
8182
return {
8283
responseCode: IndexingStatusResponseCodes.Ok,
83-
realtimeProjection: createRealtimeIndexingStatusProjection(cachedSnapshot, now),
84+
realtimeProjection: createRealtimeIndexingStatusProjection(
85+
response.realtimeProjection.snapshot,
86+
now,
87+
),
88+
config: response.config,
8489
} satisfies IndexingStatusResponseOk;
8590
},
8691
retry: false, // allows loading error to be observed immediately

apps/ensadmin/src/app/mock/indexing-status-api.mock.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import {
1818
type SerializedOmnichainIndexingStatusSnapshotUnstarted,
1919
} from "@ensnode/ensnode-sdk";
2020

21+
import { serializedEnsApiPublicConfig } from "@/app/mock/config-api.mock";
22+
2123
export const indexingStatusResponseError: IndexingStatusResponseError = {
2224
responseCode: IndexingStatusResponseCodes.Error,
2325
};
@@ -85,6 +87,7 @@ export const indexingStatusResponseOkOmnichain: Record<
8587
} satisfies SerializedOmnichainIndexingStatusSnapshotUnstarted,
8688
},
8789
},
90+
config: serializedEnsApiPublicConfig,
8891
}),
8992

9093
[OmnichainIndexingStatusIds.Backfill]: deserializeIndexingStatusResponse({
@@ -163,6 +166,7 @@ export const indexingStatusResponseOkOmnichain: Record<
163166
} satisfies SerializedOmnichainIndexingStatusSnapshotBackfill,
164167
},
165168
},
169+
config: serializedEnsApiPublicConfig,
166170
}),
167171

168172
[OmnichainIndexingStatusIds.Following]: deserializeIndexingStatusResponse({
@@ -256,6 +260,7 @@ export const indexingStatusResponseOkOmnichain: Record<
256260
} satisfies SerializedOmnichainIndexingStatusSnapshotFollowing,
257261
},
258262
},
263+
config: serializedEnsApiPublicConfig,
259264
}),
260265

261266
[OmnichainIndexingStatusIds.Completed]: deserializeIndexingStatusResponse({
@@ -293,5 +298,6 @@ export const indexingStatusResponseOkOmnichain: Record<
293298
} satisfies SerializedOmnichainIndexingStatusSnapshotCompleted,
294299
},
295300
},
301+
config: serializedEnsApiPublicConfig,
296302
}),
297303
};

0 commit comments

Comments
 (0)