npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cdp-wallet-onramp-kit

v1.2.0

Published

Complete toolkit for Coinbase Developer Platform (CDP) Embedded Wallets and Onramp integration with reusable components, utilities, and documentation

Readme

CDP Wallet & Onramp Kit

Complete toolkit for integrating Coinbase Developer Platform (CDP) Embedded Wallets and Onramp functionality into your Next.js applications. This package combines comprehensive documentation, reusable React components, utilities, and API templates to get you up and running quickly.

Features

🎯 All-in-One Solution: Embedded wallets + onramp in one package
📚 Comprehensive Docs: Complete integration guides and examples
⚛️ React Components: Pre-built, customizable UI components
🔧 Utilities & Helpers: Authentication, validation, and API utilities
🚀 Quick Setup: CLI commands to scaffold your project
💼 Production Ready: Error handling, validation, and best practices

Quick Start

1. Install Documentation & Components

# Install the package
npm install cdp-wallet-onramp-kit

# Set up documentation in your project
npx cdp-wallet-onramp-kit setup

# Or initialize a new project with API routes and examples
npx cdp-wallet-onramp-kit init

2. Environment Setup

Create .env.local:

# Required for both wallet and onramp
NEXT_PUBLIC_CDP_PROJECT_ID=your-project-id-here

# Required for onramp (server-side only)  
CDP_API_KEY_PRIVATE_KEY=your-private-key-here
CDP_API_KEY_NAME=your-key-name-here

3. Configure CORS

Visit CDP Portal and add your domains:

  • Development: http://localhost:3000
  • Production: https://yourdomain.com

4. Use the Components

"use client";

import { CDPProvider, WalletAuth, OnrampButton } from 'cdp-wallet-onramp-kit';
import { useEvmAddress } from '@coinbase/cdp-hooks';

const cdpConfig = {
  projectId: process.env.NEXT_PUBLIC_CDP_PROJECT_ID!,
  debugging: process.env.NODE_ENV === 'development',
};

const appConfig = {
  name: "My App",
  logoUrl: "/logo.png",
};

function WalletSection() {
  const evmAddress = useEvmAddress();

  return (
    <div className="space-y-4">
      <WalletAuth />
      {evmAddress && (
        <OnrampButton
          walletAddress={evmAddress || undefined}
          defaultAsset="USDC"
          presetFiatAmount={50}
        >
          Buy $50 USDC
        </OnrampButton>
      )}
    </div>
  );
}

export default function App() {
  return (
    <CDPProvider config={cdpConfig} app={appConfig}>
      <WalletSection />
    </CDPProvider>
  );
}

Components

Providers

  • CDPProvider - Full React components provider
  • CDPHooksProvider - Hooks-only provider for custom UIs

Authentication

  • WalletAuth - Simple pre-built auth button
  • CustomWalletAuth - Full control auth component with email/OTP flow

Onramp

  • OnrampButton - Simple buy crypto button
  • OnrampWidget - Complete purchase widget with auth integration

Utilities

Authentication & API

import { 
  generateJWT, 
  createSessionToken, 
  generateOnrampUrl 
} from 'cdp-wallet-onramp-kit/lib';

// Generate JWT for CDP API
const jwt = await generateJWT();

// Create session token for onramp
const sessionToken = await createSessionToken(jwt, {
  addresses: [{ address: walletAddress, blockchains: ['base'] }],
  assets: ['USDC', 'ETH']
});

// Generate complete onramp URL
const onrampUrl = await generateOnrampUrl({
  addresses: [{ address: walletAddress, blockchains: ['base'] }],
  defaultAsset: 'USDC',
  presetFiatAmount: 50
});

Validation

import { 
  validateRequest, 
  sessionTokenSchema,
  validateEnvironment 
} from 'cdp-wallet-onramp-kit/lib';

// Validate API requests
const validatedData = validateRequest(sessionTokenSchema, requestBody);

// Check environment variables
const envCheck = validateEnvironment();

API Routes (Templates)

The package includes ready-to-use API route templates:

  • app/api/onramp/session/route.ts - Session token creation
  • app/api/onramp/url/route.ts - Onramp URL generation

Copy these from the templates or use npx cdp-wallet-onramp-kit init.

Documentation

After running npx cdp-wallet-onramp-kit setup, you'll have:

  • Integration Guides: Step-by-step instructions for AI coding agents
  • API Documentation: Complete CDP Onramp and Embedded Wallet docs
  • Examples: Working code examples and patterns
  • Best Practices: Security, error handling, and production considerations

Dependencies

Required Peer Dependencies

{
  "@coinbase/cdp-core": ">=0.0.18",
  "@coinbase/cdp-hooks": ">=0.0.18", 
  "@coinbase/cdp-react": ">=0.0.18",
  "@coinbase/cdp-sdk": ">=1.33.0",
  "react": ">=18.0.0",
  "react-dom": ">=18.0.0",
  "next": ">=14.0.0"
}

Optional Dependencies

For enhanced UI:

  • lucide-react - Icons
  • framer-motion - Animations
  • tailwindcss - Styling (components use Tailwind classes)

CLI Commands

# Set up documentation
npx cdp-wallet-onramp-kit setup [--dir ./docs] [--force]

# Initialize new project
npx cdp-wallet-onramp-kit init [--template basic|complete] [--dir .]

Examples

Guest Checkout (No Wallet Required)

<OnrampButton
  defaultAsset="USDC"
  presetFiatAmount={25}
>
  Buy $25 USDC (Guest)
</OnrampButton>

Complete Widget with Authentication

<OnrampWidget
  title="Buy Crypto"
  description="Purchase crypto with your credit card"
  presetAmounts={[10, 25, 50, 100]}
  defaultAmount={50}
  theme="dark"
/>

Custom Authentication Flow

<CustomWalletAuth 
  theme="dark"
  showDebugInfo={true}
  onSignedIn={(user, address) => {
    console.log('User signed in:', user, address);
  }}
/>

Support

License

MIT


Built for developers who want to integrate crypto payments and wallets without the complexity. Get your users buying crypto in minutes, not days.