-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add menu page * setDelegate page * rebase
- Loading branch information
Showing
23 changed files
with
1,861 additions
and
1,418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use client"; | ||
|
||
import { useAccount, useDisconnect } from "@starknet-react/core"; | ||
import CartridgeConnector from "@cartridge/connector"; | ||
import { Button } from "@cartridge/ui-next"; | ||
|
||
export function Menu() { | ||
const { account, connector } = useAccount(); | ||
const { disconnect } = useDisconnect(); | ||
const cartridgeConnector = connector as unknown as CartridgeConnector; | ||
|
||
const onOpenMenu = async () => { | ||
if (!account) return; | ||
const isConnected = await cartridgeConnector.openMenu(); | ||
if (!isConnected) { | ||
disconnect() | ||
} | ||
}; | ||
|
||
if (!account) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div style={{ marginTop: "10px" }}> | ||
<h2>Open Menu</h2> | ||
<Button onClick={onOpenMenu}>Open Menu</Button> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.