# Use Helius

The `Use Helius` tool, part of AgentiPy, provides functionalities for interacting with the Helius APIs on Solana. Helius offers a suite of developer tools for reading parsed transaction data, NFT events, balances, mintlists, and managing webhooks for real-time notifications. This tool requires a Helius API key.

## Functionality

This tool is implemented in the `HeliusManager` class. All methods are static and make direct requests to Helius API endpoints. The Helius API key and RPC URL are sourced from the `SolanaAgentKit` instance (`agent.helius_api_key`, `agent.helius_rpc_url`).

### Key Methods:

* `get_balances(agent: SolanaAgentKit, address: str)`: Fetches native SOL and SPL token balances for a given `address`.
* `get_address_name(agent: SolanaAgentKit, address: str)`: Retrieves known names associated with an `address` (e.g., from domain services or exchanges).
* `get_nft_events(agent: SolanaAgentKit, accounts: List[str], types: List[str] = None, ...)`: Queries NFT event history for specified `accounts`, filterable by event `types`, `sources`, slot/time ranges, and collection details. Supports pagination.
* `get_mintlists(agent: SolanaAgentKit, first_verified_creators: List[str], ...)`: Retrieves mintlists based on first verified creators or verified collection addresses. Supports pagination.
* `get_nft_fingerprint(agent: SolanaAgentKit, mints: List[str])`: Gets the Helius fingerprint for a list of NFT `mints`.
* `get_active_listings(agent: SolanaAgentKit, first_verified_creators: List[str], ...)`: Fetches active NFT listings from various marketplaces, filterable by creators or collections.
* `get_nft_metadata(agent: SolanaAgentKit, mint_accounts: List[str])`: Retrieves metadata for a list of SPL token/NFT `mint_accounts`.
* `get_raw_transactions(agent: SolanaAgentKit, accounts: List[str], ...)`: Fetches raw (unparsed) transaction history for specified `accounts`.
* `get_parsed_transactions(agent: SolanaAgentKit, transactions: List[str], commitment: str = None)`: Fetches and parses specific transactions by their signatures.
* `get_parsed_transaction_history(agent: SolanaAgentKit, address: str, ...)`: Retrieves parsed transaction history for a given `address`, filterable by various criteria.
* `create_webhook(agent: SolanaAgentKit, webhook_url: str, transaction_types: list, account_addresses: list, webhook_type: str, ...)`: Creates a new Helius webhook to receive real-time notifications.
* `get_all_webhooks(agent: SolanaAgentKit)`: Lists all existing webhooks for the API key.
* `get_webhook(agent: SolanaAgentKit, webhook_id: str)`: Retrieves details for a specific `webhook_id`.
* `edit_webhook(agent: SolanaAgentKit, webhook_id: str, ...)`: Modifies an existing webhook.
* `delete_webhook(agent: SolanaAgentKit, webhook_id: str)`: Deletes a webhook.

(Helper functions `_make_get_request`, `_make_post_request`, etc. are used internally to interact with the Helius API.)

##

**Important Considerations:**

* **API Key:** A Helius API key is required and must be configured in `SolanaAgentKit` as `agent.helius_api_key`. The Helius RPC URL must also be set as `agent.helius_rpc_url`.
* **Direct API Interaction:** This tool interacts directly with Helius APIs. It does not use the Agentipy proxy service.
* **Rate Limits:** Be mindful of Helius API rate limits associated with your API key tier.
* **Data Richness:** Helius provides parsed and enriched Solana data, which can be very detailed and useful for analytics, event tracking, and more.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_helius.py>
