Skip to main content

A Rust-based library to fetch and decode Uniswap V3 pool events, designed to be used as a Python module.

Project description

Uniswap Fetcher

Uniswap Fetcher is a Rust-based library that provides functionalities to fetch and decode Uniswap V3 pool events. It is designed to be used as a Python module using PyO3.

Features

  • Fetch pool events by token pairs within a specified block range.
  • Fetch pool events by token pairs within a specified time range.
  • Fetch pool created events between two timestamps.
  • Get block number range for a given timestamp range.

Prerequisites

  • Rust and Cargo: Install from rustup.rs
  • Python 3.10 or higher
  • An Ethereum node RPC URL

Installation

  1. Clone the repository:

    git clone https://github.com/nestlest/uniswap-fetcher-rs.git
    cd uniswap-fetcher-rs
    
  2. Build the Python module:

    maturin develop
    

    This will build the Rust code and install the Python module locally.

Usage

Python

from uniswap_fetcher_rs import UniswapFetcher

# Initialize the fetcher with the RPC URL
fetcher = UniswapFetcher("http://localhost:8545")

# Define token pairs and block range
token_pairs = [("0xaea46a60368a7bd060eec7df8cba43b7ef41ad85", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 3000)]
from_block = 12345678
to_block = 12345778

# Fetch pool events by token pairs
events = fetcher.get_pool_events_by_token_pairs(token_pairs, from_block, to_block)
print(events)

# Define time range
start_timestamp = 1633046400  # Example start timestamp
end_timestamp = 1633132800    # Example end timestamp

# Fetch pool data by token pairs within the specified time range
pool_data = fetcher.fetch_pool_data(token_pairs, start_timestamp, end_timestamp)
print(pool_data)

# Fetch pool created events between two timestamps
pool_created_events = fetcher.get_pool_created_events_between_two_timestamps(start_timestamp, end_timestamp)
print(pool_created_events)

To use the library directly in Rust, you can call the asynchronous functions provided in the lib.rs file.

Testing

To run the tests, use the following command:

cargo test

License

This project is licensed under the MIT License. See the MIT 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

uniswap_fetcher_rs-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

uniswap_fetcher_rs-0.1.9-cp311-cp311-manylinux_2_34_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

uniswap_fetcher_rs-0.1.9-cp310-cp310-manylinux_2_34_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file uniswap_fetcher_rs-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for uniswap_fetcher_rs-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 580cf32dfef9565be21b95e2371582f990abc98c2ceee82d0785caafaebfcab1
MD5 63bd24b1fedfdf883aa3b87d5d5e16a0
BLAKE2b-256 2385e0f8013aa70b9366114062f618c2ad4bef09196ba0c02bec8d451d6483a5

See more details on using hashes here.

File details

Details for the file uniswap_fetcher_rs-0.1.9-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for uniswap_fetcher_rs-0.1.9-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7e4bfb9dc5c2b810e1b1a309ebd975c8e99e9d4efeec1860eb19f8069addd488
MD5 abc0078d44fac6cba5e1a0393ae99b67
BLAKE2b-256 05cda5f24782a7159d852a32702bf73dd5a1dd9bf5d7e806b56ab6a0c36eee06

See more details on using hashes here.

File details

Details for the file uniswap_fetcher_rs-0.1.9-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for uniswap_fetcher_rs-0.1.9-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 16bb81c980d236bd5d5d16f174c60a828015c245ddf401a033f04c9712d90e4a
MD5 c9ed5740b0c65a7419e4de4349dd2a6e
BLAKE2b-256 c78ab2ec75dfdb26160e924ed227402fafddacb28c4edcd0a48d428448b5bd2a

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