Skip to content

Commit d873d2f

Browse files
committed
Apply AI agent feedback
1 parent a090398 commit d873d2f

File tree

4 files changed

+31
-29
lines changed

4 files changed

+31
-29
lines changed

packages/ensnode-sdk/src/ensapi/api/name-tokens/prerequisites.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const nameTokensPrerequisites = Object.freeze({
1616
requiredPlugins: [PluginName.Registrars, PluginName.TokenScope] as const,
1717

1818
/**
19-
* Check if provided ENSApiPublicConfig supports the Name Tokens API.
19+
* Check if provided EnsIndexerPublicConfig supports the Name Tokens API.
2020
*/
2121
hasEnsIndexerConfigSupport(config: EnsIndexerPublicConfig): boolean {
2222
return nameTokensPrerequisites.requiredPlugins.every((plugin) =>

packages/ensnode-sdk/src/ensapi/api/registrar-actions/prerequisites.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const registrarActionsPrerequisites = Object.freeze({
2727
] as const,
2828

2929
/**
30-
* Check if provided ENSApiPublicConfig supports the Registrar Actions API.
30+
* Check if provided EnsIndexerPublicConfig supports the Registrar Actions API.
3131
*/
3232
hasEnsIndexerConfigSupport(config: EnsIndexerPublicConfig): boolean {
3333
return registrarActionsPrerequisites.requiredPlugins.every((plugin) =>

packages/ensnode-sdk/src/ensapi/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ describe("EnsApiClient", () => {
449449

450450
const client = new EnsApiClient();
451451

452-
await expect(client.config()).rejects.toThrow(/Fetching ENSNode Config Failed/i);
452+
await expect(client.config()).rejects.toThrow(/Fetching ENSApi Config Failed/i);
453453
});
454454
});
455455

@@ -479,7 +479,7 @@ describe("EnsApiClient", () => {
479479

480480
// act & assert
481481
await expect(client.indexingStatus()).rejects.toThrow(
482-
/Fetching ENSNode Indexing Status Failed/i,
482+
/Fetching ENSApi Indexing Status Failed/i,
483483
);
484484
});
485485
});

packages/ensnode-sdk/src/ensapi/client.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { ResolverRecordsSelection } from "../resolution";
22
import {
3-
type ConfigResponse,
4-
deserializeConfigResponse,
53
deserializedNameTokensResponse,
4+
deserializeEnsApiConfigResponse,
5+
deserializeEnsApiIndexingStatusResponse,
66
deserializeErrorResponse,
7-
deserializeIndexingStatusResponse,
87
deserializeRegistrarActionsResponse,
8+
type EnsApiConfigResponse,
9+
type EnsApiIndexingStatusResponse,
910
type ErrorResponse,
10-
type IndexingStatusResponse,
1111
type NameTokensRequest,
1212
type NameTokensResponse,
1313
type RegistrarActionsFilter,
@@ -22,8 +22,8 @@ import {
2222
type ResolvePrimaryNamesResponse,
2323
type ResolveRecordsRequest,
2424
type ResolveRecordsResponse,
25-
type SerializedConfigResponse,
26-
type SerializedIndexingStatusResponse,
25+
type SerializedEnsApiConfigResponse,
26+
type SerializedEnsApiIndexingStatusResponse,
2727
type SerializedNameTokensResponse,
2828
type SerializedRegistrarActionsResponse,
2929
} from "./api";
@@ -304,22 +304,22 @@ export class EnsApiClient {
304304
}
305305

306306
/**
307-
* Fetch ENSNode Config
307+
* Fetch ENSApi Config
308308
*
309-
* Fetch the ENSNode's configuration.
309+
* Fetch the ENSApi's configuration.
310310
*
311-
* @returns {ConfigResponse}
311+
* @returns {EnsApiConfigResponse}
312312
*
313-
* @throws if the ENSNode request fails
314-
* @throws if the ENSNode API returns an error response
315-
* @throws if the ENSNode response breaks required invariants
313+
* @throws if the ENSApi request fails
314+
* @throws if the ENSApi returns an error response
315+
* @throws if the ENSApi response breaks required invariants
316316
*/
317-
async config(): Promise<ConfigResponse> {
317+
async config(): Promise<EnsApiConfigResponse> {
318318
const url = new URL(`/api/config`, this.options.url);
319319

320320
const response = await fetch(url);
321321

322-
// ENSNode API should always allow parsing a response as JSON object.
322+
// ENSApi should always allow parsing a response as JSON object.
323323
// If for some reason it's not the case, throw an error.
324324
let responseData: unknown;
325325
try {
@@ -330,27 +330,27 @@ export class EnsApiClient {
330330

331331
if (!response.ok) {
332332
const errorResponse = deserializeErrorResponse(responseData);
333-
throw new Error(`Fetching ENSNode Config Failed: ${errorResponse.message}`);
333+
throw new Error(`Fetching ENSApi Config Failed: ${errorResponse.message}`);
334334
}
335335

336-
return deserializeConfigResponse(responseData as SerializedConfigResponse);
336+
return deserializeEnsApiConfigResponse(responseData as SerializedEnsApiConfigResponse);
337337
}
338338

339339
/**
340-
* Fetch ENSNode Indexing Status
340+
* Fetch ENSApi Indexing Status
341341
*
342-
* @returns {IndexingStatusResponse}
342+
* @returns {EnsApiIndexingStatusResponse}
343343
*
344-
* @throws if the ENSNode request fails
345-
* @throws if the ENSNode API returns an error response
346-
* @throws if the ENSNode response breaks required invariants
344+
* @throws if the ENSApi request fails
345+
* @throws if the ENSApi returns an error response
346+
* @throws if the ENSApi response breaks required invariants
347347
*/
348-
async indexingStatus(): Promise<IndexingStatusResponse> {
348+
async indexingStatus(): Promise<EnsApiIndexingStatusResponse> {
349349
const url = new URL(`/api/indexing-status`, this.options.url);
350350

351351
const response = await fetch(url);
352352

353-
// ENSNode API should always allow parsing a response as JSON object.
353+
// ENSApi should always allow parsing a response as JSON object.
354354
// If for some reason it's not the case, throw an error.
355355
let responseData: unknown;
356356
try {
@@ -374,11 +374,13 @@ export class EnsApiClient {
374374
// however, if errorResponse was defined,
375375
// throw an error with the generic server error message
376376
if (typeof errorResponse !== "undefined") {
377-
throw new Error(`Fetching ENSNode Indexing Status Failed: ${errorResponse.message}`);
377+
throw new Error(`Fetching ENSApi Indexing Status Failed: ${errorResponse.message}`);
378378
}
379379
}
380380

381-
return deserializeIndexingStatusResponse(responseData as SerializedIndexingStatusResponse);
381+
return deserializeEnsApiIndexingStatusResponse(
382+
responseData as SerializedEnsApiIndexingStatusResponse,
383+
);
382384
}
383385

384386
/**

0 commit comments

Comments
 (0)