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

# @atxp/solana

> API reference for the @atxp/solana package

## Overview

The `@atxp/solana` package provides Solana account implementations for using ATXP on the Solana blockchain. This package was extracted from `@atxp/client` in v0.9.0 to create a modular architecture with reduced dependencies.

<Note>
  **New in v0.9.0**: Solana functionality has been moved to this dedicated package. Users must now install `@atxp/solana` separately along with required Solana dependencies.
</Note>

## Installation

```bash theme={null}
npm install @atxp/solana
```

### Required Dependencies

You'll also need to install Solana's peer dependencies:

```bash theme={null}
npm install @solana/web3.js @solana/pay bs58
```

## SolanaAccount

The main class for managing Solana accounts with ATXP.

### Constructor

```typescript theme={null}
SolanaAccount(
  solanaRpcUrl: string,
  sourceSecretKey: string
): SolanaAccount
```

Creates a Solana account object that can be used with ATXP clients for making payments on the Solana blockchain.

**Arguments**

<Expandable title="SolanaAccount arguments">
  <ParamField body="solanaRpcUrl" type="string" required>
    The Solana RPC endpoint URL (e.g., `https://api.mainnet-beta.solana.com` for mainnet or `https://api.devnet.solana.com` for devnet).
  </ParamField>

  <ParamField body="sourceSecretKey" type="string" required>
    The private key for the Solana account in base58 format. This account will be used to sign transactions and pay for MCP server calls.
  </ParamField>
</Expandable>

**Returns**

<ResponseField name="SolanaAccount" type="SolanaAccount">
  Returns a configured SolanaAccount instance ready for use with ATXP clients.
</ResponseField>

**Example Usage**

```typescript theme={null}
import { atxpClient } from '@atxp/client';
import { SolanaAccount } from '@atxp/solana';

// Read the Solana account details from the environment variables
const solanaRpcUrl = process.env.SOLANA_RPC_URL;
const solanaPrivateKey = process.env.SOLANA_PRIVATE_KEY;

// Create a Solana account
const account = new SolanaAccount(solanaRpcUrl, solanaPrivateKey);

// Use with ATXP client
const client = await atxpClient({
  mcpServer: 'https://search.mcp.atxp.ai/',
  account,
});

// Make MCP calls
const result = await client.callTool({
  name: 'search_search',
  arguments: { query: 'Latest Solana news' }
});
```

## Migration from v0.8.x

If you're upgrading from ATXP SDK v0.8.x or earlier, follow these steps:

<Steps>
  <Step title="Install the new package">
    Install `@atxp/solana` and its peer dependencies:

    ```bash theme={null}
    npm install @atxp/solana @solana/web3.js @solana/pay bs58
    ```
  </Step>

  <Step title="Update your imports">
    Change your imports from `@atxp/client` to `@atxp/solana`:

    **Before (v0.8.x):**

    ```typescript theme={null}
    import { atxpClient, SolanaAccount } from '@atxp/client';
    ```

    **After (v0.9.0+):**

    ```typescript theme={null}
    import { atxpClient } from '@atxp/client';
    import { SolanaAccount } from '@atxp/solana';
    ```
  </Step>

  <Step title="Verify functionality">
    Test your application to ensure Solana payments work correctly with the new modular structure.
  </Step>
</Steps>

## Benefits of the Modular Architecture

The separation of Solana functionality into `@atxp/solana` provides several advantages:

<AccordionGroup>
  <Accordion title="Reduced Bundle Size">
    Applications that don't use Solana no longer need to include Solana dependencies, significantly reducing bundle size.
  </Accordion>

  <Accordion title="Security Improvements">
    The core `@atxp/client` package no longer includes the `bigint-buffer` vulnerability that was previously required for Solana support.
  </Accordion>

  <Accordion title="Clearer Dependencies">
    Users explicitly install only the blockchain packages they need, making dependency management more transparent and intentional.
  </Accordion>

  <Accordion title="Easier Maintenance">
    Blockchain-specific code is isolated, making it easier to update Solana integrations without affecting the core package.
  </Accordion>
</AccordionGroup>

## See Also

<CardGroup cols={2}>
  <Card title="@atxp/client" icon="brackets-curly" href="/developers/api-reference/client">
    Core ATXP client functionality
  </Card>

  <Card title="@atxp/base" icon="cube" href="/developers/api-reference/base">
    Base blockchain account support
  </Card>
</CardGroup>
