From e671563f1e8b9eb4015bd2b3034bad951ef3eda4 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 30 Jul 2018 17:16:14 -0700 Subject: Update json-schemas for SRA v1 --- packages/json-schemas/CHANGELOG.json | 8 +++++ .../schemas/paginated_collection_schema.ts | 10 ++++++ .../relayer_api_asset_pairs_response_schema.ts | 38 ++++++++++++++++++++++ .../schemas/relayer_api_fees_payload_schema.ts | 24 -------------- .../schemas/relayer_api_fees_response_schema.ts | 10 ------ ...layer_api_orberbook_channel_subscribe_schema.ts | 23 ------------- .../relayer_api_order_config_payload_schema.ts | 24 ++++++++++++++ .../relayer_api_order_config_response_schema.ts | 11 +++++++ .../schemas/relayer_api_order_schema.ts | 9 +++++ ...elayer_api_orderbook_channel_snapshot_schema.ts | 21 ------------ ...api_orderbook_channel_update_response_schema.ts | 11 ------- .../relayer_api_orderbook_response_schema.ts | 4 +-- .../relayer_api_orders_channel_subscribe_schema.ts | 26 +++++++++++++++ ...er_api_orders_channel_update_response_schema.ts | 11 +++++++ .../schemas/relayer_api_orders_response_schema.ts | 13 ++++++++ .../schemas/relayer_api_orders_schema.ts | 5 +++ .../relayer_api_token_pairs_response_schema.ts | 24 -------------- yarn.lock | 6 ++-- 18 files changed, 160 insertions(+), 118 deletions(-) create mode 100644 packages/json-schemas/schemas/paginated_collection_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_fees_response_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts create 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.ts create mode 100644 packages/json-schemas/schemas/relayer_api_order_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts create 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.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_response_schema.ts create mode 100644 packages/json-schemas/schemas/relayer_api_orders_schema.ts delete mode 100644 packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index 31da6a7f7..d4557d872 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "2.0.0", + "changes": [ + { + "note": "Upgrade Relayer API schemas for relayer API V1" + } + ] + }, { "version": "1.0.1-rc.3", "changes": [ diff --git a/packages/json-schemas/schemas/paginated_collection_schema.ts b/packages/json-schemas/schemas/paginated_collection_schema.ts new file mode 100644 index 000000000..5dd82ab3d --- /dev/null +++ b/packages/json-schemas/schemas/paginated_collection_schema.ts @@ -0,0 +1,10 @@ +export const paginatedCollectionSchema = { + id: '/PaginatedCollection', + type: 'object', + properties: { + total: { $ref: '/Number' }, + per_page: { $ref: '/Number' }, + page: { $ref: '/Number' }, + }, + required: ['total', 'per_page', 'page'], +}; 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 new file mode 100644 index 000000000..74b919a8f --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts @@ -0,0 +1,38 @@ +export const relayerApiAssetDataPairsResponseSchema = { + id: '/RelayerApiAssetDataPairsResponse', + type: 'object', + allOf: [ + { $ref: '/PaginatedCollection' }, + { + properties: { + records: { $ref: '/RelayerApiAssetDataPairs' }, + }, + required: ['records'], + }, + ], +}; + +export const relayerApiAssetDataPairsSchema = { + id: '/RelayerApiAssetDataPairs', + type: 'array', + items: { + properties: { + assetDataA: { $ref: '/RelayerApiAssetDataTradeInfo' }, + assetDataB: { $ref: '/RelayerApiAssetDataTradeInfo' }, + }, + required: ['assetDataA', 'assetDataB'], + type: 'object', + }, +}; + +export const relayerApiAssetDataTradeInfoSchema = { + id: '/RelayerApiAssetDataTradeInfo', + type: 'object', + properties: { + assetData: { $ref: '/Hex' }, + minAmount: { $ref: '/Number' }, + maxAmount: { $ref: '/Number' }, + precision: { type: 'number' }, + }, + required: ['assetData'], +}; diff --git a/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts b/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts deleted file mode 100644 index eaaf777a1..000000000 --- a/packages/json-schemas/schemas/relayer_api_fees_payload_schema.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const relayerApiFeesPayloadSchema = { - id: '/RelayerApiFeesPayload', - type: 'object', - properties: { - exchangeContractAddress: { $ref: '/Address' }, - maker: { $ref: '/Address' }, - taker: { $ref: '/Address' }, - makerTokenAddress: { $ref: '/Address' }, - takerTokenAddress: { $ref: '/Address' }, - makerTokenAmount: { $ref: '/Number' }, - takerTokenAmount: { $ref: '/Number' }, - expirationUnixTimestampSec: { $ref: '/Number' }, - salt: { $ref: '/Number' }, - }, - required: [ - 'exchangeContractAddress', - 'maker', - 'taker', - 'makerTokenAddress', - 'takerTokenAddress', - 'expirationUnixTimestampSec', - 'salt', - ], -}; diff --git a/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts b/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts deleted file mode 100644 index e7440613f..000000000 --- a/packages/json-schemas/schemas/relayer_api_fees_response_schema.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const relayerApiFeesResponseSchema = { - id: '/RelayerApiFeesResponse', - type: 'object', - properties: { - makerFee: { $ref: '/Number' }, - takerFee: { $ref: '/Number' }, - feeRecipient: { $ref: '/Address' }, - }, - required: ['makerFee', 'takerFee', 'feeRecipient'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts b/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts deleted file mode 100644 index d93fa73d6..000000000 --- a/packages/json-schemas/schemas/relayer_api_orberbook_channel_subscribe_schema.ts +++ /dev/null @@ -1,23 +0,0 @@ -export const relayerApiOrderbookChannelSubscribeSchema = { - id: '/RelayerApiOrderbookChannelSubscribe', - type: 'object', - properties: { - type: { enum: ['subscribe'] }, - channel: { enum: ['orderbook'] }, - requestId: { type: 'number' }, - payload: { $ref: '/RelayerApiOrderbookChannelSubscribePayload' }, - }, - required: ['type', 'channel', 'requestId', 'payload'], -}; - -export const relayerApiOrderbookChannelSubscribePayload = { - id: '/RelayerApiOrderbookChannelSubscribePayload', - type: 'object', - properties: { - baseTokenAddress: { $ref: '/Address' }, - quoteTokenAddress: { $ref: '/Address' }, - snapshot: { type: 'boolean' }, - limit: { type: 'number' }, - }, - required: ['baseTokenAddress', 'quoteTokenAddress'], -}; 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 new file mode 100644 index 000000000..7b4a88e84 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts @@ -0,0 +1,24 @@ +export const relayerApiOrderConfigPayloadSchema = { + id: '/RelayerApiOrderConfigPayload', + type: 'object', + properties: { + makerAddress: { $ref: '/Address' }, + takerAddress: { $ref: '/Address' }, + makerAssetAmount: { $ref: '/Number' }, + takerAssetAmount: { $ref: '/Number' }, + makerAssetData: { $ref: '/Hex' }, + takerAssetData: { $ref: '/Hex' }, + exchangeAddress: { $ref: '/Address' }, + expirationTimeSeconds: { $ref: '/Number' }, + }, + required: [ + 'makerAddress', + 'takerAddress', + 'makerAssetAmount', + 'takerAssetAmount', + 'makerAssetData', + 'takerAssetData', + 'exchangeAddress', + 'expirationTimeSeconds', + ], +}; 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 new file mode 100644 index 000000000..d7960cd9d --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts @@ -0,0 +1,11 @@ +export const relayerApiOrderConfigResponseSchema = { + id: '/RelayerApiOrderConfigResponse', + type: 'object', + properties: { + makerFee: { $ref: '/Number' }, + takerFee: { $ref: '/Number' }, + feeRecipientAddress: { $ref: '/Address' }, + senderAddress: { $ref: '/Address' }, + }, + required: ['makerFee', 'takerFee', 'feeRecipientAddress', 'senderAddress'], +}; diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.ts b/packages/json-schemas/schemas/relayer_api_order_schema.ts new file mode 100644 index 000000000..4e138af12 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_order_schema.ts @@ -0,0 +1,9 @@ +export const relayerApiOrderSchema = { + id: '/RelayerApiOrder', + type: 'object', + properties: { + order: { $ref: '/Order' }, + remainingFillableAmount: { $ref: '/Number' }, + }, + required: ['order', 'remainingFillableAmount'], +}; diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts deleted file mode 100644 index fe1510d5b..000000000 --- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_snapshot_schema.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const relayerApiOrderbookChannelSnapshotSchema = { - id: '/RelayerApiOrderbookChannelSnapshot', - type: 'object', - properties: { - type: { enum: ['snapshot'] }, - channel: { enum: ['orderbook'] }, - requestId: { type: 'number' }, - payload: { $ref: '/RelayerApiOrderbookChannelSnapshotPayload' }, - }, - required: ['type', 'channel', 'requestId', 'payload'], -}; - -export const relayerApiOrderbookChannelSnapshotPayload = { - id: '/RelayerApiOrderbookChannelSnapshotPayload', - type: 'object', - properties: { - bids: { $ref: '/signedOrdersSchema' }, - asks: { $ref: '/signedOrdersSchema' }, - }, - required: ['bids', 'asks'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts deleted file mode 100644 index 9a6d83d4c..000000000 --- a/packages/json-schemas/schemas/relayer_api_orderbook_channel_update_response_schema.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const relayerApiOrderbookChannelUpdateSchema = { - id: '/RelayerApiOrderbookChannelUpdate', - type: 'object', - properties: { - type: { enum: ['update'] }, - channel: { enum: ['orderbook'] }, - requestId: { type: 'number' }, - payload: { $ref: '/SignedOrder' }, - }, - required: ['type', 'channel', 'requestId', 'payload'], -}; diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts index 5c409c807..f311908db 100644 --- a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts +++ b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts @@ -2,8 +2,8 @@ export const relayerApiOrderBookResponseSchema = { id: '/RelayerApiOrderBookResponse', type: 'object', properties: { - bids: { $ref: '/signedOrdersSchema' }, - asks: { $ref: '/signedOrdersSchema' }, + bids: { $ref: '/RelayerApiOrdersResponse' }, + asks: { $ref: '/RelayerApiOrdersResponse' }, }, required: ['bids', 'asks'], }; 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 new file mode 100644 index 000000000..1fe612949 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts @@ -0,0 +1,26 @@ +export const relayerApiOrdersChannelSubscribeSchema = { + id: '/RelayerApiOrdersChannelSubscribe', + 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: '/Address' }, + takerAssetProxyId: { $ref: '/Address' }, + networkId: { type: 'number' }, + makerAssetAddress: { $ref: '/Address' }, + takerAssetAddress: { $ref: '/Address' }, + makerAssetData: { $ref: '/Hex' }, + takerAssetData: { $ref: '/Hex' }, + traderAssetData: { $ref: '/Hex' }, + }, +}; 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 new file mode 100644 index 000000000..38306391b --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts @@ -0,0 +1,11 @@ +export const relayerApiOrdersChannelUpdateSchema = { + id: '/RelayerApiOrdersChannelUpdate', + type: 'object', + properties: { + type: { enum: ['update'] }, + channel: { enum: ['orders'] }, + requestId: { type: 'string' }, + payload: { $ref: '/RelayerApiOrders' }, + }, + required: ['type', 'channel', 'requestId', 'payload'], +}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts new file mode 100644 index 000000000..4bef260c1 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts @@ -0,0 +1,13 @@ +export const relayerApiOrdersResponseSchema = { + id: '/RelayerApiOrdersResponse', + type: 'object', + allOf: [ + { $ref: '/PaginatedCollection' }, + { + properties: { + records: { $ref: '/RelayerApiOrders' }, + }, + required: ['records'], + }, + ], +}; diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_schema.ts new file mode 100644 index 000000000..da739a300 --- /dev/null +++ b/packages/json-schemas/schemas/relayer_api_orders_schema.ts @@ -0,0 +1,5 @@ +export const relayerApiOrdersSchema = { + id: '/RelayerApiOrders', + type: 'array', + items: { $ref: '/RelayerApiOrder' }, +}; diff --git a/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts b/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts deleted file mode 100644 index 5009c7955..000000000 --- a/packages/json-schemas/schemas/relayer_api_token_pairs_response_schema.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const relayerApiTokenPairsResponseSchema = { - id: '/RelayerApiTokenPairsResponse', - type: 'array', - items: { - properties: { - tokenA: { $ref: '/RelayerApiTokenTradeInfo' }, - tokenB: { $ref: '/RelayerApiTokenTradeInfo' }, - }, - required: ['tokenA', 'tokenB'], - type: 'object', - }, -}; - -export const relayerApiTokenTradeInfoSchema = { - id: '/RelayerApiTokenTradeInfo', - type: 'object', - properties: { - address: { $ref: '/Address' }, - minAmount: { $ref: '/Number' }, - maxAmount: { $ref: '/Number' }, - precision: { type: 'number' }, - }, - required: ['address'], -}; diff --git a/yarn.lock b/yarn.lock index 011520c1a..f14250931 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5216,9 +5216,9 @@ ethereumjs-wallet@~0.6.0: utf8 "^2.1.1" uuid "^2.0.1" -ethers@3.0.22: - version "3.0.22" - resolved "https://registry.npmjs.org/ethers/-/ethers-3.0.22.tgz#7fab1ea16521705837aa43c15831877b2716b436" +ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: + version "3.0.18" + resolved "https://codeload.github.com/0xproject/ethers.js/tar.gz/b91342bd200d142af0165d6befddf783c8ae8447" dependencies: aes-js "3.0.0" bn.js "^4.4.0" -- cgit