diff --git a/components/WalletConnectButton.tsx b/components/WalletConnectButton.tsx new file mode 100644 index 0000000..1022779 --- /dev/null +++ b/components/WalletConnectButton.tsx @@ -0,0 +1,19 @@ +import React, { useState } from "react"; +import { connectWallet } from "../lib/reownClient"; + +const WalletConnectButton = () => { + const [connected, setConnected] = useState(false); + + const handleConnect = async () => { + const session = await connectWallet(); + if (session) setConnected(true); + }; + + return ( + + ); +}; + +export default WalletConnectButton; diff --git a/index.tsx b/index.tsx new file mode 100644 index 0000000..e39225c --- /dev/null +++ b/index.tsx @@ -0,0 +1,10 @@ +import WalletConnectButton from "./components/WalletConnectButton"; + +function App() { + return ( +
+

Minswap Wallet Connect Integration

+ +
+ ); +} diff --git a/lib/reownClient.ts b/lib/reownClient.ts new file mode 100644 index 0000000..32f8d10 --- /dev/null +++ b/lib/reownClient.ts @@ -0,0 +1,17 @@ +import { CoreClient, AppKit } from "@reown/appkit"; + +export const initializeReown = async () => { + await CoreClient.initialize({ projectId: "180a7164cfa9e5388daf1160841f65a0" }); + await AppKit.initialize({ init: CoreClient }); +}; + +export const connectWallet = async () => { + try { + const session = await AppKit.Modal.open(); + console.log("Wallet connected:", session); + return session; + } catch (err) { + console.error(err); + return null; + } +};