diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-30 14:41:09 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-31 04:36:44 +0800 |
commit | 660e670d381316f412e706a9d7ced66b6c48c18c (patch) | |
tree | 375ae8edf3aba7f6e04a407cccd88685c369901f /packages/website/ts/components/fill_order.tsx | |
parent | 052824f4e30c6dce63f3b57591d0a5727c0bd4c2 (diff) | |
download | dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar.gz dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar.bz2 dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar.lz dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar.xz dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.tar.zst dexon-0x-contracts-660e670d381316f412e706a9d7ced66b6c48c18c.zip |
Update generate and fill order flows
Diffstat (limited to 'packages/website/ts/components/fill_order.tsx')
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 60eccff34..f24d065f4 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -26,6 +26,7 @@ import { AlertTypes, BlockchainErrs, PortalOrder, Token, TokenByAddress, Website import { analytics } from 'ts/utils/analytics'; import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; +import { orderParser } from 'ts/utils/order_parser'; import { utils } from 'ts/utils/utils'; interface FillOrderProps { @@ -418,7 +419,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { let parsedOrder: PortalOrder; let orderHash: string; try { - const order = JSON.parse(orderJSON); + const order = orderParser.parseJsonString(orderJSON); const validationResult = validator.validate(order, portalOrderSchema); if (validationResult.errors.length > 0) { orderJSONErrMsg = 'Submitted order JSON is not a valid order'; @@ -427,28 +428,12 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } parsedOrder = order; const signedOrder = parsedOrder.signedOrder; - const zeroExOrder: ZeroExOrder = { - exchangeAddress: signedOrder.exchangeAddress, - expirationTimeSeconds: signedOrder.expirationTimeSeconds, - feeRecipientAddress: signedOrder.feeRecipientAddress, - makerAddress: signedOrder.makerAddress, - makerFee: signedOrder.makerFee, - makerAssetData: signedOrder.makerAssetData, - makerAssetAmount: signedOrder.makerAssetAmount, - salt: signedOrder.salt, - takerAddress: _.isEmpty(signedOrder.takerAddress) ? constants.NULL_ADDRESS : signedOrder.takerAddress, - takerFee: signedOrder.takerFee, - takerAssetData: signedOrder.takerAssetData, - takerAssetAmount: signedOrder.takerAssetAmount, - senderAddress: signedOrder.senderAddress, - }; - orderHash = orderHashUtils.getOrderHashHex(zeroExOrder); + orderHash = orderHashUtils.getOrderHashHex(signedOrder); const exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists(); const signature = signedOrder.signature; - const ecSignature = signatureUtils.parseECSignature(signature); - const isSignatureValid = signatureUtils.isValidECSignature( + const isSignatureValid = await this.props.blockchain.isValidSignatureAsync( orderHash, - ecSignature, + signature, signedOrder.makerAddress, ); if (exchangeContractAddr !== signedOrder.exchangeAddress) { @@ -500,6 +485,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { }); } + console.log(parsedOrder); this.setState({ didOrderValidationRun: true, orderJSON, |