@ensnode/ensnode-sdk 0.0.0-next-20260227185030 → 0.0.0-next-20260228175526
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 +198 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -79
- package/dist/index.d.ts +168 -79
- package/dist/index.js +149 -89
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(index_exports, {
|
|
|
36
36
|
ATTR_PROTOCOL_STEP_RESULT: () => ATTR_PROTOCOL_STEP_RESULT,
|
|
37
37
|
AssetNamespaces: () => AssetNamespaces,
|
|
38
38
|
BASENAMES_NODE: () => BASENAMES_NODE,
|
|
39
|
-
BlockRefRangeTypeIds: () => BlockRefRangeTypeIds,
|
|
40
39
|
ChainIndexingStatusIds: () => ChainIndexingStatusIds,
|
|
41
40
|
ClientError: () => ClientError,
|
|
42
41
|
CrossChainIndexingStrategyIds: () => CrossChainIndexingStrategyIds,
|
|
@@ -75,6 +74,7 @@ __export(index_exports, {
|
|
|
75
74
|
RECORDS_PER_PAGE_MAX: () => RECORDS_PER_PAGE_MAX,
|
|
76
75
|
ROOT_NODE: () => ROOT_NODE,
|
|
77
76
|
ROOT_RESOURCE: () => ROOT_RESOURCE,
|
|
77
|
+
RangeTypeIds: () => RangeTypeIds,
|
|
78
78
|
RegistrarActionTypes: () => RegistrarActionTypes,
|
|
79
79
|
RegistrarActionsFilterTypes: () => RegistrarActionsFilterTypes,
|
|
80
80
|
RegistrarActionsOrders: () => RegistrarActionsOrders,
|
|
@@ -96,6 +96,8 @@ __export(index_exports, {
|
|
|
96
96
|
bigIntToNumber: () => bigIntToNumber,
|
|
97
97
|
bigintToCoinType: () => bigintToCoinType,
|
|
98
98
|
buildAssetId: () => buildAssetId,
|
|
99
|
+
buildBlockNumberRange: () => buildBlockNumberRange,
|
|
100
|
+
buildBlockRefRange: () => buildBlockRefRange,
|
|
99
101
|
buildEncodedReferrer: () => buildEncodedReferrer,
|
|
100
102
|
buildEnsRainbowClientLabelSet: () => buildEnsRainbowClientLabelSet,
|
|
101
103
|
buildLabelSetId: () => buildLabelSetId,
|
|
@@ -113,7 +115,6 @@ __export(index_exports, {
|
|
|
113
115
|
coinTypeReverseLabel: () => coinTypeReverseLabel,
|
|
114
116
|
coinTypeToEvmChainId: () => coinTypeToEvmChainId,
|
|
115
117
|
constructSubInterpretedName: () => constructSubInterpretedName,
|
|
116
|
-
createIndexingConfig: () => createIndexingConfig,
|
|
117
118
|
createRealtimeIndexingStatusProjection: () => createRealtimeIndexingStatusProjection,
|
|
118
119
|
decodeDNSEncodedLiteralName: () => decodeDNSEncodedLiteralName,
|
|
119
120
|
decodeDNSEncodedName: () => decodeDNSEncodedName,
|
|
@@ -121,7 +122,6 @@ __export(index_exports, {
|
|
|
121
122
|
deserializeAssetId: () => deserializeAssetId,
|
|
122
123
|
deserializeBlockNumber: () => deserializeBlockNumber,
|
|
123
124
|
deserializeBlockRef: () => deserializeBlockRef,
|
|
124
|
-
deserializeBlockrange: () => deserializeBlockrange,
|
|
125
125
|
deserializeChainId: () => deserializeChainId,
|
|
126
126
|
deserializeChainIndexingStatusSnapshot: () => deserializeChainIndexingStatusSnapshot,
|
|
127
127
|
deserializeConfigResponse: () => deserializeConfigResponse,
|
|
@@ -237,7 +237,10 @@ __export(index_exports, {
|
|
|
237
237
|
parseAccountId: () => parseAccountId,
|
|
238
238
|
parseAssetId: () => parseAssetId,
|
|
239
239
|
parseDai: () => parseDai,
|
|
240
|
+
parseEncodedLabelHash: () => parseEncodedLabelHash,
|
|
240
241
|
parseEth: () => parseEth,
|
|
242
|
+
parseLabelHash: () => parseLabelHash,
|
|
243
|
+
parseLabelHashOrEncodedLabelHash: () => parseLabelHashOrEncodedLabelHash,
|
|
241
244
|
parseNonNegativeInteger: () => parseNonNegativeInteger,
|
|
242
245
|
parsePartialInterpretedName: () => parsePartialInterpretedName,
|
|
243
246
|
parseReverseName: () => parseReverseName,
|
|
@@ -425,8 +428,38 @@ var beautifyName = (name) => {
|
|
|
425
428
|
return beautifiedLabels.join(".");
|
|
426
429
|
};
|
|
427
430
|
|
|
428
|
-
// src/ens/parse-
|
|
431
|
+
// src/ens/parse-labelhash.ts
|
|
429
432
|
var import_viem4 = require("viem");
|
|
433
|
+
function parseLabelHash(maybeLabelHash) {
|
|
434
|
+
const hexPart = maybeLabelHash.startsWith("0x") ? maybeLabelHash.slice(2) : maybeLabelHash;
|
|
435
|
+
if (!(0, import_viem4.isHex)(`0x${hexPart}`, { strict: true })) {
|
|
436
|
+
throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);
|
|
437
|
+
}
|
|
438
|
+
const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;
|
|
439
|
+
if (normalizedHexPart.length !== 64) {
|
|
440
|
+
throw new Error(
|
|
441
|
+
`Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
return `0x${normalizedHexPart.toLowerCase()}`;
|
|
445
|
+
}
|
|
446
|
+
function parseEncodedLabelHash(maybeEncodedLabelHash) {
|
|
447
|
+
if (!maybeEncodedLabelHash.startsWith("[") || !maybeEncodedLabelHash.endsWith("]")) {
|
|
448
|
+
throw new Error(
|
|
449
|
+
`Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));
|
|
453
|
+
}
|
|
454
|
+
function parseLabelHashOrEncodedLabelHash(maybeLabelHash) {
|
|
455
|
+
if (maybeLabelHash.startsWith("[") && maybeLabelHash.endsWith("]")) {
|
|
456
|
+
return parseEncodedLabelHash(maybeLabelHash);
|
|
457
|
+
}
|
|
458
|
+
return parseLabelHash(maybeLabelHash);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// src/ens/parse-reverse-name.ts
|
|
462
|
+
var import_viem5 = require("viem");
|
|
430
463
|
|
|
431
464
|
// src/shared/address.ts
|
|
432
465
|
function asLowerCaseAddress(address) {
|
|
@@ -437,7 +470,7 @@ function asLowerCaseAddress(address) {
|
|
|
437
470
|
var REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\.([0-9a-f]{1,64}|addr|default)\.reverse$/;
|
|
438
471
|
var parseAddressLabel = (addressLabel) => {
|
|
439
472
|
const maybeAddress = `0x${addressLabel}`;
|
|
440
|
-
if (!(0,
|
|
473
|
+
if (!(0, import_viem5.isAddress)(maybeAddress)) {
|
|
441
474
|
throw new Error(`Invalid EVM address "${maybeAddress}"`);
|
|
442
475
|
}
|
|
443
476
|
return asLowerCaseAddress(maybeAddress);
|
|
@@ -445,7 +478,7 @@ var parseAddressLabel = (addressLabel) => {
|
|
|
445
478
|
var parseCoinTypeLabel = (coinTypeLabel) => {
|
|
446
479
|
if (coinTypeLabel === "default") return DEFAULT_EVM_COIN_TYPE;
|
|
447
480
|
if (coinTypeLabel === "addr") return ETH_COIN_TYPE;
|
|
448
|
-
return bigintToCoinType((0,
|
|
481
|
+
return bigintToCoinType((0, import_viem5.hexToBigInt)(`0x${coinTypeLabel}`));
|
|
449
482
|
};
|
|
450
483
|
function parseReverseName(name) {
|
|
451
484
|
const match = name.match(REVERSE_NAME_REGEX);
|
|
@@ -482,9 +515,9 @@ function reverseName(address, coinType) {
|
|
|
482
515
|
}
|
|
483
516
|
|
|
484
517
|
// src/ens/subname-helpers.ts
|
|
485
|
-
var
|
|
486
|
-
var makeSubdomainNode = (labelHash, node) => (0,
|
|
487
|
-
var uint256ToHex32 = (num) => (0,
|
|
518
|
+
var import_viem6 = require("viem");
|
|
519
|
+
var makeSubdomainNode = (labelHash, node) => (0, import_viem6.keccak256)((0, import_viem6.concat)([node, labelHash]));
|
|
520
|
+
var uint256ToHex32 = (num) => (0, import_viem6.toHex)(num, { size: 32 });
|
|
488
521
|
|
|
489
522
|
// src/ens/types.ts
|
|
490
523
|
var import_datasources = require("@ensnode/datasources");
|
|
@@ -503,11 +536,11 @@ var uniq = (arr) => [...new Set(arr)];
|
|
|
503
536
|
|
|
504
537
|
// src/shared/zod-schemas.ts
|
|
505
538
|
var import_caip = require("caip");
|
|
506
|
-
var
|
|
539
|
+
var import_viem9 = require("viem");
|
|
507
540
|
var import_v4 = require("zod/v4");
|
|
508
541
|
|
|
509
542
|
// src/shared/currencies.ts
|
|
510
|
-
var
|
|
543
|
+
var import_viem7 = require("viem");
|
|
511
544
|
|
|
512
545
|
// src/shared/numbers.ts
|
|
513
546
|
function bigIntToNumber(n) {
|
|
@@ -642,24 +675,24 @@ function validateAmountToParse(value) {
|
|
|
642
675
|
function parseEth(value) {
|
|
643
676
|
validateAmountToParse(value);
|
|
644
677
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.ETH);
|
|
645
|
-
const amount = (0,
|
|
678
|
+
const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
|
|
646
679
|
return priceEth(amount);
|
|
647
680
|
}
|
|
648
681
|
function parseUsdc(value) {
|
|
649
682
|
validateAmountToParse(value);
|
|
650
683
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.USDC);
|
|
651
|
-
const amount = (0,
|
|
684
|
+
const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
|
|
652
685
|
return priceUsdc(amount);
|
|
653
686
|
}
|
|
654
687
|
function parseDai(value) {
|
|
655
688
|
validateAmountToParse(value);
|
|
656
689
|
const currencyInfo2 = getCurrencyInfo(CurrencyIds.DAI);
|
|
657
|
-
const amount = (0,
|
|
690
|
+
const amount = (0, import_viem7.parseUnits)(value, currencyInfo2.decimals);
|
|
658
691
|
return priceDai(amount);
|
|
659
692
|
}
|
|
660
693
|
|
|
661
694
|
// src/shared/interpretation/reinterpretation.ts
|
|
662
|
-
var
|
|
695
|
+
var import_viem8 = require("viem");
|
|
663
696
|
function reinterpretLabel(label) {
|
|
664
697
|
if (label === "") {
|
|
665
698
|
throw new Error(
|
|
@@ -668,7 +701,7 @@ function reinterpretLabel(label) {
|
|
|
668
701
|
}
|
|
669
702
|
if (isEncodedLabelHash(label)) return label;
|
|
670
703
|
if (isNormalizedLabel(label)) return label;
|
|
671
|
-
return encodeLabelHash((0,
|
|
704
|
+
return encodeLabelHash((0, import_viem8.labelhash)(label));
|
|
672
705
|
}
|
|
673
706
|
function reinterpretName(name) {
|
|
674
707
|
if (name === "") return name;
|
|
@@ -694,7 +727,7 @@ var makeDurationSchema = (valueLabel = "Value") => import_v4.z.number({
|
|
|
694
727
|
var makeChainIdSchema = (valueLabel = "Chain ID") => makePositiveIntegerSchema(valueLabel).transform((val) => val);
|
|
695
728
|
var makeChainIdStringSchema = (valueLabel = "Chain ID String") => import_v4.z.string({ error: `${valueLabel} must be a string representing a chain ID.` }).pipe(import_v4.z.coerce.number({ error: `${valueLabel} must represent a positive integer (>0).` })).pipe(makeChainIdSchema(`The numeric value represented by ${valueLabel}`));
|
|
696
729
|
var makeLowercaseAddressSchema = (valueLabel = "EVM address") => import_v4.z.string().check((ctx) => {
|
|
697
|
-
if (!(0,
|
|
730
|
+
if (!(0, import_viem9.isAddress)(ctx.value)) {
|
|
698
731
|
ctx.issues.push({
|
|
699
732
|
code: "custom",
|
|
700
733
|
message: `${valueLabel} must be a valid EVM address`,
|
|
@@ -709,23 +742,6 @@ var makeUrlSchema = (valueLabel = "Value") => import_v4.z.url({
|
|
|
709
742
|
abort: true
|
|
710
743
|
}).transform((v) => new URL(v));
|
|
711
744
|
var makeBlockNumberSchema = (valueLabel = "Block number") => makeNonNegativeIntegerSchema(valueLabel);
|
|
712
|
-
var makeBlockrangeSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
713
|
-
{
|
|
714
|
-
startBlock: makeBlockNumberSchema(`${valueLabel}.startBlock`).optional(),
|
|
715
|
-
endBlock: makeBlockNumberSchema(`${valueLabel}.endBlock`).optional()
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
error: `${valueLabel} must be a valid Blockrange object.`
|
|
719
|
-
}
|
|
720
|
-
).refine(
|
|
721
|
-
(v) => {
|
|
722
|
-
if (v.startBlock && v.endBlock) {
|
|
723
|
-
return v.startBlock <= v.endBlock;
|
|
724
|
-
}
|
|
725
|
-
return true;
|
|
726
|
-
},
|
|
727
|
-
{ error: `${valueLabel}: startBlock must be before or equal to endBlock` }
|
|
728
|
-
);
|
|
729
745
|
var makeBlockRefSchema = (valueLabel = "Value") => import_v4.z.strictObject(
|
|
730
746
|
{
|
|
731
747
|
timestamp: makeUnixTimestampSchema(`${valueLabel}.timestamp`),
|
|
@@ -766,7 +782,7 @@ var makeAccountIdStringSchema = (valueLabel = "Account ID String") => import_v4.
|
|
|
766
782
|
};
|
|
767
783
|
}).pipe(makeAccountIdSchema(valueLabel));
|
|
768
784
|
var makeHexStringSchema = (options, valueLabel = "String representation of bytes array") => import_v4.z.string().check(function invariant_isHexEncoded(ctx) {
|
|
769
|
-
if (!(0,
|
|
785
|
+
if (!(0, import_viem9.isHex)(ctx.value)) {
|
|
770
786
|
ctx.issues.push({
|
|
771
787
|
code: "custom",
|
|
772
788
|
input: ctx.value,
|
|
@@ -775,7 +791,7 @@ var makeHexStringSchema = (options, valueLabel = "String representation of bytes
|
|
|
775
791
|
}
|
|
776
792
|
}).transform((v) => v).check(function invariant_encodesRequiredBytesCount(ctx) {
|
|
777
793
|
const expectedBytesCount = options.bytesCount;
|
|
778
|
-
const actualBytesCount = (0,
|
|
794
|
+
const actualBytesCount = (0, import_viem9.size)(ctx.value);
|
|
779
795
|
if (actualBytesCount !== expectedBytesCount) {
|
|
780
796
|
ctx.issues.push({
|
|
781
797
|
code: "custom",
|
|
@@ -1067,17 +1083,88 @@ var import_v410 = require("zod/v4");
|
|
|
1067
1083
|
// src/indexing-status/zod-schema/cross-chain-indexing-status-snapshot.ts
|
|
1068
1084
|
var import_v49 = require("zod/v4");
|
|
1069
1085
|
|
|
1070
|
-
// src/
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1086
|
+
// src/shared/block-ref.ts
|
|
1087
|
+
function isBefore(blockA, blockB) {
|
|
1088
|
+
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1089
|
+
}
|
|
1090
|
+
function isEqualTo(blockA, blockB) {
|
|
1091
|
+
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1092
|
+
}
|
|
1093
|
+
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1094
|
+
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// src/shared/blockrange.ts
|
|
1098
|
+
var RangeTypeIds = {
|
|
1099
|
+
Unbounded: "unbounded",
|
|
1100
|
+
LeftBounded: "left-bounded",
|
|
1101
|
+
RightBounded: "right-bounded",
|
|
1102
|
+
Bounded: "bounded"
|
|
1080
1103
|
};
|
|
1104
|
+
function buildBlockNumberRange(startBlock, endBlock) {
|
|
1105
|
+
if (startBlock === void 0 && endBlock === void 0) {
|
|
1106
|
+
return {
|
|
1107
|
+
rangeType: RangeTypeIds.Unbounded
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
if (startBlock !== void 0 && endBlock === void 0) {
|
|
1111
|
+
return {
|
|
1112
|
+
rangeType: RangeTypeIds.LeftBounded,
|
|
1113
|
+
startBlock
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
if (startBlock === void 0 && endBlock !== void 0) {
|
|
1117
|
+
return {
|
|
1118
|
+
rangeType: RangeTypeIds.RightBounded,
|
|
1119
|
+
endBlock
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
if (startBlock !== void 0 && endBlock !== void 0) {
|
|
1123
|
+
if (startBlock > endBlock) {
|
|
1124
|
+
throw new Error(
|
|
1125
|
+
`For a block number range startBlock must be lower than or equal to endBlock.`
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
return {
|
|
1129
|
+
rangeType: RangeTypeIds.Bounded,
|
|
1130
|
+
startBlock,
|
|
1131
|
+
endBlock
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
throw new Error("Invalid block number range. This should be unreachable.");
|
|
1135
|
+
}
|
|
1136
|
+
function buildBlockRefRange(startBlock, endBlock) {
|
|
1137
|
+
if (startBlock === void 0 && endBlock === void 0) {
|
|
1138
|
+
return {
|
|
1139
|
+
rangeType: RangeTypeIds.Unbounded
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
if (startBlock !== void 0 && endBlock === void 0) {
|
|
1143
|
+
return {
|
|
1144
|
+
rangeType: RangeTypeIds.LeftBounded,
|
|
1145
|
+
startBlock
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
if (startBlock === void 0 && endBlock !== void 0) {
|
|
1149
|
+
return {
|
|
1150
|
+
rangeType: RangeTypeIds.RightBounded,
|
|
1151
|
+
endBlock
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
if (startBlock !== void 0 && endBlock !== void 0) {
|
|
1155
|
+
if (isBeforeOrEqualTo(startBlock, endBlock) === false) {
|
|
1156
|
+
throw new Error(`For a block ref range startBlock must be before or equal to endBlock.`);
|
|
1157
|
+
}
|
|
1158
|
+
return {
|
|
1159
|
+
rangeType: RangeTypeIds.Bounded,
|
|
1160
|
+
startBlock,
|
|
1161
|
+
endBlock
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
throw new Error("Invalid block ref range. This should be unreachable.");
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// src/indexing-status/chain-indexing-status-snapshot.ts
|
|
1081
1168
|
var ChainIndexingStatusIds = {
|
|
1082
1169
|
/**
|
|
1083
1170
|
* Represents that indexing of the chain is not ready to begin yet because:
|
|
@@ -1109,19 +1196,6 @@ var ChainIndexingStatusIds = {
|
|
|
1109
1196
|
*/
|
|
1110
1197
|
Completed: "chain-completed"
|
|
1111
1198
|
};
|
|
1112
|
-
function createIndexingConfig(startBlock, endBlock) {
|
|
1113
|
-
if (endBlock) {
|
|
1114
|
-
return {
|
|
1115
|
-
blockRangeType: BlockRefRangeTypeIds.Definite,
|
|
1116
|
-
startBlock,
|
|
1117
|
-
endBlock
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
return {
|
|
1121
|
-
blockRangeType: BlockRefRangeTypeIds.Indefinite,
|
|
1122
|
-
startBlock
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
1199
|
function getTimestampForLowestOmnichainStartBlock(chains) {
|
|
1126
1200
|
const earliestKnownBlockTimestamps = chains.map(
|
|
1127
1201
|
(chain) => chain.config.startBlock.timestamp
|
|
@@ -1138,7 +1212,7 @@ function getTimestampForHighestOmnichainKnownBlock(chains) {
|
|
|
1138
1212
|
for (const chain of chains) {
|
|
1139
1213
|
switch (chain.chainStatus) {
|
|
1140
1214
|
case ChainIndexingStatusIds.Queued:
|
|
1141
|
-
if (chain.config.
|
|
1215
|
+
if (chain.config.rangeType === RangeTypeIds.Bounded) {
|
|
1142
1216
|
latestKnownBlockTimestamps.push(chain.config.endBlock.timestamp);
|
|
1143
1217
|
}
|
|
1144
1218
|
break;
|
|
@@ -1281,22 +1355,9 @@ function getOmnichainIndexingCursor(chains) {
|
|
|
1281
1355
|
|
|
1282
1356
|
// src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1283
1357
|
var import_v47 = require("zod/v4");
|
|
1284
|
-
|
|
1285
|
-
// src/shared/block-ref.ts
|
|
1286
|
-
function isBefore(blockA, blockB) {
|
|
1287
|
-
return blockA.number < blockB.number && blockA.timestamp < blockB.timestamp;
|
|
1288
|
-
}
|
|
1289
|
-
function isEqualTo(blockA, blockB) {
|
|
1290
|
-
return blockA.number === blockB.number && blockA.timestamp === blockB.timestamp;
|
|
1291
|
-
}
|
|
1292
|
-
function isBeforeOrEqualTo(blockA, blockB) {
|
|
1293
|
-
return isBefore(blockA, blockB) || isEqualTo(blockA, blockB);
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
// src/indexing-status/zod-schema/chain-indexing-status-snapshot.ts
|
|
1297
1358
|
function invariant_chainSnapshotQueuedBlocks(ctx) {
|
|
1298
1359
|
const { config } = ctx.value;
|
|
1299
|
-
if (config.
|
|
1360
|
+
if (config.rangeType === RangeTypeIds.LeftBounded) {
|
|
1300
1361
|
return;
|
|
1301
1362
|
}
|
|
1302
1363
|
if (isBeforeOrEqualTo(config.startBlock, config.endBlock) === false) {
|
|
@@ -1323,7 +1384,7 @@ function invariant_chainSnapshotBackfillBlocks(ctx) {
|
|
|
1323
1384
|
message: "`latestIndexedBlock` must be before or same as `backfillEndBlock`."
|
|
1324
1385
|
});
|
|
1325
1386
|
}
|
|
1326
|
-
if (config.
|
|
1387
|
+
if (config.rangeType === RangeTypeIds.LeftBounded) {
|
|
1327
1388
|
return;
|
|
1328
1389
|
}
|
|
1329
1390
|
if (isEqualTo(backfillEndBlock, config.endBlock) === false) {
|
|
@@ -1368,31 +1429,40 @@ function invariant_chainSnapshotFollowingBlocks(ctx) {
|
|
|
1368
1429
|
});
|
|
1369
1430
|
}
|
|
1370
1431
|
}
|
|
1371
|
-
var makeBlockRefRangeSchema = (valueLabel = "Value") => import_v47.z.discriminatedUnion("blockRangeType", [
|
|
1372
|
-
import_v47.z.object({
|
|
1373
|
-
blockRangeType: import_v47.z.literal(BlockRefRangeTypeIds.Indefinite),
|
|
1374
|
-
startBlock: makeBlockRefSchema(valueLabel)
|
|
1375
|
-
}),
|
|
1376
|
-
import_v47.z.object({
|
|
1377
|
-
blockRangeType: import_v47.z.literal(BlockRefRangeTypeIds.Definite),
|
|
1378
|
-
startBlock: makeBlockRefSchema(valueLabel),
|
|
1379
|
-
endBlock: makeBlockRefSchema(valueLabel)
|
|
1380
|
-
})
|
|
1381
|
-
]);
|
|
1382
1432
|
var makeChainIndexingStatusSnapshotQueuedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1383
1433
|
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Queued),
|
|
1384
|
-
config:
|
|
1434
|
+
config: import_v47.z.discriminatedUnion("rangeType", [
|
|
1435
|
+
import_v47.z.object({
|
|
1436
|
+
rangeType: import_v47.z.literal(RangeTypeIds.LeftBounded),
|
|
1437
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1438
|
+
}),
|
|
1439
|
+
import_v47.z.object({
|
|
1440
|
+
rangeType: import_v47.z.literal(RangeTypeIds.Bounded),
|
|
1441
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1442
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1443
|
+
})
|
|
1444
|
+
])
|
|
1385
1445
|
}).check(invariant_chainSnapshotQueuedBlocks);
|
|
1386
1446
|
var makeChainIndexingStatusSnapshotBackfillSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1387
1447
|
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Backfill),
|
|
1388
|
-
config:
|
|
1448
|
+
config: import_v47.z.discriminatedUnion("rangeType", [
|
|
1449
|
+
import_v47.z.object({
|
|
1450
|
+
rangeType: import_v47.z.literal(RangeTypeIds.LeftBounded),
|
|
1451
|
+
startBlock: makeBlockRefSchema(valueLabel)
|
|
1452
|
+
}),
|
|
1453
|
+
import_v47.z.object({
|
|
1454
|
+
rangeType: import_v47.z.literal(RangeTypeIds.Bounded),
|
|
1455
|
+
startBlock: makeBlockRefSchema(valueLabel),
|
|
1456
|
+
endBlock: makeBlockRefSchema(valueLabel)
|
|
1457
|
+
})
|
|
1458
|
+
]),
|
|
1389
1459
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
1390
1460
|
backfillEndBlock: makeBlockRefSchema(valueLabel)
|
|
1391
1461
|
}).check(invariant_chainSnapshotBackfillBlocks);
|
|
1392
1462
|
var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1393
1463
|
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Completed),
|
|
1394
1464
|
config: import_v47.z.object({
|
|
1395
|
-
|
|
1465
|
+
rangeType: import_v47.z.literal(RangeTypeIds.Bounded),
|
|
1396
1466
|
startBlock: makeBlockRefSchema(valueLabel),
|
|
1397
1467
|
endBlock: makeBlockRefSchema(valueLabel)
|
|
1398
1468
|
}),
|
|
@@ -1401,7 +1471,7 @@ var makeChainIndexingStatusSnapshotCompletedSchema = (valueLabel = "Value") => i
|
|
|
1401
1471
|
var makeChainIndexingStatusSnapshotFollowingSchema = (valueLabel = "Value") => import_v47.z.object({
|
|
1402
1472
|
chainStatus: import_v47.z.literal(ChainIndexingStatusIds.Following),
|
|
1403
1473
|
config: import_v47.z.object({
|
|
1404
|
-
|
|
1474
|
+
rangeType: import_v47.z.literal(RangeTypeIds.LeftBounded),
|
|
1405
1475
|
startBlock: makeBlockRefSchema(valueLabel)
|
|
1406
1476
|
}),
|
|
1407
1477
|
latestIndexedBlock: makeBlockRefSchema(valueLabel),
|
|
@@ -1669,7 +1739,7 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1669
1739
|
const { snapshotTime, omnichainSnapshot } = ctx.value;
|
|
1670
1740
|
const chains = Array.from(omnichainSnapshot.chains.values());
|
|
1671
1741
|
const startBlockTimestamps = chains.map((chain) => chain.config.startBlock.timestamp);
|
|
1672
|
-
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.
|
|
1742
|
+
const endBlockTimestamps = chains.map((chain) => chain.config).filter((chainConfig) => chainConfig.rangeType === RangeTypeIds.Bounded).map((chainConfig) => chainConfig.endBlock.timestamp);
|
|
1673
1743
|
const backfillEndBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Backfill).map((chain) => chain.backfillEndBlock.timestamp);
|
|
1674
1744
|
const latestKnownBlockTimestamps = chains.filter((chain) => chain.chainStatus === ChainIndexingStatusIds.Following).map((chain) => chain.latestKnownBlock.timestamp);
|
|
1675
1745
|
const highestKnownBlockTimestamp = Math.max(
|
|
@@ -2003,17 +2073,17 @@ var serializeIndexingStatusResponse = serializeEnsApiIndexingStatusResponse;
|
|
|
2003
2073
|
var import_v420 = require("zod/v4");
|
|
2004
2074
|
|
|
2005
2075
|
// src/ensapi/api/name-tokens/zod-schemas.ts
|
|
2006
|
-
var
|
|
2076
|
+
var import_viem14 = require("viem");
|
|
2007
2077
|
var import_v419 = require("zod/v4");
|
|
2008
2078
|
|
|
2009
2079
|
// src/tokenscope/name-token.ts
|
|
2010
|
-
var
|
|
2080
|
+
var import_viem13 = require("viem");
|
|
2011
2081
|
var import_datasources5 = require("@ensnode/datasources");
|
|
2012
2082
|
|
|
2013
2083
|
// src/shared/account-id.ts
|
|
2014
|
-
var
|
|
2084
|
+
var import_viem10 = require("viem");
|
|
2015
2085
|
var accountIdEqual = (a, b) => {
|
|
2016
|
-
return a.chainId === b.chainId && (0,
|
|
2086
|
+
return a.chainId === b.chainId && (0, import_viem10.isAddressEqual)(a.address, b.address);
|
|
2017
2087
|
};
|
|
2018
2088
|
|
|
2019
2089
|
// src/shared/datasource-contract.ts
|
|
@@ -2043,12 +2113,12 @@ var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
|
2043
2113
|
};
|
|
2044
2114
|
|
|
2045
2115
|
// src/tokenscope/assets.ts
|
|
2046
|
-
var
|
|
2116
|
+
var import_viem12 = require("viem");
|
|
2047
2117
|
var import_v417 = require("zod/v4");
|
|
2048
2118
|
|
|
2049
2119
|
// src/tokenscope/zod-schemas.ts
|
|
2050
2120
|
var import_caip3 = require("caip");
|
|
2051
|
-
var
|
|
2121
|
+
var import_viem11 = require("viem");
|
|
2052
2122
|
var import_v416 = require("zod/v4");
|
|
2053
2123
|
|
|
2054
2124
|
// src/shared/types.ts
|
|
@@ -2093,7 +2163,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => import_
|
|
|
2093
2163
|
}, makeAssetIdSchema(valueLabel));
|
|
2094
2164
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
2095
2165
|
const ownership = ctx.value;
|
|
2096
|
-
if (ctx.value.owner.address ===
|
|
2166
|
+
if (ctx.value.owner.address === import_viem11.zeroAddress) {
|
|
2097
2167
|
ctx.issues.push({
|
|
2098
2168
|
code: "custom",
|
|
2099
2169
|
input: ctx.value,
|
|
@@ -2119,7 +2189,7 @@ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Un
|
|
|
2119
2189
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
2120
2190
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
2121
2191
|
const ownership = ctx.value;
|
|
2122
|
-
if (ctx.value.owner.address !==
|
|
2192
|
+
if (ctx.value.owner.address !== import_viem11.zeroAddress) {
|
|
2123
2193
|
ctx.issues.push({
|
|
2124
2194
|
code: "custom",
|
|
2125
2195
|
input: ctx.value,
|
|
@@ -2297,11 +2367,11 @@ var NFTTransferTypes = {
|
|
|
2297
2367
|
};
|
|
2298
2368
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2299
2369
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2300
|
-
const isIndexedAsMinted = isIndexed && !(0,
|
|
2301
|
-
const isMint = (0,
|
|
2302
|
-
const isBurn = (0,
|
|
2303
|
-
const isSelfTransfer = (0,
|
|
2304
|
-
if (isIndexed && !(0,
|
|
2370
|
+
const isIndexedAsMinted = isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, import_viem12.zeroAddress);
|
|
2371
|
+
const isMint = (0, import_viem12.isAddressEqual)(from, import_viem12.zeroAddress);
|
|
2372
|
+
const isBurn = (0, import_viem12.isAddressEqual)(to, import_viem12.zeroAddress);
|
|
2373
|
+
const isSelfTransfer = (0, import_viem12.isAddressEqual)(from, to);
|
|
2374
|
+
if (isIndexed && !(0, import_viem12.isAddressEqual)(currentlyIndexedOwner, from)) {
|
|
2305
2375
|
if (isMint && allowMintedRemint) {
|
|
2306
2376
|
} else {
|
|
2307
2377
|
throw new Error(
|
|
@@ -2442,7 +2512,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
2442
2512
|
owner
|
|
2443
2513
|
};
|
|
2444
2514
|
}
|
|
2445
|
-
if ((0,
|
|
2515
|
+
if ((0, import_viem13.isAddressEqual)(owner.address, import_viem13.zeroAddress)) {
|
|
2446
2516
|
return {
|
|
2447
2517
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
2448
2518
|
owner
|
|
@@ -2512,7 +2582,7 @@ var makeRegisteredNameTokenSchema = (valueLabel = "Registered Name Token", seria
|
|
|
2512
2582
|
accurateAsOf: makeUnixTimestampSchema(`${valueLabel}.accurateAsOf`)
|
|
2513
2583
|
}).check(function invariant_nameIsAssociatedWithDomainId(ctx) {
|
|
2514
2584
|
const { name, domainId } = ctx.value;
|
|
2515
|
-
if ((0,
|
|
2585
|
+
if ((0, import_viem14.namehash)(name) !== domainId) {
|
|
2516
2586
|
ctx.issues.push({
|
|
2517
2587
|
code: "custom",
|
|
2518
2588
|
input: ctx.value,
|
|
@@ -2671,34 +2741,34 @@ var import_v423 = require("zod/v4");
|
|
|
2671
2741
|
var import_v421 = require("zod/v4");
|
|
2672
2742
|
|
|
2673
2743
|
// src/registrars/encoded-referrer.ts
|
|
2674
|
-
var
|
|
2744
|
+
var import_viem15 = require("viem");
|
|
2675
2745
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2676
2746
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2677
|
-
var EXPECTED_ENCODED_REFERRER_PADDING = (0,
|
|
2747
|
+
var EXPECTED_ENCODED_REFERRER_PADDING = (0, import_viem15.pad)("0x", {
|
|
2678
2748
|
size: ENCODED_REFERRER_BYTE_OFFSET,
|
|
2679
2749
|
dir: "left"
|
|
2680
2750
|
});
|
|
2681
|
-
var ZERO_ENCODED_REFERRER = (0,
|
|
2751
|
+
var ZERO_ENCODED_REFERRER = (0, import_viem15.pad)("0x", {
|
|
2682
2752
|
size: ENCODED_REFERRER_BYTE_LENGTH,
|
|
2683
2753
|
dir: "left"
|
|
2684
2754
|
});
|
|
2685
2755
|
function buildEncodedReferrer(address) {
|
|
2686
2756
|
const lowercaseAddress = address.toLowerCase();
|
|
2687
|
-
return (0,
|
|
2757
|
+
return (0, import_viem15.pad)(lowercaseAddress, { size: ENCODED_REFERRER_BYTE_LENGTH, dir: "left" });
|
|
2688
2758
|
}
|
|
2689
2759
|
function decodeEncodedReferrer(encodedReferrer) {
|
|
2690
|
-
if ((0,
|
|
2760
|
+
if ((0, import_viem15.size)(encodedReferrer) !== ENCODED_REFERRER_BYTE_LENGTH) {
|
|
2691
2761
|
throw new Error(
|
|
2692
2762
|
`Encoded referrer value must be represented by ${ENCODED_REFERRER_BYTE_LENGTH} bytes.`
|
|
2693
2763
|
);
|
|
2694
2764
|
}
|
|
2695
|
-
const padding = (0,
|
|
2765
|
+
const padding = (0, import_viem15.slice)(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2696
2766
|
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
|
|
2697
|
-
return
|
|
2767
|
+
return import_viem15.zeroAddress;
|
|
2698
2768
|
}
|
|
2699
|
-
const decodedReferrer = (0,
|
|
2769
|
+
const decodedReferrer = (0, import_viem15.slice)(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2700
2770
|
try {
|
|
2701
|
-
return (0,
|
|
2771
|
+
return (0, import_viem15.getAddress)(decodedReferrer);
|
|
2702
2772
|
} catch {
|
|
2703
2773
|
throw new Error(`Decoded referrer value must be a valid EVM address.`);
|
|
2704
2774
|
}
|
|
@@ -3906,7 +3976,7 @@ function validateEnsIndexerPublicConfigCompatibility(configA, configB) {
|
|
|
3906
3976
|
}
|
|
3907
3977
|
|
|
3908
3978
|
// src/ensindexer/config/label-utils.ts
|
|
3909
|
-
var
|
|
3979
|
+
var import_viem16 = require("viem");
|
|
3910
3980
|
function labelHashToBytes(labelHash) {
|
|
3911
3981
|
try {
|
|
3912
3982
|
if (labelHash.length !== 66) {
|
|
@@ -3918,7 +3988,7 @@ function labelHashToBytes(labelHash) {
|
|
|
3918
3988
|
if (!labelHash.startsWith("0x")) {
|
|
3919
3989
|
throw new Error("Labelhash must be 0x-prefixed");
|
|
3920
3990
|
}
|
|
3921
|
-
const bytes = (0,
|
|
3991
|
+
const bytes = (0, import_viem16.hexToBytes)(labelHash);
|
|
3922
3992
|
if (bytes.length !== 32) {
|
|
3923
3993
|
throw new Error(`Invalid labelHash length ${bytes.length} bytes (expected 32)`);
|
|
3924
3994
|
}
|
|
@@ -3986,7 +4056,7 @@ function parseNonNegativeInteger(maybeNumber) {
|
|
|
3986
4056
|
}
|
|
3987
4057
|
|
|
3988
4058
|
// src/ensv2/ids-lib.ts
|
|
3989
|
-
var
|
|
4059
|
+
var import_viem17 = require("viem");
|
|
3990
4060
|
var makeRegistryId = (accountId) => formatAccountId(accountId);
|
|
3991
4061
|
var makeENSv1DomainId = (node) => node;
|
|
3992
4062
|
var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
@@ -3997,7 +4067,7 @@ var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
|
3997
4067
|
var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
|
|
3998
4068
|
var getCanonicalId = (input) => {
|
|
3999
4069
|
if (typeof input === "bigint") return maskLower32Bits(input);
|
|
4000
|
-
return getCanonicalId((0,
|
|
4070
|
+
return getCanonicalId((0, import_viem17.hexToBigInt)(input));
|
|
4001
4071
|
};
|
|
4002
4072
|
var makePermissionsId = (contract) => formatAccountId(contract);
|
|
4003
4073
|
var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
|
|
@@ -4343,16 +4413,6 @@ ${(0, import_v435.prettifyError)(parsed.error)}
|
|
|
4343
4413
|
}
|
|
4344
4414
|
return parsed.data;
|
|
4345
4415
|
}
|
|
4346
|
-
function deserializeBlockrange(maybeBlockrange, valueLabel) {
|
|
4347
|
-
const schema = makeBlockrangeSchema(valueLabel);
|
|
4348
|
-
const parsed = schema.safeParse(maybeBlockrange);
|
|
4349
|
-
if (parsed.error) {
|
|
4350
|
-
throw new Error(`Cannot deserialize Blockrange:
|
|
4351
|
-
${(0, import_v435.prettifyError)(parsed.error)}
|
|
4352
|
-
`);
|
|
4353
|
-
}
|
|
4354
|
-
return parsed.data;
|
|
4355
|
-
}
|
|
4356
4416
|
function deserializeBlockRef(maybeBlockRef, valueLabel) {
|
|
4357
4417
|
const schema = makeBlockRefSchema(valueLabel);
|
|
4358
4418
|
const parsed = schema.safeParse(maybeBlockRef);
|
|
@@ -4560,11 +4620,11 @@ var TtlCache = class {
|
|
|
4560
4620
|
};
|
|
4561
4621
|
|
|
4562
4622
|
// src/shared/interpretation/interpret-address.ts
|
|
4563
|
-
var
|
|
4564
|
-
var interpretAddress = (owner) => (0,
|
|
4623
|
+
var import_viem18 = require("viem");
|
|
4624
|
+
var interpretAddress = (owner) => (0, import_viem18.isAddressEqual)(import_viem18.zeroAddress, owner) ? null : owner;
|
|
4565
4625
|
|
|
4566
4626
|
// src/shared/interpretation/interpret-record-values.ts
|
|
4567
|
-
var
|
|
4627
|
+
var import_viem19 = require("viem");
|
|
4568
4628
|
|
|
4569
4629
|
// src/shared/null-bytes.ts
|
|
4570
4630
|
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
@@ -4580,8 +4640,8 @@ function interpretAddressRecordValue(value) {
|
|
|
4580
4640
|
if (hasNullByte(value)) return null;
|
|
4581
4641
|
if (value === "") return null;
|
|
4582
4642
|
if (value === "0x") return null;
|
|
4583
|
-
if (!(0,
|
|
4584
|
-
if ((0,
|
|
4643
|
+
if (!(0, import_viem19.isAddress)(value)) return value;
|
|
4644
|
+
if ((0, import_viem19.isAddressEqual)(value, import_viem19.zeroAddress)) return null;
|
|
4585
4645
|
return asLowerCaseAddress(value);
|
|
4586
4646
|
}
|
|
4587
4647
|
function interpretTextRecordKey(key) {
|
|
@@ -4600,12 +4660,12 @@ var interpretTokenIdAsLabelHash = (tokenId) => uint256ToHex32(tokenId);
|
|
|
4600
4660
|
var interpretTokenIdAsNode = (tokenId) => uint256ToHex32(tokenId);
|
|
4601
4661
|
|
|
4602
4662
|
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
4603
|
-
var
|
|
4663
|
+
var import_viem21 = require("viem");
|
|
4604
4664
|
var import_ens10 = require("viem/ens");
|
|
4605
4665
|
|
|
4606
4666
|
// src/shared/labelhash.ts
|
|
4607
|
-
var
|
|
4608
|
-
var labelhashLiteralLabel = (label) => (0,
|
|
4667
|
+
var import_viem20 = require("viem");
|
|
4668
|
+
var labelhashLiteralLabel = (label) => (0, import_viem20.keccak256)((0, import_viem20.stringToBytes)(label));
|
|
4609
4669
|
|
|
4610
4670
|
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
4611
4671
|
function literalLabelToInterpretedLabel(label) {
|
|
@@ -4629,7 +4689,7 @@ function encodedLabelToLabelhash(label) {
|
|
|
4629
4689
|
if (label.indexOf("[") !== 0) return null;
|
|
4630
4690
|
if (label.indexOf("]") !== 65) return null;
|
|
4631
4691
|
const hash = `0x${label.slice(1, 65)}`;
|
|
4632
|
-
if (!(0,
|
|
4692
|
+
if (!(0, import_viem21.isHex)(hash)) return null;
|
|
4633
4693
|
return hash;
|
|
4634
4694
|
}
|
|
4635
4695
|
function isInterpetedLabel(label) {
|