Using Wallet Authentication
import { useTonConnect, useTonAuth } from "@xircus-web3/ton-react"
export default function Index() {
const wallet = useTonConnect()
const auth = useTonAuth()
if (wallet.status == "connected") {
return (
<div>
<div>{wallet.account}</div>
<div>{wallet.balance}</div>
<button onClick={wallet.disconnect}>Disconnect</button>
<button onClick={auth.auth}>Authenticate</button>
<div>{auth?.user?.username}</div>
</div>
}
return (
<div>
<button onClick={wallet.connectMetamask}>Connect Metamask</button>
</div>
)
}
Last updated