Skip to content

Commit

Permalink
Merge pull request #241 from gnosisguild/libs_migration
Browse files Browse the repository at this point in the history
Update Zodiac Safe App to Use Ethers v6 and Migrate to Vite
  • Loading branch information
samepant authored Jul 24, 2024
2 parents acce38f + ae7885a commit 802c296
Show file tree
Hide file tree
Showing 140 changed files with 15,914 additions and 17,796 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/dev-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
branches: master

env:
REACT_APP_INFURA_ID: ${{ secrets.REACT_APP_INFURA_ID }}
REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }}
REACT_APP_GNOSISSCAN_KEY: ${{ secrets.REACT_APP_GNOSISSCAN_KEY }}
REACT_APP_POLYGONSCAN_KEY: ${{ secrets.REACT_APP_POLYGONSCAN_KEY }}
REACT_APP_BSCSCAN_KEY: ${{ secrets.REACT_APP_BSCSCAN_KEY }}
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }}
REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }}
REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }}
REACT_APP_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"
REACT_APP_BACKEND_API_URL: "https://api.dev.zodiac.gnosisguild.org/api"
VITE_INFURA_ID: ${{ secrets.VITE_INFURA_ID }}
VITE_ETHERSCAN_KEY: ${{ secrets.VITE_ETHERSCAN_KEY }}
VITE_GNOSISSCAN_KEY: ${{ secrets.VITE_GNOSISSCAN_KEY }}
VITE_POLYGONSCAN_KEY: ${{ secrets.VITE_POLYGONSCAN_KEY }}
VITE_BSCSCAN_KEY: ${{ secrets.VITE_BSCSCAN_KEY }}
VITE_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.VITE_OPTIMISTIC_ETHERSCAN_KEY }}
VITE_ARBISCAN_KEY: ${{ secrets.VITE_ARBISCAN_KEY }}
VITE_SNOWTRACE_KEY: ${{ secrets.VITE_SNOWTRACE_KEY }}
VITE_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"
VITE_BACKEND_API_URL: "https://api.dev.zodiac.gnosisguild.org/api"

jobs:
deploy:
Expand All @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 21
- run: npm install -g yarn
- name: Install deps and build
working-directory: ./packages/app
Expand All @@ -37,7 +37,7 @@ jobs:
uses: anantaramdas/ipfs-pinata-deploy-action@39bbda1ce1fe24c69c6f57861b8038278d53688d
with:
pin-name: Zodiac Safe App - Latest — ${ GITHUB_SHA }
path: "./packages/app/build"
path: "./packages/app/dist"
pinata-api-key: ${{ secrets.PINATA_API_KEY }}
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }}

Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/prod-release-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ on:
types: created

env:
REACT_APP_INFURA_ID: ${{ secrets.REACT_APP_INFURA_ID }}
REACT_APP_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"
REACT_APP_BACKEND_API_URL: "https://api.zodiac.gnosisguild.org/api"
REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }}
REACT_APP_GNOSISSCAN_KEY: ${{ secrets.REACT_APP_GNOSISSCAN_KEY }}
REACT_APP_POLYGONSCAN_KEY: ${{ secrets.REACT_APP_POLYGONSCAN_KEY }}
REACT_APP_BSCSCAN_KEY: ${{ secrets.REACT_APP_BSCSCAN_KEY }}
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }}
REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }}
REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }}
REACT_APP_BASESCAN_KEY: ${{ secrets.REACT_APP_BASESCAN_KEY }}
VITE_INFURA_ID: ${{ secrets.VITE_INFURA_ID }}
VITE_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761"
VITE_BACKEND_API_URL: "https://api.zodiac.gnosisguild.org/api"
VITE_ETHERSCAN_KEY: ${{ secrets.VITE_ETHERSCAN_KEY }}
VITE_GNOSISSCAN_KEY: ${{ secrets.VITE_GNOSISSCAN_KEY }}
VITE_POLYGONSCAN_KEY: ${{ secrets.VITE_POLYGONSCAN_KEY }}
VITE_BSCSCAN_KEY: ${{ secrets.VITE_BSCSCAN_KEY }}
VITE_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.VITE_OPTIMISTIC_ETHERSCAN_KEY }}
VITE_ARBISCAN_KEY: ${{ secrets.VITE_ARBISCAN_KEY }}
VITE_SNOWTRACE_KEY: ${{ secrets.VITE_SNOWTRACE_KEY }}
VITE_BASESCAN_KEY: ${{ secrets.VITE_BASESCAN_KEY }}

jobs:
deploy:
Expand All @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 21
- run: npm install -g yarn
- name: Install deps and build
working-directory: ./packages/app
Expand All @@ -38,7 +38,7 @@ jobs:
uses: anantaramdas/ipfs-pinata-deploy-action@39bbda1ce1fe24c69c6f57861b8038278d53688d
with:
pin-name: Zodiac Safe App - Prod — ${ GITHUB_SHA }
path: "./packages/app/build"
path: "./packages/app/dist"
pinata-api-key: ${{ secrets.PINATA_API_KEY }}
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }}

Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: packages/app/build
folder: packages/app/dist

# Deploys a production instance of the backend api to vercel
- name: Install Vercel CLI
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ coverage

# production
build
dist

# misc
.DS_Store
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

out/
dist/
build/
node_modules/
22 changes: 11 additions & 11 deletions packages/app/.env.sample
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
PORT=3000
HTTPS=true
REACT_APP_INFURA_ID=
REACT_APP_MULTI_SEND_CONTRACT=0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761
REACT_APP_BACKEND_API_URL=http://localhost:3001/api
VITE_INFURA_ID=
VITE_MULTI_SEND_CONTRACT=0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761
VITE_BACKEND_API_URL=http://localhost:3001/api

# Blockchain explorers
REACT_APP_ETHERSCAN_KEY=
REACT_APP_GNOSISSCAN_KEY=
REACT_APP_POLYGONSCAN_KEY=
REACT_APP_BSCSCAN_KEY=
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY=
REACT_APP_ARBISCAN_KEY=
REACT_APP_SNOWTRACE_KEY=
REACT_APP_BASESCAN_KEY=
VITE_ETHERSCAN_KEY=
VITE_GNOSISSCAN_KEY=
VITE_POLYGONSCAN_KEY=
VITE_BSCSCAN_KEY=
VITE_OPTIMISTIC_ETHERSCAN_KEY=
VITE_ARBISCAN_KEY=
VITE_SNOWTRACE_KEY=
VITE_BASESCAN_KEY=
19 changes: 19 additions & 0 deletions packages/app/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'prettier'
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
7 changes: 5 additions & 2 deletions packages/app/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"printWidth": 90,
"printWidth": 100,
"trailingComma": "all",
"semi": false,
"singleQuote": false
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"jsxSingleQuote": true
}
7 changes: 4 additions & 3 deletions packages/app/public/index.html → packages/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="%PUBLIC_URL%/gnosis-safe-logo.png" />
<link rel="icon" type="image/png" href="/gnosis-safe-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="The expansion pack for DAOs" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/zodiac-app-logo.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="apple-touch-icon" href="/zodiac-app-logo.png" />
<link rel="manifest" href="/manifest.json" />
<title>Zodiac - Safe App</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
<style>
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
Expand Down
68 changes: 40 additions & 28 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,71 @@
{
"name": "zodiac-app",
"version": "0.1.15",
"version": "1.5.0",
"private": true,
"homepage": "./",
"type": "module",
"dependencies": {
"@ensdomains/ensjs": "^4.0.0",
"@gnosis.pm/safe-apps-provider": "0.15.1",
"@gnosis.pm/safe-apps-react-sdk": "4.6.2",
"@gnosis.pm/safe-deployments": "1.17.0",
"@gnosis.pm/safe-deployments": "^1.19.0",
"@gnosis.pm/safe-react-components": "^1.2.0",
"@gnosis.pm/zodiac": "^3.5.0",
"@gnosis.pm/zodiac": "^4.0.3",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.61",
"@reduxjs/toolkit": "^1.6.0",
"@snapshot-labs/snapshot.js": "^0.4.73",
"@reduxjs/toolkit": "^2.2.6",
"@snapshot-labs/snapshot.js": "^0.11.39",
"@svgr/rollup": "^8.1.0",
"@vitejs/plugin-react": "^4.3.1",
"async-retry": "^1.3.1",
"classnames": "^2.3.1",
"ethcall": "^3.4.1",
"ethers": "5.7.2",
"ipfs-core": "0.14.3",
"ethcall": "^6.0.6",
"ethers": "^6.13.1",
"ipfs-core": "^0.18.1",
"lodash.debounce": "^4.0.8",
"lodash.memoize": "^4.1.2",
"ramda": "^0.28.0",
"react": "^17.0.1",
"ramda": "^0.30.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.0",
"react-dom": "^17.0.1",
"react-redux": "^7.2.4",
"react-dom": "^18.3.1",
"react-redux": "^9.1.2",
"react-select": "^5.4.0",
"styled-components": "^5.3.5",
"styled-components": "^6.1.11",
"timeago-react": "^3.0.2",
"viem": "^2.17.4",
"vite": "^5.3.3",
"vite-plugin-node-polyfills": "^0.22.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-tsconfig-paths": "^4.3.2",
"zodiac-ui-components": "^0.2.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.1.3",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/async-retry": "^1.4.3",
"@types/jest": "^26.0.14",
"@types/jest": "^29.5.12",
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.memoize": "^4.1.6",
"@types/node": "^14.6.2",
"@types/ramda": "^0.28.15",
"@types/react": "^17.0.0",
"@types/node": "^20.14.10",
"@types/ramda": "^0.30.1",
"@types/react": "^18.3.3",
"@types/react-beautiful-dnd": "^13.1.0",
"@types/react-dom": "^17.0.0",
"@types/react-dom": "^18.3.0",
"@types/styled-components": "^5.1.2",
"ganache-core": "2.12.1",
"prettier": "^2.3.1",
"ganache-core": "^2.13.2",
"prettier": "^3.3.2",
"react-app-rewired": "^2.1.6",
"react-scripts": "3.4.0",
"typescript": "4.9.4"
"typescript": "^5.5.3"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired --max_old_space_size=4096 build",
"start": "vite",
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"predeploy": "yarn run build",
"test": "react-scripts test --watchAll=false",
"eject": "react-scripts eject"
},
Expand All @@ -79,4 +91,4 @@
]
},
"packageManager": "[email protected]"
}
}
18 changes: 8 additions & 10 deletions packages/app/src/View.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import ModuleDetails from "./views/ModuleDetails"
import React from "react"
import { useRootSelector } from "./store"
import { getCurrentModule, getCurrentPendingModule } from "./store/modules/selectors"
import AddModules from "./views/AddModule"
import { ModulePendingTransaction } from "./views/ModuleDetails/ModulePendingTransaction"
import RealityModule from "views/AddModule/wizards/RealityModule"
import { OzGovernorModule } from "views/AddModule/wizards/OzGovernor"

import ModuleDetails from './views/ModuleDetails'
import React from 'react'
import { useRootSelector } from './store'
import { getCurrentModule, getCurrentPendingModule } from './store/modules/selectors'
import AddModules from './views/AddModule'
import { ModulePendingTransaction } from './views/ModuleDetails/ModulePendingTransaction'
import RealityModule from 'views/AddModule/wizards/RealityModule'
import { OzGovernorModule } from 'views/AddModule/wizards/OzGovernor'

export const Views: React.FC = () => {
const currentModule = useRootSelector(getCurrentModule)
const currentPendingModule = useRootSelector(getCurrentPendingModule)
const loadingModules = useRootSelector((state) => state.modules.loadingModules)
const showRealityModule = useRootSelector((state) => state.modules.realityModuleScreen)
const showOzGovernorModule = useRootSelector((state) => state.modules.OzGovernorModuleScreen)

if (currentModule) {
return <ModuleDetails module={currentModule} />
}
Expand Down
Loading

0 comments on commit 802c296

Please sign in to comment.