From 2cf098ffb3ac2d72a4cc714f11217b82e623ea60 Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Wed, 31 Jan 2024 03:11:20 +0530 Subject: [PATCH 1/6] fetch and partially structure Aragon DAOs --- daostar-website/src/App.js | 39 ++++++++++++++++++- .../ExplorePage/queries/registrations.js | 12 +++++- daostar-website/src/index.js | 2 +- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index 5383ef8..194c410 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -102,6 +102,35 @@ function restructureDAOData(daoInstances, networkId) { ]; } +function restructureAragonDAOData(daoInstances, network) { + return [ + { + registrationNetwork: { + __typename: "RegistrationNetwork", + id: network, + registrations: daoInstances?.map((item) => ({ + __typename: "RegistrationInstance", + id: item.name, + daoName: item.name, + daoAddress: item.name, + daoDescription: item.description, + daoURI: `https://aragon-dao-uri.onrender.com//aragon_dao/${network}/${item.id}`, + governanceURI: item.governanceURI, + issuersURI: item.issuersURI, + managerAddress: '', + membersURI: item.membersURI, + proposalsURI: item.proposalsURI, + registrationAddress: '', + registrationNetwork: { + __typename: "RegistrationNetwork", + id: network, + }, + })), + }, + }, + ]; +} + function App() { //DAODAOINT START @@ -122,6 +151,7 @@ function App() { const [daodaoInstances, setDaoDaoInstances] = useState([]); const [osmosisInstances, setOsmosisInstances] = useState([]); const [stargazeInstances, setStargazeInstances] = useState([]); + const [aragonBaseDAOs, setAragonBaseDAOs] = useState([]) useEffect(() => { const fetchDAOs = async () => { @@ -138,6 +168,12 @@ function App() { "Stargaze" ); + const aragonBaseResponse = await axios.get("https://aragon-dao-uri.onrender.com/fetch_aragon_daos/base"); + const aragonBaseData = aragonBaseResponse.data; + const aragonBD = restructureAragonDAOData(aragonBaseData, "Base") + setAragonBaseDAOs(aragonBD) + + setDaoDaoInstances(daodaoData); setOsmosisInstances(osmosisData); setStargazeInstances(stargazeData); @@ -346,7 +382,8 @@ function App() { optimismGoerliData, arbitrumGoerliData, chapelData, - arbitrumData + arbitrumData, + aragonBaseDAOs }); return ( diff --git a/daostar-website/src/components/ExplorePage/queries/registrations.js b/daostar-website/src/components/ExplorePage/queries/registrations.js index 522e859..d63c086 100644 --- a/daostar-website/src/components/ExplorePage/queries/registrations.js +++ b/daostar-website/src/components/ExplorePage/queries/registrations.js @@ -101,4 +101,14 @@ const ATTESTATIONS_BY_SCHEMA = gql` } `; -export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA } +const GET_ARAGON_DAOS = gql` + query GetDaos($network: String!) { + daos @rest(type: "Dao", path: "fetch_aragon_daos/{args.network}") { + id + daoURI + metadata + } + } +`; + +export default { REGISTRATIONS, REGISTRATION, REGISTRATIONSOLD, ATTESTATIONS_BY_SCHEMA, GET_ARAGON_DAOS } diff --git a/daostar-website/src/index.js b/daostar-website/src/index.js index 2ae4275..ecd537f 100644 --- a/daostar-website/src/index.js +++ b/daostar-website/src/index.js @@ -38,7 +38,7 @@ const client = new ApolloClient({ optimism: `https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-optimism`, ethereum: "https://api.thegraph.com/subgraphs/name/rashmi-278/daostar-ethereum-mainnet-v0", arbitrum: "https://api.thegraph.com/subgraphs/name/crazyyuan/daostar-arbitrum", - easOptimismGoerli:"https://optimism-goerli-bedrock.easscan.org/graphql" + easOptimismGoerli:"https://optimism-goerli-bedrock.easscan.org/graphql", }, //defaultEndpoint: 'https://api.thegraph.com/subgraphs/name/ipatka/daostar', httpSuffix: "", From 8ec44f904490ddc39ddfb0c6ee526203ea13a379 Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Tue, 6 Feb 2024 18:40:49 +0530 Subject: [PATCH 2/6] aragon DAOs display working, POC for Base Network --- daostar-website/src/App.js | 1 + .../src/components/ExplorePage/ExplorePage.js | 70 +++---------------- 2 files changed, 12 insertions(+), 59 deletions(-) diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index 194c410..ade741d 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -418,6 +418,7 @@ function App() { osmosisInstances={osmosisInstances} stargazeInstances={stargazeInstances} easOptimismGoerli={EASOptimismGoerliAttestations} + aragonDAOs={aragonBaseDAOs} /> } /> diff --git a/daostar-website/src/components/ExplorePage/ExplorePage.js b/daostar-website/src/components/ExplorePage/ExplorePage.js index 24360cc..31cc136 100644 --- a/daostar-website/src/components/ExplorePage/ExplorePage.js +++ b/daostar-website/src/components/ExplorePage/ExplorePage.js @@ -45,6 +45,7 @@ const NetworkButtons = [ { text: "Osmosis", filter: "osmosis" }, { text: "Stargaze", filter: "stargaze" }, { text: "EAS OPGoerli", filter: "easOptimismGoerli" }, + { text: "Aragon DAOs on Base", filter: "aragonBaseDAOS"} ]; NetworkButtons.sort((a, b) => a.text.localeCompare(b.text)); @@ -54,13 +55,15 @@ const ExplorePage = ({ junosInstances, osmosisInstances, stargazeInstances, - easOptimismGoerli + easOptimismGoerli, + aragonDAOs }) => { const [filterVal, setFilterVal] = useState(""); const onChangeFilter = (e) => setFilterVal(e.target.value); const [networkFilter, setNetworkFilter] = useState("all"); - // Network Filter for Juno, Stargaze and Osmosis + + // Network Filter for Juno, Stargaze and Osmosis and const filteredRegistrations = (instances) => { return instances .flatMap((network) => @@ -139,16 +142,18 @@ const ExplorePage = ({ .map((attestation, i) => ( )); + case "aragonBaseDAOS": + return filteredRegistrations(aragonDAOs); default: return ( <>
{daoCards}


-
{daodaoCards}
+
{filteredRegistrations(junosInstances)}


-
{osmosisDaoCards}
+
{filteredRegistrations(osmosisInstances)}


-
{stargazeDaoCards}
+
{filteredRegistrations(stargazeInstances)}
); } @@ -161,60 +166,7 @@ const ExplorePage = ({ return ; }); - // Handle Juno DAOs - const daodaoCards = junosInstances - .flatMap((network) => - network.registrationNetwork.registrations.filter((reg) => - filterRegistrations(reg, filterVal) - ) - ) - .map((registration, i) => { - return ( - - ); - }); - - // Handle Stargaze DAOs - console.log(stargazeInstances); - const stargazeDaoCards = stargazeInstances - ?.flatMap((network) => - network.registrationNetwork.registrations.filter((reg) => - filterRegistrations(reg, filterVal) - ) - ) - .map((registration, i) => { - return ( - - ); - }); - - // Handle Osmosis DAOs - const osmosisDaoCards = osmosisInstances - ?.flatMap((network) => - network.registrationNetwork.registrations.filter((reg) => - filterRegistrations(reg, filterVal) - ) - ) - .map((registration, i) => { - return ( - - ); - }); + return (
From c444da4960c19f11a0dff85a795ffc405f942cb4 Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Tue, 6 Feb 2024 21:55:03 +0530 Subject: [PATCH 3/6] checkpoint --- daostar-website/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index ade741d..3060219 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -114,7 +114,7 @@ function restructureAragonDAOData(daoInstances, network) { daoName: item.name, daoAddress: item.name, daoDescription: item.description, - daoURI: `https://aragon-dao-uri.onrender.com//aragon_dao/${network}/${item.id}`, + daoURI: `https://aragon-dao-uri.onrender.com/aragon_dao/${network}/${item.name}`, governanceURI: item.governanceURI, issuersURI: item.issuersURI, managerAddress: '', From 8deee135607a008e83a2df73cb4e66cd6af97856 Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Tue, 6 Feb 2024 23:39:51 +0530 Subject: [PATCH 4/6] convert network to lowercase --- daostar-website/src/App.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index 3060219..24c53f0 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -103,6 +103,8 @@ function restructureDAOData(daoInstances, networkId) { } function restructureAragonDAOData(daoInstances, network) { + const aragonNetwork = network.toLowerCase(); // Convert network to lowercase + return [ { registrationNetwork: { @@ -114,7 +116,7 @@ function restructureAragonDAOData(daoInstances, network) { daoName: item.name, daoAddress: item.name, daoDescription: item.description, - daoURI: `https://aragon-dao-uri.onrender.com/aragon_dao/${network}/${item.name}`, + daoURI: `https://aragon-dao-uri.onrender.com/aragon_dao/${aragonNetwork}/${item.name}`, governanceURI: item.governanceURI, issuersURI: item.issuersURI, managerAddress: '', From f8c3f33afef1c359dee49cabacad9604b4ed9f0e Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Wed, 14 Feb 2024 08:03:55 +0530 Subject: [PATCH 5/6] links for all aragon networks and explorer page in progress --- daostar-website/src/App.js | 43 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/daostar-website/src/App.js b/daostar-website/src/App.js index 24c53f0..bc05a8f 100644 --- a/daostar-website/src/App.js +++ b/daostar-website/src/App.js @@ -25,6 +25,47 @@ const mainnetOldClient = new ApolloClient({ cache: new InMemoryCache(), }); +const SUBGRAPH_API_URL = { + arbitrum: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/arbitrum', + 'arbitrum-goerli': 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/arbitrum-goerli', + base: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/base', + ethereum: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/ethereum', + goerli: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/goerli', + polygon: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/polygon', + sepolia: 'https://aragon-dao-uri.onrender.com/fetch_aragon_daos/sepolia', + unsupported: undefined, +}; + +function useFetchAragonDAOs(network) { + const [data, setData] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + const fetchData = async () => { + try { + const apiUrl = SUBGRAPH_API_URL[network]; + if (!apiUrl) { + throw new Error(`Unsupported network: ${network}`); + } + const response = await axios.get(apiUrl); + const structuredData = restructureAragonDAOData(response.data, network); // Adjust based on actual data structure + setData(structuredData); + } catch (error) { + console.error(error); + setError(error); + } finally { + setLoading(false); + } + }; + + fetchData(); + }, [network]); + + return { data, loading, error }; +} + + const alchemyId = process.env.REACT_APP_ALCHEMY_ID; const walletConnectId = process.env.REACT_APP_WALLETCONNECT_ID; const token = process.env.REACT_APP_BEARER_TOKEN; @@ -134,7 +175,6 @@ function restructureAragonDAOData(daoInstances, network) { } function App() { - //DAODAOINT START if (token !== undefined) { headers = { @@ -192,7 +232,6 @@ function App() { fetchDAOs(); }, []); - //DAODAOINT END const { loading, error, From cfd3384e9955894983adbb7fb5476e9dd199c175 Mon Sep 17 00:00:00 2001 From: Rashmi V Abbigeri Date: Wed, 14 Feb 2024 08:05:09 +0530 Subject: [PATCH 6/6] add exploreAragonDAOs file --- .../ExplorePage/ExploreAragonDAOs.js | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 daostar-website/src/components/ExplorePage/ExploreAragonDAOs.js diff --git a/daostar-website/src/components/ExplorePage/ExploreAragonDAOs.js b/daostar-website/src/components/ExplorePage/ExploreAragonDAOs.js new file mode 100644 index 0000000..1e70816 --- /dev/null +++ b/daostar-website/src/components/ExplorePage/ExploreAragonDAOs.js @@ -0,0 +1,140 @@ +import React, { useState } from "react"; +import RegistrationCard from "../RegistrationCard/RegistrationCard"; +import AttestationCard from "../AttestationCard/AttestationCard"; +import "./ExplorePage.css"; +import { InputGroup, Button } from "@blueprintjs/core"; + +// Prelimnary check filter, if a DAO has no name, it won't be displayed +export const filterRegistrations = (registration, filterVal = "") => { + if (!registration.daoName) { + return false; + } + if (filterVal !== "") { + return registration.daoName.toLowerCase().includes(filterVal.toLowerCase()); + } + return true; +}; + +// Network Filter for EVM Chains +export const NetworkFilterRegistrations = (registration, filterVal = "") => { + console.log(registration.registrationNetwork.id); + if (registration.registrationNetwork.id === filterVal) { + return true; + } + if (filterVal === "ethereum") { + if ( + (registration.registrationNetwork.id === filterVal) | + (registration.registrationNetwork.id === "mainnet") + ) { + return true; + } + } +}; + +const NetworkButtons = [ + { text: "All", filter: "all" }, + { text: "Arbitrum", filter: "arbitrum" }, + { text: "Base", filter: "base" }, + { text: "Ethereum", filter: "ethereum" }, + { text: "Goerli", filter: "goerli" }, + { text: "Polygon", filter: "polygon" }, + { text: "Arbitrum Goerli", filter: "arbitrum-goerli" }, + { text: "Sepolia", filter: "sepolia" }, +]; +NetworkButtons.sort((a, b) => a.text.localeCompare(b.text)); + +const ExplorePage = ({ + aragonBase, + aragonArbitrum, + aragonEthereum, + aragonGoerli, + aragonPolygon, + aragonSepolia, + aragonArbitrumGoerli, +}) => { + const [filterVal, setFilterVal] = useState(""); + const onChangeFilter = (e) => setFilterVal(e.target.value); + const [networkFilter, setNetworkFilter] = useState("all"); + + const filteredRegistrations = (instances) => { + return instances + .flatMap((network) => + network.registrationNetwork.registrations.filter((reg) => + filterRegistrations(reg, filterVal) + ) + ) + .map((registration, i) => ( + + )); + }; + + const renderCards = () => { + switch (networkFilter) { + case "arbitrum-goerli": + return filteredRegistrations(aragonArbitrumGoerli); + + case "base": + return filteredRegistrations(aragonBase); + + case "arbitrum": + return filteredRegistrations(aragonArbitrum); + + case "polygon": + return filteredRegistrations(aragonPolygon); + + case "sepolia": + return filteredRegistrations(aragonSepolia); + + case "ethereum": + return filteredRegistrations(aragonEthereum); + + case "goerli": + return filteredRegistrations(aragonGoerli); + + default: + return ( + <> +
{filteredRegistrations(aragonEthereum)}
+

+ + + ); + } + }; + + + + return ( +
+
+ +
+ {NetworkButtons.map((button, index) => ( +
+
+ +
{renderCards()}
+
+ ); +}; + +export default ExplorePage;