aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-utils')
-rw-r--r--packages/order-utils/CHANGELOG.json9
-rw-r--r--packages/order-utils/CHANGELOG.md4
-rw-r--r--packages/order-utils/package.json16
-rw-r--r--packages/order-utils/src/order_state_utils.ts4
-rw-r--r--packages/order-utils/test/order_state_utils_test.ts20
5 files changed, 44 insertions, 9 deletions
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index 5bf538c1f..d6742df2e 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1537875740,
+ "version": "1.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1537541580,
"version": "1.0.3",
"changes": [
diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md
index e35867fa6..67e5a54a6 100644
--- a/packages/order-utils/CHANGELOG.md
+++ b/packages/order-utils/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.4 - _September 25, 2018_
+
+ * Dependencies updated
+
## v1.0.3 - _September 21, 2018_
* Dependencies updated
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index c9620bffa..167d32608 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/order-utils",
- "version": "1.0.3",
+ "version": "1.0.4",
"engines": {
"node": ">=6.12"
},
@@ -38,7 +38,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
- "@0xproject/dev-utils": "^1.0.8",
+ "@0xproject/dev-utils": "^1.0.9",
"@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -57,13 +57,13 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0xproject/assert": "^1.0.9",
- "@0xproject/base-contract": "^2.0.3",
- "@0xproject/json-schemas": "^1.0.2",
- "@0xproject/types": "^1.0.2",
+ "@0xproject/assert": "^1.0.10",
+ "@0xproject/base-contract": "^2.0.4",
+ "@0xproject/json-schemas": "^1.0.3",
+ "@0xproject/types": "^1.1.0",
"@0xproject/typescript-typings": "^2.0.1",
- "@0xproject/utils": "^1.0.9",
- "@0xproject/web3-wrapper": "^2.0.3",
+ "@0xproject/utils": "^1.0.10",
+ "@0xproject/web3-wrapper": "^3.0.0",
"@types/node": "*",
"bn.js": "^4.11.8",
"ethereum-types": "^1.0.7",
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index 8398776aa..9b21ef6e9 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -114,7 +114,7 @@ export class OrderStateUtils {
* @return State relevant to the signedOrder, as well as whether the signedOrder is "valid".
* Validity is defined as a non-zero amount of the order can still be filled.
*/
- public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> {
+ public async getOpenOrderStateAsync(signedOrder: SignedOrder, transactionHash?: string): Promise<OrderState> {
const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder);
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash);
@@ -134,6 +134,7 @@ export class OrderStateUtils {
isValid: true,
orderHash,
orderRelevantState,
+ transactionHash,
};
return orderState;
} else {
@@ -141,6 +142,7 @@ export class OrderStateUtils {
isValid: false,
orderHash,
error: orderValidationResult.error,
+ transactionHash,
};
return orderState;
}
diff --git a/packages/order-utils/test/order_state_utils_test.ts b/packages/order-utils/test/order_state_utils_test.ts
index 91ef23b69..ea88027ae 100644
--- a/packages/order-utils/test/order_state_utils_test.ts
+++ b/packages/order-utils/test/order_state_utils_test.ts
@@ -120,5 +120,25 @@ describe('OrderStateUtils', () => {
const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder);
expect(orderState.isValid).to.eq(false);
});
+ it('should include the transactionHash in orderState if supplied in method invocation', async () => {
+ const makerAssetAmount = new BigNumber(10);
+ const takerAssetAmount = new BigNumber(10000000000000000);
+ const takerBalance = takerAssetAmount;
+ const orderFilledAmount = new BigNumber(0);
+ const mockBalanceFetcher = buildMockBalanceFetcher(takerBalance);
+ const mockOrderFilledFetcher = buildMockOrderFilledFetcher(orderFilledAmount);
+ const [signedOrder] = testOrderFactory.generateTestSignedOrders(
+ {
+ makerAssetAmount,
+ takerAssetAmount,
+ },
+ 1,
+ );
+
+ const orderStateUtils = new OrderStateUtils(mockBalanceFetcher, mockOrderFilledFetcher);
+ const transactionHash = '0xdeadbeef';
+ const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash);
+ expect(orderState.transactionHash).to.eq(transactionHash);
+ });
});
});