Skip to main content

ape-quicknode: QuickNode Provider plugin

Project description

QuickNode Ape Plugin

Use the QuickNode provider plugin to interact with blockchains via QuickNode's APIs.

If you don't have a QuickNode account already, you can create one here.

Supported Networks

The ape-quicknode plugin supports the following ecosystems:

  • Ethereum
  • Arbitrum
  • Base
  • Optimism
  • Polygon
  • Polygon-ZkEVM

Dependencies

Installation

via pip

You can install the latest release via pip:

pip install ape-quicknode

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

git clone https://github.com/your-username/ape-quicknode.git
cd ape-quicknode
python3 setup.py install

Configuration

To use the QuickNode provider, you need to set up your QuickNode credentials. You can do this by setting environment variables.

Environment Variables

Set the following environment variables:

export QUICKNODE_SUBDOMAIN=your-quicknode-subdomain
export QUICKNODE_AUTH_TOKEN=your-quicknode-auth-token

Usage

Command Line

To use the QuickNode provider plugin in most commands, set it via the --network option:

ape console --network ethereum:mainnet:quicknode

Python Script

To connect to QuickNode from a Python script, use the networks top-level manager:

from ape import networks

with networks.ethereum.mainnet.use_provider("quicknode") as provider:
    # Your code here
    ...

Transaction Traces

You can access transaction traces using the QuickNode provider:

from ape import networks

quicknode = networks.provider  # Assuming connected to QuickNode
txn_hash = "0x45a8ab098ef27f028afe532f3ca241a3425725093f1302c9bf14a03993891b70"  # Replace the hash with another hash if needed or using another network
trace = quicknode.get_transaction_trace(txn_hash)
print(f"Raw call tree: {trace.get_raw_calltree()}")

Testing

CLI Testing

You can test the QuickNode provider functionality directly from the Ape console. Here's a step-by-step guide:

  1. Initialize the Ape console with QuickNode provider:
ape console --network ethereum:mainnet:quicknode
  1. Once in the console, you can make various calls to test the functionality:
# Get the latest block number
networks.provider.get_block('latest').number

# Get the current network gas price
networks.provider.gas_price

# Get a transaction by its hash
tx_hash = "0x45a8ab098ef27f028afe532f3ca241a3425725093f1302c9bf14a03993891b70" # Replace the hash with another hash if needed or using another network
networks.provider.get_transaction(tx_hash)

# Get a transaction receipt
networks.provider.get_receipt(tx_hash)

# Get a transaction trace
networks.provider.get_transaction_trace(tx_hash).get_raw_calltree()

Unit Tests

To run the unit tests for the QuickNode plugin:

pytest tests/

Development

To set up the development environment:

  1. Clone the repository
  2. Install the development dependencies:
pip install -e ".[dev]"
  1. Install the pre-commit hooks:
pre-commit install

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache 2.0 License.

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

ape_quicknode-0.8.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

ape_quicknode-0.8.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file ape_quicknode-0.8.0.tar.gz.

File metadata

  • Download URL: ape_quicknode-0.8.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for ape_quicknode-0.8.0.tar.gz
Algorithm Hash digest
SHA256 8d538c240fc50e89cf02aa34611c89dd983b58739e8bec8adaa1c844891b6aa7
MD5 cdfa89b10d8e2fc2085ab99d27d7b055
BLAKE2b-256 2c7f38f6fb5649f5416287d044e0f3ff50390691282ec453bc1b166d0278c589

See more details on using hashes here.

File details

Details for the file ape_quicknode-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: ape_quicknode-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for ape_quicknode-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20e11059204ad7d645c7bfd9cd45743e8a2dd99a4974d733b0c40f3328f03160
MD5 48af0f0bf36a261e71d249c308a7ab6f
BLAKE2b-256 ef4d8ae13d6fa54ec70909910b56bf5c16b86fb853eee7fd0d5d55163490afce

See more details on using hashes here.

Supported by

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