Skip to main content

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.

Metadata

Release files for uniswap-fetcher-rs 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for uniswap-fetcher-rs 0.1.11
File Interpreter ABI Platform
uniswap_fetcher_rs-0.1.11-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
uniswap_fetcher_rs-0.1.11-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
uniswap_fetcher_rs-0.1.11-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details

Total release size: 8.8 MB

Release files / uniswap_fetcher_rs-0.1.11-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL uniswap_fetcher_rs-0.1.11-cp312-cp312-manylinux_2_34_x86_64.whl
Size 2.9 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
2c743cc2ffb81a6a1220025f3437598219f9b321ab03f6c5b4984f968c9ba5c0
BLAKE2b-256 checksum
How to use checksums
33e440495500b6a0e9201d7e91abf990366ccbbcb9e136e84d62c06c0e304e14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / uniswap_fetcher_rs-0.1.11-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL uniswap_fetcher_rs-0.1.11-cp311-cp311-manylinux_2_34_x86_64.whl
Size 2.9 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
a052d699b9f98391bfe127c5b52143667c541614151cd79471b58f74fa14f556
BLAKE2b-256 checksum
How to use checksums
1691299288d59d848098d831af388884ec447659633dcfe16c9a25feb86a201d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / uniswap_fetcher_rs-0.1.11-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL uniswap_fetcher_rs-0.1.11-cp310-cp310-manylinux_2_34_x86_64.whl
Size 2.9 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
96efff5686e70643bc786dade0b22f0bde354572b7b4e2feacb8e3cbbedd9b95
BLAKE2b-256 checksum
How to use checksums
81b9f02f8f428e1d72a8733e6576862deedf79b2d2564f13be4fb05a2d10b877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for uniswap-fetcher-rs 0.1.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page