|
|
@ -263,8 +263,9 @@ export function toStandardOutput(fileName: string, compilationResult: any): any |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function compileContract(contract: string, compilerUrl: string, setOutput?: any, setLoadingSpinnerState?: React.Dispatch<React.SetStateAction<boolean>>) { |
|
|
|
export async function compileContract(contract: string, compilerUrl: string, setOutput?: any, setLoadingSpinnerState?: React.Dispatch<React.SetStateAction<boolean>>, spinner?: boolean) { |
|
|
|
remixClient.eventEmitter.emit('resetCompilerState', {}) |
|
|
|
remixClient.eventEmitter.emit('resetCompilerState', {}) |
|
|
|
|
|
|
|
spinner && spinner === true ? setLoadingSpinnerState && setLoadingSpinnerState(true) : null |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// await remixClient.discardHighlight()
|
|
|
|
// await remixClient.discardHighlight()
|
|
|
@ -276,6 +277,7 @@ export async function compileContract(contract: string, compilerUrl: string, set |
|
|
|
status: 'failed', |
|
|
|
status: 'failed', |
|
|
|
message: e.message |
|
|
|
message: e.message |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
remixClient.eventEmitter.emit('setOutput', errorGettingContract) |
|
|
|
remixClient.eventEmitter.emit('setOutput', errorGettingContract) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -293,8 +295,9 @@ export async function compileContract(contract: string, compilerUrl: string, set |
|
|
|
type: 'error', |
|
|
|
type: 'error', |
|
|
|
title: 'Compilation failed...' |
|
|
|
title: 'Compilation failed...' |
|
|
|
}) |
|
|
|
}) |
|
|
|
setLoadingSpinnerState(false) |
|
|
|
|
|
|
|
remixClient.eventEmitter.emit('setOutput', {status: 'failed', message: output.message, title: 'Error compiling...', line: output.line, column: output.column}) |
|
|
|
setLoadingSpinnerState && setLoadingSpinnerState(false) |
|
|
|
|
|
|
|
remixClient.eventEmitter.emit('setOutput', {status: 'failed', message: output.message, title: 'Error compiling...', line: output.line, column: output.column, key: 1 }) |
|
|
|
output = null |
|
|
|
output = null |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -306,7 +309,8 @@ export async function compileContract(contract: string, compilerUrl: string, set |
|
|
|
type: 'success', |
|
|
|
type: 'success', |
|
|
|
title: 'success' |
|
|
|
title: 'success' |
|
|
|
}) |
|
|
|
}) |
|
|
|
setLoadingSpinnerState(false) |
|
|
|
|
|
|
|
|
|
|
|
setLoadingSpinnerState && setLoadingSpinnerState(false) |
|
|
|
const data = toStandardOutput(_contract.name, output) |
|
|
|
const data = toStandardOutput(_contract.name, output) |
|
|
|
remixClient.compilationFinish(_contract.name, _contract.content, data) |
|
|
|
remixClient.compilationFinish(_contract.name, _contract.content, data) |
|
|
|
const contractName = _contract['name'] |
|
|
|
const contractName = _contract['name'] |
|
|
@ -320,9 +324,10 @@ export async function compileContract(contract: string, compilerUrl: string, set |
|
|
|
remixClient.changeStatus({ |
|
|
|
remixClient.changeStatus({ |
|
|
|
key: 'failed', |
|
|
|
key: 'failed', |
|
|
|
type: 'error', |
|
|
|
type: 'error', |
|
|
|
title: err.message |
|
|
|
title: `1 error occured ${err.message}` |
|
|
|
}) |
|
|
|
}) |
|
|
|
// setLoadingSpinnerState(false)
|
|
|
|
|
|
|
|
|
|
|
|
setLoadingSpinnerState && setLoadingSpinnerState(false) |
|
|
|
remixClient.eventEmitter.emit('setOutput', {status: 'failed', message: err.message}) |
|
|
|
remixClient.eventEmitter.emit('setOutput', {status: 'failed', message: err.message}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|