diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index f08120cf84..416fa6a4ff 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -329,9 +329,10 @@ function contractDropdown (events, appAPI, appEvents, opts, self) { createPanel.innerHTML = '' if (opts.compiler.getContract && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { var ctrabi = txHelper.getConstructorInterface(getSelectedContract().contract.object.abi) + var ctrEVMbc = getSelectedContract().contract.object.evm.bytecode.object var createConstructorInstance = new MultiParamManager(0, ctrabi, (valArray, inputsValues) => { createInstance(inputsValues) - }, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy') + }, txHelper.inputParametersDeclarationToString(ctrabi.inputs), 'Deploy', ctrEVMbc) createPanel.appendChild(createConstructorInstance.render()) return } else { diff --git a/src/app/ui/copy-to-clipboard.js b/src/app/ui/copy-to-clipboard.js index 146c1ebc32..c1875a62e3 100644 --- a/src/app/ui/copy-to-clipboard.js +++ b/src/app/ui/copy-to-clipboard.js @@ -14,14 +14,20 @@ var css = csjs` } ` -module.exports = function copyToClipboard (getContent) { - var copyIcon = yo`` +module.exports = function copyToClipboard (getContent, tip = 'Copy value to clipboard', icon = 'fa-clipboard') { + var copyIcon = yo`` copyIcon.style.color = styles.remix.icon_Color_CopyToClipboard copyIcon.onmouseenter = function (event) { copyIcon.style.color = styles.remix.icon_HoverColor_CopyToClipboard } copyIcon.onmouseleave = function (event) { copyIcon.style.color = styles.remix.icon_Color_CopyToClipboard } copyIcon.onclick = (event) => { event.stopPropagation() - var copiableContent = getContent() + var copiableContent + try { + copiableContent = getContent() + } catch (e) { + addTooltip(e.message) + return + } if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory try { if (typeof copiableContent !== 'string') { @@ -29,7 +35,7 @@ module.exports = function copyToClipboard (getContent) { } } catch (e) {} copy(copiableContent) - addTooltip('Successfully copied!') + addTooltip(tip) } } return copyIcon diff --git a/src/multiParamManager.js b/src/multiParamManager.js index 75ffc1f9fa..6e62253c08 100644 --- a/src/multiParamManager.js +++ b/src/multiParamManager.js @@ -2,6 +2,9 @@ var yo = require('yo-yo') var css = require('./universal-dapp-styles') +var copyToClipboard = require('./app/ui/copy-to-clipboard') +var remixLib = require('remix-lib') +var txFormat = remixLib.execution.txFormat class MultiParamManager { @@ -12,14 +15,16 @@ class MultiParamManager { * @param {Function} clickMultiCallBack * @param {string} inputs * @param {string} title + * @param {string} evmBC * */ - constructor (lookupOnly, funABI, clickCallBack, inputs, title) { + constructor (lookupOnly, funABI, clickCallBack, inputs, title, evmBC) { this.lookupOnly = lookupOnly this.funABI = funABI this.clickCallBack = clickCallBack this.inputs = inputs this.title = title + this.evmBC = evmBC this.basicInputField this.multiFields } @@ -147,6 +152,22 @@ class MultiParamManager { ${this.multiFields}