import React from 'react'; import { Box, Text } from 'ink'; import { colors, formatSatoshis, formatHex } from '../../../theme.js'; import type { SelectableUTXO, FocusArea } from '../types.js'; interface Props { availableUtxos: SelectableUTXO[]; selectedUtxoIndex: number; requiredAmount: bigint; fee: bigint; selectedAmount: bigint; changeAmount: bigint; focusArea: FocusArea; } export function InputsStep({ availableUtxos, selectedUtxoIndex, requiredAmount, fee, selectedAmount, changeAmount, focusArea, }: Props): React.ReactElement { return ( Select UTXOs to fund the transaction: Required: {formatSatoshis(requiredAmount)} +{' '} {formatSatoshis(fee)} fee = requiredAmount + fee ? colors.success : colors.warning } > Selected: {formatSatoshis(selectedAmount)} {selectedAmount > requiredAmount + fee && ( Change: {formatSatoshis(changeAmount)} )} {availableUtxos.length === 0 ? ( No UTXOs available ) : ( availableUtxos.map((utxo, index) => { const isCursor = selectedUtxoIndex === index && focusArea === 'content'; return ( {isCursor ? '▸ ' : ' '}[{utxo.selected ? 'X' : ' '}]{' '} {formatSatoshis(utxo.valueSatoshis)} -{' '} {formatHex(utxo.outpointTransactionHash, 12)}: {utxo.outpointIndex} ); }) )} Space/Enter: Toggle • a: Select all • n: Deselect all ); }