aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/CHANGELOG.json9
-rw-r--r--packages/0x.js/CHANGELOG.md4
-rw-r--r--packages/0x.js/package.json22
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.json9
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.md4
-rw-r--r--packages/abi-gen-wrappers/package.json6
-rw-r--r--packages/assert/CHANGELOG.json9
-rw-r--r--packages/assert/CHANGELOG.md4
-rw-r--r--packages/assert/package.json4
-rw-r--r--packages/asset-buyer/CHANGELOG.json9
-rw-r--r--packages/asset-buyer/CHANGELOG.md4
-rw-r--r--packages/asset-buyer/package.json16
-rw-r--r--packages/base-contract/CHANGELOG.json9
-rw-r--r--packages/base-contract/CHANGELOG.md4
-rw-r--r--packages/base-contract/package.json4
-rw-r--r--packages/connect/CHANGELOG.json9
-rw-r--r--packages/connect/CHANGELOG.md4
-rw-r--r--packages/connect/package.json8
-rw-r--r--packages/connect/src/http_client.ts29
-rw-r--r--packages/connect/src/schemas/asset_pairs_request_opts_schema.ts8
-rw-r--r--packages/connect/src/schemas/order_config_request_schema.ts24
-rw-r--r--packages/connect/src/schemas/orderbook_request_schema.ts9
-rw-r--r--packages/connect/src/schemas/orders_request_opts_schema.ts19
-rw-r--r--packages/connect/src/schemas/paged_request_opts_schema.ts8
-rw-r--r--packages/connect/src/schemas/request_opts_schema.ts7
-rw-r--r--packages/connect/src/schemas/schemas.ts15
-rw-r--r--packages/contract-wrappers/CHANGELOG.json21
-rw-r--r--packages/contract-wrappers/CHANGELOG.md6
-rw-r--r--packages/contract-wrappers/package.json20
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts8
-rw-r--r--packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts16
-rw-r--r--packages/contract-wrappers/src/schemas/validate_order_fillable_opts_schema.ts7
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts15
-rw-r--r--packages/contracts/package.json16
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/fill_order_combinatorial_utils.ts2
-rw-r--r--packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts13
-rw-r--r--packages/dev-tools-pages/package.json4
-rw-r--r--packages/dev-utils/CHANGELOG.json9
-rw-r--r--packages/dev-utils/CHANGELOG.md4
-rw-r--r--packages/dev-utils/package.json6
-rw-r--r--packages/fill-scenarios/CHANGELOG.json9
-rw-r--r--packages/fill-scenarios/CHANGELOG.md4
-rw-r--r--packages/fill-scenarios/package.json10
-rw-r--r--packages/instant/package.json14
-rw-r--r--packages/instant/src/components/animations/slide_animation.tsx2
-rw-r--r--packages/instant/src/components/buy_button.tsx2
-rw-r--r--packages/instant/src/components/buy_order_progress.tsx3
-rw-r--r--packages/instant/src/components/erc20_token_selector.tsx7
-rw-r--r--packages/instant/src/components/install_wallet_panel_content.tsx33
-rw-r--r--packages/instant/src/components/meta_mask_logo.tsx78
-rw-r--r--packages/instant/src/components/payment_method.tsx143
-rw-r--r--packages/instant/src/components/placing_order_button.tsx4
-rw-r--r--packages/instant/src/components/sliding_error.tsx3
-rw-r--r--packages/instant/src/components/sliding_panel.tsx22
-rw-r--r--packages/instant/src/components/standard_panel_content.tsx60
-rw-r--r--packages/instant/src/components/standard_sliding_panel.tsx29
-rw-r--r--packages/instant/src/components/timed_progress_bar.tsx46
-rw-r--r--packages/instant/src/components/ui/button.tsx31
-rw-r--r--packages/instant/src/components/ui/icon.tsx6
-rw-r--r--packages/instant/src/components/ui/text.tsx9
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx4
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx25
-rw-r--r--packages/instant/src/components/zero_ex_instant_overlay.tsx4
-rw-r--r--packages/instant/src/components/zero_ex_instant_provider.tsx7
-rw-r--r--packages/instant/src/constants.ts4
-rw-r--r--packages/instant/src/containers/connected_account_payment_method.ts64
-rw-r--r--packages/instant/src/containers/connected_zero_ex_instant_container.ts21
-rw-r--r--packages/instant/src/containers/current_standard_sliding_panel.ts31
-rw-r--r--packages/instant/src/containers/latest_error.tsx3
-rw-r--r--packages/instant/src/redux/actions.ts7
-rw-r--r--packages/instant/src/redux/async_data.ts65
-rw-r--r--packages/instant/src/redux/reducer.ts23
-rw-r--r--packages/instant/src/types.ts12
-rw-r--r--packages/instant/src/util/heartbeater_factory.ts4
-rw-r--r--packages/instant/src/util/util.ts1
-rw-r--r--packages/json-schemas/CHANGELOG.json8
-rw-r--r--packages/json-schemas/CHANGELOG.md3
-rw-r--r--packages/json-schemas/package.json2
-rw-r--r--packages/json-schemas/schemas/asset_pairs_request_opts_schema.json8
-rw-r--r--packages/json-schemas/schemas/order_config_request_schema.json24
-rw-r--r--packages/json-schemas/schemas/orderbook_request_schema.json9
-rw-r--r--packages/json-schemas/schemas/orders_request_opts_schema.json19
-rw-r--r--packages/json-schemas/schemas/paged_request_opts_schema.json8
-rw-r--r--packages/json-schemas/schemas/request_opts_schema.json7
-rw-r--r--packages/json-schemas/src/schemas.ts12
-rw-r--r--packages/json-schemas/tsconfig.json8
-rw-r--r--packages/metacoin/package.json14
-rw-r--r--packages/migrations/CHANGELOG.json9
-rw-r--r--packages/migrations/CHANGELOG.md4
-rw-r--r--packages/migrations/package.json16
-rw-r--r--packages/order-utils/CHANGELOG.json26
-rw-r--r--packages/order-utils/CHANGELOG.md7
-rw-r--r--packages/order-utils/package.json14
-rw-r--r--packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts3
-rw-r--r--packages/order-utils/src/abstract/abstract_order_filled_cancelled_lazy_store.ts3
-rw-r--r--packages/order-utils/src/order_state_utils.ts4
-rw-r--r--packages/order-utils/src/order_validation_utils.ts209
-rw-r--r--packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts7
-rw-r--r--packages/order-utils/test/order_state_utils_test.ts3
-rw-r--r--packages/order-watcher/CHANGELOG.json18
-rw-r--r--packages/order-watcher/CHANGELOG.md4
-rw-r--r--packages/order-watcher/package.json22
-rw-r--r--packages/react-docs/CHANGELOG.json9
-rw-r--r--packages/react-docs/CHANGELOG.md4
-rw-r--r--packages/react-docs/package.json6
-rw-r--r--packages/react-shared/CHANGELOG.json9
-rw-r--r--packages/react-shared/CHANGELOG.md4
-rw-r--r--packages/react-shared/package.json4
-rw-r--r--packages/sol-compiler/CHANGELOG.json9
-rw-r--r--packages/sol-compiler/CHANGELOG.md4
-rw-r--r--packages/sol-compiler/package.json10
-rw-r--r--packages/sol-cov/CHANGELOG.json9
-rw-r--r--packages/sol-cov/CHANGELOG.md4
-rw-r--r--packages/sol-cov/package.json10
-rw-r--r--packages/sol-doc/CHANGELOG.json9
-rw-r--r--packages/sol-doc/CHANGELOG.md4
-rw-r--r--packages/sol-doc/package.json4
-rw-r--r--packages/sra-spec/CHANGELOG.json9
-rw-r--r--packages/sra-spec/CHANGELOG.md4
-rw-r--r--packages/sra-spec/package.json4
-rw-r--r--packages/subproviders/CHANGELOG.json9
-rw-r--r--packages/subproviders/CHANGELOG.md4
-rw-r--r--packages/subproviders/package.json6
-rw-r--r--packages/testnet-faucets/package.json8
-rw-r--r--packages/web3-wrapper/CHANGELOG.json9
-rw-r--r--packages/web3-wrapper/CHANGELOG.md4
-rw-r--r--packages/web3-wrapper/package.json6
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts5
-rw-r--r--packages/website/package.json16
-rw-r--r--packages/website/ts/blockchain.ts6
-rw-r--r--packages/website/ts/components/dialogs/ledger_config_dialog.tsx2
-rw-r--r--packages/website/ts/components/eth_wrappers.tsx2
-rw-r--r--packages/website/ts/components/generate_order/asset_picker.tsx2
-rw-r--r--packages/website/ts/components/inputs/allowance_state_toggle.tsx2
-rw-r--r--packages/website/ts/components/inputs/hash_input.tsx2
-rw-r--r--packages/website/ts/components/token_balances.tsx4
-rw-r--r--packages/website/ts/components/ui/copy_icon.tsx2
-rw-r--r--packages/website/ts/components/ui/ethereum_address.tsx2
-rw-r--r--packages/website/ts/components/ui/etherscan_icon.tsx2
-rw-r--r--packages/website/ts/components/ui/help_tooltip.tsx2
-rw-r--r--packages/website/ts/components/ui/identicon.tsx2
-rw-r--r--packages/website/ts/components/ui/party.tsx2
-rw-r--r--packages/website/ts/components/wallet/wallet.tsx2
-rw-r--r--packages/website/ts/local_storage/trade_history_storage.tsx2
-rw-r--r--packages/website/ts/pages/documentation/developers_page.tsx2
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx4
-rw-r--r--packages/website/ts/pages/landing/landing.tsx2
-rw-r--r--packages/website/ts/utils/doc_utils.ts2
-rw-r--r--packages/website/ts/utils/error_reporter.ts2
-rw-r--r--packages/website/ts/utils/translate.ts10
-rw-r--r--packages/website/ts/utils/utils.ts2
-rw-r--r--packages/website/tsconfig.json4
153 files changed, 1396 insertions, 522 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 7d9cb8312..c5c45026b 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "2.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.0.1",
"changes": [
{
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index d312b2c9b..3261e4004 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.2 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.0.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 38478980f..d49c8f188 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "2.0.1",
+ "version": "2.0.2",
"engines": {
"node": ">=6.12"
},
@@ -43,10 +43,10 @@
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen": "^1.0.15",
- "@0x/abi-gen-wrappers": "^1.0.2",
+ "@0x/abi-gen-wrappers": "^1.0.3",
"@0x/contract-addresses": "^1.1.0",
- "@0x/dev-utils": "^1.0.14",
- "@0x/migrations": "^2.0.1",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/migrations": "^2.0.2",
"@0x/tslint-config": "^1.0.10",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -73,16 +73,16 @@
"webpack": "^4.20.2"
},
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/base-contract": "^3.0.3",
- "@0x/contract-wrappers": "^3.0.1",
- "@0x/order-utils": "^2.0.1",
- "@0x/order-watcher": "^2.2.1",
- "@0x/subproviders": "^2.1.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/base-contract": "^3.0.4",
+ "@0x/contract-wrappers": "^4.0.0",
+ "@0x/order-utils": "^3.0.0",
+ "@0x/order-watcher": "^2.2.2",
+ "@0x/subproviders": "^2.1.2",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index c3273536b..14a0eadcb 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.2",
"changes": [
{
diff --git a/packages/abi-gen-wrappers/CHANGELOG.md b/packages/abi-gen-wrappers/CHANGELOG.md
index 18bd28cb8..649540841 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.md
+++ b/packages/abi-gen-wrappers/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.3 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.2 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
index a4316449f..5dab1fd3c 100644
--- a/packages/abi-gen-wrappers/package.json
+++ b/packages/abi-gen-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
- "version": "1.0.2",
+ "version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -33,14 +33,14 @@
"@0x/abi-gen": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
- "@0x/base-contract": "^3.0.3"
+ "@0x/base-contract": "^3.0.4"
},
"publishConfig": {
"access": "public"
diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json
index 82c0938cf..67c14f68f 100644
--- a/packages/assert/CHANGELOG.json
+++ b/packages/assert/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.15",
"changes": [
{
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md
index 7d0895eca..01b1dbbb5 100644
--- a/packages/assert/CHANGELOG.md
+++ b/packages/assert/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.16 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.15 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/assert/package.json b/packages/assert/package.json
index cc2fdaae9..1db886737 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
- "version": "1.0.15",
+ "version": "1.0.16",
"engines": {
"node": ">=6.12"
},
@@ -44,7 +44,7 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/json-schemas": "^2.0.1",
+ "@0x/json-schemas": "^2.1.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
"lodash": "^4.17.5",
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index df4531063..aa0d28879 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "2.2.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.2.0",
"changes": [
{
diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md
index d6220767e..331e4df9d 100644
--- a/packages/asset-buyer/CHANGELOG.md
+++ b/packages/asset-buyer/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.2.1 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.2.0 - _November 9, 2018_
* `getAssetBuyerForProvidedOrders` factory function now takes 3 args instead of 4 (#1187)
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index fc2414952..58daac16e 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
- "version": "2.2.0",
+ "version": "2.2.1",
"engines": {
"node": ">=6.12"
},
@@ -36,16 +36,16 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/connect": "^3.0.3",
- "@0x/contract-wrappers": "^3.0.1",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
- "@0x/subproviders": "^2.1.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/connect": "^3.0.4",
+ "@0x/contract-wrappers": "^4.0.0",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
+ "@0x/subproviders": "^2.1.2",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"ethereum-types": "^1.1.2",
"lodash": "^4.17.10"
},
diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json
index f8a1051d6..b6ce29874 100644
--- a/packages/base-contract/CHANGELOG.json
+++ b/packages/base-contract/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "3.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "3.0.3",
"changes": [
{
diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md
index d544f4f99..984eeb3f1 100644
--- a/packages/base-contract/CHANGELOG.md
+++ b/packages/base-contract/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.4 - _November 12, 2018_
+
+ * Dependencies updated
+
## v3.0.3 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index efa4a5c81..d92566208 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
- "version": "3.0.3",
+ "version": "3.0.4",
"engines": {
"node": ">=6.12"
},
@@ -42,7 +42,7 @@
"dependencies": {
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 52ad9d575..583c55cfc 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "3.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "3.0.3",
"changes": [
{
diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md
index 8e38e16de..7a57c1f88 100644
--- a/packages/connect/CHANGELOG.md
+++ b/packages/connect/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.4 - _November 12, 2018_
+
+ * Dependencies updated
+
## v3.0.3 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 527ac5bdc..09d8334a7 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
- "version": "3.0.3",
+ "version": "3.0.4",
"engines": {
"node": ">=6.12"
},
@@ -44,9 +44,9 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index b6c031fa8..c52425431 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -19,7 +19,6 @@ import { fetchAsync } from '@0x/utils';
import * as _ from 'lodash';
import * as queryString from 'query-string';
-import { schemas as clientSchemas } from './schemas/schemas';
import { Client, HttpRequestOptions, HttpRequestType } from './types';
import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers';
@@ -61,9 +60,9 @@ export class HttpClient implements Client {
requestOpts?: RequestOpts & AssetPairsRequestOpts & PagedRequestOpts,
): Promise<AssetPairsResponse> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.assetPairsRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.assetPairsRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
const httpRequestOpts = {
params: requestOpts,
@@ -81,9 +80,9 @@ export class HttpClient implements Client {
requestOpts?: RequestOpts & OrdersRequestOpts & PagedRequestOpts,
): Promise<OrdersResponse> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.ordersRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.ordersRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
const httpRequestOpts = {
params: requestOpts,
@@ -99,7 +98,7 @@ export class HttpClient implements Client {
*/
public async getOrderAsync(orderHash: string, requestOpts?: RequestOpts): Promise<APIOrder> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const httpRequestOpts = {
@@ -119,10 +118,10 @@ export class HttpClient implements Client {
request: OrderbookRequest,
requestOpts?: RequestOpts & PagedRequestOpts,
): Promise<OrderbookResponse> {
- assert.doesConformToSchema('request', request, clientSchemas.orderBookRequestSchema);
+ assert.doesConformToSchema('request', request, schemas.orderBookRequestSchema);
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
const httpRequestOpts = {
params: _.defaults({}, request, requestOpts),
@@ -142,9 +141,9 @@ export class HttpClient implements Client {
requestOpts?: RequestOpts,
): Promise<OrderConfigResponse> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
- assert.doesConformToSchema('request', request, clientSchemas.orderConfigRequestSchema);
+ assert.doesConformToSchema('request', request, schemas.orderConfigRequestSchema);
const httpRequestOpts = {
params: requestOpts,
payload: request,
@@ -160,8 +159,8 @@ export class HttpClient implements Client {
*/
public async getFeeRecipientsAsync(requestOpts?: RequestOpts & PagedRequestOpts): Promise<FeeRecipientsResponse> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.requestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, schemas.requestOptsSchema);
}
const httpRequestOpts = {
params: requestOpts,
diff --git a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts b/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts
deleted file mode 100644
index a9e3942a4..000000000
--- a/packages/connect/src/schemas/asset_pairs_request_opts_schema.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const assetPairsRequestOptsSchema = {
- id: '/AssetPairsRequestOpts',
- type: 'object',
- properties: {
- assetDataA: { $ref: '/hexSchema' },
- assetDataB: { $ref: '/hexSchema' },
- },
-};
diff --git a/packages/connect/src/schemas/order_config_request_schema.ts b/packages/connect/src/schemas/order_config_request_schema.ts
deleted file mode 100644
index 0eda430e8..000000000
--- a/packages/connect/src/schemas/order_config_request_schema.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-export const orderConfigRequestSchema = {
- id: '/OrderConfigRequest',
- type: 'object',
- properties: {
- makerAddress: { $ref: '/addressSchema' },
- takerAddress: { $ref: '/addressSchema' },
- makerAssetAmount: { $ref: '/numberSchema' },
- takerAssetAmount: { $ref: '/numberSchema' },
- makerAssetData: { $ref: '/hexSchema' },
- takerAssetData: { $ref: '/hexSchema' },
- exchangeAddress: { $ref: '/addressSchema' },
- expirationTimeSeconds: { $ref: '/numberSchema' },
- },
- required: [
- 'makerAddress',
- 'takerAddress',
- 'makerAssetAmount',
- 'takerAssetAmount',
- 'makerAssetData',
- 'takerAssetData',
- 'exchangeAddress',
- 'expirationTimeSeconds',
- ],
-};
diff --git a/packages/connect/src/schemas/orderbook_request_schema.ts b/packages/connect/src/schemas/orderbook_request_schema.ts
deleted file mode 100644
index 0c9389d50..000000000
--- a/packages/connect/src/schemas/orderbook_request_schema.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export const orderBookRequestSchema = {
- id: '/OrderBookRequest',
- type: 'object',
- properties: {
- baseAssetData: { $ref: '/hexSchema' },
- quoteAssetData: { $ref: '/hexSchema' },
- },
- required: ['baseAssetData', 'quoteAssetData'],
-};
diff --git a/packages/connect/src/schemas/orders_request_opts_schema.ts b/packages/connect/src/schemas/orders_request_opts_schema.ts
deleted file mode 100644
index 71ce3d06f..000000000
--- a/packages/connect/src/schemas/orders_request_opts_schema.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-export const ordersRequestOptsSchema = {
- id: '/OrdersRequestOpts',
- type: 'object',
- properties: {
- makerAssetProxyId: { $ref: '/hexSchema' },
- takerAssetProxyId: { $ref: '/hexSchema' },
- makerAssetAddress: { $ref: '/addressSchema' },
- takerAssetAddress: { $ref: '/addressSchema' },
- exchangeAddress: { $ref: '/addressSchema' },
- senderAddress: { $ref: '/addressSchema' },
- makerAssetData: { $ref: '/hexSchema' },
- takerAssetData: { $ref: '/hexSchema' },
- traderAssetData: { $ref: '/hexSchema' },
- makerAddress: { $ref: '/addressSchema' },
- takerAddress: { $ref: '/addressSchema' },
- traderAddress: { $ref: '/addressSchema' },
- feeRecipientAddress: { $ref: '/addressSchema' },
- },
-};
diff --git a/packages/connect/src/schemas/paged_request_opts_schema.ts b/packages/connect/src/schemas/paged_request_opts_schema.ts
deleted file mode 100644
index eb2e52100..000000000
--- a/packages/connect/src/schemas/paged_request_opts_schema.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export const pagedRequestOptsSchema = {
- id: '/PagedRequestOpts',
- type: 'object',
- properties: {
- page: { type: 'number' },
- perPage: { type: 'number' },
- },
-};
diff --git a/packages/connect/src/schemas/request_opts_schema.ts b/packages/connect/src/schemas/request_opts_schema.ts
deleted file mode 100644
index a51e98069..000000000
--- a/packages/connect/src/schemas/request_opts_schema.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const requestOptsSchema = {
- id: '/RequestOpts',
- type: 'object',
- properties: {
- networkId: { type: 'number' },
- },
-};
diff --git a/packages/connect/src/schemas/schemas.ts b/packages/connect/src/schemas/schemas.ts
deleted file mode 100644
index 8d101ed6f..000000000
--- a/packages/connect/src/schemas/schemas.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { assetPairsRequestOptsSchema } from './asset_pairs_request_opts_schema';
-import { orderConfigRequestSchema } from './order_config_request_schema';
-import { orderBookRequestSchema } from './orderbook_request_schema';
-import { ordersRequestOptsSchema } from './orders_request_opts_schema';
-import { pagedRequestOptsSchema } from './paged_request_opts_schema';
-import { requestOptsSchema } from './request_opts_schema';
-
-export const schemas = {
- orderConfigRequestSchema,
- orderBookRequestSchema,
- ordersRequestOptsSchema,
- pagedRequestOptsSchema,
- requestOptsSchema,
- assetPairsRequestOptsSchema,
-};
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 0346b79b2..425c33643 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,26 @@
[
{
+ "version": "4.0.0",
+ "changes": [
+ {
+ "note":
+ "Add signature validation, regular cancellation and `cancelledUpTo` checks to `validateOrderFillableOrThrowAsync`",
+ "pr": 1235
+ },
+ {
+ "note":
+ "Improved the errors thrown by `validateOrderFillableOrThrowAsync` by making them more descriptive",
+ "pr": 1235
+ },
+ {
+ "note":
+ "Throw previously swallowed network errors when calling `validateOrderFillableOrThrowAsync` (see issue: #1218)",
+ "pr": 1235
+ }
+ ],
+ "timestamp": 1542028948
+ },
+ {
"version": "3.0.1",
"changes": [
{
diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md
index 1fe903dd9..52c3fece6 100644
--- a/packages/contract-wrappers/CHANGELOG.md
+++ b/packages/contract-wrappers/CHANGELOG.md
@@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v4.0.0 - _November 12, 2018_
+
+ * Add signature validation, regular cancellation and `cancelledUpTo` checks to `validateOrderFillableOrThrowAsync` (#1235)
+ * Improved the errors thrown by `validateOrderFillableOrThrowAsync` by making them more descriptive (#1235)
+ * Throw previously swallowed network errors when calling `validateOrderFillableOrThrowAsync` (see issue: #1218) (#1235)
+
## v3.0.1 - _November 9, 2018_
* Fix bug in `ForwarderWrapper` where `feeRecipientAddress` was not correctly normalized. (#1178)
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index cb69bbd33..ab316c586 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
- "version": "3.0.1",
+ "version": "4.0.0",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,9 +37,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
- "@0x/migrations": "^2.0.1",
- "@0x/subproviders": "^2.1.1",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/migrations": "^2.0.2",
+ "@0x/subproviders": "^2.1.2",
"@0x/tslint-config": "^1.0.10",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -65,17 +65,17 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.2",
- "@0x/assert": "^1.0.15",
+ "@0x/abi-gen-wrappers": "^1.0.3",
+ "@0x/assert": "^1.0.16",
"@0x/contract-addresses": "^1.1.0",
"@0x/contract-artifacts": "^1.1.0",
- "@0x/fill-scenarios": "^1.0.9",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
+ "@0x/fill-scenarios": "^1.0.10",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"ethereum-types": "^1.1.2",
"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 2e978f35b..c76e51eee 100644
--- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
@@ -18,6 +18,7 @@ import { OrderFilledCancelledFetcher } from '../fetchers/order_filled_cancelled_
import { methodOptsSchema } from '../schemas/method_opts_schema';
import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
+import { validateOrderFillableOptsSchema } from '../schemas/validate_order_fillable_opts_schema';
import {
BlockRange,
EventCallback,
@@ -1114,6 +1115,9 @@ export class ExchangeWrapper extends ContractWrapper {
signedOrder: SignedOrder,
opts: ValidateOrderFillableOpts = {},
): Promise<void> {
+ assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
+ assert.doesConformToSchema('opts', opts, validateOrderFillableOptsSchema);
+
const balanceAllowanceFetcher = new AssetBalanceAndProxyAllowanceFetcher(
this._erc20TokenWrapper,
this._erc721TokenWrapper,
@@ -1124,7 +1128,7 @@ export class ExchangeWrapper extends ContractWrapper {
const expectedFillTakerTokenAmountIfExists = opts.expectedFillTakerTokenAmount;
const filledCancelledFetcher = new OrderFilledCancelledFetcher(this, BlockParamLiteral.Latest);
- const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher);
+ const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher, this._web3Wrapper.getProvider());
await orderValidationUtils.validateOrderFillableOrThrowAsync(
exchangeTradeSimulator,
signedOrder,
@@ -1152,7 +1156,7 @@ export class ExchangeWrapper extends ContractWrapper {
const exchangeTradeSimulator = new ExchangeTransferSimulator(balanceAllowanceStore);
const filledCancelledFetcher = new OrderFilledCancelledFetcher(this, BlockParamLiteral.Latest);
- const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher);
+ const orderValidationUtils = new OrderValidationUtils(filledCancelledFetcher, this._web3Wrapper.getProvider());
await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeSimulator,
this._web3Wrapper.getProvider(),
diff --git a/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts
index acf7038fa..5d350916c 100644
--- a/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts
+++ b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts
@@ -1,5 +1,6 @@
// tslint:disable:no-unnecessary-type-assertion
-import { AbstractOrderFilledCancelledFetcher } from '@0x/order-utils';
+import { AbstractOrderFilledCancelledFetcher, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParamLiteral } from 'ethereum-types';
@@ -18,9 +19,18 @@ export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelled
});
return filledTakerAmount;
}
- public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
+ public async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean> {
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const isCancelled = await this._exchange.isCancelledAsync(orderHash);
- return isCancelled;
+ const orderEpoch = await this._exchange.getOrderEpochAsync(
+ signedOrder.makerAddress,
+ signedOrder.senderAddress,
+ {
+ defaultBlock: this._stateLayer,
+ },
+ );
+ const isCancelledByOrderEpoch = orderEpoch > signedOrder.salt;
+ return isCancelled || isCancelledByOrderEpoch;
}
public getZRXAssetData(): string {
const zrxAssetData = this._exchange.getZRXAssetData();
diff --git a/packages/contract-wrappers/src/schemas/validate_order_fillable_opts_schema.ts b/packages/contract-wrappers/src/schemas/validate_order_fillable_opts_schema.ts
new file mode 100644
index 000000000..2e111af04
--- /dev/null
+++ b/packages/contract-wrappers/src/schemas/validate_order_fillable_opts_schema.ts
@@ -0,0 +1,7 @@
+export const validateOrderFillableOptsSchema = {
+ id: '/ValidateOrderFillableOpts',
+ properties: {
+ expectedFillTakerTokenAmount: { $ref: '/wholeNumberSchema' },
+ },
+ type: 'object',
+};
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index 0e537bd83..73ce6c743 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -1,7 +1,7 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0x/dev-utils';
import { FillScenarios } from '@0x/fill-scenarios';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { DoneCallback, SignedOrder } from '@0x/types';
+import { DoneCallback, RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { BlockParamLiteral } from 'ethereum-types';
@@ -282,6 +282,19 @@ describe('ExchangeWrapper', () => {
expect(ordersInfo[1].orderHash).to.be.equal(anotherOrderHash);
});
});
+ describe('#validateOrderFillableOrThrowAsync', () => {
+ it('should throw if signature is invalid', async () => {
+ const signedOrderWithInvalidSignature = {
+ ...signedOrder,
+ signature:
+ '0x1b61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403',
+ };
+
+ expect(
+ contractWrappers.exchange.validateOrderFillableOrThrowAsync(signedOrderWithInvalidSignature),
+ ).to.eventually.to.be.rejectedWith(RevertReason.InvalidOrderSignature);
+ });
+ });
describe('#isValidSignature', () => {
it('should check if the signature is valid', async () => {
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index bf9bb4826..3e08ea2c4 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "contracts",
- "version": "2.1.51",
+ "version": "2.1.52",
"engines": {
"node": ">=6.12"
},
@@ -46,10 +46,10 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.15",
- "@0x/dev-utils": "^1.0.14",
- "@0x/sol-compiler": "^1.1.9",
- "@0x/sol-cov": "^2.1.9",
- "@0x/subproviders": "^2.1.1",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/sol-compiler": "^1.1.10",
+ "@0x/sol-cov": "^2.1.10",
+ "@0x/subproviders": "^2.1.2",
"@0x/tslint-config": "^1.0.10",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -71,12 +71,12 @@
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/base-contract": "^3.0.3",
- "@0x/order-utils": "^2.0.1",
+ "@0x/base-contract": "^3.0.4",
+ "@0x/order-utils": "^3.0.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.2",
diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts
index 29dba690a..c28989d3f 100644
--- a/packages/contracts/test/utils/exchange_wrapper.ts
+++ b/packages/contracts/test/utils/exchange_wrapper.ts
@@ -212,13 +212,17 @@ export class ExchangeWrapper {
return tx;
}
public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
- const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
+ const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
return filledAmount;
}
public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
return isCancelled;
}
+ public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
+ const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
+ return orderEpoch;
+ }
public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
return orderInfo;
diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
index 81bb33318..8046771f9 100644
--- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
+++ b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
@@ -392,7 +392,7 @@ export class FillOrderCombinatorialUtils {
);
// 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected?
- const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher);
+ const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher, provider);
const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher);
const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore);
diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
index 5f5575c7b..af959e00e 100644
--- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
@@ -1,4 +1,5 @@
-import { AbstractOrderFilledCancelledFetcher } from '@0x/order-utils';
+import { AbstractOrderFilledCancelledFetcher, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { ExchangeWrapper } from './exchange_wrapper';
@@ -14,9 +15,15 @@ export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCan
const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash));
return filledTakerAmount;
}
- public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
+ public async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean> {
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash);
- return isCancelled;
+ const orderEpoch = await this._exchangeWrapper.getOrderEpochAsync(
+ signedOrder.makerAddress,
+ signedOrder.senderAddress,
+ );
+ const isCancelledByOrderEpoch = orderEpoch > signedOrder.salt;
+ return isCancelled || isCancelledByOrderEpoch;
}
public getZRXAssetData(): string {
return this._zrxAssetData;
diff --git a/packages/dev-tools-pages/package.json b/packages/dev-tools-pages/package.json
index b1b89ac99..7dba0f5dc 100644
--- a/packages/dev-tools-pages/package.json
+++ b/packages/dev-tools-pages/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-tools-pages",
- "version": "0.0.3",
+ "version": "0.0.4",
"engines": {
"node": ">=6.12"
},
@@ -16,7 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
- "@0x/react-shared": "^1.0.18",
+ "@0x/react-shared": "^1.0.19",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"less": "^2.7.2",
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index 269cdc934..f526f6b3e 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.14",
"changes": [
{
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
index ee614a904..4e364f96a 100644
--- a/packages/dev-utils/CHANGELOG.md
+++ b/packages/dev-utils/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.15 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.14 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index e1b3201d3..a4d2381bd 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-utils",
- "version": "1.0.14",
+ "version": "1.0.15",
"engines": {
"node": ">=6.12"
},
@@ -41,11 +41,11 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/subproviders": "^2.1.1",
+ "@0x/subproviders": "^2.1.2",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/web3-provider-engine": "^14.0.0",
"chai": "^4.0.1",
"ethereum-types": "^1.1.2",
diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json
index 8aa4e78d3..bd6e58334 100644
--- a/packages/fill-scenarios/CHANGELOG.json
+++ b/packages/fill-scenarios/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.9",
"changes": [
{
diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md
index 4ff28f82f..57a6431b6 100644
--- a/packages/fill-scenarios/CHANGELOG.md
+++ b/packages/fill-scenarios/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.10 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.9 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json
index e9ca077fb..20825b6dd 100644
--- a/packages/fill-scenarios/package.json
+++ b/packages/fill-scenarios/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
- "version": "1.0.9",
+ "version": "1.0.10",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -28,14 +28,14 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.2",
- "@0x/base-contract": "^3.0.3",
+ "@0x/abi-gen-wrappers": "^1.0.3",
+ "@0x/base-contract": "^3.0.4",
"@0x/contract-artifacts": "^1.1.0",
- "@0x/order-utils": "^2.0.1",
+ "@0x/order-utils": "^3.0.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 3c87743c1..4ec9e9bd3 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/instant",
- "version": "0.0.4",
+ "version": "0.0.5",
"engines": {
"node": ">=6.12"
},
@@ -45,15 +45,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/asset-buyer": "^2.2.0",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
- "@0x/subproviders": "^2.1.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/asset-buyer": "^2.2.1",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
+ "@0x/subproviders": "^2.1.2",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"copy-to-clipboard": "^3.0.8",
"ethereum-types": "^1.1.2",
"lodash": "^4.17.10",
diff --git a/packages/instant/src/components/animations/slide_animation.tsx b/packages/instant/src/components/animations/slide_animation.tsx
index 9adb1c674..5992bcba7 100644
--- a/packages/instant/src/components/animations/slide_animation.tsx
+++ b/packages/instant/src/components/animations/slide_animation.tsx
@@ -1,10 +1,10 @@
import * as React from 'react';
import { OptionallyScreenSpecific } from '../../style/media';
+import { SlideAnimationState } from '../../types';
import { PositionAnimation, PositionAnimationSettings } from './position_animation';
-export type SlideAnimationState = 'slidIn' | 'slidOut' | 'none';
export interface SlideAnimationProps {
animationState: SlideAnimationState;
slideInSettings: OptionallyScreenSpecific<PositionAnimationSettings>;
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 877ab275c..c10e07b83 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -43,7 +43,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
onClick={this._handleClick}
isDisabled={shouldDisableButton}
fontColor={ColorOption.white}
- fontSize="20px"
+ fontSize="16px"
>
Buy
</Button>
diff --git a/packages/instant/src/components/buy_order_progress.tsx b/packages/instant/src/components/buy_order_progress.tsx
index bc7319423..d93e74c9f 100644
--- a/packages/instant/src/components/buy_order_progress.tsx
+++ b/packages/instant/src/components/buy_order_progress.tsx
@@ -1,3 +1,4 @@
+import * as _ from 'lodash';
import * as React from 'react';
import { TimedProgressBar } from '../components/timed_progress_bar';
@@ -12,7 +13,6 @@ export interface BuyOrderProgressProps {
export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> = props => {
const { buyOrderState } = props;
-
if (
buyOrderState.processState === OrderProcessState.Processing ||
buyOrderState.processState === OrderProcessState.Success ||
@@ -30,6 +30,5 @@ export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> =
</Container>
);
}
-
return null;
};
diff --git a/packages/instant/src/components/erc20_token_selector.tsx b/packages/instant/src/components/erc20_token_selector.tsx
index 3503ff31a..d4a77c278 100644
--- a/packages/instant/src/components/erc20_token_selector.tsx
+++ b/packages/instant/src/components/erc20_token_selector.tsx
@@ -29,13 +29,18 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
const { tokens, onTokenSelect } = this.props;
return (
<Container height="100%">
+ <Container marginBottom="10px">
+ <Text fontColor={ColorOption.darkGrey} fontSize="18px" fontWeight="600" lineHeight="22px">
+ Select Token
+ </Text>
+ </Container>
<SearchInput
placeholder="Search tokens..."
width="100%"
value={this.state.searchQuery}
onChange={this._handleSearchInputChange}
/>
- <Container overflow="scroll" height="calc(100% - 80px)" marginTop="10px">
+ <Container overflow="scroll" height="calc(100% - 90px)" marginTop="10px">
{_.map(tokens, token => {
if (!this._isTokenQueryMatch(token)) {
return null;
diff --git a/packages/instant/src/components/install_wallet_panel_content.tsx b/packages/instant/src/components/install_wallet_panel_content.tsx
new file mode 100644
index 000000000..7000e27f6
--- /dev/null
+++ b/packages/instant/src/components/install_wallet_panel_content.tsx
@@ -0,0 +1,33 @@
+import * as React from 'react';
+
+import { META_MASK_CHROME_STORE_URL, META_MASK_SITE_URL } from '../constants';
+import { ColorOption } from '../style/theme';
+
+import { MetaMaskLogo } from './meta_mask_logo';
+import { StandardPanelContent } from './standard_panel_content';
+import { Button } from './ui/button';
+
+export interface InstallWalletPanelContentProps {}
+
+export const InstallWalletPanelContent: React.StatelessComponent<InstallWalletPanelContentProps> = () => (
+ <StandardPanelContent
+ image={<MetaMaskLogo width={85} height={80} />}
+ title="Install MetaMask"
+ description="Please install the MetaMask wallet extension from the Chrome Store."
+ moreInfoSettings={{
+ href: META_MASK_SITE_URL,
+ text: 'What is MetaMask?',
+ }}
+ action={
+ <Button
+ href={META_MASK_CHROME_STORE_URL}
+ width="100%"
+ fontSize="16px"
+ fontColor={ColorOption.white}
+ backgroundColor={ColorOption.darkOrange}
+ >
+ Get Chrome Extension
+ </Button>
+ }
+ />
+);
diff --git a/packages/instant/src/components/meta_mask_logo.tsx b/packages/instant/src/components/meta_mask_logo.tsx
new file mode 100644
index 000000000..d1ad10c23
--- /dev/null
+++ b/packages/instant/src/components/meta_mask_logo.tsx
@@ -0,0 +1,78 @@
+import * as React from 'react';
+
+export interface MetaMaskLogoProps {
+ width?: number;
+ height?: number;
+}
+
+export const MetaMaskLogo: React.StatelessComponent<MetaMaskLogoProps> = ({ width, height }) => (
+ <svg width={width} height={height} viewBox="0 0 85 80" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M80.578 0L47.7107 24.8648L53.542 10.2702L80.578 0Z" fill="#E2761B" />
+ <path d="M4.24075 0L37.1081 25.4053L31.2768 10.2702L4.24075 0Z" fill="#E4761B" />
+ <path d="M68.9152 57.8379L59.9032 71.8919L78.9874 77.2973L84.2886 58.3785L68.9152 57.8379Z" fill="#E4761B" />
+ <path d="M0.53006 58.3785L5.83124 77.2973L24.9155 71.8919L15.9035 57.8379L0.53006 58.3785Z" fill="#E4761B" />
+ <path d="M23.8552 34.5941L18.554 42.7022L37.1082 43.7833L36.5781 23.2428L23.8552 34.5941Z" fill="#E4761B" />
+ <path d="M60.9635 34.5941L47.7106 23.2428V43.7833L66.2647 42.7022L60.9635 34.5941Z" fill="#E4761B" />
+ <path d="M24.9156 71.8914L36.0481 66.4861L26.5059 58.378L24.9156 71.8914Z" fill="#E4761B" />
+ <path d="M48.7709 66.4861L59.9034 71.8914L58.313 58.378L48.7709 66.4861Z" fill="#E4761B" />
+ <path d="M59.9034 71.8919L48.7709 66.4865L49.301 73.5135V76.7567L59.9034 71.8919Z" fill="#D7C1B3" />
+ <path d="M24.9157 71.892L35.518 76.7568V73.5136L36.0482 66.4866L24.9157 71.892Z" fill="#D7C1B3" />
+ <path d="M35.5179 53.5138L25.9758 50.8111L32.8673 47.5678L35.5179 53.5138Z" fill="#233447" />
+ <path d="M49.3009 53.5138L51.9515 47.5678L58.843 50.8111L49.3009 53.5138Z" fill="#233447" />
+ <path d="M24.9155 71.892L26.5059 57.838L15.9035 58.3785L24.9155 71.892Z" fill="#CD6116" />
+ <path d="M58.313 57.838L59.9034 71.892L68.9154 58.3785L58.313 57.838Z" fill="#CD6116" />
+ <path
+ d="M66.2648 42.7025L47.7106 43.7836L49.301 53.5132L51.9516 47.5673L58.8431 50.8106L66.2648 42.7025Z"
+ fill="#CD6116"
+ />
+ <path
+ d="M25.9758 50.8106L32.8673 47.5673L35.5179 53.5132L37.1083 43.7836L18.5541 42.7025L25.9758 50.8106Z"
+ fill="#CD6116"
+ />
+ <path d="M18.5541 42.7024L26.5059 58.378L25.9758 50.8105L18.5541 42.7024Z" fill="#E4751F" />
+ <path d="M58.8431 50.8106L58.313 58.3781L66.2647 42.7025L58.8431 50.8106Z" fill="#E4751F" />
+ <path d="M37.1083 43.7838L35.518 53.5135L37.6384 65.4053L38.1686 49.7297L37.1083 43.7838Z" fill="#E4751F" />
+ <path d="M47.7105 43.7838L46.6503 49.7297L47.1804 65.4053L49.3009 53.5135L47.7105 43.7838Z" fill="#E4751F" />
+ <path
+ d="M49.301 53.5134L47.1805 65.4052L48.7709 66.4863L58.313 58.3782L58.8431 50.8107L49.301 53.5134Z"
+ fill="#F6851B"
+ />
+ <path
+ d="M25.9758 50.8107L26.5059 58.3782L36.048 66.4863L37.6384 65.4052L35.5179 53.5134L25.9758 50.8107Z"
+ fill="#F6851B"
+ />
+ <path
+ d="M49.3011 76.7568V73.5135L48.771 72.973H36.0482L35.518 73.5135V76.7568L24.9157 71.8919L28.6265 75.1351L36.0482 80H48.771L56.1927 75.1351L59.9035 71.8919L49.3011 76.7568Z"
+ fill="#C0AD9E"
+ />
+ <path
+ d="M48.771 66.486L47.1806 65.405H37.6385L36.0482 66.486L35.518 73.513L36.0482 72.9725H48.771L49.3011 73.513L48.771 66.486Z"
+ fill="#161616"
+ />
+ <path
+ d="M82.1685 26.4864L84.8191 12.9729L80.5781 0L48.771 24.3242L60.9637 34.5945L78.4576 39.9998L82.1685 35.6755L80.5781 34.0539L83.2287 31.8918L81.1082 30.2702L83.7588 28.108L82.1685 26.4864Z"
+ fill="#763D16"
+ />
+ <path
+ d="M0 12.9729L2.65059 26.4864L1.06024 28.108L3.71083 30.2702L1.59036 31.8918L4.24095 34.0539L2.65059 35.6755L6.36142 39.9998L23.8553 34.5945L36.0481 24.3242L4.24095 0L0 12.9729Z"
+ fill="#763D16"
+ />
+ <path
+ d="M78.4575 39.9993L60.9636 34.5939L66.2648 42.702L58.313 58.3776H68.9154H84.2888L78.4575 39.9993Z"
+ fill="#F6851B"
+ />
+ <path
+ d="M23.8554 34.5939L6.36147 39.9993L0.530167 58.3776H15.9036H26.506L18.5542 42.702L23.8554 34.5939Z"
+ fill="#F6851B"
+ />
+ <path
+ d="M47.7106 43.7833L48.7709 24.3239L53.5419 10.2699H31.2769L36.048 24.3239L37.1083 43.7833L37.6384 49.7292V65.4048H47.1805V49.7292L47.7106 43.7833Z"
+ fill="#F6851B"
+ />
+ </svg>
+);
+
+MetaMaskLogo.defaultProps = {
+ width: 85,
+ height: 80,
+};
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index 8c0b47d72..25c879519 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -1,45 +1,136 @@
-import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { ColorOption } from '../style/theme';
-import { Network } from '../types';
+import { Account, AccountState, Network } from '../types';
+import { MetaMaskLogo } from './meta_mask_logo';
import { PaymentMethodDropdown } from './payment_method_dropdown';
import { Circle } from './ui/circle';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
+import { Icon } from './ui/icon';
import { Text } from './ui/text';
-export interface PaymentMethodProps {}
+export interface PaymentMethodProps {
+ account: Account;
+ network: Network;
+ onInstallWalletClick: () => void;
+ onUnlockWalletClick: () => void;
+}
-export const PaymentMethod: React.StatelessComponent<PaymentMethodProps> = () => (
- <Container padding="20px" width="100%">
- <Container marginBottom="10px">
- <Flex justify="space-between">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- Payment Method
- </Text>
- <Flex>
- <Circle color={ColorOption.green} diameter={8} />
+export class PaymentMethod extends React.Component<PaymentMethodProps> {
+ public render(): React.ReactNode {
+ return (
+ <Container padding="20px" width="100%">
+ <Container marginBottom="12px">
+ <Flex justify="space-between">
+ <Text
+ letterSpacing="1px"
+ fontColor={ColorOption.primaryColor}
+ fontWeight={600}
+ textTransform="uppercase"
+ fontSize="14px"
+ >
+ {this._renderTitleText()}
+ </Text>
+ <Flex>{this._renderTitleLabel()}</Flex>
+ </Flex>
+ </Container>
+ {this._renderMainContent()}
+ </Container>
+ );
+ }
+ private readonly _renderTitleText = (): string => {
+ const { account } = this.props;
+ switch (account.state) {
+ case AccountState.Loading:
+ return 'loading...';
+ case AccountState.Locked:
+ case AccountState.None:
+ return 'connect your wallet';
+ case AccountState.Ready:
+ return 'payment method';
+ default:
+ return 'payment method';
+ }
+ };
+ private readonly _renderTitleLabel = (): React.ReactNode => {
+ const { account } = this.props;
+ if (account.state === AccountState.Ready || account.state === AccountState.Locked) {
+ const circleColor: ColorOption = account.state === AccountState.Ready ? ColorOption.green : ColorOption.red;
+ return (
+ <React.Fragment>
+ <Circle diameter={8} color={circleColor} />
<Container marginLeft="3px">
<Text fontColor={ColorOption.darkGrey} fontSize="12px">
MetaMask
</Text>
</Container>
- </Flex>
- </Flex>
- </Container>
- <PaymentMethodDropdown
- accountAddress="0xa1b2c3d4e5f6g7h8j9k10"
- accountEthBalanceInWei={new BigNumber(10500000000000000000)}
- network={Network.Mainnet}
- />
+ </React.Fragment>
+ );
+ }
+ return null;
+ };
+ private readonly _renderMainContent = (): React.ReactNode => {
+ const { account, network } = this.props;
+ switch (account.state) {
+ case AccountState.Loading:
+ // Just take up the same amount of space as the other states.
+ return <Container height="52px" />;
+ case AccountState.Locked:
+ return (
+ <WalletPrompt
+ onClick={this.props.onUnlockWalletClick}
+ image={<Icon width={13} icon="lock" color={ColorOption.black} />}
+ >
+ Please Unlock MetaMask
+ </WalletPrompt>
+ );
+ case AccountState.None:
+ return (
+ <WalletPrompt
+ onClick={this.props.onInstallWalletClick}
+ image={<MetaMaskLogo width={19} height={18} />}
+ >
+ Install MetaMask
+ </WalletPrompt>
+ );
+ case AccountState.Ready:
+ return (
+ <PaymentMethodDropdown
+ accountAddress={account.address}
+ accountEthBalanceInWei={account.ethBalanceInWei}
+ network={network}
+ />
+ );
+ default:
+ return null;
+ }
+ };
+}
+
+interface WalletPromptProps {
+ image: React.ReactNode;
+ onClick?: () => void;
+}
+
+const WalletPrompt: React.StatelessComponent<WalletPromptProps> = ({ onClick, image, children }) => (
+ <Container
+ padding="14.5px"
+ border={`1px solid ${ColorOption.darkOrange}`}
+ backgroundColor={ColorOption.lightOrange}
+ width="100%"
+ borderRadius="4px"
+ onClick={onClick}
+ cursor={onClick ? 'pointer' : undefined}
+ boxShadowOnHover={!!onClick}
+ >
+ <Flex>
+ <Container marginRight="10px">{image}</Container>
+ <Text fontSize="16px" fontColor={ColorOption.darkOrange}>
+ {children}
+ </Text>
+ </Flex>
</Container>
);
diff --git a/packages/instant/src/components/placing_order_button.tsx b/packages/instant/src/components/placing_order_button.tsx
index d774d7d27..74d6b9fc4 100644
--- a/packages/instant/src/components/placing_order_button.tsx
+++ b/packages/instant/src/components/placing_order_button.tsx
@@ -7,9 +7,9 @@ import { Container } from './ui/container';
import { Spinner } from './ui/spinner';
export const PlacingOrderButton: React.StatelessComponent<{}> = props => (
- <Button isDisabled={true} width="100%" fontColor={ColorOption.white} fontSize="20px">
+ <Button isDisabled={true} width="100%" fontColor={ColorOption.white} fontSize="16px">
<Container display="inline-block" position="relative" top="3px" marginRight="8px">
- <Spinner widthPx={20} heightPx={20} />
+ <Spinner widthPx={16} heightPx={16} />
</Container>
Placing Order&hellip;
</Button>
diff --git a/packages/instant/src/components/sliding_error.tsx b/packages/instant/src/components/sliding_error.tsx
index a8d4e391c..b59e2a905 100644
--- a/packages/instant/src/components/sliding_error.tsx
+++ b/packages/instant/src/components/sliding_error.tsx
@@ -3,9 +3,10 @@ import * as React from 'react';
import { ScreenSpecification } from '../style/media';
import { ColorOption } from '../style/theme';
import { zIndex } from '../style/z_index';
+import { SlideAnimationState } from '../types';
import { PositionAnimationSettings } from './animations/position_animation';
-import { SlideAnimation, SlideAnimationState } from './animations/slide_animation';
+import { SlideAnimation } from './animations/slide_animation';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
diff --git a/packages/instant/src/components/sliding_panel.tsx b/packages/instant/src/components/sliding_panel.tsx
index 9d16f9560..7f9037049 100644
--- a/packages/instant/src/components/sliding_panel.tsx
+++ b/packages/instant/src/components/sliding_panel.tsx
@@ -2,35 +2,25 @@ import * as React from 'react';
import { ColorOption } from '../style/theme';
import { zIndex } from '../style/z_index';
+import { SlideAnimationState } from '../types';
import { PositionAnimationSettings } from './animations/position_animation';
-import { SlideAnimation, SlideAnimationState } from './animations/slide_animation';
+import { SlideAnimation } from './animations/slide_animation';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
import { Icon } from './ui/icon';
-import { Text } from './ui/text';
export interface PanelProps {
- title?: string;
onClose?: () => void;
}
-export const Panel: React.StatelessComponent<PanelProps> = ({ title, children, onClose }) => (
+export const Panel: React.StatelessComponent<PanelProps> = ({ children, onClose }) => (
<Container backgroundColor={ColorOption.white} width="100%" height="100%" zIndex={zIndex.panel} padding="20px">
- <Flex justify="space-between">
- {title && (
- <Container marginTop="3px">
- <Text fontColor={ColorOption.darkGrey} fontSize="18px" fontWeight="600" lineHeight="22px">
- {title}
- </Text>
- </Container>
- )}
- <Container position="relative" bottom="7px">
- <Icon width={12} color={ColorOption.lightGrey} icon="closeX" onClick={onClose} />
- </Container>
+ <Flex justify="flex-end">
+ <Icon padding="5px" width={12} color={ColorOption.lightGrey} icon="closeX" onClick={onClose} />
</Flex>
- <Container marginTop="10px" height="100%">
+ <Container position="relative" top="-10px" height="100%">
{children}
</Container>
</Container>
diff --git a/packages/instant/src/components/standard_panel_content.tsx b/packages/instant/src/components/standard_panel_content.tsx
new file mode 100644
index 000000000..95a79bd55
--- /dev/null
+++ b/packages/instant/src/components/standard_panel_content.tsx
@@ -0,0 +1,60 @@
+import * as React from 'react';
+
+import { ColorOption } from '../style/theme';
+
+import { Container } from './ui/container';
+import { Flex } from './ui/flex';
+import { Text } from './ui/text';
+
+export interface MoreInfoSettings {
+ text: string;
+ href: string;
+}
+
+export interface StandardPanelContentProps {
+ image: React.ReactNode;
+ title: string;
+ description: string;
+ moreInfoSettings?: MoreInfoSettings;
+ action: React.ReactNode;
+}
+
+const spacingBetweenPx = '20px';
+
+export const StandardPanelContent: React.StatelessComponent<StandardPanelContentProps> = ({
+ image,
+ title,
+ description,
+ moreInfoSettings,
+ action,
+}) => (
+ <Container height="100%">
+ <Flex direction="column" height="calc(100% - 58px)">
+ <Container marginBottom={spacingBetweenPx}>{image}</Container>
+ <Container marginBottom={spacingBetweenPx}>
+ <Text fontSize="20px" fontWeight={700} fontColor={ColorOption.black}>
+ {title}
+ </Text>
+ </Container>
+ <Container marginBottom={spacingBetweenPx}>
+ <Text fontSize="14px" fontColor={ColorOption.grey} center={true}>
+ {description}
+ </Text>
+ </Container>
+ <Container marginBottom={spacingBetweenPx}>
+ {moreInfoSettings && (
+ <Text
+ center={true}
+ fontSize="13px"
+ textDecorationLine="underline"
+ fontColor={ColorOption.lightGrey}
+ href={moreInfoSettings.href}
+ >
+ {moreInfoSettings.text}
+ </Text>
+ )}
+ </Container>
+ </Flex>
+ <Container>{action}</Container>
+ </Container>
+);
diff --git a/packages/instant/src/components/standard_sliding_panel.tsx b/packages/instant/src/components/standard_sliding_panel.tsx
new file mode 100644
index 000000000..9409d9664
--- /dev/null
+++ b/packages/instant/src/components/standard_sliding_panel.tsx
@@ -0,0 +1,29 @@
+import * as React from 'react';
+
+import { SlideAnimationState, StandardSlidingPanelContent, StandardSlidingPanelSettings } from '../types';
+
+import { InstallWalletPanelContent } from './install_wallet_panel_content';
+import { SlidingPanel } from './sliding_panel';
+
+export interface StandardSlidingPanelProps extends StandardSlidingPanelSettings {
+ onClose: () => void;
+}
+
+export class StandardSlidingPanel extends React.Component<StandardSlidingPanelProps> {
+ public render(): React.ReactNode {
+ const { animationState, content, onClose } = this.props;
+ return (
+ <SlidingPanel animationState={animationState} onClose={onClose}>
+ {this._getNodeForContent(content)}
+ </SlidingPanel>
+ );
+ }
+ private readonly _getNodeForContent = (content: StandardSlidingPanelContent): React.ReactNode => {
+ switch (content) {
+ case StandardSlidingPanelContent.InstallWallet:
+ return <InstallWalletPanelContent />;
+ default:
+ return null;
+ }
+ };
+}
diff --git a/packages/instant/src/components/timed_progress_bar.tsx b/packages/instant/src/components/timed_progress_bar.tsx
index 59aaa33a1..8465b9cd0 100644
--- a/packages/instant/src/components/timed_progress_bar.tsx
+++ b/packages/instant/src/components/timed_progress_bar.tsx
@@ -2,7 +2,7 @@ import * as _ from 'lodash';
import * as React from 'react';
import { PROGRESS_FINISH_ANIMATION_TIME_MS, PROGRESS_STALL_AT_WIDTH } from '../constants';
-import { ColorOption, keyframes, styled } from '../style/theme';
+import { ColorOption, css, keyframes, styled } from '../style/theme';
import { Container } from './ui/container';
@@ -20,15 +20,11 @@ export class TimedProgressBar extends React.Component<TimedProgressBarProps, {}>
private readonly _barRef = React.createRef<HTMLDivElement>();
public render(): React.ReactNode {
- const timedProgressProps = this._calculateTimedProgressProps();
- return (
- <Container width="100%" backgroundColor={ColorOption.lightGrey} borderRadius="6px">
- <TimedProgress {...timedProgressProps} ref={this._barRef as any} />
- </Container>
- );
+ const widthAnimationSettings = this._calculateWidthAnimationSettings();
+ return <ProgressBar animationSettings={widthAnimationSettings} ref={this._barRef} />;
}
- private _calculateTimedProgressProps(): TimedProgressProps {
+ private _calculateWidthAnimationSettings(): WidthAnimationSettings {
if (this.props.hasEnded) {
if (!this._barRef.current) {
throw new Error('ended but no reference');
@@ -60,21 +56,45 @@ const expandingWidthKeyframes = (fromWidth: string, toWidth: string) => {
`;
};
-interface TimedProgressProps {
+export interface WidthAnimationSettings {
timeMs: number;
fromWidth: string;
toWidth: string;
}
-export const TimedProgress =
+interface ProgressProps {
+ width?: string;
+ animationSettings?: WidthAnimationSettings;
+}
+
+export const Progress =
styled.div <
- TimedProgressProps >
+ ProgressProps >
`
&& {
background-color: ${props => props.theme[ColorOption.primaryColor]};
border-radius: 6px;
height: 6px;
- animation: ${props => expandingWidthKeyframes(props.fromWidth, props.toWidth)}
- ${props => props.timeMs}ms linear 1 forwards;
+ ${props => (props.width ? `width: ${props.width};` : '')}
+ ${props =>
+ props.animationSettings
+ ? css`
+ animation: ${expandingWidthKeyframes(
+ props.animationSettings.fromWidth,
+ props.animationSettings.toWidth,
+ )}
+ ${props.animationSettings.timeMs}ms linear 1 forwards;
+ `
+ : ''}
}
`;
+
+export interface ProgressBarProps extends ProgressProps {}
+
+export const ProgressBar: React.ComponentType<ProgressBarProps & React.ClassAttributes<{}>> = React.forwardRef(
+ (props, ref) => (
+ <Container width="100%" backgroundColor={ColorOption.lightGrey} borderRadius="6px">
+ <Progress {...props} ref={ref as any} />
+ </Container>
+ ),
+);
diff --git a/packages/instant/src/components/ui/button.tsx b/packages/instant/src/components/ui/button.tsx
index b90221bf4..fbc5bcad4 100644
--- a/packages/instant/src/components/ui/button.tsx
+++ b/packages/instant/src/components/ui/button.tsx
@@ -2,6 +2,9 @@ import { darken, saturate } from 'polished';
import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
+import { util } from '../../util/util';
+
+export type ButtonOnClickHandler = (event: React.MouseEvent<HTMLElement>) => void;
export interface ButtonProps {
backgroundColor?: ColorOption;
@@ -12,15 +15,26 @@ export interface ButtonProps {
padding?: string;
type?: string;
isDisabled?: boolean;
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
+ href?: string;
+ onClick?: ButtonOnClickHandler;
className?: string;
}
-const PlainButton: React.StatelessComponent<ButtonProps> = ({ children, isDisabled, onClick, type, className }) => (
- <button type={type} className={className} onClick={isDisabled ? undefined : onClick} disabled={isDisabled}>
- {children}
- </button>
-);
+const PlainButton: React.StatelessComponent<ButtonProps> = ({
+ children,
+ isDisabled,
+ onClick,
+ href,
+ type,
+ className,
+}) => {
+ const computedOnClick = isDisabled ? undefined : href ? util.createHrefOnClick(href) : onClick;
+ return (
+ <button type={type} className={className} onClick={computedOnClick} disabled={isDisabled}>
+ {children}
+ </button>
+ );
+};
const darkenOnHoverAmount = 0.1;
const darkenOnActiveAmount = 0.2;
@@ -31,7 +45,7 @@ export const Button = styled(PlainButton)`
box-sizing: border-box;
font-size: ${props => props.fontSize};
font-family: 'Inter UI', sans-serif;
- font-weight: 600;
+ font-weight: 500;
color: ${props => props.fontColor && props.theme[props.fontColor]};
cursor: ${props => (props.isDisabled ? 'default' : 'pointer')};
transition: background-color, opacity 0.5s ease;
@@ -64,10 +78,9 @@ export const Button = styled(PlainButton)`
Button.defaultProps = {
backgroundColor: ColorOption.primaryColor,
- borderColor: ColorOption.primaryColor,
width: 'auto',
isDisabled: false,
- padding: '.6em 1.2em',
+ padding: '.82em 1.2em',
fontSize: '15px',
};
diff --git a/packages/instant/src/components/ui/icon.tsx b/packages/instant/src/components/ui/icon.tsx
index a88fa87dd..811142b5b 100644
--- a/packages/instant/src/components/ui/icon.tsx
+++ b/packages/instant/src/components/ui/icon.tsx
@@ -20,6 +20,7 @@ interface IconInfoMapping {
success: IconInfo;
chevron: IconInfo;
search: IconInfo;
+ lock: IconInfo;
}
const ICONS: IconInfoMapping = {
closeX: {
@@ -58,6 +59,11 @@ const ICONS: IconInfoMapping = {
path:
'M8.39404 5.19727C8.39404 6.96289 6.96265 8.39453 5.19702 8.39453C3.4314 8.39453 2 6.96289 2 5.19727C2 3.43164 3.4314 2 5.19702 2C6.96265 2 8.39404 3.43164 8.39404 5.19727ZM8.09668 9.51074C7.26855 10.0684 6.27075 10.3945 5.19702 10.3945C2.3269 10.3945 0 8.06738 0 5.19727C0 2.32715 2.3269 0 5.19702 0C8.06738 0 10.394 2.32715 10.394 5.19727C10.394 6.27051 10.0686 7.26855 9.51074 8.09668L13.6997 12.2861L12.2854 13.7002L8.09668 9.51074Z',
},
+ lock: {
+ viewBox: '0 0 13 16',
+ path:
+ 'M6.47619 0C3.79509 0 1.60489 2.21216 1.60489 4.92014V6.33135C0.717479 6.33135 0 7.05602 0 7.95232V14.379C0 15.2753 0.717479 16 1.60489 16H11.3475C12.2349 16 12.9524 15.2753 12.9524 14.379V7.95232C12.9524 7.05602 12.2349 6.33135 11.3475 6.33135V4.92014C11.3475 2.21216 9.1573 0 6.47619 0ZM9.6482 6.33135H3.30418V4.92014C3.30418 3.16567 4.72026 1.71633 6.47619 1.71633C8.23213 1.71633 9.6482 3.16567 9.6482 4.92014V6.33135Z',
+ },
};
export interface IconProps {
diff --git a/packages/instant/src/components/ui/text.tsx b/packages/instant/src/components/ui/text.tsx
index 4fe429d25..3dba11c74 100644
--- a/packages/instant/src/components/ui/text.tsx
+++ b/packages/instant/src/components/ui/text.tsx
@@ -2,6 +2,7 @@ import { darken } from 'polished';
import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
+import { util } from '../../util/util';
export interface TextProps {
fontColor?: ColorOption;
@@ -20,10 +21,16 @@ export interface TextProps {
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
noWrap?: boolean;
display?: string;
+ href?: string;
}
+export const Text: React.StatelessComponent<TextProps> = ({ href, onClick, ...rest }) => {
+ const computedOnClick = href ? util.createHrefOnClick(href) : onClick;
+ return <StyledText {...rest} onClick={computedOnClick} />;
+};
+
const darkenOnHoverAmount = 0.3;
-export const Text =
+export const StyledText =
styled.div <
TextProps >
`
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index b945f9908..f6ee28dba 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -1,8 +1,8 @@
import * as React from 'react';
import { INJECTED_DIV_CLASS } from '../constants';
+import { ConnectedZeroExInstantContainer } from '../containers/connected_zero_ex_instant_container';
-import { ZeroExInstantContainer } from './zero_ex_instant_container';
import { ZeroExInstantProvider, ZeroExInstantProviderProps } from './zero_ex_instant_provider';
export type ZeroExInstantProps = ZeroExInstantProviderProps;
@@ -11,7 +11,7 @@ export const ZeroExInstant: React.StatelessComponent<ZeroExInstantProps> = props
return (
<div className={INJECTED_DIV_CLASS}>
<ZeroExInstantProvider {...props}>
- <ZeroExInstantContainer />
+ <ConnectedZeroExInstantContainer />
</ZeroExInstantProvider>
</div>
);
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 5748e064e..5c2055a8a 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -1,6 +1,8 @@
import * as React from 'react';
import { AvailableERC20TokenSelector } from '../containers/available_erc20_token_selector';
+import { ConnectedAccountPaymentMethod } from '../containers/connected_account_payment_method';
+import { CurrentStandardSlidingPanel } from '../containers/current_standard_sliding_panel';
import { LatestBuyQuoteOrderDetails } from '../containers/latest_buy_quote_order_details';
import { LatestError } from '../containers/latest_error';
import { SelectedAssetBuyOrderProgress } from '../containers/selected_asset_buy_order_progress';
@@ -8,14 +10,16 @@ import { SelectedAssetBuyOrderStateButtons } from '../containers/selected_asset_
import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
import { ColorOption } from '../style/theme';
import { zIndex } from '../style/z_index';
+import { OrderProcessState, SlideAnimationState } from '../types';
-import { SlideAnimationState } from './animations/slide_animation';
import { CSSReset } from './css_reset';
import { SlidingPanel } from './sliding_panel';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
-export interface ZeroExInstantContainerProps {}
+export interface ZeroExInstantContainerProps {
+ orderProcessState: OrderProcessState;
+}
export interface ZeroExInstantContainerState {
tokenSelectionPanelAnimationState: SlideAnimationState;
}
@@ -47,19 +51,19 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
>
<Flex direction="column" justify="flex-start" height="100%">
<SelectedAssetInstantHeading onSelectAssetClick={this._handleSymbolClick} />
- <SelectedAssetBuyOrderProgress />
+ {this._renderPaymentMethodOrBuyOrderProgress()}
<LatestBuyQuoteOrderDetails />
<Container padding="20px" width="100%">
<SelectedAssetBuyOrderStateButtons />
</Container>
</Flex>
<SlidingPanel
- title="Select Token"
animationState={this.state.tokenSelectionPanelAnimationState}
onClose={this._handlePanelClose}
>
<AvailableERC20TokenSelector onTokenSelect={this._handlePanelClose} />
</SlidingPanel>
+ <CurrentStandardSlidingPanel />
</Container>
</Container>
</React.Fragment>
@@ -75,4 +79,17 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
tokenSelectionPanelAnimationState: 'slidOut',
});
};
+ private readonly _renderPaymentMethodOrBuyOrderProgress = (): React.ReactNode => {
+ const { orderProcessState } = this.props;
+ if (
+ orderProcessState === OrderProcessState.Processing ||
+ orderProcessState === OrderProcessState.Success ||
+ orderProcessState === OrderProcessState.Failure
+ ) {
+ return <SelectedAssetBuyOrderProgress />;
+ } else {
+ return <ConnectedAccountPaymentMethod />;
+ }
+ return null;
+ };
}
diff --git a/packages/instant/src/components/zero_ex_instant_overlay.tsx b/packages/instant/src/components/zero_ex_instant_overlay.tsx
index 10438ab7a..a7e1bd65a 100644
--- a/packages/instant/src/components/zero_ex_instant_overlay.tsx
+++ b/packages/instant/src/components/zero_ex_instant_overlay.tsx
@@ -1,12 +1,12 @@
import * as React from 'react';
+import { ConnectedZeroExInstantContainer } from '../containers/connected_zero_ex_instant_container';
import { ColorOption } from '../style/theme';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
import { Icon } from './ui/icon';
import { Overlay } from './ui/overlay';
-import { ZeroExInstantContainer } from './zero_ex_instant_container';
import { ZeroExInstantProvider, ZeroExInstantProviderProps } from './zero_ex_instant_provider';
export interface ZeroExInstantOverlayProps extends ZeroExInstantProviderProps {
@@ -31,7 +31,7 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
/>
</Container>
<Container width={{ default: 'auto', sm: '100%' }} height={{ default: 'auto', sm: '100%' }}>
- <ZeroExInstantContainer />
+ <ConnectedZeroExInstantContainer />
</Container>
</Flex>
</Overlay>
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx
index 411f118cc..863bc99b7 100644
--- a/packages/instant/src/components/zero_ex_instant_provider.tsx
+++ b/packages/instant/src/components/zero_ex_instant_provider.tsx
@@ -91,12 +91,13 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
}
public componentDidMount(): void {
const state = this._store.getState();
+ const dispatch = this._store.dispatch;
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchEthPriceAndDispatchToStore(this._store);
+ asyncData.fetchEthPriceAndDispatchToStore(dispatch);
// fetch available assets if none are specified
if (_.isUndefined(state.availableAssets)) {
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchAvailableAssetDatasAndDispatchToStore(this._store);
+ asyncData.fetchAvailableAssetDatasAndDispatchToStore(state, dispatch);
}
if (state.providerState.account.state !== AccountState.None) {
this._accountUpdateHeartbeat = generateAccountHeartbeater({
@@ -112,7 +113,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
});
this._buyQuoteHeartbeat.start(BUY_QUOTE_UPDATE_INTERVAL_TIME_MS);
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchCurrentBuyQuoteAndDispatchToStore({ store: this._store, shouldSetPending: true });
+ asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, true);
// warm up the gas price estimator cache just in case we can't
// grab the gas price estimate when submitting the transaction
// tslint:disable-next-line:no-floating-promises
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 110a8248a..deab23a98 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -19,6 +19,10 @@ export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info';
export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2';
export const PROGRESS_STALL_AT_WIDTH = '95%';
export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200;
+export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
+export const META_MASK_CHROME_STORE_URL =
+ 'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en';
+export const META_MASK_SITE_URL = 'https://metamask.io/';
export const ETHEREUM_NODE_URL_BY_NETWORK = {
[Network.Mainnet]: 'https://mainnet.infura.io/',
[Network.Kovan]: 'https://kovan.infura.io/',
diff --git a/packages/instant/src/containers/connected_account_payment_method.ts b/packages/instant/src/containers/connected_account_payment_method.ts
new file mode 100644
index 000000000..c20af67cc
--- /dev/null
+++ b/packages/instant/src/containers/connected_account_payment_method.ts
@@ -0,0 +1,64 @@
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+
+import { PaymentMethod } from '../components/payment_method';
+import { Action, actions } from '../redux/actions';
+import { asyncData } from '../redux/async_data';
+import { State } from '../redux/reducer';
+import { Account, Network, ProviderState, StandardSlidingPanelContent } from '../types';
+
+export interface ConnectedAccountPaymentMethodProps {}
+
+interface ConnectedState {
+ network: Network;
+ providerState: ProviderState;
+}
+
+interface ConnectedDispatch {
+ onInstallWalletClick: () => void;
+ unlockWalletAndDispatchToStore: (providerState: ProviderState) => void;
+}
+
+interface ConnectedProps {
+ onInstallWalletClick: () => void;
+ onUnlockWalletClick: () => void;
+ account: Account;
+ network: Network;
+}
+
+type FinalProps = ConnectedProps & ConnectedAccountPaymentMethodProps;
+
+const mapStateToProps = (state: State, _ownProps: ConnectedAccountPaymentMethodProps): ConnectedState => ({
+ network: state.network,
+ providerState: state.providerState,
+});
+
+const mapDispatchToProps = (
+ dispatch: Dispatch<Action>,
+ ownProps: ConnectedAccountPaymentMethodProps,
+): ConnectedDispatch => ({
+ onInstallWalletClick: () => dispatch(actions.openStandardSlidingPanel(StandardSlidingPanelContent.InstallWallet)),
+ unlockWalletAndDispatchToStore: async (providerState: ProviderState) =>
+ asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true),
+});
+
+const mergeProps = (
+ connectedState: ConnectedState,
+ connectedDispatch: ConnectedDispatch,
+ ownProps: ConnectedAccountPaymentMethodProps,
+): FinalProps => ({
+ ...ownProps,
+ network: connectedState.network,
+ account: connectedState.providerState.account,
+ onInstallWalletClick: connectedDispatch.onInstallWalletClick,
+ onUnlockWalletClick: () => {
+ connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState);
+ },
+});
+
+export const ConnectedAccountPaymentMethod: React.ComponentClass<ConnectedAccountPaymentMethodProps> = connect(
+ mapStateToProps,
+ mapDispatchToProps,
+ mergeProps,
+)(PaymentMethod);
diff --git a/packages/instant/src/containers/connected_zero_ex_instant_container.ts b/packages/instant/src/containers/connected_zero_ex_instant_container.ts
new file mode 100644
index 000000000..9606d18c2
--- /dev/null
+++ b/packages/instant/src/containers/connected_zero_ex_instant_container.ts
@@ -0,0 +1,21 @@
+import * as React from 'react';
+import { connect } from 'react-redux';
+
+import { State } from '../redux/reducer';
+import { OrderProcessState } from '../types';
+
+import { ZeroExInstantContainer } from '../components/zero_ex_instant_container';
+
+export interface ConnectedZeroExInstantContainerProps {}
+
+interface ConnectedState {
+ orderProcessState: OrderProcessState;
+}
+
+const mapStateToProps = (state: State, _ownProps: ConnectedZeroExInstantContainerProps): ConnectedState => ({
+ orderProcessState: state.buyOrderState.processState,
+});
+
+export const ConnectedZeroExInstantContainer: React.ComponentClass<ConnectedZeroExInstantContainerProps> = connect(
+ mapStateToProps,
+)(ZeroExInstantContainer);
diff --git a/packages/instant/src/containers/current_standard_sliding_panel.ts b/packages/instant/src/containers/current_standard_sliding_panel.ts
new file mode 100644
index 000000000..82ac7fa1b
--- /dev/null
+++ b/packages/instant/src/containers/current_standard_sliding_panel.ts
@@ -0,0 +1,31 @@
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+
+import { StandardSlidingPanel } from '../components/standard_sliding_panel';
+import { Action, actions } from '../redux/actions';
+import { State } from '../redux/reducer';
+import { StandardSlidingPanelSettings } from '../types';
+
+export interface CurrentStandardSlidingPanelProps {}
+
+interface ConnectedState extends StandardSlidingPanelSettings {}
+
+interface ConnectedDispatch {
+ onClose: () => void;
+}
+
+const mapStateToProps = (state: State, _ownProps: CurrentStandardSlidingPanelProps): ConnectedState =>
+ state.standardSlidingPanelSettings;
+
+const mapDispatchToProps = (
+ dispatch: Dispatch<Action>,
+ ownProps: CurrentStandardSlidingPanelProps,
+): ConnectedDispatch => ({
+ onClose: () => dispatch(actions.closeStandardSlidingPanel()),
+});
+
+export const CurrentStandardSlidingPanel: React.ComponentClass<CurrentStandardSlidingPanelProps> = connect(
+ mapStateToProps,
+ mapDispatchToProps,
+)(StandardSlidingPanel);
diff --git a/packages/instant/src/containers/latest_error.tsx b/packages/instant/src/containers/latest_error.tsx
index c0da181f1..b7cfdb504 100644
--- a/packages/instant/src/containers/latest_error.tsx
+++ b/packages/instant/src/containers/latest_error.tsx
@@ -3,7 +3,6 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
-import { SlideAnimationState } from '../components/animations/slide_animation';
import { SlidingError } from '../components/sliding_error';
import { Overlay } from '../components/ui/overlay';
import { Action } from '../redux/actions';
@@ -11,7 +10,7 @@ import { State } from '../redux/reducer';
import { ScreenWidths } from '../style/media';
import { generateOverlayBlack } from '../style/theme';
import { zIndex } from '../style/z_index';
-import { Asset, DisplayStatus, Omit } from '../types';
+import { Asset, DisplayStatus, Omit, SlideAnimationState } from '../types';
import { errorFlasher } from '../util/error_flasher';
export interface LatestErrorComponentProps {
diff --git a/packages/instant/src/redux/actions.ts b/packages/instant/src/redux/actions.ts
index 8947c6c97..0891170b4 100644
--- a/packages/instant/src/redux/actions.ts
+++ b/packages/instant/src/redux/actions.ts
@@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
-import { ActionsUnion, AddressAndEthBalanceInWei, Asset } from '../types';
+import { ActionsUnion, AddressAndEthBalanceInWei, Asset, StandardSlidingPanelContent } from '../types';
export interface PlainAction<T extends string> {
type: T;
@@ -41,6 +41,8 @@ export enum ActionTypes {
HIDE_ERROR = 'HIDE_ERROR',
CLEAR_ERROR = 'CLEAR_ERROR',
RESET_AMOUNT = 'RESET_AMOUNT',
+ OPEN_STANDARD_SLIDING_PANEL = 'OPEN_STANDARD_SLIDING_PANEL',
+ CLOSE_STANDARD_SLIDING_PANEL = 'CLOSE_STANDARD_SLIDING_PANEL',
}
export const actions = {
@@ -66,4 +68,7 @@ export const actions = {
hideError: () => createAction(ActionTypes.HIDE_ERROR),
clearError: () => createAction(ActionTypes.CLEAR_ERROR),
resetAmount: () => createAction(ActionTypes.RESET_AMOUNT),
+ openStandardSlidingPanel: (content: StandardSlidingPanelContent) =>
+ createAction(ActionTypes.OPEN_STANDARD_SLIDING_PANEL, content),
+ closeStandardSlidingPanel: () => createAction(ActionTypes.CLOSE_STANDARD_SLIDING_PANEL),
};
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
index b920ac914..8999ef097 100644
--- a/packages/instant/src/redux/async_data.ts
+++ b/packages/instant/src/redux/async_data.ts
@@ -1,71 +1,75 @@
import { AssetProxyId } from '@0x/types';
import * as _ from 'lodash';
+import { Dispatch } from 'redux';
import { BIG_NUMBER_ZERO } from '../constants';
-import { AccountState, ERC20Asset, OrderProcessState } from '../types';
+import { AccountState, ERC20Asset, OrderProcessState, ProviderState } from '../types';
import { assetUtils } from '../util/asset';
import { buyQuoteUpdater } from '../util/buy_quote_updater';
import { coinbaseApi } from '../util/coinbase_api';
import { errorFlasher } from '../util/error_flasher';
import { actions } from './actions';
-import { Store } from './store';
+import { State } from './reducer';
export const asyncData = {
- fetchEthPriceAndDispatchToStore: async (store: Store) => {
+ fetchEthPriceAndDispatchToStore: async (dispatch: Dispatch) => {
try {
const ethUsdPrice = await coinbaseApi.getEthUsdPrice();
- store.dispatch(actions.updateEthUsdPrice(ethUsdPrice));
+ dispatch(actions.updateEthUsdPrice(ethUsdPrice));
} catch (e) {
const errorMessage = 'Error fetching ETH/USD price';
- errorFlasher.flashNewErrorMessage(store.dispatch, errorMessage);
- store.dispatch(actions.updateEthUsdPrice(BIG_NUMBER_ZERO));
+ errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
+ dispatch(actions.updateEthUsdPrice(BIG_NUMBER_ZERO));
}
},
- fetchAvailableAssetDatasAndDispatchToStore: async (store: Store) => {
- const { providerState, assetMetaDataMap, network } = store.getState();
+ fetchAvailableAssetDatasAndDispatchToStore: async (state: State, dispatch: Dispatch) => {
+ const { providerState, assetMetaDataMap, network } = state;
const assetBuyer = providerState.assetBuyer;
try {
const assetDatas = await assetBuyer.getAvailableAssetDatasAsync();
const assets = assetUtils.createAssetsFromAssetDatas(assetDatas, assetMetaDataMap, network);
- store.dispatch(actions.setAvailableAssets(assets));
+ dispatch(actions.setAvailableAssets(assets));
} catch (e) {
const errorMessage = 'Could not find any assets';
- errorFlasher.flashNewErrorMessage(store.dispatch, errorMessage);
+ errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
// On error, just specify that none are available
- store.dispatch(actions.setAvailableAssets([]));
+ dispatch(actions.setAvailableAssets([]));
}
},
- fetchAccountInfoAndDispatchToStore: async (options: { store: Store; shouldSetToLoading: boolean }) => {
- const { store, shouldSetToLoading } = options;
- const { providerState } = store.getState();
+ fetchAccountInfoAndDispatchToStore: async (
+ providerState: ProviderState,
+ dispatch: Dispatch,
+ shouldAttemptUnlock: boolean = false,
+ shouldSetToLoading: boolean = false,
+ ) => {
const web3Wrapper = providerState.web3Wrapper;
const provider = providerState.provider;
if (shouldSetToLoading && providerState.account.state !== AccountState.Loading) {
- store.dispatch(actions.setAccountStateLoading());
+ dispatch(actions.setAccountStateLoading());
}
let availableAddresses: string[];
try {
// TODO(bmillman): Add support at the web3Wrapper level for calling `eth_requestAccounts` instead of calling enable here
const isPrivacyModeEnabled = !_.isUndefined((provider as any).enable);
- availableAddresses = isPrivacyModeEnabled
- ? await (provider as any).enable()
- : await web3Wrapper.getAvailableAddressesAsync();
+ availableAddresses =
+ isPrivacyModeEnabled && shouldAttemptUnlock
+ ? await (provider as any).enable()
+ : await web3Wrapper.getAvailableAddressesAsync();
} catch (e) {
- store.dispatch(actions.setAccountStateLocked());
+ dispatch(actions.setAccountStateLocked());
return;
}
if (!_.isEmpty(availableAddresses)) {
const activeAddress = availableAddresses[0];
- store.dispatch(actions.setAccountStateReady(activeAddress));
+ dispatch(actions.setAccountStateReady(activeAddress));
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchAccountBalanceAndDispatchToStore(store);
+ asyncData.fetchAccountBalanceAndDispatchToStore(providerState, dispatch);
} else {
- store.dispatch(actions.setAccountStateLocked());
+ dispatch(actions.setAccountStateLocked());
}
},
- fetchAccountBalanceAndDispatchToStore: async (store: Store) => {
- const { providerState } = store.getState();
+ fetchAccountBalanceAndDispatchToStore: async (providerState: ProviderState, dispatch: Dispatch) => {
const web3Wrapper = providerState.web3Wrapper;
const account = providerState.account;
if (account.state !== AccountState.Ready) {
@@ -74,15 +78,18 @@ export const asyncData = {
try {
const address = account.address;
const ethBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(address);
- store.dispatch(actions.updateAccountEthBalance({ address, ethBalanceInWei }));
+ dispatch(actions.updateAccountEthBalance({ address, ethBalanceInWei }));
} catch (e) {
// leave balance as is
return;
}
},
- fetchCurrentBuyQuoteAndDispatchToStore: async (options: { store: Store; shouldSetPending: boolean }) => {
- const { store, shouldSetPending } = options;
- const { buyOrderState, providerState, selectedAsset, selectedAssetAmount, affiliateInfo } = store.getState();
+ fetchCurrentBuyQuoteAndDispatchToStore: async (
+ state: State,
+ dispatch: Dispatch,
+ shouldSetPending: boolean = false,
+ ) => {
+ const { buyOrderState, providerState, selectedAsset, selectedAssetAmount, affiliateInfo } = state;
const assetBuyer = providerState.assetBuyer;
if (
!_.isUndefined(selectedAssetAmount) &&
@@ -92,7 +99,7 @@ export const asyncData = {
) {
await buyQuoteUpdater.updateBuyQuoteAsync(
assetBuyer,
- store.dispatch,
+ dispatch,
selectedAsset as ERC20Asset,
selectedAssetAmount,
shouldSetPending,
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index ef46fdd9d..4688250bc 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -19,6 +19,8 @@ import {
OrderProcessState,
OrderState,
ProviderState,
+ StandardSlidingPanelContent,
+ StandardSlidingPanelSettings,
} from '../types';
import { Action, ActionTypes } from './actions';
@@ -30,6 +32,7 @@ export interface DefaultState {
buyOrderState: OrderState;
latestErrorDisplayStatus: DisplayStatus;
quoteRequestState: AsyncProcessState;
+ standardSlidingPanelSettings: StandardSlidingPanelSettings;
}
// State that is required but needs to be derived from the props
@@ -56,6 +59,10 @@ export const DEFAULT_STATE: DefaultState = {
buyOrderState: { processState: OrderProcessState.None },
latestErrorDisplayStatus: DisplayStatus.Hidden,
quoteRequestState: AsyncProcessState.None,
+ standardSlidingPanelSettings: {
+ animationState: 'none',
+ content: StandardSlidingPanelContent.None,
+ },
};
export const createReducer = (initialState: State) => {
@@ -211,6 +218,22 @@ export const createReducer = (initialState: State) => {
...state,
availableAssets: action.data,
};
+ case ActionTypes.OPEN_STANDARD_SLIDING_PANEL:
+ return {
+ ...state,
+ standardSlidingPanelSettings: {
+ content: action.data,
+ animationState: 'slidIn',
+ },
+ };
+ case ActionTypes.CLOSE_STANDARD_SLIDING_PANEL:
+ return {
+ ...state,
+ standardSlidingPanelSettings: {
+ content: state.standardSlidingPanelSettings.content,
+ animationState: 'slidOut',
+ },
+ };
default:
return state;
}
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index b43a82d46..b6f449f38 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -125,3 +125,15 @@ export interface AddressAndEthBalanceInWei {
address: string;
ethBalanceInWei: BigNumber;
}
+
+export type SlideAnimationState = 'slidIn' | 'slidOut' | 'none';
+
+export enum StandardSlidingPanelContent {
+ None = 'NONE',
+ InstallWallet = 'INSTALL_WALLET',
+}
+
+export interface StandardSlidingPanelSettings {
+ animationState: SlideAnimationState;
+ content: StandardSlidingPanelContent;
+}
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts
index 96a8ac4e6..06fcdb8bb 100644
--- a/packages/instant/src/util/heartbeater_factory.ts
+++ b/packages/instant/src/util/heartbeater_factory.ts
@@ -10,13 +10,13 @@ export interface HeartbeatFactoryOptions {
export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
const { store, shouldPerformImmediatelyOnStart } = options;
return new Heartbeater(async () => {
- await asyncData.fetchAccountInfoAndDispatchToStore({ store, shouldSetToLoading: false });
+ await asyncData.fetchAccountInfoAndDispatchToStore(store.getState().providerState, store.dispatch, false);
}, shouldPerformImmediatelyOnStart);
};
export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
const { store, shouldPerformImmediatelyOnStart } = options;
return new Heartbeater(async () => {
- await asyncData.fetchCurrentBuyQuoteAndDispatchToStore({ store, shouldSetPending: false });
+ await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, false);
}, shouldPerformImmediatelyOnStart);
};
diff --git a/packages/instant/src/util/util.ts b/packages/instant/src/util/util.ts
index 232a86850..aeb68956b 100644
--- a/packages/instant/src/util/util.ts
+++ b/packages/instant/src/util/util.ts
@@ -2,4 +2,5 @@ import * as _ from 'lodash';
export const util = {
boundNoop: _.noop.bind(_),
+ createHrefOnClick: (href: string) => () => window.open(href, '_blank'),
};
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index f25a487b8..24eacd192 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,14 +1,18 @@
[
{
- "version": "2.0.1",
+ "version": "2.1.0",
"changes": [
{
"note":
"Improve schemas by enforcing that amounts that must be whole numbers (e.g Order asset amounts) no longer allow decimal amounts",
"pr": 1173
+ },
+ {
+ "note": "Add schemas from @0x/connect",
+ "pr": 1250
}
],
- "timestamp": 1541740904
+ "timestamp": 1542028948
},
{
"version": "2.0.0",
diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md
index a1c784640..4f77d3aee 100644
--- a/packages/json-schemas/CHANGELOG.md
+++ b/packages/json-schemas/CHANGELOG.md
@@ -5,9 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
-## v2.0.1 - _November 9, 2018_
+## v2.1.0 - _November 12, 2018_
* Improve schemas by enforcing that amounts that must be whole numbers (e.g Order asset amounts) no longer allow decimal amounts (#1173)
+ * Add schemas from @0x/connect (#1250)
## v2.0.0 - _October 18, 2018_
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index c87cbb65a..2f57f5097 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/json-schemas",
- "version": "2.0.1",
+ "version": "2.1.0",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json b/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json
new file mode 100644
index 000000000..174a8fdc3
--- /dev/null
+++ b/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json
@@ -0,0 +1,8 @@
+{
+ "id": "/AssetPairsRequestOpts",
+ "type": "object",
+ "properties": {
+ "assetDataA": { "$ref": "/hexSchema" },
+ "assetDataB": { "$ref": "/hexSchema" }
+ }
+}
diff --git a/packages/json-schemas/schemas/order_config_request_schema.json b/packages/json-schemas/schemas/order_config_request_schema.json
new file mode 100644
index 000000000..ca9b2e30e
--- /dev/null
+++ b/packages/json-schemas/schemas/order_config_request_schema.json
@@ -0,0 +1,24 @@
+{
+ "id": "/OrderConfigRequest",
+ "type": "object",
+ "properties": {
+ "makerAddress": { "$ref": "/addressSchema" },
+ "takerAddress": { "$ref": "/addressSchema" },
+ "makerAssetAmount": { "$ref": "/wholeNumberSchema" },
+ "takerAssetAmount": { "$ref": "/wholeNumberSchema" },
+ "makerAssetData": { "$ref": "/hexSchema" },
+ "takerAssetData": { "$ref": "/hexSchema" },
+ "exchangeAddress": { "$ref": "/addressSchema" },
+ "expirationTimeSeconds": { "$ref": "/wholeNumberSchema" }
+ },
+ "required": [
+ "makerAddress",
+ "takerAddress",
+ "makerAssetAmount",
+ "takerAssetAmount",
+ "makerAssetData",
+ "takerAssetData",
+ "exchangeAddress",
+ "expirationTimeSeconds"
+ ]
+}
diff --git a/packages/json-schemas/schemas/orderbook_request_schema.json b/packages/json-schemas/schemas/orderbook_request_schema.json
new file mode 100644
index 000000000..27848bdcb
--- /dev/null
+++ b/packages/json-schemas/schemas/orderbook_request_schema.json
@@ -0,0 +1,9 @@
+{
+ "id": "/OrderBookRequest",
+ "type": "object",
+ "properties": {
+ "baseAssetData": { "$ref": "/hexSchema" },
+ "quoteAssetData": { "$ref": "/hexSchema" }
+ },
+ "required": ["baseAssetData", "quoteAssetData"]
+} \ No newline at end of file
diff --git a/packages/json-schemas/schemas/orders_request_opts_schema.json b/packages/json-schemas/schemas/orders_request_opts_schema.json
new file mode 100644
index 000000000..10da51060
--- /dev/null
+++ b/packages/json-schemas/schemas/orders_request_opts_schema.json
@@ -0,0 +1,19 @@
+{
+ "id": "/OrdersRequestOpts",
+ "type": "object",
+ "properties": {
+ "makerAssetProxyId": { "$ref": "/hexSchema" },
+ "takerAssetProxyId": { "$ref": "/hexSchema" },
+ "makerAssetAddress": { "$ref": "/addressSchema" },
+ "takerAssetAddress": { "$ref": "/addressSchema" },
+ "exchangeAddress": { "$ref": "/addressSchema" },
+ "senderAddress": { "$ref": "/addressSchema" },
+ "makerAssetData": { "$ref": "/hexSchema" },
+ "takerAssetData": { "$ref": "/hexSchema" },
+ "traderAssetData": { "$ref": "/hexSchema" },
+ "makerAddress": { "$ref": "/addressSchema" },
+ "takerAddress": { "$ref": "/addressSchema" },
+ "traderAddress": { "$ref": "/addressSchema" },
+ "feeRecipientAddress": { "$ref": "/addressSchema" }
+ }
+}
diff --git a/packages/json-schemas/schemas/paged_request_opts_schema.json b/packages/json-schemas/schemas/paged_request_opts_schema.json
new file mode 100644
index 000000000..7cfc73947
--- /dev/null
+++ b/packages/json-schemas/schemas/paged_request_opts_schema.json
@@ -0,0 +1,8 @@
+{
+ "id": "/PagedRequestOpts",
+ "type": "object",
+ "properties": {
+ "page": { "type": "number" },
+ "perPage": { "type": "number" }
+ }
+}
diff --git a/packages/json-schemas/schemas/request_opts_schema.json b/packages/json-schemas/schemas/request_opts_schema.json
new file mode 100644
index 000000000..b50547d18
--- /dev/null
+++ b/packages/json-schemas/schemas/request_opts_schema.json
@@ -0,0 +1,7 @@
+{
+ "id": "/RequestOpts",
+ "type": "object",
+ "properties": {
+ "networkId": { "type": "number" }
+ }
+}
diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts
index 8ece5de75..21a6f424c 100644
--- a/packages/json-schemas/src/schemas.ts
+++ b/packages/json-schemas/src/schemas.ts
@@ -1,4 +1,5 @@
import * as addressSchema from '../schemas/address_schema.json';
+import * as assetPairsRequestOptsSchema from '../schemas/asset_pairs_request_opts_schema.json';
import * as blockParamSchema from '../schemas/block_param_schema.json';
import * as blockRangeSchema from '../schemas/block_range_schema.json';
import * as callDataSchema from '../schemas/call_data_schema.json';
@@ -10,11 +11,15 @@ import * as indexFilterValuesSchema from '../schemas/index_filter_values_schema.
import * as jsNumber from '../schemas/js_number.json';
import * as numberSchema from '../schemas/number_schema.json';
import * as orderCancellationRequestsSchema from '../schemas/order_cancel_schema.json';
+import * as orderConfigRequestSchema from '../schemas/order_config_request_schema.json';
import * as orderFillOrKillRequestsSchema from '../schemas/order_fill_or_kill_requests_schema.json';
import * as orderFillRequestsSchema from '../schemas/order_fill_requests_schema.json';
import * as orderHashSchema from '../schemas/order_hash_schema.json';
import * as orderSchema from '../schemas/order_schema.json';
+import * as orderBookRequestSchema from '../schemas/orderbook_request_schema.json';
+import * as ordersRequestOptsSchema from '../schemas/orders_request_opts_schema.json';
import * as ordersSchema from '../schemas/orders_schema.json';
+import * as pagedRequestOptsSchema from '../schemas/paged_request_opts_schema.json';
import * as paginatedCollectionSchema from '../schemas/paginated_collection_schema.json';
import * as relayerApiAssetDataPairsResponseSchema from '../schemas/relayer_api_asset_data_pairs_response_schema.json';
import * as relayerApiAssetDataPairsSchema from '../schemas/relayer_api_asset_data_pairs_schema.json';
@@ -30,6 +35,7 @@ import * as relayerApiOrdersChannelSubscribeSchema from '../schemas/relayer_api_
import * as relayerApiOrdersChannelUpdateSchema from '../schemas/relayer_api_orders_channel_update_response_schema.json';
import * as relayerApiOrdersResponseSchema from '../schemas/relayer_api_orders_response_schema.json';
import * as relayerApiOrdersSchema from '../schemas/relayer_api_orders_schema.json';
+import * as requestOptsSchema from '../schemas/request_opts_schema.json';
import * as signedOrderSchema from '../schemas/signed_order_schema.json';
import * as signedOrdersSchema from '../schemas/signed_orders_schema.json';
import * as tokenSchema from '../schemas/token_schema.json';
@@ -58,6 +64,12 @@ export const schemas = {
blockRangeSchema,
tokenSchema,
jsNumber,
+ requestOptsSchema,
+ pagedRequestOptsSchema,
+ ordersRequestOptsSchema,
+ orderBookRequestSchema,
+ orderConfigRequestSchema,
+ assetPairsRequestOptsSchema,
txDataSchema,
paginatedCollectionSchema,
relayerApiErrorResponseSchema,
diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json
index 7b14166c0..a79d54385 100644
--- a/packages/json-schemas/tsconfig.json
+++ b/packages/json-schemas/tsconfig.json
@@ -44,6 +44,12 @@
"./schemas/zero_ex_transaction_schema.json",
"./schemas/tx_data_schema.json",
"./schemas/index_filter_values_schema.json",
- "./schemas/whole_number_schema.json"
+ "./schemas/whole_number_schema.json",
+ "./schemas/asset_pairs_request_opts_schema.json",
+ "./schemas/orderbook_request_schema.json",
+ "./schemas/orders_request_opts_schema.json",
+ "./schemas/paged_request_opts_schema.json",
+ "./schemas/request_opts_schema.json",
+ "./schemas/order_config_request_schema.json"
]
}
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index 35a0834f2..250730d26 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
- "version": "0.0.25",
+ "version": "0.0.26",
"engines": {
"node": ">=6.12"
},
@@ -30,14 +30,14 @@
"license": "Apache-2.0",
"dependencies": {
"@0x/abi-gen": "^1.0.15",
- "@0x/base-contract": "^3.0.3",
- "@0x/sol-cov": "^2.1.9",
- "@0x/subproviders": "^2.1.1",
+ "@0x/base-contract": "^3.0.4",
+ "@0x/sol-cov": "^2.1.10",
+ "@0x/subproviders": "^2.1.2",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
"ethereum-types": "^1.1.2",
@@ -46,8 +46,8 @@
"run-s": "^0.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
- "@0x/sol-compiler": "^1.1.9",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/sol-compiler": "^1.1.10",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index b7128f8e1..f57139f40 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "2.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.0.1",
"changes": [
{
diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md
index 387ae0abb..56c26a472 100644
--- a/packages/migrations/CHANGELOG.md
+++ b/packages/migrations/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.2 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.0.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
index d8c5fb6c2..cbab964d5 100644
--- a/packages/migrations/package.json
+++ b/packages/migrations/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/migrations",
- "version": "2.0.1",
+ "version": "2.0.2",
"engines": {
"node": ">=6.12"
},
@@ -17,7 +17,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
+ "@0x/dev-utils": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"@0x/types": "^1.2.1",
"@types/yargs": "^10.0.0",
@@ -29,16 +29,16 @@
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.2",
- "@0x/base-contract": "^3.0.3",
+ "@0x/abi-gen-wrappers": "^1.0.3",
+ "@0x/base-contract": "^3.0.4",
"@0x/contract-addresses": "^1.1.0",
"@0x/contract-artifacts": "^1.1.0",
- "@0x/order-utils": "^2.0.1",
- "@0x/sol-compiler": "^1.1.9",
- "@0x/subproviders": "^2.1.1",
+ "@0x/order-utils": "^3.0.0",
+ "@0x/sol-compiler": "^1.1.10",
+ "@0x/subproviders": "^2.1.2",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@ledgerhq/hw-app-eth": "^4.3.0",
"ethereum-types": "^1.1.2",
"ethers": "~4.0.4",
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index abcf3d392..6ce3169d5 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,31 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note":
+ "Add signature validation, regular cancellation and `cancelledUpTo` checks to `validateOrderFillableOrThrowAsync`",
+ "pr": 1235
+ },
+ {
+ "note":
+ "Improved the errors thrown by `validateOrderFillableOrThrowAsync` by making them more descriptive",
+ "pr": 1235
+ },
+ {
+ "note":
+ "Throw previously swallowed network errors when calling `validateOrderFillableOrThrowAsync` (see issue: #1218)",
+ "pr": 1235
+ },
+ {
+ "note":
+ "Modified the `AbstractOrderFilledCancelledFetcher` interface slightly such that `isOrderCancelledAsync` accepts a `signedOrder` instead of an `orderHash` param",
+ "pr": 1235
+ }
+ ],
+ "timestamp": 1542028948
+ },
+ {
"version": "2.0.1",
"changes": [
{
diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md
index 31bd02595..eaa74d6ce 100644
--- a/packages/order-utils/CHANGELOG.md
+++ b/packages/order-utils/CHANGELOG.md
@@ -5,6 +5,13 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.0 - _November 12, 2018_
+
+ * Add signature validation, regular cancellation and `cancelledUpTo` checks to `validateOrderFillableOrThrowAsync` (#1235)
+ * Improved the errors thrown by `validateOrderFillableOrThrowAsync` by making them more descriptive (#1235)
+ * Throw previously swallowed network errors when calling `validateOrderFillableOrThrowAsync` (see issue: #1218) (#1235)
+ * Modified the `AbstractOrderFilledCancelledFetcher` interface slightly such that `isOrderCancelledAsync` accepts a `signedOrder` instead of an `orderHash` param (#1235)
+
## v2.0.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index d6fb9892e..060150f96 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-utils",
- "version": "2.0.1",
+ "version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -35,7 +35,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
+ "@0x/dev-utils": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -53,15 +53,15 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.2",
- "@0x/assert": "^1.0.15",
- "@0x/base-contract": "^3.0.3",
+ "@0x/abi-gen-wrappers": "^1.0.3",
+ "@0x/assert": "^1.0.16",
+ "@0x/base-contract": "^3.0.4",
"@0x/contract-artifacts": "^1.1.0",
- "@0x/json-schemas": "^2.0.1",
+ "@0x/json-schemas": "^2.1.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/node": "*",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.2",
diff --git a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts
index de096b7d9..9e240f9ef 100644
--- a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts
+++ b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts
@@ -1,3 +1,4 @@
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
/**
@@ -17,6 +18,6 @@ export abstract class AbstractOrderFilledCancelledFetcher {
* @param orderHash OrderHash of order we are interested in
* @return Whether or not the order is cancelled
*/
- public abstract async isOrderCancelledAsync(orderHash: string): Promise<boolean>;
+ public abstract async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean>;
public abstract getZRXAssetData(): string;
}
diff --git a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_lazy_store.ts b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_lazy_store.ts
index d9e66db06..186521401 100644
--- a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_lazy_store.ts
+++ b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_lazy_store.ts
@@ -1,8 +1,9 @@
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
export abstract class AbstractOrderFilledCancelledLazyStore {
public abstract async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber>;
- public abstract async getIsCancelledAsync(orderHash: string): Promise<boolean>;
+ public abstract async getIsCancelledAsync(signedOrder: SignedOrder): Promise<boolean>;
public abstract setFilledTakerAmount(orderHash: string, balance: BigNumber): void;
public abstract deleteFilledTakerAmount(orderHash: string): void;
public abstract setIsCancelled(orderHash: string, isCancelled: boolean): void;
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index 159aeeb09..fe0d6c773 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -117,7 +117,7 @@ export class OrderStateUtils {
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);
+ const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(signedOrder);
const sidedOrderRelevantState = {
isMakerSide: true,
traderBalance: orderRelevantState.makerBalance,
@@ -256,7 +256,7 @@ export class OrderStateUtils {
const filledTakerAssetAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash);
const totalMakerAssetAmount = signedOrder.makerAssetAmount;
const totalTakerAssetAmount = signedOrder.takerAssetAmount;
- const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash);
+ const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(signedOrder);
const remainingTakerAssetAmount = isOrderCancelled
? new BigNumber(0)
: totalTakerAssetAmount.minus(filledTakerAssetAmount);
diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts
index a40069f63..ae4291ea8 100644
--- a/packages/order-utils/src/order_validation_utils.ts
+++ b/packages/order-utils/src/order_validation_utils.ts
@@ -1,4 +1,4 @@
-import { RevertReason, SignedOrder } from '@0x/types';
+import { ExchangeContractErrs, RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
@@ -17,6 +17,7 @@ import { utils } from './utils';
*/
export class OrderValidationUtils {
private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
+ private readonly _provider: Provider;
/**
* A Typescript implementation mirroring the implementation of isRoundingError in the
* Exchange smart contract
@@ -57,65 +58,53 @@ export class OrderValidationUtils {
senderAddress: string,
zrxAssetData: string,
): Promise<void> {
- try {
- const fillMakerTokenAmount = utils.getPartialAmountFloor(
- fillTakerAssetAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerAssetAmount,
- );
- await exchangeTradeEmulator.transferFromAsync(
- signedOrder.makerAssetData,
- signedOrder.makerAddress,
- senderAddress,
- fillMakerTokenAmount,
- TradeSide.Maker,
- TransferType.Trade,
- );
- await exchangeTradeEmulator.transferFromAsync(
- signedOrder.takerAssetData,
- senderAddress,
- signedOrder.makerAddress,
- fillTakerAssetAmount,
- TradeSide.Taker,
- TransferType.Trade,
- );
- const makerFeeAmount = utils.getPartialAmountFloor(
- fillTakerAssetAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerFee,
- );
- await exchangeTradeEmulator.transferFromAsync(
- zrxAssetData,
- signedOrder.makerAddress,
- signedOrder.feeRecipientAddress,
- makerFeeAmount,
- TradeSide.Maker,
- TransferType.Fee,
- );
- const takerFeeAmount = utils.getPartialAmountFloor(
- fillTakerAssetAmount,
- signedOrder.takerAssetAmount,
- signedOrder.takerFee,
- );
- await exchangeTradeEmulator.transferFromAsync(
- zrxAssetData,
- senderAddress,
- signedOrder.feeRecipientAddress,
- takerFeeAmount,
- TradeSide.Taker,
- TransferType.Fee,
- );
- } catch (err) {
- throw new Error(RevertReason.TransferFailed);
- }
- }
- private static _validateRemainingFillAmountNotZeroOrThrow(
- takerAssetAmount: BigNumber,
- filledTakerTokenAmount: BigNumber,
- ): void {
- if (takerAssetAmount.eq(filledTakerTokenAmount)) {
- throw new Error(RevertReason.OrderUnfillable);
- }
+ const fillMakerTokenAmount = utils.getPartialAmountFloor(
+ fillTakerAssetAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerAssetAmount,
+ );
+ await exchangeTradeEmulator.transferFromAsync(
+ signedOrder.makerAssetData,
+ signedOrder.makerAddress,
+ senderAddress,
+ fillMakerTokenAmount,
+ TradeSide.Maker,
+ TransferType.Trade,
+ );
+ await exchangeTradeEmulator.transferFromAsync(
+ signedOrder.takerAssetData,
+ senderAddress,
+ signedOrder.makerAddress,
+ fillTakerAssetAmount,
+ TradeSide.Taker,
+ TransferType.Trade,
+ );
+ const makerFeeAmount = utils.getPartialAmountFloor(
+ fillTakerAssetAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerFee,
+ );
+ await exchangeTradeEmulator.transferFromAsync(
+ zrxAssetData,
+ signedOrder.makerAddress,
+ signedOrder.feeRecipientAddress,
+ makerFeeAmount,
+ TradeSide.Maker,
+ TransferType.Fee,
+ );
+ const takerFeeAmount = utils.getPartialAmountFloor(
+ fillTakerAssetAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.takerFee,
+ );
+ await exchangeTradeEmulator.transferFromAsync(
+ zrxAssetData,
+ senderAddress,
+ signedOrder.feeRecipientAddress,
+ takerFeeAmount,
+ TradeSide.Taker,
+ TransferType.Fee,
+ );
}
private static _validateOrderNotExpiredOrThrow(expirationTimeSeconds: BigNumber): void {
const currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
@@ -128,9 +117,13 @@ export class OrderValidationUtils {
* @param orderFilledCancelledFetcher A module that implements the AbstractOrderFilledCancelledFetcher
* @return An instance of OrderValidationUtils
*/
- constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher) {
+ constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher, provider: Provider) {
this._orderFilledCancelledFetcher = orderFilledCancelledFetcher;
+ this._provider = provider;
}
+ // TODO(fabio): remove this method once the smart contracts have been refactored
+ // to return helpful revert reasons instead of ORDER_UNFILLABLE. Instruct devs
+ // to make "calls" to validate order fillability + getOrderInfo for fillable amount.
/**
* Validate if the supplied order is fillable, and throw if it isn't
* @param exchangeTradeEmulator ExchangeTradeEmulator instance
@@ -146,12 +139,29 @@ export class OrderValidationUtils {
expectedFillTakerTokenAmount?: BigNumber,
): Promise<void> {
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const filledTakerTokenAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash);
- OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow(
- signedOrder.takerAssetAmount,
- filledTakerTokenAmount,
+ const isValidSignature = await signatureUtils.isValidSignatureAsync(
+ this._provider,
+ orderHash,
+ signedOrder.signature,
+ signedOrder.makerAddress,
);
- OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationTimeSeconds);
+ if (!isValidSignature) {
+ throw new Error(RevertReason.InvalidOrderSignature);
+ }
+
+ const isCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(signedOrder);
+ if (isCancelled) {
+ throw new Error('CANCELLED');
+ }
+ const filledTakerTokenAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash);
+ if (signedOrder.takerAssetAmount.eq(filledTakerTokenAmount)) {
+ throw new Error('FULLY_FILLED');
+ }
+ try {
+ OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationTimeSeconds);
+ } catch (err) {
+ throw new Error('EXPIRED');
+ }
let fillTakerAssetAmount = signedOrder.takerAssetAmount.minus(filledTakerTokenAmount);
if (!_.isUndefined(expectedFillTakerTokenAmount)) {
fillTakerAssetAmount = expectedFillTakerTokenAmount;
@@ -198,10 +208,9 @@ export class OrderValidationUtils {
throw new Error(OrderError.InvalidSignature);
}
const filledTakerTokenAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash);
- OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow(
- signedOrder.takerAssetAmount,
- filledTakerTokenAmount,
- );
+ if (signedOrder.takerAssetAmount.eq(filledTakerTokenAmount)) {
+ throw new Error(RevertReason.OrderUnfillable);
+ }
if (signedOrder.takerAddress !== constants.NULL_ADDRESS && signedOrder.takerAddress !== takerAddress) {
throw new Error(RevertReason.InvalidTaker);
}
@@ -210,13 +219,30 @@ export class OrderValidationUtils {
const desiredFillTakerTokenAmount = remainingTakerTokenAmount.lessThan(fillTakerAssetAmount)
? remainingTakerTokenAmount
: fillTakerAssetAmount;
- await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
- exchangeTradeEmulator,
- signedOrder,
- desiredFillTakerTokenAmount,
- takerAddress,
- zrxAssetData,
- );
+ try {
+ await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
+ exchangeTradeEmulator,
+ signedOrder,
+ desiredFillTakerTokenAmount,
+ takerAddress,
+ zrxAssetData,
+ );
+ } catch (err) {
+ const transferFailedErrorMessages = [
+ ExchangeContractErrs.InsufficientMakerBalance,
+ ExchangeContractErrs.InsufficientMakerFeeBalance,
+ ExchangeContractErrs.InsufficientTakerBalance,
+ ExchangeContractErrs.InsufficientTakerFeeBalance,
+ ExchangeContractErrs.InsufficientMakerAllowance,
+ ExchangeContractErrs.InsufficientMakerFeeAllowance,
+ ExchangeContractErrs.InsufficientTakerAllowance,
+ ExchangeContractErrs.InsufficientTakerFeeAllowance,
+ ];
+ if (_.includes(transferFailedErrorMessages, err.message)) {
+ throw new Error(RevertReason.TransferFailed);
+ }
+ throw err;
+ }
const wouldRoundingErrorOccur = OrderValidationUtils.isRoundingErrorFloor(
desiredFillTakerTokenAmount,
@@ -228,33 +254,4 @@ export class OrderValidationUtils {
}
return filledTakerTokenAmount;
}
- /**
- * Validate a call to fillOrKillOrder and throw if it would fail
- * @param exchangeTradeEmulator ExchangeTradeEmulator to use
- * @param provider Web3 provider to use for JSON RPC requests
- * @param signedOrder SignedOrder of interest
- * @param fillTakerAssetAmount Amount we'd like to fill the order for
- * @param takerAddress The taker of the order
- * @param zrxAssetData ZRX asset data
- */
- public async validateFillOrKillOrderThrowIfInvalidAsync(
- exchangeTradeEmulator: ExchangeTransferSimulator,
- provider: Provider,
- signedOrder: SignedOrder,
- fillTakerAssetAmount: BigNumber,
- takerAddress: string,
- zrxAssetData: string,
- ): Promise<void> {
- const filledTakerTokenAmount = await this.validateFillOrderThrowIfInvalidAsync(
- exchangeTradeEmulator,
- provider,
- signedOrder,
- fillTakerAssetAmount,
- takerAddress,
- zrxAssetData,
- );
- if (filledTakerTokenAmount !== fillTakerAssetAmount) {
- throw new Error(RevertReason.OrderUnfillable);
- }
- }
}
diff --git a/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts b/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts
index 1d84ffdaa..afd6f1108 100644
--- a/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts
+++ b/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts
@@ -1,8 +1,10 @@
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { AbstractOrderFilledCancelledFetcher } from '../abstract/abstract_order_filled_cancelled_fetcher';
import { AbstractOrderFilledCancelledLazyStore } from '../abstract/abstract_order_filled_cancelled_lazy_store';
+import { orderHashUtils } from '../order_hash';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
@@ -58,9 +60,10 @@ export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancell
* @param orderHash OrderHash from order of interest
* @return Whether the order has been cancelled
*/
- public async getIsCancelledAsync(orderHash: string): Promise<boolean> {
+ public async getIsCancelledAsync(signedOrder: SignedOrder): Promise<boolean> {
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
if (_.isUndefined(this._isCancelled[orderHash])) {
- const isCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash);
+ const isCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(signedOrder);
this.setIsCancelled(orderHash, isCancelled);
}
const cachedIsCancelled = this._isCancelled[orderHash]; // tslint:disable-line:boolean-naming
diff --git a/packages/order-utils/test/order_state_utils_test.ts b/packages/order-utils/test/order_state_utils_test.ts
index 39c4c362f..42acd54c6 100644
--- a/packages/order-utils/test/order_state_utils_test.ts
+++ b/packages/order-utils/test/order_state_utils_test.ts
@@ -1,3 +1,4 @@
+import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import 'mocha';
@@ -33,7 +34,7 @@ describe('OrderStateUtils', () => {
async getFilledTakerAmountAsync(_orderHash: string): Promise<BigNumber> {
return filledAmount;
},
- async isOrderCancelledAsync(_orderHash: string): Promise<boolean> {
+ async isOrderCancelledAsync(_signedOrder: SignedOrder): Promise<boolean> {
return cancelled;
},
getZRXAssetData(): string {
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json
index c662903a3..dbb4824fc 100644
--- a/packages/order-watcher/CHANGELOG.json
+++ b/packages/order-watcher/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "2.2.3",
+ "changes": [
+ {
+ "note": "Start jsonRpcRequestId at 1, not 0 as 0 breaks the web3.js websocket RPC provider",
+ "pr": 1227
+ }
+ ]
+ },
+ {
+ "timestamp": 1542028948,
+ "version": "2.2.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.2.1",
"changes": [
{
diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md
index b271956c7..1470b0e48 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
+## v2.2.2 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.2.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index 174e0a3a6..6bb1ef485 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-watcher",
- "version": "2.2.1",
+ "version": "2.2.2",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -33,8 +33,8 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
- "@0x/migrations": "^2.0.1",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/migrations": "^2.0.2",
"@0x/tslint-config": "^1.0.10",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
@@ -57,19 +57,19 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.2",
- "@0x/assert": "^1.0.15",
- "@0x/base-contract": "^3.0.3",
+ "@0x/abi-gen-wrappers": "^1.0.3",
+ "@0x/assert": "^1.0.16",
+ "@0x/base-contract": "^3.0.4",
"@0x/contract-addresses": "^1.1.0",
"@0x/contract-artifacts": "^1.1.0",
- "@0x/contract-wrappers": "^3.0.1",
- "@0x/fill-scenarios": "^1.0.9",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
+ "@0x/contract-wrappers": "^4.0.0",
+ "@0x/fill-scenarios": "^1.0.10",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"bintrees": "^1.0.2",
"ethereum-types": "^1.1.2",
"ethereumjs-blockstream": "6.0.0",
diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json
index 228dfab4f..42de578a6 100644
--- a/packages/react-docs/CHANGELOG.json
+++ b/packages/react-docs/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.15",
"changes": [
{
diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md
index 991b3a490..7f0514ddb 100644
--- a/packages/react-docs/CHANGELOG.md
+++ b/packages/react-docs/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.16 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.15 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json
index 827a54fdb..fb1d6d78c 100644
--- a/packages/react-docs/package.json
+++ b/packages/react-docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-docs",
- "version": "1.0.15",
+ "version": "1.0.16",
"engines": {
"node": ">=6.12"
},
@@ -24,7 +24,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
+ "@0x/dev-utils": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"@types/compare-versions": "^3.0.0",
"@types/styled-components": "^4.0.0",
@@ -34,7 +34,7 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/react-shared": "^1.0.18",
+ "@0x/react-shared": "^1.0.19",
"@0x/types": "^1.2.1",
"@0x/utils": "^2.0.4",
"@types/lodash": "4.14.104",
diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json
index 4dd11398b..4394eeb2e 100644
--- a/packages/react-shared/CHANGELOG.json
+++ b/packages/react-shared/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.18",
"changes": [
{
diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md
index 54ca77b16..4104628bc 100644
--- a/packages/react-shared/CHANGELOG.md
+++ b/packages/react-shared/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.19 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.18 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index 35a69f105..1336ce2dd 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-shared",
- "version": "1.0.18",
+ "version": "1.0.19",
"engines": {
"node": ">=6.12"
},
@@ -25,7 +25,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
+ "@0x/dev-utils": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json
index 724e68a68..b432d9d90 100644
--- a/packages/sol-compiler/CHANGELOG.json
+++ b/packages/sol-compiler/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.1.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.1.9",
"changes": [
{
diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md
index 322313f9e..2e2d810a6 100644
--- a/packages/sol-compiler/CHANGELOG.md
+++ b/packages/sol-compiler/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.10 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.1.9 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 766c789df..7c27dbc19 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-compiler",
- "version": "1.1.9",
+ "version": "1.1.10",
"engines": {
"node": ">=6.12"
},
@@ -42,7 +42,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.14",
+ "@0x/dev-utils": "^1.0.15",
"@0x/tslint-config": "^1.0.10",
"@types/mkdirp": "^0.5.2",
"@types/require-from-string": "^1.2.0",
@@ -65,13 +65,13 @@
"zeppelin-solidity": "1.8.0"
},
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/json-schemas": "^2.0.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/json-schemas": "^2.1.0",
"@0x/sol-resolver": "^1.0.16",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/yargs": "^11.0.0",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.2",
diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json
index e331d608f..83efa8ac7 100644
--- a/packages/sol-cov/CHANGELOG.json
+++ b/packages/sol-cov/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "2.1.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.1.9",
"changes": [
{
diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md
index e9d9d6952..50ca2d6e2 100644
--- a/packages/sol-cov/CHANGELOG.md
+++ b/packages/sol-cov/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.10 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.1.9 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index 34e7a8559..613bce8d3 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-cov",
- "version": "2.1.9",
+ "version": "2.1.10",
"engines": {
"node": ">=6.12"
},
@@ -42,12 +42,12 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": {
- "@0x/dev-utils": "^1.0.14",
- "@0x/sol-compiler": "^1.1.9",
- "@0x/subproviders": "^2.1.1",
+ "@0x/dev-utils": "^1.0.15",
+ "@0x/sol-compiler": "^1.1.10",
+ "@0x/subproviders": "^2.1.2",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@types/solidity-parser-antlr": "^0.2.0",
"ethereum-types": "^1.1.2",
"ethereumjs-util": "^5.1.1",
diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json
index d54569a4d..a2e903a24 100644
--- a/packages/sol-doc/CHANGELOG.json
+++ b/packages/sol-doc/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.4",
"changes": [
{
diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md
index d44af5d7f..257744b98 100644
--- a/packages/sol-doc/CHANGELOG.md
+++ b/packages/sol-doc/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.5 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.4 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json
index 0eb5d6fd5..102911acc 100644
--- a/packages/sol-doc/package.json
+++ b/packages/sol-doc/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-doc",
- "version": "1.0.4",
+ "version": "1.0.5",
"description": "Solidity documentation generator",
"main": "lib/src/index.js",
"types": "lib/src/index.d.js",
@@ -25,7 +25,7 @@
"author": "F. Eugene Aumson",
"license": "Apache-2.0",
"dependencies": {
- "@0x/sol-compiler": "^1.1.9",
+ "@0x/sol-compiler": "^1.1.10",
"@0x/types": "^1.2.1",
"@0x/utils": "^2.0.4",
"ethereum-types": "^1.1.2",
diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json
index e053b3163..37ad85385 100644
--- a/packages/sra-spec/CHANGELOG.json
+++ b/packages/sra-spec/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "1.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.8",
"changes": [
{
diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md
index 02d22431f..c53ad6b5b 100644
--- a/packages/sra-spec/CHANGELOG.md
+++ b/packages/sra-spec/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.9 - _November 12, 2018_
+
+ * Dependencies updated
+
## v1.0.8 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json
index e3b6ad979..1b7d0ccab 100644
--- a/packages/sra-spec/package.json
+++ b/packages/sra-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sra-spec",
- "version": "1.0.8",
+ "version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -35,7 +35,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md",
"dependencies": {
- "@0x/json-schemas": "^2.0.1",
+ "@0x/json-schemas": "^2.1.0",
"@loopback/openapi-v3-types": "^0.8.2"
},
"devDependencies": {
diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json
index 816c776a5..49b1d99d0 100644
--- a/packages/subproviders/CHANGELOG.json
+++ b/packages/subproviders/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "2.1.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.1.1",
"changes": [
{
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 72ac9d1f7..a8ef8deb6 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.2 - _November 12, 2018_
+
+ * Dependencies updated
+
## v2.1.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 1a25b5e32..c5a1dc3d1 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/subproviders",
- "version": "2.1.1",
+ "version": "2.1.2",
"engines": {
"node": ">=6.12"
},
@@ -29,11 +29,11 @@
}
},
"dependencies": {
- "@0x/assert": "^1.0.15",
+ "@0x/assert": "^1.0.16",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"@ledgerhq/hw-app-eth": "^4.3.0",
"@ledgerhq/hw-transport-u2f": "4.24.0",
"@types/eth-lightwallet": "^3.0.0",
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index c46f5465a..fec328ec7 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0x/testnet-faucets",
- "version": "1.0.53",
+ "version": "1.0.54",
"engines": {
"node": ">=6.12"
},
@@ -18,11 +18,11 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^2.0.1",
- "@0x/subproviders": "^2.1.1",
+ "0x.js": "^2.0.2",
+ "@0x/subproviders": "^2.1.2",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"body-parser": "^1.17.1",
"ethereum-types": "^1.1.2",
"ethereumjs-tx": "^1.3.5",
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index 7b21da73a..89d153eef 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "timestamp": 1542028948,
+ "version": "3.1.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "3.1.1",
"changes": [
{
diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md
index ebbef2c48..80ac76b9a 100644
--- a/packages/web3-wrapper/CHANGELOG.md
+++ b/packages/web3-wrapper/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.1.2 - _November 12, 2018_
+
+ * Dependencies updated
+
## v3.1.1 - _November 9, 2018_
* Fix bug in `getTransactionByHashAsync` which was causing the return value to have the wrong type (raw fields instead of unmarshalled fields). (#1177)
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 2b87cc92a..9f3bfe3c3 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/web3-wrapper",
- "version": "3.1.1",
+ "version": "3.1.2",
"engines": {
"node": ">=6.12"
},
@@ -53,8 +53,8 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/assert": "^1.0.15",
- "@0x/json-schemas": "^2.0.1",
+ "@0x/assert": "^1.0.16",
+ "@0x/json-schemas": "^2.1.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
"ethereum-types": "^1.1.2",
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts
index 56877fef3..be1713f20 100644
--- a/packages/web3-wrapper/src/web3_wrapper.ts
+++ b/packages/web3-wrapper/src/web3_wrapper.ts
@@ -157,7 +157,7 @@ export class Web3Wrapper {
this.abiDecoder = new AbiDecoder([]);
this._provider = provider;
this._txDefaults = txDefaults || {};
- this._jsonRpcRequestId = 0;
+ this._jsonRpcRequestId = 1;
}
/**
* Get the contract defaults set to the Web3Wrapper instance
@@ -533,9 +533,6 @@ export class Web3Wrapper {
method: 'eth_call',
params: [callDataHex, marshalledDefaultBlock],
});
- if (rawCallResult === '0x') {
- throw new Error('Contract call failed (returned null)');
- }
return rawCallResult;
}
/**
diff --git a/packages/website/package.json b/packages/website/package.json
index fd671d85d..143751656 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/website",
- "version": "0.0.56",
+ "version": "0.0.57",
"engines": {
"node": ">=6.12"
},
@@ -20,16 +20,16 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "@0x/contract-wrappers": "^3.0.1",
- "@0x/json-schemas": "^2.0.1",
- "@0x/order-utils": "^2.0.1",
- "@0x/react-docs": "^1.0.15",
- "@0x/react-shared": "^1.0.18",
- "@0x/subproviders": "^2.1.1",
+ "@0x/contract-wrappers": "^4.0.0",
+ "@0x/json-schemas": "^2.1.0",
+ "@0x/order-utils": "^3.0.0",
+ "@0x/react-docs": "^1.0.16",
+ "@0x/react-shared": "^1.0.19",
+ "@0x/subproviders": "^2.1.2",
"@0x/types": "^1.2.1",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.4",
- "@0x/web3-wrapper": "^3.1.1",
+ "@0x/web3-wrapper": "^3.1.2",
"accounting": "^0.4.1",
"basscss": "^8.0.3",
"blockies": "^0.0.2",
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index b43c41739..25430c1c7 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -26,7 +26,7 @@ import { BlockParam, LogWithDecodedArgs, Provider, TransactionReceiptWithDecoded
import * as _ from 'lodash';
import * as moment from 'moment';
import * as React from 'react';
-import contract = require('truffle-contract');
+import contract from 'truffle-contract';
import { BlockchainWatcher } from 'ts/blockchain_watcher';
import { AssetSendCompleted } from 'ts/components/flash_messages/asset_send_completed';
import { TransactionSubmitted } from 'ts/components/flash_messages/transaction_submitted';
@@ -55,9 +55,9 @@ import { errorReporter } from 'ts/utils/error_reporter';
import { fakeTokenRegistry } from 'ts/utils/fake_token_registry';
import { tokenAddressOverrides } from 'ts/utils/token_address_overrides';
import { utils } from 'ts/utils/utils';
-import FilterSubprovider = require('web3-provider-engine/subproviders/filters');
+import FilterSubprovider from 'web3-provider-engine/subproviders/filters';
-import * as MintableArtifacts from '../contracts/Mintable.json';
+import MintableArtifacts from '../contracts/Mintable.json';
const BLOCK_NUMBER_BACK_TRACK = 50;
const GWEI_IN_WEI = 1000000000;
diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
index a9f591150..e15a2dd94 100644
--- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
+++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
@@ -7,7 +7,7 @@ import FlatButton from 'material-ui/FlatButton';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
import TextField from 'material-ui/TextField';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { Blockchain } from 'ts/blockchain';
import { NetworkDropDown } from 'ts/components/dropdowns/network_drop_down';
import { LifeCycleRaisedButton } from 'ts/components/ui/lifecycle_raised_button';
diff --git a/packages/website/ts/components/eth_wrappers.tsx b/packages/website/ts/components/eth_wrappers.tsx
index 2af4252bd..4a9f3b2fe 100644
--- a/packages/website/ts/components/eth_wrappers.tsx
+++ b/packages/website/ts/components/eth_wrappers.tsx
@@ -6,7 +6,7 @@ import Divider from 'material-ui/Divider';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
import * as moment from 'moment';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { Blockchain } from 'ts/blockchain';
import { EthWethConversionButton } from 'ts/components/eth_weth_conversion_button';
import { Dispatcher } from 'ts/redux/dispatcher';
diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx
index 98aad6c62..e6ecd2ec8 100644
--- a/packages/website/ts/components/generate_order/asset_picker.tsx
+++ b/packages/website/ts/components/generate_order/asset_picker.tsx
@@ -3,7 +3,7 @@ import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import * as moment from 'moment';
import * as React from 'react';
-import firstBy = require('thenby');
+import firstBy from 'thenby';
import { Blockchain } from 'ts/blockchain';
import { NewTokenForm } from 'ts/components/generate_order/new_token_form';
diff --git a/packages/website/ts/components/inputs/allowance_state_toggle.tsx b/packages/website/ts/components/inputs/allowance_state_toggle.tsx
index fd7d3b174..5396295d2 100644
--- a/packages/website/ts/components/inputs/allowance_state_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_state_toggle.tsx
@@ -2,7 +2,7 @@ import { colors } from '@0x/react-shared';
import { BigNumber, logUtils } from '@0x/utils';
import * as _ from 'lodash';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { Blockchain } from 'ts/blockchain';
import { AllowanceState, AllowanceStateView } from 'ts/components/ui/allowance_state_view';
import { Container } from 'ts/components/ui/container';
diff --git a/packages/website/ts/components/inputs/hash_input.tsx b/packages/website/ts/components/inputs/hash_input.tsx
index 73b6615d4..7688ffe21 100644
--- a/packages/website/ts/components/inputs/hash_input.tsx
+++ b/packages/website/ts/components/inputs/hash_input.tsx
@@ -3,7 +3,7 @@ import { Styles } from '@0x/react-shared';
import { Order } from '@0x/types';
import * as _ from 'lodash';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { Blockchain } from 'ts/blockchain';
import { FakeTextField } from 'ts/components/ui/fake_text_field';
diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx
index 9ba2bad84..92aecf046 100644
--- a/packages/website/ts/components/token_balances.tsx
+++ b/packages/website/ts/components/token_balances.tsx
@@ -16,8 +16,8 @@ import ContentAdd from 'material-ui/svg-icons/content/add';
import ContentRemove from 'material-ui/svg-icons/content/remove';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
-import firstBy = require('thenby');
+import ReactTooltip from 'react-tooltip';
+import firstBy from 'thenby';
import { Blockchain } from 'ts/blockchain';
import { AssetPicker } from 'ts/components/generate_order/asset_picker';
import { SendButton } from 'ts/components/send_button';
diff --git a/packages/website/ts/components/ui/copy_icon.tsx b/packages/website/ts/components/ui/copy_icon.tsx
index 59e398cb6..403cd4607 100644
--- a/packages/website/ts/components/ui/copy_icon.tsx
+++ b/packages/website/ts/components/ui/copy_icon.tsx
@@ -2,7 +2,7 @@ import { colors } from '@0x/react-shared';
import * as React from 'react';
import * as CopyToClipboard from 'react-copy-to-clipboard';
import * as ReactDOM from 'react-dom';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
interface CopyIconProps {
data: string;
diff --git a/packages/website/ts/components/ui/ethereum_address.tsx b/packages/website/ts/components/ui/ethereum_address.tsx
index 71d98af56..12f8636eb 100644
--- a/packages/website/ts/components/ui/ethereum_address.tsx
+++ b/packages/website/ts/components/ui/ethereum_address.tsx
@@ -1,6 +1,6 @@
import { EtherscanLinkSuffixes } from '@0x/react-shared';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { EtherScanIcon } from 'ts/components/ui/etherscan_icon';
import { utils } from 'ts/utils/utils';
diff --git a/packages/website/ts/components/ui/etherscan_icon.tsx b/packages/website/ts/components/ui/etherscan_icon.tsx
index 57ab91ba2..a7fba8a33 100644
--- a/packages/website/ts/components/ui/etherscan_icon.tsx
+++ b/packages/website/ts/components/ui/etherscan_icon.tsx
@@ -1,7 +1,7 @@
import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
interface EtherScanIconProps {
addressOrTxHash: string;
diff --git a/packages/website/ts/components/ui/help_tooltip.tsx b/packages/website/ts/components/ui/help_tooltip.tsx
index d827eebb9..831d888f5 100644
--- a/packages/website/ts/components/ui/help_tooltip.tsx
+++ b/packages/website/ts/components/ui/help_tooltip.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
interface HelpTooltipProps {
style?: React.CSSProperties;
diff --git a/packages/website/ts/components/ui/identicon.tsx b/packages/website/ts/components/ui/identicon.tsx
index b5b374973..9eca04a5d 100644
--- a/packages/website/ts/components/ui/identicon.tsx
+++ b/packages/website/ts/components/ui/identicon.tsx
@@ -1,4 +1,4 @@
-import blockies = require('blockies');
+import blockies from 'blockies';
import * as _ from 'lodash';
import * as React from 'react';
diff --git a/packages/website/ts/components/ui/party.tsx b/packages/website/ts/components/ui/party.tsx
index 6c0572437..f9e0967d4 100644
--- a/packages/website/ts/components/ui/party.tsx
+++ b/packages/website/ts/components/ui/party.tsx
@@ -1,7 +1,7 @@
import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
-import ReactTooltip = require('react-tooltip');
+import ReactTooltip from 'react-tooltip';
import { EthereumAddress } from 'ts/components/ui/ethereum_address';
import { Identicon } from 'ts/components/ui/identicon';
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx
index 326cd3cfa..d9da0b9d5 100644
--- a/packages/website/ts/components/wallet/wallet.tsx
+++ b/packages/website/ts/components/wallet/wallet.tsx
@@ -4,7 +4,7 @@ import * as _ from 'lodash';
import ActionAccountBalanceWallet from 'material-ui/svg-icons/action/account-balance-wallet';
import * as React from 'react';
-import firstBy = require('thenby');
+import firstBy from 'thenby';
import { Blockchain } from 'ts/blockchain';
import { AccountConnection } from 'ts/components/ui/account_connection';
diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx
index 91818b035..ef6a0a1aa 100644
--- a/packages/website/ts/local_storage/trade_history_storage.tsx
+++ b/packages/website/ts/local_storage/trade_history_storage.tsx
@@ -1,5 +1,5 @@
import { BigNumber } from '@0x/utils';
-import ethUtil = require('ethereumjs-util');
+import ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { localStorage } from 'ts/local_storage/local_storage';
import { Fill } from 'ts/types';
diff --git a/packages/website/ts/pages/documentation/developers_page.tsx b/packages/website/ts/pages/documentation/developers_page.tsx
index 361dbc86e..89389e488 100644
--- a/packages/website/ts/pages/documentation/developers_page.tsx
+++ b/packages/website/ts/pages/documentation/developers_page.tsx
@@ -1,7 +1,7 @@
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
-import DocumentTitle = require('react-document-title');
+import DocumentTitle from 'react-document-title';
import { DocsLogo } from 'ts/components/documentation/docs_logo';
import { DocsTopBar } from 'ts/components/documentation/docs_top_bar';
import { Container } from 'ts/components/ui/container';
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 28bf2dba1..8392c90e4 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -6,11 +6,11 @@ import {
SupportedDocJson,
TypeDocUtils,
} from '@0x/react-docs';
-import findVersions = require('find-versions');
+import findVersions from 'find-versions';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import * as React from 'react';
-import semverSort = require('semver-sort');
+import semverSort from 'semver-sort';
import { SidebarHeader } from 'ts/components/documentation/sidebar_header';
import { NestedSidebarMenu } from 'ts/components/nested_sidebar_menu';
import { Container } from 'ts/components/ui/container';
diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx
index c56ed4ebe..e2af40c8d 100644
--- a/packages/website/ts/pages/landing/landing.tsx
+++ b/packages/website/ts/pages/landing/landing.tsx
@@ -1,7 +1,7 @@
import { colors, Link } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
-import DocumentTitle = require('react-document-title');
+import DocumentTitle from 'react-document-title';
import { Footer } from 'ts/components/footer';
import { SubscribeForm } from 'ts/components/forms/subscribe_form';
import { TopBar } from 'ts/components/top_bar/top_bar';
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index e0b883ace..6be164e6e 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -2,7 +2,7 @@ import { DocAgnosticFormat, GeneratedDocJson } from '@0x/react-docs';
import { fetchAsync, logUtils } from '@0x/utils';
import * as _ from 'lodash';
import { S3FileObject, VersionToFilePath } from 'ts/types';
-import convert = require('xml-js');
+import convert from 'xml-js';
export const docUtils = {
async getVersionToFilePathAsync(s3DocJsonRoot: string, folderName: string): Promise<VersionToFilePath> {
diff --git a/packages/website/ts/utils/error_reporter.ts b/packages/website/ts/utils/error_reporter.ts
index 6fc1216c3..8e24060ac 100644
--- a/packages/website/ts/utils/error_reporter.ts
+++ b/packages/website/ts/utils/error_reporter.ts
@@ -1,5 +1,5 @@
import { logUtils } from '@0x/utils';
-import Rollbar = require('rollbar');
+import Rollbar from 'rollbar';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { utils } from 'ts/utils/utils';
diff --git a/packages/website/ts/utils/translate.ts b/packages/website/ts/utils/translate.ts
index 5595e6e0f..af5c766a9 100644
--- a/packages/website/ts/utils/translate.ts
+++ b/packages/website/ts/utils/translate.ts
@@ -1,11 +1,11 @@
import * as _ from 'lodash';
import { Deco, Key, Language } from 'ts/types';
-import * as chinese from '../../translations/chinese.json';
-import * as english from '../../translations/english.json';
-import * as korean from '../../translations/korean.json';
-import * as russian from '../../translations/russian.json';
-import * as spanish from '../../translations/spanish.json';
+import chinese from '../../translations/chinese.json';
+import english from '../../translations/english.json';
+import korean from '../../translations/korean.json';
+import russian from '../../translations/russian.json';
+import spanish from '../../translations/spanish.json';
const languageToTranslations = {
[Language.English]: english,
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 87aa48018..8cc0061de 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -5,7 +5,7 @@ import { ExchangeContractErrs } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as bowser from 'bowser';
-import deepEqual = require('deep-equal');
+import deepEqual from 'deep-equal';
import * as _ from 'lodash';
import * as moment from 'moment';
import * as numeral from 'numeral';
diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json
index 6421cd459..7d5f31b7f 100644
--- a/packages/website/tsconfig.json
+++ b/packages/website/tsconfig.json
@@ -16,7 +16,9 @@
"composite": false,
"paths": {
"*": ["node_modules/@types/*", "*"]
- }
+ },
+ "module": "esnext",
+ "moduleResolution": "node"
},
"include": ["./ts/**/*"]
}