diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-01-10 06:19:33 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-01-10 06:19:33 +0800 |
commit | eb760aa33f0e158b3d26058aa1e9906a1f400a14 (patch) | |
tree | 864f5b616e9efb38b0282ab829871f794df0b0cd /packages/connect/src | |
parent | 262c34abac6a42edf7b6f3c463c9473740281296 (diff) | |
download | dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar.gz dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar.bz2 dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar.lz dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar.xz dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.tar.zst dexon-sol-tools-eb760aa33f0e158b3d26058aa1e9906a1f400a14.zip |
Prettier
Diffstat (limited to 'packages/connect/src')
-rw-r--r-- | packages/connect/src/http_client.ts | 41 | ||||
-rw-r--r-- | packages/connect/src/utils/relayer_response_json_parsers.ts | 13 |
2 files changed, 15 insertions, 39 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index d70e5ace4..5604a9607 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -48,11 +48,7 @@ export class HttpClient implements Client { const requestOpts = { params: request, }; - const responseJson = await this._requestAsync( - '/token_pairs', - HttpRequestType.Get, - requestOpts, - ); + const responseJson = await this._requestAsync('/token_pairs', HttpRequestType.Get, requestOpts); const tokenPairs = relayerResponseJsonParsers.parseTokenPairsJson(responseJson); return tokenPairs; } @@ -68,11 +64,7 @@ export class HttpClient implements Client { const requestOpts = { params: request, }; - const responseJson = await this._requestAsync( - `/orders`, - HttpRequestType.Get, - requestOpts, - ); + const responseJson = await this._requestAsync(`/orders`, HttpRequestType.Get, requestOpts); const orders = relayerResponseJsonParsers.parseOrdersJson(responseJson); return orders; } @@ -83,10 +75,7 @@ export class HttpClient implements Client { */ public async getOrderAsync(orderHash: string): Promise<SignedOrder> { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); - const responseJson = await this._requestAsync( - `/order/${orderHash}`, - HttpRequestType.Get, - ); + const responseJson = await this._requestAsync(`/order/${orderHash}`, HttpRequestType.Get); const order = relayerResponseJsonParsers.parseOrderJson(responseJson); return order; } @@ -100,11 +89,7 @@ export class HttpClient implements Client { const requestOpts = { params: request, }; - const responseJson = await this._requestAsync( - '/orderbook', - HttpRequestType.Get, - requestOpts, - ); + const responseJson = await this._requestAsync('/orderbook', HttpRequestType.Get, requestOpts); const orderbook = relayerResponseJsonParsers.parseOrderbookResponseJson(responseJson); return orderbook; } @@ -118,11 +103,7 @@ export class HttpClient implements Client { const requestOpts = { payload: request, }; - const responseJson = await this._requestAsync( - '/fees', - HttpRequestType.Post, - requestOpts, - ); + const responseJson = await this._requestAsync('/fees', HttpRequestType.Post, requestOpts); const fees = relayerResponseJsonParsers.parseFeesResponseJson(responseJson); return fees; } @@ -135,13 +116,13 @@ export class HttpClient implements Client { const requestOpts = { payload: signedOrder, }; - await this._requestAsync( - '/order', - HttpRequestType.Post, - requestOpts, - ); + await this._requestAsync('/order', HttpRequestType.Post, requestOpts); } - private async _requestAsync(path: string, requestType: HttpRequestType, requestOptions?: HttpRequestOptions): Promise<any> { + private async _requestAsync( + path: string, + requestType: HttpRequestType, + requestOptions?: HttpRequestOptions, + ): Promise<any> { const params = _.get(requestOptions, 'params'); const payload = _.get(requestOptions, 'payload'); let query = ''; diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index 02d88f26d..668461bf4 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -1,15 +1,10 @@ -import {assert} from '@0xproject/assert'; -import {schemas} from '@0xproject/json-schemas'; +import { assert } from '@0xproject/assert'; +import { schemas } from '@0xproject/json-schemas'; import * as _ from 'lodash'; -import { - FeesResponse, - OrderbookResponse, - SignedOrder, - TokenPairsItem, -} from '../types'; +import { FeesResponse, OrderbookResponse, SignedOrder, TokenPairsItem } from '../types'; -import {typeConverters} from './type_converters'; +import { typeConverters } from './type_converters'; export const relayerResponseJsonParsers = { parseTokenPairsJson(json: any): TokenPairsItem[] { |