@ensnode/ensnode-sdk 0.0.0-next-20260106001025 → 0.0.0-next-20260108092445
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 +333 -164
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +372 -44
- package/dist/index.d.ts +372 -44
- package/dist/index.js +231 -60
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { prettifyError as prettifyError2, ZodError } from "zod/v4";
|
|
|
5
5
|
import { z as z4 } from "zod/v4";
|
|
6
6
|
|
|
7
7
|
// src/ensindexer/config/zod-schemas.ts
|
|
8
|
-
import z2 from "zod/v4";
|
|
8
|
+
import { z as z2 } from "zod/v4";
|
|
9
9
|
|
|
10
10
|
// src/shared/account-id.ts
|
|
11
11
|
import { isAddressEqual } from "viem";
|
|
@@ -77,7 +77,7 @@ import { prettifyError } from "zod/v4";
|
|
|
77
77
|
// src/shared/zod-schemas.ts
|
|
78
78
|
import { AccountId as CaipAccountId } from "caip";
|
|
79
79
|
import { isAddress as isAddress2, isHex as isHex2, size } from "viem";
|
|
80
|
-
import z from "zod/v4";
|
|
80
|
+
import { z } from "zod/v4";
|
|
81
81
|
|
|
82
82
|
// src/ens/index.ts
|
|
83
83
|
import { getENSRootChainId } from "@ensnode/datasources";
|
|
@@ -106,12 +106,14 @@ var bigintToCoinType = (value) => {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
// src/ens/constants.ts
|
|
109
|
-
import { namehash } from "viem";
|
|
109
|
+
import { namehash, zeroHash } from "viem";
|
|
110
110
|
var ROOT_NODE = namehash("");
|
|
111
111
|
var ETH_NODE = namehash("eth");
|
|
112
112
|
var BASENAMES_NODE = namehash("base.eth");
|
|
113
113
|
var LINEANAMES_NODE = namehash("linea.eth");
|
|
114
114
|
var ADDR_REVERSE_NODE = namehash("addr.reverse");
|
|
115
|
+
var NODE_ANY = zeroHash;
|
|
116
|
+
var ROOT_RESOURCE = 0n;
|
|
115
117
|
|
|
116
118
|
// src/ens/dns-encoded-name.ts
|
|
117
119
|
import { bytesToString, hexToBytes } from "viem";
|
|
@@ -160,6 +162,10 @@ function isEncodedLabelHash(maybeEncodedLabelHash) {
|
|
|
160
162
|
return expectedFormatting && includesLabelHash;
|
|
161
163
|
}
|
|
162
164
|
|
|
165
|
+
// src/ens/fuses.ts
|
|
166
|
+
var PARENT_CANNOT_CONTROL = 65536;
|
|
167
|
+
var isPccFuseSet = (fuses) => (fuses & PARENT_CANNOT_CONTROL) === PARENT_CANNOT_CONTROL;
|
|
168
|
+
|
|
163
169
|
// src/ens/is-normalized.ts
|
|
164
170
|
import { normalize } from "viem/ens";
|
|
165
171
|
function isNormalizedName(name) {
|
|
@@ -330,7 +336,7 @@ function addPrices(...prices) {
|
|
|
330
336
|
);
|
|
331
337
|
}
|
|
332
338
|
|
|
333
|
-
// src/shared/reinterpretation.ts
|
|
339
|
+
// src/shared/interpretation/reinterpretation.ts
|
|
334
340
|
import { labelhash as labelToLabelHash } from "viem";
|
|
335
341
|
function reinterpretLabel(label) {
|
|
336
342
|
if (label === "") {
|
|
@@ -706,7 +712,9 @@ var TtlCache = class {
|
|
|
706
712
|
var uniq = (arr) => [...new Set(arr)];
|
|
707
713
|
|
|
708
714
|
// src/shared/datasource-contract.ts
|
|
709
|
-
import {
|
|
715
|
+
import {
|
|
716
|
+
maybeGetDatasource
|
|
717
|
+
} from "@ensnode/datasources";
|
|
710
718
|
var maybeGetDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
711
719
|
const datasource = maybeGetDatasource(namespaceId, datasourceName);
|
|
712
720
|
if (!datasource) return void 0;
|
|
@@ -726,12 +734,60 @@ var getDatasourceContract = (namespaceId, datasourceName, contractName) => {
|
|
|
726
734
|
}
|
|
727
735
|
return contract;
|
|
728
736
|
};
|
|
737
|
+
var makeContractMatcher = (namespace, b) => (datasourceName, contractName) => {
|
|
738
|
+
const a = maybeGetDatasourceContract(namespace, datasourceName, contractName);
|
|
739
|
+
return a && accountIdEqual(a, b);
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
// src/shared/interpretation/interpret-address.ts
|
|
743
|
+
import { isAddressEqual as isAddressEqual2, zeroAddress } from "viem";
|
|
744
|
+
var interpretAddress = (owner) => isAddressEqual2(zeroAddress, owner) ? null : owner;
|
|
745
|
+
|
|
746
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
747
|
+
import { isAddress as isAddress3, isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress2 } from "viem";
|
|
748
|
+
|
|
749
|
+
// src/shared/null-bytes.ts
|
|
750
|
+
var hasNullByte = (value) => value.indexOf("\0") !== -1;
|
|
751
|
+
var stripNullBytes = (value) => value.replaceAll("\0", "");
|
|
752
|
+
|
|
753
|
+
// src/shared/interpretation/interpret-record-values.ts
|
|
754
|
+
function interpretNameRecordValue(value) {
|
|
755
|
+
if (value === "") return null;
|
|
756
|
+
if (!isNormalizedName(value)) return null;
|
|
757
|
+
return value;
|
|
758
|
+
}
|
|
759
|
+
function interpretAddressRecordValue(value) {
|
|
760
|
+
if (hasNullByte(value)) return null;
|
|
761
|
+
if (value === "") return null;
|
|
762
|
+
if (value === "0x") return null;
|
|
763
|
+
if (!isAddress3(value)) return value;
|
|
764
|
+
if (isAddressEqual3(value, zeroAddress2)) return null;
|
|
765
|
+
return asLowerCaseAddress(value);
|
|
766
|
+
}
|
|
767
|
+
function interpretTextRecordKey(key) {
|
|
768
|
+
if (hasNullByte(key)) return null;
|
|
769
|
+
if (key === "") return null;
|
|
770
|
+
return key;
|
|
771
|
+
}
|
|
772
|
+
function interpretTextRecordValue(value) {
|
|
773
|
+
if (hasNullByte(value)) return null;
|
|
774
|
+
if (value === "") return null;
|
|
775
|
+
return value;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// src/shared/interpretation/interpret-tokenid.ts
|
|
779
|
+
var interpretTokenIdAsLabelHash = (tokenId) => uint256ToHex32(tokenId);
|
|
780
|
+
var interpretTokenIdAsNode = (tokenId) => uint256ToHex32(tokenId);
|
|
781
|
+
|
|
782
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
783
|
+
import { isHex as isHex3 } from "viem";
|
|
784
|
+
import { labelhash } from "viem/ens";
|
|
729
785
|
|
|
730
786
|
// src/shared/labelhash.ts
|
|
731
787
|
import { keccak256 as keccak2562, stringToBytes } from "viem";
|
|
732
788
|
var labelhashLiteralLabel = (label) => keccak2562(stringToBytes(label));
|
|
733
789
|
|
|
734
|
-
// src/shared/interpretation.ts
|
|
790
|
+
// src/shared/interpretation/interpreted-names-and-labels.ts
|
|
735
791
|
function literalLabelToInterpretedLabel(label) {
|
|
736
792
|
if (isNormalizedLabel(label)) return label;
|
|
737
793
|
return encodeLabelHash(labelhashLiteralLabel(label));
|
|
@@ -745,10 +801,39 @@ function interpretedLabelsToInterpretedName(labels) {
|
|
|
745
801
|
function literalLabelsToLiteralName(labels) {
|
|
746
802
|
return labels.join(".");
|
|
747
803
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
804
|
+
function interpretedNameToInterpretedLabels(name) {
|
|
805
|
+
return name.split(".");
|
|
806
|
+
}
|
|
807
|
+
function encodedLabelToLabelhash(label) {
|
|
808
|
+
if (label.length !== 66) return null;
|
|
809
|
+
if (label.indexOf("[") !== 0) return null;
|
|
810
|
+
if (label.indexOf("]") !== 65) return null;
|
|
811
|
+
const hash = `0x${label.slice(1, 65)}`;
|
|
812
|
+
if (!isHex3(hash)) return null;
|
|
813
|
+
return hash;
|
|
814
|
+
}
|
|
815
|
+
function isInterpetedLabel(label) {
|
|
816
|
+
if (label.startsWith("[")) {
|
|
817
|
+
const labelHash = encodedLabelToLabelhash(label);
|
|
818
|
+
if (labelHash === null) return false;
|
|
819
|
+
}
|
|
820
|
+
return isNormalizedLabel(label);
|
|
821
|
+
}
|
|
822
|
+
function isInterpretedName(name) {
|
|
823
|
+
return name.split(".").every(isInterpetedLabel);
|
|
824
|
+
}
|
|
825
|
+
function interpretedNameToLabelHashPath(name) {
|
|
826
|
+
return interpretedNameToInterpretedLabels(name).map((label) => {
|
|
827
|
+
if (!isInterpetedLabel(label)) {
|
|
828
|
+
throw new Error(
|
|
829
|
+
`Invariant(interpretedNameToLabelHashPath): Expected InterpretedLabel, received '${label}'.`
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
const maybeLabelHash = encodedLabelToLabelhash(label);
|
|
833
|
+
if (maybeLabelHash !== null) return maybeLabelHash;
|
|
834
|
+
return labelhash(label);
|
|
835
|
+
}).toReversed();
|
|
836
|
+
}
|
|
752
837
|
|
|
753
838
|
// src/shared/numbers.ts
|
|
754
839
|
function bigIntToNumber(n) {
|
|
@@ -765,8 +850,16 @@ function bigIntToNumber(n) {
|
|
|
765
850
|
return Number(n);
|
|
766
851
|
}
|
|
767
852
|
|
|
853
|
+
// src/shared/root-registry.ts
|
|
854
|
+
import { DatasourceNames } from "@ensnode/datasources";
|
|
855
|
+
var getENSv1Registry = (namespace) => getDatasourceContract(namespace, DatasourceNames.ENSRoot, "ENSv1Registry");
|
|
856
|
+
var isENSv1Registry = (namespace, contract) => accountIdEqual(getENSv1Registry(namespace), contract);
|
|
857
|
+
var getENSv2RootRegistry = (namespace) => getDatasourceContract(namespace, DatasourceNames.ENSRoot, "RootRegistry");
|
|
858
|
+
var getENSv2RootRegistryId = (namespace) => makeRegistryId(getENSv2RootRegistry(namespace));
|
|
859
|
+
var isENSv2RootRegistry = (namespace, contract) => accountIdEqual(getENSv2RootRegistry(namespace), contract);
|
|
860
|
+
|
|
768
861
|
// src/shared/serialize.ts
|
|
769
|
-
import { AccountId as CaipAccountId2 } from "caip";
|
|
862
|
+
import { AccountId as CaipAccountId2, AssetId as CaipAssetId } from "caip";
|
|
770
863
|
function serializeChainId(chainId) {
|
|
771
864
|
return chainId.toString();
|
|
772
865
|
}
|
|
@@ -791,6 +884,23 @@ function formatAccountId(accountId) {
|
|
|
791
884
|
address: accountId.address
|
|
792
885
|
}).toLowerCase();
|
|
793
886
|
}
|
|
887
|
+
function formatAssetId({
|
|
888
|
+
assetNamespace,
|
|
889
|
+
contract: { chainId, address },
|
|
890
|
+
tokenId
|
|
891
|
+
}) {
|
|
892
|
+
return CaipAssetId.format({
|
|
893
|
+
chainId: { namespace: "eip155", reference: chainId.toString() },
|
|
894
|
+
assetName: { namespace: assetNamespace, reference: address },
|
|
895
|
+
tokenId: uint256ToHex32(tokenId)
|
|
896
|
+
}).toLowerCase();
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// src/shared/types.ts
|
|
900
|
+
var AssetNamespaces = {
|
|
901
|
+
ERC721: "erc721",
|
|
902
|
+
ERC1155: "erc1155"
|
|
903
|
+
};
|
|
794
904
|
|
|
795
905
|
// src/shared/url.ts
|
|
796
906
|
function isHttpProtocol(url) {
|
|
@@ -812,6 +922,7 @@ var PluginName = /* @__PURE__ */ ((PluginName2) => {
|
|
|
812
922
|
PluginName2["ProtocolAcceleration"] = "protocol-acceleration";
|
|
813
923
|
PluginName2["Registrars"] = "registrars";
|
|
814
924
|
PluginName2["TokenScope"] = "tokenscope";
|
|
925
|
+
PluginName2["ENSv2"] = "ensv2";
|
|
815
926
|
return PluginName2;
|
|
816
927
|
})(PluginName || {});
|
|
817
928
|
|
|
@@ -1073,7 +1184,7 @@ function serializeENSIndexerPublicConfig(config) {
|
|
|
1073
1184
|
import { prettifyError as prettifyError4 } from "zod/v4";
|
|
1074
1185
|
|
|
1075
1186
|
// src/ensindexer/indexing-status/zod-schemas.ts
|
|
1076
|
-
import z5 from "zod/v4";
|
|
1187
|
+
import { z as z5 } from "zod/v4";
|
|
1077
1188
|
|
|
1078
1189
|
// src/ensindexer/indexing-status/types.ts
|
|
1079
1190
|
var ChainIndexingConfigTypeIds = {
|
|
@@ -1499,7 +1610,7 @@ function invariant_snapshotTimeIsTheHighestKnownBlockTimestamp(ctx) {
|
|
|
1499
1610
|
ctx.issues.push({
|
|
1500
1611
|
code: "custom",
|
|
1501
1612
|
input: ctx.value,
|
|
1502
|
-
message: `'snapshotTime' must be greater than or equal to
|
|
1613
|
+
message: `'snapshotTime' (${snapshotTime}) must be greater than or equal to the "highest known block timestamp" (${highestKnownBlockTimestamp})`
|
|
1503
1614
|
});
|
|
1504
1615
|
}
|
|
1505
1616
|
}
|
|
@@ -1829,18 +1940,17 @@ import { namehash as namehash2 } from "viem";
|
|
|
1829
1940
|
import z9 from "zod/v4";
|
|
1830
1941
|
|
|
1831
1942
|
// src/tokenscope/assets.ts
|
|
1832
|
-
import {
|
|
1833
|
-
import { isAddressEqual as isAddressEqual3, zeroAddress as zeroAddress3 } from "viem";
|
|
1943
|
+
import { isAddressEqual as isAddressEqual5, zeroAddress as zeroAddress5 } from "viem";
|
|
1834
1944
|
import { prettifyError as prettifyError6 } from "zod/v4";
|
|
1835
1945
|
|
|
1836
1946
|
// src/tokenscope/zod-schemas.ts
|
|
1837
|
-
import { AssetId as
|
|
1838
|
-
import { zeroAddress as
|
|
1947
|
+
import { AssetId as CaipAssetId2 } from "caip";
|
|
1948
|
+
import { zeroAddress as zeroAddress4 } from "viem";
|
|
1839
1949
|
import z7 from "zod/v4";
|
|
1840
1950
|
|
|
1841
1951
|
// src/tokenscope/name-token.ts
|
|
1842
|
-
import { isAddressEqual as
|
|
1843
|
-
import { DatasourceNames } from "@ensnode/datasources";
|
|
1952
|
+
import { isAddressEqual as isAddressEqual4, zeroAddress as zeroAddress3 } from "viem";
|
|
1953
|
+
import { DatasourceNames as DatasourceNames2 } from "@ensnode/datasources";
|
|
1844
1954
|
var NameTokenOwnershipTypes = {
|
|
1845
1955
|
/**
|
|
1846
1956
|
* Name Token is owned by NameWrapper account.
|
|
@@ -1871,12 +1981,12 @@ function serializeNameToken(nameToken) {
|
|
|
1871
1981
|
function getNameWrapperAccounts(namespaceId) {
|
|
1872
1982
|
const ethnamesNameWrapperAccount = getDatasourceContract(
|
|
1873
1983
|
namespaceId,
|
|
1874
|
-
|
|
1984
|
+
DatasourceNames2.ENSRoot,
|
|
1875
1985
|
"NameWrapper"
|
|
1876
1986
|
);
|
|
1877
1987
|
const lineanamesNameWrapperAccount = maybeGetDatasourceContract(
|
|
1878
1988
|
namespaceId,
|
|
1879
|
-
|
|
1989
|
+
DatasourceNames2.Lineanames,
|
|
1880
1990
|
"NameWrapper"
|
|
1881
1991
|
);
|
|
1882
1992
|
const nameWrapperAccounts = [
|
|
@@ -1899,7 +2009,7 @@ function getNameTokenOwnership(namespaceId, name, owner) {
|
|
|
1899
2009
|
owner
|
|
1900
2010
|
};
|
|
1901
2011
|
}
|
|
1902
|
-
if (
|
|
2012
|
+
if (isAddressEqual4(owner.address, zeroAddress3)) {
|
|
1903
2013
|
return {
|
|
1904
2014
|
ownershipType: NameTokenOwnershipTypes.Burned,
|
|
1905
2015
|
owner
|
|
@@ -1940,7 +2050,7 @@ var makeAssetIdSchema = (valueLabel = "Asset ID Schema", serializable) => {
|
|
|
1940
2050
|
};
|
|
1941
2051
|
var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z7.preprocess((v) => {
|
|
1942
2052
|
if (typeof v === "string") {
|
|
1943
|
-
const result = new
|
|
2053
|
+
const result = new CaipAssetId2(v);
|
|
1944
2054
|
return {
|
|
1945
2055
|
assetNamespace: result.assetName.namespace,
|
|
1946
2056
|
contract: {
|
|
@@ -1954,7 +2064,7 @@ var makeAssetIdStringSchema = (valueLabel = "Asset ID String Schema") => z7.prep
|
|
|
1954
2064
|
}, makeAssetIdSchema(valueLabel));
|
|
1955
2065
|
function invariant_nameTokenOwnershipHasNonZeroAddressOwner(ctx) {
|
|
1956
2066
|
const ownership = ctx.value;
|
|
1957
|
-
if (ctx.value.owner.address ===
|
|
2067
|
+
if (ctx.value.owner.address === zeroAddress4) {
|
|
1958
2068
|
ctx.issues.push({
|
|
1959
2069
|
code: "custom",
|
|
1960
2070
|
input: ctx.value,
|
|
@@ -1980,7 +2090,7 @@ var makeNameTokenOwnershipUnknownSchema = (valueLabel = "Name Token Ownership Un
|
|
|
1980
2090
|
}).check(invariant_nameTokenOwnershipHasNonZeroAddressOwner);
|
|
1981
2091
|
function invariant_nameTokenOwnershipHasZeroAddressOwner(ctx) {
|
|
1982
2092
|
const ownership = ctx.value;
|
|
1983
|
-
if (ctx.value.owner.address !==
|
|
2093
|
+
if (ctx.value.owner.address !== zeroAddress4) {
|
|
1984
2094
|
ctx.issues.push({
|
|
1985
2095
|
code: "custom",
|
|
1986
2096
|
input: ctx.value,
|
|
@@ -2001,10 +2111,6 @@ var makeNameTokenSchema = (valueLabel = "Name Token Schema", serializable) => z7
|
|
|
2001
2111
|
});
|
|
2002
2112
|
|
|
2003
2113
|
// src/tokenscope/assets.ts
|
|
2004
|
-
var AssetNamespaces = {
|
|
2005
|
-
ERC721: "erc721",
|
|
2006
|
-
ERC1155: "erc1155"
|
|
2007
|
-
};
|
|
2008
2114
|
function serializeAssetId(assetId) {
|
|
2009
2115
|
return {
|
|
2010
2116
|
assetNamespace: assetId.assetNamespace,
|
|
@@ -2022,14 +2128,6 @@ ${prettifyError6(parsed.error)}
|
|
|
2022
2128
|
}
|
|
2023
2129
|
return parsed.data;
|
|
2024
2130
|
}
|
|
2025
|
-
function formatAssetId(assetId) {
|
|
2026
|
-
const { assetNamespace, contract, tokenId } = serializeAssetId(assetId);
|
|
2027
|
-
return CaipAssetId2.format({
|
|
2028
|
-
chainId: { namespace: "eip155", reference: contract.chainId.toString() },
|
|
2029
|
-
assetName: { namespace: assetNamespace, reference: contract.address },
|
|
2030
|
-
tokenId
|
|
2031
|
-
}).toLowerCase();
|
|
2032
|
-
}
|
|
2033
2131
|
function parseAssetId(maybeAssetId, valueLabel) {
|
|
2034
2132
|
const schema = makeAssetIdStringSchema(valueLabel);
|
|
2035
2133
|
const parsed = schema.safeParse(maybeAssetId);
|
|
@@ -2058,13 +2156,13 @@ var NFTMintStatuses = {
|
|
|
2058
2156
|
Burned: "burned"
|
|
2059
2157
|
};
|
|
2060
2158
|
var formatNFTTransferEventMetadata = (metadata) => {
|
|
2061
|
-
const
|
|
2159
|
+
const assetIdString = formatAssetId(metadata.nft);
|
|
2062
2160
|
return [
|
|
2063
2161
|
`Event: ${metadata.eventHandlerName}`,
|
|
2064
2162
|
`Chain ID: ${metadata.chainId}`,
|
|
2065
2163
|
`Block Number: ${metadata.blockNumber}`,
|
|
2066
2164
|
`Transaction Hash: ${metadata.transactionHash}`,
|
|
2067
|
-
`NFT: ${
|
|
2165
|
+
`NFT: ${assetIdString}`
|
|
2068
2166
|
].map((line) => ` - ${line}`).join("\n");
|
|
2069
2167
|
};
|
|
2070
2168
|
var NFTTransferTypes = {
|
|
@@ -2170,11 +2268,11 @@ var NFTTransferTypes = {
|
|
|
2170
2268
|
};
|
|
2171
2269
|
var getNFTTransferType = (from, to, allowMintedRemint, metadata, currentlyIndexedOwner) => {
|
|
2172
2270
|
const isIndexed = currentlyIndexedOwner !== void 0;
|
|
2173
|
-
const isIndexedAsMinted = isIndexed && !
|
|
2174
|
-
const isMint =
|
|
2175
|
-
const isBurn =
|
|
2176
|
-
const isSelfTransfer =
|
|
2177
|
-
if (isIndexed && !
|
|
2271
|
+
const isIndexedAsMinted = isIndexed && !isAddressEqual5(currentlyIndexedOwner, zeroAddress5);
|
|
2272
|
+
const isMint = isAddressEqual5(from, zeroAddress5);
|
|
2273
|
+
const isBurn = isAddressEqual5(to, zeroAddress5);
|
|
2274
|
+
const isSelfTransfer = isAddressEqual5(from, to);
|
|
2275
|
+
if (isIndexed && !isAddressEqual5(currentlyIndexedOwner, from)) {
|
|
2178
2276
|
if (isMint && allowMintedRemint) {
|
|
2179
2277
|
} else {
|
|
2180
2278
|
throw new Error(
|
|
@@ -2463,10 +2561,10 @@ import { namehash as namehash3 } from "viem/ens";
|
|
|
2463
2561
|
import z12 from "zod/v4";
|
|
2464
2562
|
|
|
2465
2563
|
// ../ens-referrals/src/address.ts
|
|
2466
|
-
import { isAddress as
|
|
2564
|
+
import { isAddress as isAddress4 } from "viem";
|
|
2467
2565
|
|
|
2468
2566
|
// ../ens-referrals/src/encoding.ts
|
|
2469
|
-
import { getAddress, pad, size as size2, slice, zeroAddress as
|
|
2567
|
+
import { getAddress, pad, size as size2, slice, zeroAddress as zeroAddress6 } from "viem";
|
|
2470
2568
|
var ENCODED_REFERRER_BYTE_OFFSET = 12;
|
|
2471
2569
|
var ENCODED_REFERRER_BYTE_LENGTH = 32;
|
|
2472
2570
|
var EXPECTED_ENCODED_REFERRER_PADDING = pad("0x", {
|
|
@@ -2485,7 +2583,7 @@ function decodeEncodedReferrer(encodedReferrer) {
|
|
|
2485
2583
|
}
|
|
2486
2584
|
const padding = slice(encodedReferrer, 0, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2487
2585
|
if (padding !== EXPECTED_ENCODED_REFERRER_PADDING) {
|
|
2488
|
-
return
|
|
2586
|
+
return zeroAddress6;
|
|
2489
2587
|
}
|
|
2490
2588
|
const decodedReferrer = slice(encodedReferrer, ENCODED_REFERRER_BYTE_OFFSET);
|
|
2491
2589
|
try {
|
|
@@ -2514,7 +2612,7 @@ var ReferrerDetailTypeIds = {
|
|
|
2514
2612
|
};
|
|
2515
2613
|
|
|
2516
2614
|
// src/registrars/zod-schemas.ts
|
|
2517
|
-
import z10 from "zod/v4";
|
|
2615
|
+
import { z as z10 } from "zod/v4";
|
|
2518
2616
|
|
|
2519
2617
|
// src/registrars/registrar-action.ts
|
|
2520
2618
|
var RegistrarActionTypes = {
|
|
@@ -2902,14 +3000,14 @@ var registrarActionsPrerequisites = Object.freeze({
|
|
|
2902
3000
|
|
|
2903
3001
|
// src/registrars/basenames-subregistry.ts
|
|
2904
3002
|
import {
|
|
2905
|
-
DatasourceNames as
|
|
3003
|
+
DatasourceNames as DatasourceNames3,
|
|
2906
3004
|
ENSNamespaceIds as ENSNamespaceIds3,
|
|
2907
3005
|
maybeGetDatasource as maybeGetDatasource2
|
|
2908
3006
|
} from "@ensnode/datasources";
|
|
2909
3007
|
function getBasenamesSubregistryId(namespace) {
|
|
2910
|
-
const datasource = maybeGetDatasource2(namespace,
|
|
3008
|
+
const datasource = maybeGetDatasource2(namespace, DatasourceNames3.Basenames);
|
|
2911
3009
|
if (!datasource) {
|
|
2912
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3010
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames3.Basenames}`);
|
|
2913
3011
|
}
|
|
2914
3012
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
2915
3013
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -2926,7 +3024,6 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
2926
3024
|
return "base.eth";
|
|
2927
3025
|
case ENSNamespaceIds3.Sepolia:
|
|
2928
3026
|
return "basetest.eth";
|
|
2929
|
-
case ENSNamespaceIds3.Holesky:
|
|
2930
3027
|
case ENSNamespaceIds3.EnsTestEnv:
|
|
2931
3028
|
throw new Error(
|
|
2932
3029
|
`No registrar managed name is known for the 'basenames' subregistry within the "${namespaceId}" namespace.`
|
|
@@ -2936,14 +3033,14 @@ function getBasenamesSubregistryManagedName(namespaceId) {
|
|
|
2936
3033
|
|
|
2937
3034
|
// src/registrars/ethnames-subregistry.ts
|
|
2938
3035
|
import {
|
|
2939
|
-
DatasourceNames as
|
|
3036
|
+
DatasourceNames as DatasourceNames4,
|
|
2940
3037
|
ENSNamespaceIds as ENSNamespaceIds4,
|
|
2941
3038
|
maybeGetDatasource as maybeGetDatasource3
|
|
2942
3039
|
} from "@ensnode/datasources";
|
|
2943
3040
|
function getEthnamesSubregistryId(namespace) {
|
|
2944
|
-
const datasource = maybeGetDatasource3(namespace,
|
|
3041
|
+
const datasource = maybeGetDatasource3(namespace, DatasourceNames4.ENSRoot);
|
|
2945
3042
|
if (!datasource) {
|
|
2946
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3043
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames4.ENSRoot}`);
|
|
2947
3044
|
}
|
|
2948
3045
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
2949
3046
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -2958,7 +3055,6 @@ function getEthnamesSubregistryManagedName(namespaceId) {
|
|
|
2958
3055
|
switch (namespaceId) {
|
|
2959
3056
|
case ENSNamespaceIds4.Mainnet:
|
|
2960
3057
|
case ENSNamespaceIds4.Sepolia:
|
|
2961
|
-
case ENSNamespaceIds4.Holesky:
|
|
2962
3058
|
case ENSNamespaceIds4.EnsTestEnv:
|
|
2963
3059
|
return "eth";
|
|
2964
3060
|
}
|
|
@@ -2966,14 +3062,14 @@ function getEthnamesSubregistryManagedName(namespaceId) {
|
|
|
2966
3062
|
|
|
2967
3063
|
// src/registrars/lineanames-subregistry.ts
|
|
2968
3064
|
import {
|
|
2969
|
-
DatasourceNames as
|
|
3065
|
+
DatasourceNames as DatasourceNames5,
|
|
2970
3066
|
ENSNamespaceIds as ENSNamespaceIds5,
|
|
2971
3067
|
maybeGetDatasource as maybeGetDatasource4
|
|
2972
3068
|
} from "@ensnode/datasources";
|
|
2973
3069
|
function getLineanamesSubregistryId(namespace) {
|
|
2974
|
-
const datasource = maybeGetDatasource4(namespace,
|
|
3070
|
+
const datasource = maybeGetDatasource4(namespace, DatasourceNames5.Lineanames);
|
|
2975
3071
|
if (!datasource) {
|
|
2976
|
-
throw new Error(`Datasource not found for ${namespace} ${
|
|
3072
|
+
throw new Error(`Datasource not found for ${namespace} ${DatasourceNames5.Lineanames}`);
|
|
2977
3073
|
}
|
|
2978
3074
|
const address = datasource.contracts.BaseRegistrar?.address;
|
|
2979
3075
|
if (address === void 0 || Array.isArray(address)) {
|
|
@@ -2990,7 +3086,6 @@ function getLineanamesSubregistryManagedName(namespaceId) {
|
|
|
2990
3086
|
return "linea.eth";
|
|
2991
3087
|
case ENSNamespaceIds5.Sepolia:
|
|
2992
3088
|
return "linea-sepolia.eth";
|
|
2993
|
-
case ENSNamespaceIds5.Holesky:
|
|
2994
3089
|
case ENSNamespaceIds5.EnsTestEnv:
|
|
2995
3090
|
throw new Error(
|
|
2996
3091
|
`No registrar managed name is known for the 'Lineanames' subregistry within the "${namespaceId}" namespace.`
|
|
@@ -2998,6 +3093,21 @@ function getLineanamesSubregistryManagedName(namespaceId) {
|
|
|
2998
3093
|
}
|
|
2999
3094
|
}
|
|
3000
3095
|
|
|
3096
|
+
// src/registrars/registration-expiration.ts
|
|
3097
|
+
function isRegistrationExpired(info, now) {
|
|
3098
|
+
if (info.expiry == null) return false;
|
|
3099
|
+
return info.expiry <= now;
|
|
3100
|
+
}
|
|
3101
|
+
function isRegistrationFullyExpired(info, now) {
|
|
3102
|
+
if (info.expiry == null) return false;
|
|
3103
|
+
return now >= info.expiry + (info.gracePeriod ?? 0n);
|
|
3104
|
+
}
|
|
3105
|
+
function isRegistrationInGracePeriod(info, now) {
|
|
3106
|
+
if (info.expiry == null) return false;
|
|
3107
|
+
if (info.gracePeriod == null) return false;
|
|
3108
|
+
return info.expiry <= now && info.expiry + info.gracePeriod > now;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3001
3111
|
// src/api/registrar-actions/serialize.ts
|
|
3002
3112
|
function serializeNamedRegistrarAction({
|
|
3003
3113
|
action,
|
|
@@ -4109,6 +4219,30 @@ var ENSNodeClient = class _ENSNodeClient {
|
|
|
4109
4219
|
}
|
|
4110
4220
|
};
|
|
4111
4221
|
|
|
4222
|
+
// src/ensv2/ids-lib.ts
|
|
4223
|
+
import { hexToBigInt as hexToBigInt2 } from "viem";
|
|
4224
|
+
var makeRegistryId = (accountId) => formatAccountId(accountId);
|
|
4225
|
+
var makeENSv1DomainId = (node) => node;
|
|
4226
|
+
var makeENSv2DomainId = (registry, canonicalId) => formatAssetId({
|
|
4227
|
+
assetNamespace: AssetNamespaces.ERC1155,
|
|
4228
|
+
contract: registry,
|
|
4229
|
+
tokenId: canonicalId
|
|
4230
|
+
});
|
|
4231
|
+
var maskLower32Bits = (num) => num ^ num & 0xffffffffn;
|
|
4232
|
+
var getCanonicalId = (input) => {
|
|
4233
|
+
if (typeof input === "bigint") return maskLower32Bits(input);
|
|
4234
|
+
return getCanonicalId(hexToBigInt2(input));
|
|
4235
|
+
};
|
|
4236
|
+
var makePermissionsId = (contract) => formatAccountId(contract);
|
|
4237
|
+
var makePermissionsResourceId = (contract, resource) => `${makePermissionsId(contract)}/${resource}`;
|
|
4238
|
+
var makePermissionsUserId = (contract, resource, user) => `${makePermissionsId(contract)}/${resource}/${user}`;
|
|
4239
|
+
var makeResolverId = (contract) => formatAccountId(contract);
|
|
4240
|
+
var makeResolverRecordsId = (resolver, node) => `${makeResolverId(resolver)}/${node}`;
|
|
4241
|
+
var makeLatestRegistrationId = (domainId) => `${domainId}/latest`;
|
|
4242
|
+
var makeRegistrationId = (domainId, index = 0) => `${domainId}/${index}`;
|
|
4243
|
+
var makeLatestRenewalId = (domainId, registrationIndex) => `${makeRegistrationId(domainId, registrationIndex)}/latest`;
|
|
4244
|
+
var makeRenewalId = (domainId, registrationIndex, index = 0) => `${makeRegistrationId(domainId, registrationIndex)}/${index}`;
|
|
4245
|
+
|
|
4112
4246
|
// src/identity/identity.ts
|
|
4113
4247
|
import { getENSRootChainId as getENSRootChainId2 } from "@ensnode/datasources";
|
|
4114
4248
|
|
|
@@ -4213,6 +4347,7 @@ export {
|
|
|
4213
4347
|
LruCache,
|
|
4214
4348
|
NFTMintStatuses,
|
|
4215
4349
|
NFTTransferTypes,
|
|
4350
|
+
NODE_ANY,
|
|
4216
4351
|
NameTokenOwnershipTypes,
|
|
4217
4352
|
NameTokensResponseCodes,
|
|
4218
4353
|
NameTokensResponseErrorCodes,
|
|
@@ -4222,6 +4357,7 @@ export {
|
|
|
4222
4357
|
RECORDS_PER_PAGE_DEFAULT,
|
|
4223
4358
|
RECORDS_PER_PAGE_MAX,
|
|
4224
4359
|
ROOT_NODE,
|
|
4360
|
+
ROOT_RESOURCE,
|
|
4225
4361
|
ReferrerDetailResponseCodes,
|
|
4226
4362
|
ReferrerLeaderboardPageResponseCodes,
|
|
4227
4363
|
RegistrarActionTypes,
|
|
@@ -4285,15 +4421,20 @@ export {
|
|
|
4285
4421
|
deserializedNameTokensResponse,
|
|
4286
4422
|
durationBetween,
|
|
4287
4423
|
encodeLabelHash,
|
|
4424
|
+
encodedLabelToLabelhash,
|
|
4288
4425
|
evmChainIdToCoinType,
|
|
4289
4426
|
formatAccountId,
|
|
4290
4427
|
formatAssetId,
|
|
4291
4428
|
formatNFTTransferEventMetadata,
|
|
4292
4429
|
getBasenamesSubregistryId,
|
|
4293
4430
|
getBasenamesSubregistryManagedName,
|
|
4431
|
+
getCanonicalId,
|
|
4294
4432
|
getCurrencyInfo,
|
|
4295
4433
|
getDatasourceContract,
|
|
4296
4434
|
getENSRootChainId,
|
|
4435
|
+
getENSv1Registry,
|
|
4436
|
+
getENSv2RootRegistry,
|
|
4437
|
+
getENSv2RootRegistryId,
|
|
4297
4438
|
getEthnamesSubregistryId,
|
|
4298
4439
|
getEthnamesSubregistryManagedName,
|
|
4299
4440
|
getLatestIndexedBlockRef,
|
|
@@ -4310,16 +4451,33 @@ export {
|
|
|
4310
4451
|
getTimestampForHighestOmnichainKnownBlock,
|
|
4311
4452
|
getTimestampForLowestOmnichainStartBlock,
|
|
4312
4453
|
hasNullByte,
|
|
4454
|
+
interpretAddress,
|
|
4455
|
+
interpretAddressRecordValue,
|
|
4456
|
+
interpretNameRecordValue,
|
|
4457
|
+
interpretTextRecordKey,
|
|
4458
|
+
interpretTextRecordValue,
|
|
4459
|
+
interpretTokenIdAsLabelHash,
|
|
4460
|
+
interpretTokenIdAsNode,
|
|
4313
4461
|
interpretedLabelsToInterpretedName,
|
|
4462
|
+
interpretedNameToInterpretedLabels,
|
|
4463
|
+
interpretedNameToLabelHashPath,
|
|
4464
|
+
isENSv1Registry,
|
|
4465
|
+
isENSv2RootRegistry,
|
|
4314
4466
|
isEncodedLabelHash,
|
|
4315
4467
|
isHttpProtocol,
|
|
4468
|
+
isInterpetedLabel,
|
|
4469
|
+
isInterpretedName,
|
|
4316
4470
|
isLabelHash,
|
|
4317
4471
|
isNormalizedLabel,
|
|
4318
4472
|
isNormalizedName,
|
|
4473
|
+
isPccFuseSet,
|
|
4319
4474
|
isPriceCurrencyEqual,
|
|
4320
4475
|
isPriceEqual,
|
|
4321
4476
|
isRegistrarActionPricingAvailable,
|
|
4322
4477
|
isRegistrarActionReferralAvailable,
|
|
4478
|
+
isRegistrationExpired,
|
|
4479
|
+
isRegistrationFullyExpired,
|
|
4480
|
+
isRegistrationInGracePeriod,
|
|
4323
4481
|
isResolvedIdentity,
|
|
4324
4482
|
isSelectionEmpty,
|
|
4325
4483
|
isSubgraphCompatible,
|
|
@@ -4329,7 +4487,20 @@ export {
|
|
|
4329
4487
|
literalLabelToInterpretedLabel,
|
|
4330
4488
|
literalLabelsToInterpretedName,
|
|
4331
4489
|
literalLabelsToLiteralName,
|
|
4490
|
+
makeContractMatcher,
|
|
4332
4491
|
makeENSApiPublicConfigSchema,
|
|
4492
|
+
makeENSv1DomainId,
|
|
4493
|
+
makeENSv2DomainId,
|
|
4494
|
+
makeLatestRegistrationId,
|
|
4495
|
+
makeLatestRenewalId,
|
|
4496
|
+
makePermissionsId,
|
|
4497
|
+
makePermissionsResourceId,
|
|
4498
|
+
makePermissionsUserId,
|
|
4499
|
+
makeRegistrationId,
|
|
4500
|
+
makeRegistryId,
|
|
4501
|
+
makeRenewalId,
|
|
4502
|
+
makeResolverId,
|
|
4503
|
+
makeResolverRecordsId,
|
|
4333
4504
|
makeSubdomainNode,
|
|
4334
4505
|
maybeGetDatasourceContract,
|
|
4335
4506
|
nameTokensPrerequisites,
|