@ensnode/ensnode-sdk 0.0.0-next-20260202030222 → 0.0.0-next-20260202072436
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 +27 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted: () => checkChainIndexingStatusSnapshotsForOmnichainStatusSnapshotUnstarted,
|
|
94
94
|
coinTypeReverseLabel: () => coinTypeReverseLabel,
|
|
95
95
|
coinTypeToEvmChainId: () => coinTypeToEvmChainId,
|
|
96
|
+
constructSubInterpretedName: () => constructSubInterpretedName,
|
|
96
97
|
createIndexingConfig: () => createIndexingConfig,
|
|
97
98
|
createRealtimeIndexingStatusProjection: () => createRealtimeIndexingStatusProjection,
|
|
98
99
|
decodeDNSEncodedLiteralName: () => decodeDNSEncodedLiteralName,
|
|
@@ -124,6 +125,7 @@ __export(index_exports, {
|
|
|
124
125
|
durationBetween: () => durationBetween,
|
|
125
126
|
encodeLabelHash: () => encodeLabelHash,
|
|
126
127
|
encodedLabelToLabelhash: () => encodedLabelToLabelhash,
|
|
128
|
+
ensureInterpretedLabel: () => ensureInterpretedLabel,
|
|
127
129
|
evmChainIdToCoinType: () => evmChainIdToCoinType,
|
|
128
130
|
formatAccountId: () => formatAccountId,
|
|
129
131
|
formatAssetId: () => formatAssetId,
|
|
@@ -162,8 +164,8 @@ __export(index_exports, {
|
|
|
162
164
|
interpretTokenIdAsLabelHash: () => interpretTokenIdAsLabelHash,
|
|
163
165
|
interpretTokenIdAsNode: () => interpretTokenIdAsNode,
|
|
164
166
|
interpretedLabelsToInterpretedName: () => interpretedLabelsToInterpretedName,
|
|
167
|
+
interpretedLabelsToLabelHashPath: () => interpretedLabelsToLabelHashPath,
|
|
165
168
|
interpretedNameToInterpretedLabels: () => interpretedNameToInterpretedLabels,
|
|
166
|
-
interpretedNameToLabelHashPath: () => interpretedNameToLabelHashPath,
|
|
167
169
|
isENSv1Registry: () => isENSv1Registry,
|
|
168
170
|
isENSv2RootRegistry: () => isENSv2RootRegistry,
|
|
169
171
|
isEncodedLabelHash: () => isEncodedLabelHash,
|
|
@@ -212,6 +214,7 @@ __export(index_exports, {
|
|
|
212
214
|
parseDai: () => parseDai,
|
|
213
215
|
parseEth: () => parseEth,
|
|
214
216
|
parseNonNegativeInteger: () => parseNonNegativeInteger,
|
|
217
|
+
parsePartialInterpretedName: () => parsePartialInterpretedName,
|
|
215
218
|
parseReverseName: () => parseReverseName,
|
|
216
219
|
parseUsdc: () => parseUsdc,
|
|
217
220
|
priceDai: () => priceDai,
|
|
@@ -4044,18 +4047,18 @@ function encodedLabelToLabelhash(label) {
|
|
|
4044
4047
|
function isInterpetedLabel(label) {
|
|
4045
4048
|
if (label.startsWith("[")) {
|
|
4046
4049
|
const labelHash = encodedLabelToLabelhash(label);
|
|
4047
|
-
|
|
4050
|
+
return labelHash != null;
|
|
4048
4051
|
}
|
|
4049
4052
|
return isNormalizedLabel(label);
|
|
4050
4053
|
}
|
|
4051
4054
|
function isInterpretedName(name) {
|
|
4052
4055
|
return name.split(".").every(isInterpetedLabel);
|
|
4053
4056
|
}
|
|
4054
|
-
function
|
|
4055
|
-
return
|
|
4057
|
+
function interpretedLabelsToLabelHashPath(labels) {
|
|
4058
|
+
return labels.map((label) => {
|
|
4056
4059
|
if (!isInterpetedLabel(label)) {
|
|
4057
4060
|
throw new Error(
|
|
4058
|
-
`Invariant(
|
|
4061
|
+
`Invariant(interpretedLabelsToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
|
|
4059
4062
|
);
|
|
4060
4063
|
}
|
|
4061
4064
|
const maybeLabelHash = encodedLabelToLabelhash(label);
|
|
@@ -4063,6 +4066,25 @@ function interpretedNameToLabelHashPath(name) {
|
|
|
4063
4066
|
return (0, import_ens10.labelhash)(label);
|
|
4064
4067
|
}).toReversed();
|
|
4065
4068
|
}
|
|
4069
|
+
function constructSubInterpretedName(label, name) {
|
|
4070
|
+
if (name === void 0 || name === "") return label;
|
|
4071
|
+
return [label, name].join(".");
|
|
4072
|
+
}
|
|
4073
|
+
function ensureInterpretedLabel(labelHash, label) {
|
|
4074
|
+
return label ?? encodeLabelHash(labelHash);
|
|
4075
|
+
}
|
|
4076
|
+
function parsePartialInterpretedName(partialInterpretedName) {
|
|
4077
|
+
if (partialInterpretedName === "") return { concrete: [], partial: "" };
|
|
4078
|
+
const concrete = partialInterpretedName.split(".");
|
|
4079
|
+
const partial = concrete.pop();
|
|
4080
|
+
if (!concrete.every(isInterpetedLabel)) {
|
|
4081
|
+
throw new Error(
|
|
4082
|
+
`Invariant(parsePartialInterpretedName): Concrete portion of Partial InterpretedName contains segments that are not InterpretedLabels.
|
|
4083
|
+
${JSON.stringify(concrete)}`
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4086
|
+
return { concrete, partial };
|
|
4087
|
+
}
|
|
4066
4088
|
|
|
4067
4089
|
// src/shared/root-registry.ts
|
|
4068
4090
|
var import_datasources12 = require("@ensnode/datasources");
|