aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-08 03:58:19 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-08 03:58:19 +0800
commit8fba0477a69317c19b3446c76a17cb3adbf447d7 (patch)
tree7c0cc8f53f1c9e7fe7f5f6d3d1f7b8249edbdaa7 /packages/website/ts/components
parente6f2c7a382e2e7e940f430f350240cb2f703bdcd (diff)
downloaddexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar.gz
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar.bz2
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar.lz
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar.xz
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.tar.zst
dexon-sol-tools-8fba0477a69317c19b3446c76a17cb3adbf447d7.zip
Remove hash from signatureData
Diffstat (limited to 'packages/website/ts/components')
-rw-r--r--packages/website/ts/components/fill_order.tsx11
-rw-r--r--packages/website/ts/components/fill_order_json.tsx5
-rw-r--r--packages/website/ts/components/generate_order/generate_order_form.tsx17
-rw-r--r--packages/website/ts/components/order_json.tsx9
4 files changed, 15 insertions, 27 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index d2c36ff0c..4252747ec 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -404,6 +404,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
private async _validateFillOrderFireAndForgetAsync(orderJSON: string) {
let orderJSONErrMsg = '';
let parsedOrder: Order;
+ let orderHash: string;
try {
const order = JSON.parse(orderJSON);
const validationResult = this._validator.validate(order, orderSchema);
@@ -438,16 +439,13 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
takerTokenAddress: parsedOrder.signedOrder.takerTokenAddress,
takerTokenAmount: takerAmount,
};
- const orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
+ orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
const signature = parsedOrder.signedOrder.ecSignature;
- const isValidSignature = ZeroEx.isValidSignature(signature.hash, signature, parsedOrder.signedOrder.maker);
+ const isValidSignature = ZeroEx.isValidSignature(orderHash, signature, parsedOrder.signedOrder.maker);
if (exchangeContractAddr !== parsedOrder.signedOrder.exchangeContractAddress) {
orderJSONErrMsg = 'This order was made on another network or using a deprecated Exchange contract';
parsedOrder = undefined;
- } else if (orderHash !== signature.hash) {
- orderJSONErrMsg = 'Order hash does not match supplied plaintext values';
- parsedOrder = undefined;
} else if (!isValidSignature) {
orderJSONErrMsg = 'Order signature is invalid';
parsedOrder = undefined;
@@ -477,7 +475,6 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
// Clear cache entry if user updates orderJSON to invalid entry
this.props.dispatcher.updateUserSuppliedOrderCache(undefined);
} else {
- const orderHash = parsedOrder.signedOrder.ecSignature.hash;
unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
const isMakerTokenAddressInRegistry = await this.props.blockchain.isAddressInTokenRegistryAsync(
parsedOrder.signedOrder.makerTokenAddress,
@@ -617,7 +614,6 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
});
const parsedOrder = this.state.parsedOrder;
- const orderHash = parsedOrder.signedOrder.ecSignature.hash;
const takerAddress = this.props.userAddress;
if (_.isUndefined(takerAddress)) {
@@ -645,6 +641,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
parsedOrder.signedOrder.ecSignature,
new BigNumber(parsedOrder.signedOrder.salt),
);
+ const orderHash = ZeroEx.getOrderHashHex(signedOrder);
const unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
const availableTakerTokenAmount = takerTokenAmount.minus(unavailableTakerAmount);
try {
diff --git a/packages/website/ts/components/fill_order_json.tsx b/packages/website/ts/components/fill_order_json.tsx
index 877b65116..7d5351ec4 100644
--- a/packages/website/ts/components/fill_order_json.tsx
+++ b/packages/website/ts/components/fill_order_json.tsx
@@ -33,8 +33,7 @@ export class FillOrderJSON extends React.Component<FillOrderJSONProps, FillOrder
},
};
const hintOrderExpiryTimestamp = utils.initialOrderExpiryUnixTimestampSec();
- const hintSignatureData = {
- hash: '0xf965a9978a0381ab58f5a2408ad967c...',
+ const hintECSignature = {
r: '0xf01103f759e2289a28593eaf22e5820032...',
s: '937862111edcba395f8a9e0cc1b2c5e12320...',
v: 27,
@@ -50,7 +49,7 @@ export class FillOrderJSON extends React.Component<FillOrderJSONProps, FillOrder
constants.MAKER_FEE,
constants.TAKER_FEE,
feeRecipient,
- hintSignatureData,
+ hintECSignature,
this.props.tokenByAddress,
hintSalt,
);
diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx
index 6fe0fa4f3..5f1cf3c8e 100644
--- a/packages/website/ts/components/generate_order/generate_order_form.tsx
+++ b/packages/website/ts/components/generate_order/generate_order_form.tsx
@@ -1,4 +1,4 @@
-import { Order, ZeroEx } from '0x.js';
+import { ECSignature, Order, ZeroEx } from '0x.js';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
@@ -19,16 +19,7 @@ import { SwapIcon } from 'ts/components/ui/swap_icon';
import { Dispatcher } from 'ts/redux/dispatcher';
import { orderSchema } from 'ts/schemas/order_schema';
import { SchemaValidator } from 'ts/schemas/validator';
-import {
- AlertTypes,
- BlockchainErrs,
- HashData,
- Side,
- SideToAssetToken,
- SignatureData,
- Token,
- TokenByAddress,
-} from 'ts/types';
+import { AlertTypes, BlockchainErrs, HashData, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types';
import { colors } from 'ts/utils/colors';
import { constants } from 'ts/utils/constants';
import { errorReporter } from 'ts/utils/error_reporter';
@@ -49,7 +40,7 @@ interface GenerateOrderFormProps {
orderExpiryTimestamp: BigNumber;
networkId: number;
userAddress: string;
- orderSignatureData: SignatureData;
+ orderECSignature: ECSignature;
orderTakerAddress: string;
orderSalt: BigNumber;
sideToAssetToken: SideToAssetToken;
@@ -209,7 +200,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
<OrderJSON
exchangeContractIfExists={exchangeContractIfExists}
orderExpiryTimestamp={this.props.orderExpiryTimestamp}
- orderSignatureData={this.props.orderSignatureData}
+ orderECSignature={this.props.orderECSignature}
orderTakerAddress={this.props.orderTakerAddress}
orderMakerAddress={this.props.userAddress}
orderSalt={this.props.orderSalt}
diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx
index a908f2895..a5dd9ebc1 100644
--- a/packages/website/ts/components/order_json.tsx
+++ b/packages/website/ts/components/order_json.tsx
@@ -1,10 +1,11 @@
+import { ECSignature } from '0x.js';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import * as React from 'react';
import { CopyIcon } from 'ts/components/ui/copy_icon';
-import { SideToAssetToken, SignatureData, TokenByAddress, WebsitePaths } from 'ts/types';
+import { SideToAssetToken, TokenByAddress, WebsitePaths } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { errorReporter } from 'ts/utils/error_reporter';
@@ -13,7 +14,7 @@ import { utils } from 'ts/utils/utils';
interface OrderJSONProps {
exchangeContractIfExists: string;
orderExpiryTimestamp: BigNumber;
- orderSignatureData: SignatureData;
+ orderECSignature: ECSignature;
orderTakerAddress: string;
orderMakerAddress: string;
orderSalt: BigNumber;
@@ -47,7 +48,7 @@ export class OrderJSON extends React.Component<OrderJSONProps, OrderJSONState> {
this.props.orderMakerFee,
this.props.orderTakerFee,
this.props.orderFeeRecipient,
- this.props.orderSignatureData,
+ this.props.orderECSignature,
this.props.tokenByAddress,
this.props.orderSalt,
);
@@ -168,7 +169,7 @@ You can see and fill it here: ${this.state.shareLink}`);
this.props.orderMakerFee,
this.props.orderTakerFee,
this.props.orderFeeRecipient,
- this.props.orderSignatureData,
+ this.props.orderECSignature,
this.props.tokenByAddress,
this.props.orderSalt,
);