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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cryptocadet/wallet-connector

v2.2.0

Published

A lightweight, Web3Modal alternative for connecting to MetaMask, Trust Wallet, Coinbase Wallet, Phantom, and SolFlare for EVM and Solana.

Readme

@cryptocadet/wallet-connector

A lightweight, zero-dependency alternative to Web3Modal for connecting to popular Web3 wallets. Built with React and ethers.js v6.

Features

  • 🦊 MetaMask support
  • 🛡️ Trust Wallet support
  • 🔵 Coinbase Wallet support
  • 👻 Phantom support
  • 🎨 Beautiful, customizable UI
  • 📦 Tiny bundle size (~15kb gzipped)
  • 🔌 Easy integration with ethers.js v6
  • 🎯 TypeScript support
  • 🚫 No external dependencies (except peer deps)

Installation

```bash npm install @cryptocadet/wallet-connector ethers

or

yarn add @cryptocadet/wallet-connector ethers

or

pnpm add @cryptocadet/wallet-connector ethers ```

Quick Start (Recommended)

Use your own button and the hook:

import { useState } from 'react';
import { useWalletConnector, WalletSelector, SUPPORTED_WALLETS } from '@cryptocadet/wallet-connector';

function App() {
  const [showModal, setShowModal] = useState(false);
  const { address, isConnected, connect, disconnect } = useWalletConnector();

  return (
    <>
      <button onClick={() => setShowModal(true)}>
        {isConnected ? address.slice(0, 6) + '...' : 'Connect Wallet'}
      </button>

      {showModal && (
        <WalletSelector
          wallets={SUPPORTED_WALLETS}
          onSelect={async (key) => {
            await connect(key);
            setShowModal(false);
          }}
          onClose={() => setShowModal(false)}
        />
      )}
    </>
  );
}

Or Use Our Pre-built Component

import { WalletConnector } from '@cryptocadet/wallet-connector';

<WalletConnector onConnect={(data) => console.log(data)} />

Advanced Usage

Custom Styling

```jsx <WalletConnector onConnect={handleConnect} buttonText="Connect Your Wallet" buttonStyle={{ background: 'linear-gradient(to right, #667eea, #764ba2)', padding: '16px 32px', }} /> ```

Network Configuration

```jsx import { WalletConnector, NETWORKS } from '@cryptocadet/wallet-connector';

<WalletConnector onConnect={handleConnect} targetChainId={56} // BSC networks={NETWORKS} // Optional: customize networks /> ```

Using the Hook

```jsx import { useWalletConnector } from '@cryptocadet/wallet-connector';

function MyComponent() { const { address, chainId, isConnected, connect, disconnect, switchNetwork, ethersProvider } = useWalletConnector();

return ( {!isConnected ? ( <button onClick={() => connect('METAMASK')}> Connect MetaMask ) : ( <> Connected: {address} Disconnect </> )} ); } ```

API Reference

WalletConnector Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | `onConnect` | `function` | - | Callback when wallet connects | | `onDisconnect` | `function` | - | Callback when wallet disconnects | | `targetChainId` | `number` | `1` | Target blockchain network | | `buttonText` | `string` | `"Connect Wallet"` | Button label | | `buttonStyle` | `object` | - | Custom button styles | | `networks` | `object` | Default networks | Custom network configs |

useWalletConnector Hook

Returns an object with:

  • `address`: Connected wallet address
  • `chainId`: Current chain ID
  • `isConnected`: Connection status
  • `walletType`: Type of connected wallet
  • `provider`: Raw wallet provider
  • `ethersProvider`: Ethers.js BrowserProvider instance
  • `connect(walletKey)`: Connect to specific wallet
  • `disconnect()`: Disconnect wallet
  • `switchNetwork(chainId)`: Switch to different network

Supported Wallets

  • MetaMask: Browser extension and mobile app
  • Trust Wallet: Mobile app with WalletConnect
  • Coinbase Wallet: Browser extension and mobile app
  • Phantom: Browser extension (Ethereum support)

Network Support

Pre-configured networks:

  • Ethereum Mainnet (1)
  • Polygon (137)
  • BSC (56)
  • BSC Testnet (97)

Add custom networks via the `networks` prop.

License

MIT

Contributing

Contributions welcome! Please open an issue or PR.