Skip to main content

Async Python SDK for Jito Block Engine

Project description

Jito Async SDK

PyPI version Python License: MIT Code style: black

🚀 A modern, async Python SDK for interacting with Jito Block Engine

Features

  • 🔄 Full async/await support with proper resource management
  • 🛡️ Type hints for better IDE support and code safety
  • 🎯 Simple, intuitive API for all Block Engine endpoints
  • 🔒 Built-in authentication via environment variables
  • 🐛 Comprehensive error handling with custom exceptions
  • 📦 Zero configuration needed - works out of the box with mainnet

Installation

pip install jito-async

Or with Poetry (recommended):

poetry add jito-async

Quick Start

import asyncio
from jito_async import JitoJsonRpcSDK

async def main():
    # Initialize with default mainnet URL
    async with JitoJsonRpcSDK() as jito:
        # Get tip accounts
        tip_accounts = await jito.get_tip_accounts()
        print(f"Found {len(tip_accounts['data']['result'])} tip accounts")
        
        # Get a random tip account
        random_account = await jito.get_random_tip_account()
        print(f"Random tip account: {random_account}")

if __name__ == "__main__":
    asyncio.run(main())

Authentication

To use authentication, pass an environment variable name containing your UUID:

# Set your UUID in environment
import os
os.environ["JITO_AUTH_TOKEN"] = "your-uuid-here"

# Use it in the SDK
jito = JitoJsonRpcSDK(uuid_var="JITO_AUTH_TOKEN")

API Reference

Initialization

JitoJsonRpcSDK(
    url: Optional[str] = None,  # Defaults to mainnet: https://mainnet.block-engine.jito.wtf
    uuid_var: Optional[str] = None  # Environment variable name for auth token
)

Methods

Get Tip Accounts

async def get_tip_accounts() -> Dict:
    """Get tip accounts from the Block Engine."""

Get Random Tip Account

async def get_random_tip_account() -> Optional[str]:
    """Get a random tip account."""

Get Bundle Statuses

async def get_bundle_statuses(bundle_uuids: Union[str, List[str]]) -> Dict:
    """Get bundle statuses."""

Send Bundle

async def send_bundle(params: Any = None) -> Dict:
    """Send a bundle to the Block Engine."""

Get Inflight Bundle Statuses

async def get_inflight_bundle_statuses(bundle_uuids: Union[str, List[str]]) -> Dict:
    """Get inflight bundle statuses."""

Send Transaction

async def send_txn(params: Any = None, bundle_only: bool = False) -> Dict:
    """Send a transaction to the Block Engine."""

Error Handling

The SDK provides custom exceptions for better error handling:

from jito_async import JitoError, JitoConnectionError, JitoResponseError

try:
    result = await jito.send_bundle(params={"your": "bundle_data"})
except JitoConnectionError as e:
    print(f"Connection error: {e}")
except JitoResponseError as e:
    print(f"API error: {e}")
except JitoError as e:
    print(f"General error: {e}")

Development

Clone the repository and install dependencies:

git clone https://github.com/ChefJodlak/jito-async.git
cd jito-async
poetry install

Run tests:

poetry run pytest

Format code:

poetry run black .
poetry run isort .

Type check:

poetry run mypy .

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jito_async-0.1.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jito_async-0.1.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file jito_async-0.1.3.tar.gz.

File metadata

  • Download URL: jito_async-0.1.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0

File hashes

Hashes for jito_async-0.1.3.tar.gz
Algorithm Hash digest
SHA256 97cff8abbf658bbfca9abc7e3b07ae49bf4ae5893207b9ab9efba4b2b9cebbfc
MD5 9a28b07089b400aeb550e4d2ed0c899a
BLAKE2b-256 e88541f9fdb31555876466e423931e9f372a3f7ac7e4549562715e09d080fd4a

See more details on using hashes here.

File details

Details for the file jito_async-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jito_async-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Darwin/24.2.0

File hashes

Hashes for jito_async-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 89cbc4fb4466f389c28422fd5793457a45b161f8c6470865869b2c29129e922f
MD5 3b71852f22e9a45fa31c29b59030d3e1
BLAKE2b-256 dec1f00ec7669704d8701443a6f9f42a7328527dea6ac5b59584c7a9a00bf268

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page