> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interacting with Solana wallets

> Seamlessly interact with a user's Solana wallet

Mini Apps can interact with a user's Solana wallet without needing to worry
about popping open "select your wallet" dialogs or flaky connections.

## Getting Started

The SDK enables Mini Apps to interact with a user's Solana wallet through [Wallet Standard](https://github.com/anza-xyz/wallet-standard/).

We recommend using [Wallet Adapter](https://github.com/anza-xyz/wallet-adapter/)'s React hooks to interface with Wallet Standard. You may also use [Wallet Standard directly](#using-wallet-standard-directly), or interface with our [low-level Solana provider](#low-level-solana-provider).

<Steps>
  <Step title="Setup Wallet Adapter">
    Use the [Quick Setup (using React) guide](https://github.com/anza-xyz/wallet-adapter/blob/master/APP.md) to setup Wallet Adapter in your project.
  </Step>

  <Step title="Install the Wallet Standard integration">
    <CodeGroup>
      ```bash npm theme={"system"}
      npm install @farcaster/mini-app-solana
      ```

      ```bash pnpm theme={"system"}
      pnpm add @farcaster/mini-app-solana
      ```

      ```bash yarn theme={"system"}
      yarn add @farcaster/mini-app-solana
      ```
    </CodeGroup>
  </Step>

  <Step title="Render the Farcaster Solana provider">
    In place of `ConnectionProvider` and `WalletProvider` from the Wallet Adapter guide, you should render `FarcasterSolanaProvider` from `@farcaster/mini-app-solana`.

    This does two things:

    1. Importing from `@farcaster/mini-app-solana` has the side effect of triggering the Farcaster wallet to register via Wallet Standard.
    2. Sets up Wallet Adapter to automatically select the Farcaster wallet.

    ```tsx theme={"system"}
    import * as React from 'react';
    import { FarcasterSolanaProvider } from '@farcaster/mini-app-solana';
    import { useWallet } from '@solana/wallet-adapter-react';

    const solanaEndpoint = 'https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY';

    function App() {
      // FarcasterSolanaProvider internally renders ConnectionProvider
      // and WalletProvider from @solana/wallet-adapter-react
      return (
        <FarcasterSolanaProvider endpoint={solanaEndpoint}>
          <Content />
        </FarcasterSolanaProvider>
      )
    }
    ```
  </Step>

  <Step title="Use the Wallet Adapter hooks">
    You can now use Wallet Adapter React hooks directly within any component rendered downstream of `FarcasterSolanaProvider`.

    ```tsx theme={"system"}
    function Content() {
      const { publicKey } = useWallet();
      const solanaAddress = publicKey?.toBase58() ?? '';
      return <span>{solanaAddress}</span>;
    }
    ```
  </Step>
</Steps>

## Low-level Solana provider

The SDK also exposes a low-level Solana provider at `sdk.wallet.getSolanaProvider()`.
This provider is modeled after `window.phantom.solana` and its full API can be found [here](https://github.com/farcasterxyz/miniapps/blob/main/packages/miniapp-core/src/solana.ts).

## Using Wallet Standard directly

It's also possible to interface with the user's Solana wallet directly through Wallet Standard, or via Wallet Adapter's "core" (non-React) integrations.

In order to do so, it's important that you still import our package in your app entry:

```tsx theme={"system"}
import '@farcaster/mini-app-solana';
```

This ensures that the user's Solana wallet registers with Wallet Standard.

Also note that if you're using Wallet Adapter without our `FarcasterSolanaProvider` React component, you'll need to select the user's Farcaster wallet before attempting any operations.

## Demo app

To see how a working Mini App uses a Solana wallet, check out our demo Mini App [here](https://github.com/farcasterxyz/frames-v2-demo/blob/main/src/components/Demo.tsx).

## Troubleshooting

### Transaction Scanning

Modern crypto wallets scan transactions and preview them to users to help
protect users from scams. New contracts and applications can generate false
positives in these systems. If your transaction is being reported as
potentially malicious use this [Blockaid
Tool](https://report.blockaid.io/verifiedProject) to verify your app with
Blockaid.
