diff --git a/src/app/ui/universal-dapp-ui.js b/src/app/ui/universal-dapp-ui.js index 03a34c06db6..1e3a70c6a41 100644 --- a/src/app/ui/universal-dapp-ui.js +++ b/src/app/ui/universal-dapp-ui.js @@ -191,7 +191,17 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address setLLIError("'Fallback' function is not defined") } } - if (!receive && !fallback) setLLIError("Both 'receive' and 'fallback' functions are not defined") + + if (!receive && !fallback) setLLIError(`Both 'receive' and 'fallback' functions are not defined`) + + // we have to put the right function ABI: + // if receive is defined and that there is no calldata => receive function is called + // if fallback is defined => fallback function is called + if (receive && !calldata) args.funABI = receive + else if (fallback) args.funABI = fallback + + if (!args.funABI) setLLIError(`Please define at least a 'Fallback' with/without sending calldata or a 'Receive' without sending calldata`) + if (!error) self.runTransaction(false, args, null, calldata, null) }