diff --git a/pages/auth.tsx b/pages/auth.tsx
index 70fd97d..8653c3c 100644
--- a/pages/auth.tsx
+++ b/pages/auth.tsx
@@ -2,7 +2,7 @@
import { useEffect } from 'react';
import axios from 'axios';
-import { usePrivy } from '@privy-io/react-auth';
+import { usePrivy } from '@privy-io/react-auth';
import Link from 'next/link';
const Home: React.FC = () => {
@@ -14,7 +14,7 @@ const Home: React.FC = () => {
const params = new URLSearchParams(window.location.search);
const requestIdFromUrl = params.get('request_id');
- if(!result.includes('privy')){
+ if (!result.includes('privy')) {
return;
}
try {
@@ -55,17 +55,21 @@ const Home: React.FC = () => {
return (
{user && ready ? (
-
+
Login Success. You may close this now.
-
Dashboard
+
Go to Dashboard
) : (
<>
-
Complete W3B Wallet Login
-
+
+
Complete W3B Wallet Login
+
+
+
+
>
)}
diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx
index bbce8ad..384d707 100644
--- a/pages/dashboard.tsx
+++ b/pages/dashboard.tsx
@@ -28,12 +28,19 @@ export default function DashboardPage() {
const { ready, authenticated, user, logout,exportWallet, linkWallet,unlinkWallet, linkDiscord, unlinkDiscord, linkTwitter, unlinkTwitter,linkGoogle, unlinkGoogle } = usePrivy();
const { wallets } = useWallets();
- const { data: balanceData } = useBalance({
- address: user?.wallet?.address as `0x${string}`,
+
+ const [activeWallet, setActiveWallet] = useState(user?.wallet?.address);
+
+ const { data: balanceData } = useBalance({
+ address: activeWallet as `0x${string}`,
+ token: "0x22b6c31c2beb8f2d0d5373146eed41ab9ede3caf"
});
+
+
const balance = balanceData?.formatted;
const token = balanceData?.symbol;
+
useEffect(() => {
if (ready && !authenticated) {
router.push("/");
@@ -74,8 +81,20 @@ export default function DashboardPage() {
fetchUsername();
fetchVaultData();
+
}, [ready]);
+ useEffect(()=>{
+ setActiveWallet(getEmbeddedConnectedWallet(wallets)?.address);
+
+ wallets.map((wallet)=>{
+ if(activeWallet == wallet.address){
+ if(!wallet.linked){
+ }
+ }
+ });
+ },[wallets])
+
const numAccounts = user?.linkedAccounts?.length || 0;
const canRemoveAccount = numAccounts > 1;
@@ -87,6 +106,7 @@ export default function DashboardPage() {
const twitterSubject = user?.twitter?.subject || null;
const discordSubject = user?.discord?.subject || null;
+
function ToggleDiscord(){
if(user?.discord){
unlinkDiscord(user?.discord.subject);
@@ -135,8 +155,8 @@ export default function DashboardPage() {
{vaultData.vc || "0"} VC
- {/*
{user?.wallet?.address}
- {balance || 0} {token}
*/}
+ {activeWallet}
+ {balance || 0} {token}
Pre-hunt Points
@@ -191,7 +211,7 @@ export default function DashboardPage() {
Wallets
-
+
{setActiveWallet(getEmbeddedConnectedWallet(wallets)?.address)}}>
@@ -215,9 +235,10 @@ export default function DashboardPage() {
{
wallets.map((wallet)=>{
if(wallet.connectorType == "embedded"){return "";}
+ const address = wallet.address;
return (
-
+
{setActiveWallet(address)}}>