apeworx / ape-infura Goto Github PK
View Code? Open in Web Editor NEWInfura network provider plugin for the Ape Framework
Home Page: https://www.apeworx.io/
License: Apache License 2.0
Infura network provider plugin for the Ape Framework
Home Page: https://www.apeworx.io/
License: Apache License 2.0
Related to ApeWorX/ape-polygon#25
Polygon Mumbai is scheduled to be deprecated in favor of Amoy. Provide infura support for Polygon Amoy.
ape-polygon
0.7.2, https://github.com/ApeWorX/ape-polygon/releases/tag/v0.7.2.n/a
If you develop off a fork, the infura project ID does not appear in GitHub.
If you develop by pushing branches directly to the plug in (like members of apeworx can), then it works fine.
Perhaps we have to skip tests that require a secret for external contributors or maybe use a mock HTTP provider
Implement StorageAPI using IPFS feature of infura
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.
information posted here: ApeWorX/ape#119
Linea testnet has already been public released few months ago, and linea mainnet will be available soon roughly on 18th July.
In ConsenSys, we have created a fork of this repo at apxworx-ape-infura to add the feature to this library to support linea goerli testnet
and linea mainnet
.
And this PR will be created soon to merge to this repo from our fork repo after we have successfully tested with linea chain.
linea testnet
and linea mainnet
support to this plugin.Following is the detail of linea network information:
Network Name | Linea goerli testnet | Linea Mainnet |
---|---|---|
RPC URL | https://linea-goerli.infura.io/v3/<PROJECT_ID> | https://linea-mainnet.infura.io/v3/<PROJECT_ID> |
Chain ID | 59140 | 59144 |
Currency Symbol | ETH | ETH |
Block Explorer URL | https://goerli.lineascan.build/ | https://explorer.linea.build/ |
above information will be added to appropriate python files in this plugin.
None.
In the connect we need to add PoA dynamic checking:
def check_poa(block_id) -> bool:
try:
block = self.web3.eth.get_block(block_id)
except ExtraDataLengthError:
return True
else:
return (
"proofOfAuthorityData" in block
or len(block.get("extraData", "")) > MAX_EXTRADATA_LENGTH
)
# Handle if using PoA
if any(map(check_poa, (0, "latest"))):
self._web3.middleware_onion.inject(geth_poa_middleware, layer=0)
Latest
Instead of trying to connect to https://rinkeby.infura.io/v3/None
,
it should error earlier stating that it is missing env vars
ape-http is too generic that is would be fragile to try and handle detecting these errors from every possible provider plugin. From observation, every provider returns these error messages in different formats, some JSON and some just text, all with different patterns etc, it is too complex to try and handle from a single provider. Every provider should handle this separately and more custom to its needs.
THUS
We need to raise VirtualMachineError
and handle the errors accordingly to Infura error format and specific messages, similar to other existing provider plugins (use ape-http
as a reference or follow ApeWorX/ape-hardhat#4).
See ape-http
provider handling for methods get_transaction()
and estimate_gas()
as well as the utility method it uses.
Possible look into middleware layers for web3.
Include links to any open issues that must be resolved before this feature can be implemented.
ape
and plugin versions:$ ape --version
0.7.7
$ ape plugins list
Installed Plugins
etherscan 0.7.0
infura 0.7.0
polygon 0.7.1
solidity 0.7.1
Tests fail because goerli for arbitrum and optimism are no longer supported by Infura (no endpoints available).
Please include information like:
Fill this in if you have ideas on how the bug could be fixed.
ape
and plugin versions:(venv) david@david-Inspiron-5502:~/projects/ape-sandbox$ ape --version
0.3.5
(venv) david@david-Inspiron-5502:~/projects/ape-sandbox$ ape plugins list
No plugins installed. Use '--all' to see available plugins.
(venv) david@david-Inspiron-5502:~/projects/ape-sandbox$ python --version
Python 3.8.10
(venv) david@david-Inspiron-5502:~/projects/ape-sandbox$ inxi -S
System: Host: david-Inspiron-5502 Kernel: 5.15.0-41-generic x86_64 bits: 64 Desktop: Unity
Distro: Ubuntu 20.04.4 LTS (Focal Fossa)
(venv) david@david-Inspiron-5502:~/projects/ape-sandbox$ ape plugins install ape-infura
WARNING: Plugin 'ape-infura' is not an trusted plugin.
Install unknown 3rd party plugin 'ape-infura'? [y/N]: y
INFO: Installing ape-infura...
ERROR: Could not find a version that satisfies the requirement ape-ape-infura (from versions: none)
ERROR: No matching distribution found for ape-ape-infura
ERROR: Failed to install plugin 'ape-infura.
¯\_(ツ)_/¯
Infura's website lists Avalanche C-chain support
Add it and test it
n/a
Provide a simple overview of what you wish to see added. Please include:
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.
Include links to any open issues that must be resolved before this feature can be implemented.
Provide a simple overview of what you wish to see added. Please include:
We should tell the users in the README.md to add the env var
# Used by the `ape-infura` plugin
export WEB3_INFURA_PROJECT_ID=<YOUR_INFURA_PROJECT_ID>
# Used by the `ape-alchemy` plugin
export WEB3_ALCHEMY_API_KEY=<YOUR_ALCHEMY_KEY>
look at the README in alchemy for reference:
https://github.com/ApeWorX/ape-alchmey
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.