Skip to content

EtherHounds/API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forks Issues Contributors


Logo

EtherHound (API)

The API of EtherHound Core
Explore the docs »

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

EtherHound API is an asynchronous Python client library designed to interact seamlessly with the EtherHound Core API. It provides a simple and efficient interface for making HTTP requests to EtherHound-powered services, supporting modern Python features and type hints. Built on top of aiohttp and leveraging pydantic for data validation, this library enables developers to quickly integrate EtherHound API endpoints into their applications with minimal boilerplate.

Key features:

  • Asynchronous HTTP requests for high performance
  • Configurable host, port, and protocol settings
  • Designed for extensibility

(back to top)

Built With

  • Pydantic

(back to top)

Getting Started

Prerequisites

  • python >= 3.11
  • pydantic
  • aiohttp

Installation

Github installation:

  1. clone the repo
git clone https://github.com/EtherHounds/API.git
  1. cd into the repo
cd API
  1. build
pip install . -U
  1. done!

PyPi (recommended):

pip install etherhound-api

(back to top)

Usage

Subscribe to an Event

from houndapi import HoundAPI, LogsSubscription
import asyncio

async def main():
  client = HoundAPI(
    host="127.0.0.1", # local host
    port=8080
  )
  result = await client.subscribe(LogsSubscription(
    label="deposits",
    address="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", # BSC-WBNB Contract
    topics=["0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"] # The Deposit Event Hash
  ))
  print(f"Subscribed Successfully ✔️, Subscription ID: ({result.result[0]})")
  await client.close()

asyncio.run(main())

Poll Subscription Events

from houndapi import HoundAPI
import asyncio

async def main():
  client = HoundAPI(
    host="127.0.0.1", # local host
    port=8080
  )
  result = await client.poll(
    subscription_id="0xYourSubscriptionID",
    limit=10 # poll only first 10 events
  )
  for res in result:
    print(f"New Event From Subscription {res.label}")
    print(f"({res.result.address}) Has Deposited {(int(res.result.data, base=16))*10**-18:.8f} WBNB")
    print(f"(https://bscscan.com/tx/{res.result.transaction_hash})")
    print("-"*50)
  await client.close()

asyncio.run(main())

(back to top)

Roadmap

  • Examples
  • Better Documentation

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Top contributors:

contrib.rocks image

License

Distributed under the project_license. See LICENSE.txt for more information.

(back to top)

Contact

SpicyPenguin - @kerolis55463

Project Link: https://github.com/EtherHounds/API

(back to top)

About

the EtherHounds Core Library API Client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages