move resetAPI call

pull/1/head
Iuri Matias 6 years ago
parent aee8ae83b3
commit 2fd5d09320
  1. 26
      src/app.js
  2. 25
      src/app/tabs/run-tab.js
  3. 1
      src/app/tabs/runTab/model/dropdownlogic.js

@ -1,5 +1,6 @@
'use strict' 'use strict'
var $ = require('jquery')
var csjs = require('csjs-inject') var csjs = require('csjs-inject')
var yo = require('yo-yo') var yo = require('yo-yo')
var async = require('async') var async = require('async')
@ -441,6 +442,31 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
test: new TestTab(self._components.registry, compileTab) test: new TestTab(self._components.registry, compileTab)
} }
let transactionContextAPI = {
getAddress: (cb) => {
cb(null, $('#txorigin').val())
},
getValue: (cb) => {
try {
var number = document.querySelector('#value').value
var select = document.getElementById('unit')
var index = select.selectedIndex
var selectedUnit = select.querySelectorAll('option')[index].dataset.unit
var unit = 'ether' // default
if (['ether', 'finney', 'gwei', 'wei'].indexOf(selectedUnit) >= 0) {
unit = selectedUnit
}
cb(null, executionContext.web3().toWei(number, unit))
} catch (e) {
cb(e)
}
},
getGasLimit: (cb) => {
cb(null, $('#gasLimit').val())
}
}
udapp.resetAPI(transactionContextAPI)
// ---------------- Righthand-panel -------------------- // ---------------- Righthand-panel --------------------
self._components.righthandpanel = new RighthandPanel({ tabs, pluginManager }) self._components.righthandpanel = new RighthandPanel({ tabs, pluginManager })
self._view.rightpanel.appendChild(self._components.righthandpanel.render()) self._view.rightpanel.appendChild(self._components.righthandpanel.render())

@ -1,4 +1,3 @@
var $ = require('jquery')
var yo = require('yo-yo') var yo = require('yo-yo')
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
var globalRegistry = require('../../global/registry') var globalRegistry = require('../../global/registry')
@ -24,30 +23,6 @@ class RunTab {
this._view = {} this._view = {}
this.registry = globalRegistry this.registry = globalRegistry
this.transactionContextAPI = {
getAddress: (cb) => {
cb(null, $('#txorigin').val())
},
getValue: (cb) => {
try {
var number = document.querySelector('#value').value
var select = document.getElementById('unit')
var index = select.selectedIndex
var selectedUnit = select.querySelectorAll('option')[index].dataset.unit
var unit = 'ether' // default
if (['ether', 'finney', 'gwei', 'wei'].indexOf(selectedUnit) >= 0) {
unit = selectedUnit
}
cb(null, executionContext.web3().toWei(number, unit))
} catch (e) {
cb(e)
}
},
getGasLimit: (cb) => {
cb(null, $('#gasLimit').val())
}
}
udapp.resetAPI(this.transactionContextAPI)
self._view.recorderCount = yo`<span>0</span>` self._view.recorderCount = yo`<span>0</span>`
self._view.instanceContainer = yo`<div class="${css.instanceContainer}"></div>` self._view.instanceContainer = yo`<div class="${css.instanceContainer}"></div>`
self._view.clearInstanceElement = yo` self._view.clearInstanceElement = yo`

@ -27,6 +27,7 @@ class DropdownLogic {
}) })
} }
// TODO: can be moved up; the event in contractDropdown will have to refactored a method instead
listenToCompilationEvents () { listenToCompilationEvents () {
this.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => { this.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => {
// TODO check whether the tab is configured // TODO check whether the tab is configured

Loading…
Cancel
Save