Commit ee41116c authored by yann300's avatar yann300

use modalDialogCustom

parent c9a27536
......@@ -341,11 +341,17 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
var address = atAddressButtonInput.value
if (/.(.abi)$/.exec(appAPI.currentFile())) {
if (confirm('Do you really want to interact with ' + address + ' using the current abi definition ?')) {
instanceContainer.appendChild(appAPI.udapp().renderInstance(appAPI.editorContent(), address, ' - '))
}
modalDialogCustom.confirm(null, 'Do you really want to interact with ' + address + ' using the current ABI definition ?', () => {
var abi
try {
abi = JSON.parse(appAPI.editorContent())
} catch (e) {
return modalDialogCustom.alert('Failed to parse the current file as JSON ABI.')
}
instanceContainer.appendChild(appAPI.udapp().renderInstanceFromABI(abi, address, address))
})
} else {
var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerText]
var contract = appAPI.getContract(contractNames.children[contractNames.selectedIndex].innerHTML)
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract.object, address, selectContractNames.value))
}
}
......
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