diff --git a/src/universal-dapp.js b/src/universal-dapp.js index bb9362745c..e6faf12418 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -196,6 +196,10 @@ UniversalDApp.prototype.getCreateInterface = function ($container, contract) { $createInterface.append($atButton) var $newButton = self.getInstanceInterface(contract) + if (!$newButton) { + return $createInterface + } + $createInterface.append($newButton) // Only display creation interface for non-abstract contracts. @@ -228,7 +232,12 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar return 1 } }) + var funABI = self.getConstructorInterface(abi) + if (!funABI) { + return + } + var $createInterface = $('
') var appendFunctions = function (address, $el) { @@ -362,16 +371,12 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar return $createInterface } -// either return the supplied constructor or a mockup (we assume everything can be instantiated) UniversalDApp.prototype.getConstructorInterface = function (abi) { - var funABI = { 'name': '', 'inputs': [], 'type': 'constructor', 'outputs': [] } for (var i = 0; i < abi.length; i++) { if (abi[i].type === 'constructor') { - funABI.inputs = abi[i].inputs || [] - break + return abi[i] } } - return funABI } UniversalDApp.prototype.getCallButton = function (args) {