Skip to main content

Library to send batch requests using web3.py

Project description

web3Batch.py

Installation

pip install web3Batch

Example

from web3 import Web3
from web3Batch import We3Batch

contract_addresses = ['0x...', '0x...', ...]
endpoint_uri = 'https://localhost:6000'

web3 = Web3(Web3.HTTPProvider(endpoint_uri))

# Your abi for contracts
abi = {...}

contracts = [web3.eth.contract(
    address=web3.to_checksum_address(contract_address)
) for contract_address in contract_addresses]

wb = Web3Batch(endpoint_uri)

for contract in contracts:
    wb.add_contract_request(
        contract=contract,
        fn_name='balanceOf',
        args=(web3.to_checksum_address(contract.address))
    )

responses = wb.send_requests()

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

web3Batch-0.0.3.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file web3Batch-0.0.3.tar.gz.

File metadata

  • Download URL: web3Batch-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for web3Batch-0.0.3.tar.gz
Algorithm Hash digest
SHA256 567d821cd885bc89e2f90bc44423209a1e5d6d005ff29ef75bc8a547c5a2470b
MD5 134b34558c35418d1dfad9f89489f19a
BLAKE2b-256 46fed652c8f5dcceec4fe6d27935f07292f63f0ab09a0eb4d4c51094827cfeab

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