Skip to main content

Data Science friendly wrapper for web3py

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web3_premium-0.0.4.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web3_premium-0.0.4-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file web3_premium-0.0.4.tar.gz.

File metadata

  • Download URL: web3_premium-0.0.4.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for web3_premium-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d00a02ff5e2d16df8358b746429fa652a5bcd5a6f595fcfbe8a60dabfb8e6ab1
MD5 2f8670f4b60342ae3ae444736e9ecd83
BLAKE2b-256 d03f065ab572df34e41a570980fbb5e49d008b64d689f50751c6444cd6b2d35c

See more details on using hashes here.

File details

Details for the file web3_premium-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: web3_premium-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for web3_premium-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 65407da2fc1e6c8cc58eef80311f92678db705c8ce12085a215be838fabc2a5f
MD5 c9e51423b3c4bcf8a06f9e50db8116aa
BLAKE2b-256 cd847e5f19c9f2e813d113811c31142dea1d7702d41f49eea6bb6875f78a92a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page