From e3734438d458e8841e871364d6ba321d89495c2f Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 30 Jan 2020 18:06:57 +0100 Subject: [PATCH] get funABI just before making the tx --- src/app/ui/universal-dapp-ui.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/ui/universal-dapp-ui.js b/src/app/ui/universal-dapp-ui.js index 03a34c06db..1e3a70c6a4 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) }