Skip to content

Commit

Permalink
Added Basic Code
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkc2303 committed Dec 9, 2023
1 parent 27263c1 commit b2ef8bc
Show file tree
Hide file tree
Showing 54 changed files with 8,593 additions and 787 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ yarn-error.log*

# local env files
.env*.local
.env*
.env

# vercel
.vercel
Expand Down
6,620 changes: 5,965 additions & 655 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,32 @@
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^1.0.6",
"@metamask/sdk-react": "^0.14.1",
"@octokit/rest": "^20.0.2",
"@tremor/react": "^3.11.1",
"autoprefixer": "^10.0.1",
"dotenv": "^16.3.1",
"eslint": "8.44.0",
"eslint-config-next": "13.4.9",
"mongodb": "^3.5.9",
"next": "14.0.4",
"next-auth": "^4.24.5",
"react": "^18",
"react-dom": "^18",
"next": "14.0.4"
"react-icons": "^4.10.1",
"swr": "^2.2.4"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "8.44.0",
"eslint-config-next": "13.4.9",
"postcss": "^8",
"tailwindcss": "^3.3.0"
"swiper": "^10.3.1",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
51 changes: 51 additions & 0 deletions src/components/ConnectWalletButton.tsx
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>
);
};
Loading

0 comments on commit b2ef8bc

Please sign in to comment.