import React, { useEffect } from 'react' import { Box, Text } from 'ink' import type { Address } from 'viem' import { Header, KeyValue } from '../components/index.js' import { theme } from '../theme.js' import { formatSafeAddress } from '../../utils/eip3770.js' import { getConfigStore } from '../../storage/config-store.js' export interface ThresholdChangeSuccessScreenProps { /** * Safe transaction hash */ safeTxHash: string /** * Safe address */ safeAddress: Address /** * Chain ID */ chainId: string /** * Previous threshold value */ oldThreshold: number /** * New threshold value */ newThreshold: number /** * Optional callback when the screen is ready to exit */ onExit?: () => void } /** * ThresholdChangeSuccessScreen displays success message after creating a threshold change transaction. * This replaces the console.log implementation in commands/account/change-threshold.ts * * Features: * - Shows transaction hash and Safe details * - Displays old and new threshold values * - Shows next steps for signing and executing * - Clean, consistent styling */ export function ThresholdChangeSuccessScreen({ safeTxHash, safeAddress, chainId, oldThreshold, newThreshold, onExit, }: ThresholdChangeSuccessScreenProps): React.ReactElement { // Auto-exit after rendering useEffect(() => { if (onExit) { onExit() } }, [onExit]) const configStore = getConfigStore() const chains = configStore.getAllChains() const eip3770 = formatSafeAddress(safeAddress, chainId, chains) return (
{/* Transaction details */} {/* Next steps */} Next steps: {/* Step 1: Sign */} 1. Get {oldThreshold} signature(s): safe tx sign {safeTxHash} {/* Step 2: Execute */} 2. Execute the transaction: safe tx execute {safeTxHash} {/* Success message */} Threshold change transaction ready ) }