-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
8,593 additions
and
787 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
.env* | ||
.env | ||
|
||
# vercel | ||
.vercel | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,51 @@ | ||
"use client"; | ||
|
||
import Link from "next/link"; | ||
|
||
// import WalletIcon from "../public/icons/WalletIcon"; | ||
|
||
import { useSDK, MetaMaskProvider } from "@metamask/sdk-react"; | ||
import { formatAddress } from "../lib/utils"; | ||
|
||
export const ConnectWalletButton = () => { | ||
const { sdk, connected, connecting, account } = useSDK(); | ||
|
||
const connect = async () => { | ||
console.log(account) | ||
try { | ||
await sdk?.connect(); | ||
} catch (err) { | ||
console.warn(`No accounts found`, err); | ||
} | ||
console.log(account) | ||
}; | ||
|
||
const disconnect = () => { | ||
if (sdk) { | ||
sdk.terminate(); | ||
} | ||
console.log(account) | ||
}; | ||
|
||
return ( | ||
<div className="relative"> | ||
{connected ? ( | ||
<div className="flex"> | ||
<button>{formatAddress(account)}</button> | ||
<button | ||
onClick={disconnect} | ||
className="block w-full pl-2 pr-4 py-2 text-left text-[#F05252] hover:bg-gray-200" | ||
> | ||
Disconnect | ||
</button> | ||
</div> | ||
|
||
|
||
) : ( | ||
<button disabled={connecting} onClick={connect}> | ||
Connect Wallet | ||
</button> | ||
)} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.