diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 22:09:06 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 22:09:06 +0800 |
commit | 223df8006a30a95db544a2af080224a4d9d2d474 (patch) | |
tree | 6b995cab8326ab91e4b347fad8caeaf96357665c /packages/website/ts | |
parent | 1c9428cbba873fe8d5bd18b2cb10522cbdb17a3f (diff) | |
download | dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar.gz dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar.bz2 dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar.lz dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar.xz dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.tar.zst dexon-sol-tools-223df8006a30a95db544a2af080224a4d9d2d474.zip |
Move .taker.amount to .takerTokenAmount and .maker.amount to .makerTokenAmount
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 24 | ||||
-rw-r--r-- | packages/website/ts/schemas/order_schema.ts | 4 | ||||
-rw-r--r-- | packages/website/ts/schemas/order_taker_schema.ts | 3 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 3 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 4 |
5 files changed, 21 insertions, 17 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 7cef247a3..06a7932f6 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -184,8 +184,8 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { private _renderVisualOrder() { const takerTokenAddress = this.state.parsedOrder.taker.token.address; const takerToken = this.props.tokenByAddress[takerTokenAddress]; - const orderTakerAmount = new BigNumber(this.state.parsedOrder.taker.amount); - const orderMakerAmount = new BigNumber(this.state.parsedOrder.maker.amount); + const orderTakerAmount = new BigNumber(this.state.parsedOrder.takerTokenAmount); + const orderMakerAmount = new BigNumber(this.state.parsedOrder.makerTokenAmount); const takerAssetToken = { amount: orderTakerAmount.minus(this.state.unavailableTakerAmount), symbol: takerToken.symbol, @@ -414,8 +414,8 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { parsedOrder = order; const exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists(); - const makerAmount = new BigNumber(parsedOrder.maker.amount); - const takerAmount = new BigNumber(parsedOrder.taker.amount); + const makerAmount = new BigNumber(parsedOrder.makerTokenAmount); + const takerAmount = new BigNumber(parsedOrder.takerTokenAmount); const expiration = new BigNumber(parsedOrder.expirationUnixTimestampSec); const salt = new BigNumber(parsedOrder.salt); const parsedMakerFee = new BigNumber(parsedOrder.makerFee); @@ -534,8 +534,8 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { parsedOrder.taker.address, parsedOrder.maker.token.address, parsedOrder.taker.token.address, - new BigNumber(parsedOrder.maker.amount), - new BigNumber(parsedOrder.taker.amount), + new BigNumber(parsedOrder.makerTokenAmount), + new BigNumber(parsedOrder.takerTokenAmount), new BigNumber(parsedOrder.makerFee), new BigNumber(parsedOrder.takerFee), new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec), @@ -572,7 +572,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { category: 'Portal', action: 'Fill Order Success', label: eventLabel, - value: parsedOrder.taker.amount, + value: parsedOrder.takerTokenAmount, }); // After fill completes, let's force fetch the token balances this.props.dispatcher.forceTokenStateRefetch(); @@ -591,7 +591,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { category: 'Portal', action: 'Fill Order Failure', label: eventLabel, - value: parsedOrder.taker.amount, + value: parsedOrder.takerTokenAmount, }); const errMsg = `${err}`; if (utils.didUserDenyWeb3Request(errMsg)) { @@ -630,14 +630,14 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } let globalErrMsg = ''; - const takerTokenAmount = new BigNumber(parsedOrder.taker.amount); + const takerTokenAmount = new BigNumber(parsedOrder.takerTokenAmount); const signedOrder = this.props.blockchain.portalOrderToSignedOrder( parsedOrder.maker.address, parsedOrder.taker.address, parsedOrder.maker.token.address, parsedOrder.taker.token.address, - new BigNumber(parsedOrder.maker.amount), + new BigNumber(parsedOrder.makerTokenAmount), takerTokenAmount, new BigNumber(parsedOrder.makerFee), new BigNumber(parsedOrder.takerFee), @@ -674,7 +674,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { category: 'Portal', action: 'Cancel Order Success', label: eventLabel, - value: parsedOrder.maker.amount, + value: parsedOrder.makerTokenAmount, }); return; } catch (err) { @@ -689,7 +689,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { category: 'Portal', action: 'Cancel Order Failure', label: eventLabel, - value: parsedOrder.maker.amount, + value: parsedOrder.makerTokenAmount, }); globalErrMsg = 'Failed to cancel order, please refresh and try again'; utils.consoleLog(`${err}`); diff --git a/packages/website/ts/schemas/order_schema.ts b/packages/website/ts/schemas/order_schema.ts index e69891df1..ccf4af671 100644 --- a/packages/website/ts/schemas/order_schema.ts +++ b/packages/website/ts/schemas/order_schema.ts @@ -5,6 +5,8 @@ export const orderSchema = { taker: { $ref: '/OrderTaker' }, makerFee: { type: 'string' }, takerFee: { type: 'string' }, + makerTokenAmount: { type: 'string' }, + takerTokenAmount: { type: 'string' }, salt: { type: 'string' }, ecSignature: { $ref: '/SignatureData' }, expirationUnixTimestampSec: { type: 'string' }, @@ -17,6 +19,8 @@ export const orderSchema = { 'taker', 'makerFee', 'takerFee', + 'makerTokenAmount', + 'takerTokenAmount', 'salt', 'ecSignature', 'expirationUnixTimestampSec', diff --git a/packages/website/ts/schemas/order_taker_schema.ts b/packages/website/ts/schemas/order_taker_schema.ts index c8d56a417..bce71f74b 100644 --- a/packages/website/ts/schemas/order_taker_schema.ts +++ b/packages/website/ts/schemas/order_taker_schema.ts @@ -3,8 +3,7 @@ export const orderTakerSchema = { properties: { address: { type: 'string' }, token: { $ref: '/Token' }, - amount: { type: 'string' }, }, - required: ['address', 'token', 'amount'], + required: ['address', 'token'], type: 'object', }; diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 28822d484..823f6f785 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -83,7 +83,6 @@ export interface Order { export interface SerializedOrderParty { address: string; token: OrderToken; - amount: string; } export interface SerializedOrder { @@ -91,6 +90,8 @@ export interface SerializedOrder { taker: SerializedOrderParty; makerFee: string; takerFee: string; + makerTokenAmount: string; + takerTokenAmount: string; expirationUnixTimestampSec: string; feeRecipient: string; salt: string; diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index b615ba646..cc0689868 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -77,6 +77,8 @@ export const utils = { const order = { makerFee: makerFee.toString(), takerFee: takerFee.toString(), + makerTokenAmount: sideToAssetToken[Side.Deposit].amount.toString(), + takerTokenAmount: sideToAssetToken[Side.Receive].amount.toString(), maker: { address: orderMakerAddress, token: { @@ -85,7 +87,6 @@ export const utils = { decimals: makerToken.decimals, address: makerToken.address, }, - amount: sideToAssetToken[Side.Deposit].amount.toString(), }, taker: { address: orderTakerAddress, @@ -95,7 +96,6 @@ export const utils = { decimals: takerToken.decimals, address: takerToken.address, }, - amount: sideToAssetToken[Side.Receive].amount.toString(), }, expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, |