Skip to main content

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)

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:

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:

# 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:

# 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)

Custom node for predefined chains

You can set env variable for overriding default rpc (ankr). For example, for ethereum you should set ETHEREUM_RPC=infura.com/....

Metadata

Release files for web3_premium 0.0.17

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

Source distribution (sdist)

Source distribution for web3_premium 0.0.17
File Size Uploaded
web3_premium-0.0.17.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for web3_premium 0.0.17
File Interpreter ABI Platform
web3_premium-0.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / web3_premium-0.0.17.tar.gz

Download URL web3_premium-0.0.17.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b974fb9aca4d23ce89b6d2ff706a34692b38cc8e96747d2e7009a696d1f14116
BLAKE2b-256 checksum
How to use checksums
dbdb57497b1fd25e98ae7854771c2bc5709c7ffb667c11820cdcd3c222c578a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.0

Release files / web3_premium-0.0.17-py3-none-any.whl

Download URL web3_premium-0.0.17-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69deec53036d0f0a11b143a8ddf39e5d59296bbb7b8eeeb3d5ec1150e13e00d9
BLAKE2b-256 checksum
How to use checksums
dad100d43091ada9bd762863ca574bb1e7e95b72e2a3b6945a80b02198986121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.23.0

Release history Release notifications | RSS feed

This release

0.0.17 This release

2 release files

0.0.16

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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