Skip to main content

An async Python library for interacting with the Jito JSON-RPC

Project description

aiojito

aiojito is an async Python library for interacting with the Jito via JSON-RPC.

Installation

pip install aiojito

Usage

1.Gets the block engine url

You can access the block engine information using the interface below

from aiojito.api.block_engine import BlockEngine

engines = BlockEngine.get_block_engines(network='mainnet')
for k, v in engines.items():
    print(k)
    print(v['block_engine_url'])

You can get the address of the block engine from jito's website

2.Interact with Jito as a searcher asynchronously

import asyncio
import aiohttp
from aiojito.async_api.searcher import AsyncSearcher


async def main():
    # Create a session context manager
    async with aiohttp.ClientSession() as session:
        # Create a searcher instance  
        block_engine_url = "https://ny.mainnet.block-engine.jito.wtf"
        searcher = AsyncSearcher(block_engine_url=block_engine_url, session=session)

        # Get tip accounts  
        tip_accounts = await searcher.get_tip_accounts()
        print("Tip Accounts:", tip_accounts)

        # Get bundle statuses  
        bundle_ids = ["your_bundle_id_here"]
        bundle_statuses = await searcher.get_bundle_statuses(bundle_ids)
        print("Bundle Statuses:", bundle_statuses)

        # Send a bundle  
        transactions = ["your_base58_encoded_transaction_here"]
        bundle_id = await searcher.send_bundle(transactions)
        print("Sent Bundle ID:", bundle_id)

        # Send a transaction  
        transaction = "your_base58_encoded_transaction_here"
        transaction_id = await searcher.send_transaction(transaction)
        print("Sent Transaction ID:", transaction_id)


asyncio.run(main())

License

This project is licensed under the MIT License. See the LICENSE file for more 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

aiojito-0.1.1.tar.gz (59.3 kB view details)

Uploaded Source

Built Distribution

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

aiojito-0.1.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file aiojito-0.1.1.tar.gz.

File metadata

  • Download URL: aiojito-0.1.1.tar.gz
  • Upload date:
  • Size: 59.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for aiojito-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8897f26f96bb18b10d7932978a0b6f055313a5d6185f2074c6172ec6a4c9280e
MD5 ddf6be754584e4193ea3487885b10091
BLAKE2b-256 1b546876c1f82d392a4c124062a4935540f4dae3ea9d8a4ed34eb70ae34f21e7

See more details on using hashes here.

File details

Details for the file aiojito-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiojito-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for aiojito-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23e8ab2e9998a9fc675d784f90364f270c735dffb55790c1224130e15f5f7ff0
MD5 62174dbb44677b31feb0b68fbf4003ec
BLAKE2b-256 efd5397b377fc4499c3b4cb8099ca44d34567ce97d3bf0dab38ea12325d04d09

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