indexer.getNamesByExpiry
Lists names by when they expire or leave their grace period. Parameters, return value, errors and examples for indexer.getNamesByExpiry in @ensforge/sdk.
Lists names by when they expire or leave their grace period.
When to use
Use to find names expiring soon, e.g. renewal reminders or a drop-catching list.
Details
- Pass either expiry bounds (
expiresAfter,expiresBefore,windows) or grace bounds (graceEndsAfter,graceEndsBefore,graceWindows), not both. - With
windows, each name reports the window it matched (windowIndex).
Signature
function getNamesByExpiry(
client: Like,
options: getNamesByExpiry.Options,
): Promise<getNamesByExpiry.ReturnType>Call it as ens.indexer.getNamesByExpiry(options) on a client, or Actions.indexer.getNamesByExpiry(client, options).
indexer.getNamesByExpiry.request(options) builds a deferred read for Actions.batch. See Look up many at once.
Parameters
| Option | Type | Default | Description |
|---|---|---|---|
limit | number | Rows per page, 1–200. @default 50 | |
cursor | string | The previous page's cursor. | |
includeTotal | boolean | Count every row (totalCount); slower. | |
expiresAfter | bigint | Date | ||
expiresBefore | bigint | Date | ||
windows | readonly Window[] | Up to 32 disjoint expiry windows; results report the matching windowIndex. | |
graceEndsAfter | bigint | Date | ||
graceEndsBefore | bigint | Date | ||
graceWindows | readonly Window[] | ||
authority | Authority | readonly Authority[] | ||
parent | string | ||
sort | "expiry" | "graceEnd" | Field the rows are sorted by. | |
order | "asc" | "desc" | Sort direction. | |
namespace | Namespace | "ens" |
Also takes the read options.
Returns
Resolves to Page<ExpiringName>. One page of names, soonest first unless order says otherwise.
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_NAME | parent does not normalize. |
ConfigError | INDEXER_NOT_CONFIGURED | the client has no indexer. |
IndexerError | INDEXER_UNSUPPORTED | the indexer does not serve the query or its namespace. |
IndexerError | INDEXER_UNAVAILABLE, INDEXER_RATE_LIMITED, INDEXER_BEHIND, INDEXER_REQUEST_REJECTED, INDEXER_RESPONSE_INVALID | the indexer is unavailable, rate limiting, behind, rejects the request or answers unexpectedly. |
It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).
See How errors work.
Examples
const page = await ens.indexer.getNamesByExpiry({ expiresAfter: new Date(), expiresBefore: inAMonth })Was this page helpful?