Neynar Documentation

Usage

import { sdk } from '@farcaster/miniapp-sdk'

await sdk.actions.sendToken({
  token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
  recipientFid: 3621, // Optional: recipient's FID
  amount:'10000'
})

Parameters

token (optional)

The contract address of the token to send.

recipientFid (optional)

The Farcaster ID (FID) of the recipient.

amount (optional)

Send token amount, as numeric stringFor example, 1 USDC: 1000000

Return Value

type SendTokenDetails = {
  /**
   * Tx identifier.
   */
  transaction: `0x${string}`
}

type SendTokenErrorDetails = {
  /**
   * Error code.
   */
  error: string
  /**
   * Error message.
   */
  message?: string
}

export type SendTokenErrorReason = 'rejected_by_user' | 'send_failed'

export type SendTokenResult =
  | {
      success: true
      send: SendTokenDetails
    }
  | {
      success: false
      reason: SendTokenErrorReason
      error?: SendTokenErrorDetails
    }

Notes

This action opens the native send interface in the Farcaster client, allowing users to send tokens without leaving the Mini App context.