Commit 93bc2a54 authored by yann300's avatar yann300

renaming

parent 9ebde452
...@@ -851,7 +851,7 @@ function run () { ...@@ -851,7 +851,7 @@ function run () {
// ----------------- Tx listener ----------------- // ----------------- Tx listener -----------------
var txlistener = new Txlistener({ var txlistener = new Txlistener({
appAPI: { api: {
web3: function () { return executionContext.web3() }, web3: function () { return executionContext.web3() },
isVM: function () { return executionContext.isVM() }, isVM: function () { return executionContext.isVM() },
vm: function () { return executionContext.vm() }, vm: function () { return executionContext.vm() },
...@@ -865,7 +865,7 @@ function run () { ...@@ -865,7 +865,7 @@ function run () {
return executionContext.getProvider() return executionContext.getProvider()
} }
}, },
appEvent: { event: {
executionContext: executionContext.event, executionContext: executionContext.event,
udapp: udapp.event udapp: udapp.event
} }
......
...@@ -17,19 +17,19 @@ var Web3VMProvider = remix.web3.web3VMProvider ...@@ -17,19 +17,19 @@ var Web3VMProvider = remix.web3.web3VMProvider
class TxListener { class TxListener {
constructor (opt) { constructor (opt) {
this.event = new EventManager() this.event = new EventManager()
this._appAPI = opt.appAPI this._api = opt.api
this._web3VMProvider = new Web3VMProvider() // TODO this should maybe be put in app.js this._web3VMProvider = new Web3VMProvider() // TODO this should maybe be put in app.js
this._web3VMProvider.setVM(opt.appAPI.vm()) this._web3VMProvider.setVM(opt.api.vm())
this._resolvedTransactions = {} this._resolvedTransactions = {}
this._resolvedContracts = {} this._resolvedContracts = {}
this.init() this.init()
opt.appEvent.executionContext.register('contextChanged', (context) => { opt.event.executionContext.register('contextChanged', (context) => {
if (this.loopId) { if (this.loopId) {
this.startListening(context) this.startListening(context)
} }
}) })
opt.appEvent.udapp.register('transactionExecuted', (to, data, lookupOnly, txResult) => { opt.event.udapp.register('transactionExecuted', (to, data, lookupOnly, txResult) => {
if (this.loopId && this._appAPI.isVM()) { if (this.loopId && this._api.isVM()) {
this._web3VMProvider.getTransaction(txResult.transactionHash, (error, tx) => { this._web3VMProvider.getTransaction(txResult.transactionHash, (error, tx) => {
if (error) return console.log(error) if (error) return console.log(error)
this._newBlock({ this._newBlock({
...@@ -59,15 +59,15 @@ class TxListener { ...@@ -59,15 +59,15 @@ class TxListener {
startListening () { startListening () {
this.stopListening() this.stopListening()
this.init() this.init()
if (this._appAPI.context() === 'vm') { if (this._api.context() === 'vm') {
this.loopId = 'vm-listener' this.loopId = 'vm-listener'
} else { } else {
this.loopId = setInterval(() => { this.loopId = setInterval(() => {
this._appAPI.web3().eth.getBlockNumber((error, blockNumber) => { this._api.web3().eth.getBlockNumber((error, blockNumber) => {
if (error) return console.log(error) if (error) return console.log(error)
if (!this.lastBlock || blockNumber > this.lastBlock) { if (!this.lastBlock || blockNumber > this.lastBlock) {
this.lastBlock = blockNumber this.lastBlock = blockNumber
this._appAPI.web3().eth.getBlock(this.lastBlock, true, (error, result) => { this._api.web3().eth.getBlock(this.lastBlock, true, (error, result) => {
if (!error) { if (!error) {
this._newBlock(Object.assign({type: 'web3'}, result)) this._newBlock(Object.assign({type: 'web3'}, result))
} }
...@@ -79,7 +79,7 @@ class TxListener { ...@@ -79,7 +79,7 @@ class TxListener {
} }
currentWeb3 () { // TODO this should maybe be put in app.js currentWeb3 () { // TODO this should maybe be put in app.js
return this._appAPI.isVM() ? this._web3VMProvider : this._appAPI.web3() return this._api.isVM() ? this._web3VMProvider : this._api.web3()
} }
/** /**
...@@ -131,7 +131,7 @@ class TxListener { ...@@ -131,7 +131,7 @@ class TxListener {
} }
_resolveTx (tx, cb) { _resolveTx (tx, cb) {
var contracts = this._appAPI.contracts() var contracts = this._api.contracts()
if (!contracts) return cb() if (!contracts) return cb()
var contractName var contractName
if (!tx.to) { if (!tx.to) {
...@@ -240,7 +240,6 @@ class TxListener { ...@@ -240,7 +240,6 @@ class TxListener {
} }
} }
// those function will be duplicate after the merged of the compile and run tabs split // those function will be duplicate after the merged of the compile and run tabs split
function getConstructorInterface (abi) { function getConstructorInterface (abi) {
var funABI = { 'name': '', 'inputs': [], 'type': 'constructor', 'outputs': [] } var funABI = { 'name': '', 'inputs': [], 'type': 'constructor', 'outputs': [] }
......
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