aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-30 14:41:09 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-31 04:36:44 +0800
commit660e670d381316f412e706a9d7ced66b6c48c18c (patch)
tree375ae8edf3aba7f6e04a407cccd88685c369901f /packages/website/ts/utils
parent052824f4e30c6dce63f3b57591d0a5727c0bd4c2 (diff)
downloaddexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar.gz
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar.bz2
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar.lz
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar.xz
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.tar.zst
dexon-sol-tools-660e670d381316f412e706a9d7ced66b6c48c18c.zip
Update generate and fill order flows
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/order_parser.ts19
-rw-r--r--packages/website/ts/utils/utils.ts2
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';