aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-21 02:53:49 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-21 02:53:49 +0800
commit44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1 (patch)
tree97e962f71e58064411fdc11986d804c242340cbf /packages/connect/src
parent1ae11ed8ae2cbe0f60a70925c9c8d348745c96c7 (diff)
downloaddexon-0x-contracts-44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1.tar.gz
dexon-0x-contracts-44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1.tar.zst
dexon-0x-contracts-44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1.zip
Run prettier
Diffstat (limited to 'packages/connect/src')
-rw-r--r--packages/connect/src/http_client.ts13
-rw-r--r--packages/connect/src/orders_channel_factory.ts5
-rw-r--r--packages/connect/src/schemas/order_config_request_schema.ts2
-rw-r--r--packages/connect/src/types.ts14
-rw-r--r--packages/connect/src/utils/relayer_response_json_parsers.ts9
-rw-r--r--packages/connect/src/ws_orders_channel.ts7
6 files changed, 26 insertions, 24 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 4fdcfc338..93f4eeb05 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -59,7 +59,9 @@ export class HttpClient implements Client {
* @param requestOpts Options specifying assetData information to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting AssetPairsItems that match the request
*/
- public async getAssetPairsAsync(requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts): Promise<AssetPairsResponse> {
+ public async getAssetPairsAsync(
+ requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts,
+ ): Promise<AssetPairsResponse> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.assetPairsRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
@@ -77,7 +79,9 @@ export class HttpClient implements Client {
* @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting SignedOrders that match the request
*/
- public async getOrdersAsync(requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts): Promise<OrdersResponse> {
+ public async getOrdersAsync(
+ requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts,
+ ): Promise<OrdersResponse> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
@@ -134,7 +138,10 @@ export class HttpClient implements Client {
* @param request A OrderConfigRequest instance describing the specific fees to retrieve
* @return The resulting OrderConfigResponse that matches the request
*/
- public async getOrderConfigAsync(request: OrderConfigRequest, requestOpts?: RequestOpts): Promise<OrderConfigResponse> {
+ public async getOrderConfigAsync(
+ request: OrderConfigRequest,
+ requestOpts?: RequestOpts,
+ ): Promise<OrderConfigResponse> {
if (!_.isUndefined(requestOpts)) {
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
}
diff --git a/packages/connect/src/orders_channel_factory.ts b/packages/connect/src/orders_channel_factory.ts
index fae5cab8c..5e8e625e0 100644
--- a/packages/connect/src/orders_channel_factory.ts
+++ b/packages/connect/src/orders_channel_factory.ts
@@ -12,10 +12,7 @@ export const ordersChannelFactory = {
* channel updates
* @return An OrdersChannel Promise
*/
- async createWebSocketOrdersChannelAsync(
- url: string,
- handler: OrdersChannelHandler,
- ): Promise<OrdersChannel> {
+ async createWebSocketOrdersChannelAsync(url: string, handler: OrdersChannelHandler): Promise<OrdersChannel> {
assert.isUri('url', url);
assert.isOrdersChannelHandler('handler', handler);
return new Promise<OrdersChannel>((resolve, reject) => {
diff --git a/packages/connect/src/schemas/order_config_request_schema.ts b/packages/connect/src/schemas/order_config_request_schema.ts
index 8f6b19500..0eda430e8 100644
--- a/packages/connect/src/schemas/order_config_request_schema.ts
+++ b/packages/connect/src/schemas/order_config_request_schema.ts
@@ -6,7 +6,7 @@ export const orderConfigRequestSchema = {
takerAddress: { $ref: '/addressSchema' },
makerAssetAmount: { $ref: '/numberSchema' },
takerAssetAmount: { $ref: '/numberSchema' },
- makerAssetData: { $ref: '/hexSchema'},
+ makerAssetData: { $ref: '/hexSchema' },
takerAssetData: { $ref: '/hexSchema' },
exchangeAddress: { $ref: '/addressSchema' },
expirationTimeSeconds: { $ref: '/numberSchema' },
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index dbed8899f..06ae732a5 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -2,7 +2,9 @@ import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export interface Client {
- getAssetPairsAsync: (requestOpts?: AssetPairsRequestOpts & PagedRequestOpts) => Promise<PaginatedCollection<AssetPairsItem>>;
+ 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>;
@@ -28,18 +30,12 @@ export interface OrdersChannelSubscriptionOpts {
}
export interface OrdersChannelHandler {
- onUpdate: (
- channel: OrdersChannel,
- subscriptionOpts: OrdersChannelSubscriptionOpts,
- orders: APIOrder[],
- ) => void;
+ onUpdate: (channel: OrdersChannel, subscriptionOpts: OrdersChannelSubscriptionOpts, orders: APIOrder[]) => void;
onError: (channel: OrdersChannel, err: Error, subscriptionOpts?: OrdersChannelSubscriptionOpts) => void;
onClose: (channel: OrdersChannel) => void;
}
-export type OrdersChannelMessage =
- | UpdateOrdersChannelMessage
- | UnknownOrdersChannelMessage;
+export type OrdersChannelMessage = UpdateOrdersChannelMessage | UnknownOrdersChannelMessage;
export enum OrdersChannelMessageTypes {
Update = 'update',
diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts
index dff854dfb..ebd877b70 100644
--- a/packages/connect/src/utils/relayer_response_json_parsers.ts
+++ b/packages/connect/src/utils/relayer_response_json_parsers.ts
@@ -1,7 +1,14 @@
import { assert } from '@0xproject/assert';
import { schemas } from '@0xproject/json-schemas';
-import { APIOrder, AssetPairsItem, AssetPairsResponse, OrderbookResponse, OrderConfigResponse, OrdersResponse } from '../types';
+import {
+ APIOrder,
+ AssetPairsItem,
+ AssetPairsResponse,
+ OrderbookResponse,
+ OrderConfigResponse,
+ OrdersResponse,
+} from '../types';
import { typeConverters } from './type_converters';
diff --git a/packages/connect/src/ws_orders_channel.ts b/packages/connect/src/ws_orders_channel.ts
index 62960d23a..cde4acbc3 100644
--- a/packages/connect/src/ws_orders_channel.ts
+++ b/packages/connect/src/ws_orders_channel.ts
@@ -2,12 +2,7 @@ import * as _ from 'lodash';
import { v4 as uuid } from 'uuid';
import * as WebSocket from 'websocket';
-import {
- OrdersChannel,
- OrdersChannelHandler,
- OrdersChannelMessageTypes,
- OrdersChannelSubscriptionOpts,
-} from './types';
+import { OrdersChannel, OrdersChannelHandler, OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from './types';
import { assert } from './utils/assert';
import { ordersChannelMessageParser } from './utils/orders_channel_message_parser';