* Install Py packages in dep. order, not in parallel
Install Python packages in dependency order, not in parallel.
* sra_client.py: Add `./setup.py clean`
* Fix python package dependency ordering...
...and include a script to produce the proper ordering.
* sra_client.py: reformat whitespace in doctest
* contract_wrappers.py: don't auto-import wrappers
This was discovered while minimizing CircleCI steps to dianose a problem
with running the Launch Kit Backend in CircleCI.
These classes should be imported via the
zero_ex.contract_wrappers.exchange and
zero_ex.contract_wrappers.erc20_token modules, respectively. We
permitted importing them from just zero_ex.contract_wrappers back when
they were the only wrappers we had, but now that we have so many
different contracts being wrapped, this is just another list to keep
manually updated (which, obviously is error prone, since it slipped
through the cracks already), so it's better to just not support this
type of import.
* abi-gen/Py: doc contract method attributes
Without this, generated documentation was not including the class
members that represent the contract methods, rendering the usage
unclear.
* sra_client.py: disable tests in CI
* abi-gen/Py: strip repeated spaces from devdoc
* contract_wrappers.py: gen docs for all wrappers...
...except for the dummy tokens.
* sra_client.py/test: change launch kit docker image
Previously these teses were using 0xorg/launch-kit-ci, but that was a
one-off thing created just for CI, back before there was a regularly
maintained docker image of Launch Kit.
Changed to use 0xorg/launch-kit-backend since it's regularly
maintained/updated.
Because the -backend image is using a different Linux distribution
(Alpine), the commands used to wait for ganache startup also had to
change.
The tag used, 74bcc39, is provisional due to the pending Issue at
https://github.com/0xProject/0x-launch-kit-backend/issues/73 . When
that issue is resolved, the tag suffix on the imag name should be
removed.
* Migrate from Web3.py 4.x to 5.x
* sra_client.py: checksum address in doctest
Due to problem with launch-kit-backend, documented at
https://github.com/0xProject/0x-launch-kit-backend/issues/73 ,
we need to checksum the makerAddress, in the order retrieved from the
relayer, before filling it, otherwise Web3.py gives this error:
InvalidAddress('Web3.py only accepts checksum addresses. The software
that gave you this non-checksum address should be considered unsafe,
please file it as a bug on their platform. Try using an ENS name
instead. Or, if you must accept lower safety, use
Web3.toChecksumAddress(lower_case_address).',
'0x5409ed021d9299bf6814279a6a1411a7e866a631')
* Update CHANGELOGs
* sra_client.py: make CHANGELOG be REVESE chrono.
Formerly CHANGELOG was in chronological order. Now it's in reverse
chronological order.
* abi-gen/Py: fix missing space in sanitized devdoc
* git rm unnecessary .gitkeep file
* After all Pytest runs, show short test summary
* abi-gen/Py: facilitate inlining of parameter lists
Effectively, stopped new-lines from being introduced by calls to the
`params` and `typed_params` partials.
* abi-gen: simple Py wrapper test for local dev'ment
* abi-gen/Py: stop gen'ing ValidatorBase
* abi-gen/Py: declare abi() wrapper method in Base
* abi-gen/Py: methods as classes to ease call/sendTx
Represent methods as classes in order to faciliate access to a method's
different operations (call, send_transaction, etc).
* contract_wrappers.py: make Base methods public
Changed some methods on BaseContractWrapper to be public.
* contract_wrappers.py: remove unused method
* contract_wrappers.py: extract method
* abi-gen/Py: inline method
* contract_wrappers.py: fix bug in call()
We were passing transaction parameters through to sendTransaction()
invocations, but not to call() invocations.
* abi-gen/Py: remove `view_only` param to call/tx
Formerly, in the BaseContractWrapper, there was just one function used
for both eth_call and eth_sendTransaction, and you would distinguish
between the two by specifying `view_only=True` when you wanted a call.
This commit defines a method dedicated to executing an eth_call, and
leaves the old method behind, with the `view_only` param removed, to be
used for eth_sendTransaction.
* abi-gen/Py: rename method
* contract_wrappers/Py: simplify web3 func handling
Pass web3 function instance into generated wrapper method class
constructor, rather than having that class obtain it upon each method
call.
Really this is just an elimination of a call to
BaseContractWrapper.contract_instance(), which will be removed
completely in a shortly-upcoming commit.
* contract_wrappers.py: inline method
Inline and remove method BaseContractWrapper.contract_instance().
* contract_wrappers.py: pass Validator to *Method
Pass a ValidatorBase instance into construction of the contract method
classes, *Method, to eliminate another dependency on the containing
contract object, which will be eliminated completely in a
shortly-upcoming commit.
* abi-gen/Py: BaseContractWrapper -> ContractMethod
Change the fundamental thing-to-be-wrapped from the contract to the
method. Since the named method classes were introduced (in a previous
commit), and since the operations contained within the Base are
predominantly focused on supporting method calls more than anything
else, it makes more intuitive sense to provide a base for the methods
than for the contract.
With this change, the method classes no longer require a contract object
to be passed to their constructors. The contract members that the
methods were utilizing are now passed directly to the method
constructor.
* contract_wrappers.py: rename module to bases...
...from _base_contract_wrapper. The old name hasn't made sense since
ValidatorBase was moved into that module, and definitely doesn't make
sense now that the fundamental thing-to-be-wrapped has changed from the
contract to the method. Also renamed to make it public (removed the
leading underscore) since we're generating code that will depend on it.
* abi-gen/Py: clarify call/sendTx docstrings
* abi-gen/Py: adjust whitespace
* contract_wrappers.py: inline method
* abi-gen/Py: rename class ValidatorBase...
...to just Validator. It's in the "bases" module, which provides the
context needed in order to know it's a base class
* python-packages: fix silent failures of ./parallel
* contract_wrappers.py: remove private_key support
Having this present was overcomplicating interfaces. And it was
untested (and not readily working when testing was attempted). And it
only provided a thin layer of convenience, which a client could easily
code up themselves.
* contract_wrappers.py: inline method
* contract_wrappers.py: rm unused member variables
* contract_wrappers.py: rm unnecessary instance var
* abi-gen/Py: add estimate_gas to gen'd methods
* update CHANGELOG.json
* abi-gen-wrappers: fix half-baked folder rename
* .circleci: give cache more descriptive name
* abi-gen: rename type field. tsName->langLocalName
* contract-artifacts: add devdoc to ERC20Token.json
Artifact changes crafted manually: re-generated artifacts from within
@0x/contracts-erc20, and then copied them into @0x/contract-artifacts,
but only committed the changes that added devdoc.
Modified @0x/contracts-erc20/compiler.json to include devdoc in the
hopes that next time contract-artifacts are re-generated en masse, the
devdoc output will just come along for the ride.
Compiling ERC20 TypeScript wrappers after adding devdoc to the artifacts
revealed some inconsistencies in the types. ethereum-types'
DevdocOutput REQUIRED many fields which are not always present,
depending the devdoc contents itself. Relaxing the requirement had some
ramifications.
* abi-gen: Python!
Lots more to come, but so far generating typed methods with some
parameter validation and with reasonable docstrings; enough to make
ERC20 work.
* existing erc20 python wrapper: re-order methods
In order to minimize the diff in the upcoming commit of the
auto-generated version.
* existing erc20 python wrapper: rename method
Rename method _erc20 to _get_contract_instance.
* existing erc20 python wrapper: rename vars
Rename method parameters to match names used in contract methods.
* existing erc20 python wrapper: correction
Contract method `allowance` previously was returning a transaction hash,
but it's a const method, so changed it to return the int that the
underlying method returns.
* contract_wrappers.py: pull in generated code
Custom setup.py command to pull in code previously generated into
../../packages/abi-gen-wrappers/src/generated-wrappers/py.
Changes to existing wrapper code reflect differences between the old,
manually-written wrapper and the new, auto-generated wrapper.
Reconfigured Circle CI to give Python build access to the output of the
TypeScript build, in order to import the generated wrappers from there.
* abi-gen: sanitize docstrings for pycodestyle lint
* abi-gen-templates.py: expose ABI from template
Use ABI given by template, not gotten by name from
zero_ex.contract_artifacts.
Also, expose ABI as a static method.
* py wrappers: contract addr to ctor, not methods
In all Python wrappers (old, manual ones; and new, generated ones), have
client pass the contract address to the wrapper's constructor, rather
than to the individual method calls.
* py wrappers: remove unused param `account_address`
* py wrappers: document use of `private_key`
* Rename file erc20_wrapper.py to erc20_token.py
To match the name of the underlying contract.
* Update CHANGELOG.json's
* git rm erc20_token.py
No need to keep it checked in. Doing so would require manual overhead
of keeping the generated copy in sync with the generation code, which
may get overlooked and cause confusion for others. Authoritative source
will be the published package on PyPI.
* abi-gen-templates: tweak CHANGELOG wording
Co-Authored-By: Fabio B <kandinsky454@protonmail.ch>
* Include transaction parameters in const calls too
* Doc contract_address param to gen'd wrapper ctor
* make myself a CODEOWNER of abi-gen*
* rename ids: langLocalName -> languageSpecificName
* Move Python generation to its own packages/ folder
* Stop duplicating contract artifacts in Python pkg!
Thanks to the way we're now using the `./setup.py pre_install`
convention, there's no longer a need to check the artifacts in to the
Python package.
* move py templates BACK to abi-gen-templates
I got a little overzealous in the previous commit that moved ALL the
python stuff into the new packages/python-contract-wrappers folder.
* Update known-good test output: prettify
* add getABIEncodedTransationData to gen'd code
It was added into the template in the following commit, but the
corresponding checked-in generated code was not updated accordingly.
f51c4f9617
* Fix missed instance of languageSpecificName change
* abi-gen: refine pipeline for testing gen'd code
- generate wrappers for test fixture contracts (dummy, etc) not in `yarn
build` but in `yarn test`
- rename folder test/generated-test/generated-wrappers to
test/generated-test/known-good, and stop writing test output to there,
instead writing it to a new test/generated-test/output folder.
- sol-compile test fixture contracts in every test run
- run unit tests separately from tests of generated and built TypeScript
wrappers. The existing `yarn run_mocha` will run unit tests, and
there's a new `yarn run_contract_wrapper_tests`.
* abi-gen: test Python gen [known test failures]
Also generate TypeScript wrapper test code into a TypeScript folder
(alongside the newly created Python folder).
Known-good code manually corrected (from generated code) to reflect
known problems that still need to be addressed. Namely:
- base contract and tx params should be imported from canonical
package, not relative path. relative path is working for wrapping
OUR contracts, but would not be usable in a more general
context.
- return type missing for some generated methods.
These outstanding problems are currently causing this test to fail.
* fix failing abi-gen test: missing return types
* fix failing abi-gen test: qualify imports
* in py wrapper, simplify base class initialization
per
https://github.com/0xProject/0x-monorepo/pull/1878#discussion_r299248641
* move 3rd party typings to typescript-typings
* make package python-contract-wrappers private
* make Xianny CODEOWNER of base-contract & templates
* abi-gen: clarify --help for --backend
* remove superfluous CHANGELOG entry