diff options
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; }, |