@morsel-wallet/adapter  ·  v0.1.0  ·  MIT

Integrate Morsel Wallet
in minutes

A fully-typed React library for connecting Morsel Wallet to your dApp. QR scan, browser extension, Wallet Standard — with light & dark mode and native support for Cookie Chain and Solana.

Light & Dark mode Cookie Chain Solana
View on GitHub →
Morsel Wallet connect modal

QR Code Connect

Encrypted WebSocket relay with NaCl (X25519 + XSalsa20) lets mobile users scan and connect securely.

Injected Provider

Detects Morsel Wallet browser extension automatically — zero config for extension users.

Wallet Standard

Auto-discovers any wallet implementing the Wallet Standard protocol, including hardware wallets.

13 React Hooks

From useWallet() to useSendTransaction() — composable hooks for every wallet interaction.

TypeScript First

Full type definitions, typed errors, and IntelliSense support out of the box.

Dual Network

Switch between Cookie Chain and Solana at runtime. One adapter, two networks, zero refactoring.

Up and running in 3 steps

From zero to wallet-connected in under 5 minutes.

1

Install the package

bash
npm install @morsel-wallet/adapter @solana/web3.js @wallet-standard/app
2

Wrap your app with providers

tsx
import { WalletProvider, WalletModalProvider, ConnectButton } from '@morsel-wallet/adapter';
import { MorselCookieWalletAdapter, StandardWalletAdapter } from '@morsel-wallet/adapter';
import { getWallets } from '@wallet-standard/app';

const morsel   = new MorselCookieWalletAdapter();
const standard = getWallets().get().map(w => new StandardWalletAdapter(w));

export default function App() {
  return (
    <WalletProvider adapters={[morsel, ...standard]} autoConnect>
      <WalletModalProvider>
        <ConnectButton />
      </WalletModalProvider>
    </WalletProvider>
  );
}
3

Use hooks anywhere in your tree

tsx
import { useWallet, useWalletBalance, useSignMessage } from '@morsel-wallet/adapter';
import { Connection } from '@solana/web3.js';

function MyComponent() {
  const { connected, publicKey, disconnect } = useWallet();
  const connection = new Connection('https://rpc.cookiechain.io');
  const { balance, loading, refetch }        = useWalletBalance(connection);
  const { signMessage, signing }             = useSignMessage();

  if (!connected) return <ConnectButton />;

  return (
    <div>
      <p>{publicKey.toBase58()}</p>
      <p>{loading ? 'Loading...' : `${balance} COOKIE`}</p>
      <button onClick={() => signMessage(new TextEncoder().encode('Hello!'))}>
        {signing ? 'Signing...' : 'Sign Message'}
      </button>
    </div>
  );
}

13 composable hooks

Every hook is fully typed and tree-shakeable.

useWallet()

Full wallet context — state, methods, events

useWalletAddress()

Public key as Base58 string or null

useWalletBalance()

SOL / COOKIE balance with loading & refetch

useWalletStatus()

Monitor connection state changes

useSignMessage()

Sign arbitrary messages

useSignTransaction()

Sign one or multiple transactions

useSendTransaction()

Send transactions to the network

useWalletConnection()

Connection lifecycle management

useWalletError()

Access and clear current error state

useAutoConnect()

Manage auto-connect behaviour

useWalletEvent()

Subscribe to wallet events

useOnConnect()

Callback fired on wallet connect

useOnDisconnect()

Callback fired on wallet disconnect

Core classes & types

MorselCookieWalletAdapter

Main adapter class. Handles QR connect, injected provider detection, and all signing operations.

connect()disconnect() signTransaction(tx)signAllTransactions(txs) signMessage(msg)sendTransaction(tx, conn)

StandardWalletAdapter

Wraps any wallet implementing the Wallet Standard protocol — automatically discovered via getWallets().

connect()disconnect() signTransaction(tx)signMessage(msg)

WalletProvider

React context provider. Manages lifecycle, auto-connect, localStorage persistence, and wallet deduplication.

adapters={[]}autoConnect={bool}onError={fn}

ConnectButton

Drop-in UI component. Shows connect modal when disconnected, address + balance when connected.

showAddressuseModalclassNameonConnectError

Ready to integrate?

Open-source under MIT. Built and maintained by the Morsel Labs team.