Code Monkey home page Code Monkey logo

ape-alchemy's People

Contributors

antazoey avatar challet avatar dtdang avatar fubuloubu avatar gosuto-inzasheru avatar jam516 avatar mikeshultz avatar notpeopling2day avatar sabotagebeats avatar tburm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ape-alchemy's Issues

Fail to get Uniswapv3 on alchemy mainnet. ERROR: (ChainError) Failed to get contract type for address '0x3416cF6C708Da44DB2624D63ea0AAef7113527C6' [APE-813]

Environment information

$ ape --version  
0.6.7

$ ape plugins list  
alchemy     0.6.1

  • Python 3.10.6
  • Linux

What went wrong?

I'm trying to replicate banteg's work here: https://gist.github.com/banteg/dcf6082ff7fc6ad51ce220146f29d9ff

ape console --network 'ethereum:mainnet:alchemy
uniswap = Contract('0x3416cF6C708Da44DB2624D63ea0AAef7113527C6')

Results

ERROR: (ChainError) Failed to get contract type for address '0x3416cF6C708Da44DB2624D63ea0AAef7113527C6'

Support all Alchemy networks

Overview

Support other alchemy networks such as Fantom

  • Polygon (#28)
  • Starknet
  • Optimism (#28)

Specification

Similar to this:
ApeWorX/ape-infura#24

Dependencies

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

Add doc strings

Overview

Add method documentation for the plugin

Specification

Setup and add method docs using sphinx

Dependencies

None

Use alchemy_getTransactionReceipts for querying [APE-1081]

Overview

alchemy has a special API we could use or querying to save a request

https://docs.alchemy.com/reference/alchemy-gettransactionreceipts

Specification

Describe the syntax and semantics of how you would like to see this feature implemented. The more detailed the better!

Remember, your feature is much more likely to be included if it does not involve any breaking changes.

Dependencies

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

Configure from configuration

Overview

Allow configuration by network similar to geth provider.

Specification

Something like this would be cool:

alchemy:
  ethereum:
    mainnet:
      uri: https://eth-rinkeby.alchemyapi.io/v2/API_KEY

Or if you feel strongly about using keys instead of JSON-RPC URIs:

alchemy:
  ethereum:
    mainnet:
      api-key: API_KEY

Or maybe both?

There's probably some security concern here. It's not ideal if these keys are committed to public repos for an Ape project. However, I think that should be a decision for users to make (they may encrypt the config in their worfklow or use private repos and share keys between the team for dev purposes).

Dependencies

Not a hard dep, but I think this would gel well with a global config: ApeWorX/ape#379.

bug: rate limiting not being handled

Environment information

  • ape and plugin versions:
$ ape --version
0.6.21

$ ape plugins list
Installed Plugins
  alchemy    0.6.5
  foundry    0.6.17
  vyper      0.6.11
  • Python Version: 3.11.5
  • OS: linux

What went wrong?

Trying to use this with a free tier Alchemy key and can't make it usable.

[...snip...]
  File "/path/to/venv/lib/python3.11/site-packages/ape/contracts/base.py", line 641, in range
    yield from self.query_manager.query(contract_event_query)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1392, in get_contract_logs
    for page in pool.map(fetch_log_page, block_ranges):
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1388, in fetch_log_page
    logs = self._get_logs(page_filter.dict(), raw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape/api/providers.py", line 1399, in _get_logs
    return self._make_request("eth_getLogs", [filter_params])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.11/site-packages/ape_alchemy/provider.py", line 200, in _make_request
    raise cls(message) from err
ape_alchemy.exceptions.AlchemyProviderError: Your app has exceeded its compute units per second capacity. If you have retries enabled, you can safely ignore this message. If not, check out https://docs.alchemy.com/reference/throughput

How can it be fixed?

I think it's critical to have HTTP retries (probably with a backoff) in this lib. This isn't a recoverable error or anything I can do about other than upgrading my Alchemy subscription.

Should be noted that Alchemy's own SDK implements retries and they recommend doing so if you implement your own provider.

I saw #35 which may be a path forward but it looks a bit stalled.

Fix typo in README

WEB3_ETHEREUM_MAINNET_ALCHEMY_PRPJECT_ID is spelled wrong, should be

WEB3_ETHEREUM_MAINNET_ALCHEMY_PROJECT_ID

:D

`Contract.Event.query` gets stuck and does not raise

Environment information

  • ape and plugin versions:
$ ape --version
0.5.5

$ ape plugins list
Installed Plugins:
  arbitrum     0.5.1
  alchemy      0.5.2
  etherscan    0.5.4
  • Python Version: 3.10.8
  • OS: macOS

What went wrong?

Please include information like:

running the following in console gets stuck for me (no more output, no errors) using alchemy as my default provider:

Contract('0x4d224452801ACEd8B2F0aebE155379bb5D594381').Transfer.query('*', start_block=14204533)
ethereum:
  default_network: mainnet
  mainnet:
    default_provider: alchemy

however, if i connect to alchemy directly (ie without using ape-alchemy):

geth:
  ethereum:
    mainnet:
      uri: https://eth-mainnet.g.alchemy.com/v2/XXX

i get the following error back:

ProviderError: Log response size exceeded. You can make eth_getLogs requests with up to a 2K block range and no limit on the response size, or you can request any block range with a cap of 10K logs in the response. Based on your parameters and the response size limit, this block range should work: [0xdbb82d, 0xdbca64]

(note that if i pass stop_block=14404196, as proposed by the error, i do get results back for both the ape-alchemy and the geth approach)

How can it be fixed?

feels to me the error should be raised all the way when using ape-alchemy, this in order to prevent endless waiting and not knowing what went wrong.

Should add PoA middleware even if began as PoA

Environment information

Goerli and such still need the PoA middleware when accessing any blocks before the merge.

What went wrong?

Please include information like:

  • what command you ran
  • the code that caused the failure (see this link for help with formatting code)
  • full output of the error you received

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.