diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-16 08:31:39 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-16 08:31:39 +0800 |
commit | 1c87e5f69809954add5e76de520e8ef4f405c1c0 (patch) | |
tree | f3c5dbb8cfb13d06822fb26dd6bbfbaa411ed853 /packages/connect/src | |
parent | c325d638c98a990f2d0e991f2e03287183ba292f (diff) | |
download | dexon-0x-contracts-1c87e5f69809954add5e76de520e8ef4f405c1c0.tar.gz dexon-0x-contracts-1c87e5f69809954add5e76de520e8ef4f405c1c0.tar.zst dexon-0x-contracts-1c87e5f69809954add5e76de520e8ef4f405c1c0.zip |
Get orders async tests passing
Diffstat (limited to 'packages/connect/src')
-rw-r--r-- | packages/connect/src/utils/relayer_response_json_parsers.ts | 2 | ||||
-rw-r--r-- | packages/connect/src/utils/type_converters.ts | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index 37099384f..2b2e1efe7 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -26,7 +26,7 @@ export const relayerResponseJsonParsers = { }, parseAPIOrderJson(json: any): APIOrder { assert.doesConformToSchema('relayerApiOrder', json, schemas.relayerApiOrderSchema); - return typeConverters.convertOrderStringFieldsToBigNumber(json); + return typeConverters.convertAPIOrderStringFieldsToBigNumber(json); }, parseOrderbookResponseJson(json: any): OrderbookResponse { assert.doesConformToSchema('orderBookResponse', json, schemas.relayerApiOrderbookResponseSchema); diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts index c28cba0e1..4b211a0b2 100644 --- a/packages/connect/src/utils/type_converters.ts +++ b/packages/connect/src/utils/type_converters.ts @@ -36,7 +36,12 @@ export const typeConverters = { convertStringsFieldsToBigNumbers(obj: any, fields: string[]): any { const result = _.assign({}, obj); _.each(fields, field => { - _.update(result, field, (value: string) => new BigNumber(value)); + _.update(result, field, (value: string) => { + if (_.isUndefined(value)) { + throw new Error(`Could not find field '${field}' while converting string fields to BigNumber.`); + } + return new BigNumber(value); + }); }); return result; }, |