@ensnode/ensnode-sdk 0.0.0-next-20260217194807 → 0.0.0-next-20260217213247

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 CHANGED
@@ -55,6 +55,8 @@ __export(index_exports, {
55
55
  EXPECTED_ENCODED_REFERRER_PADDING: () => EXPECTED_ENCODED_REFERRER_PADDING,
56
56
  EnsApiClient: () => EnsApiClient,
57
57
  EnsApiIndexingStatusResponseCodes: () => EnsApiIndexingStatusResponseCodes,
58
+ EnsIndexerClient: () => EnsIndexerClient,
59
+ EnsIndexerIndexingStatusResponseCodes: () => EnsIndexerIndexingStatusResponseCodes,
58
60
  ForwardResolutionProtocolStep: () => ForwardResolutionProtocolStep,
59
61
  IndexingStatusResponseCodes: () => IndexingStatusResponseCodes,
60
62
  LINEANAMES_NODE: () => LINEANAMES_NODE,
@@ -130,6 +132,8 @@ __export(index_exports, {
130
132
  deserializeEnsApiConfigResponse: () => deserializeEnsApiConfigResponse,
131
133
  deserializeEnsApiIndexingStatusResponse: () => deserializeEnsApiIndexingStatusResponse,
132
134
  deserializeEnsApiPublicConfig: () => deserializeEnsApiPublicConfig,
135
+ deserializeEnsIndexerConfigResponse: () => deserializeEnsIndexerConfigResponse,
136
+ deserializeEnsIndexerIndexingStatusResponse: () => deserializeEnsIndexerIndexingStatusResponse,
133
137
  deserializeEnsIndexerPublicConfig: () => deserializeEnsIndexerPublicConfig,
134
138
  deserializeErrorResponse: () => deserializeErrorResponse,
135
139
  deserializeIndexingStatusResponse: () => deserializeIndexingStatusResponse,
@@ -259,6 +263,8 @@ __export(index_exports, {
259
263
  serializeEnsApiConfigResponse: () => serializeEnsApiConfigResponse,
260
264
  serializeEnsApiIndexingStatusResponse: () => serializeEnsApiIndexingStatusResponse,
261
265
  serializeEnsApiPublicConfig: () => serializeEnsApiPublicConfig,
266
+ serializeEnsIndexerConfigResponse: () => serializeEnsIndexerConfigResponse,
267
+ serializeEnsIndexerIndexingStatusResponse: () => serializeEnsIndexerIndexingStatusResponse,
262
268
  serializeEnsIndexerPublicConfig: () => serializeEnsIndexerPublicConfig,
263
269
  serializeIndexedChainIds: () => serializeIndexedChainIds,
264
270
  serializeIndexingStatusResponse: () => serializeIndexingStatusResponse,
@@ -3363,7 +3369,7 @@ var EnsApiClient = class _EnsApiClient {
3363
3369
  * @returns {EnsApiConfigResponse}
3364
3370
  *
3365
3371
  * @throws if the ENSApi request fails
3366
- * @throws if the ENSApi returns an error response
3372
+ * @throws if the ENSApi returns a non-ok response
3367
3373
  * @throws if the ENSApi response breaks required invariants
3368
3374
  */
3369
3375
  async config() {
@@ -3387,7 +3393,7 @@ var EnsApiClient = class _EnsApiClient {
3387
3393
  * @returns {EnsApiIndexingStatusResponse}
3388
3394
  *
3389
3395
  * @throws if the ENSApi request fails
3390
- * @throws if the ENSApi returns an error response
3396
+ * @throws if the ENSApi returns a non-ok response
3391
3397
  * @throws if the ENSApi response breaks required invariants
3392
3398
  */
3393
3399
  async indexingStatus() {
@@ -3404,7 +3410,6 @@ var EnsApiClient = class _EnsApiClient {
3404
3410
  try {
3405
3411
  errorResponse = deserializeErrorResponse(responseData);
3406
3412
  } catch {
3407
- console.log("Indexing Status API: handling a known indexing status server error.");
3408
3413
  }
3409
3414
  if (typeof errorResponse !== "undefined") {
3410
3415
  throw new Error(`Fetching ENSApi Indexing Status Failed: ${errorResponse.message}`);
@@ -3648,6 +3653,183 @@ var EnsApiClient = class _EnsApiClient {
3648
3653
  var ENSNodeClient = class extends EnsApiClient {
3649
3654
  };
3650
3655
 
3656
+ // src/ensindexer/api/config/deserialize.ts
3657
+ function deserializeEnsIndexerConfigResponse(maybeResponse) {
3658
+ return deserializeEnsIndexerPublicConfig(maybeResponse, "EnsIndexerConfigResponse");
3659
+ }
3660
+
3661
+ // src/ensindexer/api/config/serialize.ts
3662
+ function serializeEnsIndexerConfigResponse(response) {
3663
+ return serializeEnsIndexerPublicConfig(response);
3664
+ }
3665
+
3666
+ // src/ensindexer/api/indexing-status/deserialize.ts
3667
+ var import_v427 = require("zod/v4");
3668
+
3669
+ // src/ensindexer/api/indexing-status/response.ts
3670
+ var EnsIndexerIndexingStatusResponseCodes = {
3671
+ /**
3672
+ * Represents that the indexing status is available.
3673
+ */
3674
+ Ok: "ok",
3675
+ /**
3676
+ * Represents that the indexing status is unavailable.
3677
+ */
3678
+ Error: "error"
3679
+ };
3680
+
3681
+ // src/ensindexer/api/indexing-status/zod-schemas.ts
3682
+ var import_v426 = require("zod/v4");
3683
+ var makeEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Indexing Status Response OK") => import_v426.z.strictObject({
3684
+ responseCode: import_v426.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
3685
+ realtimeProjection: makeRealtimeIndexingStatusProjectionSchema(valueLabel)
3686
+ });
3687
+ var makeEnsIndexerIndexingStatusResponseErrorSchema = (_valueLabel = "Indexing Status Response Error") => import_v426.z.strictObject({
3688
+ responseCode: import_v426.z.literal(EnsIndexerIndexingStatusResponseCodes.Error)
3689
+ });
3690
+ var makeEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
3691
+ makeEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
3692
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
3693
+ ]);
3694
+ var makeSerializedEnsIndexerIndexingStatusResponseOkSchema = (valueLabel = "Serialized Indexing Status Response OK") => import_v426.z.strictObject({
3695
+ responseCode: import_v426.z.literal(EnsIndexerIndexingStatusResponseCodes.Ok),
3696
+ realtimeProjection: makeSerializedRealtimeIndexingStatusProjectionSchema(valueLabel)
3697
+ });
3698
+ var makeSerializedEnsIndexerIndexingStatusResponseSchema = (valueLabel = "Serialized Indexing Status Response") => import_v426.z.discriminatedUnion("responseCode", [
3699
+ makeSerializedEnsIndexerIndexingStatusResponseOkSchema(valueLabel),
3700
+ makeEnsIndexerIndexingStatusResponseErrorSchema(valueLabel)
3701
+ ]);
3702
+
3703
+ // src/ensindexer/api/indexing-status/deserialize.ts
3704
+ function buildUnvalidatedEnsIndexerIndexingStatusResponse(serializedResponse) {
3705
+ if (serializedResponse.responseCode !== EnsIndexerIndexingStatusResponseCodes.Ok) {
3706
+ return serializedResponse;
3707
+ }
3708
+ return {
3709
+ ...serializedResponse,
3710
+ realtimeProjection: buildUnvalidatedRealtimeIndexingStatusProjection(
3711
+ serializedResponse.realtimeProjection
3712
+ )
3713
+ };
3714
+ }
3715
+ function deserializeEnsIndexerIndexingStatusResponse(maybeResponse) {
3716
+ const parsed = makeSerializedEnsIndexerIndexingStatusResponseSchema().transform(buildUnvalidatedEnsIndexerIndexingStatusResponse).pipe(makeEnsIndexerIndexingStatusResponseSchema()).safeParse(maybeResponse);
3717
+ if (parsed.error) {
3718
+ throw new Error(
3719
+ `Cannot deserialize EnsIndexerIndexingStatusResponse:
3720
+ ${(0, import_v427.prettifyError)(parsed.error)}
3721
+ `
3722
+ );
3723
+ }
3724
+ return parsed.data;
3725
+ }
3726
+
3727
+ // src/ensindexer/api/indexing-status/serialize.ts
3728
+ function serializeEnsIndexerIndexingStatusResponse(response) {
3729
+ switch (response.responseCode) {
3730
+ case EnsIndexerIndexingStatusResponseCodes.Ok:
3731
+ return {
3732
+ responseCode: response.responseCode,
3733
+ realtimeProjection: serializeRealtimeIndexingStatusProjection(response.realtimeProjection)
3734
+ };
3735
+ case EnsIndexerIndexingStatusResponseCodes.Error:
3736
+ return response;
3737
+ }
3738
+ }
3739
+
3740
+ // src/ensindexer/api/shared/errors/deserialize.ts
3741
+ var import_v429 = require("zod/v4");
3742
+
3743
+ // src/ensindexer/api/shared/errors/zod-schemas.ts
3744
+ var import_v428 = require("zod/v4");
3745
+ var ErrorResponseSchema2 = import_v428.z.object({
3746
+ message: import_v428.z.string(),
3747
+ details: import_v428.z.optional(import_v428.z.unknown())
3748
+ });
3749
+
3750
+ // src/ensindexer/api/shared/errors/deserialize.ts
3751
+ function deserializeErrorResponse2(maybeErrorResponse) {
3752
+ const parsed = ErrorResponseSchema2.safeParse(maybeErrorResponse);
3753
+ if (parsed.error) {
3754
+ throw new Error(`Cannot deserialize ErrorResponse:
3755
+ ${(0, import_v429.prettifyError)(parsed.error)}
3756
+ `);
3757
+ }
3758
+ return parsed.data;
3759
+ }
3760
+
3761
+ // src/ensindexer/client.ts
3762
+ var EnsIndexerClient = class {
3763
+ constructor(options) {
3764
+ this.options = options;
3765
+ }
3766
+ getOptions() {
3767
+ return Object.freeze({
3768
+ url: new URL(this.options.url.href)
3769
+ });
3770
+ }
3771
+ /**
3772
+ * Fetch ENSIndexer Config
3773
+ *
3774
+ * Fetch the ENSIndexer's configuration.
3775
+ *
3776
+ * @returns {EnsIndexerConfigResponse}
3777
+ *
3778
+ * @throws if the ENSIndexer request fails
3779
+ * @throws if the ENSIndexer returns a non-ok response
3780
+ * @throws if the ENSIndexer response breaks required invariants
3781
+ */
3782
+ async config() {
3783
+ const url = new URL(`/api/config`, this.options.url);
3784
+ const response = await fetch(url);
3785
+ let responseData;
3786
+ try {
3787
+ responseData = await response.json();
3788
+ } catch {
3789
+ throw new Error("Malformed response data: invalid JSON");
3790
+ }
3791
+ if (!response.ok) {
3792
+ const errorResponse = deserializeErrorResponse2(responseData);
3793
+ throw new Error(`Fetching ENSIndexer Config Failed: ${errorResponse.message}`);
3794
+ }
3795
+ return deserializeEnsIndexerConfigResponse(
3796
+ responseData
3797
+ );
3798
+ }
3799
+ /**
3800
+ * Fetch ENSIndexer Indexing Status
3801
+ *
3802
+ * @returns {EnsIndexerIndexingStatusResponse}
3803
+ *
3804
+ * @throws if the ENSIndexer request fails
3805
+ * @throws if the ENSIndexer returns a non-ok response
3806
+ * @throws if the ENSIndexer response breaks required invariants
3807
+ */
3808
+ async indexingStatus() {
3809
+ const url = new URL(`/api/indexing-status`, this.options.url);
3810
+ const response = await fetch(url);
3811
+ let responseData;
3812
+ try {
3813
+ responseData = await response.json();
3814
+ } catch {
3815
+ throw new Error("Malformed response data: invalid JSON");
3816
+ }
3817
+ if (!response.ok) {
3818
+ let errorResponse;
3819
+ try {
3820
+ errorResponse = deserializeErrorResponse2(responseData);
3821
+ } catch {
3822
+ }
3823
+ if (typeof errorResponse !== "undefined") {
3824
+ throw new Error(`Fetching ENSIndexer Indexing Status Failed: ${errorResponse.message}`);
3825
+ }
3826
+ }
3827
+ return deserializeEnsIndexerIndexingStatusResponse(
3828
+ responseData
3829
+ );
3830
+ }
3831
+ };
3832
+
3651
3833
  // src/ensindexer/config/label-utils.ts
3652
3834
  var import_viem15 = require("viem");
3653
3835
  function labelHashToBytes(labelHash) {
@@ -3789,14 +3971,14 @@ function isResolvedIdentity(identity) {
3789
3971
  }
3790
3972
 
3791
3973
  // src/indexing-status/deserialize/chain-indexing-status-snapshot.ts
3792
- var import_v426 = require("zod/v4");
3974
+ var import_v430 = require("zod/v4");
3793
3975
  function deserializeChainIndexingStatusSnapshot(maybeSnapshot, valueLabel) {
3794
3976
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3795
3977
  const parsed = schema.safeParse(maybeSnapshot);
3796
3978
  if (parsed.error) {
3797
3979
  throw new Error(
3798
3980
  `Cannot deserialize into ChainIndexingStatusSnapshot:
3799
- ${(0, import_v426.prettifyError)(parsed.error)}
3981
+ ${(0, import_v430.prettifyError)(parsed.error)}
3800
3982
  `
3801
3983
  );
3802
3984
  }
@@ -3814,52 +3996,52 @@ function createRealtimeIndexingStatusProjection(snapshot, now) {
3814
3996
  }
3815
3997
 
3816
3998
  // src/indexing-status/validate/chain-indexing-status-snapshot.ts
3817
- var import_v427 = require("zod/v4");
3999
+ var import_v431 = require("zod/v4");
3818
4000
  function validateChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3819
4001
  const schema = makeChainIndexingStatusSnapshotSchema(valueLabel);
3820
4002
  const parsed = schema.safeParse(unvalidatedSnapshot);
3821
4003
  if (parsed.error) {
3822
4004
  throw new Error(`Invalid ChainIndexingStatusSnapshot:
3823
- ${(0, import_v427.prettifyError)(parsed.error)}
4005
+ ${(0, import_v431.prettifyError)(parsed.error)}
3824
4006
  `);
3825
4007
  }
3826
4008
  return parsed.data;
3827
4009
  }
3828
4010
 
3829
4011
  // src/indexing-status/validate/cross-chain-indexing-status-snapshot.ts
3830
- var import_v428 = require("zod/v4");
4012
+ var import_v432 = require("zod/v4");
3831
4013
  function validateCrossChainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3832
4014
  const schema = makeCrossChainIndexingStatusSnapshotSchema(valueLabel);
3833
4015
  const parsed = schema.safeParse(unvalidatedSnapshot);
3834
4016
  if (parsed.error) {
3835
4017
  throw new Error(`Invalid CrossChainIndexingStatusSnapshot:
3836
- ${(0, import_v428.prettifyError)(parsed.error)}
4018
+ ${(0, import_v432.prettifyError)(parsed.error)}
3837
4019
  `);
3838
4020
  }
3839
4021
  return parsed.data;
3840
4022
  }
3841
4023
 
3842
4024
  // src/indexing-status/validate/omnichain-indexing-status-snapshot.ts
3843
- var import_v429 = require("zod/v4");
4025
+ var import_v433 = require("zod/v4");
3844
4026
  function validateOmnichainIndexingStatusSnapshot(unvalidatedSnapshot, valueLabel) {
3845
4027
  const schema = makeOmnichainIndexingStatusSnapshotSchema(valueLabel);
3846
4028
  const parsed = schema.safeParse(unvalidatedSnapshot);
3847
4029
  if (parsed.error) {
3848
4030
  throw new Error(`Invalid OmnichainIndexingStatusSnapshot:
3849
- ${(0, import_v429.prettifyError)(parsed.error)}
4031
+ ${(0, import_v433.prettifyError)(parsed.error)}
3850
4032
  `);
3851
4033
  }
3852
4034
  return parsed.data;
3853
4035
  }
3854
4036
 
3855
4037
  // src/indexing-status/validate/realtime-indexing-status-projection.ts
3856
- var import_v430 = require("zod/v4");
4038
+ var import_v434 = require("zod/v4");
3857
4039
  function validateRealtimeIndexingStatusProjection(unvalidatedProjection, valueLabel) {
3858
4040
  const schema = makeRealtimeIndexingStatusProjectionSchema(valueLabel);
3859
4041
  const parsed = schema.safeParse(unvalidatedProjection);
3860
4042
  if (parsed.error) {
3861
4043
  throw new Error(`Invalid RealtimeIndexingStatusProjection:
3862
- ${(0, import_v430.prettifyError)(parsed.error)}
4044
+ ${(0, import_v434.prettifyError)(parsed.error)}
3863
4045
  `);
3864
4046
  }
3865
4047
  return parsed.data;
@@ -4037,13 +4219,13 @@ var import_getUnixTime2 = require("date-fns/getUnixTime");
4037
4219
  var import_getUnixTime = require("date-fns/getUnixTime");
4038
4220
 
4039
4221
  // src/shared/deserialize.ts
4040
- var import_v431 = __toESM(require("zod/v4"), 1);
4222
+ var import_v435 = __toESM(require("zod/v4"), 1);
4041
4223
  function deserializeChainId(maybeChainId, valueLabel) {
4042
4224
  const schema = makeChainIdStringSchema(valueLabel);
4043
4225
  const parsed = schema.safeParse(maybeChainId);
4044
4226
  if (parsed.error) {
4045
4227
  throw new Error(`Cannot deserialize ChainId:
4046
- ${(0, import_v431.prettifyError)(parsed.error)}
4228
+ ${(0, import_v435.prettifyError)(parsed.error)}
4047
4229
  `);
4048
4230
  }
4049
4231
  return parsed.data;
@@ -4053,7 +4235,7 @@ function deserializeDatetime(maybeDatetime, valueLabel) {
4053
4235
  const parsed = schema.safeParse(maybeDatetime);
4054
4236
  if (parsed.error) {
4055
4237
  throw new Error(`Cannot deserialize Datetime:
4056
- ${(0, import_v431.prettifyError)(parsed.error)}
4238
+ ${(0, import_v435.prettifyError)(parsed.error)}
4057
4239
  `);
4058
4240
  }
4059
4241
  return parsed.data;
@@ -4063,7 +4245,7 @@ function deserializeUnixTimestamp(maybeTimestamp, valueLabel) {
4063
4245
  const parsed = schema.safeParse(maybeTimestamp);
4064
4246
  if (parsed.error) {
4065
4247
  throw new Error(`Cannot deserialize Unix Timestamp:
4066
- ${(0, import_v431.prettifyError)(parsed.error)}
4248
+ ${(0, import_v435.prettifyError)(parsed.error)}
4067
4249
  `);
4068
4250
  }
4069
4251
  return parsed.data;
@@ -4073,7 +4255,7 @@ function deserializeUrl(maybeUrl, valueLabel) {
4073
4255
  const parsed = schema.safeParse(maybeUrl);
4074
4256
  if (parsed.error) {
4075
4257
  throw new Error(`Cannot deserialize URL:
4076
- ${(0, import_v431.prettifyError)(parsed.error)}
4258
+ ${(0, import_v435.prettifyError)(parsed.error)}
4077
4259
  `);
4078
4260
  }
4079
4261
  return parsed.data;
@@ -4083,7 +4265,7 @@ function deserializeBlockNumber(maybeBlockNumber, valueLabel) {
4083
4265
  const parsed = schema.safeParse(maybeBlockNumber);
4084
4266
  if (parsed.error) {
4085
4267
  throw new Error(`Cannot deserialize BlockNumber:
4086
- ${(0, import_v431.prettifyError)(parsed.error)}
4268
+ ${(0, import_v435.prettifyError)(parsed.error)}
4087
4269
  `);
4088
4270
  }
4089
4271
  return parsed.data;
@@ -4093,7 +4275,7 @@ function deserializeBlockrange(maybeBlockrange, valueLabel) {
4093
4275
  const parsed = schema.safeParse(maybeBlockrange);
4094
4276
  if (parsed.error) {
4095
4277
  throw new Error(`Cannot deserialize Blockrange:
4096
- ${(0, import_v431.prettifyError)(parsed.error)}
4278
+ ${(0, import_v435.prettifyError)(parsed.error)}
4097
4279
  `);
4098
4280
  }
4099
4281
  return parsed.data;
@@ -4103,17 +4285,17 @@ function deserializeBlockRef(maybeBlockRef, valueLabel) {
4103
4285
  const parsed = schema.safeParse(maybeBlockRef);
4104
4286
  if (parsed.error) {
4105
4287
  throw new Error(`Cannot deserialize BlockRef:
4106
- ${(0, import_v431.prettifyError)(parsed.error)}
4288
+ ${(0, import_v435.prettifyError)(parsed.error)}
4107
4289
  `);
4108
4290
  }
4109
4291
  return parsed.data;
4110
4292
  }
4111
4293
  function deserializeDuration(maybeDuration, valueLabel) {
4112
- const schema = import_v431.default.coerce.number().pipe(makeDurationSchema(valueLabel));
4294
+ const schema = import_v435.default.coerce.number().pipe(makeDurationSchema(valueLabel));
4113
4295
  const parsed = schema.safeParse(maybeDuration);
4114
4296
  if (parsed.error) {
4115
4297
  throw new RangeError(`Cannot deserialize Duration:
4116
- ${(0, import_v431.prettifyError)(parsed.error)}
4298
+ ${(0, import_v435.prettifyError)(parsed.error)}
4117
4299
  `);
4118
4300
  }
4119
4301
  return parsed.data;
@@ -4123,7 +4305,7 @@ function parseAccountId(maybeAccountId, valueLabel) {
4123
4305
  const parsed = schema.safeParse(maybeAccountId);
4124
4306
  if (parsed.error) {
4125
4307
  throw new RangeError(`Cannot deserialize AccountId:
4126
- ${(0, import_v431.prettifyError)(parsed.error)}
4308
+ ${(0, import_v435.prettifyError)(parsed.error)}
4127
4309
  `);
4128
4310
  }
4129
4311
  return parsed.data;
@@ -4133,7 +4315,7 @@ function deserializePriceEth(maybePrice, valueLabel) {
4133
4315
  const parsed = schema.safeParse(maybePrice);
4134
4316
  if (parsed.error) {
4135
4317
  throw new Error(`Cannot deserialize PriceEth:
4136
- ${(0, import_v431.prettifyError)(parsed.error)}
4318
+ ${(0, import_v435.prettifyError)(parsed.error)}
4137
4319
  `);
4138
4320
  }
4139
4321
  return parsed.data;
@@ -4143,7 +4325,7 @@ function deserializePriceUsdc(maybePrice, valueLabel) {
4143
4325
  const parsed = schema.safeParse(maybePrice);
4144
4326
  if (parsed.error) {
4145
4327
  throw new Error(`Cannot deserialize PriceUsdc:
4146
- ${(0, import_v431.prettifyError)(parsed.error)}
4328
+ ${(0, import_v435.prettifyError)(parsed.error)}
4147
4329
  `);
4148
4330
  }
4149
4331
  return parsed.data;
@@ -4153,7 +4335,7 @@ function deserializePriceDai(maybePrice, valueLabel) {
4153
4335
  const parsed = schema.safeParse(maybePrice);
4154
4336
  if (parsed.error) {
4155
4337
  throw new Error(`Cannot deserialize PriceDai:
4156
- ${(0, import_v431.prettifyError)(parsed.error)}
4338
+ ${(0, import_v435.prettifyError)(parsed.error)}
4157
4339
  `);
4158
4340
  }
4159
4341
  return parsed.data;