Udapp: rely on constructor ABI to be supplied

pull/1/head
Alex Beregszaszi 8 years ago
parent b5ac39fb74
commit f6cf244d83
  1. 15
      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 = $('<div class="createContract"/>')
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) {

Loading…
Cancel
Save