@ensnode/ensnode-sdk 0.0.0-next-20260421160559 → 0.0.0-next-20260421205557
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +46 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -9
- package/dist/index.d.ts +89 -9
- package/dist/index.js +46 -18
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -162,7 +162,10 @@ __export(index_exports, {
|
|
|
162
162
|
hasSubgraphApiConfigSupport: () => hasSubgraphApiConfigSupport,
|
|
163
163
|
interpretAddress: () => interpretAddress,
|
|
164
164
|
interpretAddressRecordValue: () => interpretAddressRecordValue,
|
|
165
|
+
interpretContenthashValue: () => interpretContenthashValue,
|
|
166
|
+
interpretDnszonehashValue: () => interpretDnszonehashValue,
|
|
165
167
|
interpretNameRecordValue: () => interpretNameRecordValue,
|
|
168
|
+
interpretPubkeyValue: () => interpretPubkeyValue,
|
|
166
169
|
interpretTextRecordKey: () => interpretTextRecordKey,
|
|
167
170
|
interpretTextRecordValue: () => interpretTextRecordValue,
|
|
168
171
|
isENSv1Registry: () => isENSv1Registry,
|
|
@@ -2781,7 +2784,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2781
2784
|
|
|
2782
2785
|
// src/ensnode/api/shared/errors/zod-schemas.ts
|
|
2783
2786
|
var import_v430 = require("zod/v4");
|
|
2784
|
-
var
|
|
2787
|
+
var makeErrorResponseSchema = () => import_v430.z.object({
|
|
2785
2788
|
message: import_v430.z.string(),
|
|
2786
2789
|
details: import_v430.z.optional(import_v430.z.unknown())
|
|
2787
2790
|
});
|
|
@@ -2874,17 +2877,17 @@ var makeNameTokensResponseOkSchema = (valueLabel = "Name Tokens Response OK", se
|
|
|
2874
2877
|
var makeNameTokensResponseErrorNameTokensNotIndexedSchema = (_valueLabel = "Name Tokens Response Error Name Not Indexed") => import_v431.z.strictObject({
|
|
2875
2878
|
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2876
2879
|
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.NameTokensNotIndexed),
|
|
2877
|
-
error:
|
|
2880
|
+
error: makeErrorResponseSchema()
|
|
2878
2881
|
});
|
|
2879
2882
|
var makeNameTokensResponseErrorEnsIndexerConfigUnsupported = (_valueLabel = "Name Tokens Response Error ENSIndexer Config Unsupported") => import_v431.z.strictObject({
|
|
2880
2883
|
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2881
2884
|
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.EnsIndexerConfigUnsupported),
|
|
2882
|
-
error:
|
|
2885
|
+
error: makeErrorResponseSchema()
|
|
2883
2886
|
});
|
|
2884
2887
|
var makeNameTokensResponseErrorNameIndexingStatusUnsupported = (_valueLabel = "Name Tokens Response Error Indexing Status Unsupported") => import_v431.z.strictObject({
|
|
2885
2888
|
responseCode: import_v431.z.literal(NameTokensResponseCodes.Error),
|
|
2886
2889
|
errorCode: import_v431.z.literal(NameTokensResponseErrorCodes.IndexingStatusUnsupported),
|
|
2887
|
-
error:
|
|
2890
|
+
error: makeErrorResponseSchema()
|
|
2888
2891
|
});
|
|
2889
2892
|
var makeNameTokensResponseErrorSchema = (valueLabel = "Name Tokens Response Error") => import_v431.z.discriminatedUnion("errorCode", [
|
|
2890
2893
|
makeNameTokensResponseErrorNameTokensNotIndexedSchema(valueLabel),
|
|
@@ -3141,19 +3144,20 @@ function invariant_eventIdsInitialElementIsTheActionId(ctx) {
|
|
|
3141
3144
|
}
|
|
3142
3145
|
var EventIdSchema = import_v433.z.string().nonempty();
|
|
3143
3146
|
var EventIdsSchema = import_v433.z.array(EventIdSchema).min(1).transform((v) => v);
|
|
3144
|
-
var
|
|
3147
|
+
var makeBaseRegistrarActionSchemaWithoutCheck = (valueLabel = "Base Registrar Action") => import_v433.z.object({
|
|
3145
3148
|
id: EventIdSchema,
|
|
3146
3149
|
incrementalDuration: makeDurationSchema(`${valueLabel} Incremental Duration`),
|
|
3147
3150
|
registrant: makeNormalizedAddressSchema(`${valueLabel} Registrant`),
|
|
3148
|
-
registrationLifecycle: makeRegistrationLifecycleSchema(
|
|
3149
|
-
`${valueLabel} Registration Lifecycle`
|
|
3150
|
-
),
|
|
3151
|
+
registrationLifecycle: makeRegistrationLifecycleSchema(`${valueLabel} Registration Lifecycle`),
|
|
3151
3152
|
pricing: makeRegistrarActionPricingSchema(`${valueLabel} Pricing`),
|
|
3152
3153
|
referral: makeRegistrarActionReferralSchema(`${valueLabel} Referral`),
|
|
3153
3154
|
block: makeBlockRefSchema(`${valueLabel} Block`),
|
|
3154
3155
|
transactionHash: makeTransactionHashSchema(`${valueLabel} Transaction Hash`),
|
|
3155
3156
|
eventIds: EventIdsSchema
|
|
3156
|
-
})
|
|
3157
|
+
});
|
|
3158
|
+
var makeBaseRegistrarActionSchema = (valueLabel = "Base Registrar Action") => makeBaseRegistrarActionSchemaWithoutCheck(valueLabel).check(
|
|
3159
|
+
invariant_eventIdsInitialElementIsTheActionId
|
|
3160
|
+
);
|
|
3157
3161
|
var makeRegistrarActionRegistrationSchema = (valueLabel = "Registration ") => makeBaseRegistrarActionSchema(valueLabel).extend({
|
|
3158
3162
|
type: import_v433.z.literal(RegistrarActionTypes.Registration)
|
|
3159
3163
|
});
|
|
@@ -3184,9 +3188,7 @@ var makeResponsePageContextSchemaWithNoRecords = (valueLabel = "ResponsePageCont
|
|
|
3184
3188
|
totalRecords: import_v434.z.literal(0),
|
|
3185
3189
|
totalPages: import_v434.z.literal(1),
|
|
3186
3190
|
hasNext: import_v434.z.literal(false),
|
|
3187
|
-
hasPrev: import_v434.z.literal(false)
|
|
3188
|
-
startIndex: import_v434.z.undefined(),
|
|
3189
|
-
endIndex: import_v434.z.undefined()
|
|
3191
|
+
hasPrev: import_v434.z.literal(false)
|
|
3190
3192
|
}).extend(makeRequestPageParamsSchema(valueLabel).shape);
|
|
3191
3193
|
function invariant_responsePageWithRecordsIsCorrect(ctx) {
|
|
3192
3194
|
const { hasNext, hasPrev, recordsPerPage, page, totalRecords, startIndex, endIndex } = ctx.value;
|
|
@@ -3271,7 +3273,7 @@ var makeRegistrarActionsResponseOkSchema = (valueLabel = "Registrar Actions Resp
|
|
|
3271
3273
|
});
|
|
3272
3274
|
var makeRegistrarActionsResponseErrorSchema = (_valueLabel = "Registrar Actions Response Error") => import_v435.z.strictObject({
|
|
3273
3275
|
responseCode: import_v435.z.literal(RegistrarActionsResponseCodes.Error),
|
|
3274
|
-
error:
|
|
3276
|
+
error: makeErrorResponseSchema()
|
|
3275
3277
|
});
|
|
3276
3278
|
var makeRegistrarActionsResponseSchema = (valueLabel = "Registrar Actions Response") => import_v435.z.discriminatedUnion("responseCode", [
|
|
3277
3279
|
makeRegistrarActionsResponseOkSchema(valueLabel),
|
|
@@ -3423,7 +3425,7 @@ function serializeRegistrarActionsResponse(response) {
|
|
|
3423
3425
|
// src/ensnode/api/shared/errors/deserialize.ts
|
|
3424
3426
|
var import_v437 = require("zod/v4");
|
|
3425
3427
|
function deserializeErrorResponse2(maybeErrorResponse) {
|
|
3426
|
-
const parsed =
|
|
3428
|
+
const parsed = makeErrorResponseSchema().safeParse(maybeErrorResponse);
|
|
3427
3429
|
if (parsed.error) {
|
|
3428
3430
|
throw new Error(`Cannot deserialize ErrorResponse:
|
|
3429
3431
|
${(0, import_v437.prettifyError)(parsed.error)}
|
|
@@ -3552,15 +3554,21 @@ var EnsNodeClient = class _EnsNodeClient {
|
|
|
3552
3554
|
*/
|
|
3553
3555
|
async resolveRecords(name, selection, options) {
|
|
3554
3556
|
const url = new URL(`/api/resolve/records/${encodeURIComponent(name)}`, this.options.url);
|
|
3555
|
-
if (selection.name)
|
|
3556
|
-
|
|
3557
|
-
|
|
3557
|
+
if (selection.name) url.searchParams.set("name", "true");
|
|
3558
|
+
if (selection.contenthash) url.searchParams.set("contenthash", "true");
|
|
3559
|
+
if (selection.pubkey) url.searchParams.set("pubkey", "true");
|
|
3560
|
+
if (selection.dnszonehash) url.searchParams.set("dnszonehash", "true");
|
|
3561
|
+
if (selection.version) url.searchParams.set("version", "true");
|
|
3562
|
+
if (selection.abi !== void 0) url.searchParams.set("abi", selection.abi.toString());
|
|
3558
3563
|
if (selection.addresses && selection.addresses.length > 0) {
|
|
3559
3564
|
url.searchParams.set("addresses", selection.addresses.join(","));
|
|
3560
3565
|
}
|
|
3561
3566
|
if (selection.texts && selection.texts.length > 0) {
|
|
3562
3567
|
url.searchParams.set("texts", selection.texts.join(","));
|
|
3563
3568
|
}
|
|
3569
|
+
if (selection.interfaces && selection.interfaces.length > 0) {
|
|
3570
|
+
url.searchParams.set("interfaces", selection.interfaces.join(","));
|
|
3571
|
+
}
|
|
3564
3572
|
if (options?.trace) url.searchParams.set("trace", "true");
|
|
3565
3573
|
if (options?.accelerate) url.searchParams.set("accelerate", "true");
|
|
3566
3574
|
const response = await fetch(url);
|
|
@@ -3569,6 +3577,11 @@ var EnsNodeClient = class _EnsNodeClient {
|
|
|
3569
3577
|
throw ClientError.fromErrorResponse(error);
|
|
3570
3578
|
}
|
|
3571
3579
|
const data = await response.json();
|
|
3580
|
+
const records = data.records;
|
|
3581
|
+
if (typeof records.version === "string") records.version = BigInt(records.version);
|
|
3582
|
+
if (records.abi && typeof records.abi.contentType === "string") {
|
|
3583
|
+
records.abi.contentType = BigInt(records.abi.contentType);
|
|
3584
|
+
}
|
|
3572
3585
|
return data;
|
|
3573
3586
|
}
|
|
3574
3587
|
/**
|
|
@@ -4150,7 +4163,7 @@ var translateDefaultableChainIdToChainId = (chainId, namespaceId) => {
|
|
|
4150
4163
|
};
|
|
4151
4164
|
|
|
4152
4165
|
// src/resolution/resolver-records-selection.ts
|
|
4153
|
-
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length;
|
|
4166
|
+
var isSelectionEmpty = (selection) => !selection.name && !selection.addresses?.length && !selection.texts?.length && !selection.contenthash && !selection.pubkey && !selection.dnszonehash && selection.abi === void 0 && !selection.interfaces?.length && !selection.version;
|
|
4154
4167
|
|
|
4155
4168
|
// src/shared/cache/lru-cache.ts
|
|
4156
4169
|
var LruCache = class {
|
|
@@ -4532,6 +4545,21 @@ function interpretTextRecordValue(value) {
|
|
|
4532
4545
|
return value;
|
|
4533
4546
|
}
|
|
4534
4547
|
|
|
4548
|
+
// src/shared/interpretation/interpret-resolver-values.ts
|
|
4549
|
+
var import_viem11 = require("viem");
|
|
4550
|
+
function interpretContenthashValue(value) {
|
|
4551
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4552
|
+
return value;
|
|
4553
|
+
}
|
|
4554
|
+
function interpretPubkeyValue(x, y) {
|
|
4555
|
+
if (x === import_viem11.zeroHash && y === import_viem11.zeroHash) return null;
|
|
4556
|
+
return { x, y };
|
|
4557
|
+
}
|
|
4558
|
+
function interpretDnszonehashValue(value) {
|
|
4559
|
+
if ((0, import_viem11.size)(value) === 0) return null;
|
|
4560
|
+
return value;
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4535
4563
|
// src/shared/namespace-specific-value.ts
|
|
4536
4564
|
function getNamespaceSpecificValue(namespace, value) {
|
|
4537
4565
|
return value[namespace] ?? value.default;
|