import React, { useState } from 'react'; import { ScrollView, View, Text } from 'react-native'; import { Button, TextInput } from 'react-native-paper'; import { addAccountFromHDPath } from '../utils/Accounts'; import { Account } from '../types'; const HDPath = ({ pathCode, updateAccounts, updateIndex, hideDialog, }: { pathCode: string; updateIndex: (index: number) => void; updateAccounts: (account: Account) => void; hideDialog: () => void; }) => { const [path, setPath] = useState(''); const [isAccountCreating, setIsAccountCreating] = useState(false); const createFromHDPathHandler = async () => { setIsAccountCreating(true); const hdPath = pathCode + path; try { const newAccount = await addAccountFromHDPath(hdPath); if (newAccount) { updateAccounts(newAccount); updateIndex(newAccount.counterId); hideDialog(); } } catch (error) { console.error('Error creating account:', error); } finally { setIsAccountCreating(false); } }; return ( {pathCode} ); }; export default HDPath;