aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers
diff options
context:
space:
mode:
authorXianny <8582774+xianny@users.noreply.github.com>2019-01-12 02:04:30 +0800
committerGitHub <noreply@github.com>2019-01-12 02:04:30 +0800
commit943c378309a84ed142852c6584b53958df7817c8 (patch)
tree43536b7812b11f3a83db4208bfa5640643cfd6e8 /packages/contract-wrappers
parentcf3787edbb9e8acf7160ab93b903b54c63bdffda (diff)
downloaddexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar.gz
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar.bz2
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar.lz
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar.xz
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.tar.zst
dexon-sol-tools-943c378309a84ed142852c6584b53958df7817c8.zip
Implement tslint enum-naming to enforce PascalCase on enum members (#1474)
Diffstat (limited to 'packages/contract-wrappers')
-rw-r--r--packages/contract-wrappers/CHANGELOG.json9
-rw-r--r--packages/contract-wrappers/src/types.ts14
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts10
-rw-r--r--packages/contract-wrappers/test/forwarder_wrapper_test.ts8
-rw-r--r--packages/contract-wrappers/test/order_validator_wrapper_test.ts4
5 files changed, 27 insertions, 18 deletions
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 3234ad31b..9a225726a 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "5.0.0",
+ "changes": [
+ {
+ "note": "Renamed OrderStatus enum members to PascalCase to conform with tslint enum-naming rule",
+ "pr": 1474
+ }
+ ]
+ },
+ {
"timestamp": 1547225310,
"version": "4.2.1",
"changes": [
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 () => {