Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mavagio/web3-auth
https://github.com/mavagio/web3-auth
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mavagio/web3-auth
- Owner: mavagio
- Created: 2022-11-20T13:47:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-20T15:12:50.000Z (about 2 years ago)
- Last Synced: 2024-10-14T15:21:51.945Z (3 months ago)
- Language: TypeScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 (
<>
>
);
};```