78 Commits

Author SHA1 Message Date
F. Eugene Aumson
d9378e9a8f
First auto-gen'd Python contract wrapper: ERC20 (#1878)
* 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
2019-07-03 11:01:01 -04:00
Fabio Berger
7dcdda14f5 modify types 2019-03-21 15:13:39 +01:00
Fabio Berger
ddee04e98c Try import instead of const 2019-03-21 14:46:47 +01:00
Fabio Berger
deb7e95567 Revert change 2019-03-21 14:29:26 +01:00
Fabio Berger
542d1c1c41 In-line the declaration 2019-03-20 16:27:13 +01:00
Fabio Berger
8af164dbd2 Attempt to fix type issue 2019-03-20 15:05:21 +01:00
Amir Bandeali
e7bb524362 Update dependencies and update solc types 2019-03-07 14:57:13 -08:00
Fabio Berger
e86df96bfe Fix doc gen 2019-02-20 13:20:32 -08:00
Fabio Berger
31d289c504 Add type import 2019-02-19 23:56:28 -08:00
Fabio Berger
5db20bbbe8 Add support for EIP1193 providers and clean up provider standardization logic 2019-02-18 15:12:29 -08:00
Leonid Logvinov
0c12128f64
Temp CI 2019-01-28 17:24:44 +01:00
Alex Browne
89e398fa39
Update prettier to version ^1.15.3 2019-01-10 17:41:13 -08:00
Leonid Logvinov
9160cd4983
Merge pull request #1069 from 0xProject/feature/ts-ethers
Upgrade to TS version of ethers
2018-09-27 12:47:00 +02:00
Leonid Logvinov
7b259c3f4c
Remove types for ethers.js 2018-09-19 17:56:23 +02:00
F. Eugene Aumson
cbb5a425df
Merge branch 'development' into sol-doc 2018-09-11 19:00:11 -04:00
Leonid Logvinov
cdc786a1e3
Remove types for web3-provider-engine from typescript-typings 2018-09-04 16:36:18 +02:00
Leonid Logvinov
3ea137a78f
Remove types for eth-lightwallet from typescript-typings 2018-09-04 16:36:18 +02:00
Leonid Logvinov
b525ccc825
Remove types for detect-node from typescript-typings 2018-09-04 16:36:18 +02:00
Leonid Logvinov
77acbdd3ea
Remove types for ganache-core from typescript-typings 2018-09-04 16:36:18 +02:00
Leonid Logvinov
c13190ceab
Remove types for newman from typescript-typings 2018-09-04 16:36:18 +02:00
F. Eugene Aumson
72419816a8 Merge remote-tracking branch 'upstream/development' into sol-doc 2018-08-31 09:22:05 -04:00
fragosti
74d5af34eb Add TypedText component and use it on landing page 2018-08-30 11:49:27 -07:00
F. Eugene Aumson
8d122006ba move export to top of file 2018-08-30 12:34:27 -04:00
F. Eugene Aumson
a1959df911 add devdoc support to solc typings, and use it 2018-08-29 08:51:01 -04:00
fragosti
938a99f435 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/sra/add-sra-package 2018-08-09 15:57:12 -07:00
Alex Browne
44b01f2069
Update ethers typings for TypeScript 2.9.2 2018-08-08 14:52:05 -07:00
Alex Browne
52e094addc
Move some ethers-related types to typescript-typings/ethers 2018-08-08 14:27:30 -07:00
fragosti
260976914d Add basic smoke test 2018-07-26 14:30:24 -07:00
Fabio Berger
51b6f8bc71 Revert "Move frontend package types out of typescript-typings since this package will be used in both node and browser contexts"
This reverts commit 74483631d09395de248fe97034c059a2a8bb2097.
2018-07-23 11:42:01 +02:00
Fabio Berger
74483631d0 Move frontend package types out of typescript-typings since this package will be used in both node and browser contexts 2018-07-22 16:22:19 +02:00
Fabio Berger
f0f13aa1dd Move ECSignature type from types package into eth-light-wallet type dec since only used there 2018-07-22 15:52:52 +02:00
Fabio Berger
6f540e3e58 Replace lerna-get-packages with our own implementation 2018-07-19 15:50:21 +02:00
Fabio Berger
a3d8858bb1 Fix typing 2018-07-17 16:27:46 +02:00
Fabio Berger
83f3ba21b8 Move type decl. to typescript-typings 2018-07-17 16:01:01 +02:00
Fabio Berger
350989bbec Move type defs to typescript-typingsd 2018-07-13 15:25:37 +02:00
Jacob Evans
ad570b8ae1
Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final 2018-07-02 11:21:16 +10:00
Amir Bandeali
e58e35e098 Move ledgerhq module declarations to typescript-typings 2018-06-29 17:25:56 -07:00
Fabio Berger
51211a21ba Improve ganache-core's GanacheOpts type and require it instead of any 2018-06-27 18:33:32 +02:00
Fabio Berger
f9fab216e9
Merge branch 'v2-prototype' into invalid-argument-error 2018-06-27 11:02:40 +02:00
Nikita Galkin
84bd54ba40
Improve 'web3-provider-engine' typings 2018-06-27 09:26:48 +03:00
Fabio Berger
6bb2203f79 Small stylistic tweaks 2018-06-25 23:07:27 +02:00
Fabio Berger
699de9174e Format type 2018-06-25 22:59:04 +02:00
Cavan
1821f60fb5 Move eth-lightwallet declaration to typings 2018-06-25 19:08:16 +02:00
Cavan
235d78565e Format subprovider using prettier 2018-06-25 19:06:22 +02:00
Cavan
76f4d67f33 Remove timestamps and fix typings 2018-06-25 18:58:25 +02:00
Bryce
e59c57106c Run prettier 2018-06-25 09:44:56 -07:00
Cavan
bb4c748bf1 Formatting and standards updates 2018-06-25 18:42:13 +02:00
Bryce
82d59dbea8 Address INVALID_ARGUMENT issue 2018-06-22 13:35:49 -07:00
Leonid Logvinov
a7fc9caacb
Introduce ethereum-types package 2018-05-31 11:04:05 -07:00
Leonid Logvinov
1a3958ed60
Remove some types 2018-05-31 10:20:36 -07:00