Metadata-Version: 2.1
Name: web3_premium
Version: 0.0.4
Summary: Data Science friendly wrapper for web3py
Project-URL: Homepage, https://github.com/Whynot63/web3-premium/
Project-URL: Bug Tracker, https://github.com/Whynot63/web3-premium/issues
Author-email: Dmitry Andreev <deal.d@me.com>
License: MIT License
        
        Copyright (c) [year] [fullname]
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: web3>=5.29.0
Description-Content-Type: text/markdown

# web3-premium
Data Science friendly wrapper for web3py

## Installation
```
python3 -m pip install web3_premium
```


## Explorers wrapper

Usage: `<explorer>.<module>.<action>(<params>)`  
List of modules and module actions you can get from explorer documentation (etherscan, for example: https://docs.etherscan.io/api-endpoints/accounts)

```python
import time

from web3_premium.explorer import etherscan


timestamp = int(time.time())
etherscan.block.getblocknobytime(timestamp=timestamp, closest="before")
```

You can also add new explorer, which support etherscan/blockscout api format, for example:
```python
import time

from web3_premium.explorer import Explorer


timestamp = int(time.time())
andromeda = Explorer("https://andromeda-explorer.metis.io/api")
andromeda.block.getblocknobytime(timestamp=timestamp, closest="before")
```

## Web3 smart contracts wrapper
Basic example with pure web3:
```python
# We wanna to know, how many USDT at ethereum holds zero address (0x00000....) at 01.08.2022 (block 15253306)
from web3 import Web3

BLOCK = 15253306

w3 = Web3(Web3.HTTPProvider("https://rpc.ankr.com/eth"))
usdt_abi = ...  # some big json
usdt = w3.eth.contract(
    Web3.toChecksumAddress("0xdaC17F958D2ee523a2206206994597C13D831ec7"), abi=usdt_abi
)
burnedUsdt = usdt.functions.balanceOf(
    "0x0000000000000000000000000000000000000000"
).call(block_identifier=BLOCK)
```

With web3-premium:
```python
# We wanna to know, how many USDT at ethereum holds zero address (0x00000....) at 01.08.2022 (block 15253306)
from web3_premium.chains import ethereum
from web3_premium.contract import Contract

BLOCK = 15253306

usdt = Contract("0xdaC17F958D2ee523a2206206994597C13D831ec7", ethereum)
burnedUsdt = usdt.balanceOf("0x0000000000000000000000000000000000000000", block=BLOCK)
```


