# 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](https://rustup.rs/)
- Python 3.10 or higher
- An Ethereum node RPC URL
## Installation
1. Clone the repository:
```sh
git clone https://github.com/nestlest/uniswap-fetcher-rs.git
cd uniswap-fetcher-rs
```
2. Build the Python module:
```sh
maturin develop
```
This will build the Rust code and install the Python module locally.
## Usage
### Python
```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:
```sh
cargo test
```
## License
This project is licensed under the MIT License. See the [MIT License](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/analyzify360/uniswap-fetcher-rs",
"name": "uniswap-fetcher-rs",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "uniswap, ethereum, rust, python, pyo3",
"author": "venus1004@proton.me",
"author_email": "venus1004@proton.me",
"download_url": null,
"platform": null,
"description": "# Uniswap Fetcher\n\nUniswap 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.\n\n## Features\n\n- Fetch pool events by token pairs within a specified block range.\n- Fetch pool events by token pairs within a specified time range.\n- Fetch pool created events between two timestamps.\n- Get block number range for a given timestamp range.\n\n## Prerequisites\n\n- Rust and Cargo: Install from [rustup.rs](https://rustup.rs/)\n- Python 3.10 or higher\n- An Ethereum node RPC URL\n\n## Installation\n\n1. Clone the repository:\n\n ```sh\n git clone https://github.com/nestlest/uniswap-fetcher-rs.git\n cd uniswap-fetcher-rs\n ```\n\n2. Build the Python module:\n\n ```sh\n maturin develop\n ```\n\n This will build the Rust code and install the Python module locally.\n\n## Usage\n\n### Python\n\n```python\nfrom uniswap_fetcher_rs import UniswapFetcher\n\n# Initialize the fetcher with the RPC URL\nfetcher = UniswapFetcher(\"http://localhost:8545\")\n\n# Define token pairs and block range\ntoken_pairs = [(\"0xaea46a60368a7bd060eec7df8cba43b7ef41ad85\", \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", 3000)]\nfrom_block = 12345678\nto_block = 12345778\n\n# Fetch pool events by token pairs\nevents = fetcher.get_pool_events_by_token_pairs(token_pairs, from_block, to_block)\nprint(events)\n\n# Define time range\nstart_timestamp = 1633046400 # Example start timestamp\nend_timestamp = 1633132800 # Example end timestamp\n\n# Fetch pool data by token pairs within the specified time range\npool_data = fetcher.fetch_pool_data(token_pairs, start_timestamp, end_timestamp)\nprint(pool_data)\n\n# Fetch pool created events between two timestamps\npool_created_events = fetcher.get_pool_created_events_between_two_timestamps(start_timestamp, end_timestamp)\nprint(pool_created_events)\n```\nTo use the library directly in Rust, you can call the asynchronous functions provided in the `lib.rs` file.\n## Testing\nTo run the tests, use the following command:\n```sh\ncargo test\n```\n## License\nThis project is licensed under the MIT License. See the [MIT License](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Rust-based library to fetch and decode Uniswap V3 pool events, designed to be used as a Python module.",
"version": "0.1.8",
"project_urls": {
"Homepage": "https://github.com/analyzify360/uniswap-fetcher-rs",
"Source Code": "https://github.com/analyzify360/uniswap-fetcher-rs"
},
"split_keywords": [
"uniswap",
" ethereum",
" rust",
" python",
" pyo3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ada2f201d2f7efbbf5a48b779b7aceb6c45e523fc105f915ef96bbe6e3e618f9",
"md5": "79f88bd3c0a43521287307280171d1e9",
"sha256": "96ba123173c07dfe9b3871971b225292fbb83d3e3e51b167931f051bb19a81f5"
},
"downloads": -1,
"filename": "uniswap_fetcher_rs-0.1.8-cp310-cp310-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "79f88bd3c0a43521287307280171d1e9",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 2871843,
"upload_time": "2024-12-10T18:03:54",
"upload_time_iso_8601": "2024-12-10T18:03:54.640401Z",
"url": "https://files.pythonhosted.org/packages/ad/a2/f201d2f7efbbf5a48b779b7aceb6c45e523fc105f915ef96bbe6e3e618f9/uniswap_fetcher_rs-0.1.8-cp310-cp310-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c4729f85b2f042f3eecae166a89a207bcecfc3028a47067a81082b4d35cc5359",
"md5": "11963076239667925e07fc7c28a0b05d",
"sha256": "d17373a5d2caf31d5a868ccbbce43a251d605a97ab29d88ad09cf4e2f6373141"
},
"downloads": -1,
"filename": "uniswap_fetcher_rs-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "11963076239667925e07fc7c28a0b05d",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 2871839,
"upload_time": "2024-12-10T18:03:56",
"upload_time_iso_8601": "2024-12-10T18:03:56.627103Z",
"url": "https://files.pythonhosted.org/packages/c4/72/9f85b2f042f3eecae166a89a207bcecfc3028a47067a81082b4d35cc5359/uniswap_fetcher_rs-0.1.8-cp311-cp311-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "286bb6cda79030b1a15037b6e7831a0856d5437ed847083b765b3c44a3b92953",
"md5": "0b4f6c7672eb5148ecaee4fd8b556d0a",
"sha256": "0fe4e9d073887c23d3bdb8c051202c1fa06864d7182eea0d1d306ea3c4d7b929"
},
"downloads": -1,
"filename": "uniswap_fetcher_rs-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl",
"has_sig": false,
"md5_digest": "0b4f6c7672eb5148ecaee4fd8b556d0a",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 2871777,
"upload_time": "2024-12-10T18:03:59",
"upload_time_iso_8601": "2024-12-10T18:03:59.678394Z",
"url": "https://files.pythonhosted.org/packages/28/6b/b6cda79030b1a15037b6e7831a0856d5437ed847083b765b3c44a3b92953/uniswap_fetcher_rs-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 18:03:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "analyzify360",
"github_project": "uniswap-fetcher-rs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "uniswap-fetcher-rs"
}