Commit 78bb4e0f authored by Alex Beregszaszi's avatar Alex Beregszaszi

Udapp: show fallback button only if its in the ABI

parent f6cf244d
......@@ -316,13 +316,16 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
$instance.append($title)
// Add the fallback function
$instance.append(self.getCallButton({
abi: { constant: false, inputs: [], name: '(fallback)', outputs: [], type: 'function' },
encode: function (args) {
return ''
},
address: address
}))
var fallback = self.getFallbackInterface(abi)
if (fallback) {
$instance.append(self.getCallButton({
abi: { constant: false, inputs: [], name: '(fallback)', outputs: [], type: 'function' },
encode: function (args) {
return ''
},
address: address
}))
}
$.each(abi, function (i, funABI) {
if (funABI.type !== 'function') {
......@@ -379,6 +382,14 @@ UniversalDApp.prototype.getConstructorInterface = function (abi) {
}
}
UniversalDApp.prototype.getFallbackInterface = function (abi) {
for (var i = 0; i < abi.length; i++) {
if (abi[i].type === 'fallback') {
return abi[i]
}
}
}
UniversalDApp.prototype.getCallButton = function (args) {
var self = this
// args.abi, args.encode, args.bytecode [constr only], args.address [fun only]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment