-
Notifications
You must be signed in to change notification settings - Fork 465
Python contract demo, with lots of refactoring #1485
Conversation
Changed some of the fields in the Order class so that it can be passed to our contracts via Web3. Added conversion utilities so that an Order can be easily converted to and from a JSON-compatible dict (specifically by encoding/decoding the `bytes` fields), to facilitate validation against the JSON schema. Also modified JSON order schema to accept integers in addition to stringified integers.
Has-types indicator file was not being included in package. Schemas were not being properly gathered into package installation.
I think I was requested to review that because I'm a CODEOWNER of |
python-packages/order_utils/src/zero_ex/json_schemas/schemas/zero_ex_transaction_schema.json
Outdated
Show resolved
Hide resolved
python-packages/order_utils/src/zero_ex/order_utils/__init__.py
Outdated
Show resolved
Hide resolved
I think the problem is specific to Python, in particular this bug with its packaging tools not following symlinks.
That would require using a custom docker image in Circle CI, since their standard Python image doesn't include npm. Wouldn't be too much work, but I think there's an advantage to keeping things simple enough to use their regularly-maintained image.
Don't think that would work for this case, as it would still be just a relative path from the python package source, which would still need a symlink. Maybe I'm missing something though... |
@fabioberger I addressed all your requests. |
Description
Implemented a demonstration call to
Exchange.getOrderInfo()
, inpython-packages/contract_demo/test/test_exchange.py
. (Asana task)And, did quite a bit of refactoring, including:
Order
class so that it will be compatible with web3, allowing you to pass an instance of the class as the argument togetOrderInfo()
.0x-contract-addresses
). (Asana task)0x-contract-artifacts
package in place. (Asana task)Also note that I had to duplicate both the JSON schemas and the contract artifacts that are stored in the TypeScript packages. I tried to use symlinks, and tried a few other hacky things, but I couldn't get around this duplication. To make myself feel better about it, I added an additional "linter," to both
contract-addresses
andcontract-artifacts
, that's just a diff between what's in the python package and what's in the TypeScript package, so that builds will fail if they end up diverging for some reason.Rendered docs:
0x-contract-addresses
0x-contract-artifacts
0x-contract-demo
Testing instructions
It's all in CI!
Types of changes
Checklist:
[WIP]
if necessary.