Merge pull request #2286 from ethereum/fixListeningOnVyper

Fix listening on vyper
pull/3094/head
yann300 6 years ago committed by GitHub
commit a1f685fd15
  1. 6
      src/app/tabs/runTab/contractDropdown.js
  2. 12
      src/app/tabs/runTab/model/dropdownlogic.js

@ -17,14 +17,14 @@ class ContractDropdownUI {
}
listenToEvents () {
this.dropdownLogic.event.register('newlyCompiled', (success, data, source, compiler, compilerFullName) => {
this.dropdownLogic.event.register('newlyCompiled', (success, data, source, compiler, compilerFullName, file) => {
if (!document.querySelector(`.${css.contractNames.classNames[0]}`)) return
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
contractNames.innerHTML = ''
if (success) {
this.selectContractNames.removeAttribute('disabled')
this.dropdownLogic.getCompiledContracts(compiler, compilerFullName).forEach((contract) => {
contractNames.appendChild(yo`<option compiler="${compilerFullName}">${contract.name}</option>`)
contractNames.appendChild(yo`<option value="${contract.name}" compiler="${compilerFullName}">${contract.name} - ${file}</option>`)
})
} else {
this.selectContractNames.setAttribute('disabled', true)
@ -124,7 +124,7 @@ class ContractDropdownUI {
getSelectedContract () {
var contract = this.selectContractNames.children[this.selectContractNames.selectedIndex]
var contractName = contract.innerHTML
var contractName = contract.getAttribute('value')
var compilerAtributeName = contract.getAttribute('compiler')
return this.dropdownLogic.getSelectedContract(contractName, compilerAtributeName)

@ -28,13 +28,19 @@ class DropdownLogic {
// TODO: can be moved up; the event in contractDropdown will have to refactored a method instead
listenToCompilationEvents () {
this.runView.on('solidity', 'compilationFinished', (file, source, languageVersion, data) => {
let broadcastCompilationResult = (file, source, languageVersion, data) => {
// TODO check whether the tab is configured
let compiler = new CompilerAbstract(languageVersion, data, source)
this.compilersArtefacts[languageVersion] = compiler
this.compilersArtefacts['__last'] = compiler
this.event.trigger('newlyCompiled', [true, data, source, compiler, languageVersion])
})
this.event.trigger('newlyCompiled', [true, data, source, compiler, languageVersion, file])
}
this.runView.on('solidity', 'compilationFinished', (file, source, languageVersion, data) =>
broadcastCompilationResult(file, source, languageVersion, data)
)
this.runView.on('vyper', 'compilationFinished', (file, source, languageVersion, data) =>
broadcastCompilationResult(file, source, languageVersion, data)
)
}
loadContractFromAddress (address, confirmCb, cb) {

Loading…
Cancel
Save