Can't deploy without compiling Contract (#5593)
This commit is contained in:
parent
c58c253cbf
commit
0a16c350d1
@ -345,12 +345,13 @@ class WriteContract extends Component {
|
|||||||
}
|
}
|
||||||
onClick={ this.store.handleCompile }
|
onClick={ this.store.handleCompile }
|
||||||
primary={ false }
|
primary={ false }
|
||||||
disabled={ compiling }
|
disabled={ compiling || this.store.isPristine }
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
contract
|
contract
|
||||||
? (
|
? (
|
||||||
<Button
|
<Button
|
||||||
|
disabled={ compiling || !this.store.isPristine }
|
||||||
icon={ <SendIcon /> }
|
icon={ <SendIcon /> }
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { action, observable, transaction } from 'mobx';
|
import { action, computed, observable, transaction } from 'mobx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import store from 'store';
|
import store from 'store';
|
||||||
@ -140,7 +140,7 @@ export default class WriteContractStore {
|
|||||||
this.worker = worker;
|
this.worker = worker;
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
this.fetchSolidityVersions(),
|
this.fetchSolidityVersions().then(() => this.handleCompile()),
|
||||||
this.reloadContracts(undefined, undefined, false)
|
this.reloadContracts(undefined, undefined, false)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -316,6 +316,18 @@ export default class WriteContractStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@computed get isPristine () {
|
||||||
|
return this.getHash() === this.lastCompilation.hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
getHash () {
|
||||||
|
const build = this.builds[this.selectedBuild];
|
||||||
|
const version = build.longVersion;
|
||||||
|
const sourcecode = this.sourcecode.replace(/\s+/g, ' ');
|
||||||
|
|
||||||
|
return sha3(JSON.stringify({ version, sourcecode, optimize: this.optimize }));
|
||||||
|
}
|
||||||
|
|
||||||
@action handleCompile = () => {
|
@action handleCompile = () => {
|
||||||
transaction(() => {
|
transaction(() => {
|
||||||
this.compiled = false;
|
this.compiled = false;
|
||||||
@ -324,9 +336,7 @@ export default class WriteContractStore {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const build = this.builds[this.selectedBuild];
|
const build = this.builds[this.selectedBuild];
|
||||||
const version = build.longVersion;
|
const hash = this.getHash();
|
||||||
const sourcecode = this.sourcecode.replace(/\s+/g, ' ');
|
|
||||||
const hash = sha3(JSON.stringify({ version, sourcecode, optimize: this.optimize }));
|
|
||||||
|
|
||||||
let promise = Promise.resolve(null);
|
let promise = Promise.resolve(null);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user