# Use Cybers

The `Use Cybers` tool, part of AgentiPy, allows users to interact with the Cybers API (`https://api.cybers.app/v1`). It provides functionalities to authenticate a Solana wallet and create new coins (tokens) on the Cybers platform.

## Functionality

This tool is implemented in the `CybersManager` class.

### Key Methods:

* `_sign_message(keypair: Keypair, message: str) -> str`:
  * (Internal static method) Signs a UTF-8 encoded `message` using the provided Solana `keypair`.
  * Returns a base58-encoded signature.
* `authenticate_wallet(agent: SolanaAgentKit) -> Optional[str]`:
  * (Static method) Authenticates the agent's wallet with the Cybers API.
  * It signs a predefined message ("Sign in to Cyber") using the agent's wallet.
  * Sends the wallet address, signature, and message to the Cybers `/auth/verify-signature` endpoint.
  * Returns a JWT token as a string if authentication is successful, otherwise `None` or raises an exception.
* `create_coin(agent: SolanaAgentKit, name: str, symbol: str, image_path: str, tweet_author_id: str, tweet_author_username: str) -> dict`:
  * (Static method) Creates a new coin on the Cybers platform.
  * First, it calls `authenticate_wallet` to get a JWT token.
  * It then prepares a multipart form data payload including the token `name` (max 64 chars), `symbol` (max 10 chars), `description` (auto-generated), `personality`, `instruction`, `knowledge`, social links (auto-generated from symbol), `creatorTwitterUserId`, `creatorTwitterUsername`, and an image file read from `image_path`.
  * Sends this data to the Cybers `/coin/create` endpoint with the JWT token for authorization.
  * Returns a dictionary with the API response, which should include the mint address if successful.

##

**Important Considerations:**

* **External API:** This tool relies heavily on the external Cybers API. Its functionality is subject to the API's availability, terms of service, and potential costs.
* **Authentication:** Wallet authentication is required, involving signing a message. The JWT token obtained is used for subsequent API calls like coin creation.
* **Image Handling:** The `create_coin` method requires a path to an image file, which it reads and uploads.
* **On-Chain Action:** Creating a coin results in a new token being minted on the Solana blockchain, which is an on-chain transaction likely initiated by the Cybers backend after API validation.

## Source Code

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