-
Notifications
You must be signed in to change notification settings - Fork 16
Changed accurateAsOf in Registrar Actions from optional to required
#1907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@ensnode/ensnode-sdk": minor | ||
| "ensapi": minor | ||
| --- | ||
|
|
||
| Made `accurateAsOf` a required field in the Registrar Actions API response (`RegistrarActionsResponseOk`). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,16 @@ async function fetchRegistrarActions(parentNode: Node | undefined, query: Regist | |
| */ | ||
| app.openapi(getRegistrarActionsRoute, async (c) => { | ||
| try { | ||
| // Defensive: `registrarActionsApiMiddleware` already short-circuits with a | ||
| // serialized 503 when indexingStatus is an Error, so this branch is | ||
| // unreachable at runtime — kept only for TypeScript type narrowing. | ||
| if (c.var.indexingStatus instanceof Error) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The registrar-actions handlers'
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Goader Thanks. Agreed with your conclusion here but it will be good to add a comment in the code here how this case is unreachable based on the |
||
| throw new Error("Indexing status has not been loaded yet"); | ||
Goader marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Goader marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest we move the operation that builds |
||
| // Get the accurateAsOf timestamp from the omnichain indexing cursor | ||
| const accurateAsOf = c.var.indexingStatus.snapshot.omnichainSnapshot.omnichainIndexingCursor; | ||
|
|
||
| const query = c.req.valid("query"); | ||
| const { registrarActions, pageContext } = await fetchRegistrarActions(undefined, query); | ||
|
|
||
|
|
@@ -110,6 +120,7 @@ app.openapi(getRegistrarActionsRoute, async (c) => { | |
| responseCode: RegistrarActionsResponseCodes.Ok, | ||
| registrarActions, | ||
| pageContext, | ||
| accurateAsOf, | ||
| } satisfies RegistrarActionsResponseOk), | ||
| ); | ||
| } catch (error) { | ||
|
|
@@ -163,17 +174,20 @@ app.openapi(getRegistrarActionsRoute, async (c) => { | |
| */ | ||
| app.openapi(getRegistrarActionsByParentNodeRoute, async (c) => { | ||
| try { | ||
| // Defensive: `registrarActionsApiMiddleware` already short-circuits with a | ||
| // serialized 503 when indexingStatus is an Error, so this branch is | ||
| // unreachable at runtime — kept only for TypeScript type narrowing. | ||
| if (c.var.indexingStatus instanceof Error) { | ||
| throw new Error("Indexing status has not been loaded yet"); | ||
| } | ||
|
|
||
| // Get the accurateAsOf timestamp from the omnichain indexing cursor | ||
| const accurateAsOf = c.var.indexingStatus.snapshot.omnichainSnapshot.omnichainIndexingCursor; | ||
|
|
||
| const { parentNode } = c.req.valid("param"); | ||
| const query = c.req.valid("query"); | ||
| const { registrarActions, pageContext } = await fetchRegistrarActions(parentNode, query); | ||
|
|
||
| // Get the accurateAsOf timestamp from the slowest chain indexing cursor | ||
| const accurateAsOf = c.var.indexingStatus.snapshot.slowestChainIndexingCursor; | ||
|
|
||
| // respond with success response | ||
| return c.json( | ||
| serializeRegistrarActionsResponse({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.