fix using compilersartefacts

pull/1/head
yann300 6 years ago
parent 4f8c309931
commit 07d2e60f12
  1. 2
      src/app.js
  2. 2
      src/app/panels/righthand-panel.js
  3. 2
      src/app/tabs/run-tab.js
  4. 12
      src/app/tabs/runTab/model/dropdownlogic.js
  5. 8
      src/universal-dapp-ui.js
  6. 5
      src/universal-dapp.js

@ -313,7 +313,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'})
// ----------------- UniversalDApp -----------------
var udapp = new UniversalDApp(registry.get('config').api)
var udapp = new UniversalDApp(registry)
// TODO: to remove when possible
registry.put({api: udapp, name: 'udapp'})
udapp.event.register('transactionBroadcasted', (txhash, networkName) => {

@ -47,7 +47,7 @@ const css = csjs`
`
class RighthandPanel {
constructor (localRegistry) {
constructor ({pluginManager, tabs}, localRegistry) {
const self = this
self._components = {}
self._components.registry = localRegistry || globalRegistry

@ -9,7 +9,7 @@ var css = require('./styles/run-tab-styles')
var Settings = require('./runTab/model/settings.js')
var SettingsUI = require('./runTab/settings.js')
var DropdownLogic = require('./runTab/model/dropdownLogic.js')
var DropdownLogic = require('./runTab/model/dropdownlogic.js')
var ContractDropdownUI = require('./runTab/contractDropdown.js')
var Recorder = require('./runTab/model/recorder.js')

@ -30,19 +30,11 @@ class DropdownLogic {
listenToCompilationEvents () {
this.pluginManager.event.register('sendCompilationResult', (file, source, languageVersion, data) => {
// TODO check whether the tab is configured
let compiler = new CompilerAbstract(languageVersion, data)
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.compiler.event.register('compilationFinished', (success, data, source) => {
var name = 'solidity'
let compiler = new CompilerAbstract(name, data)
this.compilersArtefacts[name] = compiler
this.compilersArtefacts['__last'] = compiler
this.event.trigger('newlyCompiled', [success, data, source, this.compiler, name])
})
}
loadContractFromAddress (address, confirmCb, cb) {
@ -278,7 +270,7 @@ class DropdownLogic {
this.filePanel.compilerMetadata().deployMetadataOf(selectedContract.name, (error, contractMetadata) => {
if (error) return statusCb(`creation of ${selectedContract.name} errored: ` + error)
if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) {
return txFormat.buildData(selectedContract.name, selectedContract.object, selectedContract.compiler.getContracts(), true, constructor, args, (error, data) => {
return txFormat.buildData(selectedContract.name, selectedContract.object, this.compilersArtefacts['__last'].getData().contracts, true, constructor, args, (error, data) => {
if (error) return statusCb(`creation of ${selectedContract.name} errored: ` + error)
statusCb(`creation of ${selectedContract.name} pending...`)

@ -26,9 +26,9 @@ function UniversalDAppUI (udapp, registry) {
this.registry = registry
this.compilerData = {contractsDetails: {}}
registry.get('compiler').api.event.register('compilationFinished', (success, data, source) => {
this.compilerData.contractsDetails = success && data ? data.contracts : {}
})
this._deps = {
compilersartefacts: registry.get('compilersartefacts').api
}
}
function decodeResponseToTreeView (response, fnabi) {
@ -220,7 +220,7 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
}
// contractsDetails is used to resolve libraries
txFormat.buildData(args.contractName, args.contractAbi, self.compilerData.contractsDetails, false, args.funABI, args.funABI.type !== 'fallback' ? value : '', (error, data) => {
txFormat.buildData(args.contractName, args.contractAbi, self._deps.compilersartefacts['__last'].getData().contracts, false, args.funABI, args.funABI.type !== 'fallback' ? value : '', (error, data) => {
if (!error) {
if (!args.funABI.constant) {
self.registry.get('logCallback').api(`${logMsg} pending ... `)

@ -8,12 +8,11 @@ var txHelper = remixLib.execution.txHelper
var EventManager = remixLib.EventManager
var executionContext = remixLib.execution.executionContext
function UniversalDApp (config) {
function UniversalDApp (registry) {
this.event = new EventManager()
var self = this
self._deps = {
config: globalRegistry.get('config').api,
compiler: globalRegistry.get('compiler').api
config: registry.get('config').api
}
self._txRunnerAPI = {
config: self._deps.config,

Loading…
Cancel
Save