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 ...@@ -316,13 +316,16 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
$instance.append($title) $instance.append($title)
// Add the fallback function // Add the fallback function
$instance.append(self.getCallButton({ var fallback = self.getFallbackInterface(abi)
abi: { constant: false, inputs: [], name: '(fallback)', outputs: [], type: 'function' }, if (fallback) {
encode: function (args) { $instance.append(self.getCallButton({
return '' abi: { constant: false, inputs: [], name: '(fallback)', outputs: [], type: 'function' },
}, encode: function (args) {
address: address return ''
})) },
address: address
}))
}
$.each(abi, function (i, funABI) { $.each(abi, function (i, funABI) {
if (funABI.type !== 'function') { if (funABI.type !== 'function') {
...@@ -379,6 +382,14 @@ UniversalDApp.prototype.getConstructorInterface = function (abi) { ...@@ -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) { UniversalDApp.prototype.getCallButton = function (args) {
var self = this var self = this
// args.abi, args.encode, args.bytecode [constr only], args.address [fun only] // 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