From 107bbe711250ee09c75a0cb9d770aadb785ff18e Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Tue, 29 Aug 2017 17:01:24 +0100 Subject: [PATCH 1/6] Separate keys and values --- src/app/tabs/compile-tab.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 537d787d95..6da4e91508 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -90,9 +90,20 @@ var css = csjs` } .log { display: flex; - flex-direction: row; + flex-direction: column; align-items: baseline } + .key { + margin-right: 5px; + color: grey; + text-transform: uppercase; + width: 100%; + } + .value { + display: flex; + width: 100%; + margin-top: 1.5%; + } .copyDetails { margin-left: 2%; font-size: 14px; @@ -324,8 +335,13 @@ function compileTab (container, appAPI, appEvents, opts) { var keys = Object.keys(contractsDetails[contractName]) var log = yo`
` keys.map(x => { - var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` - log.appendChild(yo`
${x}: ${JSON.stringify(details[x], null, 4)}
${copyDetails}
`) + var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` + log.appendChild(yo` +
+
${x} ${copyDetails}
+
${JSON.stringify(details[x], null, 4)}
+
+ `) }) modalDialog(contractName, log, {label: 'OK'}, {label: ''}) } From 5a31c5cd158bce697e1176d8e547236cae97de5a Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Tue, 29 Aug 2017 18:16:36 +0100 Subject: [PATCH 2/6] Display strings --- src/app/tabs/compile-tab.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 6da4e91508..cd6fdc7228 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -339,7 +339,7 @@ function compileTab (container, appAPI, appEvents, opts) { log.appendChild(yo`
${x} ${copyDetails}
-
${JSON.stringify(details[x], null, 4)}
+ ${insertValue(details, x)}
`) }) @@ -347,6 +347,19 @@ function compileTab (container, appAPI, appEvents, opts) { } } + function insertValue(details, x) { + var value = yo`
`
+      console.log(x)
+      if (x ==='bytecode'||x ==='metadataHash'||x ==='swarmLocation'||x==='Runtime Bytecode'||x==='Opcodes') {
+        var node = yo`
${JSON.stringify((details[x].slice(1, 40)+'...'), null, 4)}
` + value.appendChild(node) + } else { + var node = yo`
${JSON.stringify(details[x], null, 4)}
` + value.appendChild(node) + } + return value + } + function publish (appAPI) { var selectContractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) if (selectContractNames.children.length > 0 && selectContractNames.selectedIndex >= 0) { From bcf275727c844e0dfd0ceeae743d2264475b0751 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 30 Aug 2017 09:20:30 +0200 Subject: [PATCH 3/6] fix standard --- src/app/tabs/compile-tab.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index cd6fdc7228..15e8784409 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -347,16 +347,15 @@ function compileTab (container, appAPI, appEvents, opts) { } } - function insertValue(details, x) { + function insertValue (details, x) { var value = yo`
`
-      console.log(x)
-      if (x ==='bytecode'||x ==='metadataHash'||x ==='swarmLocation'||x==='Runtime Bytecode'||x==='Opcodes') {
-        var node = yo`
${JSON.stringify((details[x].slice(1, 40)+'...'), null, 4)}
` - value.appendChild(node) + var node + if (x === 'bytecode' || x === 'metadataHash' || x === 'swarmLocation' || x === 'Runtime Bytecode' || x === 'Opcodes') { + node = yo`
${JSON.stringify((details[x].slice(1, 40) + '...'), null, 4)}
` } else { - var node = yo`
${JSON.stringify(details[x], null, 4)}
` - value.appendChild(node) + node = yo`
${JSON.stringify(details[x], null, 4)}
` } + value.appendChild(node) return value } From 11337d85a0fc44f8eb6c016638cc6fabd0a99797 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 30 Aug 2017 09:45:37 +0200 Subject: [PATCH 4/6] manage webDeploy as pre, interface and metadata as TreeView --- src/app/tabs/compile-tab.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 15e8784409..3b189bce8e 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -7,6 +7,7 @@ const copy = require('clipboard-copy') var parseContracts = require('../contract/contractParser') var publishOnSwarm = require('../contract/publishOnSwarm') var modalDialog = require('../ui/modaldialog') +var TreeView = require('ethereum-remix').ui.TreeView // -------------- styling ---------------------- var csjs = require('csjs-inject') @@ -351,7 +352,12 @@ function compileTab (container, appAPI, appEvents, opts) { var value = yo`
`
       var node
       if (x === 'bytecode' || x === 'metadataHash' || x === 'swarmLocation' || x === 'Runtime Bytecode' || x === 'Opcodes') {
-        node = yo`
${JSON.stringify((details[x].slice(1, 40) + '...'), null, 4)}
` + node = yo`
${details[x]}
` + } else if (x === 'web3Deploy') { + node = yo`
${details[x]}
` + } else if (x === 'interface' || x === 'metadata') { + var treeView = new TreeView({}) + node = yo`
${treeView.render(JSON.parse(details[x]))}
` } else { node = yo`
${JSON.stringify(details[x], null, 4)}
` } From 6e80dd95815887ccb33b1d94ba65ee610328fadb Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 30 Aug 2017 09:57:28 +0200 Subject: [PATCH 5/6] don't stringify name && treeview rendering --- src/app/tabs/compile-tab.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 3b189bce8e..6ba92e51b9 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -351,12 +351,31 @@ function compileTab (container, appAPI, appEvents, opts) { function insertValue (details, x) { var value = yo`
`
       var node
-      if (x === 'bytecode' || x === 'metadataHash' || x === 'swarmLocation' || x === 'Runtime Bytecode' || x === 'Opcodes') {
+      if (x === 'bytecode' || x === 'metadataHash' || x === 'swarmLocation' || x === 'Runtime Bytecode' || x === 'Opcodes' || x === 'name') {
         node = yo`
${details[x]}
` } else if (x === 'web3Deploy') { node = yo`
${details[x]}
` } else if (x === 'interface' || x === 'metadata') { - var treeView = new TreeView({}) + var treeView = new TreeView({ + extractData: function (item, parent, key) { + var ret = {} + if (item instanceof Array) { + ret.children = item.map((item, index) => { + return {key: index, value: item} + }) + ret.self = '' + } else if (item instanceof Object) { + ret.children = Object.keys(item).map((key) => { + return {key: key, value: item[key]} + }) + ret.self = '' + } else { + ret.self = item + ret.children = [] + } + return ret + } + }) node = yo`
${treeView.render(JSON.parse(details[x]))}
` } else { node = yo`
${JSON.stringify(details[x], null, 4)}
` From 0fc6a86638afde4266681a34c016aeeac24f5455 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 30 Aug 2017 10:23:55 +0200 Subject: [PATCH 6/6] add question mark --- src/app/tabs/compile-tab.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 6ba92e51b9..c22df0a257 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -115,6 +115,12 @@ var css = csjs` .copyDetails:hover { opacity: 1; } + .questionMark { + margin-left: 1%; + font-size: 14px; + color: ${styles.colors.grey}; + opacity: .3; + }, .detailsJSON { padding: 8px 0; background-color: ${styles.colors.white}; @@ -337,9 +343,10 @@ function compileTab (container, appAPI, appEvents, opts) { var log = yo`
` keys.map(x => { var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` + var questionMark = yo`` log.appendChild(yo`
-
${x} ${copyDetails}
+
${x} ${copyDetails} ${questionMark}
${insertValue(details, x)}
`) @@ -400,3 +407,20 @@ function compileTab (container, appAPI, appEvents, opts) { return el } } + +function detailsHelpSection () { + return { + 'Assembly': 'Assembly opcodes describing the contract including corresponding solidity source code', + 'Opcodes': 'Assembly opcodes describing the contract', + 'Runtime Bytecode': 'Bytecode actually store in the state and executed during normal contract call', + 'bytecode': 'Bytecode executed during contract creation', + 'functionHashes': 'List of declared function and their corresonding hash', + 'gasEstimates': 'Gas estimation for each function call', + 'metadata': 'Contain all informations related to the compilation', + 'metadataHash': 'Hash representing all metadata information', + 'interface': 'ABI: Describe all the functions (input/output params, scope, ...)', + 'name': 'Name of the compiled contract', + 'swarmLocation': 'Swarm url where all metadata information can be found (contract needs to be published first)', + 'web3Deploy': 'Copy/paste this code to any JavaScript/Web3 console to deploy this contract' + } +}