-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples of how to use ethpm for contract factories/instances #1617
Add examples of how to use ethpm for contract factories/instances #1617
Conversation
41ad50d
to
f17309f
Compare
@kclowes Let me know if there's something that's not obvious - or needs further explaining - or needs more exampling. It's a bit hard for me to see where I overlooked explaining something that newcomers might not understand intuitively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀 Thank you!
within a package, and exposes them via an API. So, before we can interact with our package, we need to generate | ||
it as a ``Package`` instance. | ||
|
||
.. code-block:: python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think its possible/worth making these doctests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's possible - do you know if we have an infura key loaded in the doctest environment? EDIT: nvm I think I found it - i'll look into transforming these to doctest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I've been having some troubles getting this test to work with doctest - so I'm gonna move on for now. I don't think it's impossible, but it's been tricky getting all the pieces to work, but i'm happy to dedicate more time to this if it's important for web3's sake to have consistent doctests amongst the examples - just let me know if you'd like it to be doctested and i'll add it to my todo list!
docs/examples.rst
Outdated
Working with Contracts via ethPM | ||
-------------------------------- | ||
|
||
`ethPM <http://www.ethpm.com/>`__ packages contained configured contracts ready for use. Web3's ``ethpm`` module (``web3.pm``) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`ethPM <http://www.ethpm.com/>`__ packages contained configured contracts ready for use. Web3's ``ethpm`` module (``web3.pm``) | |
`ethPM <http://www.ethpm.com/>`__ packages contain configured contracts ready for use. Web3's ``ethpm`` module (``web3.pm``) |
# deploy to this new chain, and the deployments available on a package will | ||
# be automatically filtered to those located on the new chain. | ||
from web3.auto.infura.goerli import w3 as goerli_w3 | ||
goerli_registrar = ens_package.update_w3(goerli_w3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooo, that's cool!
docs/examples.rst
Outdated
extends Web3's native ``Contract`` module, with a few modifications for how you instantiate ``Contract`` factories and instances. | ||
|
||
All you need is the package name, version and ethPM registry address for the package you wish to use. | ||
You can find some available registries to explore in the `ethPM explorer <http://explorer.ethpm.com/>`__. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a quick explanation of what a registry is in this context unless it's already explained elsewhere
What was wrong?
Moar docs! Particularly how to use ethpm to create contract instances / factories.
Fixes #1611
Todo:
Cute Animal Picture