# Stake with Jupiter (JUP)

The `Stake with Jup` tool, part of AgentiPy, allows users to stake SOL tokens with the JUP validator via a Jupiter API endpoint. This process typically involves swapping SOL for jupSOL (a liquid staking token representing staked SOL with Jupiter's validator) or directly staking SOL into Jupiter's LST pool.

## Functionality

This tool is implemented in the `StakeManager` class.

### Key Methods:

* `stake_with_jup(agent: SolanaAgentKit, amount: float) -> str`:
  * Takes a `SolanaAgentKit` instance (which provides the wallet and connection) and the `amount` of SOL to stake.
  * Constructs a URL to interact with Jupiter's worker API (`https://worker.jup.ag/blinks/swap/...`) to get a transaction for staking SOL (specifically, it seems to target a swap/stake into `jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v`, which is jupSOL).
  * The agent's wallet address is sent as the account in the payload.
  * Retrieves the serialized transaction from the API response.
  * Signs the transaction with the agent's wallet.
  * Sends and confirms the transaction on the Solana network.
  * Returns the transaction signature as a string.

##

**Important Note:** This tool performs on-chain transactions that will spend SOL from the agent's wallet. Staking mechanisms can have associated risks, including smart contract vulnerabilities or changes in staking reward rates. Always ensure you understand the specifics of the JUP staking program before using this tool with significant funds.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/stake_with_jup.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/stake-with-jupiter-jup.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.
