💎 Donate SOL via Blink - Support SoldevKit UI
Soldevkit UI

Send Token

A form component for sending SPL tokens on Solana with validation and transaction handling.

Made by Aman Satyawani

Transfer Solana Tokens

Send Tokens

Send Token

A form component for sending SPL tokens on Solana with validation and transaction handling.

Installation

Usage

Basic Usage

import { SendTokenForm } from "@/components/soldevkit-ui/token/send-token";
import { PublicKey } from "@solana/web3.js";

const tokens = [
  {
    id: "sol",
    symbol: "SOL",
    name: "Solana",
    decimals: 9,
    balance: 1.5,
    mintAddress: "So11111111111111111111111111111111111111112",
    icon: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
  },
];

export default function Example() {
  const handleSendToken = async (values) => {
    // Handle token sending logic
    console.log("Sending token:", values);
  };

  const validateDestination = async (address: string) => {
    // Validate Solana address
    try {
      new PublicKey(address);
      return true;
    } catch {
      return false;
    }
  };

  return (
    <SendTokenForm
      onSendToken={handleSendToken}
      tokens={tokens}
      validateDestination={validateDestination}
      showTokenBalance
    />
  );
}

Features

  • Form Validation: Built-in validation for destination address and amount
  • Token Selection: Dropdown with balance display and token icons
  • Loading States: Proper loading indicators during transaction processing
  • Error Handling: Toast notifications for success and error states
  • Responsive Design: Works seamlessly on desktop and mobile devices
  • Accessibility: Full keyboard navigation and screen reader support
  • Customizable Validation: Support for custom destination address validation
  • Multi-Token Support: Handles both SOL and SPL token transfers

Props

Prop

Type

Type Definitions

FormValues

Prop

Type

TokenInfo

Prop

Type

Dependencies

{
  "@solana/web3.js": "^1.87.0",
  "@solana/wallet-adapter-react": "^0.15.0",
  "@solana/spl-token": "^0.3.0",
  "react-hook-form": "^7.0.0",
  "sonner": "^1.0.0",
  "lucide-react": "^0.400.0"
}

Built with ❀ for the Solana ecosystem. Contributions welcome!

How is this guide?

Built by Aman Satyawani. The source code is available on GitHub.