Murphy Logo Murphy

Swap Token Form

A Solana token swap component with shadcn UI styling

Swap Token Form

Swap Tokens

Installation

Install dependencies

Start by installing required Solana dependencies

pnpm add @solana/web3.js @solana/wallet-adapter-react

Add Wallet Provider

Make sure you have added the Wallet Provider to your application. If not, follow the steps in the Connect Wallet Button guide first.

Add Swap Token Form

pnpm dlx shadcn@canary add https://www.murphyai.dev/r/swap-token-form.json

Basic Usage

import { SwapForm } from "@/components/ui/murphy/swap-token-form";
export default function MyPage() {
  return (
    <div>
      <h1 className="text-xl font-bold mb-2">Swap Solana Tokens</h1>
      <SwapForm className="max-w-md" />
    </div>
  );
}

On this page