Dependencies bump, fix babel configuration, use connected-react-router instead of react-redux-router
This commit is contained in:
parent
3e305d3267
commit
5b2fb5f87f
36
.babelrc
36
.babelrc
|
@ -7,19 +7,41 @@
|
|||
{
|
||||
"forceAllTransforms": true
|
||||
}
|
||||
],
|
||||
["@babel/preset-stage-0", { "decoratorsLegacy": true }]
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"transform-es3-member-expression-literals",
|
||||
"transform-es3-property-literals"
|
||||
"@babel/plugin-transform-member-expression-literals",
|
||||
"@babel/plugin-transform-property-literals",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-json-strings",
|
||||
[
|
||||
"@babel/plugin-proposal-decorators",
|
||||
{
|
||||
"legacy": true
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
[
|
||||
"@babel/plugin-proposal-pipeline-operator",
|
||||
{
|
||||
"proposal": "minimal"
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-do-expressions",
|
||||
"@babel/plugin-proposal-function-bind"
|
||||
],
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [
|
||||
"dynamic-import-node"
|
||||
]
|
||||
"plugins": ["dynamic-import-node"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ if (typeof Promise === 'undefined') {
|
|||
// Rejection tracking prevents a common issue where React gets into an
|
||||
// inconsistent state due to an error, but it gets swallowed by a Promise,
|
||||
// and the user has no idea what causes React's erratic future behavior.
|
||||
require('promise/lib/rejection-tracking').enable();
|
||||
window.Promise = require('promise/lib/es6-extensions.js');
|
||||
require('promise/lib/rejection-tracking').enable()
|
||||
window.Promise = require('promise/lib/es6-extensions.js')
|
||||
}
|
||||
|
||||
// fetch() polyfill for making API calls.
|
||||
require('whatwg-fetch');
|
||||
require('whatwg-fetch')
|
||||
|
||||
// Object.assign() is commonly used with React.
|
||||
// It will use the native implementation if it's present and isn't buggy.
|
||||
Object.assign = require('object-assign');
|
||||
Object.assign = require('object-assign')
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*eslint-disable*/
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const cssmixins = require('postcss-mixins');
|
||||
const cssvars = require('postcss-simple-vars');
|
||||
const webpack = require('webpack');
|
||||
const HtmlWebPackPlugin = require("html-webpack-plugin");
|
||||
const autoprefixer = require('autoprefixer')
|
||||
const cssmixins = require('postcss-mixins')
|
||||
const cssvars = require('postcss-simple-vars')
|
||||
const webpack = require('webpack')
|
||||
const HtmlWebPackPlugin = require('html-webpack-plugin')
|
||||
|
||||
const paths = require('./paths');
|
||||
const getClientEnvironment = require('./env');
|
||||
const paths = require('./paths')
|
||||
const getClientEnvironment = require('./env')
|
||||
|
||||
const publicPath = '/';
|
||||
const publicPath = '/'
|
||||
|
||||
// `publicUrl` we will provide it to our app
|
||||
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
|
||||
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
|
||||
var publicUrl = '';
|
||||
var publicUrl = ''
|
||||
// Get environment variables to inject into our app.
|
||||
var env = getClientEnvironment(publicUrl);
|
||||
var env = getClientEnvironment(publicUrl)
|
||||
|
||||
const cssvariables = require(paths.appSrc + '/theme/variables');
|
||||
const cssvariables = require(paths.appSrc + '/theme/variables')
|
||||
|
||||
const postcssPlugins = [
|
||||
autoprefixer({
|
||||
|
@ -26,22 +26,22 @@ const postcssPlugins = [
|
|||
'last 4 versions',
|
||||
'Firefox ESR',
|
||||
'not ie < 9', // React doesn't support IE8 anyway
|
||||
]
|
||||
],
|
||||
}),
|
||||
cssmixins,
|
||||
cssvars({
|
||||
variables: function () {
|
||||
return Object.assign({}, cssvariables);
|
||||
variables: function() {
|
||||
return Object.assign({}, cssvariables)
|
||||
},
|
||||
silent: false
|
||||
silent: false,
|
||||
}),
|
||||
];
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
devtool: 'eval-source-map',
|
||||
mode: 'development',
|
||||
entry: [
|
||||
"babel-polyfill",
|
||||
'babel-polyfill',
|
||||
// Include an alternative client for WebpackDevServer. A client's job is to
|
||||
// connect to WebpackDevServer by a socket and get notified about changes.
|
||||
// When you save a file, the client will either apply hot updates (in case
|
||||
|
@ -56,17 +56,13 @@ module.exports = {
|
|||
// We ship a few polyfills by default:
|
||||
require.resolve('./polyfills'),
|
||||
// Finally, this is your app's code:
|
||||
paths.appIndexJs
|
||||
paths.appIndexJs,
|
||||
// We include the app code last so that if there is a runtime error during
|
||||
// initialization, it doesn't blow up the WebpackDevServer client, and
|
||||
// changing JS code would still trigger a refresh.
|
||||
],
|
||||
resolve: {
|
||||
modules: [
|
||||
paths.appSrc,
|
||||
'node_modules',
|
||||
paths.appContracts,
|
||||
],
|
||||
modules: [paths.appSrc, 'node_modules', paths.appContracts],
|
||||
// These are the reasonable defaults supported by the Node ecosystem.
|
||||
// We also include JSX as a common component filename extension to support
|
||||
// some tools, although we do not recommend using it, see:
|
||||
|
@ -75,7 +71,7 @@ module.exports = {
|
|||
alias: {
|
||||
'~': paths.appSrc,
|
||||
'#': paths.appContracts,
|
||||
}
|
||||
},
|
||||
},
|
||||
output: {
|
||||
// Next line is not used in dev but WebpackDevServer crashes without it:
|
||||
|
@ -87,28 +83,28 @@ module.exports = {
|
|||
// containing code from all our entry points, and the Webpack runtime.
|
||||
filename: 'static/js/bundle.js',
|
||||
// This is the URL that app is served from. We use "/" in development.
|
||||
publicPath: publicPath
|
||||
},
|
||||
publicPath: publicPath,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader"
|
||||
}
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(scss|css)$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{ loader: 'css-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
modules: true,
|
||||
minimize: false,
|
||||
localIdentName: '[name]__[local]___[hash:base64:5]',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
|
@ -123,22 +119,24 @@ module.exports = {
|
|||
test: /\.html$/,
|
||||
use: [
|
||||
{
|
||||
loader: "html-loader",
|
||||
options: { minimize: false }
|
||||
}
|
||||
]
|
||||
loader: 'html-loader',
|
||||
options: { minimize: false },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.(jpe?g|png|svg)$/i,
|
||||
exclude: /node_modules/,
|
||||
use: [{
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: 'img/[hash].[ext]'
|
||||
}
|
||||
}]
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'img/[hash].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebPackPlugin({
|
||||
|
@ -152,6 +150,6 @@ module.exports = {
|
|||
node: {
|
||||
fs: 'empty',
|
||||
net: 'empty',
|
||||
tls: 'empty'
|
||||
}
|
||||
};
|
||||
tls: 'empty',
|
||||
},
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
96
package.json
96
package.json
|
@ -31,86 +31,102 @@
|
|||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0-beta.40",
|
||||
"@babel/core": "^7.0.0-beta.40",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.40",
|
||||
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.0.0",
|
||||
"@babel/plugin-proposal-do-expressions": "^7.0.0",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.0.0",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
|
||||
"@babel/plugin-proposal-function-bind": "^7.0.0",
|
||||
"@babel/plugin-proposal-function-sent": "^7.0.0",
|
||||
"@babel/plugin-proposal-json-strings": "^7.0.0",
|
||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
|
||||
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-syntax-import-meta": "^7.0.0",
|
||||
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
|
||||
"@babel/plugin-transform-property-literals": "^7.2.0",
|
||||
"@babel/polyfill": "^7.0.0-beta.40",
|
||||
"@babel/preset-env": "^7.0.0-beta.40",
|
||||
"@babel/preset-flow": "^7.0.0-beta.40",
|
||||
"@babel/preset-react": "^7.0.0-beta.40",
|
||||
"@babel/preset-stage-0": "^7.0.0-beta.40",
|
||||
"@sambego/storybook-state": "^1.0.7",
|
||||
"@storybook/addon-actions": "^3.3.15",
|
||||
"@storybook/addon-knobs": "^3.3.15",
|
||||
"@storybook/addon-links": "^3.3.15",
|
||||
"@storybook/react": "^3.3.15",
|
||||
"autoprefixer": "^8.1.0",
|
||||
"@storybook/addon-actions": "^5.0.0",
|
||||
"@storybook/addon-knobs": "^5.0.0",
|
||||
"@storybook/addon-links": "^5.0.0",
|
||||
"@storybook/react": "^5.0.0",
|
||||
"autoprefixer": "^9.4.10",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "8",
|
||||
"babel-jest": "^22.4.1",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^24.1.0",
|
||||
"babel-loader": "^8.0.0-beta.0",
|
||||
"babel-plugin-dynamic-import-node": "^1.2.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.2.0",
|
||||
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
|
||||
"babel-plugin-transform-es3-property-literals": "^6.22.0",
|
||||
"bignumber.js": "^7.2.1",
|
||||
"bignumber.js": "^8.1.1",
|
||||
"classnames": "^2.2.5",
|
||||
"css-loader": "^0.28.10",
|
||||
"css-loader": "^2.1.0",
|
||||
"detect-port": "^1.2.2",
|
||||
"dotenv": "^5.0.1",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-config-airbnb": "^16.1.0",
|
||||
"eslint-plugin-flowtype": "^2.46.1",
|
||||
"dotenv": "^6.2.0",
|
||||
"eslint": "^5.15.1",
|
||||
"eslint-config-airbnb": "^17.1.0",
|
||||
"eslint-plugin-flowtype": "^3.4.2",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-jest": "^21.13.0",
|
||||
"eslint-plugin-jest": "^22.3.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
||||
"eslint-plugin-react": "^7.7.0",
|
||||
"ethereumjs-abi": "^0.6.5",
|
||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"file-loader": "^1.1.11",
|
||||
"flow-bin": "^0.79.1",
|
||||
"fs-extra": "^5.0.0",
|
||||
"file-loader": "^3.0.1",
|
||||
"flow-bin": "^0.94.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.0.4",
|
||||
"immutable": "^4.0.0-rc.9",
|
||||
"jest": "^22.4.2",
|
||||
"jest": "^24.1.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"material-ui-search-bar": "^1.0.0-beta.13",
|
||||
"postcss-loader": "^2.1.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-mixins": "^6.2.0",
|
||||
"postcss-simple-vars": "^4.1.0",
|
||||
"postcss-simple-vars": "^5.0.2",
|
||||
"pre-commit": "^1.2.2",
|
||||
"react": "^16.4.0",
|
||||
"react-dev-utils": "^5.0.1",
|
||||
"react-dev-utils": "^7.0.3",
|
||||
"react-dom": "^16.4.0",
|
||||
"react-redux": "^5.0.7",
|
||||
"react-router-redux": "^5.0.0-alpha.9",
|
||||
"redux": "^3.7.2",
|
||||
"react-redux": "^6.0.1",
|
||||
"redux": "^4.0.1",
|
||||
"redux-actions": "^2.3.0",
|
||||
"redux-thunk": "^2.2.0",
|
||||
"reselect": "^3.0.1",
|
||||
"reselect": "^4.0.0",
|
||||
"run-with-testrpc": "^0.3.0",
|
||||
"storybook-host": "^4.1.5",
|
||||
"storybook-host": "^5.0.3",
|
||||
"storybook-router": "^0.3.3",
|
||||
"style-loader": "^0.20.2",
|
||||
"truffle": "^4.1.11",
|
||||
"truffle-contract": "^1.1.8",
|
||||
"truffle-solidity-loader": "0.0.8",
|
||||
"uglifyjs-webpack-plugin": "^1.2.2",
|
||||
"web3": "0.18.4",
|
||||
"style-loader": "^0.23.1",
|
||||
"truffle": "^5.0.6",
|
||||
"truffle-contract": "^4.0.7",
|
||||
"truffle-solidity-loader": "^0.1.6",
|
||||
"uglifyjs-webpack-plugin": "^2.1.2",
|
||||
"web3": "^0.20.7",
|
||||
"webpack": "^4.1.1",
|
||||
"webpack-bundle-analyzer": "^2.11.1",
|
||||
"webpack-cli": "^2.0.8",
|
||||
"webpack-bundle-analyzer": "^3.1.0",
|
||||
"webpack-cli": "^3.2.3",
|
||||
"webpack-dev-server": "^3.1.0",
|
||||
"webpack-manifest-plugin": "^2.0.0-rc.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gnosis.pm/util-contracts": "^0.2.14",
|
||||
"@gnosis.pm/util-contracts": "^2.0.0",
|
||||
"@material-ui/core": "^3.0.1",
|
||||
"@material-ui/icons": "^3.0.1",
|
||||
"connected-react-router": "^6.3.1",
|
||||
"final-form": "^4.2.1",
|
||||
"history": "^4.7.2",
|
||||
"react-final-form": "^3.1.2",
|
||||
"react-final-form": "^4.1.0",
|
||||
"react-loadable": "^5.3.1",
|
||||
"react-router-dom": "^4.2.2",
|
||||
"recompose": "^0.27.1"
|
||||
"recompose": "^0.30.0"
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
|
|
|
@ -39,21 +39,19 @@ const ConnectDetails = ({ classes, onConnect }: Props) => (
|
|||
<React.Fragment>
|
||||
<div className={classes.container}>
|
||||
<Row margin="lg" align="center">
|
||||
<Paragraph className={classes.text} size="lg" noMargin weight="bolder">Connect a Wallet</Paragraph>
|
||||
<Paragraph className={classes.text} size="lg" noMargin weight="bolder">
|
||||
Connect a Wallet
|
||||
</Paragraph>
|
||||
</Row>
|
||||
</div>
|
||||
<Row className={classes.logo} margin="lg">
|
||||
<CircleDot keySize={32} circleSize={75} dotSize={25} dotTop={50} dotRight={25} center mode="error" />
|
||||
</Row>
|
||||
<Row className={classes.connect}>
|
||||
<Button
|
||||
onClick={onConnect}
|
||||
size="medium"
|
||||
variant="raised"
|
||||
color="primary"
|
||||
fullWidth
|
||||
>
|
||||
<Paragraph className={classes.connectText} size="sm" weight="regular" color="white" noMargin>CONNECT</Paragraph>
|
||||
<Button onClick={onConnect} size="medium" variant="contained" color="primary" fullWidth>
|
||||
<Paragraph className={classes.connectText} size="sm" weight="regular" color="white" noMargin>
|
||||
CONNECT
|
||||
</Paragraph>
|
||||
</Button>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
|
|
|
@ -96,9 +96,7 @@ const styles = () => ({
|
|||
},
|
||||
})
|
||||
|
||||
const UserDetails = ({
|
||||
provider, connected, network, userAddress, classes, onDisconnect,
|
||||
}: Props) => {
|
||||
const UserDetails = ({ provider, connected, network, userAddress, classes, onDisconnect }: Props) => {
|
||||
const status = connected ? 'Connected' : 'Connection error'
|
||||
const address = userAddress ? shortVersionOf(userAddress, 6) : 'Address not available'
|
||||
const identiconAddress = userAddress || 'random'
|
||||
|
@ -108,25 +106,30 @@ const UserDetails = ({
|
|||
<React.Fragment>
|
||||
<Block className={classes.container}>
|
||||
<Row className={classes.identicon} margin="md" align="center">
|
||||
{ connected
|
||||
? <Identicon address={identiconAddress} diameter={60} />
|
||||
: <CircleDot keySize={30} circleSize={75} dotSize={25} dotTop={50} dotRight={25} mode="warning" hideDot />
|
||||
}
|
||||
{connected ? (
|
||||
<Identicon address={identiconAddress} diameter={60} />
|
||||
) : (
|
||||
<CircleDot keySize={30} circleSize={75} dotSize={25} dotTop={50} dotRight={25} mode="warning" hideDot />
|
||||
)}
|
||||
</Row>
|
||||
<Block align="center" className={classes.user}>
|
||||
<Paragraph className={classes.address} size="sm" noMargin>{address}</Paragraph>
|
||||
{ userAddress &&
|
||||
<Paragraph className={classes.address} size="sm" noMargin>
|
||||
{address}
|
||||
</Paragraph>
|
||||
{userAddress && (
|
||||
<OpenInNew
|
||||
className={classes.open}
|
||||
style={openIconStyle}
|
||||
onClick={openAddressInEtherScan(userAddress, network)}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
</Block>
|
||||
</Block>
|
||||
<Hairline margin="xs" />
|
||||
<Row className={classes.details}>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>Status </Paragraph>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>
|
||||
Status{' '}
|
||||
</Paragraph>
|
||||
<Spacer />
|
||||
<Dot className={classNames(classes.dot, connected ? classes.connected : classes.warning)} />
|
||||
<Paragraph noMargin align="right" color={color} weight="bolder" className={classes.labels}>
|
||||
|
@ -135,7 +138,9 @@ const UserDetails = ({
|
|||
</Row>
|
||||
<Hairline margin="xs" />
|
||||
<Row className={classes.details}>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>Client </Paragraph>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>
|
||||
Client{' '}
|
||||
</Paragraph>
|
||||
<Spacer />
|
||||
<Img className={classes.logo} src={metamask} height={14} alt="Metamask client" />
|
||||
<Paragraph noMargin align="right" weight="bolder" className={classes.labels}>
|
||||
|
@ -144,7 +149,9 @@ const UserDetails = ({
|
|||
</Row>
|
||||
<Hairline margin="xs" />
|
||||
<Row className={classes.details}>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>Network </Paragraph>
|
||||
<Paragraph noMargin align="right" className={classes.labels}>
|
||||
Network{' '}
|
||||
</Paragraph>
|
||||
<Spacer />
|
||||
<Img className={classes.logo} src={dot} height={14} alt="Network" />
|
||||
<Paragraph noMargin align="right" weight="bolder" className={classes.labels}>
|
||||
|
@ -153,14 +160,10 @@ const UserDetails = ({
|
|||
</Row>
|
||||
<Hairline margin="xs" />
|
||||
<Row className={classes.disconnect}>
|
||||
<Button
|
||||
onClick={onDisconnect}
|
||||
size="medium"
|
||||
variant="raised"
|
||||
color="primary"
|
||||
fullWidth
|
||||
>
|
||||
<Paragraph className={classes.disconnectText} size="sm" weight="bold" color="white" noMargin>DISCONNECT</Paragraph>
|
||||
<Button onClick={onDisconnect} size="medium" variant="contained" color="primary" fullWidth>
|
||||
<Paragraph className={classes.disconnectText} size="sm" weight="bold" color="white" noMargin>
|
||||
DISCONNECT
|
||||
</Paragraph>
|
||||
</Button>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
|
|
|
@ -48,7 +48,7 @@ const Controls = ({
|
|||
<Button
|
||||
style={secondButtonStyle}
|
||||
size="small"
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
type="submit"
|
||||
disabled={disabled}
|
||||
|
|
|
@ -46,7 +46,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
|
|||
static FinishButton = ({
|
||||
component, to, title, ...props
|
||||
}) => (
|
||||
<Button component={component} to={to} variant="raised" color="primary" {...props}>
|
||||
<Button component={component} to={to} variant="contained" color="primary" {...props}>
|
||||
{title}
|
||||
</Button>
|
||||
)
|
||||
|
|
|
@ -5,7 +5,7 @@ import { MuiThemeProvider } from '@material-ui/core/styles'
|
|||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { Provider } from 'react-redux'
|
||||
import { ConnectedRouter } from 'react-router-redux'
|
||||
import { ConnectedRouter } from 'connected-react-router'
|
||||
import PageFrame from '~/components/layout/PageFrame'
|
||||
import { history, store } from '~/store'
|
||||
import theme from '~/theme/mui'
|
||||
|
@ -25,7 +25,4 @@ const Root = () => (
|
|||
</Provider>
|
||||
)
|
||||
|
||||
ReactDOM.render(
|
||||
<Root />,
|
||||
document.getElementById('root'),
|
||||
)
|
||||
ReactDOM.render(<Root />, document.getElementById('root'))
|
||||
|
|
|
@ -19,7 +19,7 @@ const NoRights = () => (
|
|||
<Button
|
||||
component={Link}
|
||||
to={SAFELIST_ADDRESS}
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
>
|
||||
Safe List
|
||||
|
|
|
@ -75,7 +75,7 @@ const BalanceComponent = openHoc(({
|
|||
<Img src={token.get('logoUrl')} height={30} alt={name} />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={name} secondary={`${token.get('funds')} ${symbol}`} />
|
||||
<Button variant="raised" color="primary" onClick={onMoveFundsClick} disabled={disabled}>
|
||||
<Button variant="contained" color="primary" onClick={onMoveFundsClick} disabled={disabled}>
|
||||
{MOVE_FUNDS_BUTTON_TEXT}
|
||||
</Button>
|
||||
</ListItem>
|
||||
|
|
|
@ -24,7 +24,7 @@ const Confirmations = ({ confirmations, onEditThreshold }: Props) => (
|
|||
cut
|
||||
/>
|
||||
<Button
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={onEditThreshold}
|
||||
>
|
||||
|
|
|
@ -22,7 +22,7 @@ const MultisigTransactionsComponent = ({ onSeeTxs }: Props) => {
|
|||
</Avatar>
|
||||
<ListItemText primary="Safe's Multisig Transaction" secondary={text} />
|
||||
<Button
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={onSeeTxs}
|
||||
>
|
||||
|
|
|
@ -51,7 +51,7 @@ const Owners = openHoc(({
|
|||
}
|
||||
</ListItemIcon>
|
||||
<Button
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={onAddOwner}
|
||||
>
|
||||
|
|
|
@ -86,7 +86,7 @@ class GnoTransaction extends React.PureComponent<Props> {
|
|||
}
|
||||
{ !executionHash && !userConfirmed &&
|
||||
<Button
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={this.onProccesClick}
|
||||
>
|
||||
|
|
|
@ -26,7 +26,7 @@ const SafeTable = ({ safes }: Props) => (
|
|||
<TableRow key={safe.address}>
|
||||
<TableCell>
|
||||
<Link to={`${SAFELIST_ADDRESS}/${safe.address}`}>
|
||||
<Button variant="raised" size="small" color="primary">Open</Button>
|
||||
<Button variant="contained" size="small" color="primary">Open</Button>
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell padding="none">{safe.get('name')}</TableCell>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { List, Map } from 'immutable'
|
||||
import contract from 'truffle-contract'
|
||||
import type { Dispatch as ReduxDispatch } from 'redux'
|
||||
import StandardToken from '@gnosis.pm/util-contracts/build/contracts/StandardToken.json'
|
||||
import StandardToken from '@gnosis.pm/util-contracts/build/contracts/GnosisStandardToken.json'
|
||||
import HumanFriendlyToken from '@gnosis.pm/util-contracts/build/contracts/HumanFriendlyToken.json'
|
||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||
import { type GlobalState } from '~/store/index'
|
||||
|
@ -35,7 +35,8 @@ export const getStandardTokenContract = ensureOnce(createStandardTokenContract)
|
|||
export const calculateBalanceOf = async (tokenAddress: string, address: string, decimals: number) => {
|
||||
const erc20Token = await getStandardTokenContract()
|
||||
|
||||
return erc20Token.at(tokenAddress)
|
||||
return erc20Token
|
||||
.at(tokenAddress)
|
||||
.then(instance => instance.balanceOf(address).then(funds => funds.div(10 ** decimals).toString()))
|
||||
.catch(() => '0')
|
||||
}
|
||||
|
@ -46,40 +47,43 @@ export const fetchTokensData = async () => {
|
|||
return enhancedFetch(url, errMsg)
|
||||
}
|
||||
|
||||
export const fetchTokens = (safeAddress: string) =>
|
||||
async (dispatch: ReduxDispatch<GlobalState>) => {
|
||||
const tokens: List<string> = getActiveTokenAddresses(safeAddress)
|
||||
const ethBalance = await getSafeEthToken(safeAddress)
|
||||
const customTokens = getTokens(safeAddress)
|
||||
const json = await exports.fetchTokensData()
|
||||
export const fetchTokens = (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => {
|
||||
const tokens: List<string> = getActiveTokenAddresses(safeAddress)
|
||||
const ethBalance = await getSafeEthToken(safeAddress)
|
||||
const customTokens = getTokens(safeAddress)
|
||||
const json = await exports.fetchTokensData()
|
||||
|
||||
try {
|
||||
const balancesRecords = await Promise.all(json.map(async (item: TokenProps) => {
|
||||
try {
|
||||
const balancesRecords = await Promise.all(
|
||||
json.map(async (item: TokenProps) => {
|
||||
const status = tokens.includes(item.address)
|
||||
const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
|
||||
|
||||
return makeToken({ ...item, status, funds })
|
||||
}))
|
||||
}),
|
||||
)
|
||||
|
||||
const customTokenRecords = await Promise.all(customTokens.map(async (item: TokenProps) => {
|
||||
const customTokenRecords = await Promise.all(
|
||||
customTokens.map(async (item: TokenProps) => {
|
||||
const status = tokens.includes(item.address)
|
||||
const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
|
||||
|
||||
return makeToken({ ...item, status, funds })
|
||||
}))
|
||||
}),
|
||||
)
|
||||
|
||||
const balances: Map<string, Token> = Map().withMutations((map) => {
|
||||
balancesRecords.forEach(record => map.set(record.get('address'), record))
|
||||
customTokenRecords.forEach(record => map.set(record.get('address'), record))
|
||||
const balances: Map<string, Token> = Map().withMutations(map => {
|
||||
balancesRecords.forEach(record => map.set(record.get('address'), record))
|
||||
customTokenRecords.forEach(record => map.set(record.get('address'), record))
|
||||
|
||||
map.set(ethBalance.get('address'), ethBalance)
|
||||
})
|
||||
map.set(ethBalance.get('address'), ethBalance)
|
||||
})
|
||||
|
||||
return dispatch(addTokens(safeAddress, balances))
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line
|
||||
console.log("Error fetching token balances... " + err)
|
||||
return dispatch(addTokens(safeAddress, balances))
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line
|
||||
console.log('Error fetching token balances... ' + err)
|
||||
|
||||
return Promise.resolve()
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ export const CreateSafe = ({ size, provider }: SafeProps) => (
|
|||
<Button
|
||||
component={Link}
|
||||
to={OPEN_ADDRESS}
|
||||
variant="raised"
|
||||
variant="contained"
|
||||
size={size || 'medium'}
|
||||
color="primary"
|
||||
disabled={!provider}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// @flow
|
||||
import { createBrowserHistory } from 'history'
|
||||
import { routerMiddleware, routerReducer } from 'react-router-redux'
|
||||
import createBrowserHistory from 'history/createBrowserHistory'
|
||||
import { connectRouter, routerMiddleware } from 'connected-react-router'
|
||||
import { combineReducers, createStore, applyMiddleware, compose, type Reducer, type Store } from 'redux'
|
||||
import thunk from 'redux-thunk'
|
||||
import provider, { PROVIDER_REDUCER_ID, type State as ProviderState } from '~/logic/wallets/store/reducer/provider'
|
||||
import safe, { SAFE_REDUCER_ID, type State as SafeState, safesInitialState } from '~/routes/safe/store/reducer/safe'
|
||||
import tokens, { TOKEN_REDUCER_ID, type State as TokensState } from '~/routes/tokens/store/reducer/tokens'
|
||||
import transactions, { type State as TransactionsState, TRANSACTIONS_REDUCER_ID } from '~/routes/safe/store/reducer/transactions'
|
||||
import transactions, {
|
||||
type State as TransactionsState,
|
||||
TRANSACTIONS_REDUCER_ID,
|
||||
} from '~/routes/safe/store/reducer/transactions'
|
||||
|
||||
export const history = createBrowserHistory()
|
||||
|
||||
// eslint-disable-next-line
|
||||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
|
||||
const finalCreateStore = composeEnhancers(applyMiddleware(
|
||||
thunk,
|
||||
routerMiddleware(history),
|
||||
))
|
||||
const finalCreateStore = composeEnhancers(applyMiddleware(thunk, routerMiddleware(history)))
|
||||
|
||||
export type GlobalState = {
|
||||
providers: ProviderState,
|
||||
|
@ -27,7 +27,7 @@ export type GlobalState = {
|
|||
export type GetState = () => GlobalState
|
||||
|
||||
const reducers: Reducer<GlobalState> = combineReducers({
|
||||
routing: routerReducer,
|
||||
router: connectRouter(history),
|
||||
[PROVIDER_REDUCER_ID]: provider,
|
||||
[SAFE_REDUCER_ID]: safe,
|
||||
[TOKEN_REDUCER_ID]: tokens,
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
// @flow
|
||||
import { createMuiTheme } from '@material-ui/core/styles'
|
||||
import { largeFontSize, mediumFontSize, smallFontSize, disabled, primary, secondary, md, lg, bolderFont, boldFont, buttonLargeFontSize } from './variables'
|
||||
import {
|
||||
largeFontSize,
|
||||
mediumFontSize,
|
||||
smallFontSize,
|
||||
disabled,
|
||||
primary,
|
||||
secondary,
|
||||
md,
|
||||
lg,
|
||||
bolderFont,
|
||||
boldFont,
|
||||
buttonLargeFontSize,
|
||||
} from './variables'
|
||||
|
||||
export type WithStyles = {
|
||||
classes: Object,
|
||||
|
@ -31,12 +43,12 @@ export default createMuiTheme({
|
|||
root: {
|
||||
fontFamily: 'Roboto Mono, monospace',
|
||||
letterSpacing: '0.9px',
|
||||
'&:disabled': {
|
||||
'&$disabled': {
|
||||
color: disabled,
|
||||
},
|
||||
color: disabled,
|
||||
},
|
||||
disabled: {
|
||||
'&$disabled': {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
contained: {
|
||||
|
@ -160,7 +172,7 @@ export default createMuiTheme({
|
|||
fontFamily: 'Roboto Mono, monospace',
|
||||
fontWeight: 'normal',
|
||||
},
|
||||
selected: {
|
||||
'&$selected': {
|
||||
fontWeight: bolderFont,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue