Created
October 9, 2023 07:48
-
-
Save TABASCOatw/22fb89c7e27e10349bb62aef8945308a to your computer and use it in GitHub Desktop.
Example of native wallet-adapter support for Particle social logins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC, ReactNode, useMemo } from 'react'; | |
import { | |
ConnectionProvider, | |
WalletProvider, | |
} from '@solana/wallet-adapter-react'; | |
import { WalletModalProvider, WalletMultiButton } from '@solana/wallet-adapter-react-ui'; | |
import { ParticleAdapter } from '@solana/wallet-adapter-wallets'; | |
import '@solana/wallet-adapter-react-ui/styles.css'; | |
import './App.css'; | |
const App: FC = () => ( | |
<Context> | |
<Content /> | |
</Context> | |
); | |
export default App; | |
const Context: FC<{ children: ReactNode }> = ({ children }) => { | |
const endpoint = useMemo(() => process.env.REACT_APP_RPC_URL!, []); | |
const wallets = useMemo(() => [new ParticleAdapter()], []); | |
return ( | |
<ConnectionProvider endpoint={endpoint}> | |
<WalletProvider wallets={wallets} autoConnect> | |
<WalletModalProvider>{children}</WalletModalProvider> | |
</WalletProvider> | |
</ConnectionProvider> | |
); | |
}; | |
const Content: FC = () => { | |
return ( | |
<div className="App"> | |
<div className="button-container"> | |
<WalletMultiButton /> | |
</div> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment