aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-24 01:52:09 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-24 01:52:09 +0800
commit7ad1a18a4aaa3da23fc013c55babea286a505f9d (patch)
treeae0e8267091b45dcdf661ec8cd76ce7699a82364
parent572ad4615a3a0fa5649549cbd65eb912ea7a0e92 (diff)
parentb013cf2e145825a9e250c61bc77825384b2af69e (diff)
downloaddexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar.gz
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar.bz2
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar.lz
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar.xz
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.tar.zst
dexon-sol-tools-7ad1a18a4aaa3da23fc013c55babea286a505f9d.zip
Merge branch 'development' into feature/forwarder-helper/init
* development: (31 commits) Update CI config to check development instead of v2-prototype branch fix: Make non-interactive npm login for publish tests more robust Run prettier Remove comment in updates json-schemas doc Add documentation for json-schemas Fix typo Remove artifacts Update variable names, make release candidate Update more names in docs Improve documentation Pin sra-report to 0xproject/connect v1.0.4 Run prettier lint everything Update websocket for SRA v2 Remove default query parameters Add networkId request param option Rename websocket files and types Use uuid as string for requestId Update changelogs Add fee recipients test ...
-rw-r--r--.circleci/config.yml2
-rw-r--r--package.json3
-rw-r--r--packages/connect/CHANGELOG.json9
-rw-r--r--packages/connect/package.json8
-rw-r--r--packages/connect/src/http_client.ts126
-rw-r--r--packages/connect/src/index.ts18
-rw-r--r--packages/connect/src/orderbook_channel_factory.ts32
-rw-r--r--packages/connect/src/orders_channel_factory.ts29
-rw-r--r--packages/connect/src/schemas/asset_pairs_request_opts_schema.ts8
-rw-r--r--packages/connect/src/schemas/fees_request_schema.ts26
-rw-r--r--packages/connect/src/schemas/order_config_request_schema.ts24
-rw-r--r--packages/connect/src/schemas/orderbook_request_schema.ts6
-rw-r--r--packages/connect/src/schemas/orders_request_opts_schema.ts23
-rw-r--r--packages/connect/src/schemas/request_opts_schema.ts7
-rw-r--r--packages/connect/src/schemas/schemas.ts10
-rw-r--r--packages/connect/src/schemas/token_pairs_request_opts_schema.ts8
-rw-r--r--packages/connect/src/types.ts168
-rw-r--r--packages/connect/src/utils/assert.ts7
-rw-r--r--packages/connect/src/utils/orderbook_channel_message_parser.ts43
-rw-r--r--packages/connect/src/utils/orders_channel_message_parser.ts37
-rw-r--r--packages/connect/src/utils/relayer_response_json_parsers.ts50
-rw-r--r--packages/connect/src/utils/type_converters.ts30
-rw-r--r--packages/connect/src/ws_orders_channel.ts (renamed from packages/connect/src/ws_orderbook_channel.ts)56
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/asset_pairs.json21
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts25
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json10
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts12
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/fees.json5
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/fees.ts9
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json34
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts32
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order_config.json6
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/order_config.ts10
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orderbook.json90
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orderbook.ts94
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orders.json45
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/orders.ts47
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts17
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/token_pairs.json16
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts20
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/unknown_orders_channel_message.ts (renamed from packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts)6
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts17
-rw-r--r--packages/connect/test/fixtures/standard_relayer_api/update_orders_channel_message.ts17
-rw-r--r--packages/connect/test/http_client_test.ts146
-rw-r--r--packages/connect/test/orderbook_channel_factory_test.ts45
-rw-r--r--packages/connect/test/orderbook_channel_message_parsers_test.ts76
-rw-r--r--packages/connect/test/orders_channel_factory_test.ts34
-rw-r--r--packages/connect/test/orders_channel_message_parsers_test.ts59
-rw-r--r--packages/connect/test/ws_orderbook_channel_test.ts59
-rw-r--r--packages/connect/test/ws_orders_channel_test.ts49
-rw-r--r--packages/json-schemas/CHANGELOG.json9
-rw-r--r--packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts6
-rw-r--r--packages/sra-api/CHANGELOG.json9
-rw-r--r--packages/sra-api/public/api.json2
-rw-r--r--packages/sra-api/src/api.ts9
-rw-r--r--packages/sra-api/src/examples/relayerApiOrderConfig0
-rw-r--r--packages/sra-report/package.json2
-rw-r--r--packages/website/md/docs/json_schemas/2.0.0/schemas.md28
-rw-r--r--packages/website/ts/containers/json_schemas_documentation.ts7
-rw-r--r--yarn.lock183
60 files changed, 1160 insertions, 826 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index a6fb511b9..bb2fa0239 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -26,7 +26,7 @@ jobs:
paths:
- node_modules/
- run: >
- if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then
+ if [ -z "$(git diff --name-only development packages/website)" ]; then
yarn build --exclude website
else
yarn build
diff --git a/package.json b/package.json
index fa93108c2..15961229e 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js",
"test:publish:circleci:comment": "HACK(albrow) We need an automated way to login to npm and echo+sleep piped to stdin was the only way I could find to do it.",
- "test:publish:circleci": "{ echo \"test\"; sleep 2; echo \"test\"; sleep 2; echo \"test@example.com\"; } | npm login --registry=http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
+ "test:publish:circleci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
"script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js",
@@ -45,6 +45,7 @@
"coveralls": "^3.0.0",
"ganache-cli": "6.1.3",
"lcov-result-merger": "^3.0.0",
+ "npm-cli-login": "^0.0.10",
"npm-run-all": "^4.1.2",
"prettier": "^1.11.1",
"source-map-support": "^0.5.6",
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 8d6feaa2e..d7e026b4f 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.0.0-rc.1",
+ "changes": [
+ {
+ "note": "Updated for SRA v2",
+ "pr": 974
+ }
+ ]
+ },
+ {
"timestamp": 1534210131,
"version": "1.0.5",
"changes": [
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 8f2e423b5..ee08104cf 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -51,14 +51,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
- "@0xproject/assert": "^0.2.14",
- "@0xproject/json-schemas": "^0.8.3",
- "@0xproject/types": "^0.8.2",
+ "@0xproject/assert": "^1.0.5",
+ "@0xproject/json-schemas": "^1.0.1-rc.4",
+ "@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
"@0xproject/utils": "^1.0.5",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",
+ "uuid": "^3.3.2",
"websocket": "^1.0.25"
},
"devDependencies": {
@@ -69,6 +70,7 @@
"@types/mocha": "^2.2.42",
"@types/query-string": "^5.0.1",
"@types/sinon": "^2.2.2",
+ "@types/uuid": "^3.4.3",
"@types/websocket": "^0.0.39",
"async-child-process": "^1.1.1",
"chai": "^4.0.1",
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 03cc590e4..b90c2c35f 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -7,31 +7,25 @@ import * as queryString from 'query-string';
import { schemas as clientSchemas } from './schemas/schemas';
import {
+ APIOrder,
+ AssetPairsRequestOpts,
+ AssetPairsResponse,
Client,
- FeesRequest,
- FeesResponse,
+ FeeRecipientsResponse,
HttpRequestOptions,
HttpRequestType,
OrderbookRequest,
OrderbookResponse,
+ OrderConfigRequest,
+ OrderConfigResponse,
OrdersRequestOpts,
+ OrdersResponse,
PagedRequestOpts,
- TokenPairsItem,
- TokenPairsRequestOpts,
+ RequestOpts,
} from './types';
import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers';
const TRAILING_SLASHES_REGEX = /\/+$/;
-const DEFAULT_PAGED_REQUEST_OPTS: PagedRequestOpts = {
- page: 1,
- perPage: 100,
-};
-/**
- * This mapping defines how an option property name gets converted into an HTTP request query field
- */
-const OPTS_TO_QUERY_FIELD_MAP = {
- perPage: 'per_page',
-};
/**
* This class includes all the functionality related to interacting with a set of HTTP endpoints
@@ -47,12 +41,8 @@ export class HttpClient implements Client {
if (_.isUndefined(params) || _.isEmpty(params)) {
return '';
}
- // format params into a form the api expects
- const formattedParams = _.mapKeys(params, (_value: any, key: string) => {
- return _.get(OPTS_TO_QUERY_FIELD_MAP, key, key);
- });
// stringify the formatted object
- const stringifiedParams = queryString.stringify(formattedParams);
+ const stringifiedParams = queryString.stringify(params);
return `?${stringifiedParams}`;
}
/**
@@ -65,34 +55,40 @@ export class HttpClient implements Client {
this._apiEndpointUrl = url.replace(TRAILING_SLASHES_REGEX, ''); // remove trailing slashes
}
/**
- * Retrieve token pair info from the API
- * @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 1, perPage: 100 }
- * @return The resulting TokenPairsItems that match the request
+ * Retrieve assetData pair info from the API
+ * @param requestOpts Options specifying assetData information to retrieve, page information, and network id.
+ * @return The resulting AssetPairsResponse that match the request
*/
- public async getTokenPairsAsync(requestOpts?: TokenPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> {
+ public async getAssetPairsAsync(
+ requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts,
+ ): Promise<AssetPairsResponse> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.tokenPairsRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.assetPairsRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
}
const httpRequestOpts = {
- params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
+ params: requestOpts,
};
- const responseJson = await this._requestAsync('/token_pairs', HttpRequestType.Get, httpRequestOpts);
- const tokenPairs = relayerResponseJsonParsers.parseTokenPairsJson(responseJson);
- return tokenPairs;
+ const responseJson = await this._requestAsync('/asset_pairs', HttpRequestType.Get, httpRequestOpts);
+ const assetDataPairs = relayerResponseJsonParsers.parseAssetDataPairsJson(responseJson);
+ return assetDataPairs;
}
/**
* Retrieve orders from the API
- * @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 1, perPage: 100 }
- * @return The resulting SignedOrders that match the request
+ * @param requestOpts Options specifying orders to retrieve and page information, page information, and network id.
+ * @return The resulting OrdersResponse that match the request
*/
- public async getOrdersAsync(requestOpts?: OrdersRequestOpts & PagedRequestOpts): Promise<SignedOrder[]> {
+ public async getOrdersAsync(
+ requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts,
+ ): Promise<OrdersResponse> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
}
const httpRequestOpts = {
- params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
+ params: requestOpts,
};
const responseJson = await this._requestAsync(`/orders`, HttpRequestType.Get, httpRequestOpts);
const orders = relayerResponseJsonParsers.parseOrdersJson(responseJson);
@@ -101,30 +97,37 @@ export class HttpClient implements Client {
/**
* Retrieve a specific order from the API
* @param orderHash An orderHash generated from the desired order
- * @return The SignedOrder that matches the supplied orderHash
+ * @return The APIOrder that matches the supplied orderHash
*/
- public async getOrderAsync(orderHash: string): Promise<SignedOrder> {
+ public async getOrderAsync(orderHash: string, requestOpts?: RequestOpts): Promise<APIOrder> {
+ if (!_.isUndefined(requestOpts)) {
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ }
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
- const responseJson = await this._requestAsync(`/order/${orderHash}`, HttpRequestType.Get);
- const order = relayerResponseJsonParsers.parseOrderJson(responseJson);
+ const httpRequestOpts = {
+ params: requestOpts,
+ };
+ const responseJson = await this._requestAsync(`/order/${orderHash}`, HttpRequestType.Get, httpRequestOpts);
+ const order = relayerResponseJsonParsers.parseAPIOrderJson(responseJson);
return order;
}
/**
* Retrieve an orderbook from the API
* @param request An OrderbookRequest instance describing the specific orderbook to retrieve
- * @param requestOpts Options specifying page information, defaults to { page: 1, perPage: 100 }
+ * @param requestOpts Options specifying page information, and network id.
* @return The resulting OrderbookResponse that matches the request
*/
public async getOrderbookAsync(
request: OrderbookRequest,
- requestOpts?: PagedRequestOpts,
+ requestOpts?: RequestOpts & PagedRequestOpts,
): Promise<OrderbookResponse> {
assert.doesConformToSchema('request', request, clientSchemas.orderBookRequestSchema);
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
}
const httpRequestOpts = {
- params: _.defaults({}, request, requestOpts, DEFAULT_PAGED_REQUEST_OPTS),
+ params: _.defaults({}, request, requestOpts),
};
const responseJson = await this._requestAsync('/orderbook', HttpRequestType.Get, httpRequestOpts);
const orderbook = relayerResponseJsonParsers.parseOrderbookResponseJson(responseJson);
@@ -132,28 +135,55 @@ export class HttpClient implements Client {
}
/**
* Retrieve fee information from the API
- * @param request A FeesRequest instance describing the specific fees to retrieve
- * @return The resulting FeesResponse that matches the request
+ * @param request A OrderConfigRequest instance describing the specific fees to retrieve
+ * @param requestOpts Options specifying network id.
+ * @return The resulting OrderConfigResponse that matches the request
*/
- public async getFeesAsync(request: FeesRequest): Promise<FeesResponse> {
- assert.doesConformToSchema('request', request, clientSchemas.feesRequestSchema);
+ public async getOrderConfigAsync(
+ request: OrderConfigRequest,
+ requestOpts?: RequestOpts,
+ ): Promise<OrderConfigResponse> {
+ if (!_.isUndefined(requestOpts)) {
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ }
+ assert.doesConformToSchema('request', request, clientSchemas.orderConfigRequestSchema);
const httpRequestOpts = {
+ params: requestOpts,
payload: request,
};
- const responseJson = await this._requestAsync('/fees', HttpRequestType.Post, httpRequestOpts);
- const fees = relayerResponseJsonParsers.parseFeesResponseJson(responseJson);
+ const responseJson = await this._requestAsync('/order_config', HttpRequestType.Post, httpRequestOpts);
+ const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson);
return fees;
}
/**
+ * Retrieve the list of fee recipient addresses used by the relayer.
+ * @param requestOpts Options specifying page information, and network id.
+ * @return The resulting FeeRecipientsResponse
+ */
+ public async getFeeRecipientsAsync(requestOpts?: RequestOpts & PagedRequestOpts): Promise<FeeRecipientsResponse> {
+ if (!_.isUndefined(requestOpts)) {
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ }
+ const httpRequestOpts = {
+ params: requestOpts,
+ };
+ const feeRecipients = await this._requestAsync('/fee_recipients', HttpRequestType.Get, httpRequestOpts);
+ assert.doesConformToSchema('feeRecipients', feeRecipients, schemas.relayerApiFeeRecipientsResponseSchema);
+ return feeRecipients;
+ }
+ /**
* Submit a signed order to the API
* @param signedOrder A SignedOrder instance to submit
+ * @param requestOpts Options specifying network id.
*/
- public async submitOrderAsync(signedOrder: SignedOrder): Promise<void> {
+ public async submitOrderAsync(signedOrder: SignedOrder, requestOpts?: RequestOpts): Promise<void> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
- const requestOpts = {
+ const httpRequestOpts = {
+ params: requestOpts,
payload: signedOrder,
};
- await this._requestAsync('/order', HttpRequestType.Post, requestOpts);
+ await this._requestAsync('/order', HttpRequestType.Post, httpRequestOpts);
}
private async _requestAsync(
path: string,
diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts
index 7f5eb8ed3..33e1222b0 100644
--- a/packages/connect/src/index.ts
+++ b/packages/connect/src/index.ts
@@ -1,19 +1,19 @@
export { HttpClient } from './http_client';
-export { orderbookChannelFactory } from './orderbook_channel_factory';
+export { ordersChannelFactory } from './orders_channel_factory';
export {
Client,
- FeesRequest,
- FeesResponse,
- OrderbookChannel,
- OrderbookChannelHandler,
- OrderbookChannelSubscriptionOpts,
+ OrderConfigRequest,
+ OrderConfigResponse,
+ OrdersChannel,
+ OrdersChannelHandler,
+ OrdersChannelSubscriptionOpts,
OrderbookRequest,
OrderbookResponse,
OrdersRequestOpts,
PagedRequestOpts,
- TokenPairsItem,
- TokenPairsRequestOpts,
- TokenTradeInfo,
+ AssetPairsItem,
+ AssetPairsRequestOpts,
+ Asset,
} from './types';
export { Order, SignedOrder } from '@0xproject/types';
diff --git a/packages/connect/src/orderbook_channel_factory.ts b/packages/connect/src/orderbook_channel_factory.ts
deleted file mode 100644
index 5134af323..000000000
--- a/packages/connect/src/orderbook_channel_factory.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import * as WebSocket from 'websocket';
-
-import { OrderbookChannel, OrderbookChannelHandler } from './types';
-import { assert } from './utils/assert';
-import { WebSocketOrderbookChannel } from './ws_orderbook_channel';
-
-export const orderbookChannelFactory = {
- /**
- * Instantiates a new WebSocketOrderbookChannel instance
- * @param url The relayer API base WS url you would like to interact with
- * @param handler An OrderbookChannelHandler instance that responds to various
- * channel updates
- * @return An OrderbookChannel Promise
- */
- async createWebSocketOrderbookChannelAsync(
- url: string,
- handler: OrderbookChannelHandler,
- ): Promise<OrderbookChannel> {
- assert.isUri('url', url);
- assert.isOrderbookChannelHandler('handler', handler);
- return new Promise<OrderbookChannel>((resolve, reject) => {
- const client = new WebSocket.w3cwebsocket(url);
- client.onopen = () => {
- const orderbookChannel = new WebSocketOrderbookChannel(client, handler);
- resolve(orderbookChannel);
- };
- client.onerror = err => {
- reject(err);
- };
- });
- },
-};
diff --git a/packages/connect/src/orders_channel_factory.ts b/packages/connect/src/orders_channel_factory.ts
new file mode 100644
index 000000000..5986d2a77
--- /dev/null
+++ b/packages/connect/src/orders_channel_factory.ts
@@ -0,0 +1,29 @@
+import * as WebSocket from 'websocket';
+
+import { OrdersChannel, OrdersChannelHandler } from './types';
+import { assert } from './utils/assert';
+import { WebSocketOrdersChannel } from './ws_orders_channel';
+
+export const ordersChannelFactory = {
+ /**
+ * Instantiates a new WebSocketOrdersChannel instance
+ * @param url The relayer API base WS url you would like to interact with
+ * @param handler An OrdersChannelHandler instance that responds to various
+ * channel updates
+ * @return An OrdersChannel Promise
+ */
+ async createWebSocketOrdersChannelAsync(url: string, handler: OrdersChannelHandler): Promise<OrdersChannel> {
+ assert.isUri('url', url);
+ assert.isOrdersChannelHandler('handler', handler);
+ return new Promise<OrdersChannel>((resolve, reject) => {
+ const client = new WebSocket.w3cwebsocket(url);
+ client.onopen = () => {
+ const ordersChannel = new WebSocketOrdersChannel(client, handler);
+ resolve(ordersChannel);
+ };
+ client.onerror = err => {
+ reject(err);
+ };
+ });
+ },
+};
diff --git a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts
new file mode 100644
index 000000000..a9e3942a4
--- /dev/null
+++ b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts
@@ -0,0 +1,8 @@
+export const assetPairsRequestOptsSchema = {
+ id: '/AssetPairsRequestOpts',
+ type: 'object',
+ properties: {
+ assetDataA: { $ref: '/hexSchema' },
+ assetDataB: { $ref: '/hexSchema' },
+ },
+};
diff --git a/packages/connect/src/schemas/fees_request_schema.ts b/packages/connect/src/schemas/fees_request_schema.ts
deleted file mode 100644
index ff3d7b9d3..000000000
--- a/packages/connect/src/schemas/fees_request_schema.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-export const feesRequestSchema = {
- id: '/FeesRequest',
- 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',
- 'makerTokenAmount',
- 'takerTokenAmount',
- 'expirationUnixTimestampSec',
- 'salt',
- ],
-};
diff --git a/packages/connect/src/schemas/order_config_request_schema.ts b/packages/connect/src/schemas/order_config_request_schema.ts
new file mode 100644
index 000000000..0eda430e8
--- /dev/null
+++ b/packages/connect/src/schemas/order_config_request_schema.ts
@@ -0,0 +1,24 @@
+export const orderConfigRequestSchema = {
+ id: '/OrderConfigRequest',
+ 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/connect/src/schemas/orderbook_request_schema.ts b/packages/connect/src/schemas/orderbook_request_schema.ts
index 5f3463242..0c9389d50 100644
--- a/packages/connect/src/schemas/orderbook_request_schema.ts
+++ b/packages/connect/src/schemas/orderbook_request_schema.ts
@@ -2,8 +2,8 @@ export const orderBookRequestSchema = {
id: '/OrderBookRequest',
type: 'object',
properties: {
- baseTokenAddress: { $ref: '/Address' },
- quoteTokenAddress: { $ref: '/Address' },
+ baseAssetData: { $ref: '/hexSchema' },
+ quoteAssetData: { $ref: '/hexSchema' },
},
- required: ['baseTokenAddress', 'quoteTokenAddress'],
+ required: ['baseAssetData', 'quoteAssetData'],
};
diff --git a/packages/connect/src/schemas/orders_request_opts_schema.ts b/packages/connect/src/schemas/orders_request_opts_schema.ts
index 5facbc959..71ce3d06f 100644
--- a/packages/connect/src/schemas/orders_request_opts_schema.ts
+++ b/packages/connect/src/schemas/orders_request_opts_schema.ts
@@ -2,15 +2,18 @@ export const ordersRequestOptsSchema = {
id: '/OrdersRequestOpts',
type: 'object',
properties: {
- exchangeContractAddress: { $ref: '/Address' },
- tokenAddress: { $ref: '/Address' },
- makerTokenAddress: { $ref: '/Address' },
- takerTokenAddress: { $ref: '/Address' },
- tokenA: { $ref: '/Address' },
- tokenB: { $ref: '/Address' },
- maker: { $ref: '/Address' },
- taker: { $ref: '/Address' },
- trader: { $ref: '/Address' },
- feeRecipient: { $ref: '/Address' },
+ makerAssetProxyId: { $ref: '/hexSchema' },
+ takerAssetProxyId: { $ref: '/hexSchema' },
+ makerAssetAddress: { $ref: '/addressSchema' },
+ takerAssetAddress: { $ref: '/addressSchema' },
+ exchangeAddress: { $ref: '/addressSchema' },
+ senderAddress: { $ref: '/addressSchema' },
+ makerAssetData: { $ref: '/hexSchema' },
+ takerAssetData: { $ref: '/hexSchema' },
+ traderAssetData: { $ref: '/hexSchema' },
+ makerAddress: { $ref: '/addressSchema' },
+ takerAddress: { $ref: '/addressSchema' },
+ traderAddress: { $ref: '/addressSchema' },
+ feeRecipientAddress: { $ref: '/addressSchema' },
},
};
diff --git a/packages/connect/src/schemas/request_opts_schema.ts b/packages/connect/src/schemas/request_opts_schema.ts
new file mode 100644
index 000000000..a51e98069
--- /dev/null
+++ b/packages/connect/src/schemas/request_opts_schema.ts
@@ -0,0 +1,7 @@
+export const requestOptsSchema = {
+ id: '/RequestOpts',
+ type: 'object',
+ properties: {
+ networkId: { type: 'number' },
+ },
+};
diff --git a/packages/connect/src/schemas/schemas.ts b/packages/connect/src/schemas/schemas.ts
index 0b8b798a9..8d101ed6f 100644
--- a/packages/connect/src/schemas/schemas.ts
+++ b/packages/connect/src/schemas/schemas.ts
@@ -1,13 +1,15 @@
-import { feesRequestSchema } from './fees_request_schema';
+import { assetPairsRequestOptsSchema } from './asset_pairs_request_opts_schema';
+import { orderConfigRequestSchema } from './order_config_request_schema';
import { orderBookRequestSchema } from './orderbook_request_schema';
import { ordersRequestOptsSchema } from './orders_request_opts_schema';
import { pagedRequestOptsSchema } from './paged_request_opts_schema';
-import { tokenPairsRequestOptsSchema } from './token_pairs_request_opts_schema';
+import { requestOptsSchema } from './request_opts_schema';
export const schemas = {
- feesRequestSchema,
+ orderConfigRequestSchema,
orderBookRequestSchema,
ordersRequestOptsSchema,
pagedRequestOptsSchema,
- tokenPairsRequestOptsSchema,
+ requestOptsSchema,
+ assetPairsRequestOptsSchema,
};
diff --git a/packages/connect/src/schemas/token_pairs_request_opts_schema.ts b/packages/connect/src/schemas/token_pairs_request_opts_schema.ts
deleted file mode 100644
index 9b73a917b..000000000
--- a/packages/connect/src/schemas/token_pairs_request_opts_schema.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const tokenPairsRequestOptsSchema = {
- id: '/TokenPairsRequestOpts',
- type: 'object',
- properties: {
- tokenA: { $ref: '/Address' },
- tokenB: { $ref: '/Address' },
- },
-};
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index fc7a4b24d..06ae732a5 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -2,73 +2,55 @@ import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export interface Client {
- getTokenPairsAsync: (requestOpts?: TokenPairsRequestOpts & PagedRequestOpts) => Promise<TokenPairsItem[]>;
- getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<SignedOrder[]>;
- getOrderAsync: (orderHash: string) => Promise<SignedOrder>;
+ getAssetPairsAsync: (
+ requestOpts?: AssetPairsRequestOpts & PagedRequestOpts,
+ ) => Promise<PaginatedCollection<AssetPairsItem>>;
+ getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<PaginatedCollection<APIOrder>>;
+ getOrderAsync: (orderHash: string) => Promise<APIOrder>;
getOrderbookAsync: (request: OrderbookRequest, requestOpts?: PagedRequestOpts) => Promise<OrderbookResponse>;
- getFeesAsync: (request: FeesRequest) => Promise<FeesResponse>;
+ getOrderConfigAsync: (request: OrderConfigRequest) => Promise<OrderConfigResponse>;
+ getFeeRecipientsAsync: (requestOpts?: PagedRequestOpts) => Promise<FeeRecipientsResponse>;
submitOrderAsync: (signedOrder: SignedOrder) => Promise<void>;
}
-export interface OrderbookChannel {
- subscribe: (subscriptionOpts: OrderbookChannelSubscriptionOpts) => void;
+export interface OrdersChannel {
+ subscribe: (subscriptionOpts: OrdersChannelSubscriptionOpts) => void;
close: () => void;
}
/**
- * baseTokenAddress: The address of token designated as the baseToken in the currency pair calculation of price
- * quoteTokenAddress: The address of token designated as the quoteToken in the currency pair calculation of price
- * snapshot: If true, a snapshot of the orderbook will be sent before the updates to the orderbook
+ * baseAssetData: The address of assetData designated as the baseToken in the currency pair calculation of price
+ * quoteAssetData: The address of assetData designated as the quoteToken in the currency pair calculation of price
* limit: Maximum number of bids and asks in orderbook snapshot
*/
-export interface OrderbookChannelSubscriptionOpts {
- baseTokenAddress: string;
- quoteTokenAddress: string;
- snapshot: boolean;
+export interface OrdersChannelSubscriptionOpts {
+ baseAssetData: string;
+ quoteAssetData: string;
limit: number;
}
-export interface OrderbookChannelHandler {
- onSnapshot: (
- channel: OrderbookChannel,
- subscriptionOpts: OrderbookChannelSubscriptionOpts,
- snapshot: OrderbookResponse,
- ) => void;
- onUpdate: (
- channel: OrderbookChannel,
- subscriptionOpts: OrderbookChannelSubscriptionOpts,
- order: SignedOrder,
- ) => void;
- onError: (channel: OrderbookChannel, err: Error, subscriptionOpts?: OrderbookChannelSubscriptionOpts) => void;
- onClose: (channel: OrderbookChannel) => void;
-}
-
-export type OrderbookChannelMessage =
- | SnapshotOrderbookChannelMessage
- | UpdateOrderbookChannelMessage
- | UnknownOrderbookChannelMessage;
-
-export enum OrderbookChannelMessageTypes {
- Snapshot = 'snapshot',
- Update = 'update',
- Unknown = 'unknown',
+export interface OrdersChannelHandler {
+ onUpdate: (channel: OrdersChannel, subscriptionOpts: OrdersChannelSubscriptionOpts, orders: APIOrder[]) => void;
+ onError: (channel: OrdersChannel, err: Error, subscriptionOpts?: OrdersChannelSubscriptionOpts) => void;
+ onClose: (channel: OrdersChannel) => void;
}
-export interface SnapshotOrderbookChannelMessage {
- type: OrderbookChannelMessageTypes.Snapshot;
- requestId: number;
- payload: OrderbookResponse;
+export type OrdersChannelMessage = UpdateOrdersChannelMessage | UnknownOrdersChannelMessage;
+
+export enum OrdersChannelMessageTypes {
+ Update = 'update',
+ Unknown = 'unknown',
}
-export interface UpdateOrderbookChannelMessage {
- type: OrderbookChannelMessageTypes.Update;
- requestId: number;
- payload: SignedOrder;
+export interface UpdateOrdersChannelMessage {
+ type: OrdersChannelMessageTypes.Update;
+ requestId: string;
+ payload: APIOrder[];
}
-export interface UnknownOrderbookChannelMessage {
- type: OrderbookChannelMessageTypes.Unknown;
- requestId: number;
+export interface UnknownOrdersChannelMessage {
+ type: OrdersChannelMessageTypes.Unknown;
+ requestId: string;
payload: undefined;
}
@@ -83,60 +65,86 @@ export enum WebsocketClientEventType {
ConnectFailed = 'connectFailed',
}
-export interface TokenPairsRequestOpts {
- tokenA?: string;
- tokenB?: string;
+export type OrdersResponse = PaginatedCollection<APIOrder>;
+
+export interface APIOrder {
+ order: SignedOrder;
+ metaData: object;
+}
+
+export interface AssetPairsRequestOpts {
+ assetDataA?: string;
+ assetDataB?: string;
}
-export interface TokenPairsItem {
- tokenA: TokenTradeInfo;
- tokenB: TokenTradeInfo;
+export type AssetPairsResponse = PaginatedCollection<AssetPairsItem>;
+
+export interface AssetPairsItem {
+ assetDataA: Asset;
+ assetDataB: Asset;
}
-export interface TokenTradeInfo {
- address: string;
+export interface Asset {
+ assetData: string;
minAmount: BigNumber;
maxAmount: BigNumber;
precision: number;
}
export interface OrdersRequestOpts {
- exchangeContractAddress?: string;
- tokenAddress?: string;
- makerTokenAddress?: string;
- takerTokenAddress?: string;
- maker?: string;
- taker?: string;
- trader?: string;
- feeRecipient?: string;
+ makerAssetProxyId?: string;
+ takerAssetProxyId?: string;
+ makerAssetAddress?: string;
+ takerAssetAddress?: string;
+ exchangeAddress?: string;
+ senderAddress?: string;
+ makerAssetData?: string;
+ takerAssetData?: string;
+ makerAddress?: string;
+ takerAddress?: string;
+ traderAddress?: string;
+ feeRecipientAddress?: string;
}
export interface OrderbookRequest {
- baseTokenAddress: string;
- quoteTokenAddress: string;
+ baseAssetData: string;
+ quoteAssetData: string;
}
export interface OrderbookResponse {
- bids: SignedOrder[];
- asks: SignedOrder[];
+ bids: PaginatedCollection<APIOrder>;
+ asks: PaginatedCollection<APIOrder>;
+}
+
+export interface PaginatedCollection<T> {
+ total: number;
+ page: number;
+ perPage: number;
+ records: T[];
}
-export interface FeesRequest {
- exchangeContractAddress: string;
- maker: string;
- taker: string;
- makerTokenAddress: string;
- takerTokenAddress: string;
- makerTokenAmount: BigNumber;
- takerTokenAmount: BigNumber;
- expirationUnixTimestampSec: BigNumber;
- salt: BigNumber;
+export interface OrderConfigRequest {
+ makerAddress: string;
+ takerAddress: string;
+ makerAssetAmount: string;
+ takerAssetAmount: string;
+ makerAssetData: string;
+ takerAssetData: string;
+ exchangeAddress: string;
+ expirationTimeSeconds: string;
}
-export interface FeesResponse {
- feeRecipient: string;
+export interface OrderConfigResponse {
makerFee: BigNumber;
takerFee: BigNumber;
+ feeRecipientAddress: string;
+ senderAddress: string;
+}
+
+export type FeeRecipientsResponse = PaginatedCollection<string>;
+
+export interface RequestOpts {
+ networkId?: number;
}
export interface PagedRequestOpts {
diff --git a/packages/connect/src/utils/assert.ts b/packages/connect/src/utils/assert.ts
index a0fd12fbd..3d8f1c799 100644
--- a/packages/connect/src/utils/assert.ts
+++ b/packages/connect/src/utils/assert.ts
@@ -10,15 +10,14 @@ import * as _ from 'lodash';
export const assert = {
...sharedAssert,
- isOrderbookChannelSubscriptionOpts(variableName: string, subscriptionOpts: any): void {
+ isOrdersChannelSubscriptionOpts(variableName: string, subscriptionOpts: any): void {
sharedAssert.doesConformToSchema(
variableName,
subscriptionOpts,
- schemas.relayerApiOrderbookChannelSubscribePayload,
+ schemas.relayerApiOrdersChannelSubscribePayload,
);
},
- isOrderbookChannelHandler(variableName: string, handler: any): void {
- sharedAssert.isFunction(`${variableName}.onSnapshot`, _.get(handler, 'onSnapshot'));
+ isOrdersChannelHandler(variableName: string, handler: any): void {
sharedAssert.isFunction(`${variableName}.onUpdate`, _.get(handler, 'onUpdate'));
sharedAssert.isFunction(`${variableName}.onError`, _.get(handler, 'onError'));
sharedAssert.isFunction(`${variableName}.onClose`, _.get(handler, 'onClose'));
diff --git a/packages/connect/src/utils/orderbook_channel_message_parser.ts b/packages/connect/src/utils/orderbook_channel_message_parser.ts
deleted file mode 100644
index 593288078..000000000
--- a/packages/connect/src/utils/orderbook_channel_message_parser.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { assert } from '@0xproject/assert';
-import { schemas } from '@0xproject/json-schemas';
-import * as _ from 'lodash';
-
-import { OrderbookChannelMessage, OrderbookChannelMessageTypes } from '../types';
-
-import { relayerResponseJsonParsers } from './relayer_response_json_parsers';
-
-export const orderbookChannelMessageParser = {
- parse(utf8Data: string): OrderbookChannelMessage {
- // parse the message
- const messageObj = JSON.parse(utf8Data);
- // ensure we have a type parameter to switch on
- const type: string = _.get(messageObj, 'type');
- assert.assert(!_.isUndefined(type), `Message is missing a type parameter: ${utf8Data}`);
- assert.isString('type', type);
- // ensure we have a request id for the resulting message
- const requestId: number = _.get(messageObj, 'requestId');
- assert.assert(!_.isUndefined(requestId), `Message is missing a requestId parameter: ${utf8Data}`);
- assert.isNumber('requestId', requestId);
- switch (type) {
- case OrderbookChannelMessageTypes.Snapshot: {
- assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelSnapshotSchema);
- const orderbookJson = messageObj.payload;
- const orderbook = relayerResponseJsonParsers.parseOrderbookResponseJson(orderbookJson);
- return _.assign(messageObj, { payload: orderbook });
- }
- case OrderbookChannelMessageTypes.Update: {
- assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelUpdateSchema);
- const orderJson = messageObj.payload;
- const order = relayerResponseJsonParsers.parseOrderJson(orderJson);
- return _.assign(messageObj, { payload: order });
- }
- default: {
- return {
- type: OrderbookChannelMessageTypes.Unknown,
- requestId,
- payload: undefined,
- };
- }
- }
- },
-};
diff --git a/packages/connect/src/utils/orders_channel_message_parser.ts b/packages/connect/src/utils/orders_channel_message_parser.ts
new file mode 100644
index 000000000..1b6cda17b
--- /dev/null
+++ b/packages/connect/src/utils/orders_channel_message_parser.ts
@@ -0,0 +1,37 @@
+import { assert } from '@0xproject/assert';
+import { schemas } from '@0xproject/json-schemas';
+import * as _ from 'lodash';
+
+import { OrdersChannelMessage, OrdersChannelMessageTypes } from '../types';
+
+import { relayerResponseJsonParsers } from './relayer_response_json_parsers';
+
+export const ordersChannelMessageParser = {
+ parse(utf8Data: string): OrdersChannelMessage {
+ // parse the message
+ const messageObj = JSON.parse(utf8Data);
+ // ensure we have a type parameter to switch on
+ const type: string = _.get(messageObj, 'type');
+ assert.assert(!_.isUndefined(type), `Message is missing a type parameter: ${utf8Data}`);
+ assert.isString('type', type);
+ // ensure we have a request id for the resulting message
+ const requestId: string = _.get(messageObj, 'requestId');
+ assert.assert(!_.isUndefined(requestId), `Message is missing a requestId parameter: ${utf8Data}`);
+ assert.isString('requestId', requestId);
+ switch (type) {
+ case OrdersChannelMessageTypes.Update: {
+ assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrdersChannelUpdateSchema);
+ const ordersJson = messageObj.payload;
+ const orders = relayerResponseJsonParsers.parseAPIOrdersJson(ordersJson);
+ return _.assign(messageObj, { payload: orders });
+ }
+ default: {
+ return {
+ type: OrdersChannelMessageTypes.Unknown,
+ requestId,
+ payload: undefined,
+ };
+ }
+ }
+ },
+};
diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts
index ccae8b115..ebd877b70 100644
--- a/packages/connect/src/utils/relayer_response_json_parsers.ts
+++ b/packages/connect/src/utils/relayer_response_json_parsers.ts
@@ -1,37 +1,49 @@
import { assert } from '@0xproject/assert';
import { schemas } from '@0xproject/json-schemas';
-import { SignedOrder } from '@0xproject/types';
-import { FeesResponse, OrderbookResponse, TokenPairsItem } from '../types';
+import {
+ APIOrder,
+ AssetPairsItem,
+ AssetPairsResponse,
+ OrderbookResponse,
+ OrderConfigResponse,
+ OrdersResponse,
+} from '../types';
import { typeConverters } from './type_converters';
export const relayerResponseJsonParsers = {
- parseTokenPairsJson(json: any): TokenPairsItem[] {
- assert.doesConformToSchema('tokenPairs', json, schemas.relayerApiTokenPairsResponseSchema);
- return json.map((tokenPair: any) => {
- return typeConverters.convertStringsFieldsToBigNumbers(tokenPair, [
- 'tokenA.minAmount',
- 'tokenA.maxAmount',
- 'tokenB.minAmount',
- 'tokenB.maxAmount',
+ parseAssetDataPairsJson(json: any): AssetPairsResponse {
+ assert.doesConformToSchema('assetDataPairsResponse', json, schemas.relayerApiAssetDataPairsResponseSchema);
+ return { ...json, records: relayerResponseJsonParsers.parseAssetPairsItemsJson(json.records) };
+ },
+ parseAssetPairsItemsJson(json: any): AssetPairsItem[] {
+ return json.map((assetDataPair: any) => {
+ return typeConverters.convertStringsFieldsToBigNumbers(assetDataPair, [
+ 'assetDataA.minAmount',
+ 'assetDataA.maxAmount',
+ 'assetDataB.minAmount',
+ 'assetDataB.maxAmount',
]);
});
},
- parseOrdersJson(json: any): SignedOrder[] {
- assert.doesConformToSchema('orders', json, schemas.signedOrdersSchema);
- return json.map((order: object) => typeConverters.convertOrderStringFieldsToBigNumber(order));
+ parseOrdersJson(json: any): OrdersResponse {
+ assert.doesConformToSchema('relayerApiOrdersResponse', json, schemas.relayerApiOrdersResponseSchema);
+ return { ...json, records: relayerResponseJsonParsers.parseAPIOrdersJson(json.records) };
+ },
+ parseAPIOrdersJson(json: any): APIOrder[] {
+ return json.map(relayerResponseJsonParsers.parseAPIOrderJson.bind(relayerResponseJsonParsers));
},
- parseOrderJson(json: any): SignedOrder {
- assert.doesConformToSchema('order', json, schemas.signedOrderSchema);
- return typeConverters.convertOrderStringFieldsToBigNumber(json);
+ parseAPIOrderJson(json: any): APIOrder {
+ assert.doesConformToSchema('relayerApiOrder', json, schemas.relayerApiOrderSchema);
+ return typeConverters.convertAPIOrderStringFieldsToBigNumber(json);
},
parseOrderbookResponseJson(json: any): OrderbookResponse {
- assert.doesConformToSchema('orderBook', json, schemas.relayerApiOrderBookResponseSchema);
+ assert.doesConformToSchema('orderBookResponse', json, schemas.relayerApiOrderbookResponseSchema);
return typeConverters.convertOrderbookStringFieldsToBigNumber(json);
},
- parseFeesResponseJson(json: any): FeesResponse {
- assert.doesConformToSchema('fees', json, schemas.relayerApiFeesResponseSchema);
+ parseOrderConfigResponseJson(json: any): OrderConfigResponse {
+ assert.doesConformToSchema('orderConfigResponse', json, schemas.relayerApiOrderConfigResponseSchema);
return typeConverters.convertStringsFieldsToBigNumbers(json, ['makerFee', 'takerFee']);
},
};
diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts
index 210d452b9..4b211a0b2 100644
--- a/packages/connect/src/utils/type_converters.ts
+++ b/packages/connect/src/utils/type_converters.ts
@@ -1,29 +1,47 @@
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
+import { APIOrder } from '../types';
+
export const typeConverters = {
convertOrderbookStringFieldsToBigNumber(orderbook: any): any {
const bids = _.get(orderbook, 'bids', []);
const asks = _.get(orderbook, 'asks', []);
+ const convertedBids = {
+ ...bids,
+ records: bids.records.map((order: any) => typeConverters.convertAPIOrderStringFieldsToBigNumber(order)),
+ };
+ const convertedAsks = {
+ ...asks,
+ records: asks.records.map((order: any) => typeConverters.convertAPIOrderStringFieldsToBigNumber(order)),
+ };
return {
- bids: bids.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
- asks: asks.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
+ bids: convertedBids,
+ asks: convertedAsks,
};
},
+ convertAPIOrderStringFieldsToBigNumber(apiOrder: any): APIOrder {
+ return { ...apiOrder, order: typeConverters.convertOrderStringFieldsToBigNumber(apiOrder.order) };
+ },
convertOrderStringFieldsToBigNumber(order: any): any {
return typeConverters.convertStringsFieldsToBigNumbers(order, [
- 'makerTokenAmount',
- 'takerTokenAmount',
+ 'makerAssetAmount',
+ 'takerAssetAmount',
'makerFee',
'takerFee',
- 'expirationUnixTimestampSec',
+ 'expirationTimeSeconds',
'salt',
]);
},
convertStringsFieldsToBigNumbers(obj: any, fields: string[]): any {
const result = _.assign({}, obj);
_.each(fields, field => {
- _.update(result, field, (value: string) => new BigNumber(value));
+ _.update(result, field, (value: string) => {
+ if (_.isUndefined(value)) {
+ throw new Error(`Could not find field '${field}' while converting string fields to BigNumber.`);
+ }
+ return new BigNumber(value);
+ });
});
return result;
},
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orders_channel.ts
index fa9f5e37f..cde4acbc3 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orders_channel.ts
@@ -1,32 +1,32 @@
import * as _ from 'lodash';
+import { v4 as uuid } from 'uuid';
import * as WebSocket from 'websocket';
-import {
- OrderbookChannel,
- OrderbookChannelHandler,
- OrderbookChannelMessageTypes,
- OrderbookChannelSubscriptionOpts,
-} from './types';
+import { OrdersChannel, OrdersChannelHandler, OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from './types';
import { assert } from './utils/assert';
-import { orderbookChannelMessageParser } from './utils/orderbook_channel_message_parser';
+import { ordersChannelMessageParser } from './utils/orders_channel_message_parser';
+
+export interface OrdersChannelSubscriptionOptsMap {
+ [key: string]: OrdersChannelSubscriptionOpts;
+}
/**
* This class includes all the functionality related to interacting with a websocket endpoint
* that implements the standard relayer API v0
*/
-export class WebSocketOrderbookChannel implements OrderbookChannel {
+export class WebSocketOrdersChannel implements OrdersChannel {
private readonly _client: WebSocket.w3cwebsocket;
- private readonly _handler: OrderbookChannelHandler;
- private readonly _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
+ private readonly _handler: OrdersChannelHandler;
+ private readonly _subscriptionOptsMap: OrdersChannelSubscriptionOptsMap = {};
/**
- * Instantiates a new WebSocketOrderbookChannel instance
+ * Instantiates a new WebSocketOrdersChannel instance
* @param client A WebSocket client
- * @param handler An OrderbookChannelHandler instance that responds to various
+ * @param handler An OrdersChannelHandler instance that responds to various
* channel updates
- * @return An instance of WebSocketOrderbookChannel
+ * @return An instance of WebSocketOrdersChannel
*/
- constructor(client: WebSocket.w3cwebsocket, handler: OrderbookChannelHandler) {
- assert.isOrderbookChannelHandler('handler', handler);
+ constructor(client: WebSocket.w3cwebsocket, handler: OrdersChannelHandler) {
+ assert.isOrdersChannelHandler('handler', handler);
// set private members
this._client = client;
this._handler = handler;
@@ -43,18 +43,18 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
}
/**
* Subscribe to orderbook snapshots and updates from the websocket
- * @param subscriptionOpts An OrderbookChannelSubscriptionOpts instance describing which
- * token pair to subscribe to
+ * @param subscriptionOpts An OrdersChannelSubscriptionOpts instance describing which
+ * assetData pair to subscribe to
*/
- public subscribe(subscriptionOpts: OrderbookChannelSubscriptionOpts): void {
- assert.isOrderbookChannelSubscriptionOpts('subscriptionOpts', subscriptionOpts);
+ public subscribe(subscriptionOpts: OrdersChannelSubscriptionOpts): void {
+ assert.isOrdersChannelSubscriptionOpts('subscriptionOpts', subscriptionOpts);
assert.assert(this._client.readyState === WebSocket.w3cwebsocket.OPEN, 'WebSocket connection is closed');
- this._subscriptionOptsList.push(subscriptionOpts);
- // TODO: update requestId management to use UUIDs for v2
+ const requestId = uuid();
+ this._subscriptionOptsMap[requestId] = subscriptionOpts;
const subscribeMessage = {
type: 'subscribe',
- channel: 'orderbook',
- requestId: this._subscriptionOptsList.length - 1,
+ channel: 'orders',
+ requestId,
payload: subscriptionOpts,
};
this._client.send(JSON.stringify(subscribeMessage));
@@ -72,8 +72,8 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
}
try {
const data = message.data;
- const parserResult = orderbookChannelMessageParser.parse(data);
- const subscriptionOpts = this._subscriptionOptsList[parserResult.requestId];
+ const parserResult = ordersChannelMessageParser.parse(data);
+ const subscriptionOpts = this._subscriptionOptsMap[parserResult.requestId];
if (_.isUndefined(subscriptionOpts)) {
this._handler.onError(
this,
@@ -82,11 +82,7 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
return;
}
switch (parserResult.type) {
- case OrderbookChannelMessageTypes.Snapshot: {
- this._handler.onSnapshot(this, subscriptionOpts, parserResult.payload);
- break;
- }
- case OrderbookChannelMessageTypes.Update: {
+ case OrdersChannelMessageTypes.Update: {
this._handler.onUpdate(this, subscriptionOpts, parserResult.payload);
break;
}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.json b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.json
new file mode 100644
index 000000000..603e9f67e
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.json
@@ -0,0 +1,21 @@
+{
+ "total": 43,
+ "page": 1,
+ "perPage": 100,
+ "records": [
+ {
+ "assetDataA": {
+ "minAmount": "0",
+ "maxAmount": "10000000000000000000",
+ "precision": 5,
+ "assetData": "0xf47261b04c32345ced77393b3530b1eed0f346429d"
+ },
+ "assetDataB": {
+ "minAmount": "0",
+ "maxAmount": "50000000000000000000",
+ "precision": 5,
+ "assetData": "0x0257179264389b814a946f3e92105513705ca6b990"
+ }
+ }
+ ]
+}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts
new file mode 100644
index 000000000..5ce703317
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts
@@ -0,0 +1,25 @@
+import { BigNumber } from '@0xproject/utils';
+
+import { AssetPairsResponse } from '../../../src/types';
+
+export const assetDataPairsResponse: AssetPairsResponse = {
+ total: 43,
+ page: 1,
+ perPage: 100,
+ records: [
+ {
+ assetDataA: {
+ minAmount: new BigNumber('0'),
+ maxAmount: new BigNumber('10000000000000000000'),
+ precision: 5,
+ assetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ },
+ assetDataB: {
+ minAmount: new BigNumber('0'),
+ maxAmount: new BigNumber('50000000000000000000'),
+ precision: 5,
+ assetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ },
+ },
+ ],
+};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json
new file mode 100644
index 000000000..b1d570b03
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json
@@ -0,0 +1,10 @@
+{
+ "total": 3,
+ "page": 1,
+ "perPage": 10,
+ "records": [
+ "0x6ec92694ea172ebc430c30fa31de87620967a082",
+ "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"
+ ]
+}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts
new file mode 100644
index 000000000..e17ffe7a8
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts
@@ -0,0 +1,12 @@
+import { FeeRecipientsResponse } from '../../../src/types';
+
+export const feeRecipientsResponse: FeeRecipientsResponse = {
+ total: 3,
+ page: 1,
+ perPage: 10,
+ records: [
+ '0x6ec92694ea172ebc430c30fa31de87620967a082',
+ '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ ],
+};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.json b/packages/connect/test/fixtures/standard_relayer_api/fees.json
deleted file mode 100644
index 483a74254..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/fees.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "feeRecipient": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "makerFee": "10000000000000000",
- "takerFee": "30000000000000000"
-}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts
deleted file mode 100644
index fecbaacff..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { BigNumber } from '@0xproject/utils';
-
-import { FeesResponse } from '../../../src/types';
-
-export const feesResponse: FeesResponse = {
- feeRecipient: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- makerFee: new BigNumber('10000000000000000'),
- takerFee: new BigNumber('30000000000000000'),
-};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
index e84954b0d..8d2cdd8ed 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json
@@ -1,19 +1,19 @@
{
- "maker": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
- "makerFee": "100000000000000",
- "takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
- "makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
- "salt": "256",
- "feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
- "ecSignature": {
- "v": 27,
- "r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
- "s": "0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254"
- }
+ "order": {
+ "makerAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "takerAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "feeRecipientAddress": "0xb046140686d052fff581f63f8136cce132e857da",
+ "senderAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
+ "makerFee": "100000000000000",
+ "takerFee": "200000000000000",
+ "expirationTimeSeconds": "1532560590",
+ "salt": "1532559225",
+ "makerAssetData": "0xf47261b04c32345ced77393b3530b1eed0f346429d",
+ "takerAssetData": "0x0257179264389b814a946f3e92105513705ca6b990",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "signature": "0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"
+ },
+ "metaData": {}
}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
index 5a03a2ff6..c8a669b3b 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.ts
@@ -1,21 +1,21 @@
import { BigNumber } from '@0xproject/utils';
export const orderResponse = {
- maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerFee: new BigNumber('100000000000000'),
- takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
- makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- salt: new BigNumber('256'),
- feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
- ecSignature: {
- v: 27,
- r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
- s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+ order: {
+ makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da',
+ senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
+ makerFee: new BigNumber('100000000000000'),
+ takerFee: new BigNumber('200000000000000'),
+ expirationTimeSeconds: new BigNumber('1532560590'),
+ salt: new BigNumber('1532559225'),
+ makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
},
+ metaData: {},
};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order_config.json b/packages/connect/test/fixtures/standard_relayer_api/order_config.json
new file mode 100644
index 000000000..39da91e6d
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/order_config.json
@@ -0,0 +1,6 @@
+{
+ "senderAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "feeRecipientAddress": "0xb046140686d052fff581f63f8136cce132e857da",
+ "makerFee": "100000000000000",
+ "takerFee": "200000000000000"
+}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/order_config.ts b/packages/connect/test/fixtures/standard_relayer_api/order_config.ts
new file mode 100644
index 000000000..36f01a009
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/order_config.ts
@@ -0,0 +1,10 @@
+import { BigNumber } from '@0xproject/utils';
+
+import { OrderConfigResponse } from '../../../src/types';
+
+export const orderConfigResponse: OrderConfigResponse = {
+ senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da',
+ makerFee: new BigNumber('100000000000000'),
+ takerFee: new BigNumber('200000000000000'),
+};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
index 825be34c2..5206c2217 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json
@@ -1,44 +1,54 @@
{
- "bids": [
- {
- "maker": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
- "makerFee": "100000000000000",
- "takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
- "makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
- "salt": "256",
- "feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
- "ecSignature": {
- "v": 27,
- "r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
- "s": "0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254"
+ "bids": {
+ "total": 325,
+ "page": 2,
+ "perPage": 100,
+ "records": [
+ {
+ "order": {
+ "makerAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "takerAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "feeRecipientAddress": "0xb046140686d052fff581f63f8136cce132e857da",
+ "senderAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
+ "makerFee": "100000000000000",
+ "takerFee": "200000000000000",
+ "expirationTimeSeconds": "1532560590",
+ "salt": "1532559225",
+ "makerAssetData": "0xf47261b04c32345ced77393b3530b1eed0f346429d",
+ "takerAssetData": "0x0257179264389b814a946f3e92105513705ca6b990",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "signature": "0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"
+ },
+ "metaData": {}
}
- }
- ],
- "asks": [
- {
- "maker": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
- "makerFee": "100000000000000",
- "takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
- "makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
- "salt": "256",
- "feeRecipient": "0xb046140686d052fff581f63f8136cce132e857da",
- "exchangeContractAddress": "0x12459c951127e0c374ff9105dda097662a027093",
- "expirationUnixTimestampSec": "42",
- "ecSignature": {
- "v": 27,
- "r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
- "s": "0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254"
+ ]
+ },
+ "asks": {
+ "total": 500,
+ "page": 2,
+ "perPage": 100,
+ "records": [
+ {
+ "order": {
+ "makerAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "takerAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "feeRecipientAddress": "0xb046140686d052fff581f63f8136cce132e857da",
+ "senderAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "makerAssetAmount": "20000000000000000",
+ "takerAssetAmount": "10000000000000000",
+ "makerFee": "200000000000000",
+ "takerFee": "100000000000000",
+ "expirationTimeSeconds": "1532560590",
+ "salt": "1532559225",
+ "makerAssetData": "0x0257179264389b814a946f3e92105513705ca6b990",
+ "takerAssetData": "0xf47261b04c32345ced77393b3530b1eed0f346429d",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "signature": "0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"
+ },
+ "metaData": {}
}
- }
- ]
+ ]
+ }
}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
index 6684ac2e5..d5f39a51f 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts
@@ -1,46 +1,58 @@
import { BigNumber } from '@0xproject/utils';
-export const orderbookResponse = {
- bids: [
- {
- maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerFee: new BigNumber('100000000000000'),
- takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
- makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- salt: new BigNumber('256'),
- feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
- ecSignature: {
- v: 27,
- r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
- s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+import { OrderbookResponse } from '../../../src/types';
+
+export const orderbookResponse: OrderbookResponse = {
+ bids: {
+ total: 325,
+ page: 2,
+ perPage: 100,
+ records: [
+ {
+ order: {
+ makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da',
+ senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
+ makerFee: new BigNumber('100000000000000'),
+ takerFee: new BigNumber('200000000000000'),
+ expirationTimeSeconds: new BigNumber('1532560590'),
+ salt: new BigNumber('1532559225'),
+ makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
+ },
+ metaData: {},
},
- },
- ],
- asks: [
- {
- maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerFee: new BigNumber('100000000000000'),
- takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
- makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- salt: new BigNumber('256'),
- feeRecipient: '0xb046140686d052fff581f63f8136cce132e857da',
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- expirationUnixTimestampSec: new BigNumber('42'),
- ecSignature: {
- v: 27,
- r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
- s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+ ],
+ },
+ asks: {
+ total: 500,
+ page: 2,
+ perPage: 100,
+ records: [
+ {
+ order: {
+ makerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ takerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da',
+ senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ makerAssetAmount: new BigNumber('20000000000000000'),
+ takerAssetAmount: new BigNumber('10000000000000000'),
+ makerFee: new BigNumber('200000000000000'),
+ takerFee: new BigNumber('100000000000000'),
+ expirationTimeSeconds: new BigNumber('1532560590'),
+ salt: new BigNumber('1532559225'),
+ makerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ takerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ signature: '0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891',
+ },
+ metaData: {},
},
- },
- ],
+ ],
+ },
};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.json b/packages/connect/test/fixtures/standard_relayer_api/orders.json
index cfa780dc4..683612071 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orders.json
+++ b/packages/connect/test/fixtures/standard_relayer_api/orders.json
@@ -1,21 +1,26 @@
-[
- {
- "maker": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "taker": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
- "makerFee": "100000000000000",
- "takerFee": "200000000000000",
- "makerTokenAmount": "10000000000000000",
- "takerTokenAmount": "20000000000000000",
- "makerTokenAddress": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "takerTokenAddress": "0xef7fff64389b814a946f3e92105513705ca6b990",
- "salt": "256",
- "feeRecipient": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "exchangeContractAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
- "expirationUnixTimestampSec": "42",
- "ecSignature": {
- "v": 27,
- "r": "0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33",
- "s": "0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254"
+{
+ "total": 984,
+ "page": 1,
+ "perPage": 100,
+ "records": [
+ {
+ "order": {
+ "makerAddress": "0x9e56625509c2f60af937f23b7b532600390e8c8b",
+ "takerAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "feeRecipientAddress": "0xb046140686d052fff581f63f8136cce132e857da",
+ "senderAddress": "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32",
+ "makerAssetAmount": "10000000000000000",
+ "takerAssetAmount": "20000000000000000",
+ "makerFee": "100000000000000",
+ "takerFee": "200000000000000",
+ "expirationTimeSeconds": "1532560590",
+ "salt": "1532559225",
+ "makerAssetData": "0xf47261b04c32345ced77393b3530b1eed0f346429d",
+ "takerAssetData": "0x0257179264389b814a946f3e92105513705ca6b990",
+ "exchangeAddress": "0x12459c951127e0c374ff9105dda097662a027093",
+ "signature": "0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"
+ },
+ "metaData": {}
}
- }
-]
+ ]
+}
diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.ts b/packages/connect/test/fixtures/standard_relayer_api/orders.ts
index 5044777bd..01f8974b8 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/orders.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/orders.ts
@@ -1,23 +1,30 @@
import { BigNumber } from '@0xproject/utils';
-export const ordersResponse = [
- {
- maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerFee: new BigNumber('100000000000000'),
- takerFee: new BigNumber('200000000000000'),
- makerTokenAmount: new BigNumber('10000000000000000'),
- takerTokenAmount: new BigNumber('20000000000000000'),
- makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- salt: new BigNumber('256'),
- feeRecipient: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- exchangeContractAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- expirationUnixTimestampSec: new BigNumber('42'),
- ecSignature: {
- v: 27,
- r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
- s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
+import { OrdersResponse } from '../../../src/types';
+
+export const ordersResponse: OrdersResponse = {
+ total: 984,
+ page: 1,
+ perPage: 100,
+ records: [
+ {
+ order: {
+ makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da',
+ senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ makerAssetAmount: new BigNumber('10000000000000000'),
+ takerAssetAmount: new BigNumber('20000000000000000'),
+ makerFee: new BigNumber('100000000000000'),
+ takerFee: new BigNumber('200000000000000'),
+ expirationTimeSeconds: new BigNumber('1532560590'),
+ salt: new BigNumber('1532559225'),
+ makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
+ signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
+ },
+ metaData: {},
},
- },
-];
+ ],
+};
diff --git a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts
deleted file mode 100644
index 1d7e67055..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/snapshot_orderbook_channel_message.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import * as orderbookJSON from './orderbook.json';
-
-const orderbookJsonString = JSON.stringify(orderbookJSON);
-
-export const snapshotOrderbookChannelMessage = `{
- "type": "snapshot",
- "channel": "orderbook",
- "requestId": 1,
- "payload": ${orderbookJsonString}
-}`;
-
-export const malformedSnapshotOrderbookChannelMessage = `{
- "type": "snapshot",
- "channel": "orderbook",
- "requestId": 1,
- "payload": {}
-}`;
diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json
deleted file mode 100644
index 90f57a974..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.json
+++ /dev/null
@@ -1,16 +0,0 @@
-[
- {
- "tokenA": {
- "address": "0x323b5d4c32345ced77393b3530b1eed0f346429d",
- "minAmount": "0",
- "maxAmount": "10000000000000000000",
- "precision": 5
- },
- "tokenB": {
- "address": "0xef7fff64389b814a946f3e92105513705ca6b990",
- "minAmount": "0",
- "maxAmount": "50000000000000000000",
- "precision": 5
- }
- }
-]
diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts
deleted file mode 100644
index f48b1e877..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { BigNumber } from '@0xproject/utils';
-
-import { TokenPairsItem } from '../../../src/types';
-
-export const tokenPairsResponse: TokenPairsItem[] = [
- {
- tokenA: {
- address: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- minAmount: new BigNumber(0),
- maxAmount: new BigNumber('10000000000000000000'),
- precision: 5,
- },
- tokenB: {
- address: '0xef7fff64389b814a946f3e92105513705ca6b990',
- minAmount: new BigNumber(0),
- maxAmount: new BigNumber('50000000000000000000'),
- precision: 5,
- },
- },
-];
diff --git a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/unknown_orders_channel_message.ts
index cbedff60e..b6c0cd50c 100644
--- a/packages/connect/test/fixtures/standard_relayer_api/unknown_orderbook_channel_message.ts
+++ b/packages/connect/test/fixtures/standard_relayer_api/unknown_orders_channel_message.ts
@@ -2,9 +2,9 @@ import * as orderResponseJSON from './order/0xabc67323774bdbd24d94f977fa9ac94a50
const orderJSONString = JSON.stringify(orderResponseJSON);
-export const unknownOrderbookChannelMessage = `{
+export const unknownOrdersChannelMessage = `{
"type": "superGoodUpdate",
"channel": "orderbook",
- "requestId": 1,
- "payload": ${orderJSONString}
+ "requestId": "6ce8c5a6-5c46-4027-a44a-51831c77b8a1",
+ "payload": [${orderJSONString}]
}`;
diff --git a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts
deleted file mode 100644
index 0e2c7523b..000000000
--- a/packages/connect/test/fixtures/standard_relayer_api/update_orderbook_channel_message.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import * as orderResponseJSON from './order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json';
-
-const orderJSONString = JSON.stringify(orderResponseJSON);
-
-export const updateOrderbookChannelMessage = `{
- "type": "update",
- "channel": "orderbook",
- "requestId": 1,
- "payload": ${orderJSONString}
-}`;
-
-export const malformedUpdateOrderbookChannelMessage = `{
- "type": "update",
- "channel": "orderbook",
- "requestId": 1,
- "payload": {}
-}`;
diff --git a/packages/connect/test/fixtures/standard_relayer_api/update_orders_channel_message.ts b/packages/connect/test/fixtures/standard_relayer_api/update_orders_channel_message.ts
new file mode 100644
index 000000000..c18a2c789
--- /dev/null
+++ b/packages/connect/test/fixtures/standard_relayer_api/update_orders_channel_message.ts
@@ -0,0 +1,17 @@
+import * as apiOrderJSON from './order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json';
+
+const apiOrderJSONString = JSON.stringify(apiOrderJSON);
+
+export const updateOrdersChannelMessage = `{
+ "type": "update",
+ "channel": "orders",
+ "requestId": "5a1ce3a2-22b9-41e6-a615-68077512e9e2",
+ "payload": [${apiOrderJSONString}]
+}`;
+
+export const malformedUpdateOrdersChannelMessage = `{
+ "type": "update",
+ "channel": "orders",
+ "requestId": "4d8efcee-adde-4475-9601-f0b30962ca2b",
+ "payload": {}
+}`;
diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts
index 311dc96e6..5b564e97b 100644
--- a/packages/connect/test/http_client_test.ts
+++ b/packages/connect/test/http_client_test.ts
@@ -1,4 +1,3 @@
-import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as dirtyChai from 'dirty-chai';
@@ -7,16 +6,18 @@ import 'mocha';
import { HttpClient } from '../src/index';
-import { feesResponse } from './fixtures/standard_relayer_api/fees';
-import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json';
+import { assetDataPairsResponse } from './fixtures/standard_relayer_api/asset_pairs';
+import * as assetDataPairsResponseJSON from './fixtures/standard_relayer_api/asset_pairs.json';
+import { feeRecipientsResponse } from './fixtures/standard_relayer_api/fee_recipients';
+import * as feeRecipientsResponseJSON from './fixtures/standard_relayer_api/fee_recipients.json';
import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f';
import * as orderResponseJSON from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json';
+import { orderConfigResponse } from './fixtures/standard_relayer_api/order_config';
+import * as orderConfigResponseJSON from './fixtures/standard_relayer_api/order_config.json';
import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook';
import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json';
import { ordersResponse } from './fixtures/standard_relayer_api/orders';
import * as ordersResponseJSON from './fixtures/standard_relayer_api/orders.json';
-import { tokenPairsResponse } from './fixtures/standard_relayer_api/token_pairs';
-import * as tokenPairsResponseJSON from './fixtures/standard_relayer_api/token_pairs.json';
chai.config.includeStack = true;
chai.use(dirtyChai);
@@ -26,7 +27,7 @@ const expect = chai.expect;
describe('HttpClient', () => {
const relayUrl = 'https://example.com';
const relayerClient = new HttpClient(relayUrl);
- afterEach(() => {
+ beforeEach(() => {
fetchMock.restore();
});
describe('#constructor', () => {
@@ -38,47 +39,47 @@ describe('HttpClient', () => {
expect(sanitizedUrl).to.be.deep.equal(urlWithoutTrailingSlash);
});
});
- describe('#getTokenPairsAsync', () => {
- const url = `${relayUrl}/token_pairs`;
- it('gets token pairs with default options when none are provided', async () => {
- const urlWithQuery = `${url}?page=1&per_page=100`;
- fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
- const tokenPairs = await relayerClient.getTokenPairsAsync();
- expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
- });
- it('gets token pairs with specified request options', async () => {
- const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
- const tokenPairsRequestOpts = {
- tokenA: tokenAddress,
+ describe('#getAssetPairsAsync', () => {
+ const url = `${relayUrl}/asset_pairs`;
+ it('gets assetData pairs with default options when none are provided', async () => {
+ fetchMock.get(url, assetDataPairsResponseJSON);
+ const assetDataPairs = await relayerClient.getAssetPairsAsync();
+ expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
+ });
+ it('gets assetData pairs with specified request options', async () => {
+ const assetData = '0xf47261b04c32345ced77393b3530b1eed0f346429d';
+ const assetPairsRequestOpts = {
+ assetDataA: assetData,
page: 3,
perPage: 50,
+ networkdId: 42,
};
- const urlWithQuery = `${url}?page=3&per_page=50&tokenA=${tokenAddress}`;
- fetchMock.get(urlWithQuery, tokenPairsResponseJSON);
- const tokenPairs = await relayerClient.getTokenPairsAsync(tokenPairsRequestOpts);
- expect(tokenPairs).to.be.deep.equal(tokenPairsResponse);
+ const urlWithQuery = `${url}?assetDataA=${assetData}&networkdId=42&page=3&perPage=50`;
+ fetchMock.get(urlWithQuery, assetDataPairsResponseJSON);
+ const assetDataPairs = await relayerClient.getAssetPairsAsync(assetPairsRequestOpts);
+ expect(assetDataPairs).to.be.deep.equal(assetDataPairsResponse);
});
it('throws an error for invalid JSON response', async () => {
fetchMock.get(url, { test: 'dummy' });
- expect(relayerClient.getTokenPairsAsync()).to.be.rejected();
+ expect(relayerClient.getAssetPairsAsync()).to.be.rejected();
});
});
describe('#getOrdersAsync', () => {
const url = `${relayUrl}/orders`;
it('gets orders with default options when none are provided', async () => {
- const urlWithQuery = `${url}?page=1&per_page=100`;
- fetchMock.get(urlWithQuery, ordersResponseJSON);
+ fetchMock.get(url, ordersResponseJSON);
const orders = await relayerClient.getOrdersAsync();
expect(orders).to.be.deep.equal(ordersResponse);
});
it('gets orders with specified request options', async () => {
- const tokenAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
+ const assetDataAddress = '0x323b5d4c32345ced77393b3530b1eed0f346429d';
const ordersRequest = {
- tokenAddress,
+ assetDataAddress,
page: 3,
perPage: 50,
+ networkdId: 42,
};
- const urlWithQuery = `${url}?page=3&per_page=50&tokenAddress=${tokenAddress}`;
+ const urlWithQuery = `${url}?assetDataAddress=${assetDataAddress}&networkdId=42&page=3&perPage=50`;
fetchMock.get(urlWithQuery, ordersResponseJSON);
const orders = await relayerClient.getOrdersAsync(ordersRequest);
expect(orders).to.be.deep.equal(ordersResponse);
@@ -103,26 +104,27 @@ describe('HttpClient', () => {
});
describe('#getOrderBookAsync', () => {
const request = {
- baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- quoteTokenAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ baseAssetData: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ quoteAssetData: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
};
const url = `${relayUrl}/orderbook`;
it('gets orderbook with default page options when none are provided', async () => {
- const urlWithQuery = `${url}?baseTokenAddress=${
- request.baseTokenAddress
- }&page=1&per_page=100&quoteTokenAddress=${request.quoteTokenAddress}`;
+ const urlWithQuery = `${url}?baseAssetData=${request.baseAssetData}&quoteAssetData=${
+ request.quoteAssetData
+ }`;
fetchMock.get(urlWithQuery, orderbookJSON);
const orderbook = await relayerClient.getOrderbookAsync(request);
expect(orderbook).to.be.deep.equal(orderbookResponse);
});
it('gets orderbook with specified page options', async () => {
- const urlWithQuery = `${url}?baseTokenAddress=${
- request.baseTokenAddress
- }&page=3&per_page=50&quoteTokenAddress=${request.quoteTokenAddress}`;
+ const urlWithQuery = `${url}?baseAssetData=${
+ request.baseAssetData
+ }&networkId=42&page=3&perPage=50&quoteAssetData=${request.quoteAssetData}`;
fetchMock.get(urlWithQuery, orderbookJSON);
const pagedRequestOptions = {
page: 3,
perPage: 50,
+ networkId: 42,
};
const orderbook = await relayerClient.getOrderbookAsync(request, pagedRequestOptions);
expect(orderbook).to.be.deep.equal(orderbookResponse);
@@ -132,39 +134,59 @@ describe('HttpClient', () => {
expect(relayerClient.getOrderbookAsync(request)).to.be.rejected();
});
});
- describe('#getFeesAsync', () => {
+ describe('#getOrderConfigAsync', () => {
const request = {
- exchangeContractAddress: '0x12459c951127e0c374ff9105dda097662a027093',
- maker: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
- taker: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
- makerTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- takerTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- makerTokenAmount: new BigNumber('10000000000000000000'),
- takerTokenAmount: new BigNumber('30000000000000000000'),
- salt: new BigNumber('256'),
- expirationUnixTimestampSec: new BigNumber('42'),
+ makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b',
+ takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32',
+ makerAssetAmount: '10000000000000000',
+ takerAssetAmount: '20000000000000000',
+ expirationTimeSeconds: '1532560590',
+ makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d',
+ takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990',
+ exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093',
};
- const url = `${relayUrl}/fees`;
- it('gets fees', async () => {
- fetchMock.post(url, feesResponseJSON);
- const fees = await relayerClient.getFeesAsync(request);
- expect(fees).to.be.deep.equal(feesResponse);
+ const url = `${relayUrl}/order_config`;
+ it('gets order config', async () => {
+ fetchMock.post(url, orderConfigResponseJSON);
+ const fees = await relayerClient.getOrderConfigAsync(request);
+ expect(fees).to.be.deep.equal(orderConfigResponse);
});
it('does not mutate input', async () => {
- fetchMock.post(url, feesResponseJSON);
- const makerTokenAmountBefore = new BigNumber(request.makerTokenAmount);
- const takerTokenAmountBefore = new BigNumber(request.takerTokenAmount);
- const saltBefore = new BigNumber(request.salt);
- const expirationUnixTimestampSecBefore = new BigNumber(request.expirationUnixTimestampSec);
- await relayerClient.getFeesAsync(request);
- expect(makerTokenAmountBefore).to.be.deep.equal(request.makerTokenAmount);
- expect(takerTokenAmountBefore).to.be.deep.equal(request.takerTokenAmount);
- expect(saltBefore).to.be.deep.equal(request.salt);
- expect(expirationUnixTimestampSecBefore).to.be.deep.equal(request.expirationUnixTimestampSec);
+ fetchMock.post(url, orderConfigResponseJSON);
+ const makerAssetAmountBefore = request.makerAssetAmount;
+ const takerAssetAmountBefore = request.takerAssetAmount;
+ const expirationTimeSecondsBefore = request.expirationTimeSeconds;
+ await relayerClient.getOrderConfigAsync(request);
+ expect(makerAssetAmountBefore).to.be.deep.equal(request.makerAssetAmount);
+ expect(takerAssetAmountBefore).to.be.deep.equal(request.takerAssetAmount);
+ expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
});
it('throws an error for invalid JSON response', async () => {
fetchMock.post(url, { test: 'dummy' });
- expect(relayerClient.getFeesAsync(request)).to.be.rejected();
+ expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected();
+ });
+ });
+ describe('#getFeeRecipientsAsync', () => {
+ const url = `${relayUrl}/fee_recipients`;
+ it('gets fee recipients with default page options when none are provided', async () => {
+ fetchMock.get(url, feeRecipientsResponseJSON);
+ const feeRecipients = await relayerClient.getFeeRecipientsAsync();
+ expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
+ });
+ it('gets fee recipient with specified page options', async () => {
+ const urlWithQuery = `${url}?networkId=42&page=3&perPage=50`;
+ fetchMock.get(urlWithQuery, feeRecipientsResponseJSON);
+ const pagedRequestOptions = {
+ page: 3,
+ perPage: 50,
+ networkId: 42,
+ };
+ const feeRecipients = await relayerClient.getFeeRecipientsAsync(pagedRequestOptions);
+ expect(feeRecipients).to.be.deep.equal(feeRecipientsResponse);
+ });
+ it('throws an error for invalid JSON response', async () => {
+ fetchMock.get(url, { test: 'dummy' });
+ expect(relayerClient.getFeeRecipientsAsync()).to.be.rejected();
});
});
});
diff --git a/packages/connect/test/orderbook_channel_factory_test.ts b/packages/connect/test/orderbook_channel_factory_test.ts
deleted file mode 100644
index 2ce361bd2..000000000
--- a/packages/connect/test/orderbook_channel_factory_test.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import * as chai from 'chai';
-import * as dirtyChai from 'dirty-chai';
-import * as _ from 'lodash';
-import 'mocha';
-
-import { orderbookChannelFactory } from '../src/orderbook_channel_factory';
-
-chai.config.includeStack = true;
-chai.use(dirtyChai);
-const expect = chai.expect;
-const emptyOrderbookChannelHandler = {
- onSnapshot: () => {
- _.noop();
- },
- onUpdate: () => {
- _.noop();
- },
- onError: () => {
- _.noop();
- },
- onClose: () => {
- _.noop();
- },
-};
-
-describe('orderbookChannelFactory', () => {
- const websocketUrl = 'ws://localhost:8080';
- describe('#createWebSocketOrderbookChannelAsync', () => {
- it('throws when input is not a url', () => {
- const badUrlInput = 54;
- expect(
- orderbookChannelFactory.createWebSocketOrderbookChannelAsync(
- badUrlInput as any,
- emptyOrderbookChannelHandler,
- ),
- ).to.be.rejected();
- });
- it('throws when handler has the incorrect members', () => {
- const badHandlerInput = {};
- expect(
- orderbookChannelFactory.createWebSocketOrderbookChannelAsync(websocketUrl, badHandlerInput as any),
- ).to.be.rejected();
- });
- });
-});
diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts
deleted file mode 100644
index 3e1f44384..000000000
--- a/packages/connect/test/orderbook_channel_message_parsers_test.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import * as chai from 'chai';
-import * as dirtyChai from 'dirty-chai';
-import 'mocha';
-
-import { orderbookChannelMessageParser } from '../src/utils/orderbook_channel_message_parser';
-
-import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f';
-import { orderbookResponse } from './fixtures/standard_relayer_api/orderbook';
-import {
- malformedSnapshotOrderbookChannelMessage,
- snapshotOrderbookChannelMessage,
-} from './fixtures/standard_relayer_api/snapshot_orderbook_channel_message';
-import { unknownOrderbookChannelMessage } from './fixtures/standard_relayer_api/unknown_orderbook_channel_message';
-import {
- malformedUpdateOrderbookChannelMessage,
- updateOrderbookChannelMessage,
-} from './fixtures/standard_relayer_api/update_orderbook_channel_message';
-
-chai.config.includeStack = true;
-chai.use(dirtyChai);
-const expect = chai.expect;
-
-describe('orderbookChannelMessageParser', () => {
- describe('#parser', () => {
- it('parses snapshot messages', () => {
- const snapshotMessage = orderbookChannelMessageParser.parse(snapshotOrderbookChannelMessage);
- expect(snapshotMessage.type).to.be.equal('snapshot');
- expect(snapshotMessage.payload).to.be.deep.equal(orderbookResponse);
- });
- it('parses update messages', () => {
- const updateMessage = orderbookChannelMessageParser.parse(updateOrderbookChannelMessage);
- expect(updateMessage.type).to.be.equal('update');
- expect(updateMessage.payload).to.be.deep.equal(orderResponse);
- });
- it('returns unknown message for messages with unsupported types', () => {
- const unknownMessage = orderbookChannelMessageParser.parse(unknownOrderbookChannelMessage);
- expect(unknownMessage.type).to.be.equal('unknown');
- expect(unknownMessage.payload).to.be.undefined();
- });
- it('throws when message does not include a type', () => {
- const typelessMessage = `{
- "channel": "orderbook",
- "requestId": 1,
- "payload": {}
- }`;
- const badCall = () => orderbookChannelMessageParser.parse(typelessMessage);
- expect(badCall).throws(`Message is missing a type parameter: ${typelessMessage}`);
- });
- it('throws when type is not a string', () => {
- const messageWithBadType = `{
- "type": 1,
- "channel": "orderbook",
- "requestId": 1,
- "payload": {}
- }`;
- const badCall = () => orderbookChannelMessageParser.parse(messageWithBadType);
- expect(badCall).throws('Expected type to be of type string, encountered: 1');
- });
- it('throws when snapshot message has malformed payload', () => {
- const badCall = () => orderbookChannelMessageParser.parse(malformedSnapshotOrderbookChannelMessage);
- // tslint:disable-next-line:max-line-length
- const errMsg =
- 'Validation errors: instance.payload requires property "bids", instance.payload requires property "asks"';
- expect(badCall).throws(errMsg);
- });
- it('throws when update message has malformed payload', () => {
- const badCall = () => orderbookChannelMessageParser.parse(malformedUpdateOrderbookChannelMessage);
- expect(badCall).throws(/^Expected message to conform to schema/);
- });
- it('throws when input message is not valid JSON', () => {
- const nonJsonString = 'h93b{sdfs9fsd f';
- const badCall = () => orderbookChannelMessageParser.parse(nonJsonString);
- expect(badCall).throws('Unexpected token h in JSON at position 0');
- });
- });
-});
diff --git a/packages/connect/test/orders_channel_factory_test.ts b/packages/connect/test/orders_channel_factory_test.ts
new file mode 100644
index 000000000..29aa87c65
--- /dev/null
+++ b/packages/connect/test/orders_channel_factory_test.ts
@@ -0,0 +1,34 @@
+import * as chai from 'chai';
+import * as dirtyChai from 'dirty-chai';
+import * as _ from 'lodash';
+
+import 'mocha';
+
+import { ordersChannelFactory } from '../src/orders_channel_factory';
+
+chai.config.includeStack = true;
+chai.use(dirtyChai);
+const expect = chai.expect;
+const emptyOrdersChannelHandler = {
+ onUpdate: _.noop.bind(_),
+ onError: _.noop.bind(_),
+ onClose: _.noop.bind(_),
+};
+
+describe('ordersChannelFactory', () => {
+ const websocketUrl = 'ws://localhost:8080';
+ describe('#createWebSocketOrdersChannelAsync', () => {
+ it('throws when input is not a url', () => {
+ const badUrlInput = 54;
+ expect(
+ ordersChannelFactory.createWebSocketOrdersChannelAsync(badUrlInput as any, emptyOrdersChannelHandler),
+ ).to.be.rejected();
+ });
+ it('throws when handler has the incorrect members', () => {
+ const badHandlerInput = {};
+ expect(
+ ordersChannelFactory.createWebSocketOrdersChannelAsync(websocketUrl, badHandlerInput as any),
+ ).to.be.rejected();
+ });
+ });
+});
diff --git a/packages/connect/test/orders_channel_message_parsers_test.ts b/packages/connect/test/orders_channel_message_parsers_test.ts
new file mode 100644
index 000000000..4d4a2d23f
--- /dev/null
+++ b/packages/connect/test/orders_channel_message_parsers_test.ts
@@ -0,0 +1,59 @@
+import * as chai from 'chai';
+import * as dirtyChai from 'dirty-chai';
+import 'mocha';
+
+import { ordersChannelMessageParser } from '../src/utils/orders_channel_message_parser';
+
+import { orderResponse } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f';
+import { unknownOrdersChannelMessage } from './fixtures/standard_relayer_api/unknown_orders_channel_message';
+import {
+ malformedUpdateOrdersChannelMessage,
+ updateOrdersChannelMessage,
+} from './fixtures/standard_relayer_api/update_orders_channel_message';
+
+chai.config.includeStack = true;
+chai.use(dirtyChai);
+const expect = chai.expect;
+
+describe('ordersChannelMessageParser', () => {
+ describe('#parser', () => {
+ it('parses update messages', () => {
+ const updateMessage = ordersChannelMessageParser.parse(updateOrdersChannelMessage);
+ expect(updateMessage.type).to.be.equal('update');
+ expect(updateMessage.payload).to.be.deep.equal([orderResponse]);
+ });
+ it('returns unknown message for messages with unsupported types', () => {
+ const unknownMessage = ordersChannelMessageParser.parse(unknownOrdersChannelMessage);
+ expect(unknownMessage.type).to.be.equal('unknown');
+ expect(unknownMessage.payload).to.be.undefined();
+ });
+ it('throws when message does not include a type', () => {
+ const typelessMessage = `{
+ "channel": "orders",
+ "requestId": "4d8efcee-adde-4475-9601-f0b30962ca2b",
+ "payload": []
+ }`;
+ const badCall = () => ordersChannelMessageParser.parse(typelessMessage);
+ expect(badCall).throws(`Message is missing a type parameter: ${typelessMessage}`);
+ });
+ it('throws when type is not a string', () => {
+ const messageWithBadType = `{
+ "type": 1,
+ "channel": "orders",
+ "requestId": "4d8efcee-adde-4475-9601-f0b30962ca2b",
+ "payload": []
+ }`;
+ const badCall = () => ordersChannelMessageParser.parse(messageWithBadType);
+ expect(badCall).throws('Expected type to be of type string, encountered: 1');
+ });
+ it('throws when update message has malformed payload', () => {
+ const badCall = () => ordersChannelMessageParser.parse(malformedUpdateOrdersChannelMessage);
+ expect(badCall).throws(/^Expected message to conform to schema/);
+ });
+ it('throws when input message is not valid JSON', () => {
+ const nonJsonString = 'h93b{sdfs9fsd f';
+ const badCall = () => ordersChannelMessageParser.parse(nonJsonString);
+ expect(badCall).throws('Unexpected token h in JSON at position 0');
+ });
+ });
+});
diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts
deleted file mode 100644
index 5a63cbdcc..000000000
--- a/packages/connect/test/ws_orderbook_channel_test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import * as chai from 'chai';
-import * as dirtyChai from 'dirty-chai';
-import * as _ from 'lodash';
-import 'mocha';
-import * as Sinon from 'sinon';
-import * as WebSocket from 'websocket';
-
-import { WebSocketOrderbookChannel } from '../src/ws_orderbook_channel';
-
-chai.config.includeStack = true;
-chai.use(dirtyChai);
-const expect = chai.expect;
-const emptyOrderbookChannelHandler = {
- onSnapshot: () => {
- _.noop();
- },
- onUpdate: () => {
- _.noop();
- },
- onError: () => {
- _.noop();
- },
- onClose: () => {
- _.noop();
- },
-};
-
-describe('WebSocketOrderbookChannel', () => {
- const websocketUrl = 'ws://localhost:8080';
- const openClient = new WebSocket.w3cwebsocket(websocketUrl);
- Sinon.stub(openClient, 'readyState').get(() => WebSocket.w3cwebsocket.OPEN);
- Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
- const openOrderbookChannel = new WebSocketOrderbookChannel(openClient, emptyOrderbookChannelHandler);
- const subscriptionOpts = {
- baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
- quoteTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
- snapshot: true,
- limit: 100,
- };
- describe('#subscribe', () => {
- it('throws when subscriptionOpts does not conform to schema', () => {
- const badSubscribeCall = openOrderbookChannel.subscribe.bind(openOrderbookChannel, {});
- expect(badSubscribeCall).throws(
- 'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"',
- );
- });
- it('does not throw when inputs are of correct types', () => {
- const goodSubscribeCall = openOrderbookChannel.subscribe.bind(openOrderbookChannel, subscriptionOpts);
- expect(goodSubscribeCall).to.not.throw();
- });
- it('throws when client is closed', () => {
- const closedClient = new WebSocket.w3cwebsocket(websocketUrl);
- Sinon.stub(closedClient, 'readyState').get(() => WebSocket.w3cwebsocket.CLOSED);
- const closedOrderbookChannel = new WebSocketOrderbookChannel(closedClient, emptyOrderbookChannelHandler);
- const badSubscribeCall = closedOrderbookChannel.subscribe.bind(closedOrderbookChannel, subscriptionOpts);
- expect(badSubscribeCall).throws('WebSocket connection is closed');
- });
- });
-});
diff --git a/packages/connect/test/ws_orders_channel_test.ts b/packages/connect/test/ws_orders_channel_test.ts
new file mode 100644
index 000000000..df30bc41d
--- /dev/null
+++ b/packages/connect/test/ws_orders_channel_test.ts
@@ -0,0 +1,49 @@
+import * as chai from 'chai';
+import * as dirtyChai from 'dirty-chai';
+import * as _ from 'lodash';
+import 'mocha';
+import * as Sinon from 'sinon';
+import * as WebSocket from 'websocket';
+
+import { WebSocketOrdersChannel } from '../src/ws_orders_channel';
+
+chai.config.includeStack = true;
+chai.use(dirtyChai);
+const expect = chai.expect;
+const emptyOrdersChannelHandler = {
+ onUpdate: _.noop.bind(_),
+ onError: _.noop.bind(_),
+ onClose: _.noop.bind(_),
+};
+
+describe('WebSocketOrdersChannel', () => {
+ const websocketUrl = 'ws://localhost:8080';
+ const openClient = new WebSocket.w3cwebsocket(websocketUrl);
+ Sinon.stub(openClient, 'readyState').get(() => WebSocket.w3cwebsocket.OPEN);
+ Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
+ const openOrdersChannel = new WebSocketOrdersChannel(openClient, emptyOrdersChannelHandler);
+ const subscriptionOpts = {
+ baseAssetData: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
+ quoteAssetData: '0xef7fff64389b814a946f3e92105513705ca6b990',
+ limit: 100,
+ };
+ describe('#subscribe', () => {
+ it('throws when subscriptionOpts does not conform to schema', () => {
+ const badSubscribeCall = openOrdersChannel.subscribe.bind(openOrdersChannel, {
+ makerAssetData: 5,
+ });
+ expect(badSubscribeCall).throws();
+ });
+ it('does not throw when inputs are of correct types', () => {
+ const goodSubscribeCall = openOrdersChannel.subscribe.bind(openOrdersChannel, subscriptionOpts);
+ expect(goodSubscribeCall).to.not.throw();
+ });
+ it('throws when client is closed', () => {
+ const closedClient = new WebSocket.w3cwebsocket(websocketUrl);
+ Sinon.stub(closedClient, 'readyState').get(() => WebSocket.w3cwebsocket.CLOSED);
+ const closedOrdersChannel = new WebSocketOrdersChannel(closedClient, emptyOrdersChannelHandler);
+ const badSubscribeCall = closedOrdersChannel.subscribe.bind(closedOrdersChannel, subscriptionOpts);
+ expect(badSubscribeCall).throws('WebSocket connection is closed');
+ });
+ });
+});
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index d78a1c11e..f22b78c2a 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.0.1-rc.5",
+ "changes": [
+ {
+ "note": "Update incorrect relayer api fee recipients response schema",
+ "pr": 974
+ }
+ ]
+ },
+ {
"version": "1.0.1-rc.4",
"changes": [
{
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
index 84d39eb20..4f96e5a2d 100644
--- a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts
+++ b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts
@@ -5,7 +5,11 @@ export const relayerApiFeeRecipientsResponseSchema = {
{ $ref: '/paginatedCollectionSchema' },
{
properties: {
- records: { $ref: '/addressSchema' },
+ records: {
+ id: '/relayerApiFeeRecipientsSchema',
+ type: 'array',
+ items: { $ref: '/addressSchema' },
+ },
},
required: ['records'],
},
diff --git a/packages/sra-api/CHANGELOG.json b/packages/sra-api/CHANGELOG.json
index 757a859f3..d6797cc45 100644
--- a/packages/sra-api/CHANGELOG.json
+++ b/packages/sra-api/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.0.1-rc.5",
+ "changes": [
+ {
+ "note": "Add takerAddress to /orders parameters",
+ "pr": 974
+ }
+ ]
+ },
+ {
"version": "1.0.1-rc.4",
"changes": [
{
diff --git a/packages/sra-api/public/api.json b/packages/sra-api/public/api.json
index 9c727cfbd..fc2409abb 100644
--- a/packages/sra-api/public/api.json
+++ b/packages/sra-api/public/api.json
@@ -1 +1 @@
-{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: <https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20>; rel=\"next\",\n<https://api.github.com/user/repos?page=10&perPage=20>; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"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"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/addressSchema"}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file
+{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: <https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20>; rel=\"next\",\n<https://api.github.com/user/repos?page=10&perPage=20>; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"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"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"id":"#/components/schemas/relayerApiFeeRecipientsSchema","type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts
index 4143a663c..f80d343d8 100644
--- a/packages/sra-api/src/api.ts
+++ b/packages/sra-api/src/api.ts
@@ -151,6 +151,15 @@ export const api: OpenApiSpec = {
},
},
{
+ name: 'takerAddress',
+ in: 'query',
+ description: `Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
+ example: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ schema: {
+ $ref: '#/components/schemas/addressSchema',
+ },
+ },
+ {
name: 'traderAddress',
in: 'query',
description: `Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`,
diff --git a/packages/sra-api/src/examples/relayerApiOrderConfig b/packages/sra-api/src/examples/relayerApiOrderConfig
deleted file mode 100644
index e69de29bb..000000000
--- a/packages/sra-api/src/examples/relayerApiOrderConfig
+++ /dev/null
diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json
index 8c213ee26..15172dcf8 100644
--- a/packages/sra-report/package.json
+++ b/packages/sra-report/package.json
@@ -36,7 +36,7 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
"dependencies": {
"@0xproject/assert": "^1.0.5",
- "@0xproject/connect": "^1.0.5",
+ "@0xproject/connect": "1.0.4",
"@0xproject/json-schemas": "^0.8.3",
"@0xproject/order-utils": "^0.0.9",
"@0xproject/types": "^0.8.2",
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
new file mode 100644
index 000000000..4f3200b1c
--- /dev/null
+++ b/packages/website/md/docs/json_schemas/2.0.0/schemas.md
@@ -0,0 +1,28 @@
+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)
+
+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)
+
+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)
diff --git a/packages/website/ts/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts
index 523777114..fe95320a9 100644
--- a/packages/website/ts/containers/json_schemas_documentation.ts
+++ b/packages/website/ts/containers/json_schemas_documentation.ts
@@ -13,6 +13,7 @@ const IntroMarkdownV1 = require('md/docs/json_schemas/1.0.0/introduction');
const InstallationMarkdownV1 = require('md/docs/json_schemas/1.0.0/installation');
const UsageMarkdownV1 = require('md/docs/json_schemas/1.0.0/usage');
const SchemasMarkdownV1 = require('md/docs/json_schemas/1.0.0/schemas');
+const SchemasMarkdownV2 = require('md/docs/json_schemas/2.0.0/schemas');
/* tslint:enable:no-var-requires */
const docSections = {
@@ -42,6 +43,12 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.schemas]: SchemasMarkdownV1,
[docSections.usage]: UsageMarkdownV1,
},
+ '1.0.0': {
+ [docSections.introduction]: IntroMarkdownV1,
+ [docSections.installation]: InstallationMarkdownV1,
+ [docSections.schemas]: SchemasMarkdownV2,
+ [docSections.usage]: UsageMarkdownV1,
+ },
},
sectionNameToModulePath: {
[docSections.schemaValidator]: ['"json-schemas/src/schema_validator"'],
diff --git a/yarn.lock b/yarn.lock
index 0cbdf8f25..a72d0ee71 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -524,6 +524,20 @@
ethers "3.0.22"
lodash "4.17.10"
+"@0xproject/connect@1.0.4":
+ version "1.0.4"
+ resolved "https://registry.npmjs.org/@0xproject/connect/-/connect-1.0.4.tgz#1d5f27f4aa69920dde50178ed7179240f81d1c54"
+ dependencies:
+ "@0xproject/assert" "^0.2.14"
+ "@0xproject/json-schemas" "^0.8.3"
+ "@0xproject/types" "^0.8.2"
+ "@0xproject/typescript-typings" "^1.0.3"
+ "@0xproject/utils" "^1.0.4"
+ lodash "^4.17.4"
+ query-string "^5.0.1"
+ sinon "^4.0.0"
+ websocket "^1.0.25"
+
"@0xproject/contract-wrappers@^0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@0xproject/contract-wrappers/-/contract-wrappers-0.0.5.tgz#36f91afb7de51478f9d2e4e0a3c4e685b3d18f28"
@@ -1256,7 +1270,7 @@
version "0.0.33"
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.0.33.tgz#1073c4bc824754ae3d10cfab88ab0237ba964e4d"
-"@types/uuid@^3.4.2":
+"@types/uuid@^3.4.2", "@types/uuid@^3.4.3":
version "3.4.3"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.3.tgz#121ace265f5569ce40f4f6d0ff78a338c732a754"
dependencies:
@@ -1480,6 +1494,10 @@ ansi-wrap@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
+ansi@^0.3.0, ansi@~0.3.1:
+ version "0.3.1"
+ resolved "https://registry.yarnpkg.com/ansi/-/ansi-0.3.1.tgz#0c42d4fb17160d5a9af1e484bace1c66922c1b21"
+
antlr4@4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.7.0.tgz#297f956ddc06f83397fc0990ecf2e0cf20bfbbee"
@@ -1785,6 +1803,10 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289"
+aws4@^1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f"
+
babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@@ -3514,7 +3536,7 @@ columnify@^1.5.4:
strip-ansi "^3.0.0"
wcwidth "^1.0.0"
-combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5:
+combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5, combined-stream@~1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818"
dependencies:
@@ -3587,19 +3609,19 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
-concat-stream@^1.5.0:
- version "1.6.1"
- resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.1.tgz#261b8f518301f1d834e36342b9fea095d2620a26"
+concat-stream@^1.4.6, concat-stream@^1.5.1, concat-stream@^1.6.0:
+ version "1.6.2"
+ resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34"
dependencies:
+ buffer-from "^1.0.0"
inherits "^2.0.3"
readable-stream "^2.2.2"
typedarray "^0.0.6"
-concat-stream@^1.5.1, concat-stream@^1.6.0:
- version "1.6.2"
- resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34"
+concat-stream@^1.5.0:
+ version "1.6.1"
+ resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.1.tgz#261b8f518301f1d834e36342b9fea095d2620a26"
dependencies:
- buffer-from "^1.0.0"
inherits "^2.0.3"
readable-stream "^2.2.2"
typedarray "^0.0.6"
@@ -5517,6 +5539,10 @@ extend@^3.0.0, extend@~3.0.0, extend@~3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
+extend@~3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
+
external-editor@^2.0.4, external-editor@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5"
@@ -5865,7 +5891,7 @@ form-data@~2.1.1:
combined-stream "^1.0.5"
mime-types "^2.1.12"
-form-data@~2.3.1:
+form-data@~2.3.1, form-data@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099"
dependencies:
@@ -6053,6 +6079,16 @@ ganache-core@0xProject/ganache-core#monorepo-dep:
websocket "^1.0.24"
yargs "^7.0.2"
+gauge@~1.2.5:
+ version "1.2.7"
+ resolved "https://registry.yarnpkg.com/gauge/-/gauge-1.2.7.tgz#e9cec5483d3d4ee0ef44b60a7d99e4935e136d93"
+ dependencies:
+ ansi "^0.3.0"
+ has-unicode "^2.0.0"
+ lodash.pad "^4.1.0"
+ lodash.padend "^4.1.0"
+ lodash.padstart "^4.1.0"
+
gauge@~2.7.3:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
@@ -6576,6 +6612,13 @@ har-validator@~5.0.2, har-validator@~5.0.3:
ajv "^5.1.0"
har-schema "^2.0.0"
+har-validator@~5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.0.tgz#44657f5688a22cfd4b72486e81b3a3fb11742c29"
+ dependencies:
+ ajv "^5.3.0"
+ har-schema "^2.0.0"
+
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
@@ -6771,7 +6814,7 @@ hosted-git-info@^2.1.4:
version "2.6.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222"
-hosted-git-info@^2.6.0:
+hosted-git-info@^2.1.5, hosted-git-info@^2.6.0:
version "2.7.1"
resolved "http://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
@@ -8394,6 +8437,18 @@ lodash.merge@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54"
+lodash.pad@^4.1.0:
+ version "4.5.1"
+ resolved "https://registry.yarnpkg.com/lodash.pad/-/lodash.pad-4.5.1.tgz#4330949a833a7c8da22cc20f6a26c4d59debba70"
+
+lodash.padend@^4.1.0:
+ version "4.6.1"
+ resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e"
+
+lodash.padstart@^4.1.0:
+ version "4.6.1"
+ resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b"
+
lodash.reduce@^4.3.0:
version "4.6.0"
resolved "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b"
@@ -8856,6 +8911,10 @@ mime-db@~1.30.0:
version "1.30.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01"
+mime-db@~1.35.0:
+ version "1.35.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.35.0.tgz#0569d657466491283709663ad379a99b90d9ab47"
+
mime-format@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/mime-format/-/mime-format-2.0.0.tgz#e29f8891e284d78270246f0050d6834bdbbe1332"
@@ -8874,6 +8933,12 @@ mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.17, mime-types@~2.1.18,
dependencies:
mime-db "~1.33.0"
+mime-types@~2.1.19:
+ version "2.1.19"
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.19.tgz#71e464537a7ef81c15f2db9d97e913fc0ff606f0"
+ dependencies:
+ mime-db "~1.35.0"
+
mime@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
@@ -9403,7 +9468,7 @@ nopt@~1.0.10:
dependencies:
abbrev "1"
-normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5:
+normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, "normalize-package-data@~1.0.1 || ^2.0.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f"
dependencies:
@@ -9449,6 +9514,12 @@ npm-bundled@^1.0.1:
version "1.0.3"
resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308"
+npm-cli-login@^0.0.10:
+ version "0.0.10"
+ resolved "https://registry.yarnpkg.com/npm-cli-login/-/npm-cli-login-0.0.10.tgz#b1e8b5b7405008e0a26ccc170443434a59c5364c"
+ dependencies:
+ npm-registry-client "7.0.9"
+
npm-lifecycle@^2.0.0:
version "2.0.3"
resolved "http://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.0.3.tgz#696bedf1143371163e9cc16fe872357e25d8d90e"
@@ -9462,6 +9533,13 @@ npm-lifecycle@^2.0.0:
umask "^1.1.0"
which "^1.3.0"
+"npm-package-arg@^3.0.0 || ^4.0.0":
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-4.2.1.tgz#593303fdea85f7c422775f17f9eb7670f680e3ec"
+ dependencies:
+ hosted-git-info "^2.1.5"
+ semver "^5.1.0"
+
"npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0:
version "6.1.0"
resolved "http://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1"
@@ -9478,6 +9556,25 @@ npm-packlist@^1.1.6:
ignore-walk "^3.0.1"
npm-bundled "^1.0.1"
+npm-registry-client@7.0.9:
+ version "7.0.9"
+ resolved "https://registry.yarnpkg.com/npm-registry-client/-/npm-registry-client-7.0.9.tgz#1baf86ee5285c4e6d38d4556208ded56049231bb"
+ dependencies:
+ chownr "^1.0.1"
+ concat-stream "^1.4.6"
+ graceful-fs "^4.1.2"
+ mkdirp "^0.5.0"
+ normalize-package-data "~1.0.1 || ^2.0.0"
+ npm-package-arg "^3.0.0 || ^4.0.0"
+ once "^1.3.0"
+ request "^2.47.0"
+ retry "^0.8.0"
+ rimraf "2"
+ semver "2 >=2.2.1 || 3.x || 4 || 5"
+ slide "^1.1.3"
+ optionalDependencies:
+ npmlog "~2.0.0"
+
npm-run-all@^4.1.2, npm-run-all@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.3.tgz#49f15b55a66bb4101664ce270cb18e7103f8f185"
@@ -9507,6 +9604,14 @@ npm-run-path@^2.0.0:
gauge "~2.7.3"
set-blocking "~2.0.0"
+npmlog@~2.0.0:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-2.0.4.tgz#98b52530f2514ca90d09ec5b22c8846722375692"
+ dependencies:
+ ansi "~0.3.1"
+ are-we-there-yet "~1.1.2"
+ gauge "~1.2.5"
+
num2fraction@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede"
@@ -9562,6 +9667,10 @@ oauth-sign@~0.8.1, oauth-sign@~0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
+oauth-sign@~0.9.0:
+ version "0.9.0"
+ resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
+
object-assign@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"
@@ -10753,6 +10862,10 @@ pseudomap@^1.0.1, pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
+psl@^1.1.24:
+ version "1.1.29"
+ resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67"
+
pstree.remy@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.0.tgz#f2af27265bd3e5b32bbfcc10e80bac55ba78688b"
@@ -10878,6 +10991,10 @@ qs@~6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233"
+qs@~6.5.2:
+ version "6.5.2"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
+
query-string@^4.1.0:
version "4.3.4"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"
@@ -11680,6 +11797,31 @@ request@2.81.0, "request@>=2.9.0 <2.82.0":
tunnel-agent "^0.6.0"
uuid "^3.0.0"
+request@^2.47.0:
+ version "2.88.0"
+ resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
+ dependencies:
+ aws-sign2 "~0.7.0"
+ aws4 "^1.8.0"
+ caseless "~0.12.0"
+ combined-stream "~1.0.6"
+ extend "~3.0.2"
+ forever-agent "~0.6.1"
+ form-data "~2.3.2"
+ har-validator "~5.1.0"
+ http-signature "~1.2.0"
+ is-typedarray "~1.0.0"
+ isstream "~0.1.2"
+ json-stringify-safe "~5.0.1"
+ mime-types "~2.1.19"
+ oauth-sign "~0.9.0"
+ performance-now "^2.1.0"
+ qs "~6.5.2"
+ safe-buffer "^5.1.2"
+ tough-cookie "~2.4.3"
+ tunnel-agent "^0.6.0"
+ uuid "^3.3.2"
+
request@^2.54.0, request@^2.67.0, request@^2.79.0:
version "2.85.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa"
@@ -11856,6 +11998,10 @@ ret@~0.1.10:
version "0.1.15"
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
+retry@^0.8.0:
+ version "0.8.0"
+ resolved "https://registry.yarnpkg.com/retry/-/retry-0.8.0.tgz#2367628dc0edb247b1eab649dc53ac8628ac2d5f"
+
revalidator@0.1.x:
version "0.1.8"
resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b"
@@ -12097,6 +12243,10 @@ semver-sort@0.0.4:
semver "^5.0.3"
semver-regex "^1.0.0"
+"semver@2 >=2.2.1 || 3.x || 4 || 5":
+ version "5.5.1"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"
+
"semver@2 || 3 || 4 || 5", semver@5.4.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@~5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
@@ -12368,7 +12518,7 @@ slice-ansi@1.0.0:
dependencies:
is-fullwidth-code-point "^2.0.0"
-slide@^1.1.5, slide@^1.1.6:
+slide@^1.1.3, slide@^1.1.5, slide@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707"
@@ -13436,6 +13586,13 @@ tough-cookie@~2.3.0, tough-cookie@~2.3.3:
dependencies:
punycode "^1.4.1"
+tough-cookie@~2.4.3:
+ version "2.4.3"
+ resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781"
+ dependencies:
+ psl "^1.1.24"
+ punycode "^1.4.1"
+
traverse-chain@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1"