Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mavagio/web3-auth


https://github.com/mavagio/web3-auth

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# web3-auth

The following project includes two packages for web3 authentication.
React component library `pacakges/ui` and common web3 functionality `packages/common`.

## Setup

### Example

The following is an example of how the package can be used in the code with solana wallets:

```TS
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { WalletModalProvider, WalletMultiButton } from '@solana/wallet-adapter-react-ui';
import {
GlowWalletAdapter,
PhantomWalletAdapter,
SlopeWalletAdapter,
SolflareWalletAdapter,
TorusWalletAdapter,
} from '@solana/wallet-adapter-wallets';
import { clusterApiUrl } from '@solana/web3.js';
import React, { FC, ReactNode, useMemo } from 'react';

export const App: FC = () => {
return (



);
};

const Context: FC<{ children: ReactNode }> = ({ children }) => {
const network = WalletAdapterNetwork.Devnet;

const endpoint = useMemo(() => clusterApiUrl(network), [network]);

const wallets = useMemo(
() => [
new PhantomWalletAdapter(),
new GlowWalletAdapter(),
new SlopeWalletAdapter(),
new SolflareWalletAdapter({ network }),
new TorusWalletAdapter(),
],
[network]
);

return (



Promise.resolve('token') /*API callBack goes here*/}>
{children}




);
};

const Content: FC = () => {
return (
<>

>
);
};

```