Skip to content

Instantly share code, notes, and snippets.

@TABASCOatw
Created October 9, 2023 07:48
Show Gist options
  • Save TABASCOatw/22fb89c7e27e10349bb62aef8945308a to your computer and use it in GitHub Desktop.
Save TABASCOatw/22fb89c7e27e10349bb62aef8945308a to your computer and use it in GitHub Desktop.
Example of native wallet-adapter support for Particle social logins
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