remove udapp and executionContext from universal dapp ui

pull/1/head
Iuri Matias 5 years ago
parent 36e72f9290
commit c11bb34c35
  1. 4
      src/app/tabs/runTab/model/blockchain.js
  2. 2
      src/app/udapp/run-tab.js
  3. 20
      src/app/ui/universal-dapp-ui.js

@ -306,6 +306,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())

@ -11,18 +11,17 @@ var css = require('../../universal-dapp-styles')
var MultiParamManager = require('./multiParamManager')
var remixLib = require('remix-lib')
var txFormat = remixLib.execution.txFormat
var txHelper = remixLib.execution.txHelper
var confirmDialog = require('./confirmDialog')
var modalCustom = require('./modal-dialog-custom')
var modalDialog = require('./modaldialog')
var TreeView = require('./TreeView')
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) {
@ -46,7 +45,7 @@ UniversalDAppUI.prototype.renderInstance = function (contract, address, contract
if (noInstances) {
noInstances.parentNode.removeChild(noInstances)
}
var abi = this.udapp.getABI(contract)
const abi = txHelper.sortAbiFunction(contract.abi)
return this.renderInstanceFromABI(abi, address, contractName)
}
@ -55,11 +54,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`
@ -111,7 +109,8 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
instance.appendChild(contractActionsWrapper)
// Add the fallback function
var fallback = self.udapp.getFallbackInterface(contractABI)
const fallback = txHelper.getFallbackInterface(contractABI)
if (fallback) {
contractActionsWrapper.appendChild(this.getCallButton({
funABI: fallback,
@ -226,9 +225,14 @@ UniversalDAppUI.prototype.getCallButton = function (args) {
self.blockchain.runOrCallContractMethod(args.contractName, args.contractAbi, args.funABI, inputsValues, args.address, callType, lookupOnly, logMsg, self.logCallback, outputCb, confirmationCb, continueCb, promptCb)
}
let inputs = ''
if (args.funABI.inputs) {
inputs = txHelper.inputParametersDeclarationToString(args.funABI.inputs)
}
const multiParamManager = new MultiParamManager(lookupOnly, args.funABI, (valArray, inputsValues, domEl) => {
clickButton(valArray, inputsValues, domEl)
}, self.udapp.getInputs(args.funABI))
}, inputs)
const contractActionsContainer = yo`<div class="${css.contractActionsContainer}" >${multiParamManager.render()}</div>`
contractActionsContainer.appendChild(outputOverride)

Loading…
Cancel
Save