From c325d638c98a990f2d0e991f2e03287183ba292f Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 15 Aug 2018 17:18:19 -0700 Subject: getAssetPairsAsync tests passing --- packages/connect/src/http_client.ts | 2 +- .../connect/src/schemas/asset_pairs_request_opts_schema.ts | 4 ++-- packages/connect/src/utils/relayer_response_json_parsers.ts | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'packages/connect/src') diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index e8b82f0b2..35d7ee77e 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -70,7 +70,7 @@ export class HttpClient implements Client { const httpRequestOpts = { params: _.defaults({}, requestOpts, DEFAULT_PAGED_REQUEST_OPTS), }; - const responseJson = await this._requestAsync('/assetData_pairs', HttpRequestType.Get, httpRequestOpts); + const responseJson = await this._requestAsync('/asset_pairs', HttpRequestType.Get, httpRequestOpts); const assetDataPairs = relayerResponseJsonParsers.parseAssetDataPairsJson(responseJson); return assetDataPairs; } diff --git a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts index f224503cc..a9e3942a4 100644 --- a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts +++ b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts @@ -2,7 +2,7 @@ export const assetPairsRequestOptsSchema = { id: '/AssetPairsRequestOpts', type: 'object', properties: { - assetDataA: { $ref: '/Address' }, - assetDataB: { $ref: '/Address' }, + assetDataA: { $ref: '/hexSchema' }, + assetDataB: { $ref: '/hexSchema' }, }, }; diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index 9a17b23d3..37099384f 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -7,10 +7,10 @@ import { typeConverters } from './type_converters'; export const relayerResponseJsonParsers = { parseAssetDataPairsJson(json: any): AssetPairsResponse { - assert.doesConformToSchema('assetDataPairs', json, schemas.relayerApiAssetDataPairsResponseSchema); - return { ...json, records: relayerResponseJsonParsers.parseAssetDataPairsJson(json.records) }; + assert.doesConformToSchema('assetDataPairsResponse', json, schemas.relayerApiAssetDataPairsResponseSchema); + return { ...json, records: relayerResponseJsonParsers.parseAssetPairsItemsJson(json.records) }; }, - parseAssetPairsItemJson(json: any): AssetPairsItem[] { + parseAssetPairsItemsJson(json: any): AssetPairsItem[] { return json.map((assetDataPair: any) => { return typeConverters.convertStringsFieldsToBigNumbers(assetDataPair, [ 'assetDataA.minAmount', @@ -29,11 +29,11 @@ export const relayerResponseJsonParsers = { return typeConverters.convertOrderStringFieldsToBigNumber(json); }, parseOrderbookResponseJson(json: any): OrderbookResponse { - assert.doesConformToSchema('orderBook', json, schemas.relayerApiOrderbookResponseSchema); + assert.doesConformToSchema('orderBookResponse', json, schemas.relayerApiOrderbookResponseSchema); return typeConverters.convertOrderbookStringFieldsToBigNumber(json); }, parseOrderConfigResponseJson(json: any): OrderConfigResponse { - assert.doesConformToSchema('orderConfig', json, schemas.relayerApiOrderConfigResponseSchema); + assert.doesConformToSchema('orderConfigResponse', json, schemas.relayerApiOrderConfigResponseSchema); return typeConverters.convertStringsFieldsToBigNumbers(json, ['makerFee', 'takerFee']); }, }; -- cgit v1.2.3