Repository

Lazorkit-to-10x-Solana-UX

πŸš€ Solana Pay Widget - Lazorkit SDK Integration Example ![Lazorkit SDK](https://img.shields.io/badge/Lazorkit_SDK-Passkey_Auth-purple?style=for-the-badge) ![Solana](https://img.shie Β· License MIT Β· Install via npm Β· Maintenance unknown

License
MIT
Feature
Description
Passkey Creation
Passkey Creation
Passkey Login
Passkey Login

Specs

  • FeatureDescription
  • Passkey CreationPasskey Creation
  • Passkey LoginPasskey Login
  • Gasless SOL TransferGasless SOL Transfer
  • Session PersistenceSession Persistence
  • Transaction HistoryTransaction History
  • Wallet UI ComponentsWallet UI Components

README

πŸš€ Solana Pay Widget - Lazorkit SDK Integration Example

![Lazorkit SDK](https://img.shields.io/badge/Lazorkit_SDK-Passkey_Auth-purple?style=for-the-badge) ![Solana](https://img.shields.io/badge/Solana-Devnet-14F195?style=for-the-badge) ![Next.js](https://img.shields.io/badge/Next.js-14-black?style=for-the-badge) ![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?style=for-the-badge) **A practical example demonstrating passkey authentication and gasless transactions using Lazorkit SDK on Solana** [Live Demo](#live-demo) β€’ [Quick Start](#quick-start) β€’ [Tutorials](#tutorials) β€’ [Documentation](https://docs.lazorkit.com)

πŸ“– Overview

This repository provides a complete, production-ready example of integrating the Lazorkit SDK into a Next.js application. It demonstrates how to build a modern Web3 payment widget with:

  • πŸ” Passkey Authentication - Users login with Face ID, Touch ID, or Windows Hello
  • ⚑ Gasless Transactions - Users never need SOL for gas fees
  • πŸ‘› Smart Wallets - Automatic wallet creation and management
  • πŸ”„ Session Persistence - Stay logged in across browser sessions

Why Lazorkit?

Traditional blockchain UX requires users to:

  1. Install a wallet app
  2. Write down a 12-24 word seed phrase
  3. Buy crypto to pay for gas fees
  4. Understand complex transaction signing

Lazorkit eliminates all of this. Users authenticate with the biometrics they already use (Face ID, fingerprint), 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!

  1. Click "Connect with Passkey"
  2. Authenticate with your device's biometrics
  3. Your smart wallet is created automatically
  4. 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:

  1. Connection State - Track if user is connected
  2. Credential Storage - Persist passkey across sessions
  3. 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

Deploy with Vercel

  1. Click the deploy button above
  2. Configure environment variables in Vercel dashboard
  3. Deploy!

Deploy to Other Platforms

# Build for production
npm run build

# Start production server
npm start

πŸ”— Resources


🀝 Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

πŸ“„ License

MIT License - feel free to use this example in your own projects!


**Built with ❀️ for the Solana community** [Lazorkit SDK](https://lazorkit.com) β€’ [Solana](https://solana.com) β€’ [Next.js](https://nextjs.org)