diff options
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r-- | packages/website/ts/utils/order_parser.ts | 19 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/packages/website/ts/utils/order_parser.ts b/packages/website/ts/utils/order_parser.ts index e542bb484..2e1d4d2f2 100644 --- a/packages/website/ts/utils/order_parser.ts +++ b/packages/website/ts/utils/order_parser.ts @@ -6,7 +6,7 @@ import { validator } from 'ts/schemas/validator'; import { PortalOrder } from 'ts/types'; export const orderParser = { - parse(queryString: string): PortalOrder | undefined { + parseQueryString(queryString: string): PortalOrder | undefined { if (queryString.length === 0) { return undefined; } @@ -28,7 +28,22 @@ export const orderParser = { logUtils.log(`Invalid shared order: ${validationResult.errors}`); return undefined; } - const result = convertOrderStringFieldsToBigNumber(order); + const signedOrder = _.get(order, 'signedOrder'); + const convertedSignedOrder = convertOrderStringFieldsToBigNumber(signedOrder); + const result = { + ...order, + signedOrder: convertedSignedOrder, + }; + return result; + }, + parseJsonString(orderJson: string): PortalOrder { + const order = JSON.parse(orderJson); + const signedOrder = _.get(order, 'signedOrder'); + const convertedSignedOrder = convertOrderStringFieldsToBigNumber(signedOrder); + const result = { + ...order, + signedOrder: convertedSignedOrder, + }; return result; }, }; diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index ab9852d16..eda0e513d 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -1,5 +1,5 @@ import { ContractWrappersError } from '@0xproject/contract-wrappers'; -import { assetDataUtils, OrderError, signatureUtils } from '@0xproject/order-utils'; +import { assetDataUtils, OrderError } from '@0xproject/order-utils'; import { constants as sharedConstants, Networks } from '@0xproject/react-shared'; import { ECSignature, ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; |