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 AccountCreateSuccessScreenProps { /** * Name of the created Safe */ name: string /** * Predicted address of the Safe */ address: Address /** * Chain ID where the Safe will be deployed */ chainId: string /** * Chain name */ chainName: string /** * Optional callback when the screen is ready to exit */ onExit?: () => void } /** * AccountCreateSuccessScreen displays the success message after creating a Safe. * This replaces part of the console.log implementation in commands/account/create.ts * * Features: * - Shows success message with Safe details * - Displays name, address (EIP-3770), chain, and status * - Shows informative message about deployment * - Provides next steps with command examples */ export function AccountCreateSuccessScreen({ name, address, chainId, chainName, onExit, }: AccountCreateSuccessScreenProps): React.ReactElement { // Auto-exit after rendering useEffect(() => { if (onExit) { onExit() } }, [onExit]) const configStore = getConfigStore() const chains = configStore.getAllChains() const eip3770 = formatSafeAddress(address, chainId, chains) return (
{/* Safe details */} {/* Info message */} This Safe has been predicted but not yet deployed to the blockchain. {/* Next steps */} Next steps: {/* Deploy command */} Deploy the Safe: safe account deploy {eip3770} {/* View info command */} View Safe info: safe account info {eip3770} ) }