Spaces:
Running
Running
File size: 707 Bytes
f19c267 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import React, {useState} from 'react';
import {View, Text, Button} from 'react-native';
import {connect} from '../services/walletConnect';
export default function WalletScreen() {
const [account, setAccount] = useState<string | null>(null);
async function handleConnect() {
try {
const res: any = await connect();
const accounts = res.accounts as string[];
setAccount(accounts[0]);
} catch (e) {
console.error(e);
}
}
return (
<View style={{flex:1, padding:20}}>
<Text style={{fontSize:18}}>Wallet</Text>
<Text>{account ?? 'Nenhuma carteira conectada'}</Text>
<Button title="Conectar Wallet" onPress={handleConnect} />
</View>
);
}
|