@ensnode/ensnode-sdk 1.14.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/internal.cjs CHANGED
@@ -70,7 +70,9 @@ __export(internal_exports, {
70
70
  invariant_rpcConfigsSpecifiedForRootChain: () => invariant_rpcConfigsSpecifiedForRootChain,
71
71
  invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL: () => invariant_rpcEndpointConfigIncludesAtLeastOneHTTPProtocolURL,
72
72
  invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL: () => invariant_rpcEndpointConfigIncludesAtMostOneWebSocketsProtocolURL,
73
+ isBridgedOriginDomain: () => isBridgedOriginDomain,
73
74
  isBridgedResolver: () => isBridgedResolver,
75
+ isBridgedTargetRegistry: () => isBridgedTargetRegistry,
74
76
  isConfigTemplateSubgraphCompatible: () => isConfigTemplateSubgraphCompatible,
75
77
  isExtendedResolver: () => isExtendedResolver,
76
78
  isKnownENSIP19ReverseResolver: () => isKnownENSIP19ReverseResolver,
@@ -2150,34 +2152,40 @@ var errorResponseInternalServerErrorExample = {
2150
2152
  var import_enssdk8 = require("enssdk");
2151
2153
  var import_datasources5 = require("@ensnode/datasources");
2152
2154
  var import_devnet = require("@ensnode/datasources/devnet");
2153
- var SEPOLIA_V2_V2_ETH_REGISTRY = maybeGetDatasourceContract(
2155
+ var SEPOLIA_V2_V2_ETH_REGISTRY = getDatasourceContract(
2154
2156
  import_datasources5.ENSNamespaceIds.SepoliaV2,
2155
2157
  import_datasources5.DatasourceNames.ENSv2Root,
2156
2158
  "ETHRegistry"
2157
2159
  );
2158
- var SEPOLIA_V2_V2_ETH_REGISTRAR = maybeGetDatasourceContract(
2159
- import_datasources5.ENSNamespaceIds.SepoliaV2,
2160
- import_datasources5.DatasourceNames.ENSv2Root,
2161
- "ETHRegistrar"
2162
- );
2163
- var ENS_TEST_ENV_V2_ETH_REGISTRY = maybeGetDatasourceContract(
2160
+ var ENS_TEST_ENV_V2_ETH_REGISTRY = getDatasourceContract(
2164
2161
  import_datasources5.ENSNamespaceIds.EnsTestEnv,
2165
2162
  import_datasources5.DatasourceNames.ENSv2Root,
2166
2163
  "ETHRegistry"
2167
2164
  );
2168
- var ENS_TEST_ENV_V2_ETH_REGISTRAR = maybeGetDatasourceContract(
2165
+ var ENS_TEST_ENV_V2_ETH_REGISTRAR = getDatasourceContract(
2169
2166
  import_datasources5.ENSNamespaceIds.EnsTestEnv,
2170
2167
  import_datasources5.DatasourceNames.ENSv2Root,
2171
2168
  "ETHRegistrar"
2172
2169
  );
2173
2170
  var VITALIK_ADDRESS = (0, import_enssdk8.toNormalizedAddress)("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
2174
- var _SEPOLIA_V2_USER_ADDRESS = (0, import_enssdk8.toNormalizedAddress)("0x2f8e8b1126e75fde0b7f731e7cb5847eba2d2574");
2175
2171
  var SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES = (0, import_enssdk8.toNormalizedAddress)(
2176
- "0x205d2686da3bf33f64c17f21462c51b5ead462cf"
2172
+ "0x69696969c3b3ca102eeb5c53a065a7c3ae4fb6dd"
2173
+ );
2174
+ var SEPOLIA_V2_ADDRESS_WITH_PERMISSIONS = (0, import_enssdk8.toNormalizedAddress)(
2175
+ "0x4c65a1c8d330ce1c3f60e00cd55709ba5fe2e090"
2177
2176
  );
2178
2177
  var DEVNET_NAME_WITH_OWNED_RESOLVER = (0, import_enssdk8.asInterpretedName)("example.eth");
2179
- var SEPOLIA_V2_NAME_WITH_OWNED_RESOLVER = (0, import_enssdk8.asInterpretedName)("sfmonicdebmig.eth");
2180
2178
  var SEPOLIA_V2_TEST_NAME = (0, import_enssdk8.asInterpretedName)("test-name.eth");
2179
+ var MAINNET_PUBLIC_RESOLVER = getDatasourceContract(
2180
+ import_datasources5.ENSNamespaceIds.Mainnet,
2181
+ import_datasources5.DatasourceNames.ReverseResolverRoot,
2182
+ "DefaultPublicResolver5"
2183
+ );
2184
+ var SEPOLIA_V2_PUBLIC_RESOLVER = getDatasourceContract(
2185
+ import_datasources5.ENSNamespaceIds.SepoliaV2,
2186
+ import_datasources5.DatasourceNames.ReverseResolverRoot,
2187
+ "DefaultPublicResolver5"
2188
+ );
2181
2189
  function getGraphqlApiExampleQueryById(id) {
2182
2190
  const found = graphqlApiExampleQueryById.get(id);
2183
2191
  if (!found) {
@@ -2200,7 +2208,7 @@ var GRAPHQL_API_EXAMPLE_QUERIES = [
2200
2208
  #
2201
2209
  # There are also example queries in the tabs above \u261D\uFE0F
2202
2210
  query HelloWorld {
2203
- domain(by: { name: "eth" }) { canonical { name { interpreted } } owner { address } }
2211
+ domain(by: { name: "eth" }) { canonical { name { interpreted beautified } } owner { address } }
2204
2212
  }`,
2205
2213
  variables: { default: {} }
2206
2214
  },
@@ -2224,7 +2232,7 @@ query FindDomains(
2224
2232
  __typename
2225
2233
  id
2226
2234
  label { interpreted hash }
2227
- canonical { name { interpreted } }
2235
+ canonical { name { interpreted beautified } }
2228
2236
 
2229
2237
  registration { expiry event { timestamp } }
2230
2238
  }
@@ -2268,6 +2276,51 @@ query DomainByName($name: InterpretedName!) {
2268
2276
  [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: SEPOLIA_V2_TEST_NAME }
2269
2277
  }
2270
2278
  },
2279
+ ///////////////////////
2280
+ // Domain Registration
2281
+ ///////////////////////
2282
+ {
2283
+ id: "domain-registration",
2284
+ query: `
2285
+ query DomainRegistration($name: InterpretedName!) {
2286
+ domain(by: { name: $name }) {
2287
+ canonical { name { interpreted } }
2288
+
2289
+ registration {
2290
+ __typename
2291
+ id
2292
+ start
2293
+ expiry
2294
+ expired
2295
+ referrer
2296
+ registrar { chainId address }
2297
+ registrant { address }
2298
+ renewals(first: 5) {
2299
+ totalCount
2300
+ edges { node { duration base premium referrer } }
2301
+ }
2302
+
2303
+ # ENSv1 .eth registrations (also Basenames & Lineanames)
2304
+ ... on BaseRegistrarRegistration {
2305
+ baseCost
2306
+ premium
2307
+ isInGracePeriod
2308
+ # present when the .eth name is wrapped by the NameWrapper
2309
+ wrapped { fuses tokenId }
2310
+ }
2311
+
2312
+ # names held natively in the NameWrapper
2313
+ ... on NameWrapperRegistration {
2314
+ fuses
2315
+ }
2316
+ }
2317
+ }
2318
+ }`,
2319
+ variables: {
2320
+ default: { name: "vitalik.eth" },
2321
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: SEPOLIA_V2_TEST_NAME }
2322
+ }
2323
+ },
2271
2324
  //////////////////////
2272
2325
  // Domain Subdomains
2273
2326
  //////////////////////
@@ -2276,11 +2329,11 @@ query DomainByName($name: InterpretedName!) {
2276
2329
  query: `
2277
2330
  query DomainSubdomains($name: InterpretedName!) {
2278
2331
  domain(by: {name: $name}) {
2279
- canonical { name { interpreted } }
2332
+ canonical { name { interpreted beautified } }
2280
2333
  subdomains(first: 10) {
2281
2334
  edges {
2282
2335
  node {
2283
- canonical { name { interpreted } }
2336
+ canonical { name { interpreted beautified } }
2284
2337
  }
2285
2338
  }
2286
2339
  }
@@ -2288,6 +2341,31 @@ query DomainSubdomains($name: InterpretedName!) {
2288
2341
  }`,
2289
2342
  variables: { default: { name: "eth" } }
2290
2343
  },
2344
+ ////////////////////////
2345
+ // Subdomains Pagination
2346
+ ////////////////////////
2347
+ {
2348
+ id: "subdomains-pagination",
2349
+ query: `
2350
+ query SubdomainsPagination($first: Int!, $after: String) {
2351
+ domain(by: { name: "eth" }) {
2352
+ canonical { name { interpreted } }
2353
+
2354
+ # paginate child names: pass pageInfo.endCursor back as $after for the next page
2355
+ subdomains(first: $first, after: $after) {
2356
+ totalCount
2357
+ pageInfo { hasNextPage endCursor }
2358
+ edges {
2359
+ cursor
2360
+ node {
2361
+ canonical { name { interpreted } }
2362
+ }
2363
+ }
2364
+ }
2365
+ }
2366
+ }`,
2367
+ variables: { default: { first: 10, after: null } }
2368
+ },
2291
2369
  /////////////////
2292
2370
  // Domain Events
2293
2371
  /////////////////
@@ -2313,7 +2391,7 @@ query DomainEvents($name: InterpretedName!) {
2313
2391
  }`,
2314
2392
  variables: {
2315
2393
  default: { name: "newowner.eth" },
2316
- [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: "sfmonicdebmig.eth" }
2394
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: SEPOLIA_V2_TEST_NAME }
2317
2395
  }
2318
2396
  },
2319
2397
  ////////////////////
@@ -2330,7 +2408,7 @@ query AccountDomains(
2330
2408
  edges {
2331
2409
  node {
2332
2410
  label { interpreted }
2333
- canonical { name { interpreted } }
2411
+ canonical { name { interpreted beautified } }
2334
2412
  }
2335
2413
  }
2336
2414
  }
@@ -2375,7 +2453,7 @@ query RegistryDomains(
2375
2453
  edges {
2376
2454
  node {
2377
2455
  label { interpreted }
2378
- canonical { name { interpreted } }
2456
+ canonical { name { interpreted beautified } }
2379
2457
  }
2380
2458
  }
2381
2459
  }
@@ -2419,8 +2497,8 @@ query PermissionsByContract(
2419
2497
  variables: {
2420
2498
  // TODO: same as above
2421
2499
  default: { contract: ENS_TEST_ENV_V2_ETH_REGISTRAR },
2422
- // TODO: example response is empty for this address on Sepolia V2
2423
- [import_datasources5.ENSNamespaceIds.SepoliaV2]: { contract: SEPOLIA_V2_V2_ETH_REGISTRAR }
2500
+ // the ETHRegistrar holds no EAC permissions on sepolia-v2; the ETHRegistry does
2501
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { contract: SEPOLIA_V2_V2_ETH_REGISTRY }
2424
2502
  }
2425
2503
  },
2426
2504
  ////////////////////////
@@ -2443,8 +2521,7 @@ query PermissionsByUser($address: Address!) {
2443
2521
  }`,
2444
2522
  variables: {
2445
2523
  default: { address: import_devnet.accounts.deployer.address },
2446
- // TODO: example response is empty for this address on Sepolia V2
2447
- [import_datasources5.ENSNamespaceIds.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2524
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_PERMISSIONS }
2448
2525
  }
2449
2526
  },
2450
2527
  //////////////////////////////////
@@ -2493,7 +2570,39 @@ query DomainResolver($name: InterpretedName!) {
2493
2570
  variables: {
2494
2571
  default: { name: "vitalik.eth" },
2495
2572
  [import_datasources5.ENSNamespaceIds.EnsTestEnv]: { name: DEVNET_NAME_WITH_OWNED_RESOLVER },
2496
- [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: SEPOLIA_V2_NAME_WITH_OWNED_RESOLVER }
2573
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { name: SEPOLIA_V2_TEST_NAME }
2574
+ }
2575
+ },
2576
+ ////////////////////////
2577
+ // Resolver By Address
2578
+ ////////////////////////
2579
+ {
2580
+ id: "resolver-by-address",
2581
+ query: `
2582
+ query ResolverByAddress($contract: AccountIdInput!) {
2583
+ resolver(by: { contract: $contract }) {
2584
+ id
2585
+ contract { chainId address }
2586
+
2587
+ # records this resolver stores, keyed by node
2588
+ records(first: 5) {
2589
+ totalCount
2590
+ edges {
2591
+ node {
2592
+ node
2593
+ name
2594
+ keys
2595
+ coinTypes
2596
+ }
2597
+ }
2598
+ }
2599
+
2600
+ events { totalCount edges { node { topics data timestamp } } }
2601
+ }
2602
+ }`,
2603
+ variables: {
2604
+ default: { contract: MAINNET_PUBLIC_RESOLVER },
2605
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { contract: SEPOLIA_V2_PUBLIC_RESOLVER }
2497
2606
  }
2498
2607
  },
2499
2608
  //////////////
@@ -2508,17 +2617,17 @@ query Namegraph {
2508
2617
  domains {
2509
2618
  edges {
2510
2619
  node {
2511
- canonical { name { interpreted } }
2620
+ canonical { name { interpreted beautified } }
2512
2621
 
2513
2622
  subdomains {
2514
2623
  edges {
2515
2624
  node {
2516
- canonical { name { interpreted } }
2625
+ canonical { name { interpreted beautified } }
2517
2626
 
2518
2627
  subdomains {
2519
2628
  edges {
2520
2629
  node {
2521
- canonical { name { interpreted } }
2630
+ canonical { name { interpreted beautified } }
2522
2631
  }
2523
2632
  }
2524
2633
  }
@@ -2529,6 +2638,38 @@ query Namegraph {
2529
2638
  }
2530
2639
  }
2531
2640
  }
2641
+ }`,
2642
+ variables: { default: {} }
2643
+ },
2644
+ /////////////////////////////
2645
+ // ENSv1 → ENSv2 Migration
2646
+ /////////////////////////////
2647
+ {
2648
+ id: "account-migrated-names",
2649
+ query: `
2650
+ query AccountMigratedNames($address: Address!) {
2651
+ account(by: { address: $address }) {
2652
+ v1DomainsCount: domains(where: { version: ENSv1 }) { totalCount }
2653
+ v2DomainsCount: domains(where: { version: ENSv2 }) { totalCount }
2654
+ }
2655
+ }`,
2656
+ variables: {
2657
+ default: { address: VITALIK_ADDRESS },
2658
+ [import_datasources5.ENSNamespaceIds.SepoliaV2]: { address: SEPOLIA_V2_ADDRESS_WITH_LOT_OF_NAMES }
2659
+ }
2660
+ },
2661
+ {
2662
+ id: "eth-by-version",
2663
+ query: `
2664
+ query GetEthDomains {
2665
+ domains(where: { name: { eq: "eth" } }) {
2666
+ edges {
2667
+ node {
2668
+ __typename
2669
+ id
2670
+ }
2671
+ }
2672
+ }
2532
2673
  }`,
2533
2674
  variables: { default: {} }
2534
2675
  }
@@ -3208,6 +3349,12 @@ function isBridgedResolver(namespace, resolver) {
3208
3349
  (config) => accountIdEqual(config.resolver, resolver)
3209
3350
  ) ?? null;
3210
3351
  }
3352
+ function isBridgedOriginDomain(namespace, domainId) {
3353
+ return getBridgedResolverConfigs(namespace).find((config) => config.originDomainId === domainId) ?? null;
3354
+ }
3355
+ function isBridgedTargetRegistry(namespace, registryId) {
3356
+ return getBridgedResolverConfigs(namespace).find((config) => config.targetRegistryId === registryId) ?? null;
3357
+ }
3211
3358
 
3212
3359
  // src/shared/protocol-acceleration/is-ensip-19-reverse-resolver.ts
3213
3360
  var import_datasources15 = require("@ensnode/datasources");