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.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ba34c59975ea81332b7c4656d9795113b1a6171b1086f6e3f2d7313db9cca56 |
|
MD5 | d8d9bb35de0295175f194c0e9b1649b4 |
|
BLAKE2b-256 | 19c405d04607efc291d72343b552d2476f971a7c2928fda6156efd2fcdf7ce46 |