Use the current contract name for Solidity compilation (#4510)
This commit is contained in:
parent
48ae38eaf9
commit
da2e28dad1
@ -18,14 +18,14 @@ import solc from 'solc/browser-wrapper';
|
|||||||
|
|
||||||
export default class SolidityUtils {
|
export default class SolidityUtils {
|
||||||
static compile (data, compiler) {
|
static compile (data, compiler) {
|
||||||
const { sourcecode, build, optimize, files } = data;
|
const { sourcecode, build, optimize, files, name = '' } = data;
|
||||||
|
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
|
|
||||||
console.log('[solidity] compiling...');
|
console.log('[solidity] compiling...');
|
||||||
|
|
||||||
const input = {
|
const input = {
|
||||||
'': sourcecode
|
[ name ]: sourcecode
|
||||||
};
|
};
|
||||||
|
|
||||||
const findFiles = (path) => {
|
const findFiles = (path) => {
|
||||||
|
@ -259,10 +259,15 @@ export default class WriteContractStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compile = (data) => {
|
compile = (data) => {
|
||||||
|
const { name = '' } = this.selectedContract;
|
||||||
|
|
||||||
if (this.useWorker) {
|
if (this.useWorker) {
|
||||||
return this.worker.postMessage({
|
return this.worker.postMessage({
|
||||||
action: 'compile',
|
action: 'compile',
|
||||||
data
|
data: {
|
||||||
|
...data,
|
||||||
|
name
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +276,10 @@ export default class WriteContractStore {
|
|||||||
this
|
this
|
||||||
.getCompiler(data.build)
|
.getCompiler(data.build)
|
||||||
.then((compiler) => {
|
.then((compiler) => {
|
||||||
return SolidityUtils.compile(data, compiler);
|
return SolidityUtils.compile({
|
||||||
|
...data,
|
||||||
|
name
|
||||||
|
}, compiler);
|
||||||
})
|
})
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
|
Loading…
Reference in New Issue
Block a user