diff --git a/src/app/execution/txFormat.js b/src/app/execution/txFormat.js index 9d8e32e110..bc887f7399 100644 --- a/src/app/execution/txFormat.js +++ b/src/app/execution/txFormat.js @@ -73,11 +73,11 @@ module.exports = { if (bytecode.indexOf('_') < 0) { return callback(null, bytecode) } - var m = bytecode.match(/__([^_]{1,36})__/) - if (!m) { + var libraryRefMatch = bytecode.match(/__([^_]{1,36})__/) + if (!libraryRefMatch) { return callback('Invalid bytecode format.') } - var libraryName = m[1] + var libraryName = libraryRefMatch[1] var libraryabi = helper.getContractByName(libraryName, contracts) if (!libraryabi) { return callback('Library ' + libraryName + ' not found.') diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 708742b286..f36296f390 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -359,18 +359,17 @@ function compileTab (container, appAPI, appEvents, opts) { var select = el.querySelector('select') if (select.children.length > 0 && select.selectedIndex >= 0) { var contractName = select.children[select.selectedIndex].innerHTML - var details = contractsDetails[contractName] - var keys = Object.keys(contractsDetails[contractName]) + var contractProperties = contractsDetails[contractName] var log = yo`
` - keys.map(x => { - var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` - var questionMark = yo`` + Object.keys(contractProperties).map(propertyName => { + var copyDetails = yo` { copy(contractProperties[propertyName]) }} aria-hidden="true">` + var questionMark = yo`` var keyDisplayName - (x === 'interface') ? keyDisplayName = 'interface - abi' : keyDisplayName = x + (propertyName === 'interface') ? keyDisplayName = 'interface - abi' : keyDisplayName = propertyName log.appendChild(yo`
${keyDisplayName} ${copyDetails} ${questionMark}
- ${insertValue(details, x)} + ${insertValue(contractProperties, propertyName)}
`) }) @@ -378,14 +377,14 @@ function compileTab (container, appAPI, appEvents, opts) { } } - function insertValue (details, x) { + function insertValue (details, propertyName) { var value = yo`
`
       var node
-      if (x === 'bytecode' || x === 'metadataHash' || x === 'swarmLocation' || x === 'Runtime Bytecode' || x === 'Opcodes') {
-        node = yo`
${details[x].slice(0, 60) + '...'}
` - } else if (x === 'web3Deploy' || x === 'name') { - node = yo`
${details[x]}
` - } else if (x === 'interface' || x === 'metadata') { + if (propertyName === 'bytecode' || propertyName === 'metadataHash' || propertyName === 'swarmLocation' || propertyName === 'Runtime Bytecode' || propertyName === 'Opcodes') { + node = yo`
${details[propertyName].slice(0, 60) + '...'}
` + } else if (propertyName === 'web3Deploy' || propertyName === 'name') { + node = yo`
${details[propertyName]}
` + } else if (propertyName === 'interface' || propertyName === 'metadata') { var treeView = new TreeView({ extractData: function (item, parent, key) { var ret = {} @@ -406,17 +405,17 @@ function compileTab (container, appAPI, appEvents, opts) { return ret } }) - if (details[x] !== '') { + if (details[propertyName] !== '') { try { - node = yo`
${treeView.render(JSON.parse(details[x]))}
` // catch in case the parsing fails. + node = yo`
${treeView.render(JSON.parse(details[propertyName]))}
` // catch in case the parsing fails. } catch (e) { - node = yo`
Unable to display "${x}": ${e.message}
` + node = yo`
Unable to display "${propertyName}": ${e.message}
` } } else { node = yo`
-
` } } else { - node = yo`
${JSON.stringify(details[x], null, 4)}
` + node = yo`
${JSON.stringify(details[propertyName], null, 4)}
` } if (node) value.appendChild(node) return value