From 63674647eed1c1b869191dba8dd64a032e01d0bf Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Tue, 4 Feb 2020 19:06:13 +0530 Subject: [PATCH 1/3] function call fixed --- src/app/ui/sendTxCallbacks.js | 4 ++-- src/app/ui/universal-dapp-ui.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/ui/sendTxCallbacks.js b/src/app/ui/sendTxCallbacks.js index 29801c09508..a300d6ab11d 100644 --- a/src/app/ui/sendTxCallbacks.js +++ b/src/app/ui/sendTxCallbacks.js @@ -45,7 +45,7 @@ const promptCb = (okCb, cancelCb) => { modalCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb) } -const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => { +const confirmationCb = function (network, tx, gasEstimation, continueTxExecution, cancelCb) { let self = this if (network.name !== 'Main') { return continueTxExecution(null) @@ -86,7 +86,7 @@ const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelC content, { label: 'Confirm', fn: () => { - self.udapp.config.setUnpersistedProperty( + self.udapp.udapp.config.setUnpersistedProperty( 'doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked ) diff --git a/src/app/ui/universal-dapp-ui.js b/src/app/ui/universal-dapp-ui.js index 8854770f578..113dc8cac03 100644 --- a/src/app/ui/universal-dapp-ui.js +++ b/src/app/ui/universal-dapp-ui.js @@ -253,7 +253,7 @@ UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, i self.logCallback(`${logMsg}`) } if (args.funABI.type === 'fallback') data.dataHex = value - self.udapp.callFunction(args.address, data, args.funABI, callbacksInContext.confirmationCb, callbacksInContext.continueCb, callbacksInContext.promptCb, (error, txResult) => { + self.udapp.callFunction(args.address, data, args.funABI, callbacksInContext.confirmationCb.bind(callbacksInContext), callbacksInContext.continueCb, callbacksInContext.promptCb, (error, txResult) => { if (!error) { var isVM = self.executionContext.isVM() if (isVM) { From bdd54054a1322f47a0578a3d83c082a34d5dd080 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 4 Feb 2020 16:22:41 +0100 Subject: [PATCH 2/3] bind all getCallBacksWithContext functions --- src/app/ui/sendTxCallbacks.js | 4 ++-- src/app/ui/universal-dapp-ui.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/ui/sendTxCallbacks.js b/src/app/ui/sendTxCallbacks.js index a300d6ab11d..7c9d72cdaca 100644 --- a/src/app/ui/sendTxCallbacks.js +++ b/src/app/ui/sendTxCallbacks.js @@ -18,7 +18,7 @@ module.exports = { } } -const continueCb = (error, continueTxExecution, cancelCb) => { +const continueCb = function (error, continueTxExecution, cancelCb) { if (error) { const msg = typeof error !== 'string' ? error.message : error modalDialog( @@ -41,7 +41,7 @@ const continueCb = (error, continueTxExecution, cancelCb) => { } } -const promptCb = (okCb, cancelCb) => { +const promptCb = function (okCb, cancelCb) { modalCustom.promptPassphrase('Passphrase requested', 'Personal mode is enabled. Please provide passphrase of account', '', okCb, cancelCb) } diff --git a/src/app/ui/universal-dapp-ui.js b/src/app/ui/universal-dapp-ui.js index 113dc8cac03..0818b6006ea 100644 --- a/src/app/ui/universal-dapp-ui.js +++ b/src/app/ui/universal-dapp-ui.js @@ -253,7 +253,7 @@ UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, i self.logCallback(`${logMsg}`) } if (args.funABI.type === 'fallback') data.dataHex = value - self.udapp.callFunction(args.address, data, args.funABI, callbacksInContext.confirmationCb.bind(callbacksInContext), callbacksInContext.continueCb, callbacksInContext.promptCb, (error, txResult) => { + self.udapp.callFunction(args.address, data, args.funABI, callbacksInContext.confirmationCb.bind(callbacksInContext), callbacksInContext.continueCb.bind(callbacksInContext), callbacksInContext.promptCb.bind(callbacksInContext), (error, txResult) => { if (!error) { var isVM = self.executionContext.isVM() if (isVM) { @@ -278,7 +278,7 @@ UniversalDAppUI.prototype.runTransaction = function (lookupOnly, args, valArr, i self.logCallback(msg) }, (data, runTxCallback) => { // called for libraries deployment - self.udapp.runTx(data, callbacksInContext.confirmationCb, runTxCallback) + self.udapp.runTx(data, callbacksInContext.confirmationCb.bind(callbacksInContext), runTxCallback) }) } From dd667a7d8f845e11afa351c866dbe0c652cc60a4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 4 Feb 2020 16:23:26 +0100 Subject: [PATCH 3/3] wording udappUI --- src/app/ui/sendTxCallbacks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/ui/sendTxCallbacks.js b/src/app/ui/sendTxCallbacks.js index 7c9d72cdaca..76dde8d6b64 100644 --- a/src/app/ui/sendTxCallbacks.js +++ b/src/app/ui/sendTxCallbacks.js @@ -7,12 +7,12 @@ const typeConversion = remixLib.execution.typeConversion const Web3 = require('web3') module.exports = { - getCallBacksWithContext: (udapp, executionContext) => { + getCallBacksWithContext: (udappUI, executionContext) => { let callbacks = {} callbacks.confirmationCb = confirmationCb callbacks.continueCb = continueCb callbacks.promptCb = promptCb - callbacks.udapp = udapp + callbacks.udappUI = udappUI callbacks.executionContext = executionContext return callbacks } @@ -51,7 +51,7 @@ const confirmationCb = function (network, tx, gasEstimation, continueTxExecution return continueTxExecution(null) } var amount = Web3.utils.fromWei(typeConversion.toInt(tx.value), 'ether') - var content = confirmDialog(tx, amount, gasEstimation, self.udapp, + var content = confirmDialog(tx, amount, gasEstimation, self.udappUI, (gasPrice, cb) => { let txFeeText, priceStatus // TODO: this try catch feels like an anti pattern, can/should be @@ -86,7 +86,7 @@ const confirmationCb = function (network, tx, gasEstimation, continueTxExecution content, { label: 'Confirm', fn: () => { - self.udapp.udapp.config.setUnpersistedProperty( + self.udappUI.udapp.config.setUnpersistedProperty( 'doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked )