import React, { useEffect } from 'react' import { Box, Text } from 'ink' import { Header, KeyValue } from '../components/index.js' import { theme } from '../theme.js' export interface TransactionSignSuccessScreenProps { /** * Safe transaction hash */ safeTxHash: string /** * Current number of signatures */ currentSignatures: number /** * Required threshold */ requiredSignatures: number /** * Optional callback when the screen is ready to exit */ onExit?: () => void } /** * TransactionSignSuccessScreen displays success message after signing a transaction. * This replaces the console.log implementation in commands/tx/sign.ts * * Features: * - Shows signature count progress * - Displays execution command when ready * - Clean, consistent styling */ export function TransactionSignSuccessScreen({ safeTxHash, currentSignatures, requiredSignatures, onExit, }: TransactionSignSuccessScreenProps): React.ReactElement { // Auto-exit after rendering useEffect(() => { if (onExit) { onExit() } }, [onExit]) const isReady = currentSignatures >= requiredSignatures const remainingSignatures = requiredSignatures - currentSignatures return (
{isReady ? ( // Transaction is ready to execute Transaction is ready to execute! To execute this transaction, run: safe tx execute {safeTxHash} ) : ( // Need more signatures )} ) }