enssdk 1.14.0 → 1.15.0
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/README.md +6 -0
- package/dist/{evm-Dhdhx057.d.ts → evm-Dd4Y60SN.d.ts} +20 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/omnigraph/index.d.ts +31 -311
- package/dist/omnigraph/index.js +33 -356
- package/dist/omnigraph/index.js.map +1 -1
- package/package.json +2 -2
- package/src/omnigraph/generated/schema.graphql +38 -59
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@ Learn more about [ENSNode](https://ensnode.io/) from [the ENSNode docs](https://
|
|
|
10
10
|
npm install enssdk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> **Version compatibility:** Our hosted ENSNode instances currently run ENSNode v1.13. If you are querying them from your own app, you **must** use `enssdk@1.13.1`. The latest published version (`1.14.0+`) contains breaking changes in the Omnigraph API data model not yet deployed to our hosted infrastructure. This notice will be removed once the hosted instances are upgraded.
|
|
14
|
+
>
|
|
15
|
+
> ```bash
|
|
16
|
+
> npm install enssdk@1.13.1
|
|
17
|
+
> ```
|
|
18
|
+
|
|
13
19
|
## Usage
|
|
14
20
|
|
|
15
21
|
### Core Client
|
|
@@ -106,6 +106,24 @@ type LiteralLabel = Label & {
|
|
|
106
106
|
type InterpretedLabel = Label & {
|
|
107
107
|
__brand: "InterpretedLabel";
|
|
108
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* A Beautified Label is a Label produced for presentation in a UI from an {@link InterpretedLabel}.
|
|
111
|
+
*
|
|
112
|
+
* It is either:
|
|
113
|
+
* a) an Encoded LabelHash, preserved verbatim from the source InterpretedLabel, or
|
|
114
|
+
* b) a Label produced by passing a normalized Label through ENSIP-15 beautification, which is
|
|
115
|
+
* guaranteed to be normalizable back to the original normalized Label but is itself NOT
|
|
116
|
+
* necessarily normalized (e.g. `"♾"` → `"♾️"`).
|
|
117
|
+
*
|
|
118
|
+
* Because (b) is not guaranteed to be normalized, a BeautifiedLabel is NOT an InterpretedLabel and
|
|
119
|
+
* MUST NOT be used as a lookup key or anywhere else that expects an InterpretedLabel.
|
|
120
|
+
*
|
|
121
|
+
* @see https://docs.ens.domains/ensip/15
|
|
122
|
+
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
123
|
+
*/
|
|
124
|
+
type BeautifiedLabel = Label & {
|
|
125
|
+
__brand: "BeautifiedLabel";
|
|
126
|
+
};
|
|
109
127
|
/**
|
|
110
128
|
* A Literal Name is a Name as it literally appears onchain, composed of 0 or more Literal Labels
|
|
111
129
|
* joined by dots. It may be an unnormalized name for reasons including:
|
|
@@ -152,6 +170,7 @@ type InterpretedName = Name & {
|
|
|
152
170
|
* MUST NOT be used as a navigation target, lookup key, or anywhere else that expects an
|
|
153
171
|
* InterpretedName.
|
|
154
172
|
*
|
|
173
|
+
* @see https://docs.ens.domains/ensip/15
|
|
155
174
|
* @dev nominally typed to enforce usage & enhance codebase clarity
|
|
156
175
|
*/
|
|
157
176
|
type BeautifiedName = Name & {
|
|
@@ -478,4 +497,4 @@ interface AssetId {
|
|
|
478
497
|
tokenId: TokenId;
|
|
479
498
|
}
|
|
480
499
|
|
|
481
|
-
export { type Address as A, type
|
|
500
|
+
export { type Address as A, type BeautifiedLabel as B, type ChainId as C, type DNSEncodedLiteralName as D, type ENSv1RegistryId as E, type DefaultableChainId as F, type DurationBigInt as G, type Hex as H, type InterpretedLabel as I, type RegistryId as J, type SubgraphInterpretedLabel as K, type LiteralLabel as L, type SubgraphInterpretedName as M, type NormalizedAddress as N, type PermissionsId as P, type RegistrationId as R, type StorageId as S, type TokenId as T, type UnixTimestampBigInt as U, type Wei as W, type InterpretedName as a, type BeautifiedName as b, type AccountId as c, type AssetId as d, type Node as e, type DNSEncodedName as f, type ENSv2RegistryId as g, type ENSv1DomainId as h, type ENSv1VirtualRegistryId as i, type ENSv2DomainId as j, type PermissionsResourceId as k, type PermissionsUserId as l, type DomainId as m, type RenewalId as n, type ResolverId as o, type ResolverRecordsId as p, type LabelHash as q, type Label as r, type Name as s, type LiteralName as t, type LabelHashPath as u, type EncodedLabelHash as v, type AssetNamespace as w, AssetNamespaces as x, type CanonicalPath as y, type DNSEncodedPartiallyInterpretedName as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as Hex, A as Address, N as NormalizedAddress, I as
|
|
2
|
-
export {
|
|
1
|
+
import { H as Hex, A as Address, N as NormalizedAddress, I as InterpretedLabel, B as BeautifiedLabel, a as InterpretedName, b as BeautifiedName, c as AccountId, d as AssetId, C as ChainId, e as Node, D as DNSEncodedLiteralName, L as LiteralLabel, f as DNSEncodedName, E as ENSv1RegistryId, g as ENSv2RegistryId, h as ENSv1DomainId, i as ENSv1VirtualRegistryId, S as StorageId, j as ENSv2DomainId, P as PermissionsId, k as PermissionsResourceId, l as PermissionsUserId, m as DomainId, R as RegistrationId, n as RenewalId, o as ResolverId, p as ResolverRecordsId, T as TokenId, q as LabelHash, r as Label, s as Name, t as LiteralName, u as LabelHashPath, v as EncodedLabelHash } from './evm-Dd4Y60SN.js';
|
|
2
|
+
export { w as AssetNamespace, x as AssetNamespaces, y as CanonicalPath, z as DNSEncodedPartiallyInterpretedName, F as DefaultableChainId, G as DurationBigInt, J as RegistryId, K as SubgraphInterpretedLabel, M as SubgraphInterpretedName, U as UnixTimestampBigInt, W as Wei } from './evm-Dd4Y60SN.js';
|
|
3
3
|
import { EvmCoinType, CoinType } from '@ensdomains/address-encoder';
|
|
4
4
|
export { CoinType, EvmCoinType } from '@ensdomains/address-encoder';
|
|
5
5
|
import 'viem';
|
|
@@ -112,13 +112,26 @@ declare function toNormalizedAddress(maybeAddress: string): NormalizedAddress;
|
|
|
112
112
|
declare function asNormalizedAddress(address: Address): NormalizedAddress;
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
|
-
* Converts an {@link
|
|
115
|
+
* Converts an {@link InterpretedLabel} into a {@link BeautifiedLabel} suitable for presentation in a UI.
|
|
116
116
|
*
|
|
117
|
-
* Each label of the InterpretedName is either an Encoded LabelHash or a normalized Label:
|
|
118
117
|
* - Encoded LabelHash labels are preserved verbatim.
|
|
119
118
|
* - Normalized Labels are passed through {@link ens_beautify}, producing a Label that is
|
|
120
119
|
* normalizable (and normalizes back to the input) but may itself be unnormalized.
|
|
121
120
|
*
|
|
121
|
+
* The resulting BeautifiedLabel is suitable for display but is NOT an InterpretedLabel, and the
|
|
122
|
+
* branded return type prevents it from being passed to APIs that expect one. Continue to use the
|
|
123
|
+
* source InterpretedLabel for lookup keys and anywhere else that expects an InterpretedLabel.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* beautifyInterpretedLabel("♾♾♾♾" as InterpretedLabel) // → "♾️♾️♾️♾️"
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare const beautifyInterpretedLabel: (label: InterpretedLabel) => BeautifiedLabel;
|
|
131
|
+
/**
|
|
132
|
+
* Converts an {@link InterpretedName} into a {@link BeautifiedName} suitable for presentation in a UI
|
|
133
|
+
* by beautifying each of its labels via {@link beautifyInterpretedLabel}.
|
|
134
|
+
*
|
|
122
135
|
* The resulting BeautifiedName is suitable for display but is NOT an InterpretedName, and the
|
|
123
136
|
* branded return type prevents it from being passed to APIs that expect one. Continue to use the
|
|
124
137
|
* source InterpretedName for navigation targets, lookup keys, and anywhere else that expects an
|
|
@@ -680,4 +693,4 @@ declare const coinTypeReverseLabel: (coinType: CoinType) => LiteralLabel;
|
|
|
680
693
|
*/
|
|
681
694
|
declare function reverseName(address: NormalizedAddress, coinType: CoinType): LiteralName;
|
|
682
695
|
|
|
683
|
-
export { ADDR_REVERSE_NODE, AccountId, type AccountIdString, Address, AssetId, type AssetIdString, BeautifiedName, ChainId, type ChainIdString, type ContentType, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, DNSEncodedLiteralName, DNSEncodedName, type DatetimeISO8601, DomainId, type Duration, type EACResource, type EACRoleBitmap, ENS_ROOT_NAME, ENS_ROOT_NODE, ENSv1DomainId, ENSv1RegistryId, ENSv1VirtualRegistryId, ENSv2DomainId, ENSv2RegistryId, ETH_COIN_TYPE, ETH_NODE, EncodedLabelHash, Hex, type InterfaceId, InterpretedLabel, InterpretedName, Label, LabelHash, LabelHashPath, LiteralLabel, LiteralName, Name, Node, NormalizedAddress, PermissionsId, PermissionsResourceId, PermissionsUserId, ROOT_RESOURCE, type RecordVersion, RegistrationId, RenewalId, ResolverId, ResolverRecordsId, StorageId, TokenId, type UnixTimestamp, type UrlString, addrReverseLabel, asInterpretedLabel, asInterpretedName, asLiteralLabel, asLiteralName, asNormalizedAddress, beautifyInterpretedName, beautifyName, bigintToCoinType, coinTypeReverseLabel, coinTypeToEvmChainId, constructSubInterpretedName, decodeDNSEncodedLiteralName, decodeDNSEncodedName, decodeEncodedLabelHash, encodeLabelHash, ensureInterpretedLabel, evmChainIdToCoinType, getNameHierarchy, getParentInterpretedName, interpretTokenIdAsLabelHash, interpretTokenIdAsNode, interpretedLabelsToInterpretedName, interpretedLabelsToLabelHashPath, interpretedNameToInterpretedLabels, isEncodedLabelHash, isInterfaceId, isInterpretedLabel, isInterpretedName, isLabelHash, isNormalizedAddress, isNormalizedLabel, isNormalizedName, labelhashInterpretedLabel, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, literalNameToInterpretedName, literalNameToLiteralLabels, makeConcreteRegistryId, makeENSv1DomainId, makeENSv1RegistryId, makeENSv1VirtualRegistryId, makeENSv2DomainId, makeENSv2RegistryId, makePermissionsId, makePermissionsResourceId, makePermissionsUserId, makeRegistrationId, makeRenewalId, makeResolverId, makeResolverRecordsId, makeStorageId, makeSubdomainNode, namehashInterpretedName, normalizeLabel, normalizeName, parseEncodedLabelHash, parseLabelHash, parseLabelHashOrEncodedLabelHash, parseReverseName, reinterpretLabel, reinterpretName, reverseName, stringifyAccountId, stringifyAssetId, toNormalizedAddress };
|
|
696
|
+
export { ADDR_REVERSE_NODE, AccountId, type AccountIdString, Address, AssetId, type AssetIdString, BeautifiedLabel, BeautifiedName, ChainId, type ChainIdString, type ContentType, DEFAULT_EVM_CHAIN_ID, DEFAULT_EVM_COIN_TYPE, DNSEncodedLiteralName, DNSEncodedName, type DatetimeISO8601, DomainId, type Duration, type EACResource, type EACRoleBitmap, ENS_ROOT_NAME, ENS_ROOT_NODE, ENSv1DomainId, ENSv1RegistryId, ENSv1VirtualRegistryId, ENSv2DomainId, ENSv2RegistryId, ETH_COIN_TYPE, ETH_NODE, EncodedLabelHash, Hex, type InterfaceId, InterpretedLabel, InterpretedName, Label, LabelHash, LabelHashPath, LiteralLabel, LiteralName, Name, Node, NormalizedAddress, PermissionsId, PermissionsResourceId, PermissionsUserId, ROOT_RESOURCE, type RecordVersion, RegistrationId, RenewalId, ResolverId, ResolverRecordsId, StorageId, TokenId, type UnixTimestamp, type UrlString, addrReverseLabel, asInterpretedLabel, asInterpretedName, asLiteralLabel, asLiteralName, asNormalizedAddress, beautifyInterpretedLabel, beautifyInterpretedName, beautifyName, bigintToCoinType, coinTypeReverseLabel, coinTypeToEvmChainId, constructSubInterpretedName, decodeDNSEncodedLiteralName, decodeDNSEncodedName, decodeEncodedLabelHash, encodeLabelHash, ensureInterpretedLabel, evmChainIdToCoinType, getNameHierarchy, getParentInterpretedName, interpretTokenIdAsLabelHash, interpretTokenIdAsNode, interpretedLabelsToInterpretedName, interpretedLabelsToLabelHashPath, interpretedNameToInterpretedLabels, isEncodedLabelHash, isInterfaceId, isInterpretedLabel, isInterpretedName, isLabelHash, isNormalizedAddress, isNormalizedLabel, isNormalizedName, labelhashInterpretedLabel, labelhashLiteralLabel, literalLabelToInterpretedLabel, literalLabelsToInterpretedName, literalLabelsToLiteralName, literalNameToInterpretedName, literalNameToLiteralLabels, makeConcreteRegistryId, makeENSv1DomainId, makeENSv1RegistryId, makeENSv1VirtualRegistryId, makeENSv2DomainId, makeENSv2RegistryId, makePermissionsId, makePermissionsResourceId, makePermissionsUserId, makeRegistrationId, makeRenewalId, makeResolverId, makeResolverRecordsId, makeStorageId, makeSubdomainNode, namehashInterpretedName, normalizeLabel, normalizeName, parseEncodedLabelHash, parseLabelHash, parseLabelHashOrEncodedLabelHash, parseReverseName, reinterpretLabel, reinterpretName, reverseName, stringifyAccountId, stringifyAssetId, toNormalizedAddress };
|
package/dist/index.js
CHANGED
|
@@ -202,10 +202,8 @@ function asInterpretedName(name) {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
// src/lib/beautify.ts
|
|
205
|
-
var
|
|
206
|
-
|
|
207
|
-
return interpretedNameToInterpretedLabels(name).map((label) => isEncodedLabelHash(label) ? label : ens_beautify(label)).join(".");
|
|
208
|
-
};
|
|
205
|
+
var beautifyInterpretedLabel = (label) => isEncodedLabelHash(label) ? label : ens_beautify(label);
|
|
206
|
+
var beautifyInterpretedName = (name) => interpretedNameToInterpretedLabels(name).map(beautifyInterpretedLabel).join(".");
|
|
209
207
|
|
|
210
208
|
// src/lib/caip.ts
|
|
211
209
|
import { AccountId as CaipAccountId, AssetId as CaipAssetId } from "caip";
|
|
@@ -459,6 +457,7 @@ export {
|
|
|
459
457
|
asLiteralLabel,
|
|
460
458
|
asLiteralName,
|
|
461
459
|
asNormalizedAddress,
|
|
460
|
+
beautifyInterpretedLabel,
|
|
462
461
|
beautifyInterpretedName,
|
|
463
462
|
beautifyName,
|
|
464
463
|
bigintToCoinType,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/address.ts","../src/lib/beautify.ts","../src/lib/namehash.ts","../src/lib/constants.ts","../src/lib/labelhash.ts","../src/lib/normalization.ts","../src/lib/interpreted-names-and-labels.ts","../src/lib/caip.ts","../src/lib/coin-type.ts","../src/lib/dns-encoded-name.ts","../src/lib/ids.ts","../src/_lib/zeroLower32Bits.ts","../src/lib/interface-id.ts","../src/_lib/uint256ToHex32.ts","../src/lib/interpret-token-id.ts","../src/lib/names.ts","../src/lib/parse-labelhash.ts","../src/lib/parse-reverse-name.ts","../src/lib/reinterpretation.ts","../src/lib/reverse-name.ts","../src/lib/types/evm.ts"],"sourcesContent":["import { isAddress } from \"viem\";\n\nimport type { Address, NormalizedAddress } from \"./types\";\n\n/**\n * Determines whether an {@link Address} is a {@link NormalizedAddress}.\n */\nexport function isNormalizedAddress(maybeAddress: string): maybeAddress is NormalizedAddress {\n const isLowerCase = maybeAddress === maybeAddress.toLowerCase();\n return isLowerCase && isAddress(maybeAddress, { strict: false });\n}\n\n/**\n * Converts an {@link Address} to a {@link NormalizedAddress}.\n *\n * @throws if `address` does not represent an EVM Address\n */\nexport function toNormalizedAddress(maybeAddress: string): NormalizedAddress {\n if (!isAddress(maybeAddress, { strict: false })) {\n throw new Error(`'${maybeAddress}' does not represent an EVM Address.`);\n }\n\n return maybeAddress.toLowerCase() as NormalizedAddress;\n}\n\n/**\n * Validates that an {@link Address} is already a {@link NormalizedAddress}.\n *\n * @throws if the address is not already normalized\n */\nexport function asNormalizedAddress(address: Address): NormalizedAddress {\n if (isNormalizedAddress(address)) return address;\n\n throw new Error(`Not a NormalizedAddress: '${address}'`);\n}\n","import { ens_beautify } from \"@adraffy/ens-normalize\";\n\nimport { ENS_ROOT_NAME } from \"./constants\";\nimport { interpretedNameToInterpretedLabels } from \"./interpreted-names-and-labels\";\nimport { isEncodedLabelHash } from \"./labelhash\";\nimport type { BeautifiedName, InterpretedName } from \"./types\";\n\n/**\n * Converts an {@link InterpretedName} into a {@link BeautifiedName} suitable for presentation in a UI.\n *\n * Each label of the InterpretedName is either an Encoded LabelHash or a normalized Label:\n * - Encoded LabelHash labels are preserved verbatim.\n * - Normalized Labels are passed through {@link ens_beautify}, producing a Label that is\n * normalizable (and normalizes back to the input) but may itself be unnormalized.\n *\n * The resulting BeautifiedName is suitable for display but is NOT an InterpretedName, and the\n * branded return type prevents it from being passed to APIs that expect one. Continue to use the\n * source InterpretedName for navigation targets, lookup keys, and anywhere else that expects an\n * InterpretedName.\n *\n * @example\n * ```ts\n * beautifyInterpretedName(\"♾♾♾♾.eth\" as InterpretedName) // → \"♾️♾️♾️♾️.eth\"\n * ```\n */\nexport const beautifyInterpretedName = (name: InterpretedName): BeautifiedName => {\n if (name === ENS_ROOT_NAME) return name as string as BeautifiedName;\n\n return interpretedNameToInterpretedLabels(name)\n .map((label) => (isEncodedLabelHash(label) ? label : ens_beautify(label)))\n .join(\".\") as BeautifiedName;\n};\n","import { concat, keccak256, namehash as viemNamehash } from \"viem\";\n\nimport type { InterpretedName, LabelHash, Node } from \"./types\";\n\n/**\n * Typed wrapper around viem's `namehash` that returns a branded {@link Node},\n * requiring an {@link InterpretedName} input and correctly parsing EncodedLabelHashes.\n *\n * @see https://docs.ens.domains/ensip/1\n */\nexport const namehashInterpretedName = (name: InterpretedName): Node => viemNamehash(name);\n\n/**\n * Implements one step of the namehash algorithm, combining `labelHash` with `node` to produce\n * the `node` of a given subdomain. Note that the order of the arguments is 'reversed' (as compared to\n * the actual concatenation) in order to improve readability (i.e. read as [labelHash].[node]).\n */\nexport const makeSubdomainNode = (labelHash: LabelHash, node: Node): Node =>\n keccak256(concat([node, labelHash]));\n","import { namehashInterpretedName } from \"./namehash\";\nimport type { EACResource, InterpretedName, Node } from \"./types\";\n\n/**\n * Name for the ENS Root\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ENS_ROOT_NAME = \"\" as InterpretedName;\n\n/**\n * The {@link Node} that identifies the ENS Root Name (\"\").\n */\nexport const ENS_ROOT_NODE: Node = namehashInterpretedName(ENS_ROOT_NAME);\n\n/**\n * The {@link Node} that identifies the ETH Name (\"eth\").\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ETH_NODE: Node = namehashInterpretedName(\"eth\" as InterpretedName);\n\n/**\n * The {@link Node} that identifies the addr.reverse Name (\"addr.reverse\").\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ADDR_REVERSE_NODE: Node = namehashInterpretedName(\"addr.reverse\" as InterpretedName);\n\n/**\n * ROOT_RESOURCE represents the 'root' resource in an EnhancedAccessControl contract.\n */\nexport const ROOT_RESOURCE: EACResource = 0n;\n","import { isHex, keccak256, stringToBytes } from \"viem\";\nimport { labelhash as viemLabelhash } from \"viem/ens\";\n\nimport type { EncodedLabelHash, InterpretedLabel, LabelHash, LiteralLabel } from \"./types\";\n\n/**\n * Typed wrapper around viem's `labelhash` that returns a branded {@link LabelHash},\n * requiring an {@link InterpretedLabel} input.\n *\n * Note: viem's labelhash has special-case handling for Encoded LabelHashes (e.g. `[hash]`).\n * Use {@link labelhashLiteralLabel} if you need to hash a label's literal bytes without\n * encoded labelhash detection.\n *\n * @see https://docs.ens.domains/ensip/1\n */\nexport const labelhashInterpretedLabel = (label: InterpretedLabel): LabelHash =>\n viemLabelhash(label);\n\n/**\n * Implements the ENS `labelhash` function for Literal Labels.\n * @see https://docs.ens.domains/ensip/1\n *\n * @param label the Literal Label to hash\n * @returns the hash of the provided label\n * @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.\n */\nexport const labelhashLiteralLabel = (label: LiteralLabel): LabelHash =>\n keccak256(stringToBytes(label));\n\n/**\n * Checks if the input is a {@link LabelHash}.\n *\n * @see https://ensnode.io/docs/reference/terminology#label-processing-and-classification\n */\nexport function isLabelHash(maybeLabelHash: string): maybeLabelHash is LabelHash {\n const expectedLength = maybeLabelHash.length === 66;\n const expectedEncoding = isHex(maybeLabelHash);\n const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();\n\n return expectedLength && expectedEncoding && expectedCasing;\n}\n\n/**\n * Formats a LabelHash as an Encoded LabelHash.\n *\n * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash\n *\n * @param labelHash - A 32-byte lowercase hash string starting with '0x'\n * @returns The encoded label hash in format `[labelhash_without_0x_prefix]`\n */\nexport const encodeLabelHash = (labelHash: LabelHash): EncodedLabelHash =>\n `[${labelHash.slice(2)}]`;\n\n/**\n * Parses an Encoded LabelHash (`[labelhash_without_0x_prefix]`) as a {@link LabelHash},\n * returning `null` if the input does not match the expected format.\n */\nfunction parseEncodedLabelHash(value: string): LabelHash | null {\n if (value.length !== 66) return null;\n if (value[0] !== \"[\") return null;\n if (value[65] !== \"]\") return null;\n\n const hash = `0x${value.slice(1, 65)}`;\n if (!isLabelHash(hash)) return null;\n\n return hash;\n}\n\n/**\n * Decodes an Encoded LabelHash as a LabelHash.\n *\n * @throws if a valid LabelHash cannot be decoded\n *\n * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash\n * @see https://github.com/wevm/viem/blob/main/src/utils/ens/encodedLabelToLabelhash.ts\n *\n * @param maybeEncodedLabelHash The encoded label hash in format `[labelhash_without_0x_prefix]`\n * @returns A 32-byte lowercase hash string starting with '0x'\n */\nexport const decodeEncodedLabelHash = (maybeEncodedLabelHash: string): LabelHash => {\n const parsed = parseEncodedLabelHash(maybeEncodedLabelHash);\n if (parsed === null) {\n throw new Error(\n `EncodedLabelHash '${maybeEncodedLabelHash}' is malformed: expected format '[<64-char lowercase hex>]'.`,\n );\n }\n return parsed;\n};\n\n/**\n * Checks if the value is an {@link EncodedLabelHash}.\n */\nexport function isEncodedLabelHash(value: string): value is EncodedLabelHash {\n return parseEncodedLabelHash(value) !== null;\n}\n","import { ens_normalize } from \"@adraffy/ens-normalize\";\n\nimport type { InterpretedLabel, InterpretedName, Label, Name } from \"./types\";\n\n/**\n * Normalizes a Name according to ENS normalization rules (ENSIP-15), returning an InterpretedName.\n *\n * @throws if the Name is not normalizable\n * @see https://docs.ens.domains/ensip/15\n */\nexport const normalizeName = (name: Name): InterpretedName => {\n try {\n return ens_normalize(name) as InterpretedName;\n } catch (cause) {\n throw new Error(`Name '${name}' cannot be normalized.`, { cause });\n }\n};\n\n/**\n * Normalizes a Label according to ENS normalization rules (ENSIP-15), returning an InterpretedLabel.\n *\n * @throws if the Label is not normalizable\n * @see https://docs.ens.domains/ensip/15\n */\nexport const normalizeLabel = (label: Label): InterpretedLabel => {\n // empty string cannot be a normalized label\n if (label === \"\") throw new Error(\"Label is empty ('') and cannot be normalized.\");\n\n // normalized labels do not contain periods\n if (label.includes(\".\")) {\n throw new Error(`Label '${label}' includes '.' and cannot be normalized.`);\n }\n\n try {\n // NOTE: the ens_normalize function accepts _names_ not labels, and so we must include our own\n // invariants above to ensure that the `label` input here can be safely normalized\n return ens_normalize(label) as InterpretedLabel;\n } catch (cause) {\n throw new Error(`Label '${label}' cannot be normalized.`, { cause });\n }\n};\n\n/**\n * Determines whether the Name is normalized according to ENSIP-15 normalization rules.\n */\nexport function isNormalizedName(name: Name): boolean {\n try {\n return name === normalizeName(name);\n } catch {\n return false;\n }\n}\n\n/**\n * Determines whether the Label is normalized according to ENSIP-15 normalization rules.\n */\nexport function isNormalizedLabel(label: Label): boolean {\n try {\n return label === normalizeLabel(label);\n } catch {\n return false;\n }\n}\n","import { ENS_ROOT_NAME } from \"./constants\";\nimport {\n decodeEncodedLabelHash,\n encodeLabelHash,\n isEncodedLabelHash,\n labelhashInterpretedLabel,\n labelhashLiteralLabel,\n} from \"./labelhash\";\nimport { isNormalizedLabel, normalizeLabel } from \"./normalization\";\nimport type {\n InterpretedLabel,\n InterpretedName,\n Label,\n LabelHash,\n LabelHashPath,\n LiteralLabel,\n LiteralName,\n Name,\n} from \"./types\";\n\n/**\n * Interprets a user-provided {@link LiteralName} as an {@link InterpretedName}.\n *\n * A {@link LiteralName} may be any arbitrary string. The ENS Root Name ('') ({@link ENS_ROOT_NAME})\n * is only accepted when `options.allowENSRootName` is `true`, and is returned as-is.\n *\n * This function walks each LiteralLabel of `name` and maps it to an {@link InterpretedLabel}\n * according to the provided `options`:\n *\n * 0. If the LiteralLabel is an empty string (''), this function throws: an empty Label is not a valid\n * {@link InterpretedLabel}.\n * 1. If the LiteralLabel is already a normalized LiteralLabel, it is kept as-is.\n * 2. Otherwise, if the LiteralLabel looks like an {@link EncodedLabelHash} (e.g. `[abcd…]`) and\n * `options.allowEncodedLabelHashes` is `true`, it is kept as-is.\n * 3. Otherwise, the LiteralLabel is unnormalized. If `options.coerceUnnormalizedLabelsToNormalizedLabels` is `false`,\n * this function throws. Otherwise (default), the LiteralLabel is passed through ENSIP-15 normalization\n * ({@link normalizeLabel}). If normalization succeeds, the normalized form is used (e.g. `\"Vitalik\"` →\n * `\"vitalik\"`).\n * 4. Otherwise, the LiteralLabel is unnormalizable. If `options.coerceUnnormalizableLabelsToEncodedLabelHashes`\n * is `true`, the Label is replaced with the EncodedLabelHash of its literal bytes. Otherwise, this\n * function throws.\n *\n * Note that step 3 gates step 4: if `options.coerceUnnormalizedLabelsToNormalizedLabels` is `false`, the\n * function throws immediately for any unnormalized Label, regardless of whether the Label would have been\n * normalizable and regardless of `options.coerceUnnormalizableLabelsToEncodedLabelHashes`.\n *\n * @param name - The user-provided {@link LiteralName} to interpret.\n * @param options - Controls how the interpretation handles edge cases.\n * @param options.allowENSRootName - When `true`, an empty `name` is accepted and returned as the ENS Root Name.\n * When `false` (default), an empty `name` throws.\n * @param options.allowEncodedLabelHashes - When `true`, a Label that is already formatted as an\n * {@link EncodedLabelHash} is preserved verbatim. When `false` (default), such a Label is treated like any other\n * input and passed through normalization, which will fail and fall through to the unnormalizable-Label handling.\n * @param options.coerceUnnormalizedLabelsToNormalizedLabels - When `true` (default), a Label that is not already\n * normalized is passed through ENSIP-15 normalization (e.g. `\"Vitalik\"` → `\"vitalik\"`). When `false`, any\n * unnormalized Label causes this function to throw — no normalization is attempted and\n * `coerceUnnormalizableLabelsToEncodedLabelHashes` is not consulted.\n * @param options.coerceUnnormalizableLabelsToEncodedLabelHashes - When `true`, a Label that cannot be normalized is\n * replaced with the EncodedLabelHash of its literal bytes. When `false` (default), encountering such a Label causes\n * this function to throw. Only consulted when `coerceUnnormalizedLabelsToNormalizedLabels` is `true`.\n *\n * @throws if `name` cannot be coerced into an {@link InterpretedName} under the provided `options`.\n *\n * @dev casts to {@link InterpretedLabel} to avoid an additional unnecessary `asInterpretedLabel` pass.\n */\nexport function literalNameToInterpretedName(\n name: LiteralName,\n {\n allowENSRootName = false,\n allowEncodedLabelHashes = false,\n coerceUnnormalizedLabelsToNormalizedLabels = true,\n coerceUnnormalizableLabelsToEncodedLabelHashes = false,\n }: {\n allowENSRootName?: boolean | undefined;\n allowEncodedLabelHashes?: boolean | undefined;\n coerceUnnormalizedLabelsToNormalizedLabels?: boolean | undefined;\n coerceUnnormalizableLabelsToEncodedLabelHashes?: boolean | undefined;\n } = {},\n): InterpretedName {\n if (name === \"\") {\n if (allowENSRootName) return ENS_ROOT_NAME;\n\n throw new Error(\n `The ENS Root Name ('') cannot conform to InterpretedName when allowENSRootName is false.`,\n );\n }\n\n return interpretedLabelsToInterpretedName(\n literalNameToLiteralLabels(name).map((label) => {\n // Sanity Check: No empty Labels\n if (label === \"\") {\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because it contains an empty Label segment, which is not a normalized Label.`,\n );\n }\n\n // if it's already normalized, good to go\n if (isNormalizedLabel(label)) {\n return label as Label as InterpretedLabel;\n }\n\n // special case: if it's an EncodedLabelHash, and the consumer allows, good to go\n if (allowEncodedLabelHashes && isEncodedLabelHash(label)) {\n return label as Label as InterpretedLabel;\n }\n\n // if the consumer does not want to allow coercion of unnormalized labels, then there's nothing to do\n if (!coerceUnnormalizedLabelsToNormalizedLabels) {\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because Label '${label}' is unnormalized and coercion is disabled.`,\n );\n }\n\n try {\n // attempt to normalize it and pass the normalized Label along\n return normalizeLabel(label);\n } catch {\n // but the label is unnormalizable, so:\n\n // if the consumer wants to interpret unnormalizable Labels as an EncodedLabelHash, do so\n if (coerceUnnormalizableLabelsToEncodedLabelHashes) {\n return encodeLabelHash(labelhashLiteralLabel(label)) as InterpretedLabel;\n }\n\n // otherwise, cannot conform\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because Label '${label}' is unnormalized and cannot be normalized.`,\n );\n }\n }),\n );\n}\n\n/**\n * Interprets a Literal Label, producing an Interpreted Label.\n *\n * @see https://ensnode.io/docs/reference/terminology#literal-label\n * @see https://ensnode.io/docs/reference/terminology#interpreted-label\n *\n * @param label - The Literal Label string to interpret\n * @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label\n */\nexport function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel {\n // if the label is normalized, good to go\n if (isNormalizedLabel(label)) return label as Label as InterpretedLabel;\n\n // otherwise, encode the labelhash of the literal Label\n return encodeLabelHash(labelhashLiteralLabel(label)) as InterpretedLabel;\n}\n\n/**\n * Interprets an ordered list of Literal Labels, producing an Interpreted Name.\n *\n * Note that it's important that the Literal Labels are provided as an array, otherwise it's\n * impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].\n *\n * Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label\n * that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be\n * interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.\n *\n * @param labels An ordered list of 0 or more Literal Labels\n * @returns An InterpretedName\n */\nexport function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName {\n return labels.map(literalLabelToInterpretedLabel).join(\".\") as InterpretedName;\n}\n\n/**\n * Joins the list of Interpreted Labels with '.' to form an Interpreted Name.\n *\n * @param labels An ordered list of 0 or more Interpreted Labels\n * @returns An InterpretedName\n */\nexport function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName {\n return labels.join(\".\") as InterpretedName;\n}\n\n/**\n * Joins the list of Literal Labels with '.' to form a Literal Name.\n *\n * Note: LiteralLabel values may contain '.' characters, which will be preserved\n * in the resulting LiteralName. Therefore, the number of labels in the returned\n * LiteralName may be greater than the number of LiteralLabels in the input array.\n *\n * @param labels An ordered list of 0 or more Literal Labels\n * @returns An LiteralName\n */\nexport function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName {\n return labels.join(\".\") as LiteralName;\n}\n\n/**\n * Converts an LiteralName into a list of LiteralLabels.\n */\nexport function literalNameToLiteralLabels(name: LiteralName): LiteralLabel[] {\n if (name === \"\") return [];\n return name.split(\".\") as LiteralLabel[];\n}\n\n/**\n * Converts an Interpreted Name into a list of Interpreted Labels.\n */\nexport function interpretedNameToInterpretedLabels(name: InterpretedName): InterpretedLabel[] {\n if (name === \"\") return [];\n return name.split(\".\") as InterpretedLabel[];\n}\n\nexport function isInterpretedLabel(label: Label): label is InterpretedLabel {\n return isEncodedLabelHash(label) || isNormalizedLabel(label);\n}\n\n/**\n * Determines whether `name` is an {@link InterpretedName}.\n * The root name (\"\") is a valid InterpretedName.\n *\n * @param name\n * @returns\n */\nexport function isInterpretedName(name: Name): name is InterpretedName {\n if (name === ENS_ROOT_NAME) return true;\n return name.split(\".\").every(isInterpretedLabel);\n}\n\n/**\n * Converts InterpretedLabels into a LabelHashPath.\n */\nexport function interpretedLabelsToLabelHashPath(labels: InterpretedLabel[]): LabelHashPath {\n return labels\n .map((label) => {\n try {\n // attempt to decode label as an encoded labelhash\n return decodeEncodedLabelHash(label);\n } catch {\n // but if that failed, this must be a normalized label, so labelhash it\n return labelhashInterpretedLabel(label);\n }\n })\n .toReversed();\n}\n\n/**\n * Constructs a new InterpretedName from an InterpretedLabel (child) and InterpretedName (parent).\n *\n * If no parent is available the InterpretedLabel is cast to an InterpretedName and returned.\n *\n * @dev the following is safe due to InterpretedLabel/InterpretedName semantics, see above.\n */\nexport function constructSubInterpretedName(\n label: InterpretedLabel,\n name: InterpretedName | undefined,\n): InterpretedName {\n if (name === undefined || name === \"\") return label as Name as InterpretedName;\n return [label, name].join(\".\") as InterpretedName;\n}\n\n/**\n * Given a `labelHash` and optionally its healed InterpretedLabel, return an InterpretedLabel.\n */\nexport function ensureInterpretedLabel(\n labelHash: LabelHash,\n label: InterpretedLabel | undefined,\n): InterpretedLabel {\n return label ?? (encodeLabelHash(labelHash) as InterpretedLabel);\n}\n\n/**\n * Casts a string to a {@link LiteralName}.\n *\n * A LiteralName is a name that should be interpreted as a string literal. It may or may not be\n * normalized or normalizable. It may also include labels formatted as an EncodedLabelHash, but\n * such labels must be interpreted literally and not as an EncodedLabelHash.\n */\nexport function asLiteralName(name: Name): LiteralName {\n return name as LiteralName;\n}\n\n/**\n * Casts a string to a {@link LiteralLabel}.\n *\n * A LiteralLabel is a label that should be interpreted as a string literal. It may or may not be\n * normalized or normalizable. It may also be formatted as an EncodedLabelHash, but such labels must\n * be interpreted literally and not as an EncodedLabelHash.\n */\nexport function asLiteralLabel(label: Label): LiteralLabel {\n return label as LiteralLabel;\n}\n\n/**\n * Validates and casts a string to an {@link InterpretedLabel}.\n * An InterpretedLabel is either a normalized label or an EncodedLabelHash.\n *\n * @throws if the input is not a valid InterpretedLabel\n */\nexport function asInterpretedLabel(label: Label): InterpretedLabel {\n if (isInterpretedLabel(label)) return label;\n\n throw new Error(`Not a valid InterpretedLabel: '${label}'`);\n}\n\n/**\n * Validates and casts a string to an {@link InterpretedName}.\n * An InterpretedName is either the ENS Root Name ('') or a name made up of InterpretedLabels (which\n * are either normalized Labels or EncodedLabelHashes).\n *\n * @throws if the input cannot be interpreted into an InterpretedName\n */\nexport function asInterpretedName(name: Name): InterpretedName {\n if (isInterpretedName(name)) return name;\n\n throw new Error(`Not a valid InterpretedName: '${name}'`);\n}\n","import { AccountId as CaipAccountId, AssetId as CaipAssetId } from \"caip\";\n\nimport type { AccountId, AccountIdString, AssetId, AssetIdString } from \"./types\";\n\n/**\n * Stringify an {@link AccountId} as a fully lowercase CAIP-10 AccountId string.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport function stringifyAccountId({ chainId, address }: AccountId): AccountIdString {\n return CaipAccountId.format({\n chainId: { namespace: \"eip155\", reference: chainId.toString() },\n address,\n }).toLowerCase();\n}\n\n/**\n * Stringify an {@link AssetId} as a fully lowercase CAIP-19 AssetId string.\n *\n * @see https://chainagnostic.org/CAIPs/caip-19\n */\nexport function stringifyAssetId({\n assetNamespace,\n contract: { chainId, address },\n tokenId,\n}: AssetId): AssetIdString {\n return CaipAssetId.format({\n chainId: { namespace: \"eip155\", reference: chainId.toString() },\n assetName: { namespace: assetNamespace, reference: address },\n tokenId: tokenId.toString(),\n }).toLowerCase();\n}\n","import {\n coinTypeToEvmChainId as _coinTypeToEvmChainId,\n evmChainIdToCoinType as _evmChainIdToCoinType,\n} from \"@ensdomains/address-encoder/utils\";\n\nimport type { ChainId, CoinType, EvmCoinType } from \"./types\";\n\n/**\n * The ETH coinType.\n *\n * @see https://docs.ens.domains/ensip/9\n */\nexport const ETH_COIN_TYPE: CoinType = 60;\n\n/**\n * The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of\n * ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19\n */\nexport const DEFAULT_EVM_CHAIN_ID = 0;\n\n/**\n * ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.\n *\n * @see https://docs.ens.domains/ensip/19/#reverse-resolution\n */\nexport const DEFAULT_EVM_COIN_TYPE = 0x8000_0000 as EvmCoinType;\n\n/**\n * Converts a CoinType to an EVM Chain Id.\n *\n * NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the\n * mainnet case so we implement that here\n *\n * @see https://docs.ens.domains/ensip/11\n */\nexport const coinTypeToEvmChainId = (coinType: CoinType): ChainId => {\n if (coinType === ETH_COIN_TYPE) return 1;\n return _coinTypeToEvmChainId(coinType);\n};\n\n/**\n * Converts an EVM Chain Id to a CoinType.\n *\n * NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the\n * mainnet case so we implement that here\n */\nexport const evmChainIdToCoinType = (chainId: ChainId): CoinType => {\n if (chainId === 1) return ETH_COIN_TYPE;\n return _evmChainIdToCoinType(chainId);\n};\n\n/**\n * Converts a bigint value representing a CoinType into a valid CoinType.\n *\n * This is useful when onchain events emit coinTypes as bigint but we want to constrain them to\n * the CoinType type.\n *\n * @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER\n */\nexport const bigintToCoinType = (value: bigint): CoinType => {\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error(`'${value}' cannot represent as CoinType, it is too large.`);\n }\n\n return Number(value) as CoinType;\n};\n","import { bytesToString, hexToBytes } from \"viem\";\n\nimport { asLiteralLabel } from \"./interpreted-names-and-labels\";\nimport type { DNSEncodedLiteralName, DNSEncodedName, LiteralLabel } from \"./types\";\n\n/**\n * Decodes a DNS-Encoded name consisting of Literal Labels into an ordered list of Literal Labels.\n *\n * For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.\n *\n * Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label\n * in the resulting list is guaranteed to have a maximum byte length of 255.\n *\n * @param packet a hex string that encodes a DNSEncodedLiteralName\n * @returns A list of the LiteralLabels contained in packet\n * @throws If the packet is malformed\n * @dev This is just `decodeDNSEncodedName` with semantic input/output\n */\nexport function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[] {\n return decodeDNSEncodedName(packet).map(asLiteralLabel);\n}\n\n/**\n * Decodes a DNS-Encoded Name into an ordered list of string segments.\n *\n * For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.\n *\n * Due to the constraints of DNS-Encoding, there is an additional guarantee that each segment\n * in the resulting list is guaranteed to have a maximum byte length of 255.\n *\n * @param packet a hex string that encodes a DNSEncodedName\n * @returns A UTF-8 string array of the segments contained in packet\n * @throws If the packet is malformed\n * @dev This is the generic implementation of DNS-Encoded Name Decoding\n */\nexport function decodeDNSEncodedName(packet: DNSEncodedName): string[] {\n const segments: string[] = [];\n\n const bytes = hexToBytes(packet);\n if (bytes.length === 0) throw new Error(`Packet is empty.`);\n\n let offset = 0;\n while (offset < bytes.length) {\n // NOTE: `len` is always [0, 255] because ByteArray is array of unsigned 8-bit integers. Because\n // the length of the next label is limited to one unsigned byte, this is why labels with bytelength\n // greater than 255 cannot be DNS Encoded.\n const len = bytes[offset];\n\n // Invariant: the while conditional enforces that there's always _something_ in bytes at offset\n if (len === undefined) {\n throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);\n }\n\n // Invariant: `len` is always [0, 255]. technically not necessary but good for clarity\n if (len < 0 || len > 255) {\n throw new Error(\n `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`,\n );\n }\n\n // stop condition\n if (len === 0) break;\n\n // decode to UTF-8 string\n const segment = bytesToString(bytes.subarray(offset + 1, offset + len + 1));\n\n // add to list of segments and continue decoding\n segments.push(segment);\n offset += len + 1;\n }\n\n // check for overflow\n if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);\n\n // check for junk\n if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);\n\n return segments;\n}\n","import { hexToBigInt } from \"viem\";\n\nimport { zeroLower32Bits } from \"../_lib/zeroLower32Bits\";\nimport type {\n AccountId,\n DomainId,\n EACResource,\n ENSv1DomainId,\n ENSv1RegistryId,\n ENSv1VirtualRegistryId,\n ENSv2DomainId,\n ENSv2RegistryId,\n LabelHash,\n Node,\n NormalizedAddress,\n PermissionsId,\n PermissionsResourceId,\n PermissionsUserId,\n RegistrationId,\n RenewalId,\n ResolverId,\n ResolverRecordsId,\n StorageId,\n TokenId,\n} from \"./types\";\n\n/**\n * Id format — dash-delimited tuples (perf trade-off, see #2016).\n *\n * Every composite id in this module joins its components with `-` rather than the canonical\n * CAIP-style mixed `:` / `/` delimiters. This is so that Ponder's indexing-cache profile-pattern\n * matcher can decompose the id into its parts (chainId, address, node, ...) and derive each\n * segment from event args (`event.chain.id`, `event.event.log.address`, `event.event.args.*`),\n * which is what enables prefetch on hot tables (Domain, Registry, Resolver, etc.). Under\n * CAIP-shaped ids the matcher's single-level string-delimiter split can't decompose a mixed\n * `:` / `/` payload, so prefetch silently never fires.\n *\n * Move back to CAIP-style ids once Ponder's matcher supports parsing CAIP-shaped composite\n * primary keys directly. This is a temporary shape, not the long-term one. Tracked in\n * https://github.com/namehash/ensnode/issues/2034.\n *\n * Note that because we key ENSv2 Domains by StorageId (necessary for stable identifier over time,\n * since its backing tokenId can change), which is _derived_ from the emitted arguments, ENSv2 Domains\n * aren't currently prefetchable, and likely won't be without a feature from Ponder that allows\n * consumers to specify the prefetch key generation per-entity.\n */\nconst _stringifyAccountId = ({ chainId, address }: AccountId) => [chainId, address].join(\"-\");\n\nexport const makeENSv1RegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv1RegistryId;\n\nexport const makeENSv2RegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv2RegistryId;\n\nexport const makeENSv1VirtualRegistryId = (accountId: AccountId, node: Node) =>\n [_stringifyAccountId(accountId), node].join(\"-\") as ENSv1VirtualRegistryId;\n\n/**\n * Stringifies an {@link AccountId} as the id of a concrete Registry — either an\n * {@link ENSv1RegistryId} or an {@link ENSv2RegistryId}, but never an\n * {@link ENSv1VirtualRegistryId}.\n */\nexport const makeConcreteRegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv1RegistryId | ENSv2RegistryId;\n\nexport const makeResolverId = (contract: AccountId) => _stringifyAccountId(contract) as ResolverId;\n\nexport const makeENSv1DomainId = (accountId: AccountId, node: Node) =>\n [_stringifyAccountId(accountId), node].join(\"-\") as ENSv1DomainId;\n\nexport const makeENSv2DomainId = (registry: AccountId, storageId: StorageId) =>\n [_stringifyAccountId(registry), storageId.toString()].join(\"-\") as ENSv2DomainId;\n\n/**\n * Computes a Label's {@link StorageId} given its TokenId or LabelHash.\n */\nexport const makeStorageId = (tokenIdOrLabelHash: TokenId | LabelHash): StorageId => {\n const tokenId =\n typeof tokenIdOrLabelHash === \"bigint\" //\n ? tokenIdOrLabelHash\n : hexToBigInt(tokenIdOrLabelHash);\n\n return zeroLower32Bits(tokenId) as StorageId;\n};\n\nexport const makePermissionsId = (contract: AccountId) =>\n _stringifyAccountId(contract) as PermissionsId;\n\nexport const makePermissionsResourceId = (contract: AccountId, resource: EACResource) =>\n [makePermissionsId(contract), resource].join(\"-\") as PermissionsResourceId;\n\nexport const makePermissionsUserId = (\n contract: AccountId,\n resource: EACResource,\n user: NormalizedAddress,\n) => [makePermissionsResourceId(contract, resource), user].join(\"-\") as PermissionsUserId;\n\nexport const makeResolverRecordsId = (resolver: AccountId, node: Node) =>\n [makeResolverId(resolver), node].join(\"-\") as ResolverRecordsId;\n\nexport const makeRegistrationId = (domainId: DomainId, registrationIndex: number) =>\n [domainId, registrationIndex].join(\"-\") as RegistrationId;\n\nexport const makeRenewalId = (domainId: DomainId, registrationIndex: number, index: number) =>\n [makeRegistrationId(domainId, registrationIndex), index].join(\"-\") as RenewalId;\n","/**\n * Zeros the lower 32 bits of `num`.\n */\nexport const zeroLower32Bits = (num: bigint) => num ^ (num & 0xffffffffn);\n","import { isHex, size } from \"viem\";\n\nimport type { InterfaceId } from \"./types\";\n\n/**\n * Whether `maybeInterfaceId` is a valid ERC-165 {@link InterfaceId} — a 4-byte hex selector.\n */\nexport function isInterfaceId(maybeInterfaceId: string): maybeInterfaceId is InterfaceId {\n return isHex(maybeInterfaceId) && size(maybeInterfaceId) === 4;\n}\n","import { type Hex, toHex } from \"viem\";\n\n/**\n * Converts a uint256 bigint to a zero-padded 32-byte (64-character) lowercase hex string.\n */\nexport const uint256ToHex32 = (num: bigint): Hex => toHex(num, { size: 32 });\n","import { uint256ToHex32 } from \"../_lib/uint256ToHex32\";\nimport type { LabelHash, Node, TokenId } from \"./types\";\n\n/**\n * Decodes a uint256-encoded-LabelHash (eg. from a {@link TokenId}) into a {@link LabelHash}.\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/ethregistrar/ETHRegistrarController.sol#L215\n */\nexport const interpretTokenIdAsLabelHash = (tokenId: TokenId): LabelHash => uint256ToHex32(tokenId);\n\n/**\n * Decodes a uint256-encoded-Node (eg. from a {@link TokenId}) into a {@link Node}.\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/wrapper/ERC1155Fuse.sol#L262\n */\nexport const interpretTokenIdAsNode = (tokenId: TokenId): Node => uint256ToHex32(tokenId);\n","import { ens_beautify } from \"@adraffy/ens-normalize\";\n\nimport { ENS_ROOT_NAME } from \"./constants\";\nimport {\n interpretedLabelsToInterpretedName,\n interpretedNameToInterpretedLabels,\n} from \"./interpreted-names-and-labels\";\nimport { isNormalizedLabel } from \"./normalization\";\nimport type { InterpretedName, Label, Name } from \"./types\";\n\n/**\n * Constructs a name hierarchy from a given InterpretedName.\n *\n * @example\n * ```\n * getNameHierarchy(\"sub.example.eth\") -> [\"sub.example.eth\", \"example.eth\", \"eth\"]\n * ```\n */\nexport const getNameHierarchy = (name: InterpretedName): InterpretedName[] => {\n if (name === ENS_ROOT_NAME) return [];\n\n return interpretedNameToInterpretedLabels(name).map((_, i, labels) =>\n interpretedLabelsToInterpretedName(labels.slice(i)),\n );\n};\n\n/**\n * Derives the parent's {@link InterpretedName} of the provided `name`, or null if there is none.\n */\nexport const getParentInterpretedName = (name: InterpretedName): InterpretedName | null => {\n if (name === ENS_ROOT_NAME) return null;\n\n const labels = interpretedNameToInterpretedLabels(name);\n\n // For TLDs, return ENS_ROOT_NAME\n if (labels.length === 1) return ENS_ROOT_NAME;\n\n // Strip off the child-most label in the name to get the FQDN of the parent\n return interpretedLabelsToInterpretedName(labels.slice(1));\n};\n\n/**\n * Beautifies a name by converting each normalized label in the provided name to\n * its \"beautified\" form. Labels that are not normalized retain their original value.\n *\n * Invariants:\n * - The number of labels in the returned name is the same as the number of labels in the input name.\n * - The order of the labels in the returned name is the same as the order of the labels in the input name.\n * - If a label in the input is normalized, it is returned in its \"beautified\" form.\n * - If a label in the input name is not normalized, it is returned without modification.\n * - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).\n *\n * The \"beautified form\" of a normalized label converts special sequences of\n * emojis and other special characters to their \"beautified\" equivalents. All\n * such conversions transform X -> Y where Y is normalizable and normalizes back to X.\n * Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).\n * Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).\n * Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).\n * Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).\n * Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).\n * Ex: '' (unnormalized as a label) to '' (no conversion).\n *\n * @param name - The name to beautify.\n * @returns The beautified name.\n */\nexport const beautifyName = (name: Name): Name =>\n name\n .split(\".\")\n .map((label: Label) => {\n if (isNormalizedLabel(label)) {\n return ens_beautify(label);\n } else {\n return label;\n }\n })\n .join(\".\");\n","import { isHex } from \"viem\";\n\nimport type { LabelHash } from \"./types\";\n\n/**\n * Parses a labelHash string and normalizes it to a canonical `LabelHash`.\n *\n * Normalization rules applied in order:\n * 1. Adds `0x` prefix if missing\n * 2. Validates all characters (excluding the optional `0x` prefix) are valid hex digits\n * (uppercase or lowercase A-F are accepted and normalized to lowercase)\n * 3. If the hex digit count is odd, adds a leading `0` to make it even\n * 4. Validates the result is exactly 64 hex digits (32 bytes)\n *\n * @param maybeLabelHash - The string to parse as a labelHash\n * @throws {Error} If the input cannot be normalized to a valid labelHash\n */\nexport function parseLabelHash(maybeLabelHash: string): LabelHash {\n const hexPart = maybeLabelHash.startsWith(\"0x\") ? maybeLabelHash.slice(2) : maybeLabelHash;\n\n if (!isHex(`0x${hexPart}`, { strict: true })) {\n throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);\n }\n\n const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;\n\n if (normalizedHexPart.length !== 64) {\n throw new Error(\n `Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`,\n );\n }\n\n return `0x${normalizedHexPart.toLowerCase()}` as LabelHash;\n}\n\n/**\n * Parses an encoded labelHash string (surrounded by square brackets) and normalizes it.\n *\n * This function is intentionally more lenient than {@link isEncodedLabelHash}: it accepts\n * both the canonical format `[hash]` (no `0x` inside brackets) and the non-canonical\n * `[0xhash]` format by delegating to {@link parseLabelHash} for the inner value.\n * `isEncodedLabelHash(\"[0xhash]\")` returns `false` for the same input.\n *\n * @param maybeEncodedLabelHash - The string to parse as an encoded labelHash\n * @throws {Error} If the input is not properly enclosed in brackets or cannot be normalized\n */\nexport function parseEncodedLabelHash(maybeEncodedLabelHash: string): LabelHash {\n if (!maybeEncodedLabelHash.startsWith(\"[\") || !maybeEncodedLabelHash.endsWith(\"]\")) {\n throw new Error(\n `Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`,\n );\n }\n\n return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));\n}\n\n/**\n * Parses a labelHash or encoded labelHash string and normalizes it.\n *\n * Tries both formats to be maximally generous with accepted inputs:\n * - If the input starts with `[` and ends with `]`, it is treated as an encoded labelHash\n * - Otherwise, it is treated as a plain labelHash\n *\n * @param maybeLabelHash - The string to parse as a labelHash or encoded labelHash\n * @throws {Error} If the input cannot be normalized to a valid labelHash\n */\nexport function parseLabelHashOrEncodedLabelHash(maybeLabelHash: string): LabelHash {\n if (maybeLabelHash.startsWith(\"[\") && maybeLabelHash.endsWith(\"]\")) {\n return parseEncodedLabelHash(maybeLabelHash);\n }\n\n return parseLabelHash(maybeLabelHash);\n}\n","import { hexToBigInt } from \"viem\";\n\nimport { toNormalizedAddress } from \"./address\";\nimport { bigintToCoinType, DEFAULT_EVM_COIN_TYPE, ETH_COIN_TYPE } from \"./coin-type\";\nimport { asLiteralLabel } from \"./interpreted-names-and-labels\";\nimport type { CoinType, LiteralLabel, NormalizedAddress } from \"./types\";\n\n/**\n * Matches an ENSIP-19 Reverse Name\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/20e34971fd55f9e3b3cf4a5825d52e1504d36493/contracts/utils/ENSIP19.sol#L70\n */\nconst REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\\.([0-9a-f]{1,64}|addr|default)\\.reverse$/;\n\n/**\n * Parses an address label (hex sans prefix) into an Address.\n *\n * @param addressLabel - Lowercase hex string derived from a reverse address.\n * @throws if address is invalid\n * @see https://docs.ens.domains/ensip/19#reverse-resolution\n */\nconst parseAddressLabel = (addressLabel: LiteralLabel): NormalizedAddress => {\n return toNormalizedAddress(`0x${addressLabel}`);\n};\n\n/**\n * Parses a coinType label (hex sans prefix) into an EVMCoinType.\n *\n * @throws if coinType is invalid\n */\nconst parseCoinTypeLabel = (coinTypeLabel: LiteralLabel): CoinType => {\n if (coinTypeLabel === \"default\") return DEFAULT_EVM_COIN_TYPE;\n if (coinTypeLabel === \"addr\") return ETH_COIN_TYPE;\n\n return bigintToCoinType(hexToBigInt(`0x${coinTypeLabel}`));\n};\n\n/**\n * Parse the address and coinType out of an ENSIP-19 reverse name.\n */\nexport function parseReverseName(name: string): {\n address: NormalizedAddress;\n coinType: CoinType;\n} | null {\n const match = name.match(REVERSE_NAME_REGEX);\n if (!match) return null;\n\n try {\n const [, addressLabel, coinTypeLabel] = match;\n if (!addressLabel) return null;\n if (!coinTypeLabel) return null;\n\n return {\n address: parseAddressLabel(asLiteralLabel(addressLabel)),\n coinType: parseCoinTypeLabel(asLiteralLabel(coinTypeLabel)),\n };\n } catch {\n // either of the parse methods threw, unable to parse reverse name\n return null;\n }\n}\n","import {\n asInterpretedLabel,\n asLiteralLabel,\n interpretedLabelsToInterpretedName,\n interpretedNameToInterpretedLabels,\n} from \"./interpreted-names-and-labels\";\nimport { encodeLabelHash, isEncodedLabelHash, labelhashLiteralLabel } from \"./labelhash\";\nimport { isNormalizedLabel } from \"./normalization\";\nimport type { InterpretedLabel, InterpretedName } from \"./types\";\n\n/**\n * Reinterpret Label\n *\n * Reinterprets {@link InterpretedLabel} values received by \"External System\"\n * into {@link InterpretedLabel} values in \"Internal System\" where:\n * 1. \"External System\" is not guaranteed to be using the same ENSNormalize\n * version as \"Internal System\", and therefore the `InterpretedLabel` passed into\n * this function (from \"External System\") is not guaranteed to 100% align\n * with the invariants of an `InterpretedLabel` in \"Internal System\".\n * 2. The `InterpretedLabel` returned by this function is guaranteed to match\n * the invariants of `InterpretedLabel` in \"Internal System\".\n *\n * @returns reinterpreted label.\n * @throws an error if the provided label is an empty label\n * (and therefore violates the invariants of an InterpretedLabel).\n */\nexport function reinterpretLabel(label: InterpretedLabel): InterpretedLabel {\n // Invariant: InterpretedLabel value must never be an empty label.\n if (label === \"\") {\n throw new Error(\n `Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`,\n );\n }\n\n // no change required for EncodedLabelHash\n if (isEncodedLabelHash(label)) return label;\n\n // no change required for NormalizedLabel\n if (isNormalizedLabel(label)) return label;\n\n // the provided `label` is an unnormalized literal label, encode it\n const labelHash = labelhashLiteralLabel(asLiteralLabel(label as string));\n return asInterpretedLabel(encodeLabelHash(labelHash));\n}\n\n/**\n * Reinterpret Name\n *\n * Reinterprets {@link InterpretedName} values received by \"External System\"\n * into {@link InterpretedName} values in \"Internal System\" where:\n * 1. \"External System\" is not guaranteed to be using the same ENSNormalize\n * version as \"Internal System\", and therefore the `InterpretedName` passed into\n * this function (from \"External System\") is not guaranteed to 100% align\n * with the invariants of an `InterpretedName` in \"Internal System\".\n * 2. The `InterpretedName` returned by this function is guaranteed to match\n * the invariants of `InterpretedName` in \"Internal System\".\n */\nexport function reinterpretName(name: InterpretedName): InterpretedName {\n if (name === \"\") return name;\n\n const labels = interpretedNameToInterpretedLabels(name);\n return interpretedLabelsToInterpretedName(labels.map(reinterpretLabel));\n}\n","import { DEFAULT_EVM_COIN_TYPE, ETH_COIN_TYPE } from \"./coin-type\";\nimport { asLiteralLabel, literalLabelsToLiteralName } from \"./interpreted-names-and-labels\";\nimport type { CoinType, LiteralLabel, LiteralName, NormalizedAddress } from \"./types\";\n\nconst ADDR_LABEL = asLiteralLabel(\"addr\");\nconst DEFAULT_LABEL = asLiteralLabel(\"default\");\nconst REVERSE_LABEL = asLiteralLabel(\"reverse\");\n\n/**\n * Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19/#reverse-resolution\n */\nexport const addrReverseLabel = (address: NormalizedAddress): LiteralLabel =>\n address.slice(2) as LiteralLabel;\n\n/**\n * Converts `coinType` to prefix-free hex string.\n *\n * @see https://docs.ens.domains/ensip/19\n */\nexport const coinTypeReverseLabel = (coinType: CoinType): LiteralLabel =>\n coinType.toString(16) as LiteralLabel;\n\n/**\n * Gets the reverse name for an address according to ENSIP-11 & ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/11#specification\n * @see https://docs.ens.domains/ensip/19#specification\n *\n * @param address - The address to get the reverse name for\n * @param coinType - The coin type to use for the reverse name\n * @returns The reverse name for the address\n *\n * @example\n * ```ts\n * reverseName(\"0x1234\", BigInt(ETH_COIN_TYPE)) // \"1234.addr.reverse\"\n * reverseName(\"0x1234\", BigInt(0x80000000)) // \"1234.default.reverse\"\n * reverseName(\"0x1234\", BigInt(0x5678)) // \"1234.5678.reverse\"\n * ```\n */\nexport function reverseName(address: NormalizedAddress, coinType: CoinType): LiteralName {\n const label = addrReverseLabel(address);\n\n const middle = ((): LiteralLabel => {\n switch (coinType) {\n case ETH_COIN_TYPE:\n return ADDR_LABEL;\n case DEFAULT_EVM_COIN_TYPE:\n return DEFAULT_LABEL;\n default:\n return coinTypeReverseLabel(coinType);\n }\n })();\n\n return literalLabelsToLiteralName([label, middle, REVERSE_LABEL]);\n}\n","import type { Address as ViemAddress, Hex as ViemHex } from \"viem\";\n\n/**\n * Represents a Hex string, in the format `0x{string}`.\n */\nexport type Hex = ViemHex;\n\n/**\n * Represents an EVM Address, in the format `0x{string}`, which may or may not be checksummed.\n */\nexport type Address = ViemAddress;\n\n/**\n * Represents a normalized (non-checksummed) EVM Address, in the format `0x{string}`, where all\n * characters are lowercase and length is exactly 42.\n *\n * @dev because the Address type is so widely used, nominally typing it would involve a _ton_ of\n * asNormalizedAddress() casts across the codebase. By avoiding the __brand, we can easily use\n * EventWithArgs<{ address: NormalizedAddress }> in all of the Ponder event handler args to\n * declare that the incoming event.args.address is a NormalizedAddress.\n */\nexport type NormalizedAddress = Address;\n\n/**\n * Unix timestamp value as bigint.\n *\n * Represents the number of seconds that have elapsed\n * since January 1, 1970 (midnight UTC/GMT).\n *\n * Guaranteed to be an integer. May be zero or negative to represent a time at or\n * before Jan 1, 1970.\n */\nexport type UnixTimestampBigInt = bigint;\n\n/**\n * Duration value as bigint.\n *\n * Representing a duration in seconds.\n *\n * Guaranteed to be a non-negative integer.\n */\nexport type DurationBigInt = bigint;\n\n/**\n * A value denominated in wei, the smallest unit of Ether (1 ETH = 10^18 wei).\n */\nexport type Wei = bigint;\n\n/**\n * Chain ID\n *\n * Represents a unique identifier for a chain.\n * Guaranteed to be a positive integer.\n *\n * Chain id standards are organized by the Ethereum Community @ https://github.com/ethereum-lists/chains\n **/\nexport type ChainId = number;\n\n/**\n * Defaultable Chain ID\n *\n * Represents a unique identifier for a chain, or\n * the default chain as defined by ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19/#annex-supported-chains\n *\n * Guaranteed to be a non-negative integer.\n **/\nexport type DefaultableChainId = 0 | ChainId;\n\n/**\n * Represents an account (contract or EOA) at `address` on chain `chainId`.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport interface AccountId {\n chainId: ChainId;\n address: NormalizedAddress;\n}\n\n/**\n * An enum representing the possible CAIP-19 Asset Namespace values.\n *\n * @see https://chainagnostic.org/CAIPs/caip-19\n */\nexport const AssetNamespaces = {\n ERC721: \"erc721\",\n ERC1155: \"erc1155\",\n} as const;\n\nexport type AssetNamespace = (typeof AssetNamespaces)[keyof typeof AssetNamespaces];\n\n/**\n * A uint256 value that identifies a specific NFT within a NFT contract.\n */\nexport type TokenId = bigint;\n\n/**\n * Represents an Asset in `assetNamespace` by `tokenId` in `contract`.\n *\n * @see https://chainagnostic.org/C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MAAM;AACxC,IAAM,gBAAgB,eAAe,SAAS;AAC9C,IAAM,gBAAgB,eAAe,SAAS;AAOvC,IAAM,mBAAmB,CAAC,YAC/B,QAAQ,MAAM,CAAC;AAOV,IAAM,uBAAuB,CAAC,aACnC,SAAS,SAAS,EAAE;AAmBf,SAAS,YAAY,SAA4B,UAAiC;AACvF,QAAM,QAAQ,iBAAiB,OAAO;AAEtC,QAAM,UAAU,MAAoB;AAClC,YAAQ,UAAU;AAAA,MAChB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO,qBAAqB,QAAQ;AAAA,IACxC;AAAA,EACF,GAAG;AAEH,SAAO,2BAA2B,CAAC,OAAO,QAAQ,aAAa,CAAC;AAClE;;;AC6BO,IAAM,kBAAkB;AAAA,EAC7B,QAAQ;AAAA,EACR,SAAS;AACX;","names":["keccak256","isHex","ens_beautify","ens_beautify","isHex","parseEncodedLabelHash","hexToBigInt","hexToBigInt"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/address.ts","../src/lib/beautify.ts","../src/lib/namehash.ts","../src/lib/constants.ts","../src/lib/labelhash.ts","../src/lib/normalization.ts","../src/lib/interpreted-names-and-labels.ts","../src/lib/caip.ts","../src/lib/coin-type.ts","../src/lib/dns-encoded-name.ts","../src/lib/ids.ts","../src/_lib/zeroLower32Bits.ts","../src/lib/interface-id.ts","../src/_lib/uint256ToHex32.ts","../src/lib/interpret-token-id.ts","../src/lib/names.ts","../src/lib/parse-labelhash.ts","../src/lib/parse-reverse-name.ts","../src/lib/reinterpretation.ts","../src/lib/reverse-name.ts","../src/lib/types/evm.ts"],"sourcesContent":["import { isAddress } from \"viem\";\n\nimport type { Address, NormalizedAddress } from \"./types\";\n\n/**\n * Determines whether an {@link Address} is a {@link NormalizedAddress}.\n */\nexport function isNormalizedAddress(maybeAddress: string): maybeAddress is NormalizedAddress {\n const isLowerCase = maybeAddress === maybeAddress.toLowerCase();\n return isLowerCase && isAddress(maybeAddress, { strict: false });\n}\n\n/**\n * Converts an {@link Address} to a {@link NormalizedAddress}.\n *\n * @throws if `address` does not represent an EVM Address\n */\nexport function toNormalizedAddress(maybeAddress: string): NormalizedAddress {\n if (!isAddress(maybeAddress, { strict: false })) {\n throw new Error(`'${maybeAddress}' does not represent an EVM Address.`);\n }\n\n return maybeAddress.toLowerCase() as NormalizedAddress;\n}\n\n/**\n * Validates that an {@link Address} is already a {@link NormalizedAddress}.\n *\n * @throws if the address is not already normalized\n */\nexport function asNormalizedAddress(address: Address): NormalizedAddress {\n if (isNormalizedAddress(address)) return address;\n\n throw new Error(`Not a NormalizedAddress: '${address}'`);\n}\n","import { ens_beautify } from \"@adraffy/ens-normalize\";\n\nimport { interpretedNameToInterpretedLabels } from \"./interpreted-names-and-labels\";\nimport { isEncodedLabelHash } from \"./labelhash\";\nimport type { BeautifiedLabel, BeautifiedName, InterpretedLabel, InterpretedName } from \"./types\";\n\n/**\n * Converts an {@link InterpretedLabel} into a {@link BeautifiedLabel} suitable for presentation in a UI.\n *\n * - Encoded LabelHash labels are preserved verbatim.\n * - Normalized Labels are passed through {@link ens_beautify}, producing a Label that is\n * normalizable (and normalizes back to the input) but may itself be unnormalized.\n *\n * The resulting BeautifiedLabel is suitable for display but is NOT an InterpretedLabel, and the\n * branded return type prevents it from being passed to APIs that expect one. Continue to use the\n * source InterpretedLabel for lookup keys and anywhere else that expects an InterpretedLabel.\n *\n * @example\n * ```ts\n * beautifyInterpretedLabel(\"♾♾♾♾\" as InterpretedLabel) // → \"♾️♾️♾️♾️\"\n * ```\n */\nexport const beautifyInterpretedLabel = (label: InterpretedLabel): BeautifiedLabel =>\n (isEncodedLabelHash(label) ? label : ens_beautify(label)) as BeautifiedLabel;\n\n/**\n * Converts an {@link InterpretedName} into a {@link BeautifiedName} suitable for presentation in a UI\n * by beautifying each of its labels via {@link beautifyInterpretedLabel}.\n *\n * The resulting BeautifiedName is suitable for display but is NOT an InterpretedName, and the\n * branded return type prevents it from being passed to APIs that expect one. Continue to use the\n * source InterpretedName for navigation targets, lookup keys, and anywhere else that expects an\n * InterpretedName.\n *\n * @example\n * ```ts\n * beautifyInterpretedName(\"♾♾♾♾.eth\" as InterpretedName) // → \"♾️♾️♾️♾️.eth\"\n * ```\n */\nexport const beautifyInterpretedName = (name: InterpretedName): BeautifiedName =>\n interpretedNameToInterpretedLabels(name)\n .map(beautifyInterpretedLabel)\n .join(\".\") as BeautifiedName;\n","import { concat, keccak256, namehash as viemNamehash } from \"viem\";\n\nimport type { InterpretedName, LabelHash, Node } from \"./types\";\n\n/**\n * Typed wrapper around viem's `namehash` that returns a branded {@link Node},\n * requiring an {@link InterpretedName} input and correctly parsing EncodedLabelHashes.\n *\n * @see https://docs.ens.domains/ensip/1\n */\nexport const namehashInterpretedName = (name: InterpretedName): Node => viemNamehash(name);\n\n/**\n * Implements one step of the namehash algorithm, combining `labelHash` with `node` to produce\n * the `node` of a given subdomain. Note that the order of the arguments is 'reversed' (as compared to\n * the actual concatenation) in order to improve readability (i.e. read as [labelHash].[node]).\n */\nexport const makeSubdomainNode = (labelHash: LabelHash, node: Node): Node =>\n keccak256(concat([node, labelHash]));\n","import { namehashInterpretedName } from \"./namehash\";\nimport type { EACResource, InterpretedName, Node } from \"./types\";\n\n/**\n * Name for the ENS Root\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ENS_ROOT_NAME = \"\" as InterpretedName;\n\n/**\n * The {@link Node} that identifies the ENS Root Name (\"\").\n */\nexport const ENS_ROOT_NODE: Node = namehashInterpretedName(ENS_ROOT_NAME);\n\n/**\n * The {@link Node} that identifies the ETH Name (\"eth\").\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ETH_NODE: Node = namehashInterpretedName(\"eth\" as InterpretedName);\n\n/**\n * The {@link Node} that identifies the addr.reverse Name (\"addr.reverse\").\n *\n * @dev manually cast to InterpretedName to avoid circular import\n */\nexport const ADDR_REVERSE_NODE: Node = namehashInterpretedName(\"addr.reverse\" as InterpretedName);\n\n/**\n * ROOT_RESOURCE represents the 'root' resource in an EnhancedAccessControl contract.\n */\nexport const ROOT_RESOURCE: EACResource = 0n;\n","import { isHex, keccak256, stringToBytes } from \"viem\";\nimport { labelhash as viemLabelhash } from \"viem/ens\";\n\nimport type { EncodedLabelHash, InterpretedLabel, LabelHash, LiteralLabel } from \"./types\";\n\n/**\n * Typed wrapper around viem's `labelhash` that returns a branded {@link LabelHash},\n * requiring an {@link InterpretedLabel} input.\n *\n * Note: viem's labelhash has special-case handling for Encoded LabelHashes (e.g. `[hash]`).\n * Use {@link labelhashLiteralLabel} if you need to hash a label's literal bytes without\n * encoded labelhash detection.\n *\n * @see https://docs.ens.domains/ensip/1\n */\nexport const labelhashInterpretedLabel = (label: InterpretedLabel): LabelHash =>\n viemLabelhash(label);\n\n/**\n * Implements the ENS `labelhash` function for Literal Labels.\n * @see https://docs.ens.domains/ensip/1\n *\n * @param label the Literal Label to hash\n * @returns the hash of the provided label\n * @dev This function is viem/ens#labelhash but without the special-case handling of Encoded LabelHashes.\n */\nexport const labelhashLiteralLabel = (label: LiteralLabel): LabelHash =>\n keccak256(stringToBytes(label));\n\n/**\n * Checks if the input is a {@link LabelHash}.\n *\n * @see https://ensnode.io/docs/reference/terminology#label-processing-and-classification\n */\nexport function isLabelHash(maybeLabelHash: string): maybeLabelHash is LabelHash {\n const expectedLength = maybeLabelHash.length === 66;\n const expectedEncoding = isHex(maybeLabelHash);\n const expectedCasing = maybeLabelHash === maybeLabelHash.toLowerCase();\n\n return expectedLength && expectedEncoding && expectedCasing;\n}\n\n/**\n * Formats a LabelHash as an Encoded LabelHash.\n *\n * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash\n *\n * @param labelHash - A 32-byte lowercase hash string starting with '0x'\n * @returns The encoded label hash in format `[labelhash_without_0x_prefix]`\n */\nexport const encodeLabelHash = (labelHash: LabelHash): EncodedLabelHash =>\n `[${labelHash.slice(2)}]`;\n\n/**\n * Parses an Encoded LabelHash (`[labelhash_without_0x_prefix]`) as a {@link LabelHash},\n * returning `null` if the input does not match the expected format.\n */\nfunction parseEncodedLabelHash(value: string): LabelHash | null {\n if (value.length !== 66) return null;\n if (value[0] !== \"[\") return null;\n if (value[65] !== \"]\") return null;\n\n const hash = `0x${value.slice(1, 65)}`;\n if (!isLabelHash(hash)) return null;\n\n return hash;\n}\n\n/**\n * Decodes an Encoded LabelHash as a LabelHash.\n *\n * @throws if a valid LabelHash cannot be decoded\n *\n * @see https://ensnode.io/docs/reference/terminology#encoded-labelhash\n * @see https://github.com/wevm/viem/blob/main/src/utils/ens/encodedLabelToLabelhash.ts\n *\n * @param maybeEncodedLabelHash The encoded label hash in format `[labelhash_without_0x_prefix]`\n * @returns A 32-byte lowercase hash string starting with '0x'\n */\nexport const decodeEncodedLabelHash = (maybeEncodedLabelHash: string): LabelHash => {\n const parsed = parseEncodedLabelHash(maybeEncodedLabelHash);\n if (parsed === null) {\n throw new Error(\n `EncodedLabelHash '${maybeEncodedLabelHash}' is malformed: expected format '[<64-char lowercase hex>]'.`,\n );\n }\n return parsed;\n};\n\n/**\n * Checks if the value is an {@link EncodedLabelHash}.\n */\nexport function isEncodedLabelHash(value: string): value is EncodedLabelHash {\n return parseEncodedLabelHash(value) !== null;\n}\n","import { ens_normalize } from \"@adraffy/ens-normalize\";\n\nimport type { InterpretedLabel, InterpretedName, Label, Name } from \"./types\";\n\n/**\n * Normalizes a Name according to ENS normalization rules (ENSIP-15), returning an InterpretedName.\n *\n * @throws if the Name is not normalizable\n * @see https://docs.ens.domains/ensip/15\n */\nexport const normalizeName = (name: Name): InterpretedName => {\n try {\n return ens_normalize(name) as InterpretedName;\n } catch (cause) {\n throw new Error(`Name '${name}' cannot be normalized.`, { cause });\n }\n};\n\n/**\n * Normalizes a Label according to ENS normalization rules (ENSIP-15), returning an InterpretedLabel.\n *\n * @throws if the Label is not normalizable\n * @see https://docs.ens.domains/ensip/15\n */\nexport const normalizeLabel = (label: Label): InterpretedLabel => {\n // empty string cannot be a normalized label\n if (label === \"\") throw new Error(\"Label is empty ('') and cannot be normalized.\");\n\n // normalized labels do not contain periods\n if (label.includes(\".\")) {\n throw new Error(`Label '${label}' includes '.' and cannot be normalized.`);\n }\n\n try {\n // NOTE: the ens_normalize function accepts _names_ not labels, and so we must include our own\n // invariants above to ensure that the `label` input here can be safely normalized\n return ens_normalize(label) as InterpretedLabel;\n } catch (cause) {\n throw new Error(`Label '${label}' cannot be normalized.`, { cause });\n }\n};\n\n/**\n * Determines whether the Name is normalized according to ENSIP-15 normalization rules.\n */\nexport function isNormalizedName(name: Name): boolean {\n try {\n return name === normalizeName(name);\n } catch {\n return false;\n }\n}\n\n/**\n * Determines whether the Label is normalized according to ENSIP-15 normalization rules.\n */\nexport function isNormalizedLabel(label: Label): boolean {\n try {\n return label === normalizeLabel(label);\n } catch {\n return false;\n }\n}\n","import { ENS_ROOT_NAME } from \"./constants\";\nimport {\n decodeEncodedLabelHash,\n encodeLabelHash,\n isEncodedLabelHash,\n labelhashInterpretedLabel,\n labelhashLiteralLabel,\n} from \"./labelhash\";\nimport { isNormalizedLabel, normalizeLabel } from \"./normalization\";\nimport type {\n InterpretedLabel,\n InterpretedName,\n Label,\n LabelHash,\n LabelHashPath,\n LiteralLabel,\n LiteralName,\n Name,\n} from \"./types\";\n\n/**\n * Interprets a user-provided {@link LiteralName} as an {@link InterpretedName}.\n *\n * A {@link LiteralName} may be any arbitrary string. The ENS Root Name ('') ({@link ENS_ROOT_NAME})\n * is only accepted when `options.allowENSRootName` is `true`, and is returned as-is.\n *\n * This function walks each LiteralLabel of `name` and maps it to an {@link InterpretedLabel}\n * according to the provided `options`:\n *\n * 0. If the LiteralLabel is an empty string (''), this function throws: an empty Label is not a valid\n * {@link InterpretedLabel}.\n * 1. If the LiteralLabel is already a normalized LiteralLabel, it is kept as-is.\n * 2. Otherwise, if the LiteralLabel looks like an {@link EncodedLabelHash} (e.g. `[abcd…]`) and\n * `options.allowEncodedLabelHashes` is `true`, it is kept as-is.\n * 3. Otherwise, the LiteralLabel is unnormalized. If `options.coerceUnnormalizedLabelsToNormalizedLabels` is `false`,\n * this function throws. Otherwise (default), the LiteralLabel is passed through ENSIP-15 normalization\n * ({@link normalizeLabel}). If normalization succeeds, the normalized form is used (e.g. `\"Vitalik\"` →\n * `\"vitalik\"`).\n * 4. Otherwise, the LiteralLabel is unnormalizable. If `options.coerceUnnormalizableLabelsToEncodedLabelHashes`\n * is `true`, the Label is replaced with the EncodedLabelHash of its literal bytes. Otherwise, this\n * function throws.\n *\n * Note that step 3 gates step 4: if `options.coerceUnnormalizedLabelsToNormalizedLabels` is `false`, the\n * function throws immediately for any unnormalized Label, regardless of whether the Label would have been\n * normalizable and regardless of `options.coerceUnnormalizableLabelsToEncodedLabelHashes`.\n *\n * @param name - The user-provided {@link LiteralName} to interpret.\n * @param options - Controls how the interpretation handles edge cases.\n * @param options.allowENSRootName - When `true`, an empty `name` is accepted and returned as the ENS Root Name.\n * When `false` (default), an empty `name` throws.\n * @param options.allowEncodedLabelHashes - When `true`, a Label that is already formatted as an\n * {@link EncodedLabelHash} is preserved verbatim. When `false` (default), such a Label is treated like any other\n * input and passed through normalization, which will fail and fall through to the unnormalizable-Label handling.\n * @param options.coerceUnnormalizedLabelsToNormalizedLabels - When `true` (default), a Label that is not already\n * normalized is passed through ENSIP-15 normalization (e.g. `\"Vitalik\"` → `\"vitalik\"`). When `false`, any\n * unnormalized Label causes this function to throw — no normalization is attempted and\n * `coerceUnnormalizableLabelsToEncodedLabelHashes` is not consulted.\n * @param options.coerceUnnormalizableLabelsToEncodedLabelHashes - When `true`, a Label that cannot be normalized is\n * replaced with the EncodedLabelHash of its literal bytes. When `false` (default), encountering such a Label causes\n * this function to throw. Only consulted when `coerceUnnormalizedLabelsToNormalizedLabels` is `true`.\n *\n * @throws if `name` cannot be coerced into an {@link InterpretedName} under the provided `options`.\n *\n * @dev casts to {@link InterpretedLabel} to avoid an additional unnecessary `asInterpretedLabel` pass.\n */\nexport function literalNameToInterpretedName(\n name: LiteralName,\n {\n allowENSRootName = false,\n allowEncodedLabelHashes = false,\n coerceUnnormalizedLabelsToNormalizedLabels = true,\n coerceUnnormalizableLabelsToEncodedLabelHashes = false,\n }: {\n allowENSRootName?: boolean | undefined;\n allowEncodedLabelHashes?: boolean | undefined;\n coerceUnnormalizedLabelsToNormalizedLabels?: boolean | undefined;\n coerceUnnormalizableLabelsToEncodedLabelHashes?: boolean | undefined;\n } = {},\n): InterpretedName {\n if (name === \"\") {\n if (allowENSRootName) return ENS_ROOT_NAME;\n\n throw new Error(\n `The ENS Root Name ('') cannot conform to InterpretedName when allowENSRootName is false.`,\n );\n }\n\n return interpretedLabelsToInterpretedName(\n literalNameToLiteralLabels(name).map((label) => {\n // Sanity Check: No empty Labels\n if (label === \"\") {\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because it contains an empty Label segment, which is not a normalized Label.`,\n );\n }\n\n // if it's already normalized, good to go\n if (isNormalizedLabel(label)) {\n return label as Label as InterpretedLabel;\n }\n\n // special case: if it's an EncodedLabelHash, and the consumer allows, good to go\n if (allowEncodedLabelHashes && isEncodedLabelHash(label)) {\n return label as Label as InterpretedLabel;\n }\n\n // if the consumer does not want to allow coercion of unnormalized labels, then there's nothing to do\n if (!coerceUnnormalizedLabelsToNormalizedLabels) {\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because Label '${label}' is unnormalized and coercion is disabled.`,\n );\n }\n\n try {\n // attempt to normalize it and pass the normalized Label along\n return normalizeLabel(label);\n } catch {\n // but the label is unnormalizable, so:\n\n // if the consumer wants to interpret unnormalizable Labels as an EncodedLabelHash, do so\n if (coerceUnnormalizableLabelsToEncodedLabelHashes) {\n return encodeLabelHash(labelhashLiteralLabel(label)) as InterpretedLabel;\n }\n\n // otherwise, cannot conform\n throw new Error(\n `Name '${name}' cannot conform to InterpretedName because Label '${label}' is unnormalized and cannot be normalized.`,\n );\n }\n }),\n );\n}\n\n/**\n * Interprets a Literal Label, producing an Interpreted Label.\n *\n * @see https://ensnode.io/docs/reference/terminology#literal-label\n * @see https://ensnode.io/docs/reference/terminology#interpreted-label\n *\n * @param label - The Literal Label string to interpret\n * @returns The provided label if it is a normalized label, else the EncodedLabelHash of the label\n */\nexport function literalLabelToInterpretedLabel(label: LiteralLabel): InterpretedLabel {\n // if the label is normalized, good to go\n if (isNormalizedLabel(label)) return label as Label as InterpretedLabel;\n\n // otherwise, encode the labelhash of the literal Label\n return encodeLabelHash(labelhashLiteralLabel(label)) as InterpretedLabel;\n}\n\n/**\n * Interprets an ordered list of Literal Labels, producing an Interpreted Name.\n *\n * Note that it's important that the Literal Labels are provided as an array, otherwise it's\n * impossible to differentiate between 'a.label.eth' being ['a.label', 'eth'] or ['a', 'label', 'eth'].\n *\n * Note that the input is an ordered list of _Literal_ Labels: in this context, any literal label\n * that is formatted as an Encoded LabelHash will NOT be interpreted as such. Instead it will be\n * interpreted into an Encoded LabelHash that encodes the literal labelhash of the Literal Label.\n *\n * @param labels An ordered list of 0 or more Literal Labels\n * @returns An InterpretedName\n */\nexport function literalLabelsToInterpretedName(labels: LiteralLabel[]): InterpretedName {\n return labels.map(literalLabelToInterpretedLabel).join(\".\") as InterpretedName;\n}\n\n/**\n * Joins the list of Interpreted Labels with '.' to form an Interpreted Name.\n *\n * @param labels An ordered list of 0 or more Interpreted Labels\n * @returns An InterpretedName\n */\nexport function interpretedLabelsToInterpretedName(labels: InterpretedLabel[]): InterpretedName {\n return labels.join(\".\") as InterpretedName;\n}\n\n/**\n * Joins the list of Literal Labels with '.' to form a Literal Name.\n *\n * Note: LiteralLabel values may contain '.' characters, which will be preserved\n * in the resulting LiteralName. Therefore, the number of labels in the returned\n * LiteralName may be greater than the number of LiteralLabels in the input array.\n *\n * @param labels An ordered list of 0 or more Literal Labels\n * @returns An LiteralName\n */\nexport function literalLabelsToLiteralName(labels: LiteralLabel[]): LiteralName {\n return labels.join(\".\") as LiteralName;\n}\n\n/**\n * Converts an LiteralName into a list of LiteralLabels.\n */\nexport function literalNameToLiteralLabels(name: LiteralName): LiteralLabel[] {\n if (name === \"\") return [];\n return name.split(\".\") as LiteralLabel[];\n}\n\n/**\n * Converts an Interpreted Name into a list of Interpreted Labels.\n */\nexport function interpretedNameToInterpretedLabels(name: InterpretedName): InterpretedLabel[] {\n if (name === \"\") return [];\n return name.split(\".\") as InterpretedLabel[];\n}\n\nexport function isInterpretedLabel(label: Label): label is InterpretedLabel {\n return isEncodedLabelHash(label) || isNormalizedLabel(label);\n}\n\n/**\n * Determines whether `name` is an {@link InterpretedName}.\n * The root name (\"\") is a valid InterpretedName.\n *\n * @param name\n * @returns\n */\nexport function isInterpretedName(name: Name): name is InterpretedName {\n if (name === ENS_ROOT_NAME) return true;\n return name.split(\".\").every(isInterpretedLabel);\n}\n\n/**\n * Converts InterpretedLabels into a LabelHashPath.\n */\nexport function interpretedLabelsToLabelHashPath(labels: InterpretedLabel[]): LabelHashPath {\n return labels\n .map((label) => {\n try {\n // attempt to decode label as an encoded labelhash\n return decodeEncodedLabelHash(label);\n } catch {\n // but if that failed, this must be a normalized label, so labelhash it\n return labelhashInterpretedLabel(label);\n }\n })\n .toReversed();\n}\n\n/**\n * Constructs a new InterpretedName from an InterpretedLabel (child) and InterpretedName (parent).\n *\n * If no parent is available the InterpretedLabel is cast to an InterpretedName and returned.\n *\n * @dev the following is safe due to InterpretedLabel/InterpretedName semantics, see above.\n */\nexport function constructSubInterpretedName(\n label: InterpretedLabel,\n name: InterpretedName | undefined,\n): InterpretedName {\n if (name === undefined || name === \"\") return label as Name as InterpretedName;\n return [label, name].join(\".\") as InterpretedName;\n}\n\n/**\n * Given a `labelHash` and optionally its healed InterpretedLabel, return an InterpretedLabel.\n */\nexport function ensureInterpretedLabel(\n labelHash: LabelHash,\n label: InterpretedLabel | undefined,\n): InterpretedLabel {\n return label ?? (encodeLabelHash(labelHash) as InterpretedLabel);\n}\n\n/**\n * Casts a string to a {@link LiteralName}.\n *\n * A LiteralName is a name that should be interpreted as a string literal. It may or may not be\n * normalized or normalizable. It may also include labels formatted as an EncodedLabelHash, but\n * such labels must be interpreted literally and not as an EncodedLabelHash.\n */\nexport function asLiteralName(name: Name): LiteralName {\n return name as LiteralName;\n}\n\n/**\n * Casts a string to a {@link LiteralLabel}.\n *\n * A LiteralLabel is a label that should be interpreted as a string literal. It may or may not be\n * normalized or normalizable. It may also be formatted as an EncodedLabelHash, but such labels must\n * be interpreted literally and not as an EncodedLabelHash.\n */\nexport function asLiteralLabel(label: Label): LiteralLabel {\n return label as LiteralLabel;\n}\n\n/**\n * Validates and casts a string to an {@link InterpretedLabel}.\n * An InterpretedLabel is either a normalized label or an EncodedLabelHash.\n *\n * @throws if the input is not a valid InterpretedLabel\n */\nexport function asInterpretedLabel(label: Label): InterpretedLabel {\n if (isInterpretedLabel(label)) return label;\n\n throw new Error(`Not a valid InterpretedLabel: '${label}'`);\n}\n\n/**\n * Validates and casts a string to an {@link InterpretedName}.\n * An InterpretedName is either the ENS Root Name ('') or a name made up of InterpretedLabels (which\n * are either normalized Labels or EncodedLabelHashes).\n *\n * @throws if the input cannot be interpreted into an InterpretedName\n */\nexport function asInterpretedName(name: Name): InterpretedName {\n if (isInterpretedName(name)) return name;\n\n throw new Error(`Not a valid InterpretedName: '${name}'`);\n}\n","import { AccountId as CaipAccountId, AssetId as CaipAssetId } from \"caip\";\n\nimport type { AccountId, AccountIdString, AssetId, AssetIdString } from \"./types\";\n\n/**\n * Stringify an {@link AccountId} as a fully lowercase CAIP-10 AccountId string.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport function stringifyAccountId({ chainId, address }: AccountId): AccountIdString {\n return CaipAccountId.format({\n chainId: { namespace: \"eip155\", reference: chainId.toString() },\n address,\n }).toLowerCase();\n}\n\n/**\n * Stringify an {@link AssetId} as a fully lowercase CAIP-19 AssetId string.\n *\n * @see https://chainagnostic.org/CAIPs/caip-19\n */\nexport function stringifyAssetId({\n assetNamespace,\n contract: { chainId, address },\n tokenId,\n}: AssetId): AssetIdString {\n return CaipAssetId.format({\n chainId: { namespace: \"eip155\", reference: chainId.toString() },\n assetName: { namespace: assetNamespace, reference: address },\n tokenId: tokenId.toString(),\n }).toLowerCase();\n}\n","import {\n coinTypeToEvmChainId as _coinTypeToEvmChainId,\n evmChainIdToCoinType as _evmChainIdToCoinType,\n} from \"@ensdomains/address-encoder/utils\";\n\nimport type { ChainId, CoinType, EvmCoinType } from \"./types\";\n\n/**\n * The ETH coinType.\n *\n * @see https://docs.ens.domains/ensip/9\n */\nexport const ETH_COIN_TYPE: CoinType = 60;\n\n/**\n * The 'default' chainId corresponding to the below {@link DEFAULT_EVM_COIN_TYPE} in the context of\n * ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19\n */\nexport const DEFAULT_EVM_CHAIN_ID = 0;\n\n/**\n * ENSIP-19 EVM CoinType representing the 'default' coinType for EVM chains in ENS.\n *\n * @see https://docs.ens.domains/ensip/19/#reverse-resolution\n */\nexport const DEFAULT_EVM_COIN_TYPE = 0x8000_0000 as EvmCoinType;\n\n/**\n * Converts a CoinType to an EVM Chain Id.\n *\n * NOTE: for whatever reason @ensdomains/address-encoder#coinTypeToEvmChainId doesn't handle the\n * mainnet case so we implement that here\n *\n * @see https://docs.ens.domains/ensip/11\n */\nexport const coinTypeToEvmChainId = (coinType: CoinType): ChainId => {\n if (coinType === ETH_COIN_TYPE) return 1;\n return _coinTypeToEvmChainId(coinType);\n};\n\n/**\n * Converts an EVM Chain Id to a CoinType.\n *\n * NOTE: for whatever reason @ensdomains/address-encoder#evmChainIdToCoinType doesn't handle the\n * mainnet case so we implement that here\n */\nexport const evmChainIdToCoinType = (chainId: ChainId): CoinType => {\n if (chainId === 1) return ETH_COIN_TYPE;\n return _evmChainIdToCoinType(chainId);\n};\n\n/**\n * Converts a bigint value representing a CoinType into a valid CoinType.\n *\n * This is useful when onchain events emit coinTypes as bigint but we want to constrain them to\n * the CoinType type.\n *\n * @throws if `value` is too large to fit in Number.MAX_SAFE_INTEGER\n */\nexport const bigintToCoinType = (value: bigint): CoinType => {\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new Error(`'${value}' cannot represent as CoinType, it is too large.`);\n }\n\n return Number(value) as CoinType;\n};\n","import { bytesToString, hexToBytes } from \"viem\";\n\nimport { asLiteralLabel } from \"./interpreted-names-and-labels\";\nimport type { DNSEncodedLiteralName, DNSEncodedName, LiteralLabel } from \"./types\";\n\n/**\n * Decodes a DNS-Encoded name consisting of Literal Labels into an ordered list of Literal Labels.\n *\n * For discussion on DNS-Encoding, see the {@link DNSEncodedName} and {@link DNSEncodedLiteralName} types.\n *\n * Due to the constraints of DNS-Encoding, there is an additional guarantee that each Literal Label\n * in the resulting list is guaranteed to have a maximum byte length of 255.\n *\n * @param packet a hex string that encodes a DNSEncodedLiteralName\n * @returns A list of the LiteralLabels contained in packet\n * @throws If the packet is malformed\n * @dev This is just `decodeDNSEncodedName` with semantic input/output\n */\nexport function decodeDNSEncodedLiteralName(packet: DNSEncodedLiteralName): LiteralLabel[] {\n return decodeDNSEncodedName(packet).map(asLiteralLabel);\n}\n\n/**\n * Decodes a DNS-Encoded Name into an ordered list of string segments.\n *\n * For discussion on DNS-Encoding, see the {@link DNSEncodedName} type.\n *\n * Due to the constraints of DNS-Encoding, there is an additional guarantee that each segment\n * in the resulting list is guaranteed to have a maximum byte length of 255.\n *\n * @param packet a hex string that encodes a DNSEncodedName\n * @returns A UTF-8 string array of the segments contained in packet\n * @throws If the packet is malformed\n * @dev This is the generic implementation of DNS-Encoded Name Decoding\n */\nexport function decodeDNSEncodedName(packet: DNSEncodedName): string[] {\n const segments: string[] = [];\n\n const bytes = hexToBytes(packet);\n if (bytes.length === 0) throw new Error(`Packet is empty.`);\n\n let offset = 0;\n while (offset < bytes.length) {\n // NOTE: `len` is always [0, 255] because ByteArray is array of unsigned 8-bit integers. Because\n // the length of the next label is limited to one unsigned byte, this is why labels with bytelength\n // greater than 255 cannot be DNS Encoded.\n const len = bytes[offset];\n\n // Invariant: the while conditional enforces that there's always _something_ in bytes at offset\n if (len === undefined) {\n throw new Error(`Invariant: bytes[offset] is undefined after offset < bytes.length check.`);\n }\n\n // Invariant: `len` is always [0, 255]. technically not necessary but good for clarity\n if (len < 0 || len > 255) {\n throw new Error(\n `Invariant: this should be literally impossible, but an unsigned byte was less than zero or greater than 255. The value in question is ${len}`,\n );\n }\n\n // stop condition\n if (len === 0) break;\n\n // decode to UTF-8 string\n const segment = bytesToString(bytes.subarray(offset + 1, offset + len + 1));\n\n // add to list of segments and continue decoding\n segments.push(segment);\n offset += len + 1;\n }\n\n // check for overflow\n if (offset >= bytes.length) throw new Error(`Overflow, offset >= bytes.length`);\n\n // check for junk\n if (offset !== bytes.length - 1) throw new Error(`Junk at end of name`);\n\n return segments;\n}\n","import { hexToBigInt } from \"viem\";\n\nimport { zeroLower32Bits } from \"../_lib/zeroLower32Bits\";\nimport type {\n AccountId,\n DomainId,\n EACResource,\n ENSv1DomainId,\n ENSv1RegistryId,\n ENSv1VirtualRegistryId,\n ENSv2DomainId,\n ENSv2RegistryId,\n LabelHash,\n Node,\n NormalizedAddress,\n PermissionsId,\n PermissionsResourceId,\n PermissionsUserId,\n RegistrationId,\n RenewalId,\n ResolverId,\n ResolverRecordsId,\n StorageId,\n TokenId,\n} from \"./types\";\n\n/**\n * Id format — dash-delimited tuples (perf trade-off, see #2016).\n *\n * Every composite id in this module joins its components with `-` rather than the canonical\n * CAIP-style mixed `:` / `/` delimiters. This is so that Ponder's indexing-cache profile-pattern\n * matcher can decompose the id into its parts (chainId, address, node, ...) and derive each\n * segment from event args (`event.chain.id`, `event.event.log.address`, `event.event.args.*`),\n * which is what enables prefetch on hot tables (Domain, Registry, Resolver, etc.). Under\n * CAIP-shaped ids the matcher's single-level string-delimiter split can't decompose a mixed\n * `:` / `/` payload, so prefetch silently never fires.\n *\n * Move back to CAIP-style ids once Ponder's matcher supports parsing CAIP-shaped composite\n * primary keys directly. This is a temporary shape, not the long-term one. Tracked in\n * https://github.com/namehash/ensnode/issues/2034.\n *\n * Note that because we key ENSv2 Domains by StorageId (necessary for stable identifier over time,\n * since its backing tokenId can change), which is _derived_ from the emitted arguments, ENSv2 Domains\n * aren't currently prefetchable, and likely won't be without a feature from Ponder that allows\n * consumers to specify the prefetch key generation per-entity.\n */\nconst _stringifyAccountId = ({ chainId, address }: AccountId) => [chainId, address].join(\"-\");\n\nexport const makeENSv1RegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv1RegistryId;\n\nexport const makeENSv2RegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv2RegistryId;\n\nexport const makeENSv1VirtualRegistryId = (accountId: AccountId, node: Node) =>\n [_stringifyAccountId(accountId), node].join(\"-\") as ENSv1VirtualRegistryId;\n\n/**\n * Stringifies an {@link AccountId} as the id of a concrete Registry — either an\n * {@link ENSv1RegistryId} or an {@link ENSv2RegistryId}, but never an\n * {@link ENSv1VirtualRegistryId}.\n */\nexport const makeConcreteRegistryId = (accountId: AccountId) =>\n _stringifyAccountId(accountId) as ENSv1RegistryId | ENSv2RegistryId;\n\nexport const makeResolverId = (contract: AccountId) => _stringifyAccountId(contract) as ResolverId;\n\nexport const makeENSv1DomainId = (accountId: AccountId, node: Node) =>\n [_stringifyAccountId(accountId), node].join(\"-\") as ENSv1DomainId;\n\nexport const makeENSv2DomainId = (registry: AccountId, storageId: StorageId) =>\n [_stringifyAccountId(registry), storageId.toString()].join(\"-\") as ENSv2DomainId;\n\n/**\n * Computes a Label's {@link StorageId} given its TokenId or LabelHash.\n */\nexport const makeStorageId = (tokenIdOrLabelHash: TokenId | LabelHash): StorageId => {\n const tokenId =\n typeof tokenIdOrLabelHash === \"bigint\" //\n ? tokenIdOrLabelHash\n : hexToBigInt(tokenIdOrLabelHash);\n\n return zeroLower32Bits(tokenId) as StorageId;\n};\n\nexport const makePermissionsId = (contract: AccountId) =>\n _stringifyAccountId(contract) as PermissionsId;\n\nexport const makePermissionsResourceId = (contract: AccountId, resource: EACResource) =>\n [makePermissionsId(contract), resource].join(\"-\") as PermissionsResourceId;\n\nexport const makePermissionsUserId = (\n contract: AccountId,\n resource: EACResource,\n user: NormalizedAddress,\n) => [makePermissionsResourceId(contract, resource), user].join(\"-\") as PermissionsUserId;\n\nexport const makeResolverRecordsId = (resolver: AccountId, node: Node) =>\n [makeResolverId(resolver), node].join(\"-\") as ResolverRecordsId;\n\nexport const makeRegistrationId = (domainId: DomainId, registrationIndex: number) =>\n [domainId, registrationIndex].join(\"-\") as RegistrationId;\n\nexport const makeRenewalId = (domainId: DomainId, registrationIndex: number, index: number) =>\n [makeRegistrationId(domainId, registrationIndex), index].join(\"-\") as RenewalId;\n","/**\n * Zeros the lower 32 bits of `num`.\n */\nexport const zeroLower32Bits = (num: bigint) => num ^ (num & 0xffffffffn);\n","import { isHex, size } from \"viem\";\n\nimport type { InterfaceId } from \"./types\";\n\n/**\n * Whether `maybeInterfaceId` is a valid ERC-165 {@link InterfaceId} — a 4-byte hex selector.\n */\nexport function isInterfaceId(maybeInterfaceId: string): maybeInterfaceId is InterfaceId {\n return isHex(maybeInterfaceId) && size(maybeInterfaceId) === 4;\n}\n","import { type Hex, toHex } from \"viem\";\n\n/**\n * Converts a uint256 bigint to a zero-padded 32-byte (64-character) lowercase hex string.\n */\nexport const uint256ToHex32 = (num: bigint): Hex => toHex(num, { size: 32 });\n","import { uint256ToHex32 } from \"../_lib/uint256ToHex32\";\nimport type { LabelHash, Node, TokenId } from \"./types\";\n\n/**\n * Decodes a uint256-encoded-LabelHash (eg. from a {@link TokenId}) into a {@link LabelHash}.\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/ethregistrar/ETHRegistrarController.sol#L215\n */\nexport const interpretTokenIdAsLabelHash = (tokenId: TokenId): LabelHash => uint256ToHex32(tokenId);\n\n/**\n * Decodes a uint256-encoded-Node (eg. from a {@link TokenId}) into a {@link Node}.\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/db613bc/contracts/wrapper/ERC1155Fuse.sol#L262\n */\nexport const interpretTokenIdAsNode = (tokenId: TokenId): Node => uint256ToHex32(tokenId);\n","import { ens_beautify } from \"@adraffy/ens-normalize\";\n\nimport { ENS_ROOT_NAME } from \"./constants\";\nimport {\n interpretedLabelsToInterpretedName,\n interpretedNameToInterpretedLabels,\n} from \"./interpreted-names-and-labels\";\nimport { isNormalizedLabel } from \"./normalization\";\nimport type { InterpretedName, Label, Name } from \"./types\";\n\n/**\n * Constructs a name hierarchy from a given InterpretedName.\n *\n * @example\n * ```\n * getNameHierarchy(\"sub.example.eth\") -> [\"sub.example.eth\", \"example.eth\", \"eth\"]\n * ```\n */\nexport const getNameHierarchy = (name: InterpretedName): InterpretedName[] => {\n if (name === ENS_ROOT_NAME) return [];\n\n return interpretedNameToInterpretedLabels(name).map((_, i, labels) =>\n interpretedLabelsToInterpretedName(labels.slice(i)),\n );\n};\n\n/**\n * Derives the parent's {@link InterpretedName} of the provided `name`, or null if there is none.\n */\nexport const getParentInterpretedName = (name: InterpretedName): InterpretedName | null => {\n if (name === ENS_ROOT_NAME) return null;\n\n const labels = interpretedNameToInterpretedLabels(name);\n\n // For TLDs, return ENS_ROOT_NAME\n if (labels.length === 1) return ENS_ROOT_NAME;\n\n // Strip off the child-most label in the name to get the FQDN of the parent\n return interpretedLabelsToInterpretedName(labels.slice(1));\n};\n\n/**\n * Beautifies a name by converting each normalized label in the provided name to\n * its \"beautified\" form. Labels that are not normalized retain their original value.\n *\n * Invariants:\n * - The number of labels in the returned name is the same as the number of labels in the input name.\n * - The order of the labels in the returned name is the same as the order of the labels in the input name.\n * - If a label in the input is normalized, it is returned in its \"beautified\" form.\n * - If a label in the input name is not normalized, it is returned without modification.\n * - Therefore, the result of ens_normalize(beautifyName(name)) is the same as the result of ens_normalize(name).\n *\n * The \"beautified form\" of a normalized label converts special sequences of\n * emojis and other special characters to their \"beautified\" equivalents. All\n * such conversions transform X -> Y where Y is normalizable and normalizes back to X.\n * Ex: '1⃣2⃣' (normalized) to '1️⃣2️⃣' (normalizable but not normalized).\n * Ex: 'ξethereum' (normalized) to 'Ξethereum' (normalizable, but not normalized).\n * Ex: 'abc' (normalized) to 'abc' (also normalized, no conversion).\n * Ex: 'ABC' (normalizable but not normalized) to 'ABC' (no conversion).\n * Ex: 'invalid|label' (not normalizable) to 'invalid|label' (no conversion).\n * Ex: '' (unnormalized as a label) to '' (no conversion).\n *\n * @param name - The name to beautify.\n * @returns The beautified name.\n */\nexport const beautifyName = (name: Name): Name =>\n name\n .split(\".\")\n .map((label: Label) => {\n if (isNormalizedLabel(label)) {\n return ens_beautify(label);\n } else {\n return label;\n }\n })\n .join(\".\");\n","import { isHex } from \"viem\";\n\nimport type { LabelHash } from \"./types\";\n\n/**\n * Parses a labelHash string and normalizes it to a canonical `LabelHash`.\n *\n * Normalization rules applied in order:\n * 1. Adds `0x` prefix if missing\n * 2. Validates all characters (excluding the optional `0x` prefix) are valid hex digits\n * (uppercase or lowercase A-F are accepted and normalized to lowercase)\n * 3. If the hex digit count is odd, adds a leading `0` to make it even\n * 4. Validates the result is exactly 64 hex digits (32 bytes)\n *\n * @param maybeLabelHash - The string to parse as a labelHash\n * @throws {Error} If the input cannot be normalized to a valid labelHash\n */\nexport function parseLabelHash(maybeLabelHash: string): LabelHash {\n const hexPart = maybeLabelHash.startsWith(\"0x\") ? maybeLabelHash.slice(2) : maybeLabelHash;\n\n if (!isHex(`0x${hexPart}`, { strict: true })) {\n throw new Error(`Invalid labelHash: contains non-hex characters: ${maybeLabelHash}`);\n }\n\n const normalizedHexPart = hexPart.length % 2 === 1 ? `0${hexPart}` : hexPart;\n\n if (normalizedHexPart.length !== 64) {\n throw new Error(\n `Invalid labelHash length: expected 32 bytes (64 hex chars), got ${normalizedHexPart.length / 2} bytes: ${maybeLabelHash}`,\n );\n }\n\n return `0x${normalizedHexPart.toLowerCase()}` as LabelHash;\n}\n\n/**\n * Parses an encoded labelHash string (surrounded by square brackets) and normalizes it.\n *\n * This function is intentionally more lenient than {@link isEncodedLabelHash}: it accepts\n * both the canonical format `[hash]` (no `0x` inside brackets) and the non-canonical\n * `[0xhash]` format by delegating to {@link parseLabelHash} for the inner value.\n * `isEncodedLabelHash(\"[0xhash]\")` returns `false` for the same input.\n *\n * @param maybeEncodedLabelHash - The string to parse as an encoded labelHash\n * @throws {Error} If the input is not properly enclosed in brackets or cannot be normalized\n */\nexport function parseEncodedLabelHash(maybeEncodedLabelHash: string): LabelHash {\n if (!maybeEncodedLabelHash.startsWith(\"[\") || !maybeEncodedLabelHash.endsWith(\"]\")) {\n throw new Error(\n `Invalid encoded labelHash: must be enclosed in square brackets: ${maybeEncodedLabelHash}`,\n );\n }\n\n return parseLabelHash(maybeEncodedLabelHash.slice(1, -1));\n}\n\n/**\n * Parses a labelHash or encoded labelHash string and normalizes it.\n *\n * Tries both formats to be maximally generous with accepted inputs:\n * - If the input starts with `[` and ends with `]`, it is treated as an encoded labelHash\n * - Otherwise, it is treated as a plain labelHash\n *\n * @param maybeLabelHash - The string to parse as a labelHash or encoded labelHash\n * @throws {Error} If the input cannot be normalized to a valid labelHash\n */\nexport function parseLabelHashOrEncodedLabelHash(maybeLabelHash: string): LabelHash {\n if (maybeLabelHash.startsWith(\"[\") && maybeLabelHash.endsWith(\"]\")) {\n return parseEncodedLabelHash(maybeLabelHash);\n }\n\n return parseLabelHash(maybeLabelHash);\n}\n","import { hexToBigInt } from \"viem\";\n\nimport { toNormalizedAddress } from \"./address\";\nimport { bigintToCoinType, DEFAULT_EVM_COIN_TYPE, ETH_COIN_TYPE } from \"./coin-type\";\nimport { asLiteralLabel } from \"./interpreted-names-and-labels\";\nimport type { CoinType, LiteralLabel, NormalizedAddress } from \"./types\";\n\n/**\n * Matches an ENSIP-19 Reverse Name\n *\n * @see https://github.com/ensdomains/ens-contracts/blob/20e34971fd55f9e3b3cf4a5825d52e1504d36493/contracts/utils/ENSIP19.sol#L70\n */\nconst REVERSE_NAME_REGEX = /^([0-9a-fA-F]+)\\.([0-9a-f]{1,64}|addr|default)\\.reverse$/;\n\n/**\n * Parses an address label (hex sans prefix) into an Address.\n *\n * @param addressLabel - Lowercase hex string derived from a reverse address.\n * @throws if address is invalid\n * @see https://docs.ens.domains/ensip/19#reverse-resolution\n */\nconst parseAddressLabel = (addressLabel: LiteralLabel): NormalizedAddress => {\n return toNormalizedAddress(`0x${addressLabel}`);\n};\n\n/**\n * Parses a coinType label (hex sans prefix) into an EVMCoinType.\n *\n * @throws if coinType is invalid\n */\nconst parseCoinTypeLabel = (coinTypeLabel: LiteralLabel): CoinType => {\n if (coinTypeLabel === \"default\") return DEFAULT_EVM_COIN_TYPE;\n if (coinTypeLabel === \"addr\") return ETH_COIN_TYPE;\n\n return bigintToCoinType(hexToBigInt(`0x${coinTypeLabel}`));\n};\n\n/**\n * Parse the address and coinType out of an ENSIP-19 reverse name.\n */\nexport function parseReverseName(name: string): {\n address: NormalizedAddress;\n coinType: CoinType;\n} | null {\n const match = name.match(REVERSE_NAME_REGEX);\n if (!match) return null;\n\n try {\n const [, addressLabel, coinTypeLabel] = match;\n if (!addressLabel) return null;\n if (!coinTypeLabel) return null;\n\n return {\n address: parseAddressLabel(asLiteralLabel(addressLabel)),\n coinType: parseCoinTypeLabel(asLiteralLabel(coinTypeLabel)),\n };\n } catch {\n // either of the parse methods threw, unable to parse reverse name\n return null;\n }\n}\n","import {\n asInterpretedLabel,\n asLiteralLabel,\n interpretedLabelsToInterpretedName,\n interpretedNameToInterpretedLabels,\n} from \"./interpreted-names-and-labels\";\nimport { encodeLabelHash, isEncodedLabelHash, labelhashLiteralLabel } from \"./labelhash\";\nimport { isNormalizedLabel } from \"./normalization\";\nimport type { InterpretedLabel, InterpretedName } from \"./types\";\n\n/**\n * Reinterpret Label\n *\n * Reinterprets {@link InterpretedLabel} values received by \"External System\"\n * into {@link InterpretedLabel} values in \"Internal System\" where:\n * 1. \"External System\" is not guaranteed to be using the same ENSNormalize\n * version as \"Internal System\", and therefore the `InterpretedLabel` passed into\n * this function (from \"External System\") is not guaranteed to 100% align\n * with the invariants of an `InterpretedLabel` in \"Internal System\".\n * 2. The `InterpretedLabel` returned by this function is guaranteed to match\n * the invariants of `InterpretedLabel` in \"Internal System\".\n *\n * @returns reinterpreted label.\n * @throws an error if the provided label is an empty label\n * (and therefore violates the invariants of an InterpretedLabel).\n */\nexport function reinterpretLabel(label: InterpretedLabel): InterpretedLabel {\n // Invariant: InterpretedLabel value must never be an empty label.\n if (label === \"\") {\n throw new Error(\n `Cannot reinterpret an empty label that violates the invariants of an InterpretedLabel.`,\n );\n }\n\n // no change required for EncodedLabelHash\n if (isEncodedLabelHash(label)) return label;\n\n // no change required for NormalizedLabel\n if (isNormalizedLabel(label)) return label;\n\n // the provided `label` is an unnormalized literal label, encode it\n const labelHash = labelhashLiteralLabel(asLiteralLabel(label as string));\n return asInterpretedLabel(encodeLabelHash(labelHash));\n}\n\n/**\n * Reinterpret Name\n *\n * Reinterprets {@link InterpretedName} values received by \"External System\"\n * into {@link InterpretedName} values in \"Internal System\" where:\n * 1. \"External System\" is not guaranteed to be using the same ENSNormalize\n * version as \"Internal System\", and therefore the `InterpretedName` passed into\n * this function (from \"External System\") is not guaranteed to 100% align\n * with the invariants of an `InterpretedName` in \"Internal System\".\n * 2. The `InterpretedName` returned by this function is guaranteed to match\n * the invariants of `InterpretedName` in \"Internal System\".\n */\nexport function reinterpretName(name: InterpretedName): InterpretedName {\n if (name === \"\") return name;\n\n const labels = interpretedNameToInterpretedLabels(name);\n return interpretedLabelsToInterpretedName(labels.map(reinterpretLabel));\n}\n","import { DEFAULT_EVM_COIN_TYPE, ETH_COIN_TYPE } from \"./coin-type\";\nimport { asLiteralLabel, literalLabelsToLiteralName } from \"./interpreted-names-and-labels\";\nimport type { CoinType, LiteralLabel, LiteralName, NormalizedAddress } from \"./types\";\n\nconst ADDR_LABEL = asLiteralLabel(\"addr\");\nconst DEFAULT_LABEL = asLiteralLabel(\"default\");\nconst REVERSE_LABEL = asLiteralLabel(\"reverse\");\n\n/**\n * Gets the Label used for the reverse names of subnames as per ENSIP-11 & ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19/#reverse-resolution\n */\nexport const addrReverseLabel = (address: NormalizedAddress): LiteralLabel =>\n address.slice(2) as LiteralLabel;\n\n/**\n * Converts `coinType` to prefix-free hex string.\n *\n * @see https://docs.ens.domains/ensip/19\n */\nexport const coinTypeReverseLabel = (coinType: CoinType): LiteralLabel =>\n coinType.toString(16) as LiteralLabel;\n\n/**\n * Gets the reverse name for an address according to ENSIP-11 & ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/11#specification\n * @see https://docs.ens.domains/ensip/19#specification\n *\n * @param address - The address to get the reverse name for\n * @param coinType - The coin type to use for the reverse name\n * @returns The reverse name for the address\n *\n * @example\n * ```ts\n * reverseName(\"0x1234\", BigInt(ETH_COIN_TYPE)) // \"1234.addr.reverse\"\n * reverseName(\"0x1234\", BigInt(0x80000000)) // \"1234.default.reverse\"\n * reverseName(\"0x1234\", BigInt(0x5678)) // \"1234.5678.reverse\"\n * ```\n */\nexport function reverseName(address: NormalizedAddress, coinType: CoinType): LiteralName {\n const label = addrReverseLabel(address);\n\n const middle = ((): LiteralLabel => {\n switch (coinType) {\n case ETH_COIN_TYPE:\n return ADDR_LABEL;\n case DEFAULT_EVM_COIN_TYPE:\n return DEFAULT_LABEL;\n default:\n return coinTypeReverseLabel(coinType);\n }\n })();\n\n return literalLabelsToLiteralName([label, middle, REVERSE_LABEL]);\n}\n","import type { Address as ViemAddress, Hex as ViemHex } from \"viem\";\n\n/**\n * Represents a Hex string, in the format `0x{string}`.\n */\nexport type Hex = ViemHex;\n\n/**\n * Represents an EVM Address, in the format `0x{string}`, which may or may not be checksummed.\n */\nexport type Address = ViemAddress;\n\n/**\n * Represents a normalized (non-checksummed) EVM Address, in the format `0x{string}`, where all\n * characters are lowercase and length is exactly 42.\n *\n * @dev because the Address type is so widely used, nominally typing it would involve a _ton_ of\n * asNormalizedAddress() casts across the codebase. By avoiding the __brand, we can easily use\n * EventWithArgs<{ address: NormalizedAddress }> in all of the Ponder event handler args to\n * declare that the incoming event.args.address is a NormalizedAddress.\n */\nexport type NormalizedAddress = Address;\n\n/**\n * Unix timestamp value as bigint.\n *\n * Represents the number of seconds that have elapsed\n * since January 1, 1970 (midnight UTC/GMT).\n *\n * Guaranteed to be an integer. May be zero or negative to represent a time at or\n * before Jan 1, 1970.\n */\nexport type UnixTimestampBigInt = bigint;\n\n/**\n * Duration value as bigint.\n *\n * Representing a duration in seconds.\n *\n * Guaranteed to be a non-negative integer.\n */\nexport type DurationBigInt = bigint;\n\n/**\n * A value denominated in wei, the smallest unit of Ether (1 ETH = 10^18 wei).\n */\nexport type Wei = bigint;\n\n/**\n * Chain ID\n *\n * Represents a unique identifier for a chain.\n * Guaranteed to be a positive integer.\n *\n * Chain id standards are organized by the Ethereum Community @ https://github.com/ethereum-lists/chains\n **/\nexport type ChainId = number;\n\n/**\n * Defaultable Chain ID\n *\n * Represents a unique identifier for a chain, or\n * the default chain as defined by ENSIP-19.\n *\n * @see https://docs.ens.domains/ensip/19/#annex-supported-chains\n *\n * Guaranteed to be a non-negative integer.\n **/\nexport type DefaultableChainId = 0 | ChainId;\n\n/**\n * Represents an account (contract or EOA) at `address` on chain `chainId`.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport interface AccountId {\n chainId: ChainId;\n address: NormalizedAddress;\n}\n\n/**\n * An enum representing the possible CAIP-19 Asset Namespace values.\n *\n * @see https://chainagnostic.org/CAIPs/caip-19\n */\nexport const AssetNamespaces = {\n ERC721: \"erc721\",\n ERC1155: \"erc1155\",\n} as const;\n\nexport type AssetNamespace = (typeof AssetNamespaces)[keyof typeof AssetNamespaces];\n\n/**\n * A uint256 value that identifies a specific NFT within a NFT contract.\n */\nexport type TokenId = bigint;\n\n/**\n * Represents an Asset in `assetNamespace` by `tokenId` in `contract`.\n *\n * @see https://chainagnostic.org/CAIPs/caip-19\n */\nexport interface AssetId {\n assetNamespace: AssetNamespace;\n contract: AccountId;\n tokenId: TokenId;\n}\n"],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