This library consolidates various functions to efficiently load network data for Lido, validate node operator keys and find key duplicates.
Project description
Lido Python SDK
This repo provides a scratch of a Python project. Its purpose is to serve as starting point for the development of a Python project based on a minimal working structure.
Installation
This library is available on PyPi:
pip install lido-sdk
Main Features
Multicall Function Calls
Instead of making network requests one-by-one, this library combines many requests into one RPC call. It uses banteg/multicall.py, a Python wrapper for makerdao/multicall.
Automatic Testnet / Mainnet Switching
Depending on which network is configured in web3 object, a set of contracts will be used. Available networks:
- Mainnet
- Görli
- Ropsten
Helpers Provided
-
lido.get_operators_data() -> operator_data - load node operator data
-
lido.get_operators_keys(operator_data) -> operator_data - fetches and adds keys to operator_data
-
lido.validate_keys(operator_data, strict = False) -> [] - same as validate_keys_multi(), but returns a list of invalid keys
(IN PROGRESS) -
lido.validate_key(chain_id, key, withdrawal_credentials) -> Boolean - low-level validation function, doesn't check for correct chain_id and withdrawal_credentials for a Lido deployment. For most use-cases use validate_keys_multi or validate_key_list_multi instead
-
lido.find_duplicates(operator_data) -> operator_data - finds duplicate keys and adds results to operator_data
-
lido.fetch_and_validate() -> operator_data - combines fetching operator data and running all validations on it - useful when you would be running all validations on data anyway
-
lido.get_stats() -> stats - fetches various constants from Lido contract, but you can even pass a list of functions to fetch eg get_stats(["isStopped"])
You can mix and match these functions, but make sure to use get_operators_data() first.
Development
Clone project:
git clone git@github.com:lidofinance/lido-python-sdk.git
cd lido-python-sdk
Create virtual env:
virtualenv .env --python=python3
source .env/bin/activate
Install all dependencies:
pip install -r requirements.txt
pip install -r requirements-dev.txt
How to test
Simply run in project root directory:
pytest .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lido_sdk-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 354861ffd0a11dc1178cffb37237421faf94dc83bfd24ab6be6276aaf51c8a3a |
|
MD5 | b8b491338c966b9915a2d768208aa07c |
|
BLAKE2b-256 | c431ca5271f599e66a799af1d4c7f487a6a038f391e787671e24e21be53d3a98 |