From 57ac2f28a43067e51f1db1736b48893189ce9dd0 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 14 Dec 2018 16:08:57 -0800 Subject: Add example usage to sra_client README --- python-packages/sra_client/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'python-packages/sra_client') diff --git a/python-packages/sra_client/README.md b/python-packages/sra_client/README.md index ab3939b41..279fb41a4 100644 --- a/python-packages/sra_client/README.md +++ b/python-packages/sra_client/README.md @@ -6,6 +6,35 @@ A Python client for interacting with servers conforming to [the Standard Relayer The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the 0x.js library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1). +```bash +pip install 0x-json-schemas +``` + +You can easily validate your API's payloads and responses using the [0x-json-schemas](https://github.com/0xProject/0x.js/tree/development/python-packages/json_schemas) package: + +```python +from zero_ex.json_schemas import assert_valid +from zero_ex.order_utils import Order + +order: Order = { + 'makerAddress': "0x0000000000000000000000000000000000000000", + 'takerAddress': "0x0000000000000000000000000000000000000000", + 'feeRecipientAddress': "0x0000000000000000000000000000000000000000", + 'senderAddress': "0x0000000000000000000000000000000000000000", + 'makerAssetAmount': "1000000000000000000", + 'takerAssetAmount': "1000000000000000000", + 'makerFee': "0", + 'takerFee': "0", + 'expirationTimeSeconds': "12345", + 'salt': "12345", + 'makerAssetData': "0x0000000000000000000000000000000000000000", + 'takerAssetData': "0x0000000000000000000000000000000000000000", + 'exchangeAddress': "0x0000000000000000000000000000000000000000", +} + +assert_valid(order, "/orderSchema") +``` + # Pagination Requests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example: -- cgit From 2c974b5f3ffa0e9736000273e39cdeee4a251b94 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 8 Jan 2019 12:23:33 +0100 Subject: Refactor out sol-cov, sol-profiler and sol-trace into their separate packages --- python-packages/sra_client/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python-packages/sra_client') diff --git a/python-packages/sra_client/README.md b/python-packages/sra_client/README.md index ab3939b41..abf0dee42 100644 --- a/python-packages/sra_client/README.md +++ b/python-packages/sra_client/README.md @@ -4,7 +4,7 @@ A Python client for interacting with servers conforming to [the Standard Relayer # Schemas -The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the 0x.js library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1). +The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas). Examples of each payload and response can be found in the 0x.js library's [test suite](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/test/schema_test.ts#L1). # Pagination -- cgit From aa5af04447dfae24731557c6beead55bd8ff99a9 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 9 Jan 2019 09:58:29 -0500 Subject: Python contract demo, with lots of refactoring (#1485) * Refine Order for Web3 compat. & add conversions 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. * Fixes for json_schemas Has-types indicator file, py.typed, was not being included in package. Schemas were not being properly gathered into package installation. * Add test/demo of Exchange.getOrderInfo() * web3 bug workaround * Fix problem packaging contract artifacts * Move contract addresses to their own package * Move contract artifacts to their own package * Add scripts to install, test & lint all components * prettierignore files in local python dev env * Correct missing coverage analysis for sra_client * CI cache lint: don't save, re-use from test-python * tag hacks as hacks * correct merge mistake * remove local strip_0x() in favor of eth_utils * remove json schemas from old order_utils location * correct merge mistake * doctest json schemas via command-line, not code --- python-packages/sra_client/setup.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'python-packages/sra_client') diff --git a/python-packages/sra_client/setup.py b/python-packages/sra_client/setup.py index b47f71ae7..0921149bd 100755 --- a/python-packages/sra_client/setup.py +++ b/python-packages/sra_client/setup.py @@ -48,6 +48,15 @@ class PublishCommand(distutils.command.build_py.build_py): subprocess.check_call("twine upload dist/*".split()) # nosec +class LintCommand(distutils.command.build_py.build_py): + """No-op lint command to support top-level lint script.""" + + description = "No-op" + + def run(self): + pass + + setup( name=NAME, version=VERSION, @@ -63,5 +72,6 @@ setup( cmdclass={ "test_publish": TestPublishCommand, "publish": PublishCommand, + "lint": LintCommand, }, ) -- cgit From 89e398fa39fd14c9fd4a467fdd039920fb28a420 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 9 Jan 2019 12:12:05 -0800 Subject: Update prettier to version ^1.15.3 --- python-packages/sra_client/README.md | 46 +++++++++++++-------------- python-packages/sra_client/docs/DefaultApi.md | 28 ++++++++-------- 2 files changed, 37 insertions(+), 37 deletions(-) (limited to 'python-packages/sra_client') diff --git a/python-packages/sra_client/README.md b/python-packages/sra_client/README.md index 78ed42b93..a1a427bce 100644 --- a/python-packages/sra_client/README.md +++ b/python-packages/sra_client/README.md @@ -219,16 +219,16 @@ A good example of such a field is `remainingTakerAssetAmount`, which is a conven # Misc. -* All requests and responses should be of **application/json** content type -* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API). -* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix. -* All parameters are to be written in `lowerCamelCase`. +- All requests and responses should be of **application/json** content type +- All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API). +- All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix. +- All parameters are to be written in `lowerCamelCase`. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -* API version: 2.0.0 -* Package version: 1.0.0 -* Build package: org.openapitools.codegen.languages.PythonClientCodegen +- API version: 2.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. @@ -310,22 +310,22 @@ All URIs are relative to _http://localhost_ ## Documentation For Models -* [OrderSchema](docs/OrderSchema.md) -* [PaginatedCollectionSchema](docs/PaginatedCollectionSchema.md) -* [RelayerApiAssetDataPairsResponseSchema](docs/RelayerApiAssetDataPairsResponseSchema.md) -* [RelayerApiAssetDataTradeInfoSchema](docs/RelayerApiAssetDataTradeInfoSchema.md) -* [RelayerApiErrorResponseSchema](docs/RelayerApiErrorResponseSchema.md) -* [RelayerApiErrorResponseSchemaValidationErrors](docs/RelayerApiErrorResponseSchemaValidationErrors.md) -* [RelayerApiFeeRecipientsResponseSchema](docs/RelayerApiFeeRecipientsResponseSchema.md) -* [RelayerApiOrderConfigPayloadSchema](docs/RelayerApiOrderConfigPayloadSchema.md) -* [RelayerApiOrderConfigResponseSchema](docs/RelayerApiOrderConfigResponseSchema.md) -* [RelayerApiOrderSchema](docs/RelayerApiOrderSchema.md) -* [RelayerApiOrderbookResponseSchema](docs/RelayerApiOrderbookResponseSchema.md) -* [RelayerApiOrdersChannelSubscribePayloadSchema](docs/RelayerApiOrdersChannelSubscribePayloadSchema.md) -* [RelayerApiOrdersChannelSubscribeSchema](docs/RelayerApiOrdersChannelSubscribeSchema.md) -* [RelayerApiOrdersChannelUpdateSchema](docs/RelayerApiOrdersChannelUpdateSchema.md) -* [RelayerApiOrdersResponseSchema](docs/RelayerApiOrdersResponseSchema.md) -* [SignedOrderSchema](docs/SignedOrderSchema.md) +- [OrderSchema](docs/OrderSchema.md) +- [PaginatedCollectionSchema](docs/PaginatedCollectionSchema.md) +- [RelayerApiAssetDataPairsResponseSchema](docs/RelayerApiAssetDataPairsResponseSchema.md) +- [RelayerApiAssetDataTradeInfoSchema](docs/RelayerApiAssetDataTradeInfoSchema.md) +- [RelayerApiErrorResponseSchema](docs/RelayerApiErrorResponseSchema.md) +- [RelayerApiErrorResponseSchemaValidationErrors](docs/RelayerApiErrorResponseSchemaValidationErrors.md) +- [RelayerApiFeeRecipientsResponseSchema](docs/RelayerApiFeeRecipientsResponseSchema.md) +- [RelayerApiOrderConfigPayloadSchema](docs/RelayerApiOrderConfigPayloadSchema.md) +- [RelayerApiOrderConfigResponseSchema](docs/RelayerApiOrderConfigResponseSchema.md) +- [RelayerApiOrderSchema](docs/RelayerApiOrderSchema.md) +- [RelayerApiOrderbookResponseSchema](docs/RelayerApiOrderbookResponseSchema.md) +- [RelayerApiOrdersChannelSubscribePayloadSchema](docs/RelayerApiOrdersChannelSubscribePayloadSchema.md) +- [RelayerApiOrdersChannelSubscribeSchema](docs/RelayerApiOrdersChannelSubscribeSchema.md) +- [RelayerApiOrdersChannelUpdateSchema](docs/RelayerApiOrdersChannelUpdateSchema.md) +- [RelayerApiOrdersResponseSchema](docs/RelayerApiOrdersResponseSchema.md) +- [SignedOrderSchema](docs/SignedOrderSchema.md) ## Documentation For Authorization diff --git a/python-packages/sra_client/docs/DefaultApi.md b/python-packages/sra_client/docs/DefaultApi.md index 942188bc6..9e3f5f2ca 100644 --- a/python-packages/sra_client/docs/DefaultApi.md +++ b/python-packages/sra_client/docs/DefaultApi.md @@ -62,8 +62,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: Not defined -* **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -113,8 +113,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: Not defined -* **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -162,8 +162,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: Not defined -* **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -211,8 +211,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: application/json -* **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -266,8 +266,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: Not defined -* **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -343,8 +343,8 @@ No authorization required ### HTTP request headers -* **Content-Type**: Not defined -* **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -391,7 +391,7 @@ No authorization required ### HTTP request headers -* **Content-Type**: application/json -* **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -- cgit