Use Jito

The Use Jito tool, part of AgentiPy, allows users to interact with Jito Labs' services on Solana. Jito is known for its MEV (Maximal Extractable Value) infrastructure, including block engines and relayer services, which allow for sending transaction bundles and accessing Jito-specific endpoints. This tool appears to wrap Jito's JSON-RPC API.

Functionality

This tool is implemented in the JitoManager class. It uses a helper function __send_request (from agentipy.utils.jito) to make requests to Jito's API endpoints. The agent's Jito UUID (agent.jito_uuid) can be used for certain requests if provided.

Key Methods:

  • get_tip_accounts(agent: SolanaAgentKit): Fetches a list of Jito tip accounts that can be used for sending transactions/bundles.

  • get_random_tip_account(): (Static method) Calls get_tip_accounts() and returns a randomly selected tip account from the list.

  • get_bundle_statuses(agent: SolanaAgentKit, bundle_uuids): Retrieves the status of one or more transaction bundles using their UUIDs.

  • send_bundle(agent: SolanaAgentKit, params=None): Sends a pre-constructed bundle of transactions to Jito's block engine. The params argument should contain the serialized transactions and other necessary bundle information.

  • get_inflight_bundle_statuses(agent: SolanaAgentKit, bundle_uuids): Gets the status of bundles that are currently in-flight or being processed.

  • send_txn(agent: SolanaAgentKit, params=None, bundleOnly=False): Sends a single transaction, potentially to be included in a Jito bundle. The params would contain the serialized transaction. The bundleOnly flag might indicate if it should only be processed as part of a bundle.

Important Considerations:

  • Direct API Interaction: This tool interacts directly with Jito's API endpoints. It does not appear to use the Agentipy proxy service.

  • Jito UUID: Some Jito API methods might behave differently or provide enhanced features if a jito_uuid is provided via the SolanaAgentKit.

  • Bundle Complexity: Sending bundles (send_bundle) is an advanced operation. It requires creating, signing, and serializing multiple transactions correctly. Bundles are often used for MEV extraction or ensuring atomic execution of several operations.

  • On-Chain Actions: Sending bundles or transactions via send_txn results in on-chain activity and will incur SOL fees and state changes.

Source Code

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

Last updated