From 44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 20 Aug 2018 11:53:49 -0700 Subject: Run prettier --- packages/connect/src/http_client.ts | 13 ++++++++++--- packages/connect/src/orders_channel_factory.ts | 5 +---- .../connect/src/schemas/order_config_request_schema.ts | 2 +- packages/connect/src/types.ts | 14 +++++--------- .../connect/src/utils/relayer_response_json_parsers.ts | 9 ++++++++- packages/connect/src/ws_orders_channel.ts | 7 +------ .../test/fixtures/standard_relayer_api/fee_recipients.json | 2 +- .../test/fixtures/standard_relayer_api/orderbook.json | 2 +- .../connect/test/fixtures/standard_relayer_api/orders.json | 1 - packages/connect/test/http_client_test.ts | 6 +++--- packages/connect/test/orders_channel_factory_test.ts | 5 +---- .../schemas/relayer_api_fee_recipients_response_schema.ts | 2 +- 12 files changed, 33 insertions(+), 35 deletions(-) (limited to 'packages') 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 { + public async getAssetPairsAsync( + requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts, + ): Promise { 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 { + public async getOrdersAsync( + requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts, + ): Promise { 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 { + public async getOrderConfigAsync( + request: OrderConfigRequest, + requestOpts?: RequestOpts, + ): Promise { 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 { + async createWebSocketOrdersChannelAsync(url: string, handler: OrdersChannelHandler): Promise { assert.isUri('url', url); assert.isOrdersChannelHandler('handler', handler); return new Promise((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>; + getAssetPairsAsync: ( + requestOpts?: AssetPairsRequestOpts & PagedRequestOpts, + ) => Promise>; getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise>; getOrderAsync: (orderHash: string) => Promise; getOrderbookAsync: (request: OrderbookRequest, requestOpts?: PagedRequestOpts) => Promise; @@ -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'; diff --git a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json index 47ce42412..b1d570b03 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json +++ b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.json @@ -7,4 +7,4 @@ "0x9e56625509c2f60af937f23b7b532600390e8c8b", "0xa2b31dacf30a9c50ca473337c01d8a201ae33e32" ] -} \ No newline at end of file +} diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json index b14d12e57..5206c2217 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.json +++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.json @@ -51,4 +51,4 @@ } ] } -} \ No newline at end of file +} diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.json b/packages/connect/test/fixtures/standard_relayer_api/orders.json index e4fb3a3dd..683612071 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orders.json +++ b/packages/connect/test/fixtures/standard_relayer_api/orders.json @@ -24,4 +24,3 @@ } ] } - diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 8b76c4c88..ad1654765 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -109,9 +109,9 @@ describe('HttpClient', () => { }; const url = `${relayUrl}/orderbook`; it('gets orderbook with default page options when none are provided', async () => { - const urlWithQuery = `${url}?baseAssetData=${ - request.baseAssetData - }"eAssetData=${request.quoteAssetData}`; + const urlWithQuery = `${url}?baseAssetData=${request.baseAssetData}"eAssetData=${ + request.quoteAssetData + }`; fetchMock.get(urlWithQuery, orderbookJSON); const orderbook = await relayerClient.getOrderbookAsync(request); expect(orderbook).to.be.deep.equal(orderbookResponse); diff --git a/packages/connect/test/orders_channel_factory_test.ts b/packages/connect/test/orders_channel_factory_test.ts index 58f7e08d9..e4c4ce32f 100644 --- a/packages/connect/test/orders_channel_factory_test.ts +++ b/packages/connect/test/orders_channel_factory_test.ts @@ -20,10 +20,7 @@ describe('ordersChannelFactory', () => { it('throws when input is not a url', () => { const badUrlInput = 54; expect( - ordersChannelFactory.createWebSocketOrdersChannelAsync( - badUrlInput as any, - emptyOrdersChannelHandler, - ), + ordersChannelFactory.createWebSocketOrdersChannelAsync(badUrlInput as any, emptyOrdersChannelHandler), ).to.be.rejected(); }); it('throws when handler has the incorrect members', () => { 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 4c798ff5c..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 @@ -14,4 +14,4 @@ export const relayerApiFeeRecipientsResponseSchema = { required: ['records'], }, ], -}; \ No newline at end of file +}; -- cgit v1.2.3