From 3447800152a95a26ab83987b6215376703899368 Mon Sep 17 00:00:00 2001 From: amitx13 Date: Sun, 11 Aug 2024 23:16:59 +0530 Subject: [PATCH] Refactored consideredUtxo for forward compatibility --- src/components/Send/SendForm.tsx | 4 ++-- src/components/Send/index.tsx | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/Send/SendForm.tsx b/src/components/Send/SendForm.tsx index 07e2e386..e92a04b9 100644 --- a/src/components/Send/SendForm.tsx +++ b/src/components/Send/SendForm.tsx @@ -26,7 +26,7 @@ import { isValidNumCollaborators, } from './helpers' import { AccountBalanceSummary } from '../../context/BalanceSummary' -import { WalletInfo, CurrentWallet, Utxos } from '../../context/WalletContext' +import { WalletInfo, CurrentWallet } from '../../context/WalletContext' import { useSettings } from '../../context/SettingsContext' import styles from './SendForm.module.css' import { TxFeeInputField, validateTxFee } from '../settings/TxFeeInputField' @@ -214,7 +214,7 @@ export interface SendFormValues { txFee?: TxFee isCoinJoin: boolean numCollaborators?: number - consideredUtxos?: Utxos + consideredUtxos?: string[] } interface InnerSendFormProps { diff --git a/src/components/Send/index.tsx b/src/components/Send/index.tsx index 00032f52..26021386 100644 --- a/src/components/Send/index.tsx +++ b/src/components/Send/index.tsx @@ -542,9 +542,17 @@ export default function Send({ wallet }: SendProps) { feeConfigValues: { ...feeConfigValues, tx_fees: showConfirmSendModal.txFee }, }} > - {showConfirmSendModal.amount!.isSweep && showConfirmSendModal.consideredUtxos && ( - - )} + {showConfirmSendModal.amount?.isSweep && + showConfirmSendModal.consideredUtxos && + walletInfo && + showConfirmSendModal.sourceJarIndex !== undefined && + (() => { + const selectedUtxosList = showConfirmSendModal.consideredUtxos + const utxoList = walletInfo.utxosByJar[showConfirmSendModal.sourceJarIndex].filter((utxo) => + selectedUtxosList.some((selectedUtxos) => selectedUtxos === utxo.utxo), + ) + return + })()} )}