Skip to content

Commit

Permalink
Show username and address after connect in example
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed May 30, 2024
1 parent c246755 commit 8c07892
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/starknet-react-next/src/components/ConnectWallet.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useAccount, useConnect, useDisconnect } from "@starknet-react/core";
import CartridgeConnector from "@cartridge/connector"

export function ConnectWallet() {
const { connect, connectors } = useConnect();
const { disconnect } = useDisconnect();
const { address } = useAccount();

const connector = connectors[0];
const connector = connectors[0] as unknown as CartridgeConnector;

return (
<>
Expand All @@ -18,6 +19,13 @@ export function ConnectWallet() {
>
{address ? "Disconnect" : "Connect"}
</button>

{address && (
<div>
<div>username: {connector.username()}</div>
<div>address: {address}</div>
</div>
)}
</div>
</>
);
Expand Down

0 comments on commit 8c07892

Please sign in to comment.