From f35d1f1cfa659a5ac9b72a1fded5d7078962ff7e Mon Sep 17 00:00:00 2001 From: Alexander Evchenko Date: Thu, 14 Sep 2023 11:40:23 +0400 Subject: [PATCH] refactor: use feeContract as address to search balances --- .../ReviewTransactionContainer.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/ux/requestsModal/ReviewRelayTransaction/ReviewTransactionContainer.tsx b/src/ux/requestsModal/ReviewRelayTransaction/ReviewTransactionContainer.tsx index 3ef8965cb..b0a0b0f90 100644 --- a/src/ux/requestsModal/ReviewRelayTransaction/ReviewTransactionContainer.tsx +++ b/src/ux/requestsModal/ReviewRelayTransaction/ReviewTransactionContainer.tsx @@ -7,7 +7,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { Alert, StyleSheet, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { RIF_TOKEN_ADDRESS_TESTNET } from '@rsksmart/rif-relay-light-sdk' import { balanceToDisplay, convertTokenToUSD } from 'lib/utils' @@ -18,7 +17,7 @@ import { TransactionSummaryScreenProps } from 'screens/transactionSummary' import { TransactionSummaryComponent } from 'screens/transactionSummary/TransactionSummaryComponent' import { sharedColors } from 'shared/constants' import { chainTypesById } from 'shared/constants/chainConstants' -import { errorHandler } from 'shared/utils' +import { castStyle, errorHandler } from 'shared/utils' import { selectWalletState } from 'store/slices/settingsSlice' import { ChainTypeEnum } from 'store/slices/settingsSlice/types' import { selectUsdPrices } from 'store/slices/usdPricesSlice' @@ -150,11 +149,10 @@ export const ReviewTransactionContainer = ({ if (tokenToBoolMap.get(symbol as TokenSymbol)) { insufficientFunds = - Number(value) + Number(feeValue) > - Number(balances[RIF_TOKEN_ADDRESS_TESTNET].balance) + Number(value) + Number(feeValue) > Number(balances[feeContract].balance) } else { insufficientFunds = - Number(feeValue) > Number(balances[RIF_TOKEN_ADDRESS_TESTNET].balance) + Number(feeValue) > Number(balances[feeContract].balance) } if (insufficientFunds) { @@ -205,6 +203,7 @@ export const ReviewTransactionContainer = ({ functionName, } }, [ + feeContract, balances, txCostInRif, value, @@ -231,10 +230,10 @@ export const ReviewTransactionContainer = ({ } const styles = StyleSheet.create({ - container: { + container: castStyle.view({ width: '100%', height: '100%', zIndex: 999, position: 'absolute', - }, + }), })