move resetAPI call

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent b5296d1164
commit 96d6e137a6
  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'
var $ = require('jquery')
var csjs = require('csjs-inject')
var yo = require('yo-yo')
var async = require('async')
@ -502,6 +503,31 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var txLogger = new TxLogger() // eslint-disable-line
txLogger.event.register('debuggingRequested', (hash) => { debug.debugger().debug(hash) })
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)
var queryParams = new QueryParams()
var loadingFromGist = self.loadFromGist(queryParams.get())

@ -1,4 +1,3 @@
var $ = require('jquery')
var yo = require('yo-yo')
var EventManager = require('../../lib/events')
var globalRegistry = require('../../global/registry')
@ -24,30 +23,6 @@ class RunTab {
this._view = {}
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.instanceContainer = yo`<div class="${css.instanceContainer}"></div>`
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 () {
this.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => {
// TODO check whether the tab is configured

Loading…
Cancel
Save