@ensnode/datasources 0.0.0-next-20260603155437 → 0.0.0-next-20260603190454
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/LICENSE +1 -1
- package/dist/index.d.ts +133 -106
- package/dist/index.js +6206 -6184
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainId, NormalizedAddress } from 'enssdk';
|
|
1
2
|
import * as viem from 'viem';
|
|
2
3
|
import { Abi, Address, Chain } from 'viem';
|
|
3
4
|
import * as viem_chains from 'viem/chains';
|
|
@@ -3580,6 +3581,137 @@ declare const ThreeDNSToken: readonly [{
|
|
|
3580
3581
|
readonly type: "event";
|
|
3581
3582
|
}];
|
|
3582
3583
|
|
|
3584
|
+
/**
|
|
3585
|
+
* ENSNamespaceIds encodes the set of identifiers for well-known ENS namespaces.
|
|
3586
|
+
*
|
|
3587
|
+
* Each ENS namespace is a single, unified set of ENS names with a distinct onchain root
|
|
3588
|
+
* Registry (the ensroot Datasource) and the capability of spanning from that root Registry across
|
|
3589
|
+
* other `Datasource`s that may be distributed across multiple chains and offchain resources.
|
|
3590
|
+
*
|
|
3591
|
+
* For example, as of 9-Feb-2025 the canonical ENS namespace on mainnet includes:
|
|
3592
|
+
* - A root Registry on mainnet.
|
|
3593
|
+
* - An onchain Registrar for direct subnames of 'eth' on mainnet.
|
|
3594
|
+
* - An onchain Registry and Registrar for direct subnames of 'base.eth' on Base.
|
|
3595
|
+
* - An onchain Registry and Registrar subregistry for direct subnames of 'linea.eth' on Linea.
|
|
3596
|
+
* - An offchain subregistry for subnames of '.cb.id'.
|
|
3597
|
+
* - An offchain subregistry for subnames of '.uni.eth'.
|
|
3598
|
+
* - Etc..
|
|
3599
|
+
*
|
|
3600
|
+
* Each ENS namespace is logically independent of & isolated from the others, and not exclusively
|
|
3601
|
+
* correlated with a specific L1 chain. For example, the Sepolia testnet ENS namepace
|
|
3602
|
+
* is independent of the canonical ENS namespace on mainnet, and there could be an additional
|
|
3603
|
+
* deployment of the ENS protocol to mainnet, configured with different Datasources, resulting in a
|
|
3604
|
+
* logically isolated set of ENS names.
|
|
3605
|
+
*
|
|
3606
|
+
* 'ens-test-env' represents an ENS namespace running on a local Anvil chain for testing
|
|
3607
|
+
* protocol changes, running deterministic test suites, and local development.
|
|
3608
|
+
* https://github.com/ensdomains/ens-test-env
|
|
3609
|
+
*/
|
|
3610
|
+
declare const ENSNamespaceIds: {
|
|
3611
|
+
readonly Mainnet: "mainnet";
|
|
3612
|
+
readonly Sepolia: "sepolia";
|
|
3613
|
+
readonly SepoliaV2: "sepolia-v2";
|
|
3614
|
+
readonly EnsTestEnv: "ens-test-env";
|
|
3615
|
+
};
|
|
3616
|
+
/**
|
|
3617
|
+
* ENSNamespaceId is the derived string union of possible ENS namespace identifiers.
|
|
3618
|
+
*/
|
|
3619
|
+
type ENSNamespaceId = (typeof ENSNamespaceIds)[keyof typeof ENSNamespaceIds];
|
|
3620
|
+
/**
|
|
3621
|
+
* A Datasource describes a set of contracts on a given chain that interact with the ENS protocol.
|
|
3622
|
+
*/
|
|
3623
|
+
interface Datasource {
|
|
3624
|
+
chain: Chain;
|
|
3625
|
+
contracts: Record<string, ContractConfig>;
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* DatasourceNames encodes a unique id for each known Datasource.
|
|
3629
|
+
*/
|
|
3630
|
+
declare const DatasourceNames: {
|
|
3631
|
+
readonly ENSRoot: "ensroot";
|
|
3632
|
+
readonly Basenames: "basenames";
|
|
3633
|
+
readonly Lineanames: "lineanames";
|
|
3634
|
+
readonly Seaport: "seaport";
|
|
3635
|
+
readonly ThreeDNSOptimism: "threednsOptimism";
|
|
3636
|
+
readonly ThreeDNSBase: "threednsBase";
|
|
3637
|
+
readonly ReverseResolverRoot: "rrRoot";
|
|
3638
|
+
readonly ReverseResolverBase: "rrBase";
|
|
3639
|
+
readonly ReverseResolverLinea: "rrLinea";
|
|
3640
|
+
readonly ReverseResolverOptimism: "rrOptimism";
|
|
3641
|
+
readonly ReverseResolverArbitrum: "rrArbitrum";
|
|
3642
|
+
readonly ReverseResolverScroll: "rrScroll";
|
|
3643
|
+
readonly ENSv2Root: "ENSv2Root";
|
|
3644
|
+
};
|
|
3645
|
+
type DatasourceName = (typeof DatasourceNames)[keyof typeof DatasourceNames];
|
|
3646
|
+
/**
|
|
3647
|
+
* EventFilter specifies a given event's name and arguments to filter that event by.
|
|
3648
|
+
* This type is intentionally a subset of Ponder's `ContractConfig['filter']`.
|
|
3649
|
+
*/
|
|
3650
|
+
interface EventFilter {
|
|
3651
|
+
event: string;
|
|
3652
|
+
args: Record<string, unknown>;
|
|
3653
|
+
}
|
|
3654
|
+
/**
|
|
3655
|
+
* Defines the abi, address, and startBlock of a contract relevant to a Datasource.
|
|
3656
|
+
*
|
|
3657
|
+
* A contract is located onchain either by
|
|
3658
|
+
* 1. a single Address in `address`,
|
|
3659
|
+
* 2. a set of Address[] in `address`,
|
|
3660
|
+
* 3. or any contract that emits events as defined in `abi`.
|
|
3661
|
+
*
|
|
3662
|
+
* This type is intentionally a subset of Ponder's ContractConfig.
|
|
3663
|
+
*
|
|
3664
|
+
* @param abi - the ABI of the contract
|
|
3665
|
+
* @param address - (optional) Address of the contract or Address[] of each contract to be indexed
|
|
3666
|
+
* @param startBlock - block number the contract was deployed in
|
|
3667
|
+
*/
|
|
3668
|
+
type ContractConfig = {
|
|
3669
|
+
readonly abi: Abi;
|
|
3670
|
+
readonly address?: Address | Address[];
|
|
3671
|
+
readonly startBlock: number;
|
|
3672
|
+
readonly endBlock?: number;
|
|
3673
|
+
};
|
|
3674
|
+
/**
|
|
3675
|
+
* ENSNamespace encodes a set of known Datasources associated with the same ENS namespace.
|
|
3676
|
+
*
|
|
3677
|
+
* The ENSRoot Datasource is required (this formally defines an ENS namespace). All other Datasources
|
|
3678
|
+
* within the ENSNamespace are optional.
|
|
3679
|
+
*/
|
|
3680
|
+
type ENSNamespace = {
|
|
3681
|
+
[DatasourceNames.ENSRoot]: Datasource;
|
|
3682
|
+
} & Partial<Record<Exclude<DatasourceName, "ensroot">, Datasource>>;
|
|
3683
|
+
/**
|
|
3684
|
+
* Helper type to extract the datasource type for a specific datasource name across all namespaces.
|
|
3685
|
+
* Returns the union of all possible datasource types for that datasource name, or never if not found.
|
|
3686
|
+
*/
|
|
3687
|
+
type ExtractDatasourceType<Namespaces extends ENSNamespace, D extends DatasourceName> = Namespaces extends any ? (D extends keyof Namespaces ? Namespaces[D] : never) : never;
|
|
3688
|
+
|
|
3689
|
+
/** A query for {@link identifyDatasourceContracts}: an address, optionally scoped to one chain. */
|
|
3690
|
+
interface DatasourceIdentifyQuery {
|
|
3691
|
+
/** When set, only consider Datasources deployed on this chain. */
|
|
3692
|
+
chainId?: ChainId;
|
|
3693
|
+
address: NormalizedAddress;
|
|
3694
|
+
}
|
|
3695
|
+
/** A well-known Datasource contract matched by {@link identifyDatasourceContracts}. */
|
|
3696
|
+
interface DatasourceContractMatch {
|
|
3697
|
+
namespace: ENSNamespaceId;
|
|
3698
|
+
datasource: DatasourceName;
|
|
3699
|
+
contract: string;
|
|
3700
|
+
chainId: ChainId;
|
|
3701
|
+
address: NormalizedAddress;
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* Finds every well-known contract in `namespaceId`'s Datasources whose address equals
|
|
3705
|
+
* `query.address`, optionally restricted to `query.chainId`.
|
|
3706
|
+
*
|
|
3707
|
+
* Contracts without a fixed address (matched onchain by event only) are skipped — they have no
|
|
3708
|
+
* address to identify. A single address may match multiple contracts, so all matches are returned.
|
|
3709
|
+
*
|
|
3710
|
+
* @param namespaceId - The ENSNamespace identifier (e.g. 'mainnet', 'sepolia', 'ens-test-env')
|
|
3711
|
+
* @param query - The address to identify, optionally scoped to a chain
|
|
3712
|
+
*/
|
|
3713
|
+
declare const identifyDatasourceContracts: (namespaceId: ENSNamespaceId, query: DatasourceIdentifyQuery) => DatasourceContractMatch[];
|
|
3714
|
+
|
|
3583
3715
|
declare const AnyRegistrarABI: readonly [{
|
|
3584
3716
|
readonly anonymous: false;
|
|
3585
3717
|
readonly inputs: readonly [{
|
|
@@ -8438,111 +8570,6 @@ declare const ResolverABI: readonly [{
|
|
|
8438
8570
|
readonly type: "function";
|
|
8439
8571
|
}];
|
|
8440
8572
|
|
|
8441
|
-
/**
|
|
8442
|
-
* ENSNamespaceIds encodes the set of identifiers for well-known ENS namespaces.
|
|
8443
|
-
*
|
|
8444
|
-
* Each ENS namespace is a single, unified set of ENS names with a distinct onchain root
|
|
8445
|
-
* Registry (the ensroot Datasource) and the capability of spanning from that root Registry across
|
|
8446
|
-
* other `Datasource`s that may be distributed across multiple chains and offchain resources.
|
|
8447
|
-
*
|
|
8448
|
-
* For example, as of 9-Feb-2025 the canonical ENS namespace on mainnet includes:
|
|
8449
|
-
* - A root Registry on mainnet.
|
|
8450
|
-
* - An onchain Registrar for direct subnames of 'eth' on mainnet.
|
|
8451
|
-
* - An onchain Registry and Registrar for direct subnames of 'base.eth' on Base.
|
|
8452
|
-
* - An onchain Registry and Registrar subregistry for direct subnames of 'linea.eth' on Linea.
|
|
8453
|
-
* - An offchain subregistry for subnames of '.cb.id'.
|
|
8454
|
-
* - An offchain subregistry for subnames of '.uni.eth'.
|
|
8455
|
-
* - Etc..
|
|
8456
|
-
*
|
|
8457
|
-
* Each ENS namespace is logically independent of & isolated from the others, and not exclusively
|
|
8458
|
-
* correlated with a specific L1 chain. For example, the Sepolia testnet ENS namepace
|
|
8459
|
-
* is independent of the canonical ENS namespace on mainnet, and there could be an additional
|
|
8460
|
-
* deployment of the ENS protocol to mainnet, configured with different Datasources, resulting in a
|
|
8461
|
-
* logically isolated set of ENS names.
|
|
8462
|
-
*
|
|
8463
|
-
* 'ens-test-env' represents an ENS namespace running on a local Anvil chain for testing
|
|
8464
|
-
* protocol changes, running deterministic test suites, and local development.
|
|
8465
|
-
* https://github.com/ensdomains/ens-test-env
|
|
8466
|
-
*/
|
|
8467
|
-
declare const ENSNamespaceIds: {
|
|
8468
|
-
readonly Mainnet: "mainnet";
|
|
8469
|
-
readonly Sepolia: "sepolia";
|
|
8470
|
-
readonly SepoliaV2: "sepolia-v2";
|
|
8471
|
-
readonly EnsTestEnv: "ens-test-env";
|
|
8472
|
-
};
|
|
8473
|
-
/**
|
|
8474
|
-
* ENSNamespaceId is the derived string union of possible ENS namespace identifiers.
|
|
8475
|
-
*/
|
|
8476
|
-
type ENSNamespaceId = (typeof ENSNamespaceIds)[keyof typeof ENSNamespaceIds];
|
|
8477
|
-
/**
|
|
8478
|
-
* A Datasource describes a set of contracts on a given chain that interact with the ENS protocol.
|
|
8479
|
-
*/
|
|
8480
|
-
interface Datasource {
|
|
8481
|
-
chain: Chain;
|
|
8482
|
-
contracts: Record<string, ContractConfig>;
|
|
8483
|
-
}
|
|
8484
|
-
/**
|
|
8485
|
-
* DatasourceNames encodes a unique id for each known Datasource.
|
|
8486
|
-
*/
|
|
8487
|
-
declare const DatasourceNames: {
|
|
8488
|
-
readonly ENSRoot: "ensroot";
|
|
8489
|
-
readonly Basenames: "basenames";
|
|
8490
|
-
readonly Lineanames: "lineanames";
|
|
8491
|
-
readonly Seaport: "seaport";
|
|
8492
|
-
readonly ThreeDNSOptimism: "threednsOptimism";
|
|
8493
|
-
readonly ThreeDNSBase: "threednsBase";
|
|
8494
|
-
readonly ReverseResolverRoot: "rrRoot";
|
|
8495
|
-
readonly ReverseResolverBase: "rrBase";
|
|
8496
|
-
readonly ReverseResolverLinea: "rrLinea";
|
|
8497
|
-
readonly ReverseResolverOptimism: "rrOptimism";
|
|
8498
|
-
readonly ReverseResolverArbitrum: "rrArbitrum";
|
|
8499
|
-
readonly ReverseResolverScroll: "rrScroll";
|
|
8500
|
-
readonly ENSv2Root: "ENSv2Root";
|
|
8501
|
-
};
|
|
8502
|
-
type DatasourceName = (typeof DatasourceNames)[keyof typeof DatasourceNames];
|
|
8503
|
-
/**
|
|
8504
|
-
* EventFilter specifies a given event's name and arguments to filter that event by.
|
|
8505
|
-
* This type is intentionally a subset of Ponder's `ContractConfig['filter']`.
|
|
8506
|
-
*/
|
|
8507
|
-
interface EventFilter {
|
|
8508
|
-
event: string;
|
|
8509
|
-
args: Record<string, unknown>;
|
|
8510
|
-
}
|
|
8511
|
-
/**
|
|
8512
|
-
* Defines the abi, address, and startBlock of a contract relevant to a Datasource.
|
|
8513
|
-
*
|
|
8514
|
-
* A contract is located onchain either by
|
|
8515
|
-
* 1. a single Address in `address`,
|
|
8516
|
-
* 2. a set of Address[] in `address`,
|
|
8517
|
-
* 3. or any contract that emits events as defined in `abi`.
|
|
8518
|
-
*
|
|
8519
|
-
* This type is intentionally a subset of Ponder's ContractConfig.
|
|
8520
|
-
*
|
|
8521
|
-
* @param abi - the ABI of the contract
|
|
8522
|
-
* @param address - (optional) Address of the contract or Address[] of each contract to be indexed
|
|
8523
|
-
* @param startBlock - block number the contract was deployed in
|
|
8524
|
-
*/
|
|
8525
|
-
type ContractConfig = {
|
|
8526
|
-
readonly abi: Abi;
|
|
8527
|
-
readonly address?: Address | Address[];
|
|
8528
|
-
readonly startBlock: number;
|
|
8529
|
-
readonly endBlock?: number;
|
|
8530
|
-
};
|
|
8531
|
-
/**
|
|
8532
|
-
* ENSNamespace encodes a set of known Datasources associated with the same ENS namespace.
|
|
8533
|
-
*
|
|
8534
|
-
* The ENSRoot Datasource is required (this formally defines an ENS namespace). All other Datasources
|
|
8535
|
-
* within the ENSNamespace are optional.
|
|
8536
|
-
*/
|
|
8537
|
-
type ENSNamespace = {
|
|
8538
|
-
[DatasourceNames.ENSRoot]: Datasource;
|
|
8539
|
-
} & Partial<Record<Exclude<DatasourceName, "ensroot">, Datasource>>;
|
|
8540
|
-
/**
|
|
8541
|
-
* Helper type to extract the datasource type for a specific datasource name across all namespaces.
|
|
8542
|
-
* Returns the union of all possible datasource types for that datasource name, or never if not found.
|
|
8543
|
-
*/
|
|
8544
|
-
type ExtractDatasourceType<Namespaces extends ENSNamespace, D extends DatasourceName> = Namespaces extends any ? (D extends keyof Namespaces ? Namespaces[D] : never) : never;
|
|
8545
|
-
|
|
8546
8573
|
/**
|
|
8547
8574
|
* The ens-test-env ENSNamespace
|
|
8548
8575
|
*
|
|
@@ -128287,4 +128314,4 @@ declare const getENSRootChain: (namespaceId: ENSNamespaceId) => {
|
|
|
128287
128314
|
*/
|
|
128288
128315
|
declare const getENSRootChainId: (namespaceId: ENSNamespaceId) => 1 | 31337 | 11155111;
|
|
128289
128316
|
|
|
128290
|
-
export { AnyRegistrarABI, AnyRegistrarControllerABI, type ContractConfig, type Datasource, type DatasourceName, DatasourceNames, type ENSNamespace, type ENSNamespaceId, ENSNamespaceIds, ETHRegistrar as ETHRegistrarABI, EnhancedAccessControl as EnhancedAccessControlABI, type EventFilter, type ExtractDatasourceType, L2ReverseRegistrar as L2ReverseRegistrarABI, Registry as RegistryABI, ResolverABI, StandaloneReverseRegistrar as StandaloneReverseRegistrarABI, ThreeDNSToken as ThreeDNSTokenABI, UniversalResolverABI, ensTestEnvChain, getDatasource, getENSNamespace, getENSRootChain, getENSRootChainId, maybeGetDatasource };
|
|
128317
|
+
export { AnyRegistrarABI, AnyRegistrarControllerABI, type ContractConfig, type Datasource, type DatasourceContractMatch, type DatasourceIdentifyQuery, type DatasourceName, DatasourceNames, type ENSNamespace, type ENSNamespaceId, ENSNamespaceIds, ETHRegistrar as ETHRegistrarABI, EnhancedAccessControl as EnhancedAccessControlABI, type EventFilter, type ExtractDatasourceType, L2ReverseRegistrar as L2ReverseRegistrarABI, Registry as RegistryABI, ResolverABI, StandaloneReverseRegistrar as StandaloneReverseRegistrarABI, ThreeDNSToken as ThreeDNSTokenABI, UniversalResolverABI, ensTestEnvChain, getDatasource, getENSNamespace, getENSRootChain, getENSRootChainId, identifyDatasourceContracts, maybeGetDatasource };
|