Commit 1732e9e7 authored by Iuri Matias's avatar Iuri Matias Committed by yann300

abstract udapp plugin so it maintains backwards compatibilify with the plugin api

parent 18cadabd
......@@ -23,6 +23,7 @@ var CompilerMetadata = require('./app/files/compiler-metadata')
var CompilerImport = require('./app/compiler/compiler-imports')
const Blockchain = require('./blockchain/blockchain.js')
const PluginUDapp = require('./blockchain/pluginUDapp.js')
const PluginManagerComponent = require('./app/components/plugin-manager-component')
const CompilersArtefacts = require('./app/compiler/compiler-artefacts')
......@@ -223,6 +224,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.put({api: fileManager, name: 'filemanager'})
const blockchain = new Blockchain(registry.get('config').api)
const pluginUdapp = new PluginUDapp(blockchain)
// ----------------- compilation metadata generation servive ----------------------------
const compilerMetadataGenerator = new CompilerMetadata(blockchain, fileManager, registry.get('config').api)
......@@ -295,6 +297,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
)
const run = new RunTab(
blockchain,
pluginUdapp,
registry.get('config').api,
registry.get('filemanager').api,
registry.get('editor').api,
......
......@@ -33,8 +33,8 @@ const profile = {
export class RunTab extends LibraryPlugin {
constructor (blockchain, config, fileManager, editor, filePanel, compilersArtefacts, networkModule, mainView) {
super(blockchain.udapp, profile)
constructor (blockchain, pluginUDapp, config, fileManager, editor, filePanel, compilersArtefacts, networkModule, mainView) {
super(pluginUDapp, profile)
this.event = new EventManager()
this.config = config
this.blockchain = blockchain
......
const { EventEmitter } = require('events')
class PluginUdapp {
constructor (blockchain) {
this.blockchain = blockchain
this.events = new EventEmitter()
this.setupEvents()
}
setupEvents () {
this.blockchain.event.register('newTransaction', (tx, receipt) => {
this.events.trigger('newTransaction', [tx, receipt])
})
}
createVMAccount (newAccount) {
return this.blockchain.udapp.createVMAccount(newAccount)
}
sendTransaction (tx) {
return this.blockchain.udapp.sendTransaction(tx)
}
getAccounts (cb) {
return this.blockchain.udapp.getAccounts(cb)
}
pendingTransactionsCount () {
return this.blockchain.udapp.pendingTransactionsCount()
}
}
module.exports = PluginUdapp
......@@ -6,7 +6,6 @@ const { EventEmitter } = require('events')
const remixLib = require('remix-lib')
const TxRunner = remixLib.execution.txRunner
const txHelper = remixLib.execution.txHelper
const EventManager = remixLib.EventManager
const Web3 = require('web3')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment