Skip to content

Commit

Permalink
Refactored consideredUtxo for forward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
amitx13 committed Aug 20, 2024
1 parent e8382b4 commit bb30c98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Send/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -214,7 +214,7 @@ export interface SendFormValues {
txFee?: TxFee
isCoinJoin: boolean
numCollaborators?: number
consideredUtxos?: Utxos
consideredUtxos?: string[]
}

interface InnerSendFormProps {
Expand Down
14 changes: 11 additions & 3 deletions src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,17 @@ export default function Send({ wallet }: SendProps) {
feeConfigValues: { ...feeConfigValues, tx_fees: showConfirmSendModal.txFee },
}}
>
{showConfirmSendModal.amount!.isSweep && showConfirmSendModal.consideredUtxos && (
<ReviewConsideredUtxos utxos={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 <ReviewConsideredUtxos utxos={utxoList} />
})()}
</PaymentConfirmModal>
)}
</div>
Expand Down

0 comments on commit bb30c98

Please sign in to comment.