diff --git a/features/withdrawals/hooks/contract/useRequest.ts b/features/withdrawals/hooks/contract/useRequest.ts index 5477c2998..b5d464f34 100644 --- a/features/withdrawals/hooks/contract/useRequest.ts +++ b/features/withdrawals/hooks/contract/useRequest.ts @@ -318,7 +318,7 @@ export const useWithdrawalRequest = ({ approve, needsApprove, allowance, - loading: loadingUseApprove, + initialLoading: loadingUseApprove, } = useApprove( valueBN, tokenContract.address, @@ -331,10 +331,11 @@ export const useWithdrawalRequest = ({ spender: withdrawalQueueAddress, }); - const isApprovalFlow = + const isApprovalFlow = Boolean( connector?.id === 'walletConnect' || - isMultisig || - (allowance.gt(BigNumber.from(0)) && !needsApprove); + isMultisig || + (allowance && allowance.gt(Zero) && !needsApprove), + ); const isApprovalFlowLoading = isMultisigLoading || (isApprovalFlow && loadingUseApprove); diff --git a/features/wsteth/unwrap/unwrap-form/unwrap-stats.tsx b/features/wsteth/unwrap/unwrap-form/unwrap-stats.tsx index 2506d3a15..9a193626e 100644 --- a/features/wsteth/unwrap/unwrap-form/unwrap-stats.tsx +++ b/features/wsteth/unwrap/unwrap-form/unwrap-stats.tsx @@ -37,6 +37,7 @@ export const UnwrapStats = () => { > { Promise; needsApprove: boolean; initialLoading: boolean; - allowance: BigNumber; + allowance: BigNumber | undefined; loading: boolean; error: unknown; }; @@ -45,14 +44,11 @@ export const useApprove = ( invariant(spender != null, 'Spender is required'); const result = useAllowance(token, spender, mergedOwner, STRATEGY_LAZY); - const { - data: allowance = Zero, - initialLoading, - update: updateAllowance, - } = result; + const { data: allowance, initialLoading, update: updateAllowance } = result; - const needsApprove = - !initialLoading && !amount.isZero() && amount.gt(allowance); + const needsApprove = Boolean( + !initialLoading && allowance && !amount.isZero() && amount.gt(allowance), + ); const approve = useCallback( async ({ onTxStart, onTxSent, onTxAwaited } = {}) => {