remove udapp and executionContext from universal dapp ui

pull/1/head
Iuri Matias 5 years ago committed by yann300
parent 71a083e2ea
commit 57b2963f56
  1. 4
      src/app/tabs/runTab/model/blockchain.js
  2. 2
      src/app/udapp/run-tab.js
  3. 13
      src/app/ui/universal-dapp-ui.js

@ -304,6 +304,10 @@ class Blockchain {
})
}
context () {
return (this.executionContext.isVM() ? 'memory' : 'blockchain')
}
}
module.exports = Blockchain

@ -49,7 +49,7 @@ export class RunTab extends LibraryPlugin {
}
onActivationInternal () {
this.udappUI = new UniversalDAppUI(this.blockchain, this.udapp, this.logCallback, this.executionContext)
this.udappUI = new UniversalDAppUI(this.blockchain, this.logCallback)
this.udapp.resetAPI({
getAddress: (cb) => {
cb(null, $('#txorigin').val())

@ -14,12 +14,10 @@ var txFormat = remixLib.execution.txFormat
var TreeView = require('./TreeView')
var txCallBacks = require('./sendTxCallbacks')
function UniversalDAppUI (blockchain, udapp, logCallback, executionContext) {
function UniversalDAppUI (blockchain, logCallback) {
this.blockchain = blockchain
this.udapp = udapp
this.logCallback = logCallback
this.compilerData = {contractsDetails: {}}
this.executionContext = executionContext
}
function decodeResponseToTreeView (response, fnabi) {
@ -52,11 +50,10 @@ UniversalDAppUI.prototype.renderInstance = function (contract, address, contract
// basically this has to be called for the "atAddress" (line 393) and when a contract creation succeed
// this returns a DOM element
UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address, contractName) {
var self = this
address = (address.slice(0, 2) === '0x' ? '' : '0x') + address.toString('hex')
address = ethJSUtil.toChecksumAddress(address)
var instance = yo`<div class="instance ${css.instance} ${css.hidesub}" id="instance${address}"></div>`
var context = self.udapp.context()
const context = this.blockchain.context()
var shortAddress = helper.shortenAddress(address)
var title = yo`
@ -160,8 +157,8 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
}
setLLIError('')
const fallback = self.udapp.getFallbackInterface(contractABI)
const receive = self.udapp.getReceiveInterface(contractABI)
const fallback = this.udapp.getFallbackInterface(contractABI)
const receive = this.udapp.getReceiveInterface(contractABI)
const args = {
funABI: fallback || receive,
address: address,
@ -203,7 +200,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
else if (fallback) args.funABI = fallback
if (!args.funABI) return setLLIError(`Please define a 'Fallback' function to send calldata and a either 'Receive' or payable 'Fallback' to send ethers`)
self.runTransaction(false, args, null, calldataInput.value, null)
this.runTransaction(false, args, null, calldataInput.value, null)
}
contractActionsWrapper.appendChild(lowLevelInteracions)

Loading…
Cancel
Save