Name | web3client JSON |
Version |
1.3.11
JSON |
| download |
home_page | None |
Summary | Batteries-included client to interact with blockchains and smart contracts |
upload_time | 2024-05-16 08:49:17 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
web3
blockchain
ethereum
evm
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Batteries-included client to interact with blockchains and smart contracts; used by [`web3cli`](https://github.com/coccoinomane/web3cli) and [crabada.py](https://github.com/coccoinomane/crabada.py).
# Features
- Easily create a client to interact with EVM-compatible chains
- Works with Ethereum, Binance, Avalanche, Arbitrum One, zkSync Era, etc.
- Subscribe to pending transactions in the mempool and new blocks
- Flexible logging of RPC calls and transactions
- Interact with tokens and ETH with the same dual interface
- Includes a client for Compound V2 operations, and its clones
- Save gas by setting an upper limit on the base fee
- Need more flexibility? Use directly the underlying web3.py client
# Install
```bash
pip3 install -U web3client
```
# Examples
- Stream pending transactions on the zkSync Era network:
```python
from web3client.base_client import BaseClient
client = BaseClient("wss://mainnet.era.zksync.io/ws")
client.subscribe(lambda tx, _, __: print(f"Pending tx: {tx}"))
```
- Send 1 ETH and 100 USDC to Unicef, using a dual client:
```python
from web3client.erc20_client import DualClient
rpc = "https://cloudflare-eth.com"
private_key = "0x..."
unicef = "0xA59B29d7dbC9794d1e7f45123C48b2b8d0a34636"
USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
usdc_client = DualClient(rpc, private_key=private_key, contract_address=USDC)
usdc_client.send_eth(unicef, 1)
usdc_client.transfer(unicef, 100)
```
# More examples
Please find more examples
- in the [examples folder](./examples), and
- in the [tests folder](./tests).
# Test suite `web3test`
`web3client` comes with several pytest plugins you can use to test your scripts:
- `web3test-ape`: fixtures of accounts and smart contracts (erc20, compound, etc)
- `web3test-web3client`: fixtures of clients for various smart contracts
- `web3test-web3factory`: fixtures of clients for various chains
To use one or more plugins in your script, add the following lines at the top of your `conftest.py``:
```python
pytest_plugins = [
"web3test-ape", "web3test-web3client", "web3test-web3factory"
]
```
The order of the plugins in the aray is important.
# It doesn't work 😡
Don't panic! Instead...
1. Please check if your issue is listed in the [Issues tab](https://github.com/coccoinomane/web3client/issues).
2. If not, consider [writing a new issue](https://github.com/coccoinomane/web3client/issues/new) 🙂
# Contributing
All contributions are welcome! To start improving `web3client`, please refer to our [__contribution guide__](./CONTRIBUTING.md).
Raw data
{
"_id": null,
"home_page": null,
"name": "web3client",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "web3, blockchain, ethereum, evm",
"author": null,
"author_email": "coccoinomane <coccoinomane@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1b/01/cc42f1706effb3901695b6a536a420ffedbf6068c28cd1cd63e5a863a11f/web3client-1.3.11.tar.gz",
"platform": null,
"description": "Batteries-included client to interact with blockchains and smart contracts; used by [`web3cli`](https://github.com/coccoinomane/web3cli) and [crabada.py](https://github.com/coccoinomane/crabada.py).\n\n# Features\n\n- Easily create a client to interact with EVM-compatible chains\n- Works with Ethereum, Binance, Avalanche, Arbitrum One, zkSync Era, etc.\n- Subscribe to pending transactions in the mempool and new blocks\n- Flexible logging of RPC calls and transactions\n- Interact with tokens and ETH with the same dual interface\n- Includes a client for Compound V2 operations, and its clones\n- Save gas by setting an upper limit on the base fee\n- Need more flexibility? Use directly the underlying web3.py client\n\n\n# Install\n\n```bash\npip3 install -U web3client\n```\n\n# Examples\n\n- Stream pending transactions on the zkSync Era network:\n\n ```python\n from web3client.base_client import BaseClient\n \n client = BaseClient(\"wss://mainnet.era.zksync.io/ws\")\n client.subscribe(lambda tx, _, __: print(f\"Pending tx: {tx}\"))\n ```\n\n- Send 1 ETH and 100 USDC to Unicef, using a dual client:\n ```python\n from web3client.erc20_client import DualClient\n \n rpc = \"https://cloudflare-eth.com\"\n private_key = \"0x...\"\n unicef = \"0xA59B29d7dbC9794d1e7f45123C48b2b8d0a34636\"\n USDC = \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"\n\n usdc_client = DualClient(rpc, private_key=private_key, contract_address=USDC)\n usdc_client.send_eth(unicef, 1)\n usdc_client.transfer(unicef, 100)\n ```\n\n# More examples\n\nPlease find more examples\n\n- in the [examples folder](./examples), and\n- in the [tests folder](./tests).\n\n\n# Test suite `web3test`\n\n`web3client` comes with several pytest plugins you can use to test your scripts:\n\n- `web3test-ape`: fixtures of accounts and smart contracts (erc20, compound, etc)\n- `web3test-web3client`: fixtures of clients for various smart contracts \n- `web3test-web3factory`: fixtures of clients for various chains\n\nTo use one or more plugins in your script, add the following lines at the top of your `conftest.py``:\n\n```python\npytest_plugins = [\n \"web3test-ape\", \"web3test-web3client\", \"web3test-web3factory\"\n]\n```\n\nThe order of the plugins in the aray is important.\n\n# It doesn't work \ud83d\ude21\n\nDon't panic! Instead...\n\n1. Please check if your issue is listed in the [Issues tab](https://github.com/coccoinomane/web3client/issues).\n2. If not, consider [writing a new issue](https://github.com/coccoinomane/web3client/issues/new) \ud83d\ude42\n\n# Contributing\n\nAll contributions are welcome! To start improving `web3client`, please refer to our [__contribution guide__](./CONTRIBUTING.md).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Batteries-included client to interact with blockchains and smart contracts",
"version": "1.3.11",
"project_urls": {
"homepage": "https://github.com/coccoinomane/web3client",
"repository": "https://github.com/coccoinomane/web3client"
},
"split_keywords": [
"web3",
" blockchain",
" ethereum",
" evm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e27ca484043563a0031fa151bc9c105b6599fb5a860e79f7349888a239e70c63",
"md5": "dbd44ec168502cb2b1379d8d35de3c63",
"sha256": "e3ffc9b1519832c64557ee69fc21716d98020cae24cf620b2bcbac5e4f934cfd"
},
"downloads": -1,
"filename": "web3client-1.3.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dbd44ec168502cb2b1379d8d35de3c63",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 2709580,
"upload_time": "2024-05-16T08:49:14",
"upload_time_iso_8601": "2024-05-16T08:49:14.952182Z",
"url": "https://files.pythonhosted.org/packages/e2/7c/a484043563a0031fa151bc9c105b6599fb5a860e79f7349888a239e70c63/web3client-1.3.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1b01cc42f1706effb3901695b6a536a420ffedbf6068c28cd1cd63e5a863a11f",
"md5": "074f0427d8fbe9458399c1b6f170c390",
"sha256": "c1045deab4b0b14ce000e0d51f8de95366b39d567c6ae9c82df04dcefe1a3317"
},
"downloads": -1,
"filename": "web3client-1.3.11.tar.gz",
"has_sig": false,
"md5_digest": "074f0427d8fbe9458399c1b6f170c390",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 2203379,
"upload_time": "2024-05-16T08:49:17",
"upload_time_iso_8601": "2024-05-16T08:49:17.736364Z",
"url": "https://files.pythonhosted.org/packages/1b/01/cc42f1706effb3901695b6a536a420ffedbf6068c28cd1cd63e5a863a11f/web3client-1.3.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-16 08:49:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "coccoinomane",
"github_project": "web3client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "web3client"
}