import {
WalletNotConnectedError,
SimulationError,
WebAuthnError,
SubmissionError,
} from 'smart-account-kit';
try {
await kit.transfer(tokenContract, recipient, amount);
} catch (error) {
if (error instanceof WalletNotConnectedError) {
showConnectPrompt();
} else if (error instanceof WebAuthnError) {
// User cancelled the passkey prompt or the device rejected it
showToast('Authentication cancelled or failed', 'warning');
} else if (error instanceof SimulationError) {
showToast('Transaction simulation failed: ' + error.message, 'error');
} else if (error instanceof SubmissionError) {
showToast('Transaction failed to submit', 'error');
} else {
throw error; // Re-throw unknown errors
}
}