From a647d9c278aca7c6bd42753aea385a4f8ce20442 Mon Sep 17 00:00:00 2001 From: djstrong Date: Wed, 11 Jun 2025 10:10:36 +0200 Subject: [PATCH 01/11] feat(ensadmin): add new GraphQL queries and categories for domain and resolver operations - Introduced multiple new GraphQL queries for domain and resolver functionalities, including fetching domains by name, label, and namehash. - Added a category field to saved queries for better organization. - Enhanced existing queries to support additional data retrieval options, improving overall functionality. --- .../src/app/gql/subgraph-compat/page.tsx | 865 ++++++++++++++++++ .../saved-queries/saved-queries-plugin.tsx | 1 + 2 files changed, 866 insertions(+) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 1fca0be14..1beeb0c4c 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -12,6 +12,7 @@ const savedQueries = [ operationName: "getDomains", id: "1", name: "Get Latest Domains", + category: "Domain", query: `query GetLatestDomains($first: Int!) { domains(orderBy: createdAt, orderDirection: desc, first: $first) { name @@ -27,6 +28,870 @@ const savedQueries = [ 2, ), }, + { + operationName: "getDomainByNamehash", + id: "2", + name: "Get Domain by Namehash", + category: "Domain", + query: `query GetDomainByNamehash($id: String!) { + domain(id: $id) { + name + labelName + labelhash + createdAt + expiryDate + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, + { + operationName: "getDomainByName", + id: "2a", + name: "Get Domain by Name", + category: "Domain", + query: `query GetDomainByName($ensName: String!) { + domains(where: {name: $ensName}) { + id + name + labelName + labelhash + createdAt + expiryDate + } +} + `, + variables: JSON.stringify( + { + id: "ens.eth", + }, + null, + 2, + ), + }, + { + operationName: "getDomainByLabel", + id: "2c", + name: "Get Domain by Label substring", + category: "Domain", + query: `query GetDomainByLabel($label: String!) { + domains(where: {labelName_contains: $label}) { + id + name + labelName + labelhash + createdAt + expiryDate + } +} + `, + variables: JSON.stringify( + { + label: "ens", + }, + null, + 2, + ), + }, + { + operationName: "getDomainByLabelhash", + id: "3", + name: "Get Label by Labelhash", + category: "Label", + query: `query GetLabelByLabelhash($labelhash: String!) { + domains(first: 1, where: { labelhash: $labelhash, labelName_not: null }) { + labelName + } +} + `, + variables: JSON.stringify( + { + labelhash: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // ens + }, + null, + 2, + ), + }, + { + operationName: "getNameHistory", + id: "4", + name: "Get Complete Name History", + category: "Domain", + query: `query GetNameHistory($id: String!) { + domain(id: $id) { + name + events { + id + blockNumber + transactionID + type: __typename + ... on Transfer { + owner { + id + } + } + ... on NewOwner { + owner { + id + } + } + ... on NewResolver { + resolver { + id + } + } + ... on NewTTL { + ttl + } + ... on WrappedTransfer { + owner { + id + } + } + ... on NameWrapped { + fuses + expiryDate + owner { + id + } + } + ... on NameUnwrapped { + owner { + id + } + } + ... on FusesSet { + fuses + } + ... on ExpiryExtended { + expiryDate + } + } + registration { + events { + id + blockNumber + transactionID + type: __typename + ... on NameRegistered { + registrant { + id + } + expiryDate + } + ... on NameRenewed { + expiryDate + } + ... on NameTransferred { + newOwner { + id + } + } + } + } + resolver { + events { + id + blockNumber + transactionID + type: __typename + ... on AddrChanged { + addr { + id + } + } + ... on MulticoinAddrChanged { + coinType + multiaddr: addr + } + ... on NameChanged { + name + } + ... on TextChanged { + key + value + } + ... on ContenthashChanged { + hash + } + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, + { + operationName: "getDomainEvents", + id: "5", + name: "Get Domain Events Only", + category: "Domain", + //events(orderBy: blockNumber, orderDirection: desc) is not working + query: `query GetDomainEvents($id: String!) { + domain(id: $id) { + name + events { + id + blockNumber + transactionID + type: __typename + ... on Transfer { + owner { + id + } + } + ... on NewOwner { + owner { + id + } + } + ... on NewResolver { + resolver { + id + } + } + ... on NameWrapped { + fuses + expiryDate + owner { + id + } + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, + { + operationName: "getResolverEvents", + id: "6", + name: "Get Resolver Events Only", + category: "Resolver", + //events(orderBy: blockNumber, orderDirection: desc) is not working + query: `query GetResolverEvents($id: String!) { + domain(id: $id) { + name + resolver { + events { + id + blockNumber + transactionID + type: __typename + ... on AddrChanged { + addr { + id + } + } + ... on MulticoinAddrChanged { + coinType + multiaddr: addr + } + ... on TextChanged { + key + value + } + ... on ContenthashChanged { + hash + } + ... on NameChanged { + name + } + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, + { + operationName: "getNamesForAddress", + id: "7", + name: "Get Names for Address (All Relations)", + category: "Account", + query: `query GetNamesForAddress($owner: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { + domains( + where: { + or: [ + { owner: $owner } + { registrant: $owner } + { wrappedOwner: $owner } + { resolvedAddress: $owner } + ] + and: [ + # Exclude domains with parent addr.reverse + # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + { parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" } + { + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + ] + } + orderBy: $orderBy + orderDirection: $orderDirection + first: $first + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + registrant { + id + } + wrappedOwner { + id + } + resolvedAddress { + id + } + registration { + registrationDate + expiryDate + } + } +} + `, + variables: JSON.stringify( + { + owner: "0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7", // ENS: DAO Wallet + first: 10, + orderBy: "name", + orderDirection: "asc", + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "getOwnedNames", + id: "8", + name: "Get Owned Names Only", + category: "Account", + query: `query GetOwnedNames($owner: String!, $first: Int!, $date: BigInt!) { + domains( + where: { + owner: $owner + # Exclude domains with parent addr.reverse + # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + orderBy: name + orderDirection: asc + first: $first + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + resolver { + id + } + } +} + `, + variables: JSON.stringify( + { + owner: "0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7", // ENS: DAO Wallet + first: 10, + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "getRegisteredNames", + id: "9", + name: "Get Registered Names Only", + category: "Account", + query: `query GetRegisteredNames($registrant: String!, $first: Int!, $date: BigInt!) { + domains( + where: { + registrant: $registrant + # Exclude domains with parent addr.reverse + # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + orderBy: expiryDate + orderDirection: desc + first: $first + ) { + id + name + labelName + createdAt + expiryDate + registrant { + id + } + registration { + registrationDate + expiryDate + cost + } + } +} + `, + variables: JSON.stringify( + { + registrant: "0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7", // ENS: DAO Wallet + first: 10, + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "getNamesIncludingExpired", + id: "10", + name: "Get Names Including Expired", + category: "Account", + query: `query GetNamesIncludingExpired($owner: String!, $first: Int!) { + domains( + where: { + or: [ + { owner: $owner } + { registrant: $owner } + { wrappedOwner: $owner } + ] + parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" + } + orderBy: expiryDate + orderDirection: desc + first: $first + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + registrant { + id + } + wrappedOwner { + id + } + registration { + expiryDate + } + } +} + `, + variables: JSON.stringify( + { + owner: "0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7", // ENS: DAO Wallet + first: 10, + }, + null, + 2, + ), + }, + { + operationName: "getSubgraphRegistrant", + id: "11", + name: "Get Registrant by Labelhash", // works with ENS only? + category: "Registrar", + query: `query GetSubgraphRegistrant($id: String!) { + registration(id: $id) { + registrant { + id + } + registrationDate + expiryDate + cost + domain { + name + labelName + } + } +} + `, + variables: JSON.stringify( + { + id: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // ens + }, + null, + 2, + ), + }, + { + operationName: "getSubnames", + id: "12", + name: "Get Subdomains", + category: "Domain", + query: `query GetSubnames($id: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { + domain(id: $id) { + name + subdomains( + orderBy: $orderBy + orderDirection: $orderDirection + first: $first + where: { + and: [ + { + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + { + or: [ + { owner_not: "0x0000000000000000000000000000000000000000" } + { resolver_not: null } + ] + } + ] + } + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + resolver { + id + } + registration { + registrationDate + expiryDate + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", + first: 10, + orderBy: "name", + orderDirection: "asc", + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "searchSubnames", + id: "13", + name: "Search Subdomains by Label", + category: "Domain", + query: `query SearchSubnames($id: String!, $searchString: String!, $first: Int!, $date: BigInt!) { + domain(id: $id) { + name + subdomains( + orderBy: name + orderDirection: asc + first: $first + where: { + and: [ + { labelName_contains: $searchString } + { + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + { + or: [ + { owner_not: "0x0000000000000000000000000000000000000000" } + { resolver_not: null } + ] + } + ] + } + ) { + id + name + labelName + createdAt + owner { + id + } + resolver { + id + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + searchString: "test", + first: 10, + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "getSubnamesIncludingExpired", + id: "14", + name: "Get Subdomains Including Expired", + category: "Domain", + query: `query GetSubnamesIncludingExpired($id: String!, $first: Int!) { + domain(id: $id) { + name + subdomains( + orderBy: expiryDate + orderDirection: desc + first: $first + where: { + or: [ + { owner_not: "0x0000000000000000000000000000000000000000" } + { resolver_not: null } + ] + } + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + resolver { + id + } + registration { + expiryDate + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + first: 10, + }, + null, + 2, + ), + }, + { + operationName: "getRecentSubnames", + id: "15", + name: "Get Recently Created Subdomains", + category: "Registrar", + query: `query GetRecentSubnames($id: String!, $first: Int!, $date: BigInt!) { + domain(id: $id) { + name + subdomains( + orderBy: createdAt + orderDirection: desc + first: $first + where: { + and: [ + { + or: [ + { expiryDate_gt: $date } + { expiryDate: null } + ] + } + { + or: [ + { owner_not: "0x0000000000000000000000000000000000000000" } + { resolver_not: null } + ] + } + ] + } + ) { + id + name + labelName + createdAt + expiryDate + owner { + id + } + resolver { + id + texts + coinTypes + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + first: 10, + date: Math.floor(Date.now() / 1000), + }, + null, + 2, + ), + }, + { + operationName: "getSubgraphRecords", + id: "16", + name: "Get Domain Records (Inherited Resolver)", + category: "Resolver", + query: `query GetSubgraphRecords($id: String!) { + domain(id: $id) { + name + isMigrated + createdAt + resolver { + id + texts + coinTypes + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, + { + operationName: "getSubgraphRecordsCustomResolver", + id: "17", + name: "Get Domain Records (Custom Resolver)", + category: "Resolver", + query: `query GetSubgraphRecordsCustomResolver($id: String!, $resolverId: String!) { + domain(id: $id) { + name + isMigrated + createdAt + } + resolver(id: $resolverId) { + id + texts + coinTypes + domain { + name + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + resolverId: "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41-0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ENS: Public Resolver 2 + }, + null, + 2, + ), + }, + { + operationName: "getResolverDetails", + id: "18", + name: "Get Resolver Details by Address", + category: "Resolver", + query: `query GetResolverDetails($resolverAddress: String!) { + resolvers(where: { address: $resolverAddress }, first: 10) { + id + texts + coinTypes + domain { + name + id + } + } +} + `, + variables: JSON.stringify( + { + resolverAddress: "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41", // ENS: Public Resolver 2 + }, + null, + 2, + ), + }, + { + operationName: "getDomainTextRecords", + id: "19", + name: "Get Domain Text Records", //FIXME + category: "Resolver", + //events(where: { type_in: ["TextChanged"] }, first: 20) is not working + query: `query GetDomainTextRecords($id: String!) { + domain(id: $id) { + name + resolver { + texts + events(first: 20) { + id + blockNumber + type: __typename + ... on TextChanged { + key + value + } + } + } + } +} + `, + variables: JSON.stringify( + { + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + }, + null, + 2, + ), + }, ] satisfies Array; export default async function SubgraphGraphQLPage({ searchParams }: PageProps) { diff --git a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx index b9227f850..9a801a4a1 100644 --- a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx +++ b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx @@ -9,6 +9,7 @@ import "./saved-queries-plugin.css"; export interface SavedQuery { id: string; name: string; + category: string; /** * The GraphQL query. From c3794ea6d90a283b830b5cc3a3e8477bee959083 Mon Sep 17 00:00:00 2001 From: djstrong Date: Wed, 11 Jun 2025 10:13:43 +0200 Subject: [PATCH 02/11] fix(saved-queries-plugin): make category field optional in SavedQuery interface --- .../plugins/saved-queries/saved-queries-plugin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx index 9a801a4a1..a35f8273a 100644 --- a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx +++ b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx @@ -9,7 +9,7 @@ import "./saved-queries-plugin.css"; export interface SavedQuery { id: string; name: string; - category: string; + category?: string; /** * The GraphQL query. From 4ce74a28680e6875a08023c5397d66a6a8655134 Mon Sep 17 00:00:00 2001 From: djstrong Date: Wed, 11 Jun 2025 10:16:45 +0200 Subject: [PATCH 03/11] lint --- apps/ensadmin/src/app/gql/subgraph-compat/page.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 1beeb0c4c..fe87e63fc 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -829,7 +829,8 @@ const savedQueries = [ variables: JSON.stringify( { id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth - resolverId: "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41-0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ENS: Public Resolver 2 + resolverId: + "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41-0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ENS: Public Resolver 2 }, null, 2, From 322245891abf855f182aecd56e78cccd797b94f1 Mon Sep 17 00:00:00 2001 From: djstrong Date: Wed, 11 Jun 2025 10:42:54 +0200 Subject: [PATCH 04/11] feat(subgraph-compat): add new GraphQL query for historical resolver records - Introduced a new query to fetch historical resolver records, including resolver details and changes over time. - Enhanced saved queries with additional operation for improved data retrieval related to ENS domains. --- .../src/app/gql/subgraph-compat/page.tsx | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index fe87e63fc..bbe958029 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -893,6 +893,51 @@ const savedQueries = [ 2, ), }, + { + operationName: "getHistoricalResolverRecords", + id: "20", + name: "Get Historical Resolver Records Evolution", + category: "Resolver", + query: `query GetHistoricalResolverRecords($ensName: String!) { + domains(where: { name: $ensName }) { + id + name + newResolvers { + resolverId + blockNumber + transactionID + resolver { + address + textChangeds { + key + value + blockNumber + transactionID + } + multicoinAddrChangeds { + coinType + addr + blockNumber + transactionID + } + contenthashChangeds { + hash + blockNumber + transactionID + } + } + } + } +} + `, + variables: JSON.stringify( + { + ensName: "ens.eth", + }, + null, + 2, + ), + }, ] satisfies Array; export default async function SubgraphGraphQLPage({ searchParams }: PageProps) { From ec08246c7b5a81e7669dd3b79b5c2adfe82aa5ef Mon Sep 17 00:00:00 2001 From: djstrong Date: Wed, 11 Jun 2025 10:54:42 +0200 Subject: [PATCH 05/11] feat(subgraph-compat): add new GraphQL query for domains with pagination - Introduced a new query to retrieve domains with pagination support, allowing for efficient data fetching. - Enhanced saved queries to include the new operation for improved data management related to ENS domains. --- .../src/app/gql/subgraph-compat/page.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index bbe958029..0beac8e7a 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -28,6 +28,29 @@ const savedQueries = [ 2, ), }, + { + operationName: "getDomainsWithPagination", + id: "1a", + name: "Get Domains with Pagination", + category: "Domain", + query: `query GetDomainsWithPagination($first: Int!, $skip: Int) { + domains(orderBy: createdAt, orderDirection: asc, first: $first, skip: $skip) { + id + name + expiryDate + createdAt + } +} + `, + variables: JSON.stringify( + { + first: 10, + skip: 20, + }, + null, + 2, + ), + }, { operationName: "getDomainByNamehash", id: "2", From 8ec69505c72a02a9efa2db51c17a7a6d5e0a02ab Mon Sep 17 00:00:00 2001 From: djstrong Date: Mon, 16 Jun 2025 12:57:00 +0200 Subject: [PATCH 06/11] feat(subgraph-compat): enhance saved queries with descriptions for better clarity - Added descriptive text for various saved queries to improve understanding of their functionality and usage. - Updated the SavedQuery interface to include an optional description field for enhanced documentation. --- .../src/app/gql/subgraph-compat/page.tsx | 93 ++++++++++++------- .../saved-queries/saved-queries-plugin.tsx | 1 + 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 0beac8e7a..661c57395 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -13,6 +13,7 @@ const savedQueries = [ id: "1", name: "Get Latest Domains", category: "Domain", + description: "Retrieves the most recently created domains in descending order by creation time. Useful for monitoring new domain registrations and understanding recent activity on the ENS network.", query: `query GetLatestDomains($first: Int!) { domains(orderBy: createdAt, orderDirection: desc, first: $first) { name @@ -33,6 +34,7 @@ const savedQueries = [ id: "1a", name: "Get Domains with Pagination", category: "Domain", + description: "Fetches domains with pagination support, ordered by creation time in ascending order. Use this when you need to iterate through all domains systematically or implement pagination in your application.", query: `query GetDomainsWithPagination($first: Int!, $skip: Int) { domains(orderBy: createdAt, orderDirection: asc, first: $first, skip: $skip) { id @@ -56,6 +58,7 @@ const savedQueries = [ id: "2", name: "Get Domain by Namehash", category: "Domain", + description: "Retrieves a specific domain using its namehash (the unique identifier for ENS names). The namehash is the cryptographic hash of the domain name.", query: `query GetDomainByNamehash($id: String!) { domain(id: $id) { name @@ -68,7 +71,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, @@ -79,8 +82,9 @@ const savedQueries = [ id: "2a", name: "Get Domain by Name", category: "Domain", - query: `query GetDomainByName($ensName: String!) { - domains(where: {name: $ensName}) { + description: "Looks up a domain by its human-readable name (e.g., 'ens.eth'). This is more user-friendly than using namehash but may be slightly less efficient for programmatic access.", + query: `query GetDomainByName($name: String!) { + domains(where: {name: $name}) { id name labelName @@ -92,18 +96,19 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "ens.eth", + name: "ens.eth", }, null, 2, ), }, { - operationName: "getDomainByLabel", + operationName: "getDomainsByLabel", id: "2c", - name: "Get Domain by Label substring", + name: "Get Domains by the childmost-label substring", category: "Domain", - query: `query GetDomainByLabel($label: String!) { + description: "Searches for domains containing a specific substring in their label (the leftmost part of the domain name). For example, searching for 'ens' would find 'ens.eth', 'myens.eth', etc. Useful for finding related domains or performing fuzzy searches.", + query: `query GetDomainsByLabel($label: String!) { domains(where: {labelName_contains: $label}) { id name @@ -123,11 +128,12 @@ const savedQueries = [ ), }, { - operationName: "getDomainByLabelhash", + operationName: "getLabelByLabelhash", id: "3", name: "Get Label by Labelhash", category: "Label", - query: `query GetLabelByLabelhash($labelhash: String!) { + description: "Reverse lookup to find the human-readable label from its labelhash. This is useful when you have a labelhash and need to determine what the actual text label is.", + query: `query getLabelByLabelhash($labelhash: String!) { domains(first: 1, where: { labelhash: $labelhash, labelName_not: null }) { labelName } @@ -135,7 +141,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - labelhash: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // ens + labelhash: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // labelhash("ens") }, null, 2, @@ -146,6 +152,7 @@ const savedQueries = [ id: "4", name: "Get Complete Name History", category: "Domain", + description: "Retrieves the complete historical timeline of events for a domain, including ownership transfers, resolver changes, registrations, renewals, and all resolver record updates. This provides an audit trail of activities related to the domain.", query: `query GetNameHistory($id: String!) { domain(id: $id) { name @@ -250,7 +257,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, @@ -261,6 +268,7 @@ const savedQueries = [ id: "5", name: "Get Domain Events Only", category: "Domain", + description: "Retrieves only the domain-level events (transfers, ownership changes, wrapping events) without registration or resolver events. Use this when you're specifically interested in domain ownership and management events.", //events(orderBy: blockNumber, orderDirection: desc) is not working query: `query GetDomainEvents($id: String!) { domain(id: $id) { @@ -298,7 +306,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, @@ -309,6 +317,7 @@ const savedQueries = [ id: "6", name: "Get Resolver Events Only", category: "Resolver", + description: "Retrieves only the resolver-related events (address changes, text record updates, contenthash changes) for a domain. Useful when you're tracking how a domain's records have been updated over time.", //events(orderBy: blockNumber, orderDirection: desc) is not working query: `query GetResolverEvents($id: String!) { domain(id: $id) { @@ -345,18 +354,19 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, ), }, { - operationName: "getNamesForAddress", + operationName: "getDomainsForAddress", id: "7", - name: "Get Names for Address (All Relations)", + name: "Get Domains for Address (owner, registrant, wrappedOwner, or resolvedAddress)", category: "Account", - query: `query GetNamesForAddress($owner: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { + description: "Finds all domains associated with an Ethereum address in any capacity - as owner, registrant, wrapped owner, or as the resolved address. Excludes reverse records and expired domains. This is a comprehensive way to find domains connected to an address.", + query: `query GetDomainsForAddress($owner: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { domains( where: { or: [ @@ -367,7 +377,7 @@ const savedQueries = [ ] and: [ # Exclude domains with parent addr.reverse - # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + # namehash("addr.reverse") = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 { parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" } { or: [ @@ -418,16 +428,17 @@ const savedQueries = [ ), }, { - operationName: "getOwnedNames", + operationName: "getOwnedInRegistryDomains", id: "8", - name: "Get Owned Names Only", + name: "Get Owned In Registry Domains Only", category: "Account", - query: `query GetOwnedNames($owner: String!, $first: Int!, $date: BigInt!) { + description: "Retrieves domains where the specified address is the owner in the ENS registry (not registrant or wrapped owner). This shows domains where the address has direct control over the ENS records but may not be the original registrant.", + query: `query getOwnedInRegistryDomains($owner: String!, $first: Int!, $date: BigInt!) { domains( where: { owner: $owner # Exclude domains with parent addr.reverse - # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + # namehash("addr.reverse") = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" or: [ { expiryDate_gt: $date } @@ -463,16 +474,17 @@ const savedQueries = [ ), }, { - operationName: "getRegisteredNames", + operationName: "getRegisteredDomains", id: "9", - name: "Get Registered Names Only", + name: "Get Registered Domains Only", category: "Account", - query: `query GetRegisteredNames($registrant: String!, $first: Int!, $date: BigInt!) { + description: "Retrieves domains where the specified address is the original registrant (the one who initially registered the .eth domain). This shows domains the address actually purchased and registered, not just ones they received or control.", + query: `query GetRegisteredDomains($registrant: String!, $first: Int!, $date: BigInt!) { domains( where: { registrant: $registrant # Exclude domains with parent addr.reverse - # namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 + # namehash("addr.reverse") = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" or: [ { expiryDate_gt: $date } @@ -514,6 +526,7 @@ const savedQueries = [ id: "10", name: "Get Names Including Expired", category: "Account", + description: "Retrieves all domains associated with an address (as owner, registrant, or wrapped owner) including those that have expired. Useful for historical analysis or when you need to see the domain portfolio of an address.", query: `query GetNamesIncludingExpired($owner: String!, $first: Int!) { domains( where: { @@ -522,6 +535,8 @@ const savedQueries = [ { registrant: $owner } { wrappedOwner: $owner } ] + # Exclude domains with parent addr.reverse + # namehash("addr.reverse") = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2" } orderBy: expiryDate @@ -562,6 +577,7 @@ const savedQueries = [ id: "11", name: "Get Registrant by Labelhash", // works with ENS only? category: "Registrar", + description: "Looks up registration information using a labelhash. This is primarily used for .eth domains and provides details about who registered the domain, when it was registered, when it expires, and what it cost. Note: This mainly works with .eth domains.", query: `query GetSubgraphRegistrant($id: String!) { registration(id: $id) { registrant { @@ -579,7 +595,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // ens + id: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // labelhash("ens") }, null, 2, @@ -590,6 +606,7 @@ const savedQueries = [ id: "12", name: "Get Subdomains", category: "Domain", + description: "Retrieves all subdomains under a given parent domain, filtering out expired domains and empty records. This is useful for exploring the subdomain hierarchy and finding active subdomains under a particular domain.", query: `query GetSubnames($id: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { domain(id: $id) { name @@ -635,7 +652,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") first: 10, orderBy: "name", orderDirection: "asc", @@ -650,6 +667,7 @@ const savedQueries = [ id: "13", name: "Search Subdomains by Label", category: "Domain", + description: "Searches for subdomains under a parent domain that contain a specific text string in their label. This enables fuzzy searching within a domain's subdomain space, useful for finding related or similarly named subdomains.", query: `query SearchSubnames($id: String!, $searchString: String!, $first: Int!, $date: BigInt!) { domain(id: $id) { name @@ -691,7 +709,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") searchString: "test", first: 10, date: Math.floor(Date.now() / 1000), @@ -705,6 +723,7 @@ const savedQueries = [ id: "14", name: "Get Subdomains Including Expired", category: "Domain", + description: "Retrieves all subdomains under a parent domain, including those that have expired. This provides a complete historical view of all subdomains that have ever existed under the parent domain.", query: `query GetSubnamesIncludingExpired($id: String!, $first: Int!) { domain(id: $id) { name @@ -739,7 +758,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") first: 10, }, null, @@ -751,6 +770,7 @@ const savedQueries = [ id: "15", name: "Get Recently Created Subdomains", category: "Registrar", + description: "Retrieves the most recently created subdomains under a parent domain, ordered by creation time. This is useful for monitoring new subdomain activity and tracking the growth of a domain's subdomain ecosystem.", query: `query GetRecentSubnames($id: String!, $first: Int!, $date: BigInt!) { domain(id: $id) { name @@ -794,7 +814,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") first: 10, date: Math.floor(Date.now() / 1000), }, @@ -807,6 +827,7 @@ const savedQueries = [ id: "16", name: "Get Domain Records (Inherited Resolver)", category: "Resolver", + description: "Retrieves a domain's resolver information including the types of records it supports (text records and coin types). This uses the domain's current resolver and shows what kind of records are available for the domain.", query: `query GetSubgraphRecords($id: String!) { domain(id: $id) { name @@ -822,7 +843,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, @@ -833,6 +854,7 @@ const savedQueries = [ id: "17", name: "Get Domain Records (Custom Resolver)", category: "Resolver", + description: "Retrieves domain information along with records from a specific resolver address.", query: `query GetSubgraphRecordsCustomResolver($id: String!, $resolverId: String!) { domain(id: $id) { name @@ -851,7 +873,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") resolverId: "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41-0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ENS: Public Resolver 2 }, @@ -864,6 +886,7 @@ const savedQueries = [ id: "18", name: "Get Resolver Details by Address", category: "Resolver", + description: "Retrieves detailed information about a resolver by its contract address. This shows the domains using this resolver and what types of records it supports.", query: `query GetResolverDetails($resolverAddress: String!) { resolvers(where: { address: $resolverAddress }, first: 10) { id @@ -887,8 +910,9 @@ const savedQueries = [ { operationName: "getDomainTextRecords", id: "19", - name: "Get Domain Text Records", //FIXME + name: "Get Domain Text Records", category: "Resolver", + description: "Retrieves the current text record keys for a domain and all resolver events history. The 'texts' field shows currently set text record keys, while 'events' shows all resolver events including TextChanged, ContenthashChanged, AddrChanged, and MulticoinAddrChanged.", //events(where: { type_in: ["TextChanged"] }, first: 20) is not working query: `query GetDomainTextRecords($id: String!) { domain(id: $id) { @@ -910,7 +934,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ens.eth + id: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") }, null, 2, @@ -921,6 +945,7 @@ const savedQueries = [ id: "20", name: "Get Historical Resolver Records Evolution", category: "Resolver", + description: "Provides a comprehensive view of how a domain's resolver records have evolved over time. This tracks resolver changes and the history of text records, address records, and contenthash changes across all resolvers the domain has used.", query: `query GetHistoricalResolverRecords($ensName: String!) { domains(where: { name: $ensName }) { id diff --git a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx index a35f8273a..fa3eb578a 100644 --- a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx +++ b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx @@ -10,6 +10,7 @@ export interface SavedQuery { id: string; name: string; category?: string; + description?: string; /** * The GraphQL query. From 7a3419b84dae75736db77e3c43ebb4f1386e2168 Mon Sep 17 00:00:00 2001 From: djstrong Date: Mon, 16 Jun 2025 12:57:21 +0200 Subject: [PATCH 07/11] lint --- .../src/app/gql/subgraph-compat/page.tsx | 69 ++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 661c57395..3544c81cc 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -13,7 +13,8 @@ const savedQueries = [ id: "1", name: "Get Latest Domains", category: "Domain", - description: "Retrieves the most recently created domains in descending order by creation time. Useful for monitoring new domain registrations and understanding recent activity on the ENS network.", + description: + "Retrieves the most recently created domains in descending order by creation time. Useful for monitoring new domain registrations and understanding recent activity on the ENS network.", query: `query GetLatestDomains($first: Int!) { domains(orderBy: createdAt, orderDirection: desc, first: $first) { name @@ -34,7 +35,8 @@ const savedQueries = [ id: "1a", name: "Get Domains with Pagination", category: "Domain", - description: "Fetches domains with pagination support, ordered by creation time in ascending order. Use this when you need to iterate through all domains systematically or implement pagination in your application.", + description: + "Fetches domains with pagination support, ordered by creation time in ascending order. Use this when you need to iterate through all domains systematically or implement pagination in your application.", query: `query GetDomainsWithPagination($first: Int!, $skip: Int) { domains(orderBy: createdAt, orderDirection: asc, first: $first, skip: $skip) { id @@ -58,7 +60,8 @@ const savedQueries = [ id: "2", name: "Get Domain by Namehash", category: "Domain", - description: "Retrieves a specific domain using its namehash (the unique identifier for ENS names). The namehash is the cryptographic hash of the domain name.", + description: + "Retrieves a specific domain using its namehash (the unique identifier for ENS names). The namehash is the cryptographic hash of the domain name.", query: `query GetDomainByNamehash($id: String!) { domain(id: $id) { name @@ -82,7 +85,8 @@ const savedQueries = [ id: "2a", name: "Get Domain by Name", category: "Domain", - description: "Looks up a domain by its human-readable name (e.g., 'ens.eth'). This is more user-friendly than using namehash but may be slightly less efficient for programmatic access.", + description: + "Looks up a domain by its human-readable name (e.g., 'ens.eth'). This is more user-friendly than using namehash but may be slightly less efficient for programmatic access.", query: `query GetDomainByName($name: String!) { domains(where: {name: $name}) { id @@ -107,7 +111,8 @@ const savedQueries = [ id: "2c", name: "Get Domains by the childmost-label substring", category: "Domain", - description: "Searches for domains containing a specific substring in their label (the leftmost part of the domain name). For example, searching for 'ens' would find 'ens.eth', 'myens.eth', etc. Useful for finding related domains or performing fuzzy searches.", + description: + "Searches for domains containing a specific substring in their label (the leftmost part of the domain name). For example, searching for 'ens' would find 'ens.eth', 'myens.eth', etc. Useful for finding related domains or performing fuzzy searches.", query: `query GetDomainsByLabel($label: String!) { domains(where: {labelName_contains: $label}) { id @@ -132,7 +137,8 @@ const savedQueries = [ id: "3", name: "Get Label by Labelhash", category: "Label", - description: "Reverse lookup to find the human-readable label from its labelhash. This is useful when you have a labelhash and need to determine what the actual text label is.", + description: + "Reverse lookup to find the human-readable label from its labelhash. This is useful when you have a labelhash and need to determine what the actual text label is.", query: `query getLabelByLabelhash($labelhash: String!) { domains(first: 1, where: { labelhash: $labelhash, labelName_not: null }) { labelName @@ -152,7 +158,8 @@ const savedQueries = [ id: "4", name: "Get Complete Name History", category: "Domain", - description: "Retrieves the complete historical timeline of events for a domain, including ownership transfers, resolver changes, registrations, renewals, and all resolver record updates. This provides an audit trail of activities related to the domain.", + description: + "Retrieves the complete historical timeline of events for a domain, including ownership transfers, resolver changes, registrations, renewals, and all resolver record updates. This provides an audit trail of activities related to the domain.", query: `query GetNameHistory($id: String!) { domain(id: $id) { name @@ -268,7 +275,8 @@ const savedQueries = [ id: "5", name: "Get Domain Events Only", category: "Domain", - description: "Retrieves only the domain-level events (transfers, ownership changes, wrapping events) without registration or resolver events. Use this when you're specifically interested in domain ownership and management events.", + description: + "Retrieves only the domain-level events (transfers, ownership changes, wrapping events) without registration or resolver events. Use this when you're specifically interested in domain ownership and management events.", //events(orderBy: blockNumber, orderDirection: desc) is not working query: `query GetDomainEvents($id: String!) { domain(id: $id) { @@ -317,7 +325,8 @@ const savedQueries = [ id: "6", name: "Get Resolver Events Only", category: "Resolver", - description: "Retrieves only the resolver-related events (address changes, text record updates, contenthash changes) for a domain. Useful when you're tracking how a domain's records have been updated over time.", + description: + "Retrieves only the resolver-related events (address changes, text record updates, contenthash changes) for a domain. Useful when you're tracking how a domain's records have been updated over time.", //events(orderBy: blockNumber, orderDirection: desc) is not working query: `query GetResolverEvents($id: String!) { domain(id: $id) { @@ -365,7 +374,8 @@ const savedQueries = [ id: "7", name: "Get Domains for Address (owner, registrant, wrappedOwner, or resolvedAddress)", category: "Account", - description: "Finds all domains associated with an Ethereum address in any capacity - as owner, registrant, wrapped owner, or as the resolved address. Excludes reverse records and expired domains. This is a comprehensive way to find domains connected to an address.", + description: + "Finds all domains associated with an Ethereum address in any capacity - as owner, registrant, wrapped owner, or as the resolved address. Excludes reverse records and expired domains. This is a comprehensive way to find domains connected to an address.", query: `query GetDomainsForAddress($owner: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { domains( where: { @@ -432,7 +442,8 @@ const savedQueries = [ id: "8", name: "Get Owned In Registry Domains Only", category: "Account", - description: "Retrieves domains where the specified address is the owner in the ENS registry (not registrant or wrapped owner). This shows domains where the address has direct control over the ENS records but may not be the original registrant.", + description: + "Retrieves domains where the specified address is the owner in the ENS registry (not registrant or wrapped owner). This shows domains where the address has direct control over the ENS records but may not be the original registrant.", query: `query getOwnedInRegistryDomains($owner: String!, $first: Int!, $date: BigInt!) { domains( where: { @@ -478,7 +489,8 @@ const savedQueries = [ id: "9", name: "Get Registered Domains Only", category: "Account", - description: "Retrieves domains where the specified address is the original registrant (the one who initially registered the .eth domain). This shows domains the address actually purchased and registered, not just ones they received or control.", + description: + "Retrieves domains where the specified address is the original registrant (the one who initially registered the .eth domain). This shows domains the address actually purchased and registered, not just ones they received or control.", query: `query GetRegisteredDomains($registrant: String!, $first: Int!, $date: BigInt!) { domains( where: { @@ -526,7 +538,8 @@ const savedQueries = [ id: "10", name: "Get Names Including Expired", category: "Account", - description: "Retrieves all domains associated with an address (as owner, registrant, or wrapped owner) including those that have expired. Useful for historical analysis or when you need to see the domain portfolio of an address.", + description: + "Retrieves all domains associated with an address (as owner, registrant, or wrapped owner) including those that have expired. Useful for historical analysis or when you need to see the domain portfolio of an address.", query: `query GetNamesIncludingExpired($owner: String!, $first: Int!) { domains( where: { @@ -577,7 +590,8 @@ const savedQueries = [ id: "11", name: "Get Registrant by Labelhash", // works with ENS only? category: "Registrar", - description: "Looks up registration information using a labelhash. This is primarily used for .eth domains and provides details about who registered the domain, when it was registered, when it expires, and what it cost. Note: This mainly works with .eth domains.", + description: + "Looks up registration information using a labelhash. This is primarily used for .eth domains and provides details about who registered the domain, when it was registered, when it expires, and what it cost. Note: This mainly works with .eth domains.", query: `query GetSubgraphRegistrant($id: String!) { registration(id: $id) { registrant { @@ -606,7 +620,8 @@ const savedQueries = [ id: "12", name: "Get Subdomains", category: "Domain", - description: "Retrieves all subdomains under a given parent domain, filtering out expired domains and empty records. This is useful for exploring the subdomain hierarchy and finding active subdomains under a particular domain.", + description: + "Retrieves all subdomains under a given parent domain, filtering out expired domains and empty records. This is useful for exploring the subdomain hierarchy and finding active subdomains under a particular domain.", query: `query GetSubnames($id: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { domain(id: $id) { name @@ -667,7 +682,8 @@ const savedQueries = [ id: "13", name: "Search Subdomains by Label", category: "Domain", - description: "Searches for subdomains under a parent domain that contain a specific text string in their label. This enables fuzzy searching within a domain's subdomain space, useful for finding related or similarly named subdomains.", + description: + "Searches for subdomains under a parent domain that contain a specific text string in their label. This enables fuzzy searching within a domain's subdomain space, useful for finding related or similarly named subdomains.", query: `query SearchSubnames($id: String!, $searchString: String!, $first: Int!, $date: BigInt!) { domain(id: $id) { name @@ -723,7 +739,8 @@ const savedQueries = [ id: "14", name: "Get Subdomains Including Expired", category: "Domain", - description: "Retrieves all subdomains under a parent domain, including those that have expired. This provides a complete historical view of all subdomains that have ever existed under the parent domain.", + description: + "Retrieves all subdomains under a parent domain, including those that have expired. This provides a complete historical view of all subdomains that have ever existed under the parent domain.", query: `query GetSubnamesIncludingExpired($id: String!, $first: Int!) { domain(id: $id) { name @@ -770,7 +787,8 @@ const savedQueries = [ id: "15", name: "Get Recently Created Subdomains", category: "Registrar", - description: "Retrieves the most recently created subdomains under a parent domain, ordered by creation time. This is useful for monitoring new subdomain activity and tracking the growth of a domain's subdomain ecosystem.", + description: + "Retrieves the most recently created subdomains under a parent domain, ordered by creation time. This is useful for monitoring new subdomain activity and tracking the growth of a domain's subdomain ecosystem.", query: `query GetRecentSubnames($id: String!, $first: Int!, $date: BigInt!) { domain(id: $id) { name @@ -827,7 +845,8 @@ const savedQueries = [ id: "16", name: "Get Domain Records (Inherited Resolver)", category: "Resolver", - description: "Retrieves a domain's resolver information including the types of records it supports (text records and coin types). This uses the domain's current resolver and shows what kind of records are available for the domain.", + description: + "Retrieves a domain's resolver information including the types of records it supports (text records and coin types). This uses the domain's current resolver and shows what kind of records are available for the domain.", query: `query GetSubgraphRecords($id: String!) { domain(id: $id) { name @@ -854,7 +873,8 @@ const savedQueries = [ id: "17", name: "Get Domain Records (Custom Resolver)", category: "Resolver", - description: "Retrieves domain information along with records from a specific resolver address.", + description: + "Retrieves domain information along with records from a specific resolver address.", query: `query GetSubgraphRecordsCustomResolver($id: String!, $resolverId: String!) { domain(id: $id) { name @@ -886,7 +906,8 @@ const savedQueries = [ id: "18", name: "Get Resolver Details by Address", category: "Resolver", - description: "Retrieves detailed information about a resolver by its contract address. This shows the domains using this resolver and what types of records it supports.", + description: + "Retrieves detailed information about a resolver by its contract address. This shows the domains using this resolver and what types of records it supports.", query: `query GetResolverDetails($resolverAddress: String!) { resolvers(where: { address: $resolverAddress }, first: 10) { id @@ -912,7 +933,8 @@ const savedQueries = [ id: "19", name: "Get Domain Text Records", category: "Resolver", - description: "Retrieves the current text record keys for a domain and all resolver events history. The 'texts' field shows currently set text record keys, while 'events' shows all resolver events including TextChanged, ContenthashChanged, AddrChanged, and MulticoinAddrChanged.", + description: + "Retrieves the current text record keys for a domain and all resolver events history. The 'texts' field shows currently set text record keys, while 'events' shows all resolver events including TextChanged, ContenthashChanged, AddrChanged, and MulticoinAddrChanged.", //events(where: { type_in: ["TextChanged"] }, first: 20) is not working query: `query GetDomainTextRecords($id: String!) { domain(id: $id) { @@ -945,7 +967,8 @@ const savedQueries = [ id: "20", name: "Get Historical Resolver Records Evolution", category: "Resolver", - description: "Provides a comprehensive view of how a domain's resolver records have evolved over time. This tracks resolver changes and the history of text records, address records, and contenthash changes across all resolvers the domain has used.", + description: + "Provides a comprehensive view of how a domain's resolver records have evolved over time. This tracks resolver changes and the history of text records, address records, and contenthash changes across all resolvers the domain has used.", query: `query GetHistoricalResolverRecords($ensName: String!) { domains(where: { name: $ensName }) { id From 11c4b71aa0e1c87e484f375560843f7daeda5835 Mon Sep 17 00:00:00 2001 From: djstrong Date: Mon, 16 Jun 2025 13:53:57 +0200 Subject: [PATCH 08/11] feat(subgraph-compat): update saved queries with new operations and improved naming conventions - Renamed existing operations for consistency and clarity, aligning with naming conventions. - Added several new GraphQL queries for enhanced functionality, including retrieving recent registrations, indexer metadata, and wrapped domain information. - Each new query includes detailed descriptions to improve understanding and usability. --- .../src/app/gql/subgraph-compat/page.tsx | 291 ++++++++++++++++-- 1 file changed, 270 insertions(+), 21 deletions(-) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 3544c81cc..96d70bee0 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -9,7 +9,7 @@ type PageProps = { const savedQueries = [ { - operationName: "getDomains", + operationName: "GetLatestDomains", id: "1", name: "Get Latest Domains", category: "Domain", @@ -31,7 +31,42 @@ const savedQueries = [ ), }, { - operationName: "getDomainsWithPagination", + operationName: "RecentRegistrationsQuery", + id: "21", + name: "Get Recent Registrations", + category: "Registrar", + description: + "Retrieves the most recent domain registrations ordered by registration date in descending order. Shows registration details including expiry dates and ownership information for newly registered domains.", + query: `query RecentRegistrationsQuery($first: Int!) { + registrations(first: $first, orderBy: registrationDate, orderDirection: desc) { + registrationDate + expiryDate + domain { + id + name + labelName + createdAt + expiryDate + owner { + id + } + wrappedOwner { + id + } + } + } +} + `, + variables: JSON.stringify( + { + first: 5, + }, + null, + 2, + ), + }, + { + operationName: "GetDomainsWithPagination", id: "1a", name: "Get Domains with Pagination", category: "Domain", @@ -56,7 +91,35 @@ const savedQueries = [ ), }, { - operationName: "getDomainByNamehash", + operationName: "allDomainsByCreationTime", + id: "22", + name: "Get All Domains with Pagination by Creation Time", + category: "Domain", + description: + "Retrieves domains in batches for pagination, ordered by creation time in ascending order. Excludes reverse records and null names. Use the lastCreatedAt parameter to paginate through all domains by passing the createdAt timestamp of the last domain from the previous batch.", + query: `query allDomainsByCreationTime($lastCreatedAt: String, $first: Int!) { + domains( + first: $first + where: { createdAt_gt: $lastCreatedAt, name_not_ends_with: ".addr.reverse", name_not: null } + orderBy: createdAt + orderDirection: asc + ) { + createdAt + name + } +} + `, + variables: JSON.stringify( + { + lastCreatedAt: "", + first: 10, + }, + null, + 2, + ), + }, + { + operationName: "GetDomainByNamehash", id: "2", name: "Get Domain by Namehash", category: "Domain", @@ -81,7 +144,7 @@ const savedQueries = [ ), }, { - operationName: "getDomainByName", + operationName: "GetDomainByName", id: "2a", name: "Get Domain by Name", category: "Domain", @@ -107,7 +170,7 @@ const savedQueries = [ ), }, { - operationName: "getDomainsByLabel", + operationName: "GetDomainsByLabel", id: "2c", name: "Get Domains by the childmost-label substring", category: "Domain", @@ -154,7 +217,7 @@ const savedQueries = [ ), }, { - operationName: "getNameHistory", + operationName: "GetNameHistory", id: "4", name: "Get Complete Name History", category: "Domain", @@ -271,7 +334,7 @@ const savedQueries = [ ), }, { - operationName: "getDomainEvents", + operationName: "GetDomainEvents", id: "5", name: "Get Domain Events Only", category: "Domain", @@ -321,7 +384,7 @@ const savedQueries = [ ), }, { - operationName: "getResolverEvents", + operationName: "GetResolverEvents", id: "6", name: "Get Resolver Events Only", category: "Resolver", @@ -370,7 +433,7 @@ const savedQueries = [ ), }, { - operationName: "getDomainsForAddress", + operationName: "GetDomainsForAddress", id: "7", name: "Get Domains for Address (owner, registrant, wrappedOwner, or resolvedAddress)", category: "Account", @@ -485,7 +548,7 @@ const savedQueries = [ ), }, { - operationName: "getRegisteredDomains", + operationName: "GetRegisteredDomains", id: "9", name: "Get Registered Domains Only", category: "Account", @@ -534,7 +597,7 @@ const savedQueries = [ ), }, { - operationName: "getNamesIncludingExpired", + operationName: "GetNamesIncludingExpired", id: "10", name: "Get Names Including Expired", category: "Account", @@ -586,7 +649,7 @@ const savedQueries = [ ), }, { - operationName: "getSubgraphRegistrant", + operationName: "GetSubgraphRegistrant", id: "11", name: "Get Registrant by Labelhash", // works with ENS only? category: "Registrar", @@ -616,7 +679,7 @@ const savedQueries = [ ), }, { - operationName: "getSubnames", + operationName: "GetSubnames", id: "12", name: "Get Subdomains", category: "Domain", @@ -678,7 +741,7 @@ const savedQueries = [ ), }, { - operationName: "searchSubnames", + operationName: "SearchSubnames", id: "13", name: "Search Subdomains by Label", category: "Domain", @@ -735,7 +798,7 @@ const savedQueries = [ ), }, { - operationName: "getSubnamesIncludingExpired", + operationName: "GetSubnamesIncludingExpired", id: "14", name: "Get Subdomains Including Expired", category: "Domain", @@ -783,7 +846,7 @@ const savedQueries = [ ), }, { - operationName: "getRecentSubnames", + operationName: "GetRecentSubnames", id: "15", name: "Get Recently Created Subdomains", category: "Registrar", @@ -841,7 +904,7 @@ const savedQueries = [ ), }, { - operationName: "getSubgraphRecords", + operationName: "GetSubgraphRecords", id: "16", name: "Get Domain Records (Inherited Resolver)", category: "Resolver", @@ -869,7 +932,7 @@ const savedQueries = [ ), }, { - operationName: "getSubgraphRecordsCustomResolver", + operationName: "GetSubgraphRecordsCustomResolver", id: "17", name: "Get Domain Records (Custom Resolver)", category: "Resolver", @@ -902,7 +965,7 @@ const savedQueries = [ ), }, { - operationName: "getResolverDetails", + operationName: "GetResolverDetails", id: "18", name: "Get Resolver Details by Address", category: "Resolver", @@ -929,7 +992,7 @@ const savedQueries = [ ), }, { - operationName: "getDomainTextRecords", + operationName: "GetDomainTextRecords", id: "19", name: "Get Domain Text Records", category: "Resolver", @@ -963,7 +1026,7 @@ const savedQueries = [ ), }, { - operationName: "getHistoricalResolverRecords", + operationName: "GetHistoricalResolverRecords", id: "20", name: "Get Historical Resolver Records Evolution", category: "Resolver", @@ -1009,6 +1072,192 @@ const savedQueries = [ 2, ), }, + { + operationName: "getIndexerMetadata", + id: "23", + name: "Get Indexer Metadata", + category: "Meta", + description: + "Retrieves metadata information about the indexer including indexing status and current block number. Use this to check if the indexer has indexing errors and to monitor synchronization with the blockchain.", + query: `query getIndexerMetadata { + _meta { + hasIndexingErrors + block { + number + } + } +} + `, + variables: JSON.stringify({}, null, 2), + }, + { + operationName: "getResolverExists", + id: "24", + name: "Check if Resolver Exists", + category: "Resolver", + description: + "Checks if a specific resolver exists by its ID. The resolver ID is constructed as 'resolverAddress-namehash' where resolverAddress is the contract address and namehash is the domain's namehash. Used to verify resolver existence before operations.", + query: `query getResolverExists($id: String!) { + resolver(id: $id) { + id + } +} + `, + variables: JSON.stringify( + { + id: "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41-0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // ENS: Public Resolver 2 + namehash("ens.eth") + }, + null, + 2, + ), + }, + { + operationName: "getNameDates", + id: "25", + name: "Get Registration Data by Labelhash", + category: "Registrar", + description: + "Retrieves registration information for a domain using its labelhash (hash of the label without the TLD). Returns the registration date and the most recent registration transaction ID. Primarily used for .eth domains.", + query: `query getNameDates($id: String!) { + registration(id: $id) { + registrationDate + } + nameRegistereds(first: 1, orderBy: blockNumber, orderDirection: desc, where: { registration: $id }) { + transactionID + } +} + `, + variables: JSON.stringify( + { + id: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // labelhash("ens") + }, + null, + 2, + ), + }, + { + operationName: "getDomainWithResolver", + id: "26", + name: "Get Domain with Resolver Address", + category: "Domain", + description: + "Retrieves domain information including resolver address and text records. Unlike other domain queries, this specifically includes the resolver's address field along with standard domain information.", + query: `query getDomainWithResolver($tokenId: String!) { + domain(id: $tokenId) { + id + labelhash + name + createdAt + parent { + id + } + resolver { + texts + address + } + } +} + `, + variables: JSON.stringify( + { + tokenId: "0x4e34d3a81dc3a20f71bbdf2160492ddaa17ee7e5523757d47153379c13cb46df", // namehash("ens.eth") + }, + null, + 2, + ), + }, + { + operationName: "getEthDomainByLabelhash", + id: "27", + name: "Get ETH Domain by Labelhash", + category: "Domain", + description: + "Retrieves .eth domains by their labelhash under the ETH parent domain. This is specifically for finding .eth domains using their labelhash identifier.", + query: `query getEthDomainByLabelhash($tokenId: String!) { + domains( + where: { + parent: "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae" + labelhash: $tokenId + } + ) { + id + labelhash + name + createdAt + parent { + id + } + resolver { + texts + address + } + } +} + `, + variables: JSON.stringify( + { + tokenId: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // labelhash("ens") + }, + null, + 2, + ), + }, + { + operationName: "getRegistrationByTokenId", //similar to getSubgraphRegistrant - remove? + id: "28", + name: "Get Registration by Token ID", + category: "Registrar", + description: + "Retrieves registration information by token ID (labelhash), including label name, registration date, and expiry date. Ordered by registration date in descending order.", + query: `query getRegistrationByTokenId($tokenId: String!) { + registrations( + orderBy: registrationDate + orderDirection: desc + where: { id: $tokenId } + ) { + labelName + registrationDate + expiryDate + } +} + `, + variables: JSON.stringify( + { + tokenId: "0x5cee339e13375638553bdf5a6e36ba80fb9f6a4f0783680884d92b558aa471da", // labelhash("ens") + }, + null, + 2, + ), + }, + { + operationName: "getWrappedDomain", + id: "29", + name: "Get Wrapped Domain", + category: "Domain", + description: + "Retrieves wrapped domain information including owner, fuses, expiry date, and domain name. Used for ENS domains that have been wrapped using the Name Wrapper contract.", + query: `query getWrappedDomain($tokenId: String!) { + wrappedDomain(id: $tokenId) { + id + owner { + id + } + fuses + expiryDate + domain { + name + } + } +} + `, + variables: JSON.stringify( + { + tokenId: "0x2c18815bc184e0d6d1d6817e9461e713acb6f3d6c1d2092babfbad56842a4085", // namehash("$$$.eth") + }, + null, + 2, + ), + }, ] satisfies Array; export default async function SubgraphGraphQLPage({ searchParams }: PageProps) { From 4ab2eaf20c2970d656b601b5f536c05688b54c4b Mon Sep 17 00:00:00 2001 From: djstrong Date: Mon, 16 Jun 2025 14:07:31 +0200 Subject: [PATCH 09/11] fix(subgraph-compat): update query parameters and improve naming for clarity --- apps/ensadmin/src/app/gql/subgraph-compat/page.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index 96d70bee0..af5e329c7 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -97,7 +97,7 @@ const savedQueries = [ category: "Domain", description: "Retrieves domains in batches for pagination, ordered by creation time in ascending order. Excludes reverse records and null names. Use the lastCreatedAt parameter to paginate through all domains by passing the createdAt timestamp of the last domain from the previous batch.", - query: `query allDomainsByCreationTime($lastCreatedAt: String, $first: Int!) { + query: `query allDomainsByCreationTime($lastCreatedAt: BigInt, $first: Int!) { domains( first: $first where: { createdAt_gt: $lastCreatedAt, name_not_ends_with: ".addr.reverse", name_not: null } @@ -111,7 +111,7 @@ const savedQueries = [ `, variables: JSON.stringify( { - lastCreatedAt: "", + lastCreatedAt: "1489206542", first: 10, }, null, @@ -1169,10 +1169,10 @@ const savedQueries = [ { operationName: "getEthDomainByLabelhash", id: "27", - name: "Get ETH Domain by Labelhash", + name: "Get .eth Domain by Labelhash", category: "Domain", description: - "Retrieves .eth domains by their labelhash under the ETH parent domain. This is specifically for finding .eth domains using their labelhash identifier.", + "Retrieves .eth domains by their labelhash under the .eth parent domain. This is specifically for finding .eth domains using their labelhash identifier.", query: `query getEthDomainByLabelhash($tokenId: String!) { domains( where: { From f4e7c2f44b6d4fae9cfe8dd6b7f81ff82c56c869 Mon Sep 17 00:00:00 2001 From: djstrong Date: Mon, 23 Jun 2025 13:52:17 +0200 Subject: [PATCH 10/11] feat(saved-queries): introduce SavedQueryCategory enum and update saved queries with structured categories - Added SavedQueryCategory enum to standardize query categories across the application. - Updated existing saved queries to utilize the new enum for improved clarity and consistency in categorization. - Enhanced descriptions for several queries to provide better context and usability. --- apps/ensadmin/src/app/gql/ponder/page.tsx | 3 + .../src/app/gql/subgraph-compat/page.tsx | 91 ++++++++++--------- .../plugins/saved-queries/index.ts | 1 + .../saved-queries/saved-queries-plugin.tsx | 13 ++- 4 files changed, 61 insertions(+), 47 deletions(-) diff --git a/apps/ensadmin/src/app/gql/ponder/page.tsx b/apps/ensadmin/src/app/gql/ponder/page.tsx index ac86950fd..e87910847 100644 --- a/apps/ensadmin/src/app/gql/ponder/page.tsx +++ b/apps/ensadmin/src/app/gql/ponder/page.tsx @@ -1,4 +1,5 @@ import { PonderGraphiQLEditor, type SavedQuery } from "@/components/graphiql-editor"; +import { SavedQueryCategory } from "@/components/graphiql-editor/plugins/saved-queries"; import { defaultEnsNodeUrl } from "@/lib/env"; type PageProps = { @@ -12,6 +13,8 @@ const savedQueries = [ operationName: "getLatestDomains", id: "1", name: "Get Latest Domains", + category: SavedQueryCategory.DOMAIN, + description: "Get the latest domains", query: `query GetLatestDomains($limit: Int!) { domains(orderBy: "createdAt", orderDirection: "desc", limit: $limit) { items { diff --git a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx index af5e329c7..fc2d7d41b 100644 --- a/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx +++ b/apps/ensadmin/src/app/gql/subgraph-compat/page.tsx @@ -1,4 +1,5 @@ import { type SavedQuery, SubgraphGraphiQLEditor } from "@/components/graphiql-editor"; +import { SavedQueryCategory } from "@/components/graphiql-editor/plugins/saved-queries"; import { defaultEnsNodeUrl } from "@/lib/env"; type PageProps = { @@ -12,9 +13,9 @@ const savedQueries = [ operationName: "GetLatestDomains", id: "1", name: "Get Latest Domains", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: - "Retrieves the most recently created domains in descending order by creation time. Useful for monitoring new domain registrations and understanding recent activity on the ENS network.", + "Retrieves the most recently created domains in descending order by creation time.", query: `query GetLatestDomains($first: Int!) { domains(orderBy: createdAt, orderDirection: desc, first: $first) { name @@ -31,13 +32,13 @@ const savedQueries = [ ), }, { - operationName: "RecentRegistrationsQuery", + operationName: "LatestRegistrations", id: "21", - name: "Get Recent Registrations", - category: "Registrar", + name: "Get Latest Registrations", + category: SavedQueryCategory.REGISTRAR, description: "Retrieves the most recent domain registrations ordered by registration date in descending order. Shows registration details including expiry dates and ownership information for newly registered domains.", - query: `query RecentRegistrationsQuery($first: Int!) { + query: `query LatestRegistrations($first: Int!) { registrations(first: $first, orderBy: registrationDate, orderDirection: desc) { registrationDate expiryDate @@ -69,7 +70,7 @@ const savedQueries = [ operationName: "GetDomainsWithPagination", id: "1a", name: "Get Domains with Pagination", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Fetches domains with pagination support, ordered by creation time in ascending order. Use this when you need to iterate through all domains systematically or implement pagination in your application.", query: `query GetDomainsWithPagination($first: Int!, $skip: Int) { @@ -94,7 +95,7 @@ const savedQueries = [ operationName: "allDomainsByCreationTime", id: "22", name: "Get All Domains with Pagination by Creation Time", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves domains in batches for pagination, ordered by creation time in ascending order. Excludes reverse records and null names. Use the lastCreatedAt parameter to paginate through all domains by passing the createdAt timestamp of the last domain from the previous batch.", query: `query allDomainsByCreationTime($lastCreatedAt: BigInt, $first: Int!) { @@ -122,7 +123,7 @@ const savedQueries = [ operationName: "GetDomainByNamehash", id: "2", name: "Get Domain by Namehash", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves a specific domain using its namehash (the unique identifier for ENS names). The namehash is the cryptographic hash of the domain name.", query: `query GetDomainByNamehash($id: String!) { @@ -147,9 +148,9 @@ const savedQueries = [ operationName: "GetDomainByName", id: "2a", name: "Get Domain by Name", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: - "Looks up a domain by its human-readable name (e.g., 'ens.eth'). This is more user-friendly than using namehash but may be slightly less efficient for programmatic access.", + "Looks up a domain by its human-readable name (e.g., 'ens.eth'). This is user-friendly for ad-hoc queries, but not recommended for programmatic access because names are not stable identifiers. Use the 'Get Domain by Namehash' query for reliable lookups.", query: `query GetDomainByName($name: String!) { domains(where: {name: $name}) { id @@ -170,13 +171,13 @@ const savedQueries = [ ), }, { - operationName: "GetDomainsByLabel", + operationName: "GetDomainsByChildmostLabel", id: "2c", name: "Get Domains by the childmost-label substring", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Searches for domains containing a specific substring in their label (the leftmost part of the domain name). For example, searching for 'ens' would find 'ens.eth', 'myens.eth', etc. Useful for finding related domains or performing fuzzy searches.", - query: `query GetDomainsByLabel($label: String!) { + query: `query GetDomainsByChildmostLabel($label: String!) { domains(where: {labelName_contains: $label}) { id name @@ -199,7 +200,7 @@ const savedQueries = [ operationName: "getLabelByLabelhash", id: "3", name: "Get Label by Labelhash", - category: "Label", + category: SavedQueryCategory.LABEL, description: "Reverse lookup to find the human-readable label from its labelhash. This is useful when you have a labelhash and need to determine what the actual text label is.", query: `query getLabelByLabelhash($labelhash: String!) { @@ -217,13 +218,13 @@ const savedQueries = [ ), }, { - operationName: "GetNameHistory", + operationName: "GetDomainHistory", id: "4", - name: "Get Complete Name History", - category: "Domain", + name: "Get Complete Domain History", + category: SavedQueryCategory.DOMAIN, description: "Retrieves the complete historical timeline of events for a domain, including ownership transfers, resolver changes, registrations, renewals, and all resolver record updates. This provides an audit trail of activities related to the domain.", - query: `query GetNameHistory($id: String!) { + query: `query GetDomainHistory($id: String!) { domain(id: $id) { name events { @@ -337,7 +338,7 @@ const savedQueries = [ operationName: "GetDomainEvents", id: "5", name: "Get Domain Events Only", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves only the domain-level events (transfers, ownership changes, wrapping events) without registration or resolver events. Use this when you're specifically interested in domain ownership and management events.", //events(orderBy: blockNumber, orderDirection: desc) is not working @@ -387,7 +388,7 @@ const savedQueries = [ operationName: "GetResolverEvents", id: "6", name: "Get Resolver Events Only", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Retrieves only the resolver-related events (address changes, text record updates, contenthash changes) for a domain. Useful when you're tracking how a domain's records have been updated over time.", //events(orderBy: blockNumber, orderDirection: desc) is not working @@ -436,7 +437,7 @@ const savedQueries = [ operationName: "GetDomainsForAddress", id: "7", name: "Get Domains for Address (owner, registrant, wrappedOwner, or resolvedAddress)", - category: "Account", + category: SavedQueryCategory.ACCOUNT, description: "Finds all domains associated with an Ethereum address in any capacity - as owner, registrant, wrapped owner, or as the resolved address. Excludes reverse records and expired domains. This is a comprehensive way to find domains connected to an address.", query: `query GetDomainsForAddress($owner: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { @@ -504,7 +505,7 @@ const savedQueries = [ operationName: "getOwnedInRegistryDomains", id: "8", name: "Get Owned In Registry Domains Only", - category: "Account", + category: SavedQueryCategory.ACCOUNT, description: "Retrieves domains where the specified address is the owner in the ENS registry (not registrant or wrapped owner). This shows domains where the address has direct control over the ENS records but may not be the original registrant.", query: `query getOwnedInRegistryDomains($owner: String!, $first: Int!, $date: BigInt!) { @@ -551,7 +552,7 @@ const savedQueries = [ operationName: "GetRegisteredDomains", id: "9", name: "Get Registered Domains Only", - category: "Account", + category: SavedQueryCategory.ACCOUNT, description: "Retrieves domains where the specified address is the original registrant (the one who initially registered the .eth domain). This shows domains the address actually purchased and registered, not just ones they received or control.", query: `query GetRegisteredDomains($registrant: String!, $first: Int!, $date: BigInt!) { @@ -600,7 +601,7 @@ const savedQueries = [ operationName: "GetNamesIncludingExpired", id: "10", name: "Get Names Including Expired", - category: "Account", + category: SavedQueryCategory.ACCOUNT, description: "Retrieves all domains associated with an address (as owner, registrant, or wrapped owner) including those that have expired. Useful for historical analysis or when you need to see the domain portfolio of an address.", query: `query GetNamesIncludingExpired($owner: String!, $first: Int!) { @@ -652,7 +653,7 @@ const savedQueries = [ operationName: "GetSubgraphRegistrant", id: "11", name: "Get Registrant by Labelhash", // works with ENS only? - category: "Registrar", + category: SavedQueryCategory.REGISTRAR, description: "Looks up registration information using a labelhash. This is primarily used for .eth domains and provides details about who registered the domain, when it was registered, when it expires, and what it cost. Note: This mainly works with .eth domains.", query: `query GetSubgraphRegistrant($id: String!) { @@ -682,7 +683,7 @@ const savedQueries = [ operationName: "GetSubnames", id: "12", name: "Get Subdomains", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves all subdomains under a given parent domain, filtering out expired domains and empty records. This is useful for exploring the subdomain hierarchy and finding active subdomains under a particular domain.", query: `query GetSubnames($id: String!, $first: Int!, $orderBy: Domain_orderBy!, $orderDirection: OrderDirection!, $date: BigInt!) { @@ -744,7 +745,7 @@ const savedQueries = [ operationName: "SearchSubnames", id: "13", name: "Search Subdomains by Label", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Searches for subdomains under a parent domain that contain a specific text string in their label. This enables fuzzy searching within a domain's subdomain space, useful for finding related or similarly named subdomains.", query: `query SearchSubnames($id: String!, $searchString: String!, $first: Int!, $date: BigInt!) { @@ -801,7 +802,7 @@ const savedQueries = [ operationName: "GetSubnamesIncludingExpired", id: "14", name: "Get Subdomains Including Expired", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves all subdomains under a parent domain, including those that have expired. This provides a complete historical view of all subdomains that have ever existed under the parent domain.", query: `query GetSubnamesIncludingExpired($id: String!, $first: Int!) { @@ -846,13 +847,13 @@ const savedQueries = [ ), }, { - operationName: "GetRecentSubnames", + operationName: "GetLatestSubnames", id: "15", - name: "Get Recently Created Subdomains", - category: "Registrar", + name: "Get Latest Subdomains", + category: SavedQueryCategory.REGISTRAR, description: "Retrieves the most recently created subdomains under a parent domain, ordered by creation time. This is useful for monitoring new subdomain activity and tracking the growth of a domain's subdomain ecosystem.", - query: `query GetRecentSubnames($id: String!, $first: Int!, $date: BigInt!) { + query: `query GetLatestSubnames($id: String!, $first: Int!, $date: BigInt!) { domain(id: $id) { name subdomains( @@ -907,7 +908,7 @@ const savedQueries = [ operationName: "GetSubgraphRecords", id: "16", name: "Get Domain Records (Inherited Resolver)", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Retrieves a domain's resolver information including the types of records it supports (text records and coin types). This uses the domain's current resolver and shows what kind of records are available for the domain.", query: `query GetSubgraphRecords($id: String!) { @@ -935,7 +936,7 @@ const savedQueries = [ operationName: "GetSubgraphRecordsCustomResolver", id: "17", name: "Get Domain Records (Custom Resolver)", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Retrieves domain information along with records from a specific resolver address.", query: `query GetSubgraphRecordsCustomResolver($id: String!, $resolverId: String!) { @@ -968,7 +969,7 @@ const savedQueries = [ operationName: "GetResolverDetails", id: "18", name: "Get Resolver Details by Address", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Retrieves detailed information about a resolver by its contract address. This shows the domains using this resolver and what types of records it supports.", query: `query GetResolverDetails($resolverAddress: String!) { @@ -995,7 +996,7 @@ const savedQueries = [ operationName: "GetDomainTextRecords", id: "19", name: "Get Domain Text Records", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Retrieves the current text record keys for a domain and all resolver events history. The 'texts' field shows currently set text record keys, while 'events' shows all resolver events including TextChanged, ContenthashChanged, AddrChanged, and MulticoinAddrChanged.", //events(where: { type_in: ["TextChanged"] }, first: 20) is not working @@ -1029,7 +1030,7 @@ const savedQueries = [ operationName: "GetHistoricalResolverRecords", id: "20", name: "Get Historical Resolver Records Evolution", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Provides a comprehensive view of how a domain's resolver records have evolved over time. This tracks resolver changes and the history of text records, address records, and contenthash changes across all resolvers the domain has used.", query: `query GetHistoricalResolverRecords($ensName: String!) { @@ -1076,7 +1077,7 @@ const savedQueries = [ operationName: "getIndexerMetadata", id: "23", name: "Get Indexer Metadata", - category: "Meta", + category: SavedQueryCategory.META, description: "Retrieves metadata information about the indexer including indexing status and current block number. Use this to check if the indexer has indexing errors and to monitor synchronization with the blockchain.", query: `query getIndexerMetadata { @@ -1094,7 +1095,7 @@ const savedQueries = [ operationName: "getResolverExists", id: "24", name: "Check if Resolver Exists", - category: "Resolver", + category: SavedQueryCategory.RESOLVER, description: "Checks if a specific resolver exists by its ID. The resolver ID is constructed as 'resolverAddress-namehash' where resolverAddress is the contract address and namehash is the domain's namehash. Used to verify resolver existence before operations.", query: `query getResolverExists($id: String!) { @@ -1115,7 +1116,7 @@ const savedQueries = [ operationName: "getNameDates", id: "25", name: "Get Registration Data by Labelhash", - category: "Registrar", + category: SavedQueryCategory.REGISTRAR, description: "Retrieves registration information for a domain using its labelhash (hash of the label without the TLD). Returns the registration date and the most recent registration transaction ID. Primarily used for .eth domains.", query: `query getNameDates($id: String!) { @@ -1139,7 +1140,7 @@ const savedQueries = [ operationName: "getDomainWithResolver", id: "26", name: "Get Domain with Resolver Address", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves domain information including resolver address and text records. Unlike other domain queries, this specifically includes the resolver's address field along with standard domain information.", query: `query getDomainWithResolver($tokenId: String!) { @@ -1170,7 +1171,7 @@ const savedQueries = [ operationName: "getEthDomainByLabelhash", id: "27", name: "Get .eth Domain by Labelhash", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves .eth domains by their labelhash under the .eth parent domain. This is specifically for finding .eth domains using their labelhash identifier.", query: `query getEthDomainByLabelhash($tokenId: String!) { @@ -1206,7 +1207,7 @@ const savedQueries = [ operationName: "getRegistrationByTokenId", //similar to getSubgraphRegistrant - remove? id: "28", name: "Get Registration by Token ID", - category: "Registrar", + category: SavedQueryCategory.REGISTRAR, description: "Retrieves registration information by token ID (labelhash), including label name, registration date, and expiry date. Ordered by registration date in descending order.", query: `query getRegistrationByTokenId($tokenId: String!) { @@ -1233,7 +1234,7 @@ const savedQueries = [ operationName: "getWrappedDomain", id: "29", name: "Get Wrapped Domain", - category: "Domain", + category: SavedQueryCategory.DOMAIN, description: "Retrieves wrapped domain information including owner, fuses, expiry date, and domain name. Used for ENS domains that have been wrapped using the Name Wrapper contract.", query: `query getWrappedDomain($tokenId: String!) { diff --git a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/index.ts b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/index.ts index 9c5f770f3..ace97a88a 100644 --- a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/index.ts +++ b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/index.ts @@ -2,4 +2,5 @@ export { savedQueriesPlugin, type SavedQuery, type SavedQueriesPluginProps, + SavedQueryCategory, } from "./saved-queries-plugin"; diff --git a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx index fa3eb578a..a654fbdcc 100644 --- a/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx +++ b/apps/ensadmin/src/components/graphiql-editor/plugins/saved-queries/saved-queries-plugin.tsx @@ -6,11 +6,20 @@ import React from "react"; import "./saved-queries-plugin.css"; +export enum SavedQueryCategory { + DOMAIN = "Domain", + REGISTRAR = "Registrar", + LABEL = "Label", + RESOLVER = "Resolver", + ACCOUNT = "Account", + META = "Meta", +} + export interface SavedQuery { id: string; name: string; - category?: string; - description?: string; + category: SavedQueryCategory; + description: string; /** * The GraphQL query. From d7b96086a98ccc5a3bc0f33195904cc1b8eb0678 Mon Sep 17 00:00:00 2001 From: "kwrobel.eth" Date: Mon, 23 Jun 2025 13:59:57 +0200 Subject: [PATCH 11/11] Create shy-glasses-sip.md --- .changeset/shy-glasses-sip.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shy-glasses-sip.md diff --git a/.changeset/shy-glasses-sip.md b/.changeset/shy-glasses-sip.md new file mode 100644 index 000000000..8f4d981c1 --- /dev/null +++ b/.changeset/shy-glasses-sip.md @@ -0,0 +1,5 @@ +--- +"ensadmin": minor +--- + +add new saved GraphQL queries in ENSAdmin