[OP-15] contracts and dapp restructure (#85)

pull/87/head
Chris Mckay 5 years ago committed by GitHub
parent 577fa19abe
commit a525630f47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      .dockerignore
  2. 14
      .editorconfig
  3. 10
      .gitignore
  4. 2
      .solcover.js
  5. 0
      Dockerfile
  6. 33
      Jenkinsfile
  7. 24
      app/.gitignore
  8. 68
      app/README.md
  9. 17090
      app/package-lock.json
  10. 78
      app/package.json
  11. 4
      app/src/index.css
  12. 0
      nginx/conf.d/default.conf
  13. 27743
      package-lock.json
  14. 81
      package.json
  15. 0
      public/index.html
  16. 0
      public/manifest.json
  17. 0
      public/pegasys-logo.png
  18. 0
      src/@types/drizzle-react/index.d.ts
  19. 0
      src/@types/rimble-ui/index.d.ts
  20. 0
      src/App.test.tsx
  21. 0
      src/App.tsx
  22. 0
      src/__test__/App.test.tsx
  23. 0
      src/__test__/__snapshots__/App.test.tsx.snap
  24. 0
      src/components/AccountTab/AccountTab.tsx
  25. 0
      src/components/AccountTab/EmptyRow.js
  26. 0
      src/components/AccountTab/Row.js
  27. 0
      src/components/AccountTab/Table.tsx
  28. 0
      src/components/AccountTab/TableHeader.tsx
  29. 0
      src/components/AccountTab/TextWithTooltip.js
  30. 0
      src/components/AccountTab/styles.module.scss
  31. 0
      src/components/AdminTab/AdminTab.js
  32. 0
      src/components/AdminTab/Row.js
  33. 0
      src/components/AdminTab/Table.js
  34. 0
      src/components/AdminTab/TableHeader.js
  35. 0
      src/components/AdminTab/TextWithTooltip.js
  36. 0
      src/components/AdminTab/styles.module.scss
  37. 0
      src/components/AppBar/AppBar.js
  38. 0
      src/components/AppBar/__test__/AppBar.test.js
  39. 2
      src/components/AppBar/__test__/__snapshots__/AppBar.test.js.snap
  40. 0
      src/components/AppBar/styles.module.scss
  41. 0
      src/components/Dashboard/Dashboard.js
  42. 0
      src/components/Dashboard/TabSelector.js
  43. 0
      src/components/Dashboard/__test__/Dashboard.test.js
  44. 0
      src/components/Dashboard/__test__/TabSelector.test.js
  45. 14140
      src/components/Dashboard/__test__/__snapshots__/Dashboard.test.js.snap
  46. 14140
      src/components/Dashboard/__test__/__snapshots__/TabSelector.test.js.snap
  47. 0
      src/components/Dashboard/styles.module.scss
  48. 0
      src/components/EnodeTab/EmptyRow.js
  49. 0
      src/components/EnodeTab/EnodeTab.js
  50. 0
      src/components/EnodeTab/Row.js
  51. 0
      src/components/EnodeTab/Table.js
  52. 0
      src/components/EnodeTab/TableHeader.js
  53. 0
      src/components/EnodeTab/TextWithTooltip.js
  54. 0
      src/components/EnodeTab/styles.module.scss
  55. 0
      src/components/Flashes/NoProvider.js
  56. 0
      src/components/Flashes/WrongNetwork.js
  57. 0
      src/components/Flashes/__test__/NoProvider.test.js
  58. 0
      src/components/Flashes/__test__/WrongNetwork.test.js
  59. 0
      src/components/Flashes/__test__/__snapshots__/NoProvider.test.js.snap
  60. 0
      src/components/Flashes/__test__/__snapshots__/WrongNetwork.test.js.snap
  61. 0
      src/components/Flashes/styles.module.scss
  62. 0
      src/components/Layout/Layout.js
  63. 0
      src/components/Layout/__test__/Layout.test.js
  64. 0
      src/components/Layout/__test__/__snapshots__/Layout.test.js.snap
  65. 0
      src/components/LoadingPage/LoadingPage.js
  66. 0
      src/components/LoadingPage/__test__/LoadingPage.test.js
  67. 0
      src/components/LoadingPage/__test__/__snapshots__/LoadingPage.test.js.snap
  68. 0
      src/components/Modals/Add.js
  69. 0
      src/components/Modals/Lock.js
  70. 0
      src/components/Modals/Remove.js
  71. 0
      src/components/Modals/styles.module.scss
  72. 0
      src/components/Toasts/Error.js
  73. 0
      src/components/Toasts/Pending.js
  74. 0
      src/components/Toasts/Success.js
  75. 0
      src/components/Toasts/Toasts.js
  76. 0
      src/components/Toasts/styles.module.scss
  77. 0
      src/constants/colors.ts
  78. 0
      src/constants/modals.ts
  79. 0
      src/constants/tabs.ts
  80. 0
      src/constants/theme.ts
  81. 0
      src/constants/transactions.ts
  82. 0
      src/containers/Dashboard/Dashboard.tsx
  83. 0
      src/containers/Dashboard/__test__/Dashboard.test.tsx
  84. 2
      src/containers/Dashboard/__test__/__snapshots__/Dashboard.test.tsx.snap
  85. 0
      src/containers/Layout/Initializer.js
  86. 0
      src/containers/Layout/__test__/Initializer.test.js
  87. 0
      src/containers/Layout/__test__/__snapshots__/Initializer.test.js.snap
  88. 0
      src/containers/Modals/Add.js
  89. 0
      src/containers/Modals/Remove.js
  90. 0
      src/containers/Tabs/Account.tsx
  91. 0
      src/containers/Tabs/Admin.js
  92. 0
      src/containers/Tabs/Enode.js
  93. 0
      src/containers/Tabs/useModal.js
  94. 0
      src/containers/Tabs/useTab.js
  95. 0
      src/containers/Tabs/useTransaction.js
  96. 0
      src/containers/Toasts/Toasts.js
  97. 0
      src/containers/Toasts/__test__/Toasts.test.js
  98. 2
      src/containers/Toasts/__test__/__snapshots__/Toasts.test.js.snap
  99. 0
      src/context/__test__/__snapshots__/data.test.js.snap
  100. 0
      src/context/__test__/__snapshots__/toasts.test.js.snap
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,17 +1,17 @@
root = true root = true
[*] [*]
charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
[src/**.{css,js,jsx,ts,tsx}]
charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
indent_style = space indent_style = space
[src/**.{css,js,jsx,ts,tsx}]
indent_size = 2 indent_size = 2
[package.json] [*.json]
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2 indent_size = 2
[*.sol]
indent_size = 4

10
.gitignore vendored

@ -26,6 +26,7 @@ test-results/
node_modules node_modules
build build
app/src/contracts app/src/contracts
src/chain/abis
.DS_Store .DS_Store
.idea .idea
@ -63,6 +64,8 @@ build/Release
# Dependency directories # Dependency directories
node_modules/ node_modules/
jspm_packages/ jspm_packages/
.pnp
.pnp.js
# TypeScript v1 declaration files # TypeScript v1 declaration files
typings/ typings/
@ -79,12 +82,19 @@ typings/
# Output of 'npm pack' # Output of 'npm pack'
*.tgz *.tgz
# Junit output
junit.xml
# Yarn Integrity file # Yarn Integrity file
.yarn-integrity .yarn-integrity
# dotenv environment variables file # dotenv environment variables file
.env .env
.env.test .env.test
.env.local
.env.development.local
.env.test.local
.env.production.local
# parcel-bundler cache (https://parceljs.org/) # parcel-bundler cache (https://parceljs.org/)
.cache .cache

@ -1,3 +1,3 @@
module.exports = { module.exports = {
buildDirPath: '/app/src/contracts' buildDirPath: '/src/chain/abis'
}; };

33
Jenkinsfile vendored

@ -15,56 +15,51 @@ pipeline {
stage('Contracts: Build') { stage('Contracts: Build') {
steps { steps {
sh 'npm install' sh 'npm install'
sh 'npm run build' sh 'npm run build:contracts'
} }
} }
stage('Contracts: Lint') { stage('Contracts: Lint') {
steps { steps {
sh 'npm run lint' sh 'npm run lint:contracts'
} }
} }
stage('Contracts: Test') { stage('Contracts: Test') {
steps { steps {
sh 'npm test' sh 'npm run test:contracts'
} }
} }
stage('Contracts: Coverage') { stage('Contracts: Coverage') {
steps { steps {
sh 'npm run coverage' sh 'npm run coverage:contracts'
sh './node_modules/.bin/istanbul report cobertura --root .' sh './node_modules/.bin/istanbul report cobertura --root .'
} }
} }
stage('Dapp: Build') { stage('Dapp: Build') {
steps { steps {
dir('app') { sh 'npm run build:app'
sh 'npm install'
sh 'npm run build'
}
} }
} }
stage('Dapp: Test') { stage('Dapp: Test') {
steps { steps {
dir('app') { sh 'npm run test:app:ci'
sh 'npm run test:ci'
}
} }
} }
} }
post { post {
always { always {
junit 'test-results/**/*.xml' junit 'test-results/**/*.xml'
junit 'app/junit.xml' junit 'junit.xml'
publishCoverage adapters: [ publishCoverage adapters: [
istanbulCoberturaAdapter( istanbulCoberturaAdapter(
path: 'coverage/cobertura-coverage.xml', path: 'coverage/cobertura-coverage.xml',
thresholds: [[failUnhealthy: true, thresholdTarget: 'Function', unhealthyThreshold: 80.0, unstableThreshold: 85.0]])] thresholds: [[failUnhealthy: true, thresholdTarget: 'Function', unhealthyThreshold: 80.0, unstableThreshold: 85.0]])]
publishHTML([ publishHTML([
allowMissing: false, allowMissing: false,
alwaysLinkToLastBuild: false, alwaysLinkToLastBuild: false,
keepAll: false, keepAll: false,
reportDir: 'coverage', reportDir: 'coverage',
reportFiles: 'index.html', reportFiles: 'index.html',
reportName: 'Coverage Report (HTML)', reportName: 'Coverage Report (HTML)',
reportTitles: '']) reportTitles: ''])
} }
} }

24
app/.gitignore vendored

@ -1,24 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
junit.xml
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

@ -1,68 +0,0 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
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.
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.
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/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

17090
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,78 +0,0 @@
{
"name": "permissioning-dapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@types/enzyme": "^3.9.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/react": "^16.8.19",
"@types/react-dom": "^16.8.4",
"@types/styled-components": "^4.1.15",
"classnames": "^2.2.6",
"drizzle": "^1.4.0",
"drizzle-react": "^1.3.0",
"jest-junit": "^6.4.0",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.1",
"rimble-ui": "^0.8.0",
"styled-components": "^4.2.0",
"typescript": "^3.5.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test:ci": "react-scripts test --reporters=default --reporters=jest-junit",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.13.1",
"enzyme-to-json": "^3.3.5",
"husky": "^2.2.0",
"lint-staged": "^8.1.6",
"prettier": "^1.17.0"
},
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --write",
"git add"
]
},
"prettier": {
"useTabs": false,
"tabWidth": 4
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!**/src/index.js",
"!**/src/serviceWorker.js"
]
}
}

@ -1,4 +0,0 @@
body {
margin: 0;
padding: 0;
}

27743
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,26 +1,99 @@
{ {
"name": "permissioning-smart-contracts", "name": "permissioning-smart-contracts",
"version": "0.1.0",
"repository": "permissioning-smart-contracts", "repository": "permissioning-smart-contracts",
"license": "Apache-2.0", "license": "Apache-2.0",
"private": true, "private": true,
"scripts": { "scripts": {
"lint": "solium -d contracts", "lint:contracts": "solium -d contracts",
"test": "truffle test --network develop", "lint": "npm run lint:contracts",
"coverage": "solidity-coverage", "test:app": "react-scripts test --env=jsdom --watchAll=false",
"build": "truffle compile" "test:app:watch": "react-scripts test --env=jsdom",
"test:app:ci": "react-scripts test --reporters=default --reporters=jest-junit",
"test:contracts": "truffle test --network develop",
"test": "npm run test:contracts && npm run test:app",
"coverage:contracts": "solidity-coverage",
"coverage": "npm run coverage:contracts",
"build:app": "react-scripts build",
"build:contracts": "truffle compile",
"build": "npm run build:contracts && npm run build:app",
"start": "react-scripts start",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}, },
"dependencies": { "dependencies": {
"@types/enzyme": "^3.9.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/react": "^16.8.19",
"@types/react-dom": "^16.8.4",
"@types/styled-components": "^4.1.15",
"classnames": "^2.2.6",
"dotenv": "^7.0.0", "dotenv": "^7.0.0",
"drizzle": "^1.4.0",
"drizzle-react": "^1.3.0",
"jest-junit": "^6.4.0",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.1",
"rimble-ui": "^0.8.0",
"solidity-linked-list": "^2.0.2", "solidity-linked-list": "^2.0.2",
"styled-components": "^4.2.0",
"truffle-hdwallet-provider": "^1.0.6", "truffle-hdwallet-provider": "^1.0.6",
"typescript": "^3.5.1",
"web3-utils": "^1.0.0-beta.52" "web3-utils": "^1.0.0-beta.52"
}, },
"devDependencies": { "devDependencies": {
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.13.1",
"enzyme-to-json": "^3.3.5",
"husky": "^2.2.0",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"lint-staged": "^8.1.6",
"mocha-junit-reporter": "^1.21.0", "mocha-junit-reporter": "^1.21.0",
"mocha-multi-reporters": "^1.1.7", "mocha-multi-reporters": "^1.1.7",
"prettier": "^1.17.0",
"solidity-coverage": "github:sc-forks/solidity-coverage#leapdao", "solidity-coverage": "github:sc-forks/solidity-coverage#leapdao",
"solium": "^1.2.4", "solium": "^1.2.4",
"truffle": "^5.0.12" "truffle": "^5.0.12"
},
"lint-staged": {
"src/**/*.{js,jsx,json,css}": [
"prettier --write",
"git add"
]
},
"prettier": {
"useTabs": false,
"tabWidth": 4
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!**/src/index.js",
"!**/src/serviceWorker.js"
]
} }
} }

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

@ -255,9 +255,11 @@ exports[`<AppBar /> matches snapshot 1`] = `
> >
<Styled(Styled(Text)) <Styled(Styled(Text))
as="h3" as="h3"
color="copyColor"
fontFamily="sansSerif" fontFamily="sansSerif"
fontSize={4} fontSize={4}
fontWeight={3} fontWeight={3}
lineHeight="copy"
my={3} my={3}
textAlign="left" textAlign="left"
theme={ theme={

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Dashboard Container /> matches snapshot 1`] = ` exports[`<Dashboard Container /> matches snapshot 1`] = `
<Dashboard <Memo(Dashboard)
dataReady={true} dataReady={true}
setTab={[Function]} setTab={[Function]}
tab="accountTab" tab="accountTab"

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Toasts Container /> matches snapshot 1`] = ` exports[`<Toasts Container /> matches snapshot 1`] = `
<Toasts <Memo(Toasts)
closeToast={[Function]} closeToast={[Function]}
toasts={Array []} toasts={Array []}
/> />

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save