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.4.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.4-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jito_async-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 aad93aa94faf34b39fa36a654a21c98c4c5d37a98b83ad9ec17241b672e41238
MD5 47124d0f6e694a86e895b195df15c21e
BLAKE2b-256 2dbcb51c16152437657a57f5cb6e097ed0e70b905ae19a330d61f2d628e8143d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jito_async-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 56efe161a5959e451c7d9a5b219485975c6b204b5e8fbe1b2be11661225f95cc
MD5 7f71c57853dacb4808b5c550ca981420
BLAKE2b-256 9bc00d4e564ab42dd0fc527a3fcb1a3fdf9a170ae13cb61187506c5a92f14c43

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