import React, { useState } from 'react'; import { ScrollView, View, Alert } from 'react-native'; import { Button, Text, TextInput } from 'react-native-paper'; import { NativeStackScreenProps } from '@react-navigation/native-stack'; import { StackParamsList } from '../types'; import styles from '../styles/stylesheet'; import { signMessage } from '../utils/SignMessage'; type SignProps = NativeStackScreenProps; const SignMessage = ({ route }: SignProps) => { const network = route.params?.selectedNetwork; const account = route.params?.accountInfo; const [message, setMessage] = useState(''); const signMessageHandler = async () => { if (network) { if (!account) { throw new Error('Account is not valid'); } const signedMessage = await signMessage({ message, network, accountId: account.counterId, }); Alert.alert('Signature', signedMessage); } }; return ( {account && `Account ${account.counterId + 1}`} Address: {account?.address} Public Key: {account?.pubKey} setMessage(text)} value={message} /> ); }; export default SignMessage;