GoodDollar / GoodCollective

Monorepo for GoodCollective (Segmented UBI and Direct Payments Pool)
MIT License
3 stars 1 forks source link

data from ipfs should be cached using apollo client #57

Closed krisbitney closed 8 months ago

krisbitney commented 8 months ago

Right now we use fetch to get data from IPFS. We should be using ApolloClient with AsyncLocalStorage.

krisbitney commented 8 months ago

According to The Graph docs:

Note: The Graph Network does not yet support ipfs.cat and ipfs.map, and developers should not deploy subgraphs using that functionality to the network via the Studio.

source: https://thegraph.com/docs/en/developing/creating-a-subgraph/#ipfs-on-ethereum-contracts

Apollo Client is a GraphQL client, not an HTTP client, which is likely the reason it wasn't used for fetching IPFS data before.

@sirpy can you please let me know whether the GoodDollar's subgraph will be hosted on The Graph Network? If so, we should continue fetching IPFS data via HTTP. If not, we can add another entity to the subgraph IpfsCollective to store the IPFS data for each collective.

sirpy commented 8 months ago

At the moment probably only to the hosted service, so it makes sense to store the IPFS data on the subgraph. We probably don't need another entity, just populate and update the relevant fields in the Collective entity, but your call.

krisbitney commented 8 months ago

Can you tell me which values are guaranteed to exist in a Collective's IPFS metadata?

Here is a model of the metadata. In it I assume that only the name and description of the collective are guaranteed to exist. How can I change this to make it more correct?

export type IpfsCollective = {
  id: string; // collective address
  name: string;
  description: string;
  email?: string;
  website?: string;
  twitter?: string;
  instagram?: string;
  threads?: string;
  headerImage?: string;
  logo?: string;
  images?: string[];
};
sirpy commented 8 months ago

@krisbitney I think headerImage and logo But that's more of a question to @patpedrosa @decentralauren , what would be the required field a collective would MUST fill when creating one

decentralauren commented 8 months ago

@krisbitney I think headerImage and logo But that's more of a question to @patpedrosa @decentralauren , what would be the required field a collective would MUST fill when creating one

Collective name, description, wallet address, header image and logo are all required.

@patpedrosa @sanajamm copying you for visibility that these fields are all mandatory (as we do not have placeholders / want to deal with placeholders for each).

krisbitney commented 8 months ago

Awesome, thanks.I updated the Subgraph accordingly.