update
This commit is contained in:
parent
7dd17df0cd
commit
98bfbeab3b
@ -33,7 +33,8 @@
|
||||
"styled-components": "^6.1.14",
|
||||
"tailwind-merge": "^3.0.1",
|
||||
"three": "^0.173.0",
|
||||
"three.meshline": "^1.4.0"
|
||||
"three.meshline": "^1.4.0",
|
||||
"viem": "^2.23.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.17.0",
|
||||
|
@ -11,7 +11,7 @@ const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
|
||||
const { authenticated } = usePrivy();
|
||||
const { wallets } = useSolanaWallets()
|
||||
console.log(wallets[0]);
|
||||
if (!authenticated && wallets.length===0) {
|
||||
if (!authenticated) {
|
||||
return <Navigate to="/" replace />;
|
||||
}
|
||||
|
||||
|
@ -1,35 +1,37 @@
|
||||
import { PrivyProvider } from "@privy-io/react-auth";
|
||||
import { toSolanaWalletConnectors } from "@privy-io/react-auth/solana";
|
||||
|
||||
const solanaConnectors = toSolanaWalletConnectors({
|
||||
// By default, shouldAutoConnect is enabled
|
||||
shouldAutoConnect: true,
|
||||
});
|
||||
import { PrivyProvider } from '@privy-io/react-auth';
|
||||
import {bsc} from 'viem/chains';
|
||||
|
||||
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<PrivyProvider
|
||||
appId="cm6t7wm9y0i1wt680b4tukt8r"
|
||||
config={{
|
||||
appearance: {
|
||||
theme: "dark",
|
||||
showWalletLoginFirst: false,
|
||||
walletChainType: "solana-only",
|
||||
walletList: ["phantom"],
|
||||
<PrivyProvider
|
||||
appId={"cm6t7wm9y0i1wt680b4tukt8r"}
|
||||
config={{
|
||||
"appearance": {
|
||||
"accentColor": "#6A6FF5",
|
||||
"theme":"#FFFFFF",
|
||||
"showWalletLoginFirst": false,
|
||||
"logo": "https://auth.privy.io/logos/privy-logo.png",
|
||||
"walletChainType": 'ethereum-only',
|
||||
"walletList": ['metamask', 'wallet_connect', 'coinbase_wallet', 'rabby_wallet', 'cryptocom','safe']
|
||||
},
|
||||
externalWallets: {
|
||||
solana: {
|
||||
connectors: solanaConnectors,
|
||||
},
|
||||
"loginMethods": [
|
||||
"email",
|
||||
"wallet"
|
||||
],
|
||||
"embeddedWallets": {
|
||||
"createOnLogin": "all-users",
|
||||
"requireUserPasswordOnCreate": false,
|
||||
"showWalletUIs": true
|
||||
},
|
||||
loginMethods: ["wallet", "email"],
|
||||
embeddedWallets: {
|
||||
createOnLogin: "all-users",
|
||||
requireUserPasswordOnCreate: false,
|
||||
"mfa": {
|
||||
"noPromptOnMfaRequired": false
|
||||
},
|
||||
defaultChain: bsc,
|
||||
supportedChains: [bsc]
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</PrivyProvider>
|
||||
>
|
||||
{children}
|
||||
</PrivyProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import cardIcon2 from "../../public/icons/Box.svg";
|
||||
import cardIcon3 from "../../public/icons/Share Circle.svg";
|
||||
import cardIcon4 from "../../public/icons/SSD Square.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 Spline from '@splinetool/react-spline'
|
||||
import axios from 'axios'
|
||||
@ -23,14 +23,13 @@ const Home = () => {
|
||||
|
||||
const { login, authenticated, ready, connectOrCreateWallet } = usePrivy()
|
||||
const navigate = useNavigate()
|
||||
const { wallets } = useSolanaWallets()
|
||||
|
||||
const handleLogin = async () => {
|
||||
|
||||
if (authenticated || wallets[0]) {
|
||||
if (authenticated) {
|
||||
navigate("/create-agent")
|
||||
} else {
|
||||
connectOrCreateWallet()
|
||||
login()
|
||||
}
|
||||
}
|
||||
const [hash, setHash] = useState("efgunyhed5frvgtbyu8799j");
|
||||
|
Loading…
x
Reference in New Issue
Block a user