Skip to content

Commit

Permalink
Merge branch 'add-ens-query'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed May 24, 2024
2 parents ae49836 + 01e5169 commit e5022eb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 4 deletions.
22 changes: 22 additions & 0 deletions daostar-website/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,25 @@ function App() {
data: EASOptimismData,
} = EASOptimismRes;
console.log(EASOptimismData)


const ENSQueryRes = useQuery(queries.ENS_QUERY, {
context: { apiName: "ensTextRecords" },
variables: {
"where": {
"value_not": null,
"key_starts_with_nocase": "daouri",
"key_ends_with_nocase": "daouri"
},
"first": 5
},
});
const {
loading: ENSQueryResLoading,
error: ENSQueryResError,
data: ENSQueryResData,
} = ENSQueryRes;
console.log(ENSQueryResData)
if (
error ||
goerliError ||
Expand Down Expand Up @@ -328,6 +347,8 @@ function App() {
const EASOptimismAttestations =
EASOptimismData?.attestations || [];

const ENSTextRecords =
ENSQueryResData?.textChangeds || [];
// This object clones and modifies the mainnetV0 registration instances to change the network ID to "ethereum"
// So that when we click on an old registration instance card we are able to view and edit its proprties
// this allows to query mainnetV0 subgraph link
Expand Down Expand Up @@ -400,6 +421,7 @@ function App() {
osmosisInstances={osmosisInstances}
stargazeInstances={stargazeInstances}
easAttestations={EASAttestations}
ENSTextRecords={ENSTextRecords}
/>
}
/>
Expand Down
39 changes: 39 additions & 0 deletions daostar-website/src/components/ENSCard/ENSCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Fragment } from 'react';
import { Card, Divider } from '@blueprintjs/core';
import '../AttestationCard/AttestationCard.css';

const DisplayENSTextRecord = ({
id,
key,
value,
resolver
}) => {
const daoName = resolver?.domain?.name ?? "Unknown DAO";
const daoAddress = resolver?.domain?.resolvedAddress?.id ?? "Unknown DAO";
const daoURI = value ? value : "https://daostar.org/registration";

return (
<Card className='wizard-card attestation-card'>
<Fragment>
<h3>{daoName}</h3>
<Divider />
<div className="card-metadata">
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">ENS ID: </span>
{id}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">DAO Address: </span>
{daoAddress}
</p>
<p className="bp4-text-small wizard-no-margin">
<span className="bp4-text-muted">DAO URI: </span>
{daoURI}
</p>
</div>
</Fragment>
</Card>
);
};

export default DisplayENSTextRecord;
10 changes: 9 additions & 1 deletion daostar-website/src/components/ExplorePage/ExplorePage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from "react";
import RegistrationCard from "../RegistrationCard/RegistrationCard";
import AttestationCard from "../AttestationCard/AttestationCard";
import ENSCard from "../ENSCard/ENSCard";
import "./ExplorePage.css";
import { InputGroup, Button } from "@blueprintjs/core";
import { filterEASbyId } from "../FilterRegistrations/Filter_Registrations_By_Id";
Expand Down Expand Up @@ -61,6 +62,7 @@ const NetworkButtons = [
{ text: "Osmosis", filter: "osmosis" },
{ text: "Stargaze", filter: "stargaze" },
{ text: "EAS", filter: "easAttestations" },
{ text: "ENS", filter: "ensTextRecords"}

];
NetworkButtons.sort((a, b) => a.text.localeCompare(b.text));
Expand All @@ -70,7 +72,8 @@ const ExplorePage = ({
junosInstances,
osmosisInstances,
stargazeInstances,
easAttestations
easAttestations,
ENSTextRecords
}) => {
const [filterVal, setFilterVal] = useState("");
const onChangeFilter = (e) => setFilterVal(e.target.value);
Expand Down Expand Up @@ -156,6 +159,11 @@ const ExplorePage = ({
.map((attestation, i) => (
<AttestationCard key={i} {...attestation} />
));
case "ensTextRecords":
return ENSTextRecords
.map((textRecord, i) => (
<ENSCard key={i} {...textRecord} />
));
default:
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,24 @@ const ATTESTATIONS_BY_SCHEMA = gql`
}
`;

export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA }



const ENS_QUERY = gql `
query TextChangeds($where: TextChanged_filter, $first: Int) @api(contextKey: "apiName"){
textChangeds(where: $where, first: $first) {
id
key
value
resolver {
domain {
name
resolvedAddress {
id
}
}
}
}
}
`;
export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA, ENS_QUERY }
4 changes: 2 additions & 2 deletions daostar-website/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const client = new ApolloClient({
ethereum: "https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0",
arbitrum: "https://api.thegraph.com/subgraphs/name/crazyyuan/daostar-arbitrum",
easOptimismSepolia:"https://optimism-sepolia.easscan.org/graphql",
easOptimism:"https://optimism.easscan.org/graphql"

easOptimism:"https://optimism.easscan.org/graphql",
ensTextRecords: "https://api.thegraph.com/subgraphs/name/ensdomains/ens"
},
//defaultEndpoint: 'https://api.thegraph.com/subgraphs/name/ipatka/daostar',
httpSuffix: "",
Expand Down

0 comments on commit e5022eb

Please sign in to comment.