Repository
Lazorkit-to-10x-Solana-UX
π Solana Pay Widget - Lazorkit SDK Integration Example  , and transactions are gasless. It's Web3 with Web2-like simplicity.
π― Features Demonstrated
| Feature | Description | File |
|---|---|---|
| Passkey Creation | Create new wallet with biometric auth | src/providers/LazorkitProvider.tsx |
| Passkey Login | Authenticate with existing passkey | src/providers/LazorkitProvider.tsx |
| Gasless SOL Transfer | Send SOL without holding SOL for gas | src/components/PaymentWidget.tsx |
| Session Persistence | Remember wallet across sessions | src/providers/LazorkitProvider.tsx |
| Transaction History | View past transactions | src/components/TransactionHistory.tsx |
| Wallet UI Components | Ready-to-use wallet connection UI | src/components/WalletConnect.tsx |
π Quick Start
Prerequisites
- Node.js 18.0 or higher
- A browser that supports WebAuthn (Chrome, Safari, Firefox, Edge)
- Optional: A device with biometric authentication
1. Clone the Repository
git clone https://github.com/your-username/lazorkit-solana-pay-widget.git
cd lazorkit-solana-pay-widget
2. Install Dependencies
npm install
3. Configure Environment
Copy the example environment file and configure:
cp env.example .env.local
Edit .env.local with your configuration:
# Solana RPC URL (Devnet for testing)
NEXT_PUBLIC_LAZORKIT_RPC_URL=https://api.devnet.solana.com
# Lazorkit Portal URL for passkey storage
NEXT_PUBLIC_LAZORKIT_PORTAL_URL=https://portal.lazorkit.com
# Lazorkit Paymaster URL for gasless transactions
NEXT_PUBLIC_LAZORKIT_PAYMASTER_URL=https://paymaster.lazorkit.com
# Your app name (shown in passkey prompts)
NEXT_PUBLIC_APP_NAME=Solana Pay Widget
# Network (devnet or mainnet-beta)
NEXT_PUBLIC_SOLANA_NETWORK=devnet
4. Run the Development Server
npm run dev
Open http://localhost:3000 in your browser.
5. Try It Out!
- Click "Connect with Passkey"
- Authenticate with your device's biometrics
- Your smart wallet is created automatically
- Send a test payment (gasless!)
π Project Structure
lazorkit-solana-pay-widget/
βββ src/
β βββ app/
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Main page component
β β
β βββ components/
β β βββ WalletConnect.tsx # Wallet connection UI
β β βββ PaymentWidget.tsx # Payment form component
β β βββ TransactionHistory.tsx
β β βββ FeatureShowcase.tsx
β β βββ index.ts # Component exports
β β
β βββ providers/
β β βββ LazorkitProvider.tsx # Lazorkit SDK integration
β β
β βββ styles/
β βββ globals.css # Global styles & Tailwind
β
βββ docs/ # Tutorial documentation
β βββ tutorial-passkey-wallet.md
β βββ tutorial-gasless-transactions.md
β
βββ env.example # Environment template
βββ package.json
βββ tailwind.config.js
βββ README.md
π Tutorials
Tutorial 1: Creating a Passkey-Based Wallet
Learn how to implement passkey authentication for wallet creation.
π Read the full tutorial β
Quick overview:
// 1. Set up the provider
import { LazorkitProvider } from '@lazorkit/wallet';
<LazorkitProvider
rpcUrl={process.env.NEXT_PUBLIC_LAZORKIT_RPC_URL}
paymasterUrl={process.env.NEXT_PUBLIC_LAZORKIT_PAYMASTER_URL}
>
<App />
</LazorkitProvider>
// 2. Use the wallet hook
import { useWallet } from '@lazorkit/wallet';
const { connect, isConnected, smartWalletPubkey } = useWallet();
// 3. Connect with passkey
await connect(); // Prompts biometric authentication
Tutorial 2: Sending Gasless Transactions
Learn how to send transactions without requiring users to hold SOL.
π Read the full tutorial β
Quick overview:
const { signAndSendTransaction } = useWallet();
// Build your transaction
const transaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey: smartWalletPubkey,
toPubkey: recipientPubkey,
lamports: amount * LAMPORTS_PER_SOL,
})
);
// Sign with passkey and send (gasless!)
const { signature } = await signAndSendTransaction(transaction);
π§ SDK Integration Deep Dive
The LazorkitProvider
The provider wraps your application and manages:
- Connection State - Track if user is connected
- Credential Storage - Persist passkey across sessions
- Transaction Signing - Handle WebAuthn assertions
// src/providers/LazorkitProvider.tsx
export function LazorkitContextProvider({ children }) {
const [isConnected, setIsConnected] = useState(false);
const [smartWalletPubkey, setSmartWalletPubkey] = useState(null);
// Restore session on mount
useEffect(() => {
const savedCredential = loadCredential();
if (savedCredential) {
// Auto-restore session
}
}, []);
// ... provider implementation
}
WebAuthn Flow
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β User β β Browser β β Solana β
β Device β β (WebAuthn) β β Network β
ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ
β β β
β 1. Click Connect β β
ββββββββββββββββββββ>β β
β β β
β 2. Biometric Promptβ β
β<ββββββββββββββββββββ β
β β β
β 3. User Approves β β
ββββββββββββββββββββ>β β
β β β
β β 4. Create Credential
β ββββββββββββββ β
β β<ββββββββββββ β
β β β
β β 5. Derive Smart Wallet
β ββββββββββββββββββββ>β
β β β
β 6. Connected! β β
β<ββββββββββββββββββββ β
β β β
π¨ UI Components
WalletConnect
Flexible wallet connection component with three variants:
// Hero variant - Large button for landing pages
<WalletConnect variant="hero" />
// Compact variant - Small button for headers
<WalletConnect variant="compact" />
// Full variant - Complete card with all wallet info
<WalletConnect variant="full" />
PaymentWidget
Complete payment form with:
- Token selection (SOL/USDC)
- Amount input with validation
- Recipient address validation
- Transaction status indicators
- Success/error states
<PaymentWidget />
π Deployment
Deploy to Vercel
- Click the deploy button above
- Configure environment variables in Vercel dashboard
- Deploy!
Deploy to Other Platforms
# Build for production
npm run build
# Start production server
npm start
π Resources
- Lazorkit Documentation: https://docs.lazorkit.com
- Lazorkit GitHub: https://github.com/lazor-kit/lazor-kit
- Lazorkit Telegram: https://t.me/lazorkit
- Solana Web3.js: https://solana-labs.github.io/solana-web3.js/
- WebAuthn Guide: https://webauthn.guide
π€ Contributing
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch
- Submit a pull request
π License
MIT License - feel free to use this example in your own projects!