This Subgraph sources events from the HNS.ID contracts, including the registration managers and any resolvers linked to domains. The resolvers are added through dynamic data sources.
For more information on the underlying technology, consult The Graph Documentation.
Subgraph end-point can be found here https://thegraph.com/hosted-service/subgraph/namebasehq/hns-id
- Example Query
- Installing and Running Graph Node Locally with Docker
- Clearing Postgres Data
- Deploying Subgraphs
- Deployment to Hosted Service
{
tlds {
id
claimant {
id
}
owner {
id
tlds {
id
}
slds {
id
}
}
tokenId
label
registrationBlockNumber
registrationBlockTimestamp
lastUpdateBlockNumber
lastUpdateTimestamp
transferCount
saleSettings {
id
enabled
prices
discounts
blockNumber
blockTimestamp
premiumPrices {
id
label
price
}
reservedNames {
id
label
claimant
}
}
slds {
id
label
fullName
owner {
id
}
registrant {
id
}
registrationBlockNumber
registrationTimestamp
lastUpdateBlockNumber
lastUpdateTimestamp
expirationTimestamp
delegate {
id
}
resolver {
id
addresses {
id
address
cointype
}
textRecords {
id
key
value
}
dnsRecords {
id
node
name
resource
record
}
dnsZonehash
version
}
renewalCount
renewals {
id
expirationTimestamp
owner {
id
}
renewer {
id
}
blockNumber
blockTimestamp
transactionHash
}
transferCount
transfers {
id
oldOwner {
id
}
newOwner {
id
}
blockNumber
blockTimestamp
transactionHash
}
}
royalty {
id
percentage
payoutAddress {
id
}
}
royaltyHistory {
id
percentage
payoutAddress {
id
}
blockNumber
blockTimestamp
transactionHash
}
delegate {
id
}
resolver {
id
addresses {
id
address
cointype
}
textRecords {
id
key
value
}
dnsRecords {
id
node
name
resource
record
}
dnsZonehash
version
}
transfers {
id
oldOwner {
id
}
newOwner {
id
}
blockNumber
blockTimestamp
transactionHash
}
}
}
- Make sure you have Docker and Docker Compose installed on your system.
-
Clone the Graph Node repository:
git clone https://github.com/graphprotocol/graph-node/
-
Navigate to the Docker folder:
cd graph-node/docker
-
Edit the
docker-compose.yml
file:Locate the
ethereum
line under thegraph-node
service and set it to either:"mainnet:http://host.docker.internal:8545"
for a local Ethereum node"mainnet:https://mainnet.infura.io/v3/YOUR_INFURA_ACCESS_TOKEN"
for a remote Ethereum node via Infura
Here's how it should look for a local node:
ethereum: "mainnet:http://host.docker.internal:8545"
Or for a remote Infura node:
ethereum: "mainnet:https://mainnet.infura.io/v3/YOUR_INFURA_ACCESS_TOKEN"
-
Start Docker containers:
docker-compose up
If you need to clear the Postgres data, you can delete the data
folder under graph-node/docker
:
rm -rf ./data
Then, restart the Docker containers
docker-compose down
docker-compose up
Before deploying, you'll need to create a subgraph on the Graph Explorer
graph create --node http://localhost:8020/ hns-id
If your schema has not changed, you can build and deploy your subgraph using
graph build
graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001/ hns-id
If your schema has changed, you'll need to restart the Graph Node
docker-compose down
docker-compose up
Then build and deploy as mentioned above
To clear the graph and start fresh, you can delete the Postgres data folder
rm -rf ./data
# Then restart the Docker containers
```bash
docker-compose down
docker-compose up
This section provides instructions for deploying your subgraph to a hosted service. It assumes that you have already created and tested the subgraph locally.
-
Authentication:
graph auth --product hosted-service YOUR_ACCESS_TOKEN
-
Deploy:
graph deploy --product hosted-service YOUR_SUBGRAPH_NAME
This will deploy your subgraph to the hosted service where it will be publicly queryable.
# deploying subgraph
graph auth --studio API_KEY
graph codegen && graph build
graph deploy --studio hns-id
# deploying hosted service
graph auth --product hosted-service API_KEY
graph codegen && graph build
graph deploy --product hosted-service namebasehq/hns-id