diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..cd0ca45 --- /dev/null +++ b/.env.template @@ -0,0 +1,4 @@ +VITE_SUBGRAPH_MARKETS_URL_ETHEREUM= +VITE_SUBGRAPH_MARKETS_URL_ARBITRUM_ONE= +VITE_SUBGRAPH_MARKETS_URL_BSC_MAINNET= +VITE_SUBGRAPH_MARKETS_URL_OPBNB_MAINNET= diff --git a/README.md b/README.md index b58e0af..13d2ff8 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,49 @@ -# Getting Started with Create React App +# Venus Protocol Landing Page -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +
+ +
-## Available Scripts +Official repository for the [Venus protocol](https://venus.io) landing page. -In the project directory, you can run: +## Getting started -### `yarn start` +Install dependencies with yarn -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +```ssh +yarn +``` -The page will reload if you make edits.\ -You will also see any lint errors in the console. +Define environment variables by making a copy of `.env.example` and renaming it to `.env` (make sure to add values for each environment variable). -### `yarn test` +Start the development server -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. +```ssh +yarn start +``` -### `yarn build` +## Useful commands -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. +Check Typescript code -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! +```ssh +yarn tsc +``` -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. +Lint code -### `yarn eject` +```ssh +yarn lint +``` -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** +Generate production build -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. +```ssh +yarn build +``` -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. +Start application with production build -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +```ssh +yarn preview +``` diff --git a/package.json b/package.json index 1d66d0a..9af8bfc 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "@testing-library/user-event": "^13.5.0", "axios": "^0.26.1", "classnames": "^2.3.1", + "graphql": "^16.8.1", + "graphql-request": "^7.0.1", "normalize.css": "^8.0.1", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -26,7 +28,9 @@ "preview": "vite preview", "lint:fix": "yarn lint --fix && yarn pretty --write", "lint": "yarn run eslint .", - "pretty": "yarn prettier \"src/**/*.{js,jsx,ts,tsx,html,json,md}\" public/**/*.html --check" + "pretty": "yarn prettier \"src/**/*.{js,jsx,ts,tsx,html,json,md}\" public/**/*.html --check", + "generate-subgraph-types": "dotenv -- graphql-codegen --config src/subgraph/codegen.ts", + "postinstall": "yarn run generate-subgraph-types" }, "browserslist": { "production": [ @@ -41,6 +45,8 @@ ] }, "devDependencies": { + "@graphql-codegen/cli": "5.0.2", + "@graphql-codegen/client-preset": "4.2.6", "@types/jest": "^29.5.12", "@types/node": "^20.12.12", "@types/react": "^18.3.3", @@ -49,6 +55,7 @@ "@typescript-eslint/parser": "^7.11.0", "@vitejs/plugin-react": "^4.3.1", "autoprefixer": "^9.0.0", + "dotenv-cli": "^7.4.2", "eslint": "^8", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^18.0.0", diff --git a/src/api/hooks/useProposals.ts b/src/api/hooks/useProposals.ts index d61469b..c39cf57 100644 --- a/src/api/hooks/useProposals.ts +++ b/src/api/hooks/useProposals.ts @@ -1,32 +1,8 @@ -import { useEffect, useState } from 'react'; +import { useQuery } from '@tanstack/react-query'; import { fetchProposalCount } from '../index'; -export const useProposalsCountFromApi = () => { - const [data, setData] = useState{error.message}
-Market size
-{isLoading ? loadingState : marketSize}
+{isLoading ? loadingState : formatUsd(marketSize)}
Total Borrowed
-{isLoading ? loadingState : borrowedSum}
+{isLoading ? loadingState : formatUsd(borrowedSum)}
Total Liquidity
-{isLoading ? loadingState : liquiditySum}
+{isLoading ? loadingState : formatUsd(liquiditySum)}
+ Our liquidities are distributed across {marketCount} markets on{' '} + {chainCount} networks +
{isLoading ? ( @@ -66,7 +80,7 @@ const Market: React.FC