aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-11-15 01:29:46 +0800
committerBrandon Millman <brandon.millman@gmail.com>2017-11-15 01:29:46 +0800
commit9bb5e6f5ce199acde620a0fb8f36f585e1c763e9 (patch)
tree125f6d75b0e664208d5fef11694d9e982a932c45
parent56b5619d24b44d23f770b58b0c9e1d4a63b89aca (diff)
parent05de07496fe3f9089b4c96b0594b234afc436304 (diff)
downloaddexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.gz
dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.tar.zst
dexon-sol-tools-9bb5e6f5ce199acde620a0fb8f36f585e1c763e9.zip
Merge branch 'development' into feature/addJsonSchemas
* development: Improve description Alphabetize Add exit 0 to 0x.js build command Add snapshot save and revert to order_state_watcher_test.ts Fix changelog Use tslint v5.8.0 everywhere and use the tslint-config sub-package instead of the old repo as a dep. in the rest of the sub-packages. Add tslint-config sub-package Fix tslint issue Public interface has changed, moved to minor version Update changelog Renamed canceled to cancelled
-rw-r--r--packages/0x.js/CHANGELOG.md9
-rw-r--r--packages/0x.js/package.json9
-rw-r--r--packages/0x.js/src/contract_wrappers/exchange_wrapper.ts4
-rw-r--r--packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts2
-rw-r--r--packages/0x.js/src/types.ts2
-rw-r--r--packages/0x.js/src/utils/abi_decoder.ts2
-rw-r--r--packages/0x.js/src/utils/order_state_utils.ts6
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts16
-rw-r--r--packages/0x.js/test/order_state_watcher_test.ts8
-rw-r--r--packages/0x.js/tslint.json2
-rw-r--r--packages/assert/package.json4
-rw-r--r--packages/tslint-config/README.md4
-rw-r--r--packages/tslint-config/package.json38
-rw-r--r--packages/tslint-config/tslint.json53
-rw-r--r--yarn.lock27
15 files changed, 146 insertions, 40 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 029144b5a..a9362151c 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -1,5 +1,14 @@
# CHANGELOG
+v0.24.0 - _November 13, 2017_
+------------------------
+ * Standardise on Cancelled over Canceled
+
+v0.23.0 - _November 12, 2017_
+------------------------
+ * Fixed unhandled promise rejection error in subscribe methods (#209)
+ * Subscribe callbacks now receive an error object as their first argument
+
v0.22.6 - _November 10, 2017_
------------------------
* Add a timeout parameter to transaction awaiting (#206)
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 3aa9ef408..26bde76f9 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -13,7 +13,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"prebuild": "npm run clean",
- "build": "run-p build:umd:prod build:commonjs",
+ "build": "run-p build:umd:prod build:commonjs; exit 0;",
"prepublishOnly": "run-p build",
"postpublish": "run-s release docs:json upload_docs_json",
"release": "publish-release --assets _bundles/index.js,_bundles/index.min.js --tag $(git describe --tags) --owner 0xProject --repo 0x.js",
@@ -76,20 +76,20 @@
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"truffle-hdwallet-provider": "^0.0.3",
- "tslint": "~5.5.0",
- "tslint-config-0xproject": "^0.0.2",
"typedoc": "~0.8.0",
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
"typescript": "~2.6.1",
"web3-provider-engine": "^13.0.1",
"web3-typescript-typings": "^0.7.1",
- "webpack": "^3.1.0"
+ "webpack": "^3.1.0",
+ "@0xproject/tslint-config": "0.0.2"
},
"dependencies": {
"@0xproject/assert": "0.0.3",
"@0xproject/json-schemas": "0.6.6",
"bignumber.js": "~4.1.0",
+ "bn.js": "4.11.8",
"compare-versions": "^3.0.1",
"es6-promisify": "^5.0.0",
"ethereumjs-abi": "^0.6.4",
@@ -99,6 +99,7 @@
"js-sha3": "^0.6.1",
"lodash": "^4.17.4",
"publish-release": "^1.3.3",
+ "tslint": "5.8.0",
"uuid": "^3.1.0",
"web3": "^0.20.0"
}
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
index ef3cc0b16..3e631b73e 100644
--- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
@@ -95,7 +95,7 @@ export class ExchangeWrapper extends ContractWrapper {
* @param orderHash The hex encoded orderHash for which you would like to retrieve the
* unavailable takerAmount.
* @param methodOpts Optional arguments this method accepts.
- * @return The amount of the order (in taker tokens) that has either been filled or canceled.
+ * @return The amount of the order (in taker tokens) that has either been filled or cancelled.
*/
public async getUnavailableTakerAmountAsync(orderHash: string,
methodOpts?: MethodOpts): Promise<BigNumber> {
@@ -133,7 +133,7 @@ export class ExchangeWrapper extends ContractWrapper {
* @param methodOpts Optional arguments this method accepts.
* @return The amount of the order (in taker tokens) that has been cancelled.
*/
- public async getCanceledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber> {
+ public async getCancelledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber> {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const exchangeContract = await this._getExchangeContractAsync();
diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
index 9d74da096..666d8363c 100644
--- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
+++ b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
@@ -42,7 +42,7 @@ export class OrderFilledCancelledLazyStore {
const methodOpts = {
defaultBlock: BlockParamLiteral.Pending,
};
- const cancelledTakerAmount = await this.exchange.getCanceledTakerAmountAsync(orderHash, methodOpts);
+ const cancelledTakerAmount = await this.exchange.getCancelledTakerAmountAsync(orderHash, methodOpts);
this.setCancelledTakerAmount(orderHash, cancelledTakerAmount);
}
const cachedCancelled = this.cancelledTakerAmount[orderHash];
diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts
index 11683378f..11b5d8569 100644
--- a/packages/0x.js/src/types.ts
+++ b/packages/0x.js/src/types.ts
@@ -488,7 +488,7 @@ export interface OrderRelevantState {
makerFeeBalance: BigNumber;
makerFeeProxyAllowance: BigNumber;
filledTakerTokenAmount: BigNumber;
- canceledTakerTokenAmount: BigNumber;
+ cancelledTakerTokenAmount: BigNumber;
remainingFillableMakerTokenAmount: BigNumber;
}
diff --git a/packages/0x.js/src/utils/abi_decoder.ts b/packages/0x.js/src/utils/abi_decoder.ts
index 840ad9be0..df0fb2d6f 100644
--- a/packages/0x.js/src/utils/abi_decoder.ts
+++ b/packages/0x.js/src/utils/abi_decoder.ts
@@ -34,7 +34,7 @@ export class AbiDecoder {
value = this.padZeros(new BigNumber(value).toString(16));
} else if (param.type === SolidityTypes.Uint256 ||
param.type === SolidityTypes.Uint8 ||
- param.type === SolidityTypes.Uint ) {
+ param.type === SolidityTypes.Uint) {
value = new BigNumber(value);
}
decodedParams[param.name] = value;
diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts
index f82601cae..a1ee7577d 100644
--- a/packages/0x.js/src/utils/order_state_utils.ts
+++ b/packages/0x.js/src/utils/order_state_utils.ts
@@ -67,7 +67,7 @@ export class OrderStateUtils {
zrxTokenAddress, signedOrder.maker,
);
const filledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getFilledTakerAmountAsync(orderHash);
- const canceledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getCancelledTakerAmountAsync(
+ const cancelledTakerTokenAmount = await this.orderFilledCancelledLazyStore.getCancelledTakerAmountAsync(
orderHash,
);
const unavailableTakerTokenAmount = await exchange.getUnavailableTakerAmountAsync(orderHash);
@@ -85,13 +85,13 @@ export class OrderStateUtils {
makerFeeBalance,
makerFeeProxyAllowance,
filledTakerTokenAmount,
- canceledTakerTokenAmount,
+ cancelledTakerTokenAmount,
remainingFillableMakerTokenAmount,
};
return orderRelevantState;
}
private validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void {
- const unavailableTakerTokenAmount = orderRelevantState.canceledTakerTokenAmount.add(
+ const unavailableTakerTokenAmount = orderRelevantState.cancelledTakerTokenAmount.add(
orderRelevantState.filledTakerTokenAmount,
);
const availableTakerTokenAmount = signedOrder.takerTokenAmount.minus(unavailableTakerTokenAmount);
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index 26b8c1e0e..add89a3b2 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -443,7 +443,7 @@ describe('ExchangeWrapper', () => {
it('should cancel an order', async () => {
const txHash = await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount);
await zeroEx.awaitTransactionMinedAsync(txHash);
- const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex);
+ const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex);
expect(cancelledAmount).to.be.bignumber.equal(cancelAmount);
});
});
@@ -502,8 +502,8 @@ describe('ExchangeWrapper', () => {
describe('successful batch cancels', () => {
it('should cancel a batch of orders', async () => {
await zeroEx.exchange.batchCancelOrdersAsync(cancelBatch);
- const cancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHashHex);
- const anotherCancelledAmount = await zeroEx.exchange.getCanceledTakerAmountAsync(
+ const cancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHashHex);
+ const anotherCancelledAmount = await zeroEx.exchange.getCancelledTakerAmountAsync(
anotherOrderHashHex,
);
expect(cancelledAmount).to.be.bignumber.equal(cancelAmount);
@@ -592,23 +592,23 @@ describe('ExchangeWrapper', () => {
expect(filledValueT).to.be.bignumber.equal(partialFillAmount);
});
});
- describe('#getCanceledTakerAmountAsync', () => {
+ describe('#getCancelledTakerAmountAsync', () => {
it('should throw if passed an invalid orderHash', async () => {
const invalidOrderHashHex = '0x123';
- return expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected();
+ return expect(zeroEx.exchange.getCancelledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected();
});
it('should return zero if passed a valid but non-existent orderHash', async () => {
- const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(NON_EXISTENT_ORDER_HASH);
+ const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(NON_EXISTENT_ORDER_HASH);
expect(cancelledValueT).to.be.bignumber.equal(0);
});
it('should return the cancelledValueT for a valid and partially filled orderHash', async () => {
- const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash);
+ const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash);
expect(cancelledValueT).to.be.bignumber.equal(0);
});
it('should return the cancelledValueT for a valid and cancelled orderHash', async () => {
const cancelAmount = fillableAmount.minus(partialFillAmount);
await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount);
- const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash);
+ const cancelledValueT = await zeroEx.exchange.getCancelledTakerAmountAsync(orderHash);
expect(cancelledValueT).to.be.bignumber.equal(cancelAmount);
});
});
diff --git a/packages/0x.js/test/order_state_watcher_test.ts b/packages/0x.js/test/order_state_watcher_test.ts
index c8a4a8064..810168aca 100644
--- a/packages/0x.js/test/order_state_watcher_test.ts
+++ b/packages/0x.js/test/order_state_watcher_test.ts
@@ -61,6 +61,12 @@ describe('OrderStateWatcher', () => {
[makerToken, takerToken] = tokenUtils.getNonProtocolTokens();
web3Wrapper = (zeroEx as any)._web3Wrapper;
});
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
describe('#removeOrder', async () => {
it('should successfully remove existing order', async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
@@ -345,7 +351,7 @@ describe('OrderStateWatcher', () => {
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
- expect(orderRelevantState.canceledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits);
+ expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits);
done();
});
zeroEx.orderStateWatcher.subscribe(callback);
diff --git a/packages/0x.js/tslint.json b/packages/0x.js/tslint.json
index 5842a872a..a07795151 100644
--- a/packages/0x.js/tslint.json
+++ b/packages/0x.js/tslint.json
@@ -1,5 +1,5 @@
{
"extends": [
- "tslint-config-0xproject"
+ "@0xproject/tslint-config"
]
}
diff --git a/packages/assert/package.json b/packages/assert/package.json
index 51b88f58b..d82ce19e4 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -24,6 +24,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/assert/README.md",
"devDependencies": {
+ "@0xproject/tslint-config": "0.0.2",
"@types/lodash": "^4.14.78",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
@@ -33,8 +34,7 @@
"mocha": "^4.0.1",
"npm-run-all": "^4.1.1",
"shx": "^0.2.2",
- "tslint": "~5.5.0",
- "tslint-config-0xproject": "^0.0.2",
+ "tslint": "5.8.0",
"typescript": "^2.4.2"
},
"dependencies": {
diff --git a/packages/tslint-config/README.md b/packages/tslint-config/README.md
new file mode 100644
index 000000000..d8bb0a51e
--- /dev/null
+++ b/packages/tslint-config/README.md
@@ -0,0 +1,4 @@
+tslint-config
+-----------------------
+
+Lint rules related to 0xProject for TSLint.
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
new file mode 100644
index 000000000..a0a925e91
--- /dev/null
+++ b/packages/tslint-config/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "@0xproject/tslint-config",
+ "version": "0.0.2",
+ "description": "Lint rules related to 0xProject for TSLint",
+ "main": "tslint.json",
+ "files": [
+ "tslint.js",
+ "README.md",
+ "LICENSE"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/0xProject/0x.js.git"
+ },
+ "keywords": [
+ "tslint",
+ "config",
+ "0xProject",
+ "typescript",
+ "ts"
+ ],
+ "author": {
+ "name": "Fabio Berger",
+ "email": "fabio@0xproject.com"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x.js/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x.js/packages/tslint-config/README.md",
+ "devDependencies": {
+ "tslint": "5.8.0",
+ "typescript": "2.6.1"
+ },
+ "dependencies": {
+ "tslint-react": "^3.2.0"
+ }
+}
diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json
new file mode 100644
index 000000000..8b839f25a
--- /dev/null
+++ b/packages/tslint-config/tslint.json
@@ -0,0 +1,53 @@
+{
+ "extends": [
+ "tslint:latest",
+ "tslint-react"
+ ],
+ "rules": {
+ "arrow-parens": [true, "ban-single-arg-parens"],
+ "ordered-imports": false,
+ "quotemark": [true, "single", "avoid-escape", "jsx-double"],
+ "callable-types": true,
+ "interface-name": false,
+ "interface-over-type-literal": true,
+ "object-literal-sort-keys": false,
+ "max-classes-per-file": false,
+ "max-line-length": [true, 120],
+ "member-ordering": [true,
+ "public-before-private",
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-angle-bracket-type-assertion": true,
+ "no-default-export": true,
+ "no-empty-interface": false,
+ "no-string-throw": true,
+ "no-submodule-imports": false,
+ "no-implicit-dependencies": [true, "dev"],
+ "prefer-const": true,
+ "variable-name": [true,
+ "ban-keywords",
+ "allow-pascal-case"
+ ],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-rest-spread",
+ "check-type",
+ "check-typecast",
+ "check-preblock"
+ ],
+ "jsx-alignment": true,
+ "jsx-boolean-value": true,
+ "jsx-curly-spacing": [true, "never"],
+ "jsx-no-lambda": true,
+ "jsx-no-multiline-js": false,
+ "jsx-no-string-ref": true,
+ "jsx-self-close": true,
+ "jsx-wrap-multiline": false,
+ "jsx-no-bind": false
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index a9c7685b0..b7be3fc06 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -873,7 +873,7 @@ bn.js@4.11.7:
version "4.11.7"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.7.tgz#ddb048e50d9482790094c13eb3fcfc833ce7ab46"
-bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.3, bn.js@^4.11.7, bn.js@^4.4.0, bn.js@^4.8.0:
+bn.js@4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.3, bn.js@^4.11.7, bn.js@^4.4.0, bn.js@^4.8.0:
version "4.11.8"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
@@ -1028,7 +1028,7 @@ buffer@^5.0.6:
base64-js "^1.0.2"
ieee754 "^1.1.4"
-builtin-modules@^1.0.0:
+builtin-modules@^1.0.0, builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
@@ -5621,24 +5621,19 @@ tslib@^1.7.1:
version "1.8.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6"
-tslint-config-0xproject@^0.0.2:
- version "0.0.2"
- resolved "https://registry.yarnpkg.com/tslint-config-0xproject/-/tslint-config-0xproject-0.0.2.tgz#39901e0c0b3e9388f00092a28b90c015395d5bba"
- dependencies:
- tslint-react "^3.0.0"
-
-tslint-react@^3.0.0:
+tslint-react@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/tslint-react/-/tslint-react-3.2.0.tgz#851fb505201c63d0343c51726e6364f7e9ad2e99"
dependencies:
tsutils "^2.8.0"
-tslint@~5.5.0:
- version "5.5.0"
- resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.5.0.tgz#10e8dab3e3061fa61e9442e8cee3982acf20a6aa"
+tslint@5.8.0:
+ version "5.8.0"
+ resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.8.0.tgz#1f49ad5b2e77c76c3af4ddcae552ae4e3612eb13"
dependencies:
babel-code-frame "^6.22.0"
- colors "^1.1.2"
+ builtin-modules "^1.1.1"
+ chalk "^2.1.0"
commander "^2.9.0"
diff "^3.2.0"
glob "^7.1.1"
@@ -5646,9 +5641,9 @@ tslint@~5.5.0:
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.7.1"
- tsutils "^2.5.1"
+ tsutils "^2.12.1"
-tsutils@^2.5.1, tsutils@^2.8.0:
+tsutils@^2.12.1, tsutils@^2.8.0:
version "2.12.2"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.12.2.tgz#ad58a4865d17ec3ddb6631b6ca53be14a5656ff3"
dependencies:
@@ -5720,7 +5715,7 @@ typescript@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc"
-typescript@^2.4.2, typescript@~2.6.1:
+typescript@2.6.1, typescript@^2.4.2, typescript@~2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.1.tgz#ef39cdea27abac0b500242d6726ab90e0c846631"