mento-protocol / governance-ui

An open source interface for the Mento protocol governance
https://governance.mento.org
0 stars 1 forks source link

Link app to datasources (read + write) #33

Closed bowd closed 9 months ago

bowd commented 9 months ago

⚠️ This branch is based off #31 and #32 as well, so it should be reviewed after those two are merged

Overview

This PR introduces a base-line for connecting the UI to two data sources:

  1. [read] from a graphql server hosted by the thegraph.com, currently in development mode.
  2. [rand/write] from a blockchain node via wagmi.

The GraphQL server

Most of the setup and files live in the app/graphql folder. There's also a generated folder there where code gets automatically generated if we change queries. But you must run the codegen tool:

> pnpm graphql-codegen --watch

You don't need to run it if you're not changing the graphql queries.

For a preview on how that's implemented follow the proposals list example, and read the README in app/graphql.

The on-chain data and making transactions

While starting to wire this up I realised that rainbowkit is about to launch 2.0.0 and there's a 2.0.0-beta.1 version out there, which updates to the 2.x versions of viem and wagmi. If we develop this app on 1.x we will be behind and it will probably a be a pain to migrate so I update rainbowkit to 2.0.0 and in the process got rid of the @celo/rainbowkit-celo dependency (see: https://github.com/celo-org/rainbowkit-celo/issues/84), simplifying the setup a bit.

I've then wired up the create proposal form in a quite hacky way but just to get it working. There's still a bunch to do:

Notes

I think there's no use for the api routes that we currently have, and we will also potentially deprecate some of the stores. I'm working now on a way to get balances and other on-chain data easily.

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
governance-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2024 11:30am