aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-watcher
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-watcher')
-rw-r--r--packages/order-watcher/CHANGELOG.json9
-rw-r--r--packages/order-watcher/CHANGELOG.md4
-rw-r--r--packages/order-watcher/package.json36
-rw-r--r--packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts74
-rw-r--r--packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts27
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts4
6 files changed, 33 insertions, 121 deletions
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json
index 04ec38fe3..d6cfe9c3c 100644
--- a/packages/order-watcher/CHANGELOG.json
+++ b/packages/order-watcher/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1536142250,
+ "version": "1.0.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.1-rc.5",
"changes": [
{
diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md
index 5f34ea726..31ed75927 100644
--- a/packages/order-watcher/CHANGELOG.md
+++ b/packages/order-watcher/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.1 - _September 5, 2018_
+
+ * Dependencies updated
+
## v1.0.1-rc.5 - _August 27, 2018_
* Fix missing `BlockParamLiteral` type import issue
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index 27eeca6fd..a6195793b 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/order-watcher",
- "version": "1.0.1-rc.5",
+ "version": "1.0.1",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -22,13 +22,13 @@
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
- "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;",
+ "update_artifacts": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;",
"clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers generated_docs",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
- "contracts_v2_beta": "AssetProxyOwner ERC20Proxy ERC20Token ERC721Proxy ERC721Token Exchange Forwarder OrderValidator WETH9 ZRXToken",
+ "contracts_v2": "AssetProxyOwner ERC20Proxy ERC20Token ERC721Proxy ERC721Token Exchange Forwarder OrderValidator WETH9 ZRXToken",
"postpublish": {
"assets": []
}
@@ -42,10 +42,10 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0xproject/abi-gen": "^1.0.7",
- "@0xproject/dev-utils": "^1.0.6",
- "@0xproject/migrations": "^1.0.6",
- "@0xproject/tslint-config": "^1.0.6",
+ "@0xproject/abi-gen": "^1.0.8",
+ "@0xproject/dev-utils": "^1.0.7",
+ "@0xproject/migrations": "^1.0.7",
+ "@0xproject/tslint-config": "^1.0.7",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -70,18 +70,18 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0xproject/assert": "^1.0.7",
- "@0xproject/base-contract": "^2.0.1",
- "@0xproject/contract-wrappers": "^1.0.1-rc.5",
- "@0xproject/fill-scenarios": "^1.0.1-rc.5",
- "@0xproject/json-schemas": "^1.0.1-rc.6",
- "@0xproject/order-utils": "^1.0.1-rc.6",
- "@0xproject/types": "^1.0.1-rc.6",
- "@0xproject/typescript-typings": "^1.0.5",
- "@0xproject/utils": "^1.0.7",
- "@0xproject/web3-wrapper": "^2.0.1",
+ "@0xproject/assert": "^1.0.8",
+ "@0xproject/base-contract": "^2.0.2",
+ "@0xproject/contract-wrappers": "^1.0.1",
+ "@0xproject/fill-scenarios": "^1.0.1",
+ "@0xproject/json-schemas": "^1.0.1",
+ "@0xproject/order-utils": "^1.0.1",
+ "@0xproject/types": "^1.0.1",
+ "@0xproject/typescript-typings": "^2.0.0",
+ "@0xproject/utils": "^1.0.8",
+ "@0xproject/web3-wrapper": "^2.0.2",
"bintrees": "^1.0.2",
- "ethereum-types": "^1.0.5",
+ "ethereum-types": "^1.0.6",
"ethereumjs-blockstream": "5.0.0",
"ethers": "3.0.22",
"lodash": "^4.17.5"
diff --git a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
deleted file mode 100644
index a1de22a5e..000000000
--- a/packages/order-watcher/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-// tslint:disable:no-unnecessary-type-assertion
-import { BlockParamLiteral, ERC20TokenWrapper, ERC721TokenWrapper } from '@0xproject/contract-wrappers';
-import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0xproject/order-utils';
-import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-
-export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
- private readonly _erc20Token: ERC20TokenWrapper;
- private readonly _erc721Token: ERC721TokenWrapper;
- private readonly _stateLayer: BlockParamLiteral;
- constructor(erc20Token: ERC20TokenWrapper, erc721Token: ERC721TokenWrapper, stateLayer: BlockParamLiteral) {
- this._erc20Token = erc20Token;
- this._erc721Token = erc721Token;
- this._stateLayer = stateLayer;
- }
- public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
- const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
- if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
- const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
- const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
- defaultBlock: this._stateLayer,
- });
- return balance;
- } else {
- const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
- const tokenOwner = await this._erc721Token.getOwnerOfAsync(
- decodedERC721AssetData.tokenAddress,
- decodedERC721AssetData.tokenId,
- {
- defaultBlock: this._stateLayer,
- },
- );
- const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
- return balance;
- }
- }
- public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
- const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
- if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
- const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
- const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
- decodedERC20AssetData.tokenAddress,
- userAddress,
- {
- defaultBlock: this._stateLayer,
- },
- );
- return proxyAllowance;
- } else {
- const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
-
- const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
- decodedERC721AssetData.tokenAddress,
- userAddress,
- {
- defaultBlock: this._stateLayer,
- },
- );
- if (isApprovedForAll) {
- return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
- } else {
- const isApproved = await this._erc721Token.isProxyApprovedAsync(
- decodedERC721AssetData.tokenAddress,
- decodedERC721AssetData.tokenId,
- {
- defaultBlock: this._stateLayer,
- },
- );
- const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
- return proxyAllowance;
- }
- }
- }
-}
diff --git a/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
deleted file mode 100644
index bfad1a48c..000000000
--- a/packages/order-watcher/src/fetchers/order_filled_cancelled_fetcher.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-// tslint:disable:no-unnecessary-type-assertion
-import { BlockParamLiteral, ExchangeWrapper } from '@0xproject/contract-wrappers';
-import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
-import { BigNumber } from '@0xproject/utils';
-
-export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
- private readonly _exchange: ExchangeWrapper;
- private readonly _stateLayer: BlockParamLiteral;
- constructor(exchange: ExchangeWrapper, stateLayer: BlockParamLiteral) {
- this._exchange = exchange;
- this._stateLayer = stateLayer;
- }
- public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
- const filledTakerAmount = this._exchange.getFilledTakerAssetAmountAsync(orderHash, {
- defaultBlock: this._stateLayer,
- });
- return filledTakerAmount;
- }
- public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
- const isCancelled = await this._exchange.isCancelledAsync(orderHash);
- return isCancelled;
- }
- public getZRXAssetData(): string {
- const zrxAssetData = this._exchange.getZRXAssetData();
- return zrxAssetData;
- }
-}
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index d4c5cca4b..cab2efa4b 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -1,5 +1,6 @@
// tslint:disable:no-unnecessary-type-assertion
import {
+ AssetBalanceAndProxyAllowanceFetcher,
ContractWrappers,
ERC20TokenApprovalEventArgs,
ERC20TokenEventArgs,
@@ -15,6 +16,7 @@ import {
ExchangeEventArgs,
ExchangeEvents,
ExchangeFillEventArgs,
+ OrderFilledCancelledFetcher,
WETH9DepositEventArgs,
WETH9EventArgs,
WETH9Events,
@@ -34,8 +36,6 @@ import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, Provider } from '
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
-import { AssetBalanceAndProxyAllowanceFetcher } from '../fetchers/asset_balance_and_proxy_allowance_fetcher';
-import { OrderFilledCancelledFetcher } from '../fetchers/order_filled_cancelled_fetcher';
import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema';
import { OnOrderStateChangeCallback, OrderWatcherConfig, OrderWatcherError } from '../types';
import { assert } from '../utils/assert';