remove udapp && udappUI

pull/3094/head
yann300 7 years ago
parent 6ed42d2360
commit 2c0f111f8a
  1. 7
      src/app.js
  2. 22
      src/app/tabs/run-tab.js
  3. 5
      src/recorder.js

@ -716,12 +716,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
visitContracts: (cb) => { visitContracts: (cb) => {
compiler.visitContracts(cb) compiler.visitContracts(cb)
}, },
udapp: () => {
return udapp
},
udappUI: () => {
return udappUI
},
switchFile: function (path) { switchFile: function (path) {
fileManager.switchFile(path) fileManager.switchFile(path)
}, },
@ -775,6 +769,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var rhpOpts = { var rhpOpts = {
pluginAPI: new PluginAPI(self, compiler), pluginAPI: new PluginAPI(self, compiler),
udapp: udapp, udapp: udapp,
udappUI: udappUI,
compiler: compiler, compiler: compiler,
renderer: renderer renderer: renderer
} }

@ -55,7 +55,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
// PENDING transactions // PENDING transactions
function updatePendingTxs (container, appAPI) { function updatePendingTxs (container, appAPI) {
var pendingCount = Object.keys(appAPI.udapp().pendingTransactions()).length var pendingCount = Object.keys(opts.udapp.pendingTransactions()).length
pendingTxsText.innerText = pendingCount + ' pending transactions' pendingTxsText.innerText = pendingCount + ' pending transactions'
} }
@ -90,7 +90,7 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
executionContext.event.register('contextChanged', (context, silent) => { executionContext.event.register('contextChanged', (context, silent) => {
setFinalContext() setFinalContext()
}) })
fillAccountsList(appAPI, el) fillAccountsList(appAPI, opts, el)
setInterval(() => { setInterval(() => {
updateAccountBalances(container, appAPI) updateAccountBalances(container, appAPI)
updatePendingTxs(container, appAPI) updatePendingTxs(container, appAPI)
@ -104,10 +104,10 @@ function runTab (appAPI = {}, appEvents = {}, opts = {}) {
return { render () { return container } } return { render () { return container } }
} }
function fillAccountsList (appAPI, container) { function fillAccountsList (appAPI, opts, container) {
var $txOrigin = $(container.querySelector('#txorigin')) var $txOrigin = $(container.querySelector('#txorigin'))
$txOrigin.empty() $txOrigin.empty()
appAPI.udapp().getAccounts((err, accounts) => { opts.udapp.getAccounts((err, accounts) => {
if (err) { addTooltip(`Cannot get account list: ${err}`) } if (err) { addTooltip(`Cannot get account list: ${err}`) }
if (accounts && accounts[0]) { if (accounts && accounts[0]) {
for (var a in accounts) { $txOrigin.append($('<option />').val(accounts[a]).text(accounts[a])) } for (var a in accounts) { $txOrigin.append($('<option />').val(accounts[a]).text(accounts[a])) }
@ -190,8 +190,8 @@ function makeRecorder (events, appAPI, appEvents, opts) {
} }
if (txArray.length) { if (txArray.length) {
noInstancesText.style.display = 'none' noInstancesText.style.display = 'none'
recorder.run(txArray, accounts, options, abis, linkReferences, (abi, address, contractName) => { recorder.run(txArray, accounts, options, abis, linkReferences, opts.udapp, (abi, address, contractName) => {
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, contractName)) instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, contractName))
}) })
} }
} else { } else {
@ -284,7 +284,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) {
txFormat.buildData(selectedContract.name, selectedContract.contract.object, opts.compiler.getContracts(), true, constructor, args, (error, data) => { txFormat.buildData(selectedContract.name, selectedContract.contract.object, opts.compiler.getContracts(), true, constructor, args, (error, data) => {
if (!error) { if (!error) {
appAPI.logMessage(`creation of ${selectedContract.name} pending...`) appAPI.logMessage(`creation of ${selectedContract.name} pending...`)
appAPI.udapp().createContract(data, (error, txResult) => { opts.udapp.createContract(data, (error, txResult) => {
if (!error) { if (!error) {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
if (isVM) { if (isVM) {
@ -296,7 +296,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) {
} }
noInstancesText.style.display = 'none' noInstancesText.style.display = 'none'
var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress var address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress
instanceContainer.appendChild(appAPI.udappUI().renderInstance(selectedContract.contract.object, address, selectContractNames.value)) instanceContainer.appendChild(opts.udappUI.renderInstance(selectedContract.contract.object, address, selectContractNames.value))
} else { } else {
appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error) appAPI.logMessage(`creation of ${selectedContract.name} errored: ` + error)
} }
@ -308,7 +308,7 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) {
appAPI.logMessage(msg) appAPI.logMessage(msg)
}, (data, runTxCallback) => { }, (data, runTxCallback) => {
// called for libraries deployment // called for libraries deployment
appAPI.udapp().runTx(data, runTxCallback) opts.udapp.runTx(data, runTxCallback)
}) })
} }
@ -330,11 +330,11 @@ function contractDropdown (events, appAPI, appEvents, opts, instanceContainer) {
} catch (e) { } catch (e) {
return modalDialogCustom.alert('Failed to parse the current file as JSON ABI.') return modalDialogCustom.alert('Failed to parse the current file as JSON ABI.')
} }
instanceContainer.appendChild(appAPI.udappUI().renderInstanceFromABI(abi, address, address)) instanceContainer.appendChild(opts.udappUI.renderInstanceFromABI(abi, address, address))
}) })
} else { } else {
var contract = opts.compiler.getContract(contractNames.children[contractNames.selectedIndex].innerHTML) var contract = opts.compiler.getContract(contractNames.children[contractNames.selectedIndex].innerHTML)
instanceContainer.appendChild(appAPI.udappUI().renderInstance(contract.object, address, selectContractNames.value)) instanceContainer.appendChild(opts.udappUI.renderInstance(contract.object, address, selectContractNames.value))
} }
} }

@ -175,10 +175,11 @@ class Recorder {
* @param {Object} accounts * @param {Object} accounts
* @param {Object} options * @param {Object} options
* @param {Object} abis * @param {Object} abis
* @param {Object} udapp
* @param {Function} newContractFn * @param {Function} newContractFn
* *
*/ */
run (records, accounts, options, abis, linkReferences, newContractFn) { run (records, accounts, options, abis, linkReferences, udapp, newContractFn) {
var self = this var self = this
self.setListen(false) self.setListen(false)
self._api.logMessage(`Running ${records.length} transaction(s) ...`) self._api.logMessage(`Running ${records.length} transaction(s) ...`)
@ -242,7 +243,7 @@ class Recorder {
self._api.logMessage(`(${index}) data: ${data.data}`) self._api.logMessage(`(${index}) data: ${data.data}`)
record.data = { dataHex: data.data, funArgs: tx.record.parameters, funAbi: fnABI, contractBytecode: tx.record.bytecode, contractName: tx.record.contractName } record.data = { dataHex: data.data, funArgs: tx.record.parameters, funAbi: fnABI, contractBytecode: tx.record.bytecode, contractName: tx.record.contractName }
} }
self._api.udapp().runTx(record, function (err, txResult) { udapp.runTx(record, function (err, txResult) {
if (err) { if (err) {
console.error(err) console.error(err)
self._api.logMessage(err + '. Execution failed at ' + index) self._api.logMessage(err + '. Execution failed at ' + index)

Loading…
Cancel
Save