diff options
Diffstat (limited to 'packages/contract-wrappers')
9 files changed, 74 insertions, 46 deletions
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 2ba6c9f10..bfba8454c 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,5 +1,28 @@ [ { + "version": "5.0.0", + "changes": [ + { + "note": "Renamed OrderStatus enum members to PascalCase to conform with tslint enum-naming rule", + "pr": 1474 + }, + { + "note": "Remove Exchange `matchOrdersAsync` optimization", + "pr": 1514 + } + ], + "timestamp": 1547561734 + }, + { + "timestamp": 1547225310, + "version": "4.2.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "version": "4.2.0", "changes": [ { diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index fe7bb7b81..8281f5050 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v5.0.0 - _January 15, 2019_ + + * Renamed OrderStatus enum members to PascalCase to conform with tslint enum-naming rule (#1474) + * Remove Exchange `matchOrdersAsync` optimization (#1514) + +## v4.2.1 - _January 11, 2019_ + + * Dependencies updated + ## v4.2.0 - _January 9, 2019_ * Added Dutch Auction wrapper (#1465) diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 708b4249a..c4f75a5a4 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contract-wrappers", - "version": "4.2.0", + "version": "5.0.0", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -37,10 +37,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0x/dev-utils": "^1.0.22", - "@0x/migrations": "^2.3.0", - "@0x/subproviders": "^2.1.9", - "@0x/tslint-config": "^2.0.0", + "@0x/dev-utils": "^1.0.24", + "@0x/migrations": "^2.4.0", + "@0x/subproviders": "^2.1.11", + "@0x/tslint-config": "^2.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "*", @@ -65,19 +65,19 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0x/abi-gen-wrappers": "^2.1.0", - "@0x/assert": "^1.0.21", - "@0x/contract-addresses": "^2.1.0", - "@0x/contract-artifacts": "^1.2.0", - "@0x/contracts-test-utils": "^1.0.3", - "@0x/fill-scenarios": "^1.1.0", - "@0x/json-schemas": "^2.1.5", - "@0x/order-utils": "^3.1.0", - "@0x/types": "^1.5.0", - "@0x/typescript-typings": "^3.0.6", - "@0x/utils": "^2.1.1", - "@0x/web3-wrapper": "^3.2.2", - "ethereum-types": "^1.1.4", + "@0x/abi-gen-wrappers": "^2.2.0", + "@0x/assert": "^1.0.23", + "@0x/contract-addresses": "^2.2.0", + "@0x/contract-artifacts": "^1.3.0", + "@0x/contracts-test-utils": "^2.0.0", + "@0x/fill-scenarios": "^1.1.2", + "@0x/json-schemas": "^2.1.7", + "@0x/order-utils": "^3.1.2", + "@0x/types": "^1.5.2", + "@0x/typescript-typings": "^3.0.8", + "@0x/utils": "^3.0.1", + "@0x/web3-wrapper": "^3.2.4", + "ethereum-types": "^1.1.6", "ethereumjs-abi": "0.6.5", "ethereumjs-blockstream": "6.0.0", "ethereumjs-util": "^5.1.1", diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index c9556971a..49193f816 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -743,10 +743,6 @@ export class ExchangeWrapper extends ContractWrapper { rightSignedOrder.takerAssetData !== leftSignedOrder.makerAssetData ) { throw new Error(ExchangeWrapperError.AssetDataMismatch); - } else { - // Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data - rightSignedOrder.makerAssetData = '0x'; - rightSignedOrder.takerAssetData = '0x'; } const exchangeInstance = await this._getExchangeContractAsync(); if (orderTransactionOpts.shouldValidate) { diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 945ca88cd..29cf8b2c4 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -177,13 +177,13 @@ export interface OrderInfo { } export enum OrderStatus { - INVALID = 0, - INVALID_MAKER_ASSET_AMOUNT, - INVALID_TAKER_ASSET_AMOUNT, - FILLABLE, - EXPIRED, - FULLY_FILLED, - CANCELLED, + Invalid = 0, + InvalidMakerAssetAmount, + InvalidTakerAssetAmount, + Fillable, + Expired, + FullyFilled, + Cancelled, } export interface TraderInfo { diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts index 73ce6c743..a1d60dc6e 100644 --- a/packages/contract-wrappers/test/exchange_wrapper_test.ts +++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts @@ -109,7 +109,7 @@ describe('ExchangeWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const orderInfo = await contractWrappers.exchange.getOrderInfoAsync(signedOrder); - expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FullyFilled); }); }); describe('#fillOrKillOrderAsync', () => { @@ -157,7 +157,7 @@ describe('ExchangeWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const orderInfo = await contractWrappers.exchange.getOrderInfoAsync(signedOrder); - expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FullyFilled); }); }); describe('#marketSellOrdersAsync', () => { @@ -183,7 +183,7 @@ describe('ExchangeWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const orderInfo = await contractWrappers.exchange.getOrderInfoAsync(signedOrder); - expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FullyFilled); }); }); describe('#batchFillOrdersNoThrowAsync', () => { @@ -197,9 +197,9 @@ describe('ExchangeWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); let orderInfo = await contractWrappers.exchange.getOrderInfoAsync(signedOrder); - expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FullyFilled); orderInfo = await contractWrappers.exchange.getOrderInfoAsync(anotherSignedOrder); - expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FullyFilled); }); }); describe('#batchFillOrKillOrdersAsync', () => { diff --git a/packages/contract-wrappers/test/forwarder_wrapper_test.ts b/packages/contract-wrappers/test/forwarder_wrapper_test.ts index ff4ff8b67..0d197eced 100644 --- a/packages/contract-wrappers/test/forwarder_wrapper_test.ts +++ b/packages/contract-wrappers/test/forwarder_wrapper_test.ts @@ -97,8 +97,8 @@ describe('ForwarderWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const ordersInfo = await contractWrappers.exchange.getOrdersInfoAsync([signedOrder, anotherSignedOrder]); - expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); - expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); + expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FullyFilled); + expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.FullyFilled); }); it('should throw when invalid transaction and shouldValidate is true', async () => { const signedOrders = [signedOrder]; @@ -131,8 +131,8 @@ describe('ForwarderWrapper', () => { ); await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); const ordersInfo = await contractWrappers.exchange.getOrdersInfoAsync([signedOrder, anotherSignedOrder]); - expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED); - expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.FILLABLE); + expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FullyFilled); + expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.Fillable); expect(ordersInfo[1].orderTakerAssetFilledAmount).to.be.bignumber.equal(new BigNumber(4)); // only 95% of ETH is sold }); it('should throw when invalid transaction and shouldValidate is true', async () => { diff --git a/packages/contract-wrappers/test/order_validator_wrapper_test.ts b/packages/contract-wrappers/test/order_validator_wrapper_test.ts index da3f99e72..c61c05d31 100644 --- a/packages/contract-wrappers/test/order_validator_wrapper_test.ts +++ b/packages/contract-wrappers/test/order_validator_wrapper_test.ts @@ -117,9 +117,9 @@ describe('OrderValidator', () => { it('should return correct on-chain order info for input orders', async () => { const firstOrderInfo = ordersInfo[0]; const secondOrderInfo = ordersInfo[1]; - expect(firstOrderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE); + expect(firstOrderInfo.orderStatus).to.be.equal(OrderStatus.Fillable); expect(firstOrderInfo.orderTakerAssetFilledAmount).to.bignumber.equal(constants.ZERO_AMOUNT); - expect(secondOrderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE); + expect(secondOrderInfo.orderStatus).to.be.equal(OrderStatus.Fillable); expect(secondOrderInfo.orderTakerAssetFilledAmount).to.bignumber.equal(constants.ZERO_AMOUNT); }); it('should return correct on-chain trader info for input takers', async () => { diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts index f8a88637f..e390d2775 100644 --- a/packages/contract-wrappers/test/utils/token_utils.ts +++ b/packages/contract-wrappers/test/utils/token_utils.ts @@ -9,14 +9,14 @@ import { provider, txDefaults, web3Wrapper } from './web3_wrapper'; // Before we were fetching them from the TokenRegistry but now we can't as it's deprecated and removed. // TODO(albrow): Import these from the migrations package instead of hard-coding them. const DUMMY_ERC_20_ADRESSES = [ - '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f', - '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db', - '0xf22469f31527adc53284441bae1665a7b9214dba', - '0x10add991de718a69dec2117cb6aa28098836511b', - '0x8d61158a366019ac78db4149d75fff9dda51160d', + '0x34d402f14d58e001d8efbe6585051bf9706aa064', + '0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3', + '0xcdb594a32b1cc3479d8746279712c39d18a07fc0', + '0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d', + '0xbe0037eaf2d64fe5529bca93c18c9702d3930376', ]; -const DUMMY_ERC_721_ADRESSES = ['0x131855dda0aaff096f6854854c55a4debf61077a']; +const DUMMY_ERC_721_ADRESSES = ['0x07f96aa816c1f244cbc6ef114bb2b023ba54a2eb']; export const tokenUtils = { getDummyERC20TokenAddresses(): string[] { |