migrate to embark 3.2

This commit is contained in:
Barry Gitarts 2018-09-28 15:12:52 -04:00 committed by Barry G
parent b1e6242972
commit 513058bbff
6 changed files with 41 additions and 14 deletions

View File

@ -1,4 +1,24 @@
{ {
"plugins": ["transform-object-rest-spread"], "plugins": [
"presets": ["stage-2"] "@babel/plugin-proposal-object-rest-spread",
} "@babel/plugin-syntax-dynamic-import",
"@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"
],
"presets": [],
"ignore": [
"config/",
"node_modules"
]
}

View File

@ -33,6 +33,7 @@ const DisplayBox = ({ displayType, pubKey }) => (
</div> </div>
); );
const formRef = React.createRef();
const displayTerms = status => status === 'terms'; const displayTerms = status => status === 'terms';
const InnerForm = ({ const InnerForm = ({
values, values,
@ -51,7 +52,7 @@ const InnerForm = ({
SNTAllowance, SNTAllowance,
SNTBalance, SNTBalance,
}) => ( }) => (
<form onSubmit={handleSubmit} ref={node => (this.form = node)}> <form onSubmit={handleSubmit} ref={formRef}>
<div style={{ margin: '10px' }}> <div style={{ margin: '10px' }}>
{!subDomain && {!subDomain &&
<FieldGroup <FieldGroup
@ -157,7 +158,7 @@ const InnerForm = ({
{/*</Field>*/} {/*</Field>*/}
<div style={{ position: 'relative', left: 0, right: 0, bottom: 0 }}> <div style={{ position: 'relative', left: 0, right: 0, bottom: 0 }}>
{!isSubmitting ? <MobileButton onClick={() => { setStatus('terms') }} text={`${editAccount ? 'Save' : 'Register'} with transaction`} style={{ width: '100%' }} /> : <CircularProgress style={{ marginLeft: '45%' }} />} {!isSubmitting ? <MobileButton onClick={() => { setStatus('terms') }} text={`${editAccount ? 'Save' : 'Register'} with transaction`} style={{ width: '100%' }} /> : <CircularProgress style={{ marginLeft: '45%' }} />}
<Terms open={displayTerms(status)} onSubmit={() => { setStatus(null); this.form.dispatchEvent(new Event('submit')) }} /> <Terms open={displayTerms(status)} onSubmit={() => { setStatus(null); formRef.dispatchEvent(new Event('submit')) }} />
</div> </div>
</Hidden> </Hidden>
</div> </div>

View File

@ -8,6 +8,6 @@ export const nullAddress = '0x0000000000000000000000000000000000000000';
export const getResolver = async node => { export const getResolver = async node => {
const resolverAddress = await resolver(node).call(); const resolverAddress = await resolver(node).call();
return resolverAddress !== nullAddress return resolverAddress !== nullAddress
? new EmbarkJS.Contract({ abi: PublicResolver._jsonInterface, address: resolverAddress }) ? new EmbarkJS.Blockchain.Contract({ abi: PublicResolver._jsonInterface, address: resolverAddress })
: PublicResolver : PublicResolver
} }

View File

@ -40,9 +40,8 @@ class App extends React.Component {
state = { admin: false, searching: false }; state = { admin: false, searching: false };
componentDidMount(){ componentDidMount(){
__embarkContext.execWhenReady(() => { EmbarkJS.onReady((err) => {
getNetworkType().then(network => { this.setState({ network })}); getNetworkType().then(network => { this.setState({ network })});
}); });
} }

View File

@ -6,7 +6,7 @@ import { fetchAndDispatchSNTAllowance, fetchAndDispatchAccountsWithBalances, che
const dispatch = action => store.dispatch(action) const dispatch = action => store.dispatch(action)
export default () => { export default () => {
__embarkContext.execWhenReady(async () => { EmbarkJS.onReady(async (err) => {
fetchAndDispatchAccountsWithBalances(web3, dispatch) fetchAndDispatchAccountsWithBalances(web3, dispatch)
checkAndDispatchStatusContactCode(dispatch) checkAndDispatchStatusContactCode(dispatch)
fetchAndDispatchSNTAllowance(dispatch) fetchAndDispatchSNTAllowance(dispatch)

View File

@ -18,7 +18,6 @@
}, },
"homepage": "https://github.com/status-im/contracts#readme", "homepage": "https://github.com/status-im/contracts#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "7.0.0-beta.55",
"@material-ui/core": "^1.2.1", "@material-ui/core": "^1.2.1",
"@material-ui/icons": "^1.1.0", "@material-ui/icons": "^1.1.0",
"bignumber.js": "^5.0.0", "bignumber.js": "^5.0.0",
@ -30,11 +29,11 @@
"install": "^0.11.0", "install": "^0.11.0",
"npm": "^6.1.0", "npm": "^6.1.0",
"prop-types": "^15.6.1", "prop-types": "^15.6.1",
"react": "^16.3.2", "react": "^16.4.2",
"react-blockies": "^1.3.0", "react-blockies": "^1.3.0",
"react-bootstrap": "^0.32.1", "react-bootstrap": "^0.32.1",
"react-copy-to-clipboard": "^5.0.1", "react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.3.2", "react-dom": "^16.4.2",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",
"react-toggle": "^4.0.2", "react-toggle": "^4.0.2",
"redux": "^4.0.0", "redux": "^4.0.0",
@ -46,8 +45,16 @@
"web3-utils": "^1.0.0-beta.34" "web3-utils": "^1.0.0-beta.34"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-object-rest-spread": "^6.26.0", "@babel/plugin-proposal-class-properties": "^7.0.0",
"babel-preset-stage-2": "^6.24.1", "@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^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",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.12.0", "eslint-plugin-import": "^2.12.0",