ape-etherscan icon indicating copy to clipboard operation
ape-etherscan copied to clipboard

ProviderAPI implementation using Geth/parity proxy [APE-780]

Open antazoey opened this issue 2 years ago • 0 comments

Overview

One could implement a ProviderAPI using Etherscan's Geth/Parity proxy API: https://docs.etherscan.io/api-endpoints/geth-parity-proxy.

This is a good opportunity for a contributor to create a ProviderAPI implementation without having to make a whole new plugin!

Specification

Just an idea / psuedo-python (missing tons of things - this code wont work at all, just for demo, <3)

(ape_etherscan/provider.py)

from ape.api import ProviderAPI, BlockAPI

class EtherscanProvider(ProviderAPI):
    client_factory
    
    @cached_property
    def client(self) -> ProxyClient:
        ...
        
    def get_block(self, number):
        response = self.client.get_block(number)
        return BlockAPI.parse_obj(response)

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

antazoey avatar Mar 31 '23 19:03 antazoey