> For the complete documentation index, see [llms.txt](https://docs.agentipy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentipy.fun/tools/use-solayer.md).

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