From 7d9009bb96fa576c98abd82200cd0fc2b4d27e40 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 13:28:26 +0100 Subject: Convert all schemas to json files, so it's easier for devs in other languages to use it --- packages/json-schemas/schemas/address_schema.json | 5 ++ .../json-schemas/schemas/basic_type_schemas.ts | 17 ----- .../json-schemas/schemas/block_param_schema.json | 11 ++++ .../json-schemas/schemas/block_range_schema.json | 8 +++ .../json-schemas/schemas/block_range_schema.ts | 20 ------ .../json-schemas/schemas/call_data_schema.json | 27 ++++++++ packages/json-schemas/schemas/call_data_schema.ts | 27 -------- .../schemas/ec_signature_parameter_schema.json | 5 ++ .../json-schemas/schemas/ec_signature_schema.json | 14 ++++ .../json-schemas/schemas/ec_signature_schema.ts | 20 ------ packages/json-schemas/schemas/eip712_typed_data.ts | 28 -------- .../schemas/eip712_typed_data_schema.json | 28 ++++++++ packages/json-schemas/schemas/hex_schema.json | 5 ++ .../schemas/index_filter_values_schema.json | 7 ++ .../schemas/index_filter_values_schema.ts | 7 -- packages/json-schemas/schemas/js_number.json | 5 ++ packages/json-schemas/schemas/number_schema.json | 5 ++ .../json-schemas/schemas/order_cancel_schema.json | 12 ++++ .../json-schemas/schemas/order_cancel_schema.ts | 12 ---- .../order_fill_or_kill_requests_schema.json | 12 ++++ .../schemas/order_fill_or_kill_requests_schema.ts | 12 ---- .../schemas/order_fill_requests_schema.json | 12 ++++ .../schemas/order_fill_requests_schema.ts | 12 ---- .../json-schemas/schemas/order_hash_schema.json | 5 ++ packages/json-schemas/schemas/order_hash_schema.ts | 5 -- packages/json-schemas/schemas/order_schema.json | 34 ++++++++++ packages/json-schemas/schemas/order_schemas.ts | 47 -------------- packages/json-schemas/schemas/orders_schema.json | 5 ++ packages/json-schemas/schemas/orders_schema.ts | 5 -- .../schemas/paginated_collection_schema.json | 10 +++ .../schemas/paginated_collection_schema.ts | 10 --- ...layer_api_asset_data_pairs_response_schema.json | 13 ++++ .../relayer_api_asset_data_pairs_schema.json | 12 ++++ .../relayer_api_asset_data_trade_info_schema.json | 11 ++++ .../relayer_api_asset_pairs_response_schema.ts | 38 ----------- .../schemas/relayer_api_error_response_schema.json | 21 ++++++ .../schemas/relayer_api_error_response_schema.ts | 21 ------ ...relayer_api_fee_recipients_response_schema.json | 16 +++++ .../relayer_api_fee_recipients_response_schema.ts | 16 ----- .../relayer_api_order_config_payload_schema.json | 24 +++++++ .../relayer_api_order_config_payload_schema.ts | 24 ------- .../relayer_api_order_config_response_schema.json | 11 ++++ .../relayer_api_order_config_response_schema.ts | 11 ---- .../schemas/relayer_api_order_schema.json | 9 +++ .../schemas/relayer_api_order_schema.ts | 9 --- .../relayer_api_orderbook_response_schema.json | 9 +++ .../relayer_api_orderbook_response_schema.ts | 9 --- ...pi_orders_channel_subscribe_payload_schema.json | 14 ++++ ...elayer_api_orders_channel_subscribe_schema.json | 11 ++++ .../relayer_api_orders_channel_subscribe_schema.ts | 26 -------- ..._api_orders_channel_update_response_schema.json | 11 ++++ ...er_api_orders_channel_update_response_schema.ts | 11 ---- .../relayer_api_orders_response_schema.json | 13 ++++ .../schemas/relayer_api_orders_response_schema.ts | 13 ---- .../schemas/relayer_api_orders_schema.json | 5 ++ .../schemas/relayer_api_orders_schema.ts | 5 -- .../json-schemas/schemas/signed_order_schema.json | 12 ++++ .../json-schemas/schemas/signed_orders_schema.json | 5 ++ .../json-schemas/schemas/signed_orders_schema.ts | 5 -- packages/json-schemas/schemas/token_schema.json | 11 ++++ packages/json-schemas/schemas/token_schema.ts | 11 ---- packages/json-schemas/schemas/tx_data_schema.json | 26 ++++++++ packages/json-schemas/schemas/tx_data_schema.ts | 32 ---------- .../schemas/zero_ex_transaction_schema.json | 10 +++ .../schemas/zero_ex_transaction_schema.ts | 10 --- packages/json-schemas/src/globals.d.ts | 6 -- packages/json-schemas/src/schemas.ts | 74 +++++++++++----------- packages/json-schemas/tsconfig.json | 44 ++++++++++++- 68 files changed, 534 insertions(+), 507 deletions(-) create mode 100644 packages/json-schemas/schemas/address_schema.json delete mode 100644 packages/json-schemas/schemas/basic_type_schemas.ts create mode 100644 packages/json-schemas/schemas/block_param_schema.json create mode 100644 packages/json-schemas/schemas/block_range_schema.json delete mode 100644 packages/json-schemas/schemas/block_range_schema.ts create mode 100644 packages/json-schemas/schemas/call_data_schema.json delete mode 100644 packages/json-schemas/schemas/call_data_schema.ts create mode 100644 packages/json-schemas/schemas/ec_signature_parameter_schema.json create mode 100644 packages/json-schemas/schemas/ec_signature_schema.json delete mode 100644 packages/json-schemas/schemas/ec_signature_schema.ts delete mode 100644 packages/json-schemas/schemas/eip712_typed_data.ts create mode 100644 packages/json-schemas/schemas/eip712_typed_data_schema.json create mode 100644 packages/json-schemas/schemas/hex_schema.json create mode 100644 packages/json-schemas/schemas/index_filter_values_schema.json delete mode 100644 packages/json-schemas/schemas/index_filter_values_schema.ts create mode 100644 packages/json-schemas/schemas/js_number.json create mode 100644 packages/json-schemas/schemas/number_schema.json create mode 100644 packages/json-schemas/schemas/order_cancel_schema.json delete mode 100644 packages/json-schemas/schemas/order_cancel_schema.ts create mode 100644 packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json delete mode 100644 packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts create mode 100644 packages/json-schemas/schemas/order_fill_requests_schema.json delete mode 100644 packages/json-schemas/schemas/order_fill_requests_schema.ts create mode 100644 packages/json-schemas/schemas/order_hash_schema.json delete mode 100644 packages/json-schemas/schemas/order_hash_schema.ts create mode 100644 packages/json-schemas/schemas/order_schema.json delete mode 100644 packages/json-schemas/schemas/order_schemas.ts create mode 100644 packages/json-schemas/schemas/orders_schema.json delete mode 100644 packages/json-schemas/schemas/orders_schema.ts create mode 100644 packages/json-schemas/schemas/paginated_collection_schema.json delete mode 100644 packages/json-schemas/schemas/paginated_collection_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json create mode 100644 packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json create mode 100644 packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_error_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_error_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_order_config_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_order_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_order_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json create mode 100644 packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_response_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_orders_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_schema.json delete mode 100644 packages/json-schemas/schemas/relayer_api_orders_schema.ts create mode 100644 packages/json-schemas/schemas/signed_order_schema.json create mode 100644 packages/json-schemas/schemas/signed_orders_schema.json delete mode 100644 packages/json-schemas/schemas/signed_orders_schema.ts create mode 100644 packages/json-schemas/schemas/token_schema.json delete mode 100644 packages/json-schemas/schemas/token_schema.ts create mode 100644 packages/json-schemas/schemas/tx_data_schema.json delete mode 100644 packages/json-schemas/schemas/tx_data_schema.ts create mode 100644 packages/json-schemas/schemas/zero_ex_transaction_schema.json delete mode 100644 packages/json-schemas/schemas/zero_ex_transaction_schema.ts delete mode 100644 packages/json-schemas/src/globals.d.ts (limited to 'packages') diff --git a/packages/json-schemas/schemas/address_schema.json b/packages/json-schemas/schemas/address_schema.json new file mode 100644 index 000000000..0dc02d331 --- /dev/null +++ b/packages/json-schemas/schemas/address_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/addressSchema", + "type": "string", + "pattern": "^0x[0-9a-f]{40}$" +} diff --git a/packages/json-schemas/schemas/basic_type_schemas.ts b/packages/json-schemas/schemas/basic_type_schemas.ts deleted file mode 100644 index a59afaef8..000000000 --- a/packages/json-schemas/schemas/basic_type_schemas.ts +++ /dev/null @@ -1,17 +0,0 @@ -export const addressSchema = { - id: '/addressSchema', - type: 'string', - pattern: '^0x[0-9a-f]{40}$', -}; - -export const hexSchema = { - id: '/hexSchema', - type: 'string', - pattern: '^0x(([0-9a-f][0-9a-f])+)?$', -}; - -export const numberSchema = { - id: '/numberSchema', - type: 'string', - pattern: '^\\d+(\\.\\d+)?$', -}; diff --git a/packages/json-schemas/schemas/block_param_schema.json b/packages/json-schemas/schemas/block_param_schema.json new file mode 100644 index 000000000..ed4dd1e87 --- /dev/null +++ b/packages/json-schemas/schemas/block_param_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/blockParamSchema", + "oneOf": [ + { + "type": "number" + }, + { + "enum": ["latest", "earliest", "pending"] + } + ] +} diff --git a/packages/json-schemas/schemas/block_range_schema.json b/packages/json-schemas/schemas/block_range_schema.json new file mode 100644 index 000000000..b14294649 --- /dev/null +++ b/packages/json-schemas/schemas/block_range_schema.json @@ -0,0 +1,8 @@ +{ + "id": "/blockRangeSchema", + "properties": { + "fromBlock": { "$ref": "/blockParamSchema" }, + "toBlock": { "$ref": "/blockParamSchema" } + }, + "type": "object" +} diff --git a/packages/json-schemas/schemas/block_range_schema.ts b/packages/json-schemas/schemas/block_range_schema.ts deleted file mode 100644 index 9eb242fc6..000000000 --- a/packages/json-schemas/schemas/block_range_schema.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const blockParamSchema = { - id: '/blockParamSchema', - oneOf: [ - { - type: 'number', - }, - { - enum: ['latest', 'earliest', 'pending'], - }, - ], -}; - -export const blockRangeSchema = { - id: '/blockRangeSchema', - properties: { - fromBlock: { $ref: '/blockParamSchema' }, - toBlock: { $ref: '/blockParamSchema' }, - }, - type: 'object', -}; diff --git a/packages/json-schemas/schemas/call_data_schema.json b/packages/json-schemas/schemas/call_data_schema.json new file mode 100644 index 000000000..c5972e8c1 --- /dev/null +++ b/packages/json-schemas/schemas/call_data_schema.json @@ -0,0 +1,27 @@ +{ + "id": "/callDataSchema", + "properties": { + "from": { "$ref": "/addressSchema" }, + "to": { "$ref": "/addressSchema" }, + "value": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "gas": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "gasPrice": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "data": { + "type": "string", + "pattern": "^0x[0-9a-f]*$" + }, + "nonce": { + "type": "number", + "minimum": 0 + } + }, + "required": [], + "type": "object", + "additionalProperties": false +} diff --git a/packages/json-schemas/schemas/call_data_schema.ts b/packages/json-schemas/schemas/call_data_schema.ts deleted file mode 100644 index 4c77d9f9d..000000000 --- a/packages/json-schemas/schemas/call_data_schema.ts +++ /dev/null @@ -1,27 +0,0 @@ -export const callDataSchema = { - id: '/callDataSchema', - properties: { - from: { $ref: '/addressSchema' }, - to: { $ref: '/addressSchema' }, - value: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - gas: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - gasPrice: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - data: { - type: 'string', - pattern: '^0x[0-9a-f]*$', - }, - nonce: { - type: 'number', - minimum: 0, - }, - }, - required: [], - type: 'object', - additionalProperties: false, -}; diff --git a/packages/json-schemas/schemas/ec_signature_parameter_schema.json b/packages/json-schemas/schemas/ec_signature_parameter_schema.json new file mode 100644 index 000000000..0c08ec240 --- /dev/null +++ b/packages/json-schemas/schemas/ec_signature_parameter_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/ecSignatureParameterSchema", + "type": "string", + "pattern": "^0[xX][0-9A-Fa-f]{64}$" +} diff --git a/packages/json-schemas/schemas/ec_signature_schema.json b/packages/json-schemas/schemas/ec_signature_schema.json new file mode 100644 index 000000000..bc79ca5e9 --- /dev/null +++ b/packages/json-schemas/schemas/ec_signature_schema.json @@ -0,0 +1,14 @@ +{ + "id": "/ECSignature", + "properties": { + "v": { + "type": "number", + "minimum": 27, + "maximum": 28 + }, + "r": { "$ref": "/ecSignatureParameterSchema" }, + "s": { "$ref": "/ecSignatureParameterSchema" } + }, + "required": ["v", "r", "s"], + "type": "object" +} diff --git a/packages/json-schemas/schemas/ec_signature_schema.ts b/packages/json-schemas/schemas/ec_signature_schema.ts deleted file mode 100644 index c59532f09..000000000 --- a/packages/json-schemas/schemas/ec_signature_schema.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const ecSignatureParameterSchema = { - id: '/ecSignatureParameterSchema', - type: 'string', - pattern: '^0[xX][0-9A-Fa-f]{64}$', -}; - -export const ecSignatureSchema = { - id: '/ECSignature', - properties: { - v: { - type: 'number', - minimum: 27, - maximum: 28, - }, - r: { $ref: '/ecSignatureParameterSchema' }, - s: { $ref: '/ecSignatureParameterSchema' }, - }, - required: ['v', 'r', 's'], - type: 'object', -}; diff --git a/packages/json-schemas/schemas/eip712_typed_data.ts b/packages/json-schemas/schemas/eip712_typed_data.ts deleted file mode 100644 index 31ad74610..000000000 --- a/packages/json-schemas/schemas/eip712_typed_data.ts +++ /dev/null @@ -1,28 +0,0 @@ -export const eip712TypedDataSchema = { - id: '/eip712TypedData', - type: 'object', - properties: { - types: { - type: 'object', - properties: { - EIP712Domain: { type: 'array' }, - }, - additionalProperties: { - type: 'array', - items: { - type: 'object', - properties: { - name: { type: 'string' }, - type: { type: 'string' }, - }, - required: ['name', 'type'], - }, - }, - required: ['EIP712Domain'], - }, - primaryType: { type: 'string' }, - domain: { type: 'object' }, - message: { type: 'object' }, - }, - required: ['types', 'primaryType', 'domain', 'message'], -}; diff --git a/packages/json-schemas/schemas/eip712_typed_data_schema.json b/packages/json-schemas/schemas/eip712_typed_data_schema.json new file mode 100644 index 000000000..8efd6de44 --- /dev/null +++ b/packages/json-schemas/schemas/eip712_typed_data_schema.json @@ -0,0 +1,28 @@ +{ + "id": "/eip712TypedDataSchema", + "type": "object", + "properties": { + "types": { + "type": "object", + "properties": { + "EIP712Domain": { "type": "array" } + }, + "additionalProperties": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "type": "string" } + }, + "required": ["name", "type"] + } + }, + "required": ["EIP712Domain"] + }, + "primaryType": { "type": "string" }, + "domain": { "type": "object" }, + "message": { "type": "object" } + }, + "required": ["types", "primaryType", "domain", "message"] +} diff --git a/packages/json-schemas/schemas/hex_schema.json b/packages/json-schemas/schemas/hex_schema.json new file mode 100644 index 000000000..f37815d5b --- /dev/null +++ b/packages/json-schemas/schemas/hex_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/hexSchema", + "type": "string", + "pattern": "^0x(([0-9a-f][0-9a-f])+)?$" +} diff --git a/packages/json-schemas/schemas/index_filter_values_schema.json b/packages/json-schemas/schemas/index_filter_values_schema.json new file mode 100644 index 000000000..bec00d79e --- /dev/null +++ b/packages/json-schemas/schemas/index_filter_values_schema.json @@ -0,0 +1,7 @@ +{ + "id": "/indexFilterValuesSchema", + "additionalProperties": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/addressSchema" }, { "$ref": "/orderHashSchema" }] + }, + "type": "object" +} diff --git a/packages/json-schemas/schemas/index_filter_values_schema.ts b/packages/json-schemas/schemas/index_filter_values_schema.ts deleted file mode 100644 index f3c8cef68..000000000 --- a/packages/json-schemas/schemas/index_filter_values_schema.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const indexFilterValuesSchema = { - id: '/indexFilterValuesSchema', - additionalProperties: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/addressSchema' }, { $ref: '/orderHashSchema' }], - }, - type: 'object', -}; diff --git a/packages/json-schemas/schemas/js_number.json b/packages/json-schemas/schemas/js_number.json new file mode 100644 index 000000000..6a72d92c0 --- /dev/null +++ b/packages/json-schemas/schemas/js_number.json @@ -0,0 +1,5 @@ +{ + "id": "/jsNumber", + "type": "number", + "minimum": 0 +} diff --git a/packages/json-schemas/schemas/number_schema.json b/packages/json-schemas/schemas/number_schema.json new file mode 100644 index 000000000..a48f3e8cf --- /dev/null +++ b/packages/json-schemas/schemas/number_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/numberSchema", + "type": "string", + "pattern": "^\\d+(\\.\\d+)?$" +} diff --git a/packages/json-schemas/schemas/order_cancel_schema.json b/packages/json-schemas/schemas/order_cancel_schema.json new file mode 100644 index 000000000..09d4068c6 --- /dev/null +++ b/packages/json-schemas/schemas/order_cancel_schema.json @@ -0,0 +1,12 @@ +{ + "id": "/orderCancellationRequestsSchema", + "type": "array", + "items": { + "properties": { + "order": { "$ref": "/orderSchema" }, + "takerTokenCancelAmount": { "$ref": "/numberSchema" } + }, + "required": ["order", "takerTokenCancelAmount"], + "type": "object" + } +} diff --git a/packages/json-schemas/schemas/order_cancel_schema.ts b/packages/json-schemas/schemas/order_cancel_schema.ts deleted file mode 100644 index e4edfbca9..000000000 --- a/packages/json-schemas/schemas/order_cancel_schema.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const orderCancellationRequestsSchema = { - id: '/orderCancellationRequestsSchema', - type: 'array', - items: { - properties: { - order: { $ref: '/orderSchema' }, - takerTokenCancelAmount: { $ref: '/numberSchema' }, - }, - required: ['order', 'takerTokenCancelAmount'], - type: 'object', - }, -}; diff --git a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json new file mode 100644 index 000000000..c9549c72e --- /dev/null +++ b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json @@ -0,0 +1,12 @@ +{ + "id": "/orderFillOrKillRequestsSchema", + "type": "array", + "items": { + "properties": { + "signedOrder": { "$ref": "/signedOrderSchema" }, + "fillTakerAmount": { "$ref": "/numberSchema" } + }, + "required": ["signedOrder", "fillTakerAmount"], + "type": "object" + } +} diff --git a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts deleted file mode 100644 index e2c18ef0a..000000000 --- a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const orderFillOrKillRequestsSchema = { - id: '/orderFillOrKillRequestsSchema', - type: 'array', - items: { - properties: { - signedOrder: { $ref: '/signedOrderSchema' }, - fillTakerAmount: { $ref: '/numberSchema' }, - }, - required: ['signedOrder', 'fillTakerAmount'], - type: 'object', - }, -}; diff --git a/packages/json-schemas/schemas/order_fill_requests_schema.json b/packages/json-schemas/schemas/order_fill_requests_schema.json new file mode 100644 index 000000000..98325653b --- /dev/null +++ b/packages/json-schemas/schemas/order_fill_requests_schema.json @@ -0,0 +1,12 @@ +{ + "id": "/orderFillRequestsSchema", + "type": "array", + "items": { + "properties": { + "signedOrder": { "$ref": "/signedOrderSchema" }, + "takerTokenFillAmount": { "$ref": "/numberSchema" } + }, + "required": ["signedOrder", "takerTokenFillAmount"], + "type": "object" + } +} diff --git a/packages/json-schemas/schemas/order_fill_requests_schema.ts b/packages/json-schemas/schemas/order_fill_requests_schema.ts deleted file mode 100644 index ea8b35e54..000000000 --- a/packages/json-schemas/schemas/order_fill_requests_schema.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const orderFillRequestsSchema = { - id: '/orderFillRequestsSchema', - type: 'array', - items: { - properties: { - signedOrder: { $ref: '/signedOrderSchema' }, - takerTokenFillAmount: { $ref: '/numberSchema' }, - }, - required: ['signedOrder', 'takerTokenFillAmount'], - type: 'object', - }, -}; diff --git a/packages/json-schemas/schemas/order_hash_schema.json b/packages/json-schemas/schemas/order_hash_schema.json new file mode 100644 index 000000000..4a770579f --- /dev/null +++ b/packages/json-schemas/schemas/order_hash_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/orderHashSchema", + "type": "string", + "pattern": "^0x[0-9a-fA-F]{64}$" +} diff --git a/packages/json-schemas/schemas/order_hash_schema.ts b/packages/json-schemas/schemas/order_hash_schema.ts deleted file mode 100644 index 9773a88f9..000000000 --- a/packages/json-schemas/schemas/order_hash_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const orderHashSchema = { - id: '/orderHashSchema', - type: 'string', - pattern: '^0x[0-9a-fA-F]{64}$', -}; diff --git a/packages/json-schemas/schemas/order_schema.json b/packages/json-schemas/schemas/order_schema.json new file mode 100644 index 000000000..de2c8c7c2 --- /dev/null +++ b/packages/json-schemas/schemas/order_schema.json @@ -0,0 +1,34 @@ +{ + "id": "/orderSchema", + "properties": { + "makerAddress": { "$ref": "/addressSchema" }, + "takerAddress": { "$ref": "/addressSchema" }, + "makerFee": { "$ref": "/numberSchema" }, + "takerFee": { "$ref": "/numberSchema" }, + "senderAddress": { "$ref": "/addressSchema" }, + "makerAssetAmount": { "$ref": "/numberSchema" }, + "takerAssetAmount": { "$ref": "/numberSchema" }, + "makerAssetData": { "$ref": "/hexSchema" }, + "takerAssetData": { "$ref": "/hexSchema" }, + "salt": { "$ref": "/numberSchema" }, + "exchangeAddress": { "$ref": "/addressSchema" }, + "feeRecipientAddress": { "$ref": "/addressSchema" }, + "expirationTimeSeconds": { "$ref": "/numberSchema" } + }, + "required": [ + "makerAddress", + "takerAddress", + "makerFee", + "takerFee", + "senderAddress", + "makerAssetAmount", + "takerAssetAmount", + "makerAssetData", + "takerAssetData", + "salt", + "exchangeAddress", + "feeRecipientAddress", + "expirationTimeSeconds" + ], + "type": "object" +} diff --git a/packages/json-schemas/schemas/order_schemas.ts b/packages/json-schemas/schemas/order_schemas.ts deleted file mode 100644 index eb7fdaf5a..000000000 --- a/packages/json-schemas/schemas/order_schemas.ts +++ /dev/null @@ -1,47 +0,0 @@ -export const orderSchema = { - id: '/orderSchema', - properties: { - makerAddress: { $ref: '/addressSchema' }, - takerAddress: { $ref: '/addressSchema' }, - makerFee: { $ref: '/numberSchema' }, - takerFee: { $ref: '/numberSchema' }, - senderAddress: { $ref: '/addressSchema' }, - makerAssetAmount: { $ref: '/numberSchema' }, - takerAssetAmount: { $ref: '/numberSchema' }, - makerAssetData: { $ref: '/hexSchema' }, - takerAssetData: { $ref: '/hexSchema' }, - salt: { $ref: '/numberSchema' }, - exchangeAddress: { $ref: '/addressSchema' }, - feeRecipientAddress: { $ref: '/addressSchema' }, - expirationTimeSeconds: { $ref: '/numberSchema' }, - }, - required: [ - 'makerAddress', - 'takerAddress', - 'makerFee', - 'takerFee', - 'senderAddress', - 'makerAssetAmount', - 'takerAssetAmount', - 'makerAssetData', - 'takerAssetData', - 'salt', - 'exchangeAddress', - 'feeRecipientAddress', - 'expirationTimeSeconds', - ], - type: 'object', -}; - -export const signedOrderSchema = { - id: '/signedOrderSchema', - allOf: [ - { $ref: '/orderSchema' }, - { - properties: { - signature: { $ref: '/hexSchema' }, - }, - required: ['signature'], - }, - ], -}; diff --git a/packages/json-schemas/schemas/orders_schema.json b/packages/json-schemas/schemas/orders_schema.json new file mode 100644 index 000000000..1e1c6a875 --- /dev/null +++ b/packages/json-schemas/schemas/orders_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/ordersSchema", + "type": "array", + "items": { "$ref": "/orderSchema" } +} diff --git a/packages/json-schemas/schemas/orders_schema.ts b/packages/json-schemas/schemas/orders_schema.ts deleted file mode 100644 index de0abcf00..000000000 --- a/packages/json-schemas/schemas/orders_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const ordersSchema = { - id: '/ordersSchema', - type: 'array', - items: { $ref: '/orderSchema' }, -}; diff --git a/packages/json-schemas/schemas/paginated_collection_schema.json b/packages/json-schemas/schemas/paginated_collection_schema.json new file mode 100644 index 000000000..9dcedf5b4 --- /dev/null +++ b/packages/json-schemas/schemas/paginated_collection_schema.json @@ -0,0 +1,10 @@ +{ + "id": "/paginatedCollectionSchema", + "type": "object", + "properties": { + "total": { "type": "number" }, + "perPage": { "type": "number" }, + "page": { "type": "number" } + }, + "required": ["total", "perPage", "page"] +} diff --git a/packages/json-schemas/schemas/paginated_collection_schema.ts b/packages/json-schemas/schemas/paginated_collection_schema.ts deleted file mode 100644 index 16044c70a..000000000 --- a/packages/json-schemas/schemas/paginated_collection_schema.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const paginatedCollectionSchema = { - id: '/paginatedCollectionSchema', - type: 'object', - properties: { - total: { type: 'number' }, - perPage: { type: 'number' }, - page: { type: 'number' }, - }, - required: ['total', 'perPage', 'page'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json new file mode 100644 index 000000000..d1150d3db --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json @@ -0,0 +1,13 @@ +{ + "id": "/relayerApiAssetDataPairsResponseSchema", + "type": "object", + "allOf": [ + { "$ref": "/paginatedCollectionSchema" }, + { + "properties": { + "records": { "$ref": "/relayerApiAssetDataPairsSchema" } + }, + "required": ["records"] + } + ] +} diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json new file mode 100644 index 000000000..62d4745b8 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json @@ -0,0 +1,12 @@ +{ + "id": "/relayerApiAssetDataPairsSchema", + "type": "array", + "items": { + "properties": { + "assetDataA": { "$ref": "/relayerApiAssetDataTradeInfoSchema" }, + "assetDataB": { "$ref": "/relayerApiAssetDataTradeInfoSchema" } + }, + "required": ["assetDataA", "assetDataB"], + "type": "object" + } +} diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json new file mode 100644 index 000000000..0ab9b444f --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/relayerApiAssetDataTradeInfoSchema", + "type": "object", + "properties": { + "assetData": { "$ref": "/hexSchema" }, + "minAmount": { "$ref": "/numberSchema" }, + "maxAmount": { "$ref": "/numberSchema" }, + "precision": { "type": "number" } + }, + "required": ["assetData"] +} diff --git a/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts b/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts deleted file mode 100644 index c13396d29..000000000 --- a/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts +++ /dev/null @@ -1,38 +0,0 @@ -export const relayerApiAssetDataPairsResponseSchema = { - id: '/relayerApiAssetDataPairsResponseSchema', - type: 'object', - allOf: [ - { $ref: '/paginatedCollectionSchema' }, - { - properties: { - records: { $ref: '/relayerApiAssetDataPairsSchema' }, - }, - required: ['records'], - }, - ], -}; - -export const relayerApiAssetDataPairsSchema = { - id: '/relayerApiAssetDataPairsSchema', - type: 'array', - items: { - properties: { - assetDataA: { $ref: '/relayerApiAssetDataTradeInfoSchema' }, - assetDataB: { $ref: '/relayerApiAssetDataTradeInfoSchema' }, - }, - required: ['assetDataA', 'assetDataB'], - type: 'object', - }, -}; - -export const relayerApiAssetDataTradeInfoSchema = { - id: '/relayerApiAssetDataTradeInfoSchema', - type: 'object', - properties: { - assetData: { $ref: '/hexSchema' }, - minAmount: { $ref: '/numberSchema' }, - maxAmount: { $ref: '/numberSchema' }, - precision: { type: 'number' }, - }, - required: ['assetData'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_error_response_schema.json b/packages/json-schemas/schemas/relayer_api_error_response_schema.json new file mode 100644 index 000000000..be4659b0b --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_error_response_schema.json @@ -0,0 +1,21 @@ +{ + "id": "/relayerApiErrorResponseSchema", + "type": "object", + "properties": { + "code": { "type": "integer", "minimum": 100, "maximum": 103 }, + "reason": { "type": "string" }, + "validationErrors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { "type": "string" }, + "code": { "type": "integer", "minimum": 1000, "maximum": 1006 }, + "reason": { "type": "string" } + }, + "required": ["field", "code", "reason"] + } + } + }, + "required": ["code", "reason"] +} diff --git a/packages/json-schemas/schemas/relayer_api_error_response_schema.ts b/packages/json-schemas/schemas/relayer_api_error_response_schema.ts deleted file mode 100644 index 79e33fc85..000000000 --- a/packages/json-schemas/schemas/relayer_api_error_response_schema.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const relayerApiErrorResponseSchema = { - id: '/relayerApiErrorResponseSchema', - type: 'object', - properties: { - code: { type: 'integer', minimum: 100, maximum: 103 }, - reason: { type: 'string' }, - validationErrors: { - type: 'array', - items: { - type: 'object', - properties: { - field: { type: 'string' }, - code: { type: 'integer', minimum: 1000, maximum: 1006 }, - reason: { type: 'string' }, - }, - required: ['field', 'code', 'reason'], - }, - }, - }, - required: ['code', 'reason'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json new file mode 100644 index 000000000..c73506dbb --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json @@ -0,0 +1,16 @@ +{ + "id": "/relayerApiFeeRecipientsResponseSchema", + "type": "object", + "allOf": [ + { "$ref": "/paginatedCollectionSchema" }, + { + "properties": { + "records": { + "type": "array", + "items": { "$ref": "/addressSchema" } + } + }, + "required": ["records"] + } + ] +} diff --git a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts deleted file mode 100644 index 5f6bc0530..000000000 --- a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const relayerApiFeeRecipientsResponseSchema = { - id: '/relayerApiFeeRecipientsResponseSchema', - type: 'object', - allOf: [ - { $ref: '/paginatedCollectionSchema' }, - { - properties: { - records: { - type: 'array', - items: { $ref: '/addressSchema' }, - }, - }, - required: ['records'], - }, - ], -}; diff --git a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json new file mode 100644 index 000000000..bc95b61ef --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json @@ -0,0 +1,24 @@ +{ + "id": "/relayerApiOrderConfigPayloadSchema", + "type": "object", + "properties": { + "makerAddress": { "$ref": "/addressSchema" }, + "takerAddress": { "$ref": "/addressSchema" }, + "makerAssetAmount": { "$ref": "/numberSchema" }, + "takerAssetAmount": { "$ref": "/numberSchema" }, + "makerAssetData": { "$ref": "/hexSchema" }, + "takerAssetData": { "$ref": "/hexSchema" }, + "exchangeAddress": { "$ref": "/addressSchema" }, + "expirationTimeSeconds": { "$ref": "/numberSchema" } + }, + "required": [ + "makerAddress", + "takerAddress", + "makerAssetAmount", + "takerAssetAmount", + "makerAssetData", + "takerAssetData", + "exchangeAddress", + "expirationTimeSeconds" + ] +} diff --git a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts deleted file mode 100644 index 8d1d408d6..000000000 --- a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const relayerApiOrderConfigPayloadSchema = { - id: '/relayerApiOrderConfigPayloadSchema', - type: 'object', - properties: { - makerAddress: { $ref: '/addressSchema' }, - takerAddress: { $ref: '/addressSchema' }, - makerAssetAmount: { $ref: '/numberSchema' }, - takerAssetAmount: { $ref: '/numberSchema' }, - makerAssetData: { $ref: '/hexSchema' }, - takerAssetData: { $ref: '/hexSchema' }, - exchangeAddress: { $ref: '/addressSchema' }, - expirationTimeSeconds: { $ref: '/numberSchema' }, - }, - required: [ - 'makerAddress', - 'takerAddress', - 'makerAssetAmount', - 'takerAssetAmount', - 'makerAssetData', - 'takerAssetData', - 'exchangeAddress', - 'expirationTimeSeconds', - ], -}; diff --git a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json new file mode 100644 index 000000000..0742febdf --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/relayerApiOrderConfigResponseSchema", + "type": "object", + "properties": { + "makerFee": { "$ref": "/numberSchema" }, + "takerFee": { "$ref": "/numberSchema" }, + "feeRecipientAddress": { "$ref": "/addressSchema" }, + "senderAddress": { "$ref": "/addressSchema" } + }, + "required": ["makerFee", "takerFee", "feeRecipientAddress", "senderAddress"] +} diff --git a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts deleted file mode 100644 index 390d0b262..000000000 --- a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const relayerApiOrderConfigResponseSchema = { - id: '/relayerApiOrderConfigResponseSchema', - type: 'object', - properties: { - makerFee: { $ref: '/numberSchema' }, - takerFee: { $ref: '/numberSchema' }, - feeRecipientAddress: { $ref: '/addressSchema' }, - senderAddress: { $ref: '/addressSchema' }, - }, - required: ['makerFee', 'takerFee', 'feeRecipientAddress', 'senderAddress'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.json b/packages/json-schemas/schemas/relayer_api_order_schema.json new file mode 100644 index 000000000..e0f6539b9 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_schema.json @@ -0,0 +1,9 @@ +{ + "id": "/relayerApiOrderSchema", + "type": "object", + "properties": { + "order": { "$ref": "/orderSchema" }, + "metaData": { "type": "object" } + }, + "required": ["order", "metaData"] +} diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.ts b/packages/json-schemas/schemas/relayer_api_order_schema.ts deleted file mode 100644 index 3952e9683..000000000 --- a/packages/json-schemas/schemas/relayer_api_order_schema.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const relayerApiOrderSchema = { - id: '/relayerApiOrderSchema', - type: 'object', - properties: { - order: { $ref: '/orderSchema' }, - metaData: { type: 'object' }, - }, - required: ['order', 'metaData'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json new file mode 100644 index 000000000..b44f2a740 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json @@ -0,0 +1,9 @@ +{ + "id": "/relayerApiOrderbookResponseSchema", + "type": "object", + "properties": { + "bids": { "$ref": "/relayerApiOrdersResponseSchema" }, + "asks": { "$ref": "/relayerApiOrdersResponseSchema" } + }, + "required": ["bids", "asks"] +} diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts deleted file mode 100644 index 7c0b8e0df..000000000 --- a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const relayerApiOrderbookResponseSchema = { - id: '/relayerApiOrderbookResponseSchema', - type: 'object', - properties: { - bids: { $ref: '/relayerApiOrdersResponseSchema' }, - asks: { $ref: '/relayerApiOrdersResponseSchema' }, - }, - required: ['bids', 'asks'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json new file mode 100644 index 000000000..274ef1625 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json @@ -0,0 +1,14 @@ +{ + "id": "/relayerApiOrdersChannelSubscribePayloadSchema", + "type": "object", + "properties": { + "makerAssetProxyId": { "$ref": "/hexSchema" }, + "takerAssetProxyId": { "$ref": "/hexSchema" }, + "networkId": { "type": "number" }, + "makerAssetAddress": { "$ref": "/addressSchema" }, + "takerAssetAddress": { "$ref": "/addressSchema" }, + "makerAssetData": { "$ref": "/hexSchema" }, + "takerAssetData": { "$ref": "/hexSchema" }, + "traderAssetData": { "$ref": "/hexSchema" } + } +} diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json new file mode 100644 index 000000000..29561d09f --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/relayerApiOrdersChannelSubscribeSchema", + "type": "object", + "properties": { + "type": { "enum": ["subscribe"] }, + "channel": { "enum": ["orders"] }, + "requestId": { "type": "string" }, + "payload": { "$ref": "/relayerApiOrdersChannelSubscribePayloadSchema" } + }, + "required": ["type", "channel", "requestId"] +} diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts deleted file mode 100644 index a3b9b6d95..000000000 --- a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts +++ /dev/null @@ -1,26 +0,0 @@ -export const relayerApiOrdersChannelSubscribeSchema = { - id: '/relayerApiOrdersChannelSubscribeSchema', - type: 'object', - properties: { - type: { enum: ['subscribe'] }, - channel: { enum: ['orders'] }, - requestId: { type: 'string' }, - payload: { $ref: '/relayerApiOrdersChannelSubscribePayload' }, - }, - required: ['type', 'channel', 'requestId'], -}; - -export const relayerApiOrdersChannelSubscribePayload = { - id: '/relayerApiOrdersChannelSubscribePayload', - type: 'object', - properties: { - makerAssetProxyId: { $ref: '/hexSchema' }, - takerAssetProxyId: { $ref: '/hexSchema' }, - networkId: { type: 'number' }, - makerAssetAddress: { $ref: '/addressSchema' }, - takerAssetAddress: { $ref: '/addressSchema' }, - makerAssetData: { $ref: '/hexSchema' }, - takerAssetData: { $ref: '/hexSchema' }, - traderAssetData: { $ref: '/hexSchema' }, - }, -}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json new file mode 100644 index 000000000..239e7c586 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/relayerApiOrdersChannelUpdateSchema", + "type": "object", + "properties": { + "type": { "enum": ["update"] }, + "channel": { "enum": ["orders"] }, + "requestId": { "type": "string" }, + "payload": { "$ref": "/relayerApiOrdersSchema" } + }, + "required": ["type", "channel", "requestId"] +} diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts deleted file mode 100644 index 800b818e2..000000000 --- a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const relayerApiOrdersChannelUpdateSchema = { - id: '/relayerApiOrdersChannelUpdateSchema', - type: 'object', - properties: { - type: { enum: ['update'] }, - channel: { enum: ['orders'] }, - requestId: { type: 'string' }, - payload: { $ref: '/relayerApiOrdersSchema' }, - }, - required: ['type', 'channel', 'requestId'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.json b/packages/json-schemas/schemas/relayer_api_orders_response_schema.json new file mode 100644 index 000000000..a5023a3fc --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_response_schema.json @@ -0,0 +1,13 @@ +{ + "id": "/relayerApiOrdersResponseSchema", + "type": "object", + "allOf": [ + { "$ref": "/paginatedCollectionSchema" }, + { + "properties": { + "records": { "$ref": "/relayerApiOrdersSchema" } + }, + "required": ["records"] + } + ] +} diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts deleted file mode 100644 index c10d64ca9..000000000 --- a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const relayerApiOrdersResponseSchema = { - id: '/relayerApiOrdersResponseSchema', - type: 'object', - allOf: [ - { $ref: '/paginatedCollectionSchema' }, - { - properties: { - records: { $ref: '/relayerApiOrdersSchema' }, - }, - required: ['records'], - }, - ], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.json b/packages/json-schemas/schemas/relayer_api_orders_schema.json new file mode 100644 index 000000000..84e75cd04 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/relayerApiOrdersSchema", + "type": "array", + "items": { "$ref": "/relayerApiOrderSchema" } +} diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_schema.ts deleted file mode 100644 index ba8ce4722..000000000 --- a/packages/json-schemas/schemas/relayer_api_orders_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const relayerApiOrdersSchema = { - id: '/relayerApiOrdersSchema', - type: 'array', - items: { $ref: '/relayerApiOrderSchema' }, -}; diff --git a/packages/json-schemas/schemas/signed_order_schema.json b/packages/json-schemas/schemas/signed_order_schema.json new file mode 100644 index 000000000..137ae4a24 --- /dev/null +++ b/packages/json-schemas/schemas/signed_order_schema.json @@ -0,0 +1,12 @@ +{ + "id": "/signedOrderSchema", + "allOf": [ + { "$ref": "/orderSchema" }, + { + "properties": { + "signature": { "$ref": "/hexSchema" } + }, + "required": ["signature"] + } + ] +} diff --git a/packages/json-schemas/schemas/signed_orders_schema.json b/packages/json-schemas/schemas/signed_orders_schema.json new file mode 100644 index 000000000..e7c3a0b6c --- /dev/null +++ b/packages/json-schemas/schemas/signed_orders_schema.json @@ -0,0 +1,5 @@ +{ + "id": "/signedOrdersSchema", + "type": "array", + "items": { "$ref": "/signedOrderSchema" } +} diff --git a/packages/json-schemas/schemas/signed_orders_schema.ts b/packages/json-schemas/schemas/signed_orders_schema.ts deleted file mode 100644 index e2a5aeb56..000000000 --- a/packages/json-schemas/schemas/signed_orders_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const signedOrdersSchema = { - id: '/signedOrdersSchema', - type: 'array', - items: { $ref: '/signedOrderSchema' }, -}; diff --git a/packages/json-schemas/schemas/token_schema.json b/packages/json-schemas/schemas/token_schema.json new file mode 100644 index 000000000..31e41c4b8 --- /dev/null +++ b/packages/json-schemas/schemas/token_schema.json @@ -0,0 +1,11 @@ +{ + "id": "/tokenSchema", + "properties": { + "name": { "type": "string" }, + "symbol": { "type": "string" }, + "decimals": { "type": "number" }, + "address": { "$ref": "/addressSchema" } + }, + "required": ["name", "symbol", "decimals", "address"], + "type": "object" +} diff --git a/packages/json-schemas/schemas/token_schema.ts b/packages/json-schemas/schemas/token_schema.ts deleted file mode 100644 index a0b1ae27f..000000000 --- a/packages/json-schemas/schemas/token_schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const tokenSchema = { - id: '/tokenSchema', - properties: { - name: { type: 'string' }, - symbol: { type: 'string' }, - decimals: { type: 'number' }, - address: { $ref: '/addressSchema' }, - }, - required: ['name', 'symbol', 'decimals', 'address'], - type: 'object', -}; diff --git a/packages/json-schemas/schemas/tx_data_schema.json b/packages/json-schemas/schemas/tx_data_schema.json new file mode 100644 index 000000000..4643521ce --- /dev/null +++ b/packages/json-schemas/schemas/tx_data_schema.json @@ -0,0 +1,26 @@ +{ + "id": "/txDataSchema", + "properties": { + "from": { "$ref": "/addressSchema" }, + "to": { "$ref": "/addressSchema" }, + "value": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "gas": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "gasPrice": { + "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }] + }, + "data": { + "type": "string", + "pattern": "^0x[0-9a-f]*$" + }, + "nonce": { + "type": "number", + "minimum": 0 + } + }, + "required": ["from"], + "type": "object" +} diff --git a/packages/json-schemas/schemas/tx_data_schema.ts b/packages/json-schemas/schemas/tx_data_schema.ts deleted file mode 100644 index c57e18461..000000000 --- a/packages/json-schemas/schemas/tx_data_schema.ts +++ /dev/null @@ -1,32 +0,0 @@ -export const jsNumber = { - id: '/jsNumber', - type: 'number', - minimum: 0, -}; - -export const txDataSchema = { - id: '/txDataSchema', - properties: { - from: { $ref: '/addressSchema' }, - to: { $ref: '/addressSchema' }, - value: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - gas: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - gasPrice: { - oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }], - }, - data: { - type: 'string', - pattern: '^0x[0-9a-f]*$', - }, - nonce: { - type: 'number', - minimum: 0, - }, - }, - required: ['from'], - type: 'object', -}; diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.json b/packages/json-schemas/schemas/zero_ex_transaction_schema.json new file mode 100644 index 000000000..ad3b11583 --- /dev/null +++ b/packages/json-schemas/schemas/zero_ex_transaction_schema.json @@ -0,0 +1,10 @@ +{ + "id": "/zeroExTransactionSchema", + "properties": { + "data": { "$ref": "/hexSchema" }, + "signerAddress": { "$ref": "/addressSchema" }, + "salt": { "$ref": "/numberSchema" } + }, + "required": ["data", "salt", "signerAddress"], + "type": "object" +} diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.ts b/packages/json-schemas/schemas/zero_ex_transaction_schema.ts deleted file mode 100644 index 7f729b724..000000000 --- a/packages/json-schemas/schemas/zero_ex_transaction_schema.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const zeroExTransactionSchema = { - id: '/zeroExTransactionSchema', - properties: { - data: { $ref: '/hexSchema' }, - signerAddress: { $ref: '/addressSchema' }, - salt: { $ref: '/numberSchema' }, - }, - required: ['data', 'salt', 'signerAddress'], - type: 'object', -}; diff --git a/packages/json-schemas/src/globals.d.ts b/packages/json-schemas/src/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/json-schemas/src/globals.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module '*.json' { - const json: any; - /* tslint:disable */ - export default json; - /* tslint:enable */ -} diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts index 4eb96092d..8318df617 100644 --- a/packages/json-schemas/src/schemas.ts +++ b/packages/json-schemas/src/schemas.ts @@ -1,38 +1,40 @@ -import { addressSchema, hexSchema, numberSchema } from '../schemas/basic_type_schemas'; -import { blockParamSchema, blockRangeSchema } from '../schemas/block_range_schema'; -import { callDataSchema } from '../schemas/call_data_schema'; -import { ecSignatureParameterSchema, ecSignatureSchema } from '../schemas/ec_signature_schema'; -import { eip712TypedDataSchema } from '../schemas/eip712_typed_data'; -import { indexFilterValuesSchema } from '../schemas/index_filter_values_schema'; -import { orderCancellationRequestsSchema } from '../schemas/order_cancel_schema'; -import { orderFillOrKillRequestsSchema } from '../schemas/order_fill_or_kill_requests_schema'; -import { orderFillRequestsSchema } from '../schemas/order_fill_requests_schema'; -import { orderHashSchema } from '../schemas/order_hash_schema'; -import { orderSchema, signedOrderSchema } from '../schemas/order_schemas'; -import { ordersSchema } from '../schemas/orders_schema'; -import { paginatedCollectionSchema } from '../schemas/paginated_collection_schema'; -import { - relayerApiAssetDataPairsResponseSchema, - relayerApiAssetDataPairsSchema, - relayerApiAssetDataTradeInfoSchema, -} from '../schemas/relayer_api_asset_pairs_response_schema'; -import { relayerApiErrorResponseSchema } from '../schemas/relayer_api_error_response_schema'; -import { relayerApiFeeRecipientsResponseSchema } from '../schemas/relayer_api_fee_recipients_response_schema'; -import { relayerApiOrderConfigPayloadSchema } from '../schemas/relayer_api_order_config_payload_schema'; -import { relayerApiOrderConfigResponseSchema } from '../schemas/relayer_api_order_config_response_schema'; -import { relayerApiOrderSchema } from '../schemas/relayer_api_order_schema'; -import { relayerApiOrderbookResponseSchema } from '../schemas/relayer_api_orderbook_response_schema'; -import { - relayerApiOrdersChannelSubscribePayload, - relayerApiOrdersChannelSubscribeSchema, -} from '../schemas/relayer_api_orders_channel_subscribe_schema'; -import { relayerApiOrdersChannelUpdateSchema } from '../schemas/relayer_api_orders_channel_update_response_schema'; -import { relayerApiOrdersResponseSchema } from '../schemas/relayer_api_orders_response_schema'; -import { relayerApiOrdersSchema } from '../schemas/relayer_api_orders_schema'; -import { signedOrdersSchema } from '../schemas/signed_orders_schema'; -import { tokenSchema } from '../schemas/token_schema'; -import { jsNumber, txDataSchema } from '../schemas/tx_data_schema'; -import { zeroExTransactionSchema } from '../schemas/zero_ex_transaction_schema'; +import * as addressSchema from '../schemas/address_schema.json'; +import * as blockParamSchema from '../schemas/block_param_schema.json'; +import * as blockRangeSchema from '../schemas/block_range_schema.json'; +import * as callDataSchema from '../schemas/call_data_schema.json'; +import * as ecSignatureParameterSchema from '../schemas/ec_signature_parameter_schema.json'; +import * as ecSignatureSchema from '../schemas/ec_signature_schema.json'; +import * as eip712TypedDataSchema from '../schemas/eip712_typed_data_schema.json'; +import * as hexSchema from '../schemas/hex_schema.json'; +import * as indexFilterValuesSchema from '../schemas/index_filter_values_schema.json'; +import * as jsNumber from '../schemas/js_number.json'; +import * as numberSchema from '../schemas/number_schema.json'; +import * as orderCancellationRequestsSchema from '../schemas/order_cancel_schema.json'; +import * as orderFillOrKillRequestsSchema from '../schemas/order_fill_or_kill_requests_schema.json'; +import * as orderFillRequestsSchema from '../schemas/order_fill_requests_schema.json'; +import * as orderHashSchema from '../schemas/order_hash_schema.json'; +import * as orderSchema from '../schemas/order_schema.json'; +import * as ordersSchema from '../schemas/orders_schema.json'; +import * as paginatedCollectionSchema from '../schemas/paginated_collection_schema.json'; +import * as relayerApiAssetDataPairsResponseSchema from '../schemas/relayer_api_asset_data_pairs_response_schema.json'; +import * as relayerApiAssetDataPairsSchema from '../schemas/relayer_api_asset_data_pairs_schema.json'; +import * as relayerApiAssetDataTradeInfoSchema from '../schemas/relayer_api_asset_data_trade_info_schema.json'; +import * as relayerApiErrorResponseSchema from '../schemas/relayer_api_error_response_schema.json'; +import * as relayerApiFeeRecipientsResponseSchema from '../schemas/relayer_api_fee_recipients_response_schema.json'; +import * as relayerApiOrderConfigPayloadSchema from '../schemas/relayer_api_order_config_payload_schema.json'; +import * as relayerApiOrderConfigResponseSchema from '../schemas/relayer_api_order_config_response_schema.json'; +import * as relayerApiOrderSchema from '../schemas/relayer_api_order_schema.json'; +import * as relayerApiOrderbookResponseSchema from '../schemas/relayer_api_orderbook_response_schema.json'; +import * as relayerApiOrdersChannelSubscribePayloadSchema from '../schemas/relayer_api_orders_channel_subscribe_payload_schema.json'; +import * as relayerApiOrdersChannelSubscribeSchema from '../schemas/relayer_api_orders_channel_subscribe_schema.json'; +import * as relayerApiOrdersChannelUpdateSchema from '../schemas/relayer_api_orders_channel_update_response_schema.json'; +import * as relayerApiOrdersResponseSchema from '../schemas/relayer_api_orders_response_schema.json'; +import * as relayerApiOrdersSchema from '../schemas/relayer_api_orders_schema.json'; +import * as signedOrderSchema from '../schemas/signed_order_schema.json'; +import * as signedOrdersSchema from '../schemas/signed_orders_schema.json'; +import * as tokenSchema from '../schemas/token_schema.json'; +import * as txDataSchema from '../schemas/tx_data_schema.json'; +import * as zeroExTransactionSchema from '../schemas/zero_ex_transaction_schema.json'; export const schemas = { numberSchema, @@ -67,7 +69,7 @@ export const schemas = { relayerApiAssetDataPairsResponseSchema, relayerApiAssetDataTradeInfoSchema, relayerApiOrdersChannelSubscribeSchema, - relayerApiOrdersChannelSubscribePayload, + relayerApiOrdersChannelSubscribePayloadSchema, relayerApiOrdersChannelUpdateSchema, relayerApiOrdersResponseSchema, relayerApiAssetDataPairsSchema, diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json index 96bf8789e..683787102 100644 --- a/packages/json-schemas/tsconfig.json +++ b/packages/json-schemas/tsconfig.json @@ -2,7 +2,47 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", - "rootDir": "." + "rootDir": ".", + "resolveJsonModule": true }, - "include": ["./src/**/*", "./test/**/*", "./schemas/**/*"] + "include": ["./src/**/*", "./test/**/*", "./schemas/**/*"], + "files": [ + "./schemas/address_schema.json", + "./schemas/number_schema.json", + "./schemas/hex_schema.json", + "./schemas/block_param_schema.json", + "./schemas/block_range_schema.json", + "./schemas/call_data_schema.json", + "./schemas/ec_signature_parameter_schema.json", + "./schemas/ec_signature_schema.json", + "./schemas/eip712_typed_data_schema.json", + "./schemas/order_cancel_schema.json", + "./schemas/order_fill_or_kill_requests_schema.json", + "./schemas/order_fill_requests_schema.json", + "./schemas/order_hash_schema.json", + "./schemas/order_schema.json", + "./schemas/signed_order_schema.json", + "./schemas/orders_schema.json", + "./schemas/paginated_collection_schema.json", + "./schemas/relayer_api_asset_data_pairs_response_schema.json", + "./schemas/relayer_api_asset_data_pairs_schema.json", + "./schemas/relayer_api_asset_data_trade_info_schema.json", + "./schemas/relayer_api_error_response_schema.json", + "./schemas/relayer_api_fee_recipients_response_schema.json", + "./schemas/relayer_api_order_config_payload_schema.json", + "./schemas/relayer_api_order_config_response_schema.json", + "./schemas/relayer_api_order_schema.json", + "./schemas/relayer_api_orderbook_response_schema.json", + "./schemas/relayer_api_orders_channel_subscribe_payload_schema.json", + "./schemas/relayer_api_orders_channel_subscribe_schema.json", + "./schemas/relayer_api_orders_channel_update_response_schema.json", + "./schemas/relayer_api_orders_response_schema.json", + "./schemas/relayer_api_orders_schema.json", + "./schemas/signed_orders_schema.json", + "./schemas/token_schema.json", + "./schemas/js_number.json", + "./schemas/zero_ex_transaction_schema.json", + "./schemas/tx_data_schema.json", + "./schemas/index_filter_values_schema.json" + ] } -- cgit v1.2.3 From 9176e535aa54c9e5c831cc0e678262b4e42d1d2b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 13:52:43 +0100 Subject: Fix sra-spec & connect --- packages/connect/src/utils/assert.ts | 2 +- packages/sra-spec/src/json-schemas.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/connect/src/utils/assert.ts b/packages/connect/src/utils/assert.ts index 3d8f1c799..4e2202d2e 100644 --- a/packages/connect/src/utils/assert.ts +++ b/packages/connect/src/utils/assert.ts @@ -14,7 +14,7 @@ export const assert = { sharedAssert.doesConformToSchema( variableName, subscriptionOpts, - schemas.relayerApiOrdersChannelSubscribePayload, + schemas.relayerApiOrdersChannelSubscribePayloadSchema, ); }, isOrdersChannelHandler(variableName: string, handler: any): void { diff --git a/packages/sra-spec/src/json-schemas.ts b/packages/sra-spec/src/json-schemas.ts index 173a04bfb..47cca9b04 100644 --- a/packages/sra-spec/src/json-schemas.ts +++ b/packages/sra-spec/src/json-schemas.ts @@ -21,7 +21,7 @@ const { relayerApiAssetDataPairsResponseSchema, relayerApiAssetDataTradeInfoSchema, relayerApiOrdersChannelSubscribeSchema, - relayerApiOrdersChannelSubscribePayload, + relayerApiOrdersChannelSubscribePayloadSchema, relayerApiOrdersChannelUpdateSchema, relayerApiOrdersResponseSchema, relayerApiAssetDataPairsSchema, @@ -47,7 +47,7 @@ const usedSchemas = { relayerApiAssetDataPairsResponseSchema, relayerApiAssetDataTradeInfoSchema, relayerApiOrdersChannelSubscribeSchema, - relayerApiOrdersChannelSubscribePayload, + relayerApiOrdersChannelSubscribePayloadSchema, relayerApiOrdersChannelUpdateSchema, relayerApiOrdersResponseSchema, relayerApiAssetDataPairsSchema, -- cgit v1.2.3 From bd00f1279b2b8bdfc4971580b2ec547d2849d5df Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 13:54:27 +0100 Subject: Add CHANGELOG entry --- packages/json-schemas/CHANGELOG.json | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'packages') diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index 53d929901..08e74b6db 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "2.0.0", + "changes": [ + { + "note": + "Convert all schemas to JSON files so that they can be used with `json-schema` implemenations in other programming languages.", + "pr": 1145 + } + ] + }, { "timestamp": 1538693146, "version": "1.0.7", -- cgit v1.2.3 From d87643fdfa722237247d28333e8ce50404670040 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 14:02:38 +0100 Subject: Update schemas markdown section for v2 docs --- .../website/md/docs/json_schemas/2.0.0/schemas.md | 52 +++++++++++++--------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'packages') diff --git a/packages/website/md/docs/json_schemas/2.0.0/schemas.md b/packages/website/md/docs/json_schemas/2.0.0/schemas.md index 4f3200b1c..ec7cf6f15 100644 --- a/packages/website/md/docs/json_schemas/2.0.0/schemas.md +++ b/packages/website/md/docs/json_schemas/2.0.0/schemas.md @@ -1,28 +1,40 @@ +Basic Schemas + +* [Address type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/address.json) +* [Number type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/number.json) +* [Hex type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/hex.json) +* [JS number](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/js_number.json) + 0x Protocol Schemas -* [Basic types](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/basic_type_schemas.ts) (e.g Ethereum address, number, hex) -* [Order/SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schemas.ts) -* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.ts) +* [Order](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schema.json) +* [SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_order_schema.json) +* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.json) +* [ECSignature](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/ec_signature_schema.json) 0x.js Schemas -* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.ts) -* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.ts) -* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.ts) -* [OrderCancellationRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.ts) -* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts) -* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.ts) -* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.ts) -* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.ts) +* [BlockParam](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_param_schema.json) +* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.json) +* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.json) +* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.json) +* [OrderCancellationRequests](https://github.com/0xProjet/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.json) +* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json) +* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.json) +* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.json) +* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.json) Standard Relayer API Schemas -* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.ts) -* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts) -* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts) -* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts) -* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts) -* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts) -* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts) -* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts) -* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts) +* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.json) +* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.json) +* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json) +* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json) +* [Orders channel subscribe payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json) +* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json) +* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json) +* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json) +* [Asset pairs](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_schema.json) +* [Trade info](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_trade_info_schema.json) +* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.json) +* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json) -- cgit v1.2.3 From abc00b05c3e5b09004c247f5c1b7f7cf007591f6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 17 Oct 2018 14:04:01 +0100 Subject: chore: remove schemas from include section --- packages/json-schemas/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json index 683787102..425dfcfe1 100644 --- a/packages/json-schemas/tsconfig.json +++ b/packages/json-schemas/tsconfig.json @@ -5,7 +5,7 @@ "rootDir": ".", "resolveJsonModule": true }, - "include": ["./src/**/*", "./test/**/*", "./schemas/**/*"], + "include": ["./src/**/*", "./test/**/*"], "files": [ "./schemas/address_schema.json", "./schemas/number_schema.json", -- cgit v1.2.3 From f2e5a9635bdd61dbba2713ef6c556d412481251d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 15:33:50 +0100 Subject: chore: make linter ignore json schemas --- packages/json-schemas/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 38dee306d..46305b6ab 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -10,7 +10,7 @@ "scripts": { "build": "tsc -b", "build:ci": "yarn build", - "lint": "tslint --project .", + "lint": "tslint --project . --exclude **/schemas/**/*", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", -- cgit v1.2.3 From 7c87d2e38b070fa9c3f2704c60f4e886d921cda3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 16:18:28 +0100 Subject: chore: Update TypeDoc to 0.13.0 (supports TS v3.1) --- packages/0x.js/package.json | 2 +- packages/asset-buyer/package.json | 2 +- packages/connect/package.json | 2 +- packages/contract-wrappers/package.json | 2 +- packages/instant/package.json | 2 +- packages/json-schemas/package.json | 2 +- packages/monorepo-scripts/package.json | 2 +- packages/order-utils/package.json | 2 +- packages/sol-compiler/package.json | 2 +- packages/sol-cov/package.json | 2 +- packages/subproviders/package.json | 2 +- packages/web3-wrapper/package.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index a78457e22..c439c8af3 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -68,7 +68,7 @@ "sinon": "^4.0.0", "source-map-support": "^0.5.0", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1", "uglifyjs-webpack-plugin": "^2.0.1", "webpack": "^4.20.2" diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index 8c8f3c92c..1f97365f4 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -63,7 +63,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "publishConfig": { diff --git a/packages/connect/package.json b/packages/connect/package.json index e47ca3b79..591db0f83 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -77,7 +77,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "publishConfig": { diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 3924378d3..ef19057cd 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -60,7 +60,7 @@ "sinon": "^4.0.0", "source-map-support": "^0.5.0", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1", "web3-provider-engine": "14.0.6" }, diff --git a/packages/instant/package.json b/packages/instant/package.json index 203ac4894..0c4b470fa 100644 --- a/packages/instant/package.json +++ b/packages/instant/package.json @@ -79,7 +79,7 @@ "shx": "^0.2.2", "ts-jest": "^23.10.3", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1", "webpack": "^4.20.2", "webpack-cli": "^3.1.1", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 46305b6ab..20d2e48ce 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -59,7 +59,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "publishConfig": { diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 83091ae84..57e8bc147 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -65,7 +65,7 @@ "semver": "5.5.0", "semver-diff": "^2.1.0", "semver-sort": "0.0.4", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "yargs": "^10.0.3" }, "publishConfig": { diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 50bc0f0a0..09eef849f 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -49,7 +49,7 @@ "shx": "^0.2.2", "sinon": "^4.0.0", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "dependencies": { diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 9ee88a5ef..828ce1dbc 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -58,7 +58,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "types-bn": "^0.0.1", "typescript": "3.0.1", "web3-typescript-typings": "^0.10.2", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index e093aa2ad..49473f6c8 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -78,7 +78,7 @@ "shx": "^0.2.2", "sinon": "^4.0.0", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "publishConfig": { diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index bef93a572..1fe1ee4ad 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -73,7 +73,7 @@ "shx": "^0.2.2", "sinon": "^4.0.0", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1", "webpack": "^4.20.2" }, diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 972dfa7a2..4d033e130 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -49,7 +49,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0.12.0", + "typedoc": "0.13.0", "typescript": "3.0.1" }, "dependencies": { -- cgit v1.2.3 From 852f50d1a0e2d7f6c95231406c8604f9e56dc1dc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 17:09:35 +0100 Subject: chore: Re-cast to EventAbi after checking the the type is set to 'event' --- packages/utils/src/abi_decoder.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index ac3e54efb..9cc863909 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -99,11 +99,12 @@ export class AbiDecoder { const ethersInterface = new ethers.utils.Interface(abiArray); _.map(abiArray, (abi: AbiDefinition) => { if (abi.type === AbiType.Event) { - const topic = ethersInterface.events[abi.name].topic; - const numIndexedArgs = _.reduce(abi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); + const eventAbi = abi as EventAbi; + const topic = ethersInterface.events[eventAbi.name].topic; + const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); this._methodIds[topic] = { ...this._methodIds[topic], - [numIndexedArgs]: abi, + [numIndexedArgs]: eventAbi, }; } }); -- cgit v1.2.3 From f7de26f65c4aebcf5d27dab07f4b75081b48d7ac Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 17:13:32 +0100 Subject: chore: make abi `type` prop always of type string to fix TypeDoc issue related to reading in artifacts from JSON files --- packages/ethereum-types/src/index.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index ddd472010..eff38711a 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -20,7 +20,9 @@ export type ConstructorStateMutability = 'nonpayable' | 'payable'; export type StateMutability = 'pure' | 'view' | ConstructorStateMutability; export interface MethodAbi { - type: 'function'; // We hardcode this here b/c doc pages cannot render an enum value + // Ideally this would be set to: `'function'` but then TS complains when artifacts are loaded + // from JSON files, and this value has type `string` not type `'function'` + type: string; name: string; inputs: DataItem[]; outputs: DataItem[]; @@ -30,14 +32,18 @@ export interface MethodAbi { } export interface ConstructorAbi { - type: 'constructor'; // We hardcode this here b/c doc pages cannot render an enum value + // Ideally this would be set to: `'constructor'` but then TS complains when artifacts are loaded + // from JSON files, and this value has type `string` not type `'constructor'` + type: string; inputs: DataItem[]; payable: boolean; stateMutability: ConstructorStateMutability; } export interface FallbackAbi { - type: 'fallback'; // We hardcode this here b/c doc pages cannot render an enum value + // Ideally this would be set to: `'fallback'` but then TS complains when artifacts are loaded + // from JSON files, and this value has type `string` not type `'fallback'` + type: string; payable: boolean; } @@ -46,7 +52,9 @@ export interface EventParameter extends DataItem { } export interface EventAbi { - type: 'event'; // We hardcode this here b/c doc pages cannot render an enum value + // Ideally this would be set to: `'event'` but then TS complains when artifacts are loaded + // from JSON files, and this value has type `string` not type `'event'` + type: string; name: string; inputs: EventParameter[]; anonymous: boolean; -- cgit v1.2.3 From a31f3b542f96b0a332c9b6424d5bf21f5a4dd8b9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 17:18:00 +0100 Subject: Add necessary cast --- packages/base-contract/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index a8e4ad2e2..354362d45 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -1,5 +1,6 @@ import { abiUtils, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { FunctionAbi } from 'ethereum-protocol'; import { AbiDefinition, AbiType, @@ -129,7 +130,7 @@ export class BaseContract { if (abiDefinition.type !== AbiType.Function) { return false; } - const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition); + const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi); if (abiFunctionSignature === functionSignature) { return true; } -- cgit v1.2.3 From 87fabbb943779d868d29c437f078a341cb177b2b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 17:36:21 +0100 Subject: chore: Fix remaining necessary casts --- packages/sol-compiler/src/utils/encoder.ts | 5 +++-- packages/sol-doc/src/sol_doc.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts index 0f2d75691..6527304d6 100644 --- a/packages/sol-compiler/src/utils/encoder.ts +++ b/packages/sol-compiler/src/utils/encoder.ts @@ -1,4 +1,4 @@ -import { AbiDefinition, AbiType, ContractAbi, DataItem } from 'ethereum-types'; +import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem } from 'ethereum-types'; import * as _ from 'lodash'; import * as web3Abi from 'web3-eth-abi'; @@ -7,7 +7,8 @@ export const encoder = { const constructorTypes: string[] = []; _.each(abi, (element: AbiDefinition) => { if (element.type === AbiType.Constructor) { - _.each(element.inputs, (input: DataItem) => { + const constuctorAbi = element as ConstructorAbi; + _.each(constuctorAbi.inputs, (input: DataItem) => { constructorTypes.push(input.type); }); } diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts index 138882c92..35ba2c6e8 100644 --- a/packages/sol-doc/src/sol_doc.ts +++ b/packages/sol-doc/src/sol_doc.ts @@ -324,19 +324,21 @@ export class SolDoc { switch (abiDefinition.type) { case 'constructor': docSection.constructors.push( - this._genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc), + this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc), ); break; case 'event': - (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition)); + (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi)); // note that we're not sending devdoc to this._genEventDoc(). // that's because the type of the events array doesn't have any fields for documentation! break; case 'function': - docSection.methods.push(this._genMethodDoc(abiDefinition, compiledContract.devdoc)); + docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); break; case 'fallback': - docSection.methods.push(SolDoc._genFallbackDoc(abiDefinition, compiledContract.devdoc)); + docSection.methods.push( + SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc), + ); break; default: throw new Error( -- cgit v1.2.3 From bdae4ba2a2c9b7b3b41c352c628cb11cd4a1f295 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 18:23:06 +0100 Subject: chore: tslint fix --- packages/base-contract/src/index.ts | 2 +- packages/sol-compiler/src/utils/encoder.ts | 1 + packages/sol-doc/src/sol_doc.ts | 4 ++++ packages/utils/src/abi_decoder.ts | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 354362d45..73550ffd4 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -1,6 +1,5 @@ import { abiUtils, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { FunctionAbi } from 'ethereum-protocol'; import { AbiDefinition, AbiType, @@ -130,6 +129,7 @@ export class BaseContract { if (abiDefinition.type !== AbiType.Function) { return false; } + // tslint:disable-next-line:no-unnecessary-type-assertion const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi); if (abiFunctionSignature === functionSignature) { return true; diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts index 6527304d6..40b103fd5 100644 --- a/packages/sol-compiler/src/utils/encoder.ts +++ b/packages/sol-compiler/src/utils/encoder.ts @@ -7,6 +7,7 @@ export const encoder = { const constructorTypes: string[] = []; _.each(abi, (element: AbiDefinition) => { if (element.type === AbiType.Constructor) { + // tslint:disable-next-line:no-unnecessary-type-assertion const constuctorAbi = element as ConstructorAbi; _.each(constuctorAbi.inputs, (input: DataItem) => { constructorTypes.push(input.type); diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts index 35ba2c6e8..686e9ca34 100644 --- a/packages/sol-doc/src/sol_doc.ts +++ b/packages/sol-doc/src/sol_doc.ts @@ -324,18 +324,22 @@ export class SolDoc { switch (abiDefinition.type) { case 'constructor': docSection.constructors.push( + // tslint:disable-next-line:no-unnecessary-type-assertion this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc), ); break; case 'event': + // tslint:disable-next-line:no-unnecessary-type-assertion (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi)); // note that we're not sending devdoc to this._genEventDoc(). // that's because the type of the events array doesn't have any fields for documentation! break; case 'function': + // tslint:disable-next-line:no-unnecessary-type-assertion docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); break; case 'fallback': + // tslint:disable-next-line:no-unnecessary-type-assertion docSection.methods.push( SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc), ); diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 9cc863909..c0b2c7950 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -99,6 +99,7 @@ export class AbiDecoder { const ethersInterface = new ethers.utils.Interface(abiArray); _.map(abiArray, (abi: AbiDefinition) => { if (abi.type === AbiType.Event) { + // tslint:disable-next-line:no-unnecessary-type-assertion const eventAbi = abi as EventAbi; const topic = ethersInterface.events[eventAbi.name].topic; const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); -- cgit v1.2.3