Commit 05191c14 authored by yann300's avatar yann300

don/'t add instances if the creation fails

parent 38debddc
......@@ -355,7 +355,9 @@ function contractDropdown (events, appAPI, appEvents, opts, self) {
if (!error) {
appAPI.logMessage(`creation of ${selectedContract.name} pending...`)
opts.udapp.createContract(data, (error, txResult) => {
if (!error) {
if (error) {
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error)
} else {
var isVM = executionContext.isVM()
if (isVM) {
var vmError = txExecution.checkVMError(txResult)
......@@ -364,12 +366,14 @@ function contractDropdown (events, appAPI, appEvents, opts, self) {
return
}
}
if (txResult.result.status && txResult.result.status === '0x0') {
appAPI.logMessage(`creation of ${selectedContract.name} errored: transaction execution failed`)
return
}
var noInstancesText = self._view.noInstancesText
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress
instanceContainer.appendChild(opts.udappUI.renderInstance(selectedContract.contract.object, address, selectContractNames.value))
} else {
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error)
}
})
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment