diff --git a/src/universal-dapp.js b/src/universal-dapp.js index e6faf12418..0acf15e386 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -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]