# Use Solayer

The `Use Solayer` tool, part of AgentiPy, allows users to interact with the Solayer platform (`https://app.solayer.org`), specifically for staking SOL to receive sSOL (Solayer Staked SOL), which is a liquid staking token.

## Functionality

This tool is implemented in the `SolayerManager` class. It interacts directly with the Solayer API to get a transaction for staking, which is then signed by the agent's wallet and submitted to the Solana blockchain.

### Key Methods:

* `stake_with_solayer(agent: SolanaAgentKit, amount: float) -> str`:
  * Stakes a specified `amount` of SOL with Solayer to mint sSOL.
  * Parameters:
    * `agent`: The `SolanaAgentKit` instance (provides wallet and connection).
    * `amount`: The amount of SOL to stake.
  * Makes a POST request to the Solayer API endpoint (`https://app.solayer.org/api/action/restake/ssol`) with the agent's wallet address and the staking amount.
  * The API returns a base64 encoded, serialized `VersionedTransaction`.
  * This transaction is then decoded, signed by the agent's wallet.
  * The signed transaction is sent to the Solana network and confirmed.
  * Returns the transaction signature as a string.

##

**Important Considerations:**

* **Direct API Interaction & On-Chain:** This tool first interacts with the Solayer API to fetch a pre-built transaction. This transaction is then signed locally using the agent's wallet and submitted directly to the Solana blockchain. This is an on-chain financial transaction.
* **Liquid Staking:** When you stake SOL with Solayer, you receive sSOL, a liquid staking token. Understand how sSOL accrues value and the risks associated with liquid staking protocols (e.g., smart contract risk, de-pegging risk if sSOL trades differently from SOL).
* **API Reliance:** The construction of the staking transaction relies on the Solayer API.
* **Fees:** The transaction will incur standard Solana network fees. Solayer might also have protocol fees, which would be embedded in the transaction returned by their API.

## Source Code

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/tools/use-solayer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
