feat: add privy-auth community template#317
feat: add privy-auth community template#317nathanliow wants to merge 2 commits intosolana-foundation:mainfrom
Conversation
| @@ -0,0 +1,42 @@ | |||
| /** Represents a linked account from Privy's user object */ | |||
| export type LinkedAccountType = | |||
There was a problem hiding this comment.
Any reason for recreating LinkedAccountType? The react auth SDK contains types for these.
| } | ||
|
|
||
| /** Auth status states used throughout the app */ | ||
| export type AuthState = "loading" | "authenticated" | "unauthenticated"; |
There was a problem hiding this comment.
same here - would propose using ready and authenticated variable from usePrivy to control the UI state that shows and removing these.
| @@ -0,0 +1,42 @@ | |||
| /** Represents a linked account from Privy's user object */ | |||
There was a problem hiding this comment.
Doesn't seem like these types are being used?
| export default function AuthStatus() { | ||
| const { ready, authenticated, user } = usePrivy(); | ||
|
|
||
| const state: AuthState = !ready |
There was a problem hiding this comment.
Feel like AuthState isn't too useful here , propose directly using ready and authenticated
| @@ -0,0 +1,146 @@ | |||
| "use client"; | |||
|
|
|||
| import { usePrivy } from "@privy-io/react-auth"; | |||
There was a problem hiding this comment.
use LinkedAccountWithMetadata from react auth
| "use client"; | ||
|
|
||
| import { useSolanaWallets } from "@privy-io/react-auth/solana"; | ||
| import { Connection, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; |
There was a problem hiding this comment.
web3.js is a deprecated package - let's use solana/kit instead: https://docs.privy.io/wallets/connectors/solana/kit-integrations
tedim52
left a comment
There was a problem hiding this comment.
Seems like this is an auth focused template but would be great to include simle code examples for sign message and send transaction.
- Delete types/privy.ts (custom types not used, duplicated SDK types)
- Refactor AuthStatus to use ready/authenticated directly (no custom AuthState)
- Rewrite UserProfile to use LinkedAccountWithMetadata from @privy-io/react-auth
- Replace @solana/web3.js with @solana/kit in WalletInfo (createSolanaRpc, address)
- Add SignMessage component (working signMessage demo)
- Add SendTransaction component (code reference for building txs with @solana/kit)
- Upgrade to @privy-io/react-auth v3, add @solana-program/{system,token,memo}
- Remove solanaClusters config (removed in Privy v3)
|
This pull request has been automatically marked as stale because it has not had any activity for 7 days. It will be closed in 7 days if no further activity occurs. If you believe this PR is still relevant, please add a comment or push new commits to keep it open. Thank you for your contributions! |
|
Still active — all requested changes have been addressed. Ready for re-review when you get a chance! |
|
This pull request has been automatically marked as stale because it has not had any activity for 7 days. It will be closed in 7 days if no further activity occurs. If you believe this PR is still relevant, please add a comment or push new commits to keep it open. Thank you for your contributions! |
|
Still actively maintained — bumping to keep open. Happy to address any additional feedback from reviewers. |
|
This pull request has been automatically marked as stale because it has not had any activity for 7 days. It will be closed in 7 days if no further activity occurs. If you believe this PR is still relevant, please add a comment or push new commits to keep it open. Thank you for your contributions! |
|
Still active and ready for review — all changes addressed. Bumping to keep open. |
|
This pull request has been automatically marked as stale because it has not had any activity for 7 days. It will be closed in 7 days if no further activity occurs. If you believe this PR is still relevant, please add a comment or push new commits to keep it open. Thank you for your contributions! |
|
Bumping to keep open — still actively maintained and ready for review. |
Add a community/privy-auth template to the Solana Foundation's templates repo demonstrating Privy-based authentication in a Solana dApp — including social logins, embedded wallet creation, and protected routes — usable via
pnpm create solana-dapp --template privy-auth.