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/http_client.ts | |
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/http_client.ts')
-rw-r--r-- | packages/connect/src/http_client.ts | 41 |
1 files changed, 11 insertions, 30 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 = ''; |