From 2fc4a3dc20285d425fa84c2beae08dbc3fd42cb7 Mon Sep 17 00:00:00 2001 From: Gustavo Antunes Date: Wed, 9 Mar 2022 16:48:49 -0300 Subject: [PATCH] [FIX] Issue #172 (#3863) --- .../UI/ApproveTransactionReview/index.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/components/UI/ApproveTransactionReview/index.js b/app/components/UI/ApproveTransactionReview/index.js index 65451aa3120..dbb6b661960 100644 --- a/app/components/UI/ApproveTransactionReview/index.js +++ b/app/components/UI/ApproveTransactionReview/index.js @@ -245,6 +245,10 @@ class ApproveTransactionReview extends PureComponent { * Whether the transaction was confirmed or not */ transactionConfirmed: PropTypes.bool, + /** + * Dispatch set transaction object from transaction action + */ + setTransactionObject: PropTypes.func, }; state = { @@ -434,6 +438,7 @@ class ApproveTransactionReview extends PureComponent { } = this.state; try { + const { setTransactionObject } = this.props; const uint = toTokenMinimalUnit( spendLimitUnlimitedSelected ? originalApproveAmount : spendLimitCustomValue, token.decimals @@ -443,7 +448,15 @@ class ApproveTransactionReview extends PureComponent { spender: spenderAddress, value: Number(uint).toString(16), }); - const newApprovalTransaction = { ...transaction, data: approvalData }; + const newApprovalTransaction = { + ...transaction, + data: approvalData, + transaction: { + ...transaction.transaction, + data: approvalData, + }, + }; + setTransactionObject(newApprovalTransaction); } catch (err) { Logger.log('Failed to setTransactionObject', err); @@ -662,8 +675,10 @@ class ApproveTransactionReview extends PureComponent { originalApproveAmount, spendLimitUnlimitedSelected, spendLimitCustomValue, - transaction: { to, data }, } = this.state; + const { + transaction: { to, data }, + } = this.props; const allowance = (!spendLimitUnlimitedSelected && spendLimitCustomValue) || originalApproveAmount; return (