This commit is contained in:
manusdlai 2025-02-16 17:26:03 +05:30
parent 7dd17df0cd
commit 98bfbeab3b
4 changed files with 34 additions and 32 deletions

View File

@ -33,7 +33,8 @@
"styled-components": "^6.1.14", "styled-components": "^6.1.14",
"tailwind-merge": "^3.0.1", "tailwind-merge": "^3.0.1",
"three": "^0.173.0", "three": "^0.173.0",
"three.meshline": "^1.4.0" "three.meshline": "^1.4.0",
"viem": "^2.23.2"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.17.0", "@eslint/js": "^9.17.0",

View File

@ -11,7 +11,7 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { authenticated } = usePrivy(); const { authenticated } = usePrivy();
const { wallets } = useSolanaWallets() const { wallets } = useSolanaWallets()
console.log(wallets[0]); console.log(wallets[0]);
if (!authenticated && wallets.length===0) { if (!authenticated) {
return <Navigate to="/" replace />; return <Navigate to="/" replace />;
} }

View File

@ -1,35 +1,37 @@
import { PrivyProvider } from "@privy-io/react-auth"; import { PrivyProvider } from '@privy-io/react-auth';
import { toSolanaWalletConnectors } from "@privy-io/react-auth/solana"; import {bsc} from 'viem/chains';
const solanaConnectors = toSolanaWalletConnectors({
// By default, shouldAutoConnect is enabled
shouldAutoConnect: true,
});
export default function Providers({ children }: { children: React.ReactNode }) { export default function Providers({ children }: { children: React.ReactNode }) {
return ( return (
<PrivyProvider <PrivyProvider
appId="cm6t7wm9y0i1wt680b4tukt8r" appId={"cm6t7wm9y0i1wt680b4tukt8r"}
config={{ config={{
appearance: { "appearance": {
theme: "dark", "accentColor": "#6A6FF5",
showWalletLoginFirst: false, "theme":"#FFFFFF",
walletChainType: "solana-only", "showWalletLoginFirst": false,
walletList: ["phantom"], "logo": "https://auth.privy.io/logos/privy-logo.png",
"walletChainType": 'ethereum-only',
"walletList": ['metamask', 'wallet_connect', 'coinbase_wallet', 'rabby_wallet', 'cryptocom','safe']
}, },
externalWallets: { "loginMethods": [
solana: { "email",
connectors: solanaConnectors, "wallet"
],
"embeddedWallets": {
"createOnLogin": "all-users",
"requireUserPasswordOnCreate": false,
"showWalletUIs": true
}, },
"mfa": {
"noPromptOnMfaRequired": false
}, },
loginMethods: ["wallet", "email"], defaultChain: bsc,
embeddedWallets: { supportedChains: [bsc]
createOnLogin: "all-users",
requireUserPasswordOnCreate: false,
},
}} }}
> >
{children} {children}
</PrivyProvider> </PrivyProvider>
); );
} }

View File

@ -14,7 +14,7 @@ import cardIcon2 from "../../public/icons/Box.svg";
import cardIcon3 from "../../public/icons/Share Circle.svg"; import cardIcon3 from "../../public/icons/Share Circle.svg";
import cardIcon4 from "../../public/icons/SSD Square.svg"; import cardIcon4 from "../../public/icons/SSD Square.svg";
import cardIcon5 from "../../public/icons/Posts Carousel Horizontal.svg"; import cardIcon5 from "../../public/icons/Posts Carousel Horizontal.svg";
import { usePrivy, useSolanaWallets } from '@privy-io/react-auth'; import { usePrivy } from '@privy-io/react-auth';
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import Spline from '@splinetool/react-spline' import Spline from '@splinetool/react-spline'
import axios from 'axios' import axios from 'axios'
@ -23,14 +23,13 @@ const Home = () => {
const { login, authenticated, ready, connectOrCreateWallet } = usePrivy() const { login, authenticated, ready, connectOrCreateWallet } = usePrivy()
const navigate = useNavigate() const navigate = useNavigate()
const { wallets } = useSolanaWallets()
const handleLogin = async () => { const handleLogin = async () => {
if (authenticated || wallets[0]) { if (authenticated) {
navigate("/create-agent") navigate("/create-agent")
} else { } else {
connectOrCreateWallet() login()
} }
} }
const [hash, setHash] = useState("efgunyhed5frvgtbyu8799j"); const [hash, setHash] = useState("efgunyhed5frvgtbyu8799j");