2024-03-19 12:54:15 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useWalletConnectContext } from "./context/WalletConnectContext";
|
2024-03-19 06:47:12 +00:00
|
|
|
|
|
|
|
function App() {
|
2024-03-19 12:54:15 +00:00
|
|
|
const { connect, session } = useWalletConnectContext();
|
|
|
|
|
2024-03-19 06:47:12 +00:00
|
|
|
return (
|
2024-03-19 12:54:15 +00:00
|
|
|
<>
|
|
|
|
{!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>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</>
|
2024-03-19 06:47:12 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|