From 8fba0477a69317c19b3446c76a17cb3adbf447d7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 20:58:19 +0100 Subject: Remove hash from signatureData --- packages/website/ts/blockchain.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 099efb405..697ff4f10 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -2,6 +2,7 @@ import { BlockParam, BlockRange, DecodedLogEvent, + ECSignature, ExchangeContractEventArgs, ExchangeEvents, IndexedFilterValues, @@ -299,10 +300,9 @@ export class Blockchain { takerFee: BigNumber, expirationUnixTimestampSec: BigNumber, feeRecipient: string, - signatureData: SignatureData, + ecSignature: ECSignature, salt: BigNumber, ): SignedOrder { - const ecSignature = signatureData; const exchangeContractAddress = this.getExchangeContractAddressIfExists(); const takerOrNullAddress = _.isEmpty(taker) ? constants.NULL_ADDRESS : taker; const signedOrder = { @@ -413,7 +413,7 @@ export class Blockchain { return newTokenBalancePromise; } - public async signOrderHashAsync(orderHash: string): Promise { + public async signOrderHashAsync(orderHash: string): Promise { utils.assert(!_.isUndefined(this._zeroEx), 'ZeroEx must be instantiated.'); const makerAddress = this._userAddress; // If makerAddress is undefined, this means they have a web3 instance injected into their browser @@ -436,11 +436,8 @@ export class Blockchain { makerAddress, shouldAddPersonalMessagePrefix, ); - const signatureData = _.extend({}, ecSignature, { - hash: orderHash, - }); - this._dispatcher.updateSignatureData(signatureData); - return signatureData; + this._dispatcher.updateECSignature(ecSignature); + return ecSignature; } public async mintTestTokensAsync(token: Token) { utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses); -- cgit v1.2.3 From 1233c33116a389f34ac90768c5ef43c8bbfbf514 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Feb 2018 16:23:20 +0100 Subject: Address feedback --- packages/website/ts/blockchain.ts | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 697ff4f10..ae79651d5 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -39,7 +39,6 @@ import { ProviderType, Side, SideToAssetToken, - SignatureData, Token, TokenByAddress, } from 'ts/types'; @@ -289,39 +288,6 @@ export class Blockchain { }), ); } - public portalOrderToSignedOrder( - maker: string, - taker: string, - makerTokenAddress: string, - takerTokenAddress: string, - makerTokenAmount: BigNumber, - takerTokenAmount: BigNumber, - makerFee: BigNumber, - takerFee: BigNumber, - expirationUnixTimestampSec: BigNumber, - feeRecipient: string, - ecSignature: ECSignature, - salt: BigNumber, - ): SignedOrder { - const exchangeContractAddress = this.getExchangeContractAddressIfExists(); - const takerOrNullAddress = _.isEmpty(taker) ? constants.NULL_ADDRESS : taker; - const signedOrder = { - ecSignature, - exchangeContractAddress, - expirationUnixTimestampSec, - feeRecipient, - maker, - makerFee, - makerTokenAddress, - makerTokenAmount, - salt, - taker: takerOrNullAddress, - takerFee, - takerTokenAddress, - takerTokenAmount, - }; - return signedOrder; - } public async fillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber): Promise { utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses); -- cgit v1.2.3 From 43cf8d30bdab025cdcda888897d35b25ad455031 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Feb 2018 18:28:54 +0100 Subject: Implement blockchain.portalOrderToZeroExOrder --- packages/website/ts/blockchain.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'packages/website/ts/blockchain.ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index ae79651d5..db3872a32 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -36,6 +36,7 @@ import { BlockchainErrs, ContractInstance, EtherscanLinkSuffixes, + Order as PortalOrder, ProviderType, Side, SideToAssetToken, @@ -288,6 +289,25 @@ export class Blockchain { }), ); } + public portalOrderToZeroExOrder(portalOrder: PortalOrder): SignedOrder { + const exchangeContractAddress = this.getExchangeContractAddressIfExists(); + const zeroExSignedOrder = { + exchangeContractAddress, + maker: portalOrder.signedOrder.maker, + taker: portalOrder.signedOrder.taker, + makerTokenAddress: portalOrder.signedOrder.makerTokenAddress, + takerTokenAddress: portalOrder.signedOrder.takerTokenAddress, + makerTokenAmount: new BigNumber(portalOrder.signedOrder.makerTokenAmount), + takerTokenAmount: new BigNumber(portalOrder.signedOrder.takerTokenAmount), + makerFee: new BigNumber(portalOrder.signedOrder.makerFee), + takerFee: new BigNumber(portalOrder.signedOrder.takerFee), + expirationUnixTimestampSec: new BigNumber(portalOrder.signedOrder.expirationUnixTimestampSec), + feeRecipient: portalOrder.signedOrder.feeRecipient, + ecSignature: portalOrder.signedOrder.ecSignature, + salt: new BigNumber(portalOrder.signedOrder.salt), + }; + return zeroExSignedOrder; + } public async fillOrderAsync(signedOrder: SignedOrder, fillTakerTokenAmount: BigNumber): Promise { utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses); -- cgit v1.2.3