> ## 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.

## 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**

**SolanaAccount arguments**

**solanaRpcUrl** `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).

**sourceSecretKey** `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.

**Returns**

**SolanaAccount** `SolanaAccount`

Returns a configured SolanaAccount instance ready for use with ATXP clients.

**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:

**1. Install the new package**

Install `@atxp/solana` and its peer dependencies:

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

**2. 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';
```

**3. Verify functionality**

Test your application to ensure Solana payments work correctly with the new modular structure.

## Benefits of the Modular Architecture

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

> [accordion] Reduced Bundle Size
>
> Applications that don't use Solana no longer need to include Solana dependencies, significantly reducing bundle size.

> [accordion] Security Improvements
>
> The core `@atxp/client` package no longer includes the `bigint-buffer` vulnerability that was previously required for Solana support.

> [accordion] Clearer Dependencies
>
> Users explicitly install only the blockchain packages they need, making dependency management more transparent and intentional.

> [accordion] Easier Maintenance
>
> Blockchain-specific code is isolated, making it easier to update Solana integrations without affecting the core package.

## See Also

> [card] [@atxp/client](https://docs.atxp.ai/developers/api-reference/client.md)
>
> Core ATXP client functionality

> [card] [@atxp/base](https://docs.atxp.ai/developers/api-reference/base.md)
>
> Base blockchain account support


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.