testnet-onboarding-app/src/App.tsx

35 lines
863 B
TypeScript
Raw Normal View History

import React from "react";
import { useWalletConnectContext } from "./context/WalletConnectContext";
function App() {
const { connect, session } = useWalletConnectContext();
return (
<>
{!session ? (
<div>
<h1>Connect wallet </h1>
<button onClick={connect}>Connect</button>
</div>
) : (
<>
<h1>Connected</h1>
<p>Session Topic: {session.pairingTopic}</p>
<p>Ethereum accounts: </p>
<ul>{session.namespaces.eip155.accounts.map((address, index) =>
<li key={index}>{address}</li>
)}
</ul>
<p>Cosmos accounts: </p>
<ul>{session.namespaces.cosmos.accounts.map((address, index) =>
<li key={index}>{address}</li>
)}
</ul>
</>
)}
</>
);
}
export default App;