aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-18 18:35:07 +0800
committerFabio Berger <me@fabioberger.com>2018-10-18 18:35:07 +0800
commitcdd650d0eb83153a992922c6ffff35b494f299d3 (patch)
treefc12135e69ae74403a26408d2d7625e8a3fe334e
parentc333d093b585fa0250a6973f2d396eb3cf227334 (diff)
parentbd8ba14bf46cb901e14f0ee718ac01cdbc833e86 (diff)
downloaddexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.gz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.bz2
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.lz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.xz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.zst
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.zip
merge development
-rw-r--r--.circleci/config.yml1
-rw-r--r--.prettierignore1
-rw-r--r--CODEOWNERS18
-rw-r--r--package.json6
-rw-r--r--packages/0x.js/CHANGELOG.json4
-rw-r--r--packages/0x.js/package.json2
-rw-r--r--packages/0x.js/src/index.ts1
-rw-r--r--packages/asset-buyer/CHANGELOG.json16
-rw-r--r--packages/asset-buyer/package.json5
-rw-r--r--packages/asset-buyer/src/index.ts9
-rw-r--r--packages/base-contract/src/index.ts3
-rw-r--r--packages/connect/package.json2
-rw-r--r--packages/connect/src/utils/assert.ts2
-rw-r--r--packages/contract-addresses/CHANGELOG.json10
-rw-r--r--packages/contract-artifacts/CHANGELOG.json10
-rw-r--r--packages/contract-wrappers/package.json2
-rw-r--r--packages/ethereum-types/src/index.ts16
-rw-r--r--packages/instant/package.json7
-rw-r--r--packages/instant/src/components/amount_input.tsx12
-rw-r--r--packages/instant/src/components/animations/slide_animations.tsx54
-rw-r--r--packages/instant/src/components/animations/slide_up_and_down_animation.tsx96
-rw-r--r--packages/instant/src/components/asset_amount_input.tsx38
-rw-r--r--packages/instant/src/components/buy_button.tsx58
-rw-r--r--packages/instant/src/components/instant_heading.tsx62
-rw-r--r--packages/instant/src/components/order_details.tsx110
-rw-r--r--packages/instant/src/components/sliding_error.tsx24
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx3
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx17
-rw-r--r--packages/instant/src/constants.ts6
-rw-r--r--packages/instant/src/containers/latest_buy_quote_order_details.ts27
-rw-r--r--packages/instant/src/containers/latest_error.tsx35
-rw-r--r--packages/instant/src/containers/selected_asset_amount_input.ts89
-rw-r--r--packages/instant/src/containers/selected_asset_amount_input.tsx36
-rw-r--r--packages/instant/src/containers/selected_asset_buy_button.ts55
-rw-r--r--packages/instant/src/containers/selected_asset_instant_heading.ts30
-rw-r--r--packages/instant/src/data/asset_meta_data.ts15
-rw-r--r--packages/instant/src/redux/actions.ts46
-rw-r--r--packages/instant/src/redux/async_data.ts22
-rw-r--r--packages/instant/src/redux/reducer.ts67
-rw-r--r--packages/instant/src/redux/store.ts3
-rw-r--r--packages/instant/src/types.ts36
-rw-r--r--packages/instant/src/util/asset_buyer.ts9
-rw-r--r--packages/instant/src/util/asset_data.ts21
-rw-r--r--packages/instant/src/util/coinbase_api.ts10
-rw-r--r--packages/instant/src/util/error.ts62
-rw-r--r--packages/instant/src/util/format.ts53
-rw-r--r--packages/instant/src/util/provider.ts12
-rw-r--r--packages/instant/src/util/util.ts5
-rw-r--r--packages/instant/src/util/web3_wrapper.ts5
-rw-r--r--packages/instant/test/components/zero_ex_instant.test.tsx12
-rw-r--r--packages/instant/test/util/asset_data.test.ts17
-rw-r--r--packages/instant/test/util/error.test.ts48
-rw-r--r--packages/instant/test/util/format.test.ts97
-rw-r--r--packages/json-schemas/CHANGELOG.json10
-rw-r--r--packages/json-schemas/package.json4
-rw-r--r--packages/json-schemas/schemas/address_schema.json5
-rw-r--r--packages/json-schemas/schemas/basic_type_schemas.ts17
-rw-r--r--packages/json-schemas/schemas/block_param_schema.json11
-rw-r--r--packages/json-schemas/schemas/block_range_schema.json8
-rw-r--r--packages/json-schemas/schemas/block_range_schema.ts20
-rw-r--r--packages/json-schemas/schemas/call_data_schema.json27
-rw-r--r--packages/json-schemas/schemas/call_data_schema.ts27
-rw-r--r--packages/json-schemas/schemas/ec_signature_parameter_schema.json5
-rw-r--r--packages/json-schemas/schemas/ec_signature_schema.json14
-rw-r--r--packages/json-schemas/schemas/ec_signature_schema.ts20
-rw-r--r--packages/json-schemas/schemas/eip712_typed_data.ts28
-rw-r--r--packages/json-schemas/schemas/eip712_typed_data_schema.json28
-rw-r--r--packages/json-schemas/schemas/hex_schema.json5
-rw-r--r--packages/json-schemas/schemas/index_filter_values_schema.json7
-rw-r--r--packages/json-schemas/schemas/index_filter_values_schema.ts7
-rw-r--r--packages/json-schemas/schemas/js_number.json5
-rw-r--r--packages/json-schemas/schemas/number_schema.json5
-rw-r--r--packages/json-schemas/schemas/order_cancel_schema.json12
-rw-r--r--packages/json-schemas/schemas/order_cancel_schema.ts12
-rw-r--r--packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json12
-rw-r--r--packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts12
-rw-r--r--packages/json-schemas/schemas/order_fill_requests_schema.json12
-rw-r--r--packages/json-schemas/schemas/order_fill_requests_schema.ts12
-rw-r--r--packages/json-schemas/schemas/order_hash_schema.json5
-rw-r--r--packages/json-schemas/schemas/order_hash_schema.ts5
-rw-r--r--packages/json-schemas/schemas/order_schema.json34
-rw-r--r--packages/json-schemas/schemas/order_schemas.ts47
-rw-r--r--packages/json-schemas/schemas/orders_schema.json5
-rw-r--r--packages/json-schemas/schemas/orders_schema.ts5
-rw-r--r--packages/json-schemas/schemas/paginated_collection_schema.json10
-rw-r--r--packages/json-schemas/schemas/paginated_collection_schema.ts10
-rw-r--r--packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json13
-rw-r--r--packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json12
-rw-r--r--packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json11
-rw-r--r--packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts38
-rw-r--r--packages/json-schemas/schemas/relayer_api_error_response_schema.json21
-rw-r--r--packages/json-schemas/schemas/relayer_api_error_response_schema.ts21
-rw-r--r--packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json16
-rw-r--r--packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts16
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json24
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts24
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_response_schema.json11
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts11
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_schema.json9
-rw-r--r--packages/json-schemas/schemas/relayer_api_order_schema.ts9
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json9
-rw-r--r--packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts9
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json14
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json11
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts26
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json11
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts11
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_response_schema.json13
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_response_schema.ts13
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_schema.json5
-rw-r--r--packages/json-schemas/schemas/relayer_api_orders_schema.ts5
-rw-r--r--packages/json-schemas/schemas/signed_order_schema.json12
-rw-r--r--packages/json-schemas/schemas/signed_orders_schema.json5
-rw-r--r--packages/json-schemas/schemas/signed_orders_schema.ts5
-rw-r--r--packages/json-schemas/schemas/token_schema.json11
-rw-r--r--packages/json-schemas/schemas/token_schema.ts11
-rw-r--r--packages/json-schemas/schemas/tx_data_schema.json26
-rw-r--r--packages/json-schemas/schemas/tx_data_schema.ts32
-rw-r--r--packages/json-schemas/schemas/zero_ex_transaction_schema.json10
-rw-r--r--packages/json-schemas/schemas/zero_ex_transaction_schema.ts10
-rw-r--r--packages/json-schemas/src/globals.d.ts6
-rw-r--r--packages/json-schemas/src/schemas.ts74
-rw-r--r--packages/json-schemas/tsconfig.json44
-rw-r--r--packages/monorepo-scripts/CHANGELOG.json13
-rw-r--r--packages/monorepo-scripts/package.json2
-rw-r--r--packages/monorepo-scripts/src/doc_gen_configs.ts15
-rw-r--r--packages/monorepo-scripts/src/utils/changelog_utils.ts3
-rw-r--r--packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts2
-rw-r--r--packages/order-utils/CHANGELOG.json4
-rw-r--r--packages/order-utils/package.json2
-rw-r--r--packages/order-utils/src/asset_data_utils.ts4
-rw-r--r--packages/order-utils/src/index.ts2
-rw-r--r--packages/sol-compiler/package.json2
-rw-r--r--packages/sol-compiler/src/utils/encoder.ts6
-rw-r--r--packages/sol-cov/package.json2
-rw-r--r--packages/sol-doc/src/sol_doc.ts14
-rw-r--r--packages/sra-spec/src/json-schemas.ts4
-rw-r--r--packages/subproviders/package.json2
-rw-r--r--packages/types/CHANGELOG.json4
-rw-r--r--packages/types/src/index.ts2
-rw-r--r--packages/utils/src/abi_decoder.ts8
-rw-r--r--packages/web3-wrapper/package.json2
-rw-r--r--packages/website/md/docs/asset_buyer/installation.md17
-rw-r--r--packages/website/md/docs/asset_buyer/introduction.md1
-rw-r--r--packages/website/md/docs/asset_buyer/usage.md39
-rw-r--r--packages/website/md/docs/json_schemas/2.0.0/schemas.md52
-rw-r--r--packages/website/translations/english.json1
-rw-r--r--packages/website/ts/components/portal/portal.tsx9
-rw-r--r--packages/website/ts/components/relayer_index/relayer_grid_tile.tsx46
-rw-r--r--packages/website/ts/components/relayer_index/relayer_index.tsx23
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx1
-rw-r--r--packages/website/ts/containers/asset_buyer_documentation.ts69
-rw-r--r--packages/website/ts/index.tsx8
-rw-r--r--packages/website/ts/pages/about/about.tsx3
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx1
-rw-r--r--packages/website/ts/types.ts3
-rw-r--r--typedoc-tsconfig.json1
-rw-r--r--yarn.lock38
158 files changed, 2036 insertions, 831 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 876b861d3..1cf665cce 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -98,6 +98,7 @@ jobs:
- run: yarn wsrun test:circleci @0xproject/subproviders
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
- run: yarn wsrun test:circleci @0xproject/utils
+ - run: yarn wsrun test:circleci @0xproject/instant
- save_cache:
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
paths:
diff --git a/.prettierignore b/.prettierignore
index 8d302a275..79dec3d1f 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -4,6 +4,7 @@ lib
/packages/contracts/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
+/packages/json-schemas/schemas
/packages/metacoin/src/contract_wrappers
/packages/metacoin/artifacts
/packages/sra-spec/public/
diff --git a/CODEOWNERS b/CODEOWNERS
index e2a8d93cd..278234aff 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -8,3 +8,21 @@
packages/asset-buyer/ @BMillman19 @fragosti @steveklebanoff
packages/instant/ @BMillman19 @fragosti @steveklebanoff
packages/website/ @BMillman19 @fragosti @fabioberger @steveklebanoff
+
+# Dev tools & setup
+packages/abi-gen/ @LogvinovLeon
+packages/base-contract/ @LogvinovLeon
+packages/contract_templates/ @LogvinovLeon
+packages/dev-utils/ @LogvinovLeon @fabioberger
+
+packages/ethereum-types/ @LogvinovLeon
+packages/metacoin/ @LogvinovLeon
+packages/sol-compiler/ @LogvinovLeon
+packages/sol-cov/ @LogvinovLeon
+packages/sol-resolver/ @LogvinovLeon
+packages/web3-wrapper/ @LogvinovLeon @fabioberger
+.circleci/ @LogvinovLeon
+packages/subproviders/ @fabioberger @dekz
+packages/connect/ @fragosti
+packages/monorepo-scripts/ @fabioberger
+packages/order-utils/ @fabioberger @LogvinovLeon
diff --git a/package.json b/package.json
index 031f73ba8..9785cd672 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
- "packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types"
+ "packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer"
},
"bundlewatch" : {
"files": [
@@ -50,7 +50,7 @@
},
{
"path": "packages/instant/public/main.bundle.js",
- "maxSize": "350kB"
+ "maxSize": "500kB"
}
],
"ci": {
@@ -65,7 +65,7 @@
"coveralls": "^3.0.0",
"ganache-cli": "6.1.8",
"lcov-result-merger": "^3.0.0",
- "npm-cli-login": "^0.0.10",
+ "@0xproject/npm-cli-login": "^0.0.11",
"npm-run-all": "^4.1.2",
"prettier": "^1.11.1",
"source-map-support": "^0.5.6",
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 4efd8f035..98791139f 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -24,6 +24,10 @@
{
"note": "Make web3-provider-engine types a 'dependency' so it's available to users of the library",
"pr": 1105
+ },
+ {
+ "note": "Export new `AssetData` type from types",
+ "pr": 1131
}
]
},
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index a78457e22..c439c8af3 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -68,7 +68,7 @@
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.20.2"
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index 7fd48da37..2fcfb5ce7 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -79,6 +79,7 @@ export {
OrderStateInvalid,
OrderState,
AssetProxyId,
+ AssetData,
ERC20AssetData,
ERC721AssetData,
SignatureType,
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index b50fe2c63..e55661235 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -6,9 +6,25 @@
"note": "Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`"
},
{
+ "note": "Export `BuyQuoteInfo` type",
+ "pr": 1131
+ },
+ {
"note":
"Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers",
"pr": 1105
+ },
+ {
+ "note": "Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`",
+ "pr": 1116
+ },
+ {
+ "note": "Add `docs:json` command to package.json",
+ "pr": 1139
+ },
+ {
+ "note": "Add missing types to public interface",
+ "pr": 1139
}
]
},
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index 8c8f3c92c..850fce873 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -17,7 +17,8 @@
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit",
- "clean": "shx rm -rf lib test_temp"
+ "clean": "shx rm -rf lib test_temp",
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"postpublish": {
@@ -63,7 +64,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"publishConfig": {
diff --git a/packages/asset-buyer/src/index.ts b/packages/asset-buyer/src/index.ts
index 2da2724d7..9ac3c0b8a 100644
--- a/packages/asset-buyer/src/index.ts
+++ b/packages/asset-buyer/src/index.ts
@@ -1,4 +1,10 @@
-export { Provider } from 'ethereum-types';
+export {
+ JSONRPCRequestPayload,
+ JSONRPCResponsePayload,
+ JSONRPCResponseError,
+ JSONRPCErrorCallback,
+ Provider,
+} from 'ethereum-types';
export { SignedOrder } from '@0xproject/types';
export { BigNumber } from '@0xproject/utils';
@@ -10,6 +16,7 @@ export {
AssetBuyerOpts,
BuyQuote,
BuyQuoteExecutionOpts,
+ BuyQuoteInfo,
BuyQuoteRequestOpts,
OrderProvider,
OrderProviderRequest,
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index a8e4ad2e2..73550ffd4 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -129,7 +129,8 @@ export class BaseContract {
if (abiDefinition.type !== AbiType.Function) {
return false;
}
- const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition);
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi);
if (abiFunctionSignature === functionSignature) {
return true;
}
diff --git a/packages/connect/package.json b/packages/connect/package.json
index e47ca3b79..591db0f83 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -77,7 +77,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"publishConfig": {
diff --git a/packages/connect/src/utils/assert.ts b/packages/connect/src/utils/assert.ts
index 3d8f1c799..4e2202d2e 100644
--- a/packages/connect/src/utils/assert.ts
+++ b/packages/connect/src/utils/assert.ts
@@ -14,7 +14,7 @@ export const assert = {
sharedAssert.doesConformToSchema(
variableName,
subscriptionOpts,
- schemas.relayerApiOrdersChannelSubscribePayload,
+ schemas.relayerApiOrdersChannelSubscribePayloadSchema,
);
},
isOrdersChannelHandler(variableName: string, handler: any): void {
diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json
index d91ad0b36..d9bd2c077 100644
--- a/packages/contract-addresses/CHANGELOG.json
+++ b/packages/contract-addresses/CHANGELOG.json
@@ -1,11 +1,19 @@
[
{
- "version": "1.0.0",
+ "version": "1.0.1",
"changes": [
{
"pr": 1105,
"note": "Initial release"
}
]
+ },
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Unpublished Package"
+ }
+ ]
}
]
diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json
index d91ad0b36..d9bd2c077 100644
--- a/packages/contract-artifacts/CHANGELOG.json
+++ b/packages/contract-artifacts/CHANGELOG.json
@@ -1,11 +1,19 @@
[
{
- "version": "1.0.0",
+ "version": "1.0.1",
"changes": [
{
"pr": 1105,
"note": "Initial release"
}
]
+ },
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Unpublished Package"
+ }
+ ]
}
]
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index 3924378d3..ef19057cd 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -60,7 +60,7 @@
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1",
"web3-provider-engine": "14.0.6"
},
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index ddd472010..eff38711a 100644
--- a/packages/ethereum-types/src/index.ts
+++ b/packages/ethereum-types/src/index.ts
@@ -20,7 +20,9 @@ export type ConstructorStateMutability = 'nonpayable' | 'payable';
export type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
export interface MethodAbi {
- type: 'function'; // We hardcode this here b/c doc pages cannot render an enum value
+ // Ideally this would be set to: `'function'` but then TS complains when artifacts are loaded
+ // from JSON files, and this value has type `string` not type `'function'`
+ type: string;
name: string;
inputs: DataItem[];
outputs: DataItem[];
@@ -30,14 +32,18 @@ export interface MethodAbi {
}
export interface ConstructorAbi {
- type: 'constructor'; // We hardcode this here b/c doc pages cannot render an enum value
+ // Ideally this would be set to: `'constructor'` but then TS complains when artifacts are loaded
+ // from JSON files, and this value has type `string` not type `'constructor'`
+ type: string;
inputs: DataItem[];
payable: boolean;
stateMutability: ConstructorStateMutability;
}
export interface FallbackAbi {
- type: 'fallback'; // We hardcode this here b/c doc pages cannot render an enum value
+ // Ideally this would be set to: `'fallback'` but then TS complains when artifacts are loaded
+ // from JSON files, and this value has type `string` not type `'fallback'`
+ type: string;
payable: boolean;
}
@@ -46,7 +52,9 @@ export interface EventParameter extends DataItem {
}
export interface EventAbi {
- type: 'event'; // We hardcode this here b/c doc pages cannot render an enum value
+ // Ideally this would be set to: `'event'` but then TS complains when artifacts are loaded
+ // from JSON files, and this value has type `string` not type `'event'`
+ type: string;
name: string;
inputs: EventParameter[];
anonymous: boolean;
diff --git a/packages/instant/package.json b/packages/instant/package.json
index d15f1ad38..5c4436c52 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -55,12 +55,15 @@
"react-dom": "^16.5.2",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
- "styled-components": "^3.4.9"
+ "redux-devtools-extension": "^2.13.5",
+ "styled-components": "^3.4.9",
+ "ts-optchain": "^0.1.1"
},
"devDependencies": {
"@0xproject/tslint-config": "^1.0.8",
"@types/enzyme": "^3.1.14",
"@types/enzyme-adapter-react-16": "^1.0.3",
+ "@types/jest": "^23.3.5",
"@types/lodash": "^4.14.116",
"@types/node": "*",
"@types/react": "^16.4.16",
@@ -77,7 +80,7 @@
"shx": "^0.2.2",
"ts-jest": "^23.10.3",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1",
diff --git a/packages/instant/src/components/amount_input.tsx b/packages/instant/src/components/amount_input.tsx
index 38810063d..7644f5f67 100644
--- a/packages/instant/src/components/amount_input.tsx
+++ b/packages/instant/src/components/amount_input.tsx
@@ -3,6 +3,7 @@ import * as _ from 'lodash';
import * as React from 'react';
import { ColorOption } from '../style/theme';
+import { util } from '../util/util';
import { Container, Input } from './ui';
@@ -10,10 +11,13 @@ export interface AmountInputProps {
fontColor?: ColorOption;
fontSize?: string;
value?: BigNumber;
- onChange?: (value?: BigNumber) => void;
+ onChange: (value?: BigNumber) => void;
}
export class AmountInput extends React.Component<AmountInputProps> {
+ public static defaultProps = {
+ onChange: util.boundNoop,
+ };
public render(): React.ReactNode {
const { fontColor, fontSize, value } = this.props;
return (
@@ -24,7 +28,7 @@ export class AmountInput extends React.Component<AmountInputProps> {
onChange={this._handleChange}
value={!_.isUndefined(value) ? value.toString() : ''}
placeholder="0.00"
- width="2em"
+ width="2.2em"
/>
</Container>
);
@@ -40,8 +44,6 @@ export class AmountInput extends React.Component<AmountInputProps> {
return;
}
}
- if (!_.isUndefined(this.props.onChange)) {
- this.props.onChange(bigNumberValue);
- }
+ this.props.onChange(bigNumberValue);
};
}
diff --git a/packages/instant/src/components/animations/slide_animations.tsx b/packages/instant/src/components/animations/slide_animations.tsx
new file mode 100644
index 000000000..1f10a2ed6
--- /dev/null
+++ b/packages/instant/src/components/animations/slide_animations.tsx
@@ -0,0 +1,54 @@
+import * as React from 'react';
+
+import { keyframes, styled } from '../../style/theme';
+
+const slideKeyframeGenerator = (fromY: string, toY: string) => keyframes`
+ from {
+ position: relative;
+ top: ${fromY};
+ }
+
+ to {
+ position: relative;
+ top: ${toY};
+ }
+`;
+
+export interface SlideAnimationProps {
+ keyframes: string;
+ animationType: string;
+ animationDirection?: string;
+}
+
+export const SlideAnimation =
+ styled.div <
+ SlideAnimationProps >
+ `
+ animation-name: ${props => props.keyframes};
+ animation-duration: 0.3s;
+ animation-timing-function: ${props => props.animationType};
+ animation-delay: 0s;
+ animation-iteration-count: 1;
+ animation-fill-mode: ${props => props.animationDirection || 'none'};
+ position: relative;
+`;
+
+export interface SlideAnimationComponentProps {
+ downY: string;
+}
+
+export const SlideUpAnimation: React.StatelessComponent<SlideAnimationComponentProps> = props => (
+ <SlideAnimation animationType="ease-in" keyframes={slideKeyframeGenerator(props.downY, '0px')}>
+ {props.children}
+ </SlideAnimation>
+);
+
+export const SlideDownAnimation: React.StatelessComponent<SlideAnimationComponentProps> = props => (
+ <SlideAnimation
+ animationDirection="forwards"
+ animationType="cubic-bezier(0.25, 0.1, 0.25, 1)"
+ keyframes={slideKeyframeGenerator('0px', props.downY)}
+ >
+ {props.children}
+ </SlideAnimation>
+);
diff --git a/packages/instant/src/components/animations/slide_up_and_down_animation.tsx b/packages/instant/src/components/animations/slide_up_and_down_animation.tsx
deleted file mode 100644
index 9c18e0933..000000000
--- a/packages/instant/src/components/animations/slide_up_and_down_animation.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import * as React from 'react';
-
-import { keyframes, styled } from '../../style/theme';
-
-const slideKeyframeGenerator = (fromY: string, toY: string) => keyframes`
- from {
- position: relative;
- top: ${fromY};
- }
-
- to {
- position: relative;
- top: ${toY};
- }
-`;
-
-export interface SlideAnimationProps {
- keyframes: string;
- animationType: string;
- animationDirection?: string;
-}
-
-export const SlideAnimation =
- styled.div <
- SlideAnimationProps >
- `
- animation-name: ${props => props.keyframes};
- animation-duration: 0.3s;
- animation-timing-function: ${props => props.animationType};
- animation-delay: 0s;
- animation-iteration-count: 1;
- animation-fill-mode: ${props => props.animationDirection || 'none'};
- position: relative;
-`;
-
-export interface SlideAnimationComponentProps {
- downY: string;
-}
-
-export const SlideUpAnimationComponent: React.StatelessComponent<SlideAnimationComponentProps> = props => (
- <SlideAnimation animationType="ease-in" keyframes={slideKeyframeGenerator(props.downY, '0px')}>
- {props.children}
- </SlideAnimation>
-);
-
-export const SlideDownAnimationComponent: React.StatelessComponent<SlideAnimationComponentProps> = props => (
- <SlideAnimation
- animationDirection="forwards"
- animationType="cubic-bezier(0.25, 0.1, 0.25, 1)"
- keyframes={slideKeyframeGenerator('0px', props.downY)}
- >
- {props.children}
- </SlideAnimation>
-);
-
-export interface SlideUpAndDownAnimationProps extends SlideAnimationComponentProps {
- delayMs: number;
-}
-
-enum SlideState {
- Up = 'up',
- Down = 'down',
-}
-interface SlideUpAndDownState {
- slideState: SlideState;
-}
-
-export class SlideUpAndDownAnimation extends React.Component<SlideUpAndDownAnimationProps, SlideUpAndDownState> {
- public state = {
- slideState: SlideState.Up,
- };
-
- private _timeoutId?: number;
- public render(): React.ReactNode {
- return this._renderSlide();
- }
- public componentDidMount(): void {
- this._timeoutId = window.setTimeout(() => {
- this.setState({
- slideState: SlideState.Down,
- });
- }, this.props.delayMs);
-
- return;
- }
- public componentWillUnmount(): void {
- if (this._timeoutId) {
- window.clearTimeout(this._timeoutId);
- }
- }
- private _renderSlide(): React.ReactNode {
- const SlideComponent = this.state.slideState === 'up' ? SlideUpAnimationComponent : SlideDownAnimationComponent;
-
- return <SlideComponent downY={this.props.downY}>{this.props.children}</SlideComponent>;
- }
-}
diff --git a/packages/instant/src/components/asset_amount_input.tsx b/packages/instant/src/components/asset_amount_input.tsx
new file mode 100644
index 000000000..db3dbe7f3
--- /dev/null
+++ b/packages/instant/src/components/asset_amount_input.tsx
@@ -0,0 +1,38 @@
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
+import * as React from 'react';
+
+import { assetDataUtil } from '../util/asset_data';
+
+import { ColorOption } from '../style/theme';
+import { util } from '../util/util';
+
+import { AmountInput, AmountInputProps } from './amount_input';
+import { Container, Text } from './ui';
+
+export interface AssetAmountInputProps extends AmountInputProps {
+ assetData?: string;
+ onChange: (value?: BigNumber, assetData?: string) => void;
+}
+
+export class AssetAmountInput extends React.Component<AssetAmountInputProps> {
+ public static defaultProps = {
+ onChange: util.boundNoop,
+ };
+ public render(): React.ReactNode {
+ const { assetData, onChange, ...rest } = this.props;
+ return (
+ <Container>
+ <AmountInput {...rest} onChange={this._handleChange} />
+ <Container display="inline-block" marginLeft="10px">
+ <Text fontSize={rest.fontSize} fontColor={ColorOption.white} textTransform="uppercase">
+ {assetDataUtil.bestNameForAsset(this.props.assetData, '???')}
+ </Text>
+ </Container>
+ </Container>
+ );
+ }
+ private readonly _handleChange = (value?: BigNumber): void => {
+ this.props.onChange(value, this.props.assetData);
+ };
+}
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 5a32b9575..0706817c9 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -1,19 +1,53 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
+import * as _ from 'lodash';
import * as React from 'react';
import { ColorOption } from '../style/theme';
+import { assetBuyer } from '../util/asset_buyer';
+import { util } from '../util/util';
+import { web3Wrapper } from '../util/web3_wrapper';
import { Button, Container, Text } from './ui';
-export interface BuyButtonProps {}
+export interface BuyButtonProps {
+ buyQuote?: BuyQuote;
+ onClick: (buyQuote: BuyQuote) => void;
+ onBuySuccess: (buyQuote: BuyQuote, txnHash: string) => void;
+ onBuyFailure: (buyQuote: BuyQuote, tnxHash?: string) => void;
+ text: string;
+}
-export const BuyButton: React.StatelessComponent<BuyButtonProps> = props => (
- <Container padding="20px" width="100%">
- <Button width="100%">
- <Text fontColor={ColorOption.white} fontWeight={600} fontSize="20px">
- Buy
- </Text>
- </Button>
- </Container>
-);
-
-BuyButton.displayName = 'BuyButton';
+export class BuyButton extends React.Component<BuyButtonProps> {
+ public static defaultProps = {
+ onClick: util.boundNoop,
+ onBuySuccess: util.boundNoop,
+ onBuyFailure: util.boundNoop,
+ };
+ public render(): React.ReactNode {
+ const shouldDisableButton = _.isUndefined(this.props.buyQuote);
+ return (
+ <Container padding="20px" width="100%">
+ <Button width="100%" onClick={this._handleClick} isDisabled={shouldDisableButton}>
+ <Text fontColor={ColorOption.white} fontWeight={600} fontSize="20px">
+ {this.props.text}
+ </Text>
+ </Button>
+ </Container>
+ );
+ }
+ private readonly _handleClick = async () => {
+ // The button is disabled when there is no buy quote anyway.
+ if (_.isUndefined(this.props.buyQuote)) {
+ return;
+ }
+ this.props.onClick(this.props.buyQuote);
+ let txnHash;
+ try {
+ txnHash = await assetBuyer.executeBuyQuoteAsync(this.props.buyQuote);
+ await web3Wrapper.awaitTransactionSuccessAsync(txnHash);
+ this.props.onBuySuccess(this.props.buyQuote, txnHash);
+ } catch {
+ this.props.onBuyFailure(this.props.buyQuote, txnHash);
+ }
+ };
+}
diff --git a/packages/instant/src/components/instant_heading.tsx b/packages/instant/src/components/instant_heading.tsx
index be0414b8d..f57b59b73 100644
--- a/packages/instant/src/components/instant_heading.tsx
+++ b/packages/instant/src/components/instant_heading.tsx
@@ -1,11 +1,58 @@
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
import * as React from 'react';
import { SelectedAssetAmountInput } from '../containers/selected_asset_amount_input';
import { ColorOption } from '../style/theme';
+import { AsyncProcessState } from '../types';
+import { format } from '../util/format';
import { Container, Flex, Text } from './ui';
-export interface InstantHeadingProps {}
+export interface InstantHeadingProps {
+ selectedAssetAmount?: BigNumber;
+ totalEthBaseAmount?: BigNumber;
+ ethUsdPrice?: BigNumber;
+ quoteState: AsyncProcessState;
+}
+
+const Placeholder = () => (
+ <Text fontWeight="bold" fontColor={ColorOption.white}>
+ &mdash;
+ </Text>
+);
+const displaytotalEthBaseAmount = ({
+ selectedAssetAmount,
+ totalEthBaseAmount,
+}: InstantHeadingProps): React.ReactNode => {
+ if (_.isUndefined(selectedAssetAmount)) {
+ return '0 ETH';
+ }
+ return format.ethBaseAmount(totalEthBaseAmount, 4, <Placeholder />);
+};
+
+const displayUsdAmount = ({
+ totalEthBaseAmount,
+ selectedAssetAmount,
+ ethUsdPrice,
+}: InstantHeadingProps): React.ReactNode => {
+ if (_.isUndefined(selectedAssetAmount)) {
+ return '$0.00';
+ }
+ return format.ethBaseAmountInUsd(totalEthBaseAmount, ethUsdPrice, 2, <Placeholder />);
+};
+
+const loadingOrAmount = (quoteState: AsyncProcessState, amount: React.ReactNode): React.ReactNode => {
+ if (quoteState === AsyncProcessState.PENDING) {
+ return (
+ <Text fontWeight="bold" fontColor={ColorOption.white}>
+ &hellip;loading
+ </Text>
+ );
+ } else {
+ return amount;
+ }
+};
export const InstantHeading: React.StatelessComponent<InstantHeadingProps> = props => (
<Container backgroundColor={ColorOption.primaryColor} padding="20px" width="100%" borderRadius="3px 3px 0px 0px">
@@ -22,22 +69,15 @@ export const InstantHeading: React.StatelessComponent<InstantHeadingProps> = pro
</Text>
</Container>
<Flex direction="row" justify="space-between">
- <Container>
- <SelectedAssetAmountInput fontSize="45px" />
- <Container display="inline-block" marginLeft="10px">
- <Text fontSize="45px" fontColor={ColorOption.white} textTransform="uppercase">
- rep
- </Text>
- </Container>
- </Container>
+ <SelectedAssetAmountInput fontSize="45px" />
<Flex direction="column" justify="space-between">
<Container marginBottom="5px">
<Text fontSize="16px" fontColor={ColorOption.white} fontWeight={500}>
- 0 ETH
+ {loadingOrAmount(props.quoteState, displaytotalEthBaseAmount(props))}
</Text>
</Container>
<Text fontSize="16px" fontColor={ColorOption.white} opacity={0.7}>
- $0.00
+ {loadingOrAmount(props.quoteState, displayUsdAmount(props))}
</Text>
</Flex>
</Flex>
diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx
index dbf2c1f0b..a15ff411b 100644
--- a/packages/instant/src/components/order_details.tsx
+++ b/packages/instant/src/components/order_details.tsx
@@ -1,53 +1,90 @@
+import { BuyQuoteInfo } from '@0xproject/asset-buyer';
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
import * as React from 'react';
+import { oc } from 'ts-optchain';
import { ColorOption } from '../style/theme';
+import { format } from '../util/format';
import { Container, Flex, Text } from './ui';
-export interface OrderDetailsProps {}
-
-export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = props => (
- <Container padding="20px" width="100%">
- <Container marginBottom="10px">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- Order Details
- </Text>
- </Container>
- <OrderDetailsRow name="Token Price" primaryValue=".013 ETH" secondaryValue="$24.32" />
- <OrderDetailsRow name="Fee" primaryValue=".005 ETH" secondaryValue="$1.04" />
- <OrderDetailsRow name="Total Cost" primaryValue="1.66 ETH" secondaryValue="$589.56" shouldEmphasize={true} />
- </Container>
-);
-
-OrderDetails.displayName = 'OrderDetails';
-
-export interface OrderDetailsRowProps {
- name: string;
- primaryValue: string;
- secondaryValue: string;
+export interface OrderDetailsProps {
+ buyQuoteInfo?: BuyQuoteInfo;
+ ethUsdPrice?: BigNumber;
+}
+
+export class OrderDetails extends React.Component<OrderDetailsProps> {
+ public render(): React.ReactNode {
+ const { buyQuoteInfo, ethUsdPrice } = this.props;
+ const buyQuoteAccessor = oc(buyQuoteInfo);
+ const ethAssetPrice = buyQuoteAccessor.ethPerAssetPrice();
+ const ethTokenFee = buyQuoteAccessor.feeEthAmount();
+ const totalEthAmount = buyQuoteAccessor.totalEthAmount();
+ return (
+ <Container padding="20px" width="100%">
+ <Container marginBottom="10px">
+ <Text
+ letterSpacing="1px"
+ fontColor={ColorOption.primaryColor}
+ fontWeight={600}
+ textTransform="uppercase"
+ fontSize="14px"
+ >
+ Order Details
+ </Text>
+ </Container>
+ <EthAmountRow
+ rowLabel="Token Price"
+ ethAmount={ethAssetPrice}
+ ethUsdPrice={ethUsdPrice}
+ isEthAmountInBaseUnits={false}
+ />
+ <EthAmountRow rowLabel="Fee" ethAmount={ethTokenFee} ethUsdPrice={ethUsdPrice} />
+ <EthAmountRow
+ rowLabel="Total Cost"
+ ethAmount={totalEthAmount}
+ ethUsdPrice={ethUsdPrice}
+ shouldEmphasize={true}
+ />
+ </Container>
+ );
+ }
+}
+
+export interface EthAmountRowProps {
+ rowLabel: string;
+ ethAmount?: BigNumber;
+ isEthAmountInBaseUnits?: boolean;
+ ethUsdPrice?: BigNumber;
shouldEmphasize?: boolean;
}
-export const OrderDetailsRow: React.StatelessComponent<OrderDetailsRowProps> = props => {
- const fontWeight = props.shouldEmphasize ? 700 : 400;
+export const EthAmountRow: React.StatelessComponent<EthAmountRowProps> = ({
+ rowLabel,
+ ethAmount,
+ isEthAmountInBaseUnits,
+ ethUsdPrice,
+ shouldEmphasize,
+}) => {
+ const fontWeight = shouldEmphasize ? 700 : 400;
+ const usdFormatter = isEthAmountInBaseUnits ? format.ethBaseAmountInUsd : format.ethUnitAmountInUsd;
+ const ethFormatter = isEthAmountInBaseUnits ? format.ethBaseAmount : format.ethUnitAmount;
+ const usdPriceSection = _.isUndefined(ethUsdPrice) ? null : (
+ <Container marginRight="3px" display="inline-block">
+ <Text fontColor={ColorOption.lightGrey}>({usdFormatter(ethAmount, ethUsdPrice)})</Text>
+ </Container>
+ );
return (
<Container padding="10px 0px" borderTop="1px dashed" borderColor={ColorOption.feintGrey}>
<Flex justify="space-between">
<Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {props.name}
+ {rowLabel}
</Text>
<Container>
- <Container marginRight="3px" display="inline-block">
- <Text fontColor={ColorOption.lightGrey}>({props.secondaryValue}) </Text>
- </Container>
+ {usdPriceSection}
<Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {props.primaryValue}
+ {ethFormatter(ethAmount)}
</Text>
</Container>
</Flex>
@@ -55,8 +92,9 @@ export const OrderDetailsRow: React.StatelessComponent<OrderDetailsRowProps> = p
);
};
-OrderDetailsRow.defaultProps = {
+EthAmountRow.defaultProps = {
shouldEmphasize: false,
+ isEthAmountInBaseUnits: true,
};
-OrderDetailsRow.displayName = 'OrderDetailsRow';
+EthAmountRow.displayName = 'EthAmountRow';
diff --git a/packages/instant/src/components/sliding_error.tsx b/packages/instant/src/components/sliding_error.tsx
index 0237fb7e9..3865a8797 100644
--- a/packages/instant/src/components/sliding_error.tsx
+++ b/packages/instant/src/components/sliding_error.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { ColorOption } from '../style/theme';
-import { SlideUpAndDownAnimation } from './animations/slide_up_and_down_animation';
+import { SlideDownAnimation, SlideUpAnimation } from './animations/slide_animations';
import { Container, Text } from './ui';
@@ -20,8 +20,8 @@ export const Error: React.StatelessComponent<ErrorProps> = props => (
borderRadius="6px"
marginBottom="10px"
>
- <Container marginRight="5px" display="inline">
- {props.icon}
+ <Container marginRight="5px" display="inline" top="3px" position="relative">
+ <Text fontSize="20px">{props.icon}</Text>
</Container>
<Text fontWeight="500" fontColor={ColorOption.darkOrange}>
{props.message}
@@ -29,8 +29,16 @@ export const Error: React.StatelessComponent<ErrorProps> = props => (
</Container>
);
-export const SlidingError: React.StatelessComponent<ErrorProps> = props => (
- <SlideUpAndDownAnimation downY="120px" delayMs={5000}>
- <Error icon={props.icon} message={props.message} />
- </SlideUpAndDownAnimation>
-);
+export type SlidingDirection = 'up' | 'down';
+export interface SlidingErrorProps extends ErrorProps {
+ direction: SlidingDirection;
+}
+export const SlidingError: React.StatelessComponent<SlidingErrorProps> = props => {
+ const AnimationComponent = props.direction === 'up' ? SlideUpAnimation : SlideDownAnimation;
+
+ return (
+ <AnimationComponent downY="120px">
+ <Error icon={props.icon} message={props.message} />
+ </AnimationComponent>
+ );
+};
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index 0e6230d1b..f6472e811 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { Provider } from 'react-redux';
+import { asyncData } from '../redux/async_data';
import { store } from '../redux/store';
import { fonts } from '../style/fonts';
import { theme, ThemeProvider } from '../style/theme';
@@ -8,6 +9,8 @@ import { theme, ThemeProvider } from '../style/theme';
import { ZeroExInstantContainer } from './zero_ex_instant_container';
fonts.include();
+// tslint:disable-next-line:no-floating-promises
+asyncData.fetchAndDispatchToStore();
export interface ZeroExInstantProps {}
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index a384c5f1b..cf918d890 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -1,16 +1,21 @@
import * as React from 'react';
+import { LatestBuyQuoteOrderDetails } from '../containers/latest_buy_quote_order_details';
+import { LatestError } from '../containers/latest_error';
+import { SelectedAssetBuyButton } from '../containers/selected_asset_buy_button';
+import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
+
import { ColorOption } from '../style/theme';
-import { BuyButton } from './buy_button';
-import { InstantHeading } from './instant_heading';
-import { OrderDetails } from './order_details';
import { Container, Flex } from './ui';
export interface ZeroExInstantContainerProps {}
export const ZeroExInstantContainer: React.StatelessComponent<ZeroExInstantContainerProps> = props => (
<Container width="350px">
+ <Container zIndex={1} position="relative">
+ <LatestError />
+ </Container>
<Container
zIndex={2}
position="relative"
@@ -19,9 +24,9 @@ export const ZeroExInstantContainer: React.StatelessComponent<ZeroExInstantConta
hasBoxShadow={true}
>
<Flex direction="column" justify="flex-start">
- <InstantHeading />
- <OrderDetails />
- <BuyButton />
+ <SelectedAssetInstantHeading />
+ <LatestBuyQuoteOrderDetails />
+ <SelectedAssetBuyButton />
</Flex>
</Container>
</Container>
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
new file mode 100644
index 000000000..1fd321c5a
--- /dev/null
+++ b/packages/instant/src/constants.ts
@@ -0,0 +1,6 @@
+import { BigNumber } from '@0xproject/utils';
+export const BIG_NUMBER_ZERO = new BigNumber(0);
+export const sraApiUrl = 'https://api.radarrelay.com/0x/v2/';
+export const zrxAssetData = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
+export const zrxDecimals = 18;
+export const ethDecimals = 18;
diff --git a/packages/instant/src/containers/latest_buy_quote_order_details.ts b/packages/instant/src/containers/latest_buy_quote_order_details.ts
new file mode 100644
index 000000000..b354c78fa
--- /dev/null
+++ b/packages/instant/src/containers/latest_buy_quote_order_details.ts
@@ -0,0 +1,27 @@
+import { BuyQuoteInfo } from '@0xproject/asset-buyer';
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { oc } from 'ts-optchain';
+
+import { State } from '../redux/reducer';
+
+import { OrderDetails } from '../components/order_details';
+
+export interface LatestBuyQuoteOrderDetailsProps {}
+
+interface ConnectedState {
+ buyQuoteInfo?: BuyQuoteInfo;
+ ethUsdPrice?: BigNumber;
+}
+
+const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({
+ // use the worst case quote info
+ buyQuoteInfo: oc(state).latestBuyQuote.worstCaseQuoteInfo(),
+ ethUsdPrice: state.ethUsdPrice,
+});
+
+export const LatestBuyQuoteOrderDetails: React.ComponentClass<LatestBuyQuoteOrderDetailsProps> = connect(
+ mapStateToProps,
+)(OrderDetails);
diff --git a/packages/instant/src/containers/latest_error.tsx b/packages/instant/src/containers/latest_error.tsx
new file mode 100644
index 000000000..08ea418e7
--- /dev/null
+++ b/packages/instant/src/containers/latest_error.tsx
@@ -0,0 +1,35 @@
+import * as React from 'react';
+
+import { connect } from 'react-redux';
+
+import { SlidingError } from '../components/sliding_error';
+import { LatestErrorDisplay, State } from '../redux/reducer';
+import { errorUtil } from '../util/error';
+
+export interface LatestErrorComponentProps {
+ assetData?: string;
+ latestError?: any;
+ slidingDirection: 'down' | 'up';
+}
+
+export const LatestErrorComponent: React.StatelessComponent<LatestErrorComponentProps> = props => {
+ if (!props.latestError) {
+ return <div />;
+ }
+ const { icon, message } = errorUtil.errorDescription(props.latestError, props.assetData);
+ return <SlidingError direction={props.slidingDirection} icon={icon} message={message} />;
+};
+
+interface ConnectedState {
+ assetData?: string;
+ latestError?: any;
+ slidingDirection: 'down' | 'up';
+}
+export interface LatestErrorProps {}
+const mapStateToProps = (state: State, _ownProps: LatestErrorProps): ConnectedState => ({
+ assetData: state.selectedAssetData,
+ latestError: state.latestError,
+ slidingDirection: state.latestErrorDisplay === LatestErrorDisplay.Present ? 'up' : 'down',
+});
+
+export const LatestError = connect(mapStateToProps)(LatestErrorComponent);
diff --git a/packages/instant/src/containers/selected_asset_amount_input.ts b/packages/instant/src/containers/selected_asset_amount_input.ts
new file mode 100644
index 000000000..0873f1ab6
--- /dev/null
+++ b/packages/instant/src/containers/selected_asset_amount_input.ts
@@ -0,0 +1,89 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+
+import { zrxDecimals } from '../constants';
+import { Action, actions } from '../redux/actions';
+import { State } from '../redux/reducer';
+import { ColorOption } from '../style/theme';
+import { AsyncProcessState } from '../types';
+import { assetBuyer } from '../util/asset_buyer';
+import { errorUtil } from '../util/error';
+
+import { AssetAmountInput } from '../components/asset_amount_input';
+
+export interface SelectedAssetAmountInputProps {
+ fontColor?: ColorOption;
+ fontSize?: string;
+}
+
+interface ConnectedState {
+ value?: BigNumber;
+ assetData?: string;
+}
+
+interface ConnectedDispatch {
+ onChange: (value?: BigNumber, assetData?: string) => void;
+}
+
+const mapStateToProps = (state: State, _ownProps: SelectedAssetAmountInputProps): ConnectedState => ({
+ value: state.selectedAssetAmount,
+ assetData: state.selectedAssetData,
+});
+
+const updateBuyQuoteAsync = async (
+ dispatch: Dispatch<Action>,
+ assetData: string,
+ assetAmount: BigNumber,
+): Promise<void> => {
+ // get a new buy quote.
+ const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetAmount, zrxDecimals);
+
+ // mark quote as pending
+ dispatch(actions.updateBuyQuoteStatePending());
+
+ let newBuyQuote: BuyQuote | undefined;
+ try {
+ newBuyQuote = await assetBuyer.getBuyQuoteAsync(assetData, baseUnitValue);
+ } catch (error) {
+ dispatch(actions.updateBuyQuoteStateFailure());
+ errorUtil.errorFlasher.flashNewError(dispatch, error);
+ return;
+ }
+ // We have a successful new buy quote
+ errorUtil.errorFlasher.clearError(dispatch);
+ // invalidate the last buy quote.
+ dispatch(actions.updateLatestBuyQuote(newBuyQuote));
+};
+
+const debouncedUpdateBuyQuoteAsync = _.debounce(updateBuyQuoteAsync, 200, { trailing: true });
+
+const mapDispatchToProps = (
+ dispatch: Dispatch<Action>,
+ _ownProps: SelectedAssetAmountInputProps,
+): ConnectedDispatch => ({
+ onChange: (value, assetData) => {
+ // Update the input
+ dispatch(actions.updateSelectedAssetAmount(value));
+ // invalidate the last buy quote.
+ dispatch(actions.updateLatestBuyQuote(undefined));
+ // reset our buy state
+ dispatch(actions.updatebuyOrderState(AsyncProcessState.NONE));
+
+ if (!_.isUndefined(value) && !_.isUndefined(assetData)) {
+ // even if it's debounced, give them the illusion it's loading
+ dispatch(actions.updateBuyQuoteStatePending());
+ // tslint:disable-next-line:no-floating-promises
+ debouncedUpdateBuyQuoteAsync(dispatch, assetData, value);
+ }
+ },
+});
+
+export const SelectedAssetAmountInput: React.ComponentClass<SelectedAssetAmountInputProps> = connect(
+ mapStateToProps,
+ mapDispatchToProps,
+)(AssetAmountInput);
diff --git a/packages/instant/src/containers/selected_asset_amount_input.tsx b/packages/instant/src/containers/selected_asset_amount_input.tsx
deleted file mode 100644
index 800a4c568..000000000
--- a/packages/instant/src/containers/selected_asset_amount_input.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { BigNumber } from '@0xproject/utils';
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-
-import { State } from '../redux/reducer';
-import { ColorOption } from '../style/theme';
-import { Action, ActionTypes } from '../types';
-
-import { AmountInput } from '../components/amount_input';
-
-export interface SelectedAssetAmountInputProps {
- fontColor?: ColorOption;
- fontSize?: string;
-}
-
-interface ConnectedState {
- value?: BigNumber;
-}
-
-interface ConnectedDispatch {
- onChange?: (value?: BigNumber) => void;
-}
-
-const mapStateToProps = (state: State, _ownProps: SelectedAssetAmountInputProps): ConnectedState => ({
- value: state.selectedAssetAmount,
-});
-
-const mapDispatchToProps = (dispatch: Dispatch<Action>): ConnectedDispatch => ({
- onChange: value => dispatch({ type: ActionTypes.UPDATE_SELECTED_ASSET_AMOUNT, data: value }),
-});
-
-export const SelectedAssetAmountInput: React.ComponentClass<SelectedAssetAmountInputProps> = connect(
- mapStateToProps,
- mapDispatchToProps,
-)(AmountInput);
diff --git a/packages/instant/src/containers/selected_asset_buy_button.ts b/packages/instant/src/containers/selected_asset_buy_button.ts
new file mode 100644
index 000000000..7d3919468
--- /dev/null
+++ b/packages/instant/src/containers/selected_asset_buy_button.ts
@@ -0,0 +1,55 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+
+import { Action, actions } from '../redux/actions';
+import { State } from '../redux/reducer';
+import { AsyncProcessState } from '../types';
+
+import { BuyButton } from '../components/buy_button';
+
+export interface SelectedAssetBuyButtonProps {}
+
+interface ConnectedState {
+ text: string;
+ buyQuote?: BuyQuote;
+}
+
+interface ConnectedDispatch {
+ onClick: (buyQuote: BuyQuote) => void;
+ onBuySuccess: (buyQuote: BuyQuote) => void;
+ onBuyFailure: (buyQuote: BuyQuote) => void;
+}
+
+const textForState = (state: AsyncProcessState): string => {
+ switch (state) {
+ case AsyncProcessState.NONE:
+ return 'Buy';
+ case AsyncProcessState.PENDING:
+ return '...Loading';
+ case AsyncProcessState.SUCCESS:
+ return 'Success!';
+ case AsyncProcessState.FAILURE:
+ return 'Failed';
+ default:
+ return 'Buy';
+ }
+};
+
+const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyButtonProps): ConnectedState => ({
+ text: textForState(state.buyOrderState),
+ buyQuote: state.latestBuyQuote,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<Action>, ownProps: SelectedAssetBuyButtonProps): ConnectedDispatch => ({
+ onClick: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.PENDING)),
+ onBuySuccess: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.SUCCESS)),
+ onBuyFailure: buyQuote => dispatch(actions.updatebuyOrderState(AsyncProcessState.FAILURE)),
+});
+
+export const SelectedAssetBuyButton: React.ComponentClass<SelectedAssetBuyButtonProps> = connect(
+ mapStateToProps,
+ mapDispatchToProps,
+)(BuyButton);
diff --git a/packages/instant/src/containers/selected_asset_instant_heading.ts b/packages/instant/src/containers/selected_asset_instant_heading.ts
new file mode 100644
index 000000000..be31527f1
--- /dev/null
+++ b/packages/instant/src/containers/selected_asset_instant_heading.ts
@@ -0,0 +1,30 @@
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { oc } from 'ts-optchain';
+
+import { State } from '../redux/reducer';
+import { AsyncProcessState } from '../types';
+
+import { InstantHeading } from '../components/instant_heading';
+
+export interface InstantHeadingProps {}
+
+interface ConnectedState {
+ selectedAssetAmount?: BigNumber;
+ totalEthBaseAmount?: BigNumber;
+ ethUsdPrice?: BigNumber;
+ quoteState: AsyncProcessState;
+}
+
+const mapStateToProps = (state: State, _ownProps: InstantHeadingProps): ConnectedState => ({
+ selectedAssetAmount: state.selectedAssetAmount,
+ totalEthBaseAmount: oc(state).latestBuyQuote.worstCaseQuoteInfo.totalEthAmount(),
+ ethUsdPrice: state.ethUsdPrice,
+ quoteState: state.quoteState,
+});
+
+export const SelectedAssetInstantHeading: React.ComponentClass<InstantHeadingProps> = connect(mapStateToProps)(
+ InstantHeading,
+);
diff --git a/packages/instant/src/data/asset_meta_data.ts b/packages/instant/src/data/asset_meta_data.ts
new file mode 100644
index 000000000..e4d3e8f73
--- /dev/null
+++ b/packages/instant/src/data/asset_meta_data.ts
@@ -0,0 +1,15 @@
+import { AssetProxyId, ObjectMap } from '@0xproject/types';
+
+import { zrxAssetData } from '../constants';
+import { AssetMetaData } from '../types';
+
+// Map from assetData string to AssetMetaData object
+// TODO: import this from somewhere else.
+export const assetMetaData: ObjectMap<AssetMetaData> = {
+ [zrxAssetData]: {
+ assetProxyId: AssetProxyId.ERC20,
+ decimals: 18,
+ primaryColor: 'rgb(54, 50, 60)',
+ symbol: 'zrx',
+ },
+};
diff --git a/packages/instant/src/redux/actions.ts b/packages/instant/src/redux/actions.ts
new file mode 100644
index 000000000..bec847742
--- /dev/null
+++ b/packages/instant/src/redux/actions.ts
@@ -0,0 +1,46 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
+import { BigNumber } from '@0xproject/utils';
+import * as _ from 'lodash';
+
+import { ActionsUnion, AsyncProcessState } from '../types';
+
+export interface PlainAction<T extends string> {
+ type: T;
+}
+
+export interface ActionWithPayload<T extends string, P> extends PlainAction<T> {
+ data: P;
+}
+
+export type Action = ActionsUnion<typeof actions>;
+
+function createAction<T extends string>(type: T): PlainAction<T>;
+function createAction<T extends string, P>(type: T, data: P): ActionWithPayload<T, P>;
+function createAction<T extends string, P>(type: T, data?: P): PlainAction<T> | ActionWithPayload<T, P> {
+ return _.isUndefined(data) ? { type } : { type, data };
+}
+
+export enum ActionTypes {
+ UPDATE_ETH_USD_PRICE = 'UPDATE_ETH_USD_PRICE',
+ UPDATE_SELECTED_ASSET_AMOUNT = 'UPDATE_SELECTED_ASSET_AMOUNT',
+ UPDATE_SELECTED_ASSET_BUY_STATE = 'UPDATE_SELECTED_ASSET_BUY_STATE',
+ UPDATE_LATEST_BUY_QUOTE = 'UPDATE_LATEST_BUY_QUOTE',
+ UPDATE_BUY_QUOTE_STATE_PENDING = 'UPDATE_BUY_QUOTE_STATE_PENDING',
+ UPDATE_BUY_QUOTE_STATE_FAILURE = 'UPDATE_BUY_QUOTE_STATE_FAILURE',
+ SET_ERROR = 'SET_ERROR',
+ HIDE_ERROR = 'HIDE_ERROR',
+ CLEAR_ERROR = 'CLEAR_ERROR',
+}
+
+export const actions = {
+ updateEthUsdPrice: (price?: BigNumber) => createAction(ActionTypes.UPDATE_ETH_USD_PRICE, price),
+ updateSelectedAssetAmount: (amount?: BigNumber) => createAction(ActionTypes.UPDATE_SELECTED_ASSET_AMOUNT, amount),
+ updatebuyOrderState: (buyState: AsyncProcessState) =>
+ createAction(ActionTypes.UPDATE_SELECTED_ASSET_BUY_STATE, buyState),
+ updateLatestBuyQuote: (buyQuote?: BuyQuote) => createAction(ActionTypes.UPDATE_LATEST_BUY_QUOTE, buyQuote),
+ updateBuyQuoteStatePending: () => createAction(ActionTypes.UPDATE_BUY_QUOTE_STATE_PENDING),
+ updateBuyQuoteStateFailure: () => createAction(ActionTypes.UPDATE_BUY_QUOTE_STATE_FAILURE),
+ setError: (error?: any) => createAction(ActionTypes.SET_ERROR, error),
+ hideError: () => createAction(ActionTypes.HIDE_ERROR),
+ clearError: () => createAction(ActionTypes.CLEAR_ERROR),
+};
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
new file mode 100644
index 000000000..348838307
--- /dev/null
+++ b/packages/instant/src/redux/async_data.ts
@@ -0,0 +1,22 @@
+import { BIG_NUMBER_ZERO } from '../constants';
+import { coinbaseApi } from '../util/coinbase_api';
+
+import { ActionTypes } from './actions';
+
+import { store } from './store';
+
+export const asyncData = {
+ fetchAndDispatchToStore: async () => {
+ let ethUsdPrice = BIG_NUMBER_ZERO;
+ try {
+ ethUsdPrice = await coinbaseApi.getEthUsdPrice();
+ } catch (e) {
+ // ignore
+ } finally {
+ store.dispatch({
+ type: ActionTypes.UPDATE_ETH_USD_PRICE,
+ data: ethUsdPrice,
+ });
+ }
+ },
+};
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 5026895ae..54290483b 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -1,16 +1,37 @@
+import { BuyQuote } from '@0xproject/asset-buyer';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
-import { Action, ActionTypes } from '../types';
+import { zrxAssetData } from '../constants';
+import { AsyncProcessState } from '../types';
+import { Action, ActionTypes } from './actions';
+
+export enum LatestErrorDisplay {
+ Present,
+ Hidden,
+}
export interface State {
- ethUsdPrice?: string;
+ selectedAssetData?: string;
selectedAssetAmount?: BigNumber;
+ buyOrderState: AsyncProcessState;
+ ethUsdPrice?: BigNumber;
+ latestBuyQuote?: BuyQuote;
+ quoteState: AsyncProcessState;
+ latestError?: any;
+ latestErrorDisplay: LatestErrorDisplay;
}
export const INITIAL_STATE: State = {
- ethUsdPrice: undefined,
+ // TODO: Remove hardcoded zrxAssetData
+ selectedAssetData: zrxAssetData,
selectedAssetAmount: undefined,
+ buyOrderState: AsyncProcessState.NONE,
+ ethUsdPrice: undefined,
+ latestBuyQuote: undefined,
+ latestError: undefined,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
+ quoteState: AsyncProcessState.NONE,
};
export const reducer = (state: State = INITIAL_STATE, action: Action): State => {
@@ -25,6 +46,46 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
...state,
selectedAssetAmount: action.data,
};
+ case ActionTypes.UPDATE_LATEST_BUY_QUOTE:
+ return {
+ ...state,
+ latestBuyQuote: action.data,
+ quoteState: AsyncProcessState.SUCCESS,
+ };
+ case ActionTypes.UPDATE_BUY_QUOTE_STATE_PENDING:
+ return {
+ ...state,
+ latestBuyQuote: undefined,
+ quoteState: AsyncProcessState.PENDING,
+ };
+ case ActionTypes.UPDATE_BUY_QUOTE_STATE_FAILURE:
+ return {
+ ...state,
+ latestBuyQuote: undefined,
+ quoteState: AsyncProcessState.FAILURE,
+ };
+ case ActionTypes.UPDATE_SELECTED_ASSET_BUY_STATE:
+ return {
+ ...state,
+ buyOrderState: action.data,
+ };
+ case ActionTypes.SET_ERROR:
+ return {
+ ...state,
+ latestError: action.data,
+ latestErrorDisplay: LatestErrorDisplay.Present,
+ };
+ case ActionTypes.HIDE_ERROR:
+ return {
+ ...state,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
+ };
+ case ActionTypes.CLEAR_ERROR:
+ return {
+ ...state,
+ latestError: undefined,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
+ };
default:
return state;
}
diff --git a/packages/instant/src/redux/store.ts b/packages/instant/src/redux/store.ts
index fcd19f9a8..b9ce9c0c1 100644
--- a/packages/instant/src/redux/store.ts
+++ b/packages/instant/src/redux/store.ts
@@ -1,6 +1,7 @@
import * as _ from 'lodash';
import { createStore, Store as ReduxStore } from 'redux';
+import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
import { reducer, State } from './reducer';
-export const store: ReduxStore<State> = createStore(reducer);
+export const store: ReduxStore<State> = createStore(reducer, devToolsEnhancer({}));
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index d150bd8ab..f0ffb893b 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -1,9 +1,33 @@
-export enum ActionTypes {
- UPDATE_ETH_USD_PRICE,
- UPDATE_SELECTED_ASSET_AMOUNT,
+import { AssetProxyId, ObjectMap } from '@0xproject/types';
+
+// Reusable
+export enum AsyncProcessState {
+ NONE = 'None',
+ PENDING = 'Pending',
+ SUCCESS = 'Success',
+ FAILURE = 'Failure',
+}
+
+export type FunctionType = (...args: any[]) => any;
+export type ActionCreatorsMapObject = ObjectMap<FunctionType>;
+export type ActionsUnion<A extends ActionCreatorsMapObject> = ReturnType<A[keyof A]>;
+
+export interface ERC20AssetMetaData {
+ assetProxyId: AssetProxyId.ERC20;
+ decimals: number;
+ primaryColor?: string;
+ symbol: string;
}
-export interface Action {
- type: ActionTypes;
- data?: any;
+export interface ERC721AssetMetaData {
+ assetProxyId: AssetProxyId.ERC721;
+ name: string;
+ primaryColor?: string;
+}
+
+export type AssetMetaData = ERC20AssetMetaData | ERC721AssetMetaData;
+
+export enum Network {
+ Kovan = 42,
+ Mainnet = 1,
}
diff --git a/packages/instant/src/util/asset_buyer.ts b/packages/instant/src/util/asset_buyer.ts
new file mode 100644
index 000000000..27d66d600
--- /dev/null
+++ b/packages/instant/src/util/asset_buyer.ts
@@ -0,0 +1,9 @@
+import { AssetBuyer } from '@0xproject/asset-buyer';
+
+import { sraApiUrl } from '../constants';
+
+import { getProvider } from './provider';
+
+const provider = getProvider();
+
+export const assetBuyer = AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(provider, sraApiUrl);
diff --git a/packages/instant/src/util/asset_data.ts b/packages/instant/src/util/asset_data.ts
new file mode 100644
index 000000000..f7c5b78cd
--- /dev/null
+++ b/packages/instant/src/util/asset_data.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+
+import { AssetProxyId } from '@0xproject/types';
+
+import { assetMetaData } from '../data/asset_meta_data';
+
+export const assetDataUtil = {
+ bestNameForAsset: (assetData: string | undefined, defaultString: string) => {
+ if (_.isUndefined(assetData)) {
+ return defaultString;
+ }
+ const metaData = assetMetaData[assetData];
+ if (_.isUndefined(metaData)) {
+ return defaultString;
+ }
+ if (metaData.assetProxyId === AssetProxyId.ERC20) {
+ return metaData.symbol.toUpperCase();
+ }
+ return defaultString;
+ },
+};
diff --git a/packages/instant/src/util/coinbase_api.ts b/packages/instant/src/util/coinbase_api.ts
new file mode 100644
index 000000000..94a5d3c80
--- /dev/null
+++ b/packages/instant/src/util/coinbase_api.ts
@@ -0,0 +1,10 @@
+import { BigNumber } from '@0xproject/utils';
+
+const baseEndpoint = 'https://api.coinbase.com/v2';
+export const coinbaseApi = {
+ getEthUsdPrice: async (): Promise<BigNumber> => {
+ const res = await fetch(`${baseEndpoint}/prices/ETH-USD/buy`);
+ const resJson = await res.json();
+ return new BigNumber(resJson.data.amount);
+ },
+};
diff --git a/packages/instant/src/util/error.ts b/packages/instant/src/util/error.ts
new file mode 100644
index 000000000..48cb131a9
--- /dev/null
+++ b/packages/instant/src/util/error.ts
@@ -0,0 +1,62 @@
+import { AssetBuyerError } from '@0xproject/asset-buyer';
+import { Dispatch } from 'redux';
+
+import { Action, actions } from '../redux/actions';
+import { assetDataUtil } from '../util/asset_data';
+
+class ErrorFlasher {
+ private _timeoutId?: number;
+ public flashNewError(dispatch: Dispatch<Action>, error: any, delayMs: number = 7000): void {
+ this._clearTimeout();
+
+ // dispatch new message
+ dispatch(actions.setError(error));
+
+ this._timeoutId = window.setTimeout(() => {
+ dispatch(actions.hideError());
+ }, delayMs);
+ }
+ public clearError(dispatch: Dispatch<Action>): void {
+ this._clearTimeout();
+ dispatch(actions.hideError());
+ }
+ private _clearTimeout(): void {
+ if (this._timeoutId) {
+ window.clearTimeout(this._timeoutId);
+ }
+ }
+}
+
+const humanReadableMessageForError = (error: Error, assetData?: string): string | undefined => {
+ const hasInsufficientLiquidity =
+ error.message === AssetBuyerError.InsufficientAssetLiquidity ||
+ error.message === AssetBuyerError.InsufficientZrxLiquidity;
+ if (hasInsufficientLiquidity) {
+ const assetName = assetDataUtil.bestNameForAsset(assetData, 'of this asset');
+ return `Not enough ${assetName} available`;
+ }
+
+ if (
+ error.message === AssetBuyerError.StandardRelayerApiError ||
+ error.message.startsWith(AssetBuyerError.AssetUnavailable)
+ ) {
+ const assetName = assetDataUtil.bestNameForAsset(assetData, 'This asset');
+ return `${assetName} is currently unavailable`;
+ }
+
+ return undefined;
+};
+
+export const errorUtil = {
+ errorFlasher: new ErrorFlasher(),
+ errorDescription: (error?: any, assetData?: string): { icon: string; message: string } => {
+ let bestMessage: string | undefined;
+ if (error instanceof Error) {
+ bestMessage = humanReadableMessageForError(error, assetData);
+ }
+ return {
+ icon: '😢',
+ message: bestMessage || 'Something went wrong...',
+ };
+ },
+};
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
new file mode 100644
index 000000000..09eb880b2
--- /dev/null
+++ b/packages/instant/src/util/format.ts
@@ -0,0 +1,53 @@
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as _ from 'lodash';
+
+import { ethDecimals } from '../constants';
+
+export const format = {
+ ethBaseAmount: (
+ ethBaseAmount?: BigNumber,
+ decimalPlaces: number = 4,
+ defaultText: React.ReactNode = '0 ETH',
+ ): React.ReactNode => {
+ if (_.isUndefined(ethBaseAmount)) {
+ return defaultText;
+ }
+ const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseAmount, ethDecimals);
+ return format.ethUnitAmount(ethUnitAmount, decimalPlaces);
+ },
+ ethUnitAmount: (
+ ethUnitAmount?: BigNumber,
+ decimalPlaces: number = 4,
+ defaultText: React.ReactNode = '0 ETH',
+ ): React.ReactNode => {
+ if (_.isUndefined(ethUnitAmount)) {
+ return defaultText;
+ }
+ const roundedAmount = ethUnitAmount.round(decimalPlaces);
+ return `${roundedAmount} ETH`;
+ },
+ ethBaseAmountInUsd: (
+ ethBaseAmount?: BigNumber,
+ ethUsdPrice?: BigNumber,
+ decimalPlaces: number = 2,
+ defaultText: React.ReactNode = '$0.00',
+ ): React.ReactNode => {
+ if (_.isUndefined(ethBaseAmount) || _.isUndefined(ethUsdPrice)) {
+ return defaultText;
+ }
+ const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseAmount, ethDecimals);
+ return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces);
+ },
+ ethUnitAmountInUsd: (
+ ethUnitAmount?: BigNumber,
+ ethUsdPrice?: BigNumber,
+ decimalPlaces: number = 2,
+ defaultText: React.ReactNode = '$0.00',
+ ): React.ReactNode => {
+ if (_.isUndefined(ethUnitAmount) || _.isUndefined(ethUsdPrice)) {
+ return defaultText;
+ }
+ return `$${ethUnitAmount.mul(ethUsdPrice).toFixed(decimalPlaces)}`;
+ },
+};
diff --git a/packages/instant/src/util/provider.ts b/packages/instant/src/util/provider.ts
new file mode 100644
index 000000000..49705fd11
--- /dev/null
+++ b/packages/instant/src/util/provider.ts
@@ -0,0 +1,12 @@
+import { Provider } from 'ethereum-types';
+
+export const getProvider = (): Provider => {
+ const injectedWeb3 = (window as any).web3 || undefined;
+ try {
+ // Use MetaMask/Mist provider
+ return injectedWeb3.currentProvider;
+ } catch (err) {
+ // Throws when user doesn't have MetaMask/Mist running
+ throw new Error(`No injected web3 found: ${err}`);
+ }
+};
diff --git a/packages/instant/src/util/util.ts b/packages/instant/src/util/util.ts
new file mode 100644
index 000000000..232a86850
--- /dev/null
+++ b/packages/instant/src/util/util.ts
@@ -0,0 +1,5 @@
+import * as _ from 'lodash';
+
+export const util = {
+ boundNoop: _.noop.bind(_),
+};
diff --git a/packages/instant/src/util/web3_wrapper.ts b/packages/instant/src/util/web3_wrapper.ts
new file mode 100644
index 000000000..d7e43521f
--- /dev/null
+++ b/packages/instant/src/util/web3_wrapper.ts
@@ -0,0 +1,5 @@
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+
+import { getProvider } from './provider';
+
+export const web3Wrapper = new Web3Wrapper(getProvider());
diff --git a/packages/instant/test/components/zero_ex_instant.test.tsx b/packages/instant/test/components/zero_ex_instant.test.tsx
index 5858732cf..e373bb002 100644
--- a/packages/instant/test/components/zero_ex_instant.test.tsx
+++ b/packages/instant/test/components/zero_ex_instant.test.tsx
@@ -4,10 +4,12 @@ import * as React from 'react';
configure({ adapter: new Adapter() });
-import { ZeroExInstant } from '../../src';
-
-describe('<ZeroExInstant />', () => {
- it('shallow renders without crashing', () => {
- shallow(<ZeroExInstant />);
+// TODO: Write non-trivial tests.
+// At time of writing we cannot render ZeroExInstant
+// because we are looking for a provider on window.
+// But in the future it will be dependency injected.
+describe('<Test />', () => {
+ it('runs a test', () => {
+ shallow(<div />);
});
});
diff --git a/packages/instant/test/util/asset_data.test.ts b/packages/instant/test/util/asset_data.test.ts
new file mode 100644
index 000000000..cf247142a
--- /dev/null
+++ b/packages/instant/test/util/asset_data.test.ts
@@ -0,0 +1,17 @@
+import { assetDataUtil } from '../../src/util/asset_data';
+
+const ZRX_ASSET_DATA = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
+
+describe('assetDataUtil', () => {
+ describe('bestNameForAsset', () => {
+ it('should return default string if assetData is undefined', () => {
+ expect(assetDataUtil.bestNameForAsset(undefined, 'xyz')).toEqual('xyz');
+ });
+ it('should return default string if assetData isnt found', () => {
+ expect(assetDataUtil.bestNameForAsset('fake', 'mah default')).toEqual('mah default');
+ });
+ it('should return ZRX for ZRX assetData', () => {
+ expect(assetDataUtil.bestNameForAsset(ZRX_ASSET_DATA, 'mah default')).toEqual('ZRX');
+ });
+ });
+});
diff --git a/packages/instant/test/util/error.test.ts b/packages/instant/test/util/error.test.ts
new file mode 100644
index 000000000..56f3a1e86
--- /dev/null
+++ b/packages/instant/test/util/error.test.ts
@@ -0,0 +1,48 @@
+import { AssetBuyerError } from '@0xproject/asset-buyer';
+
+import { errorUtil } from '../../src/util/error';
+
+const ZRX_ASSET_DATA = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
+
+describe('errorUtil', () => {
+ describe('errorFlasher', () => {
+ it('should return error and asset name for InsufficientAssetLiquidity', () => {
+ const insufficientAssetError = new Error(AssetBuyerError.InsufficientAssetLiquidity);
+ expect(errorUtil.errorDescription(insufficientAssetError, ZRX_ASSET_DATA).message).toEqual(
+ 'Not enough ZRX available',
+ );
+ });
+ it('should return error default name for InsufficientAssetLiquidity', () => {
+ const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity);
+ expect(errorUtil.errorDescription(insufficientZrxError).message).toEqual(
+ 'Not enough of this asset available',
+ );
+ });
+ it('should return asset name for InsufficientAssetLiquidity', () => {
+ const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity);
+ expect(errorUtil.errorDescription(insufficientZrxError, ZRX_ASSET_DATA).message).toEqual(
+ 'Not enough ZRX available',
+ );
+ });
+ it('should return unavailable error and asset name for StandardRelayerApiError', () => {
+ const standardRelayerError = new Error(AssetBuyerError.StandardRelayerApiError);
+ expect(errorUtil.errorDescription(standardRelayerError, ZRX_ASSET_DATA).message).toEqual(
+ 'ZRX is currently unavailable',
+ );
+ });
+ it('should return error for AssetUnavailable error', () => {
+ const assetUnavailableError = new Error(
+ `${AssetBuyerError.AssetUnavailable}: For assetData ${ZRX_ASSET_DATA}`,
+ );
+ expect(errorUtil.errorDescription(assetUnavailableError, ZRX_ASSET_DATA).message).toEqual(
+ 'ZRX is currently unavailable',
+ );
+ });
+ it('should return default for AssetUnavailable error', () => {
+ const assetUnavailableError = new Error(`${AssetBuyerError.AssetUnavailable}: For assetData xyz`);
+ expect(errorUtil.errorDescription(assetUnavailableError, 'xyz').message).toEqual(
+ 'This asset is currently unavailable',
+ );
+ });
+ });
+});
diff --git a/packages/instant/test/util/format.test.ts b/packages/instant/test/util/format.test.ts
new file mode 100644
index 000000000..073b86b19
--- /dev/null
+++ b/packages/instant/test/util/format.test.ts
@@ -0,0 +1,97 @@
+import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
+
+import { ethDecimals } from '../../src/constants';
+import { format } from '../../src/util/format';
+
+const BIG_NUMBER_ONE = new BigNumber(1);
+const BIG_NUMBER_DECIMAL = new BigNumber(0.432414);
+const BIG_NUMBER_IRRATIONAL = new BigNumber(5.3014059295032);
+const ONE_ETH_IN_BASE_UNITS = Web3Wrapper.toBaseUnitAmount(BIG_NUMBER_ONE, ethDecimals);
+const DECIMAL_ETH_IN_BASE_UNITS = Web3Wrapper.toBaseUnitAmount(BIG_NUMBER_DECIMAL, ethDecimals);
+const IRRATIONAL_ETH_IN_BASE_UNITS = Web3Wrapper.toBaseUnitAmount(BIG_NUMBER_IRRATIONAL, ethDecimals);
+const BIG_NUMBER_FAKE_ETH_USD_PRICE = new BigNumber(2.534);
+
+describe('format', () => {
+ describe('ethBaseAmount', () => {
+ it('converts 1 ETH in base units to the string `1 ETH`', () => {
+ expect(format.ethBaseAmount(ONE_ETH_IN_BASE_UNITS)).toBe('1 ETH');
+ });
+ it('converts .432414 ETH in base units to the string `.4324 ETH`', () => {
+ expect(format.ethBaseAmount(DECIMAL_ETH_IN_BASE_UNITS)).toBe('0.4324 ETH');
+ });
+ it('converts 5.3014059295032 ETH in base units to the string `5.3014 ETH`', () => {
+ expect(format.ethBaseAmount(IRRATIONAL_ETH_IN_BASE_UNITS)).toBe('5.3014 ETH');
+ });
+ it('returns defaultText param when ethBaseAmount is not defined', () => {
+ const defaultText = 'defaultText';
+ expect(format.ethBaseAmount(undefined, 4, defaultText)).toBe(defaultText);
+ });
+ it('it allows for configurable decimal places', () => {
+ expect(format.ethBaseAmount(DECIMAL_ETH_IN_BASE_UNITS, 2)).toBe('0.43 ETH');
+ });
+ });
+ describe('ethUnitAmount', () => {
+ it('converts BigNumber(1) to the string `1 ETH`', () => {
+ expect(format.ethUnitAmount(BIG_NUMBER_ONE)).toBe('1 ETH');
+ });
+ it('converts BigNumer(.432414) to the string `.4324 ETH`', () => {
+ expect(format.ethUnitAmount(BIG_NUMBER_DECIMAL)).toBe('0.4324 ETH');
+ });
+ it('converts BigNumber(5.3014059295032) to the string `5.3014 ETH`', () => {
+ expect(format.ethUnitAmount(BIG_NUMBER_IRRATIONAL)).toBe('5.3014 ETH');
+ });
+ it('returns defaultText param when ethUnitAmount is not defined', () => {
+ const defaultText = 'defaultText';
+ expect(format.ethUnitAmount(undefined, 4, defaultText)).toBe(defaultText);
+ expect(format.ethUnitAmount(BIG_NUMBER_ONE, 4, defaultText)).toBe('1 ETH');
+ });
+ it('it allows for configurable decimal places', () => {
+ expect(format.ethUnitAmount(BIG_NUMBER_DECIMAL, 2)).toBe('0.43 ETH');
+ });
+ });
+ describe('ethBaseAmountInUsd', () => {
+ it('correctly formats 1 ETH to usd according to some price', () => {
+ expect(format.ethBaseAmountInUsd(ONE_ETH_IN_BASE_UNITS, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$2.53');
+ });
+ it('correctly formats .432414 ETH to usd according to some price', () => {
+ expect(format.ethBaseAmountInUsd(DECIMAL_ETH_IN_BASE_UNITS, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$1.10');
+ });
+ it('correctly formats 5.3014059295032 ETH to usd according to some price', () => {
+ expect(format.ethBaseAmountInUsd(IRRATIONAL_ETH_IN_BASE_UNITS, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe(
+ '$13.43',
+ );
+ });
+ it('returns defaultText param when ethBaseAmountInUsd or ethUsdPrice is not defined', () => {
+ const defaultText = 'defaultText';
+ expect(format.ethBaseAmountInUsd(undefined, undefined, 2, defaultText)).toBe(defaultText);
+ expect(format.ethBaseAmountInUsd(BIG_NUMBER_ONE, undefined, 2, defaultText)).toBe(defaultText);
+ expect(format.ethBaseAmountInUsd(undefined, BIG_NUMBER_ONE, 2, defaultText)).toBe(defaultText);
+ });
+ it('it allows for configurable decimal places', () => {
+ expect(format.ethBaseAmountInUsd(DECIMAL_ETH_IN_BASE_UNITS, BIG_NUMBER_FAKE_ETH_USD_PRICE, 4)).toBe(
+ '$1.0957',
+ );
+ });
+ });
+ describe('ethUnitAmountInUsd', () => {
+ it('correctly formats 1 ETH to usd according to some price', () => {
+ expect(format.ethUnitAmountInUsd(BIG_NUMBER_ONE, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$2.53');
+ });
+ it('correctly formats .432414 ETH to usd according to some price', () => {
+ expect(format.ethUnitAmountInUsd(BIG_NUMBER_DECIMAL, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$1.10');
+ });
+ it('correctly formats 5.3014059295032 ETH to usd according to some price', () => {
+ expect(format.ethUnitAmountInUsd(BIG_NUMBER_IRRATIONAL, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$13.43');
+ });
+ it('returns defaultText param when ethUnitAmountInUsd or ethUsdPrice is not defined', () => {
+ const defaultText = 'defaultText';
+ expect(format.ethUnitAmountInUsd(undefined, undefined, 2, defaultText)).toBe(defaultText);
+ expect(format.ethUnitAmountInUsd(BIG_NUMBER_ONE, undefined, 2, defaultText)).toBe(defaultText);
+ expect(format.ethUnitAmountInUsd(undefined, BIG_NUMBER_ONE, 2, defaultText)).toBe(defaultText);
+ });
+ it('it allows for configurable decimal places', () => {
+ expect(format.ethUnitAmountInUsd(BIG_NUMBER_DECIMAL, BIG_NUMBER_FAKE_ETH_USD_PRICE, 4)).toBe('$1.0957');
+ });
+ });
+});
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index 53d929901..08e74b6db 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,15 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note":
+ "Convert all schemas to JSON files so that they can be used with `json-schema` implemenations in other programming languages.",
+ "pr": 1145
+ }
+ ]
+ },
+ {
"timestamp": 1538693146,
"version": "1.0.7",
"changes": [
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index 38dee306d..20d2e48ce 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -10,7 +10,7 @@
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
- "lint": "tslint --project .",
+ "lint": "tslint --project . --exclude **/schemas/**/*",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
@@ -59,7 +59,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"publishConfig": {
diff --git a/packages/json-schemas/schemas/address_schema.json b/packages/json-schemas/schemas/address_schema.json
new file mode 100644
index 000000000..0dc02d331
--- /dev/null
+++ b/packages/json-schemas/schemas/address_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/addressSchema",
+ "type": "string",
+ "pattern": "^0x[0-9a-f]{40}$"
+}
diff --git a/packages/json-schemas/schemas/basic_type_schemas.ts b/packages/json-schemas/schemas/basic_type_schemas.ts
deleted file mode 100644
index a59afaef8..000000000
--- a/packages/json-schemas/schemas/basic_type_schemas.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-export const addressSchema = {
- id: '/addressSchema',
- type: 'string',
- pattern: '^0x[0-9a-f]{40}$',
-};
-
-export const hexSchema = {
- id: '/hexSchema',
- type: 'string',
- pattern: '^0x(([0-9a-f][0-9a-f])+)?$',
-};
-
-export const numberSchema = {
- id: '/numberSchema',
- type: 'string',
- pattern: '^\\d+(\\.\\d+)?$',
-};
diff --git a/packages/json-schemas/schemas/block_param_schema.json b/packages/json-schemas/schemas/block_param_schema.json
new file mode 100644
index 000000000..ed4dd1e87
--- /dev/null
+++ b/packages/json-schemas/schemas/block_param_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/blockParamSchema",
+ "oneOf": [
+ {
+ "type": "number"
+ },
+ {
+ "enum": ["latest", "earliest", "pending"]
+ }
+ ]
+}
diff --git a/packages/json-schemas/schemas/block_range_schema.json b/packages/json-schemas/schemas/block_range_schema.json
new file mode 100644
index 000000000..b14294649
--- /dev/null
+++ b/packages/json-schemas/schemas/block_range_schema.json
@@ -0,0 +1,8 @@
+{
+ "id": "/blockRangeSchema",
+ "properties": {
+ "fromBlock": { "$ref": "/blockParamSchema" },
+ "toBlock": { "$ref": "/blockParamSchema" }
+ },
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/block_range_schema.ts b/packages/json-schemas/schemas/block_range_schema.ts
deleted file mode 100644
index 9eb242fc6..000000000
--- a/packages/json-schemas/schemas/block_range_schema.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export const blockParamSchema = {
- id: '/blockParamSchema',
- oneOf: [
- {
- type: 'number',
- },
- {
- enum: ['latest', 'earliest', 'pending'],
- },
- ],
-};
-
-export const blockRangeSchema = {
- id: '/blockRangeSchema',
- properties: {
- fromBlock: { $ref: '/blockParamSchema' },
- toBlock: { $ref: '/blockParamSchema' },
- },
- type: 'object',
-};
diff --git a/packages/json-schemas/schemas/call_data_schema.json b/packages/json-schemas/schemas/call_data_schema.json
new file mode 100644
index 000000000..c5972e8c1
--- /dev/null
+++ b/packages/json-schemas/schemas/call_data_schema.json
@@ -0,0 +1,27 @@
+{
+ "id": "/callDataSchema",
+ "properties": {
+ "from": { "$ref": "/addressSchema" },
+ "to": { "$ref": "/addressSchema" },
+ "value": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "gas": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "gasPrice": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "data": {
+ "type": "string",
+ "pattern": "^0x[0-9a-f]*$"
+ },
+ "nonce": {
+ "type": "number",
+ "minimum": 0
+ }
+ },
+ "required": [],
+ "type": "object",
+ "additionalProperties": false
+}
diff --git a/packages/json-schemas/schemas/call_data_schema.ts b/packages/json-schemas/schemas/call_data_schema.ts
deleted file mode 100644
index 4c77d9f9d..000000000
--- a/packages/json-schemas/schemas/call_data_schema.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-export const callDataSchema = {
- id: '/callDataSchema',
- properties: {
- from: { $ref: '/addressSchema' },
- to: { $ref: '/addressSchema' },
- value: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- gas: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- gasPrice: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- data: {
- type: 'string',
- pattern: '^0x[0-9a-f]*$',
- },
- nonce: {
- type: 'number',
- minimum: 0,
- },
- },
- required: [],
- type: 'object',
- additionalProperties: false,
-};
diff --git a/packages/json-schemas/schemas/ec_signature_parameter_schema.json b/packages/json-schemas/schemas/ec_signature_parameter_schema.json
new file mode 100644
index 000000000..0c08ec240
--- /dev/null
+++ b/packages/json-schemas/schemas/ec_signature_parameter_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/ecSignatureParameterSchema",
+ "type": "string",
+ "pattern": "^0[xX][0-9A-Fa-f]{64}$"
+}
diff --git a/packages/json-schemas/schemas/ec_signature_schema.json b/packages/json-schemas/schemas/ec_signature_schema.json
new file mode 100644
index 000000000..bc79ca5e9
--- /dev/null
+++ b/packages/json-schemas/schemas/ec_signature_schema.json
@@ -0,0 +1,14 @@
+{
+ "id": "/ECSignature",
+ "properties": {
+ "v": {
+ "type": "number",
+ "minimum": 27,
+ "maximum": 28
+ },
+ "r": { "$ref": "/ecSignatureParameterSchema" },
+ "s": { "$ref": "/ecSignatureParameterSchema" }
+ },
+ "required": ["v", "r", "s"],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/ec_signature_schema.ts b/packages/json-schemas/schemas/ec_signature_schema.ts
deleted file mode 100644
index c59532f09..000000000
--- a/packages/json-schemas/schemas/ec_signature_schema.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export const ecSignatureParameterSchema = {
- id: '/ecSignatureParameterSchema',
- type: 'string',
- pattern: '^0[xX][0-9A-Fa-f]{64}$',
-};
-
-export const ecSignatureSchema = {
- id: '/ECSignature',
- properties: {
- v: {
- type: 'number',
- minimum: 27,
- maximum: 28,
- },
- r: { $ref: '/ecSignatureParameterSchema' },
- s: { $ref: '/ecSignatureParameterSchema' },
- },
- required: ['v', 'r', 's'],
- type: 'object',
-};
diff --git a/packages/json-schemas/schemas/eip712_typed_data.ts b/packages/json-schemas/schemas/eip712_typed_data.ts
deleted file mode 100644
index 31ad74610..000000000
--- a/packages/json-schemas/schemas/eip712_typed_data.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-export const eip712TypedDataSchema = {
- id: '/eip712TypedData',
- type: 'object',
- properties: {
- types: {
- type: 'object',
- properties: {
- EIP712Domain: { type: 'array' },
- },
- additionalProperties: {
- type: 'array',
- items: {
- type: 'object',
- properties: {
- name: { type: 'string' },
- type: { type: 'string' },
- },
- required: ['name', 'type'],
- },
- },
- required: ['EIP712Domain'],
- },
- primaryType: { type: 'string' },
- domain: { type: 'object' },
- message: { type: 'object' },
- },
- required: ['types', 'primaryType', 'domain', 'message'],
-};
diff --git a/packages/json-schemas/schemas/eip712_typed_data_schema.json b/packages/json-schemas/schemas/eip712_typed_data_schema.json
new file mode 100644
index 000000000..8efd6de44
--- /dev/null
+++ b/packages/json-schemas/schemas/eip712_typed_data_schema.json
@@ -0,0 +1,28 @@
+{
+ "id": "/eip712TypedDataSchema",
+ "type": "object",
+ "properties": {
+ "types": {
+ "type": "object",
+ "properties": {
+ "EIP712Domain": { "type": "array" }
+ },
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "type": { "type": "string" }
+ },
+ "required": ["name", "type"]
+ }
+ },
+ "required": ["EIP712Domain"]
+ },
+ "primaryType": { "type": "string" },
+ "domain": { "type": "object" },
+ "message": { "type": "object" }
+ },
+ "required": ["types", "primaryType", "domain", "message"]
+}
diff --git a/packages/json-schemas/schemas/hex_schema.json b/packages/json-schemas/schemas/hex_schema.json
new file mode 100644
index 000000000..f37815d5b
--- /dev/null
+++ b/packages/json-schemas/schemas/hex_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/hexSchema",
+ "type": "string",
+ "pattern": "^0x(([0-9a-f][0-9a-f])+)?$"
+}
diff --git a/packages/json-schemas/schemas/index_filter_values_schema.json b/packages/json-schemas/schemas/index_filter_values_schema.json
new file mode 100644
index 000000000..bec00d79e
--- /dev/null
+++ b/packages/json-schemas/schemas/index_filter_values_schema.json
@@ -0,0 +1,7 @@
+{
+ "id": "/indexFilterValuesSchema",
+ "additionalProperties": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/addressSchema" }, { "$ref": "/orderHashSchema" }]
+ },
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/index_filter_values_schema.ts b/packages/json-schemas/schemas/index_filter_values_schema.ts
deleted file mode 100644
index f3c8cef68..000000000
--- a/packages/json-schemas/schemas/index_filter_values_schema.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const indexFilterValuesSchema = {
- id: '/indexFilterValuesSchema',
- additionalProperties: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/addressSchema' }, { $ref: '/orderHashSchema' }],
- },
- type: 'object',
-};
diff --git a/packages/json-schemas/schemas/js_number.json b/packages/json-schemas/schemas/js_number.json
new file mode 100644
index 000000000..6a72d92c0
--- /dev/null
+++ b/packages/json-schemas/schemas/js_number.json
@@ -0,0 +1,5 @@
+{
+ "id": "/jsNumber",
+ "type": "number",
+ "minimum": 0
+}
diff --git a/packages/json-schemas/schemas/number_schema.json b/packages/json-schemas/schemas/number_schema.json
new file mode 100644
index 000000000..a48f3e8cf
--- /dev/null
+++ b/packages/json-schemas/schemas/number_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/numberSchema",
+ "type": "string",
+ "pattern": "^\\d+(\\.\\d+)?$"
+}
diff --git a/packages/json-schemas/schemas/order_cancel_schema.json b/packages/json-schemas/schemas/order_cancel_schema.json
new file mode 100644
index 000000000..09d4068c6
--- /dev/null
+++ b/packages/json-schemas/schemas/order_cancel_schema.json
@@ -0,0 +1,12 @@
+{
+ "id": "/orderCancellationRequestsSchema",
+ "type": "array",
+ "items": {
+ "properties": {
+ "order": { "$ref": "/orderSchema" },
+ "takerTokenCancelAmount": { "$ref": "/numberSchema" }
+ },
+ "required": ["order", "takerTokenCancelAmount"],
+ "type": "object"
+ }
+}
diff --git a/packages/json-schemas/schemas/order_cancel_schema.ts b/packages/json-schemas/schemas/order_cancel_schema.ts
deleted file mode 100644
index e4edfbca9..000000000
--- a/packages/json-schemas/schemas/order_cancel_schema.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export const orderCancellationRequestsSchema = {
- id: '/orderCancellationRequestsSchema',
- type: 'array',
- items: {
- properties: {
- order: { $ref: '/orderSchema' },
- takerTokenCancelAmount: { $ref: '/numberSchema' },
- },
- required: ['order', 'takerTokenCancelAmount'],
- type: 'object',
- },
-};
diff --git a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json
new file mode 100644
index 000000000..c9549c72e
--- /dev/null
+++ b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json
@@ -0,0 +1,12 @@
+{
+ "id": "/orderFillOrKillRequestsSchema",
+ "type": "array",
+ "items": {
+ "properties": {
+ "signedOrder": { "$ref": "/signedOrderSchema" },
+ "fillTakerAmount": { "$ref": "/numberSchema" }
+ },
+ "required": ["signedOrder", "fillTakerAmount"],
+ "type": "object"
+ }
+}
diff --git a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts b/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts
deleted file mode 100644
index e2c18ef0a..000000000
--- a/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export const orderFillOrKillRequestsSchema = {
- id: '/orderFillOrKillRequestsSchema',
- type: 'array',
- items: {
- properties: {
- signedOrder: { $ref: '/signedOrderSchema' },
- fillTakerAmount: { $ref: '/numberSchema' },
- },
- required: ['signedOrder', 'fillTakerAmount'],
- type: 'object',
- },
-};
diff --git a/packages/json-schemas/schemas/order_fill_requests_schema.json b/packages/json-schemas/schemas/order_fill_requests_schema.json
new file mode 100644
index 000000000..98325653b
--- /dev/null
+++ b/packages/json-schemas/schemas/order_fill_requests_schema.json
@@ -0,0 +1,12 @@
+{
+ "id": "/orderFillRequestsSchema",
+ "type": "array",
+ "items": {
+ "properties": {
+ "signedOrder": { "$ref": "/signedOrderSchema" },
+ "takerTokenFillAmount": { "$ref": "/numberSchema" }
+ },
+ "required": ["signedOrder", "takerTokenFillAmount"],
+ "type": "object"
+ }
+}
diff --git a/packages/json-schemas/schemas/order_fill_requests_schema.ts b/packages/json-schemas/schemas/order_fill_requests_schema.ts
deleted file mode 100644
index ea8b35e54..000000000
--- a/packages/json-schemas/schemas/order_fill_requests_schema.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export const orderFillRequestsSchema = {
- id: '/orderFillRequestsSchema',
- type: 'array',
- items: {
- properties: {
- signedOrder: { $ref: '/signedOrderSchema' },
- takerTokenFillAmount: { $ref: '/numberSchema' },
- },
- required: ['signedOrder', 'takerTokenFillAmount'],
- type: 'object',
- },
-};
diff --git a/packages/json-schemas/schemas/order_hash_schema.json b/packages/json-schemas/schemas/order_hash_schema.json
new file mode 100644
index 000000000..4a770579f
--- /dev/null
+++ b/packages/json-schemas/schemas/order_hash_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/orderHashSchema",
+ "type": "string",
+ "pattern": "^0x[0-9a-fA-F]{64}$"
+}
diff --git a/packages/json-schemas/schemas/order_hash_schema.ts b/packages/json-schemas/schemas/order_hash_schema.ts
deleted file mode 100644
index 9773a88f9..000000000
--- a/packages/json-schemas/schemas/order_hash_schema.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const orderHashSchema = {
- id: '/orderHashSchema',
- type: 'string',
- pattern: '^0x[0-9a-fA-F]{64}$',
-};
diff --git a/packages/json-schemas/schemas/order_schema.json b/packages/json-schemas/schemas/order_schema.json
new file mode 100644
index 000000000..de2c8c7c2
--- /dev/null
+++ b/packages/json-schemas/schemas/order_schema.json
@@ -0,0 +1,34 @@
+{
+ "id": "/orderSchema",
+ "properties": {
+ "makerAddress": { "$ref": "/addressSchema" },
+ "takerAddress": { "$ref": "/addressSchema" },
+ "makerFee": { "$ref": "/numberSchema" },
+ "takerFee": { "$ref": "/numberSchema" },
+ "senderAddress": { "$ref": "/addressSchema" },
+ "makerAssetAmount": { "$ref": "/numberSchema" },
+ "takerAssetAmount": { "$ref": "/numberSchema" },
+ "makerAssetData": { "$ref": "/hexSchema" },
+ "takerAssetData": { "$ref": "/hexSchema" },
+ "salt": { "$ref": "/numberSchema" },
+ "exchangeAddress": { "$ref": "/addressSchema" },
+ "feeRecipientAddress": { "$ref": "/addressSchema" },
+ "expirationTimeSeconds": { "$ref": "/numberSchema" }
+ },
+ "required": [
+ "makerAddress",
+ "takerAddress",
+ "makerFee",
+ "takerFee",
+ "senderAddress",
+ "makerAssetAmount",
+ "takerAssetAmount",
+ "makerAssetData",
+ "takerAssetData",
+ "salt",
+ "exchangeAddress",
+ "feeRecipientAddress",
+ "expirationTimeSeconds"
+ ],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/order_schemas.ts b/packages/json-schemas/schemas/order_schemas.ts
deleted file mode 100644
index eb7fdaf5a..000000000
--- a/packages/json-schemas/schemas/order_schemas.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-export const orderSchema = {
- id: '/orderSchema',
- properties: {
- makerAddress: { $ref: '/addressSchema' },
- takerAddress: { $ref: '/addressSchema' },
- makerFee: { $ref: '/numberSchema' },
- takerFee: { $ref: '/numberSchema' },
- senderAddress: { $ref: '/addressSchema' },
- makerAssetAmount: { $ref: '/numberSchema' },
- takerAssetAmount: { $ref: '/numberSchema' },
- makerAssetData: { $ref: '/hexSchema' },
- takerAssetData: { $ref: '/hexSchema' },
- salt: { $ref: '/numberSchema' },
- exchangeAddress: { $ref: '/addressSchema' },
- feeRecipientAddress: { $ref: '/addressSchema' },
- expirationTimeSeconds: { $ref: '/numberSchema' },
- },
- required: [
- 'makerAddress',
- 'takerAddress',
- 'makerFee',
- 'takerFee',
- 'senderAddress',
- 'makerAssetAmount',
- 'takerAssetAmount',
- 'makerAssetData',
- 'takerAssetData',
- 'salt',
- 'exchangeAddress',
- 'feeRecipientAddress',
- 'expirationTimeSeconds',
- ],
- type: 'object',
-};
-
-export const signedOrderSchema = {
- id: '/signedOrderSchema',
- allOf: [
- { $ref: '/orderSchema' },
- {
- properties: {
- signature: { $ref: '/hexSchema' },
- },
- required: ['signature'],
- },
- ],
-};
diff --git a/packages/json-schemas/schemas/orders_schema.json b/packages/json-schemas/schemas/orders_schema.json
new file mode 100644
index 000000000..1e1c6a875
--- /dev/null
+++ b/packages/json-schemas/schemas/orders_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/ordersSchema",
+ "type": "array",
+ "items": { "$ref": "/orderSchema" }
+}
diff --git a/packages/json-schemas/schemas/orders_schema.ts b/packages/json-schemas/schemas/orders_schema.ts
deleted file mode 100644
index de0abcf00..000000000
--- a/packages/json-schemas/schemas/orders_schema.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const ordersSchema = {
- id: '/ordersSchema',
- type: 'array',
- items: { $ref: '/orderSchema' },
-};
diff --git a/packages/json-schemas/schemas/paginated_collection_schema.json b/packages/json-schemas/schemas/paginated_collection_schema.json
new file mode 100644
index 000000000..9dcedf5b4
--- /dev/null
+++ b/packages/json-schemas/schemas/paginated_collection_schema.json
@@ -0,0 +1,10 @@
+{
+ "id": "/paginatedCollectionSchema",
+ "type": "object",
+ "properties": {
+ "total": { "type": "number" },
+ "perPage": { "type": "number" },
+ "page": { "type": "number" }
+ },
+ "required": ["total", "perPage", "page"]
+}
diff --git a/packages/json-schemas/schemas/paginated_collection_schema.ts b/packages/json-schemas/schemas/paginated_collection_schema.ts
deleted file mode 100644
index 16044c70a..000000000
--- a/packages/json-schemas/schemas/paginated_collection_schema.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export const paginatedCollectionSchema = {
- id: '/paginatedCollectionSchema',
- type: 'object',
- properties: {
- total: { type: 'number' },
- perPage: { type: 'number' },
- page: { type: 'number' },
- },
- required: ['total', 'perPage', 'page'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json
new file mode 100644
index 000000000..d1150d3db
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_response_schema.json
@@ -0,0 +1,13 @@
+{
+ "id": "/relayerApiAssetDataPairsResponseSchema",
+ "type": "object",
+ "allOf": [
+ { "$ref": "/paginatedCollectionSchema" },
+ {
+ "properties": {
+ "records": { "$ref": "/relayerApiAssetDataPairsSchema" }
+ },
+ "required": ["records"]
+ }
+ ]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json
new file mode 100644
index 000000000..62d4745b8
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_asset_data_pairs_schema.json
@@ -0,0 +1,12 @@
+{
+ "id": "/relayerApiAssetDataPairsSchema",
+ "type": "array",
+ "items": {
+ "properties": {
+ "assetDataA": { "$ref": "/relayerApiAssetDataTradeInfoSchema" },
+ "assetDataB": { "$ref": "/relayerApiAssetDataTradeInfoSchema" }
+ },
+ "required": ["assetDataA", "assetDataB"],
+ "type": "object"
+ }
+}
diff --git a/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json b/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json
new file mode 100644
index 000000000..0ab9b444f
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_asset_data_trade_info_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/relayerApiAssetDataTradeInfoSchema",
+ "type": "object",
+ "properties": {
+ "assetData": { "$ref": "/hexSchema" },
+ "minAmount": { "$ref": "/numberSchema" },
+ "maxAmount": { "$ref": "/numberSchema" },
+ "precision": { "type": "number" }
+ },
+ "required": ["assetData"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts b/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts
deleted file mode 100644
index c13396d29..000000000
--- a/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-export const relayerApiAssetDataPairsResponseSchema = {
- id: '/relayerApiAssetDataPairsResponseSchema',
- type: 'object',
- allOf: [
- { $ref: '/paginatedCollectionSchema' },
- {
- properties: {
- records: { $ref: '/relayerApiAssetDataPairsSchema' },
- },
- required: ['records'],
- },
- ],
-};
-
-export const relayerApiAssetDataPairsSchema = {
- id: '/relayerApiAssetDataPairsSchema',
- type: 'array',
- items: {
- properties: {
- assetDataA: { $ref: '/relayerApiAssetDataTradeInfoSchema' },
- assetDataB: { $ref: '/relayerApiAssetDataTradeInfoSchema' },
- },
- required: ['assetDataA', 'assetDataB'],
- type: 'object',
- },
-};
-
-export const relayerApiAssetDataTradeInfoSchema = {
- id: '/relayerApiAssetDataTradeInfoSchema',
- type: 'object',
- properties: {
- assetData: { $ref: '/hexSchema' },
- minAmount: { $ref: '/numberSchema' },
- maxAmount: { $ref: '/numberSchema' },
- precision: { type: 'number' },
- },
- required: ['assetData'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_error_response_schema.json b/packages/json-schemas/schemas/relayer_api_error_response_schema.json
new file mode 100644
index 000000000..be4659b0b
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_error_response_schema.json
@@ -0,0 +1,21 @@
+{
+ "id": "/relayerApiErrorResponseSchema",
+ "type": "object",
+ "properties": {
+ "code": { "type": "integer", "minimum": 100, "maximum": 103 },
+ "reason": { "type": "string" },
+ "validationErrors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "field": { "type": "string" },
+ "code": { "type": "integer", "minimum": 1000, "maximum": 1006 },
+ "reason": { "type": "string" }
+ },
+ "required": ["field", "code", "reason"]
+ }
+ }
+ },
+ "required": ["code", "reason"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_error_response_schema.ts b/packages/json-schemas/schemas/relayer_api_error_response_schema.ts
deleted file mode 100644
index 79e33fc85..000000000
--- a/packages/json-schemas/schemas/relayer_api_error_response_schema.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export const relayerApiErrorResponseSchema = {
- id: '/relayerApiErrorResponseSchema',
- type: 'object',
- properties: {
- code: { type: 'integer', minimum: 100, maximum: 103 },
- reason: { type: 'string' },
- validationErrors: {
- type: 'array',
- items: {
- type: 'object',
- properties: {
- field: { type: 'string' },
- code: { type: 'integer', minimum: 1000, maximum: 1006 },
- reason: { type: 'string' },
- },
- required: ['field', 'code', 'reason'],
- },
- },
- },
- required: ['code', 'reason'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json
new file mode 100644
index 000000000..c73506dbb
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json
@@ -0,0 +1,16 @@
+{
+ "id": "/relayerApiFeeRecipientsResponseSchema",
+ "type": "object",
+ "allOf": [
+ { "$ref": "/paginatedCollectionSchema" },
+ {
+ "properties": {
+ "records": {
+ "type": "array",
+ "items": { "$ref": "/addressSchema" }
+ }
+ },
+ "required": ["records"]
+ }
+ ]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts
deleted file mode 100644
index 5f6bc0530..000000000
--- a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-export const relayerApiFeeRecipientsResponseSchema = {
- id: '/relayerApiFeeRecipientsResponseSchema',
- type: 'object',
- allOf: [
- { $ref: '/paginatedCollectionSchema' },
- {
- properties: {
- records: {
- type: 'array',
- items: { $ref: '/addressSchema' },
- },
- },
- required: ['records'],
- },
- ],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json
new file mode 100644
index 000000000..bc95b61ef
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json
@@ -0,0 +1,24 @@
+{
+ "id": "/relayerApiOrderConfigPayloadSchema",
+ "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/json-schemas/schemas/relayer_api_order_config_payload_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts
deleted file mode 100644
index 8d1d408d6..000000000
--- a/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-export const relayerApiOrderConfigPayloadSchema = {
- id: '/relayerApiOrderConfigPayloadSchema',
- 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/json-schemas/schemas/relayer_api_order_config_response_schema.json b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json
new file mode 100644
index 000000000..0742febdf
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/relayerApiOrderConfigResponseSchema",
+ "type": "object",
+ "properties": {
+ "makerFee": { "$ref": "/numberSchema" },
+ "takerFee": { "$ref": "/numberSchema" },
+ "feeRecipientAddress": { "$ref": "/addressSchema" },
+ "senderAddress": { "$ref": "/addressSchema" }
+ },
+ "required": ["makerFee", "takerFee", "feeRecipientAddress", "senderAddress"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts b/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts
deleted file mode 100644
index 390d0b262..000000000
--- a/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const relayerApiOrderConfigResponseSchema = {
- id: '/relayerApiOrderConfigResponseSchema',
- type: 'object',
- properties: {
- makerFee: { $ref: '/numberSchema' },
- takerFee: { $ref: '/numberSchema' },
- feeRecipientAddress: { $ref: '/addressSchema' },
- senderAddress: { $ref: '/addressSchema' },
- },
- required: ['makerFee', 'takerFee', 'feeRecipientAddress', 'senderAddress'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.json b/packages/json-schemas/schemas/relayer_api_order_schema.json
new file mode 100644
index 000000000..e0f6539b9
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_order_schema.json
@@ -0,0 +1,9 @@
+{
+ "id": "/relayerApiOrderSchema",
+ "type": "object",
+ "properties": {
+ "order": { "$ref": "/orderSchema" },
+ "metaData": { "type": "object" }
+ },
+ "required": ["order", "metaData"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_order_schema.ts b/packages/json-schemas/schemas/relayer_api_order_schema.ts
deleted file mode 100644
index 3952e9683..000000000
--- a/packages/json-schemas/schemas/relayer_api_order_schema.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export const relayerApiOrderSchema = {
- id: '/relayerApiOrderSchema',
- type: 'object',
- properties: {
- order: { $ref: '/orderSchema' },
- metaData: { type: 'object' },
- },
- required: ['order', 'metaData'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json
new file mode 100644
index 000000000..b44f2a740
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json
@@ -0,0 +1,9 @@
+{
+ "id": "/relayerApiOrderbookResponseSchema",
+ "type": "object",
+ "properties": {
+ "bids": { "$ref": "/relayerApiOrdersResponseSchema" },
+ "asks": { "$ref": "/relayerApiOrdersResponseSchema" }
+ },
+ "required": ["bids", "asks"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts
deleted file mode 100644
index 7c0b8e0df..000000000
--- a/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export const relayerApiOrderbookResponseSchema = {
- id: '/relayerApiOrderbookResponseSchema',
- type: 'object',
- properties: {
- bids: { $ref: '/relayerApiOrdersResponseSchema' },
- asks: { $ref: '/relayerApiOrdersResponseSchema' },
- },
- required: ['bids', 'asks'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json
new file mode 100644
index 000000000..274ef1625
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json
@@ -0,0 +1,14 @@
+{
+ "id": "/relayerApiOrdersChannelSubscribePayloadSchema",
+ "type": "object",
+ "properties": {
+ "makerAssetProxyId": { "$ref": "/hexSchema" },
+ "takerAssetProxyId": { "$ref": "/hexSchema" },
+ "networkId": { "type": "number" },
+ "makerAssetAddress": { "$ref": "/addressSchema" },
+ "takerAssetAddress": { "$ref": "/addressSchema" },
+ "makerAssetData": { "$ref": "/hexSchema" },
+ "takerAssetData": { "$ref": "/hexSchema" },
+ "traderAssetData": { "$ref": "/hexSchema" }
+ }
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json
new file mode 100644
index 000000000..29561d09f
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/relayerApiOrdersChannelSubscribeSchema",
+ "type": "object",
+ "properties": {
+ "type": { "enum": ["subscribe"] },
+ "channel": { "enum": ["orders"] },
+ "requestId": { "type": "string" },
+ "payload": { "$ref": "/relayerApiOrdersChannelSubscribePayloadSchema" }
+ },
+ "required": ["type", "channel", "requestId"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts
deleted file mode 100644
index a3b9b6d95..000000000
--- a/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-export const relayerApiOrdersChannelSubscribeSchema = {
- id: '/relayerApiOrdersChannelSubscribeSchema',
- type: 'object',
- properties: {
- type: { enum: ['subscribe'] },
- channel: { enum: ['orders'] },
- requestId: { type: 'string' },
- payload: { $ref: '/relayerApiOrdersChannelSubscribePayload' },
- },
- required: ['type', 'channel', 'requestId'],
-};
-
-export const relayerApiOrdersChannelSubscribePayload = {
- id: '/relayerApiOrdersChannelSubscribePayload',
- type: 'object',
- properties: {
- makerAssetProxyId: { $ref: '/hexSchema' },
- takerAssetProxyId: { $ref: '/hexSchema' },
- networkId: { type: 'number' },
- makerAssetAddress: { $ref: '/addressSchema' },
- takerAssetAddress: { $ref: '/addressSchema' },
- makerAssetData: { $ref: '/hexSchema' },
- takerAssetData: { $ref: '/hexSchema' },
- traderAssetData: { $ref: '/hexSchema' },
- },
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json
new file mode 100644
index 000000000..239e7c586
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/relayerApiOrdersChannelUpdateSchema",
+ "type": "object",
+ "properties": {
+ "type": { "enum": ["update"] },
+ "channel": { "enum": ["orders"] },
+ "requestId": { "type": "string" },
+ "payload": { "$ref": "/relayerApiOrdersSchema" }
+ },
+ "required": ["type", "channel", "requestId"]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts
deleted file mode 100644
index 800b818e2..000000000
--- a/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const relayerApiOrdersChannelUpdateSchema = {
- id: '/relayerApiOrdersChannelUpdateSchema',
- type: 'object',
- properties: {
- type: { enum: ['update'] },
- channel: { enum: ['orders'] },
- requestId: { type: 'string' },
- payload: { $ref: '/relayerApiOrdersSchema' },
- },
- required: ['type', 'channel', 'requestId'],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.json b/packages/json-schemas/schemas/relayer_api_orders_response_schema.json
new file mode 100644
index 000000000..a5023a3fc
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_response_schema.json
@@ -0,0 +1,13 @@
+{
+ "id": "/relayerApiOrdersResponseSchema",
+ "type": "object",
+ "allOf": [
+ { "$ref": "/paginatedCollectionSchema" },
+ {
+ "properties": {
+ "records": { "$ref": "/relayerApiOrdersSchema" }
+ },
+ "required": ["records"]
+ }
+ ]
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts
deleted file mode 100644
index c10d64ca9..000000000
--- a/packages/json-schemas/schemas/relayer_api_orders_response_schema.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export const relayerApiOrdersResponseSchema = {
- id: '/relayerApiOrdersResponseSchema',
- type: 'object',
- allOf: [
- { $ref: '/paginatedCollectionSchema' },
- {
- properties: {
- records: { $ref: '/relayerApiOrdersSchema' },
- },
- required: ['records'],
- },
- ],
-};
diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.json b/packages/json-schemas/schemas/relayer_api_orders_schema.json
new file mode 100644
index 000000000..84e75cd04
--- /dev/null
+++ b/packages/json-schemas/schemas/relayer_api_orders_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/relayerApiOrdersSchema",
+ "type": "array",
+ "items": { "$ref": "/relayerApiOrderSchema" }
+}
diff --git a/packages/json-schemas/schemas/relayer_api_orders_schema.ts b/packages/json-schemas/schemas/relayer_api_orders_schema.ts
deleted file mode 100644
index ba8ce4722..000000000
--- a/packages/json-schemas/schemas/relayer_api_orders_schema.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const relayerApiOrdersSchema = {
- id: '/relayerApiOrdersSchema',
- type: 'array',
- items: { $ref: '/relayerApiOrderSchema' },
-};
diff --git a/packages/json-schemas/schemas/signed_order_schema.json b/packages/json-schemas/schemas/signed_order_schema.json
new file mode 100644
index 000000000..137ae4a24
--- /dev/null
+++ b/packages/json-schemas/schemas/signed_order_schema.json
@@ -0,0 +1,12 @@
+{
+ "id": "/signedOrderSchema",
+ "allOf": [
+ { "$ref": "/orderSchema" },
+ {
+ "properties": {
+ "signature": { "$ref": "/hexSchema" }
+ },
+ "required": ["signature"]
+ }
+ ]
+}
diff --git a/packages/json-schemas/schemas/signed_orders_schema.json b/packages/json-schemas/schemas/signed_orders_schema.json
new file mode 100644
index 000000000..e7c3a0b6c
--- /dev/null
+++ b/packages/json-schemas/schemas/signed_orders_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/signedOrdersSchema",
+ "type": "array",
+ "items": { "$ref": "/signedOrderSchema" }
+}
diff --git a/packages/json-schemas/schemas/signed_orders_schema.ts b/packages/json-schemas/schemas/signed_orders_schema.ts
deleted file mode 100644
index e2a5aeb56..000000000
--- a/packages/json-schemas/schemas/signed_orders_schema.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export const signedOrdersSchema = {
- id: '/signedOrdersSchema',
- type: 'array',
- items: { $ref: '/signedOrderSchema' },
-};
diff --git a/packages/json-schemas/schemas/token_schema.json b/packages/json-schemas/schemas/token_schema.json
new file mode 100644
index 000000000..31e41c4b8
--- /dev/null
+++ b/packages/json-schemas/schemas/token_schema.json
@@ -0,0 +1,11 @@
+{
+ "id": "/tokenSchema",
+ "properties": {
+ "name": { "type": "string" },
+ "symbol": { "type": "string" },
+ "decimals": { "type": "number" },
+ "address": { "$ref": "/addressSchema" }
+ },
+ "required": ["name", "symbol", "decimals", "address"],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/token_schema.ts b/packages/json-schemas/schemas/token_schema.ts
deleted file mode 100644
index a0b1ae27f..000000000
--- a/packages/json-schemas/schemas/token_schema.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export const tokenSchema = {
- id: '/tokenSchema',
- properties: {
- name: { type: 'string' },
- symbol: { type: 'string' },
- decimals: { type: 'number' },
- address: { $ref: '/addressSchema' },
- },
- required: ['name', 'symbol', 'decimals', 'address'],
- type: 'object',
-};
diff --git a/packages/json-schemas/schemas/tx_data_schema.json b/packages/json-schemas/schemas/tx_data_schema.json
new file mode 100644
index 000000000..4643521ce
--- /dev/null
+++ b/packages/json-schemas/schemas/tx_data_schema.json
@@ -0,0 +1,26 @@
+{
+ "id": "/txDataSchema",
+ "properties": {
+ "from": { "$ref": "/addressSchema" },
+ "to": { "$ref": "/addressSchema" },
+ "value": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "gas": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "gasPrice": {
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ },
+ "data": {
+ "type": "string",
+ "pattern": "^0x[0-9a-f]*$"
+ },
+ "nonce": {
+ "type": "number",
+ "minimum": 0
+ }
+ },
+ "required": ["from"],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/tx_data_schema.ts b/packages/json-schemas/schemas/tx_data_schema.ts
deleted file mode 100644
index c57e18461..000000000
--- a/packages/json-schemas/schemas/tx_data_schema.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-export const jsNumber = {
- id: '/jsNumber',
- type: 'number',
- minimum: 0,
-};
-
-export const txDataSchema = {
- id: '/txDataSchema',
- properties: {
- from: { $ref: '/addressSchema' },
- to: { $ref: '/addressSchema' },
- value: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- gas: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- gasPrice: {
- oneOf: [{ $ref: '/numberSchema' }, { $ref: '/jsNumber' }],
- },
- data: {
- type: 'string',
- pattern: '^0x[0-9a-f]*$',
- },
- nonce: {
- type: 'number',
- minimum: 0,
- },
- },
- required: ['from'],
- type: 'object',
-};
diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.json b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
new file mode 100644
index 000000000..ad3b11583
--- /dev/null
+++ b/packages/json-schemas/schemas/zero_ex_transaction_schema.json
@@ -0,0 +1,10 @@
+{
+ "id": "/zeroExTransactionSchema",
+ "properties": {
+ "data": { "$ref": "/hexSchema" },
+ "signerAddress": { "$ref": "/addressSchema" },
+ "salt": { "$ref": "/numberSchema" }
+ },
+ "required": ["data", "salt", "signerAddress"],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/zero_ex_transaction_schema.ts b/packages/json-schemas/schemas/zero_ex_transaction_schema.ts
deleted file mode 100644
index 7f729b724..000000000
--- a/packages/json-schemas/schemas/zero_ex_transaction_schema.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export const zeroExTransactionSchema = {
- id: '/zeroExTransactionSchema',
- properties: {
- data: { $ref: '/hexSchema' },
- signerAddress: { $ref: '/addressSchema' },
- salt: { $ref: '/numberSchema' },
- },
- required: ['data', 'salt', 'signerAddress'],
- type: 'object',
-};
diff --git a/packages/json-schemas/src/globals.d.ts b/packages/json-schemas/src/globals.d.ts
deleted file mode 100644
index 94e63a32d..000000000
--- a/packages/json-schemas/src/globals.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts
index 4eb96092d..8318df617 100644
--- a/packages/json-schemas/src/schemas.ts
+++ b/packages/json-schemas/src/schemas.ts
@@ -1,38 +1,40 @@
-import { addressSchema, hexSchema, numberSchema } from '../schemas/basic_type_schemas';
-import { blockParamSchema, blockRangeSchema } from '../schemas/block_range_schema';
-import { callDataSchema } from '../schemas/call_data_schema';
-import { ecSignatureParameterSchema, ecSignatureSchema } from '../schemas/ec_signature_schema';
-import { eip712TypedDataSchema } from '../schemas/eip712_typed_data';
-import { indexFilterValuesSchema } from '../schemas/index_filter_values_schema';
-import { orderCancellationRequestsSchema } from '../schemas/order_cancel_schema';
-import { orderFillOrKillRequestsSchema } from '../schemas/order_fill_or_kill_requests_schema';
-import { orderFillRequestsSchema } from '../schemas/order_fill_requests_schema';
-import { orderHashSchema } from '../schemas/order_hash_schema';
-import { orderSchema, signedOrderSchema } from '../schemas/order_schemas';
-import { ordersSchema } from '../schemas/orders_schema';
-import { paginatedCollectionSchema } from '../schemas/paginated_collection_schema';
-import {
- relayerApiAssetDataPairsResponseSchema,
- relayerApiAssetDataPairsSchema,
- relayerApiAssetDataTradeInfoSchema,
-} from '../schemas/relayer_api_asset_pairs_response_schema';
-import { relayerApiErrorResponseSchema } from '../schemas/relayer_api_error_response_schema';
-import { relayerApiFeeRecipientsResponseSchema } from '../schemas/relayer_api_fee_recipients_response_schema';
-import { relayerApiOrderConfigPayloadSchema } from '../schemas/relayer_api_order_config_payload_schema';
-import { relayerApiOrderConfigResponseSchema } from '../schemas/relayer_api_order_config_response_schema';
-import { relayerApiOrderSchema } from '../schemas/relayer_api_order_schema';
-import { relayerApiOrderbookResponseSchema } from '../schemas/relayer_api_orderbook_response_schema';
-import {
- relayerApiOrdersChannelSubscribePayload,
- relayerApiOrdersChannelSubscribeSchema,
-} from '../schemas/relayer_api_orders_channel_subscribe_schema';
-import { relayerApiOrdersChannelUpdateSchema } from '../schemas/relayer_api_orders_channel_update_response_schema';
-import { relayerApiOrdersResponseSchema } from '../schemas/relayer_api_orders_response_schema';
-import { relayerApiOrdersSchema } from '../schemas/relayer_api_orders_schema';
-import { signedOrdersSchema } from '../schemas/signed_orders_schema';
-import { tokenSchema } from '../schemas/token_schema';
-import { jsNumber, txDataSchema } from '../schemas/tx_data_schema';
-import { zeroExTransactionSchema } from '../schemas/zero_ex_transaction_schema';
+import * as addressSchema from '../schemas/address_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';
+import * as ecSignatureParameterSchema from '../schemas/ec_signature_parameter_schema.json';
+import * as ecSignatureSchema from '../schemas/ec_signature_schema.json';
+import * as eip712TypedDataSchema from '../schemas/eip712_typed_data_schema.json';
+import * as hexSchema from '../schemas/hex_schema.json';
+import * as indexFilterValuesSchema from '../schemas/index_filter_values_schema.json';
+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 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 ordersSchema from '../schemas/orders_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';
+import * as relayerApiAssetDataTradeInfoSchema from '../schemas/relayer_api_asset_data_trade_info_schema.json';
+import * as relayerApiErrorResponseSchema from '../schemas/relayer_api_error_response_schema.json';
+import * as relayerApiFeeRecipientsResponseSchema from '../schemas/relayer_api_fee_recipients_response_schema.json';
+import * as relayerApiOrderConfigPayloadSchema from '../schemas/relayer_api_order_config_payload_schema.json';
+import * as relayerApiOrderConfigResponseSchema from '../schemas/relayer_api_order_config_response_schema.json';
+import * as relayerApiOrderSchema from '../schemas/relayer_api_order_schema.json';
+import * as relayerApiOrderbookResponseSchema from '../schemas/relayer_api_orderbook_response_schema.json';
+import * as relayerApiOrdersChannelSubscribePayloadSchema from '../schemas/relayer_api_orders_channel_subscribe_payload_schema.json';
+import * as relayerApiOrdersChannelSubscribeSchema from '../schemas/relayer_api_orders_channel_subscribe_schema.json';
+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 signedOrderSchema from '../schemas/signed_order_schema.json';
+import * as signedOrdersSchema from '../schemas/signed_orders_schema.json';
+import * as tokenSchema from '../schemas/token_schema.json';
+import * as txDataSchema from '../schemas/tx_data_schema.json';
+import * as zeroExTransactionSchema from '../schemas/zero_ex_transaction_schema.json';
export const schemas = {
numberSchema,
@@ -67,7 +69,7 @@ export const schemas = {
relayerApiAssetDataPairsResponseSchema,
relayerApiAssetDataTradeInfoSchema,
relayerApiOrdersChannelSubscribeSchema,
- relayerApiOrdersChannelSubscribePayload,
+ relayerApiOrdersChannelSubscribePayloadSchema,
relayerApiOrdersChannelUpdateSchema,
relayerApiOrdersResponseSchema,
relayerApiAssetDataPairsSchema,
diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json
index 96bf8789e..425dfcfe1 100644
--- a/packages/json-schemas/tsconfig.json
+++ b/packages/json-schemas/tsconfig.json
@@ -2,7 +2,47 @@
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib",
- "rootDir": "."
+ "rootDir": ".",
+ "resolveJsonModule": true
},
- "include": ["./src/**/*", "./test/**/*", "./schemas/**/*"]
+ "include": ["./src/**/*", "./test/**/*"],
+ "files": [
+ "./schemas/address_schema.json",
+ "./schemas/number_schema.json",
+ "./schemas/hex_schema.json",
+ "./schemas/block_param_schema.json",
+ "./schemas/block_range_schema.json",
+ "./schemas/call_data_schema.json",
+ "./schemas/ec_signature_parameter_schema.json",
+ "./schemas/ec_signature_schema.json",
+ "./schemas/eip712_typed_data_schema.json",
+ "./schemas/order_cancel_schema.json",
+ "./schemas/order_fill_or_kill_requests_schema.json",
+ "./schemas/order_fill_requests_schema.json",
+ "./schemas/order_hash_schema.json",
+ "./schemas/order_schema.json",
+ "./schemas/signed_order_schema.json",
+ "./schemas/orders_schema.json",
+ "./schemas/paginated_collection_schema.json",
+ "./schemas/relayer_api_asset_data_pairs_response_schema.json",
+ "./schemas/relayer_api_asset_data_pairs_schema.json",
+ "./schemas/relayer_api_asset_data_trade_info_schema.json",
+ "./schemas/relayer_api_error_response_schema.json",
+ "./schemas/relayer_api_fee_recipients_response_schema.json",
+ "./schemas/relayer_api_order_config_payload_schema.json",
+ "./schemas/relayer_api_order_config_response_schema.json",
+ "./schemas/relayer_api_order_schema.json",
+ "./schemas/relayer_api_orderbook_response_schema.json",
+ "./schemas/relayer_api_orders_channel_subscribe_payload_schema.json",
+ "./schemas/relayer_api_orders_channel_subscribe_schema.json",
+ "./schemas/relayer_api_orders_channel_update_response_schema.json",
+ "./schemas/relayer_api_orders_response_schema.json",
+ "./schemas/relayer_api_orders_schema.json",
+ "./schemas/signed_orders_schema.json",
+ "./schemas/token_schema.json",
+ "./schemas/js_number.json",
+ "./schemas/zero_ex_transaction_schema.json",
+ "./schemas/tx_data_schema.json",
+ "./schemas/index_filter_values_schema.json"
+ ]
}
diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json
index 3b8684fab..4797fd929 100644
--- a/packages/monorepo-scripts/CHANGELOG.json
+++ b/packages/monorepo-scripts/CHANGELOG.json
@@ -1,5 +1,18 @@
[
{
+ "version": "1.0.6",
+ "changes": [
+ {
+ "note": "Render date formats in UTC to prevent conflicts when publishing in different timezones.",
+ "pr": 1143
+ },
+ {
+ "note": "Add AssetBuyerError to the IGNORED_EXCESSIVE_TYPES array",
+ "pr": 1139
+ }
+ ]
+ },
+ {
"timestamp": 1534210131,
"version": "1.0.5",
"changes": [
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index 83091ae84..57e8bc147 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -65,7 +65,7 @@
"semver": "5.5.0",
"semver-diff": "^2.1.0",
"semver-sort": "0.0.4",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"yargs": "^10.0.3"
},
"publishConfig": {
diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts
index e3ddeddc9..0aaf5a6a5 100644
--- a/packages/monorepo-scripts/src/doc_gen_configs.ts
+++ b/packages/monorepo-scripts/src/doc_gen_configs.ts
@@ -16,8 +16,14 @@ export const docGenConfigs: DocGenConfigs = {
Schema:
'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49',
Uint8Array: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array',
+ // HACK: CI can handle these without the namespace but some local setups (Jacob) require the namespace prefix
+ // This is duplicated until we can discover the source of the issue.
GanacheOpts: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
keystore: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
+ 'Ganache.GanacheOpts':
+ 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
+ 'lightwallet.keystore':
+ 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
},
// If a 0x package re-exports an external package, we should add a link to it's exported items here
EXTERNAL_EXPORT_TO_LINK: {
@@ -30,6 +36,7 @@ export const docGenConfigs: DocGenConfigs = {
// factory method which instantiates an instance of a class, but we don't want users instantiating it themselves
// and getting confused. Any class name in this list will not have it's constructor rendered in our docs.
CLASSES_WITH_HIDDEN_CONSTRUCTORS: [
+ 'AssetBuyer',
'ERC20ProxyWrapper',
'ERC20TokenWrapper',
'ERC721ProxyWrapper',
@@ -43,7 +50,13 @@ export const docGenConfigs: DocGenConfigs = {
// Some types are not explicitly part of the public interface like params, return values, etc... But we still
// want them exported. E.g error enum types that can be thrown by methods. These must be manually added to this
// config
- IGNORED_EXCESSIVE_TYPES: ['NonceSubproviderErrors', 'Web3WrapperErrors', 'ContractWrappersError', 'OrderError'],
+ IGNORED_EXCESSIVE_TYPES: [
+ 'NonceSubproviderErrors',
+ 'Web3WrapperErrors',
+ 'ContractWrappersError',
+ 'OrderError',
+ 'AssetBuyerError',
+ ],
// Some libraries only export types. In those cases, we cannot check if the exported types are part of the
// "exported public interface". Thus we add them here and skip those checks.
TYPES_ONLY_LIBRARIES: ['ethereum-types', 'types'],
diff --git a/packages/monorepo-scripts/src/utils/changelog_utils.ts b/packages/monorepo-scripts/src/utils/changelog_utils.ts
index 8058d222b..0b46bf670 100644
--- a/packages/monorepo-scripts/src/utils/changelog_utils.ts
+++ b/packages/monorepo-scripts/src/utils/changelog_utils.ts
@@ -19,7 +19,8 @@ CHANGELOG
export const changelogUtils = {
getChangelogMdTitle(versionChangelog: VersionChangelog): string {
- const date = moment(`${versionChangelog.timestamp}`, 'X').format('MMMM D, YYYY');
+ // Use UTC rather than the local machines time (formatted date time is +0:00)
+ const date = moment.utc(`${versionChangelog.timestamp}`, 'X').format('MMMM D, YYYY');
const title = `\n## v${versionChangelog.version} - _${date}_\n\n`;
return title;
},
diff --git a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
index 4fea94414..547b65eeb 100644
--- a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
+++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts
@@ -331,7 +331,7 @@ export class DocGenerateAndUploadUtils {
throw new Error(
`${this._packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join(
'\n',
- )} \nin it\'s index.ts. Remove them then try again.`,
+ )} \nin it\'s index.ts. Remove them then try again OR if we still want them exported (e.g error enum types), then add them to the IGNORED_EXCESSIVE_TYPES array.`,
);
}
}
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index 5a0c0db47..9bf16ef2a 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -14,6 +14,10 @@
{
"note": "Rename `ecSignOrderHashAsync` to `ecSignHashAsync` removing `SignerType` parameter.",
"pr": 1102
+ },
+ {
+ "note": "Use `AssetData` union type for function return values.",
+ "pr": 1131
}
]
},
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index 50bc0f0a0..09eef849f 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -49,7 +49,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"dependencies": {
diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts
index 0c0b59548..12c11bce9 100644
--- a/packages/order-utils/src/asset_data_utils.ts
+++ b/packages/order-utils/src/asset_data_utils.ts
@@ -1,4 +1,4 @@
-import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types';
+import { AssetData, AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import ethAbi = require('ethereumjs-abi');
import ethUtil = require('ethereumjs-util');
@@ -112,7 +112,7 @@ export const assetDataUtils = {
* @param assetData Hex encoded assetData string to decode
* @return Either a ERC20 or ERC721 assetData object
*/
- decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData {
+ decodeAssetDataOrThrow(assetData: string): AssetData {
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (assetProxyId) {
case AssetProxyId.ERC20:
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index dbb782b85..50b8a88a8 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -18,7 +18,6 @@ export { ExchangeTransferSimulator } from './exchange_transfer_simulator';
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store';
-export { constants } from './constants';
export { eip712Utils } from './eip712_utils';
export {
@@ -35,6 +34,7 @@ export {
OrderRelevantState,
OrderState,
ECSignature,
+ AssetData,
ERC20AssetData,
ERC721AssetData,
AssetProxyId,
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 9ee88a5ef..828ce1dbc 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -58,7 +58,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"types-bn": "^0.0.1",
"typescript": "3.0.1",
"web3-typescript-typings": "^0.10.2",
diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts
index 0f2d75691..40b103fd5 100644
--- a/packages/sol-compiler/src/utils/encoder.ts
+++ b/packages/sol-compiler/src/utils/encoder.ts
@@ -1,4 +1,4 @@
-import { AbiDefinition, AbiType, ContractAbi, DataItem } from 'ethereum-types';
+import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem } from 'ethereum-types';
import * as _ from 'lodash';
import * as web3Abi from 'web3-eth-abi';
@@ -7,7 +7,9 @@ export const encoder = {
const constructorTypes: string[] = [];
_.each(abi, (element: AbiDefinition) => {
if (element.type === AbiType.Constructor) {
- _.each(element.inputs, (input: DataItem) => {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const constuctorAbi = element as ConstructorAbi;
+ _.each(constuctorAbi.inputs, (input: DataItem) => {
constructorTypes.push(input.type);
});
}
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index e093aa2ad..49473f6c8 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -78,7 +78,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"publishConfig": {
diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts
index 138882c92..686e9ca34 100644
--- a/packages/sol-doc/src/sol_doc.ts
+++ b/packages/sol-doc/src/sol_doc.ts
@@ -324,19 +324,25 @@ export class SolDoc {
switch (abiDefinition.type) {
case 'constructor':
docSection.constructors.push(
- this._genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc),
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc),
);
break;
case 'event':
- (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition));
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi));
// note that we're not sending devdoc to this._genEventDoc().
// that's because the type of the events array doesn't have any fields for documentation!
break;
case 'function':
- docSection.methods.push(this._genMethodDoc(abiDefinition, compiledContract.devdoc));
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc));
break;
case 'fallback':
- docSection.methods.push(SolDoc._genFallbackDoc(abiDefinition, compiledContract.devdoc));
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ docSection.methods.push(
+ SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc),
+ );
break;
default:
throw new Error(
diff --git a/packages/sra-spec/src/json-schemas.ts b/packages/sra-spec/src/json-schemas.ts
index 173a04bfb..47cca9b04 100644
--- a/packages/sra-spec/src/json-schemas.ts
+++ b/packages/sra-spec/src/json-schemas.ts
@@ -21,7 +21,7 @@ const {
relayerApiAssetDataPairsResponseSchema,
relayerApiAssetDataTradeInfoSchema,
relayerApiOrdersChannelSubscribeSchema,
- relayerApiOrdersChannelSubscribePayload,
+ relayerApiOrdersChannelSubscribePayloadSchema,
relayerApiOrdersChannelUpdateSchema,
relayerApiOrdersResponseSchema,
relayerApiAssetDataPairsSchema,
@@ -47,7 +47,7 @@ const usedSchemas = {
relayerApiAssetDataPairsResponseSchema,
relayerApiAssetDataTradeInfoSchema,
relayerApiOrdersChannelSubscribeSchema,
- relayerApiOrdersChannelSubscribePayload,
+ relayerApiOrdersChannelSubscribePayloadSchema,
relayerApiOrdersChannelUpdateSchema,
relayerApiOrdersResponseSchema,
relayerApiAssetDataPairsSchema,
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index bef93a572..1fe1ee4ad 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -73,7 +73,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1",
"webpack": "^4.20.2"
},
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json
index 53e1f3716..106dc3281 100644
--- a/packages/types/CHANGELOG.json
+++ b/packages/types/CHANGELOG.json
@@ -9,6 +9,10 @@
{
"note": "Added `ZeroExTransaction` type for Exchange executeTransaction",
"pr": 1102
+ },
+ {
+ "note": "Add `AssetData` union type (`type AssetData = ERC20AssetData | ERC721AssetData`)",
+ "pr": 1131
}
]
},
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index d33048b61..3c9b6bbc5 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -168,6 +168,8 @@ export interface ERC721AssetData {
tokenId: BigNumber;
}
+export type AssetData = ERC20AssetData | ERC721AssetData;
+
// TODO: DRY. These should be extracted from contract code.
export enum RevertReason {
OrderUnfillable = 'ORDER_UNFILLABLE',
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index ac3e54efb..c0b2c7950 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -99,11 +99,13 @@ export class AbiDecoder {
const ethersInterface = new ethers.utils.Interface(abiArray);
_.map(abiArray, (abi: AbiDefinition) => {
if (abi.type === AbiType.Event) {
- const topic = ethersInterface.events[abi.name].topic;
- const numIndexedArgs = _.reduce(abi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0);
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const eventAbi = abi as EventAbi;
+ const topic = ethersInterface.events[eventAbi.name].topic;
+ const numIndexedArgs = _.reduce(eventAbi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0);
this._methodIds[topic] = {
...this._methodIds[topic],
- [numIndexedArgs]: abi,
+ [numIndexedArgs]: eventAbi,
};
}
});
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 972dfa7a2..4d033e130 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -49,7 +49,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.11.0",
- "typedoc": "0.12.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1"
},
"dependencies": {
diff --git a/packages/website/md/docs/asset_buyer/installation.md b/packages/website/md/docs/asset_buyer/installation.md
new file mode 100644
index 000000000..483ee2b65
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/installation.md
@@ -0,0 +1,17 @@
+**Install**
+
+```bash
+yarn add @0xproject/asset-buyer
+```
+
+**Import**
+
+```javascript
+import { AssetBuyer } from '@0xproject/asset-buyer';
+```
+
+or
+
+```javascript
+var AssetBuyer = require('@0xproject/asset-buyer').AssetBuyer;
+```
diff --git a/packages/website/md/docs/asset_buyer/introduction.md b/packages/website/md/docs/asset_buyer/introduction.md
new file mode 100644
index 000000000..a40d20cc9
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/introduction.md
@@ -0,0 +1 @@
+Welcome to the [@0xproject/asset-buyer](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-buyer) documentation! AssetBuyer is a library that provides an easy way to buy any asset with ETH in one click, leveraging 0x liquidity and the [Forwarder contract](https://0xproject.com/docs/contracts#Forwarder).
diff --git a/packages/website/md/docs/asset_buyer/usage.md b/packages/website/md/docs/asset_buyer/usage.md
new file mode 100644
index 000000000..6462d938e
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/usage.md
@@ -0,0 +1,39 @@
+**Construction**
+
+Connecting to a standard relayer API compliant url:
+
+```typescript
+const provider = web3.currentProvider;
+const apiUrl = 'https://api.relayer.com/v2';
+const assetBuyer = AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(provider, apiUrl);
+```
+
+Providing your own orders:
+
+```typescript
+const provider = web3.currentProvider;
+const orders = []; // get these from your own API, a relayer, a friend, from anywhere
+const assetBuyer = AssetBuyer.getAssetBuyerForProvidedOrders(provider, orders);
+```
+
+**Get a quote**
+
+A [BuyQuote](#types-BuyQuote) object contains enough information to display buy information to an end user
+
+```typescript
+const erc20TokenAddress = '0x5fa3c....';
+const amountToBuy = new BigNumber(50000000000000000000);
+const buyQuote = await assetBuyer.getBuyQuoteForERC20TokenAddressAsync(erc20TokenAddress, amountToBuy);
+const quoteInfo = buyQuote.worstCaseQuoteInfo;
+console.log(quoteInfo.ethAmount); // the total amount the user needs to pay to buy the desired amount (including ZRX fees)
+console.log(quoteInfo.feeAmount); // a portion of the total ethAmount above that was used to buy affiliate fees
+console.log(quoteInfo.ethPerAssetPrice); // the rate that this quote provides (e.g. 0.0035ETH / REP)
+```
+
+**Perform a buy**
+
+Pass the [BuyQuote](#types-BuyQuote) object from above back to the assetBuyer in order to initiate the buy transaction
+
+```typescript
+const txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote); // the hash of the transaction submitted to the Ethereum network
+```
diff --git a/packages/website/md/docs/json_schemas/2.0.0/schemas.md b/packages/website/md/docs/json_schemas/2.0.0/schemas.md
index 4f3200b1c..ec7cf6f15 100644
--- a/packages/website/md/docs/json_schemas/2.0.0/schemas.md
+++ b/packages/website/md/docs/json_schemas/2.0.0/schemas.md
@@ -1,28 +1,40 @@
+Basic Schemas
+
+* [Address type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/address.json)
+* [Number type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/number.json)
+* [Hex type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/hex.json)
+* [JS number](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/js_number.json)
+
0x Protocol Schemas
-* [Basic types](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/basic_type_schemas.ts) (e.g Ethereum address, number, hex)
-* [Order/SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schemas.ts)
-* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.ts)
+* [Order](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schema.json)
+* [SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_order_schema.json)
+* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.json)
+* [ECSignature](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/ec_signature_schema.json)
0x.js Schemas
-* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.ts)
-* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.ts)
-* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.ts)
-* [OrderCancellationRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.ts)
-* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts)
-* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.ts)
-* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.ts)
-* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.ts)
+* [BlockParam](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_param_schema.json)
+* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.json)
+* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.json)
+* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.json)
+* [OrderCancellationRequests](https://github.com/0xProjet/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.json)
+* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json)
+* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.json)
+* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.json)
+* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.json)
Standard Relayer API Schemas
-* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.ts)
-* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts)
-* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts)
-* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts)
-* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts)
-* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts)
-* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts)
-* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts)
-* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts)
+* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.json)
+* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.json)
+* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json)
+* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json)
+* [Orders channel subscribe payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json)
+* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json)
+* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json)
+* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json)
+* [Asset pairs](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_schema.json)
+* [Trade info](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_trade_info_schema.json)
+* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.json)
+* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json)
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 6ee780c78..fab8ed56b 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -73,6 +73,7 @@
"WIKI": "wiki",
"WEB3_WRAPPER": "Web3Wrapper",
"ORDER_UTILS": "Order Utils",
+ "ASSET_BUYER": "AssetBuyer",
"FAQ": "FAQ",
"SMART_CONTRACTS": "0x smart contracts",
"STANDARD_RELAYER_API": "standard relayer API",
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx
index b8cd45661..c58dc26bd 100644
--- a/packages/website/ts/components/portal/portal.tsx
+++ b/packages/website/ts/components/portal/portal.tsx
@@ -18,7 +18,7 @@ import { Loading } from 'ts/components/portal/loading';
import { Menu, MenuTheme } from 'ts/components/portal/menu';
import { Section } from 'ts/components/portal/section';
import { TextHeader } from 'ts/components/portal/text_header';
-import { RelayerIndex } from 'ts/components/relayer_index/relayer_index';
+import { RelayerIndex, RelayerIndexCellStyle } from 'ts/components/relayer_index/relayer_index';
import { TokenBalances } from 'ts/components/token_balances';
import { TopBar, TopBarDisplayType } from 'ts/components/top_bar/top_bar';
import { TradeHistory } from 'ts/components/trade_history/trade_history';
@@ -539,6 +539,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
}
private _renderRelayerIndexSection(): React.ReactNode {
const isMobile = utils.isMobileWidth(this.props.screenWidth);
+ // TODO(bmillman): revert RelayerIndex cellStyle to Expanded once data pipeline is tracking v2 volume
return (
<Section
header={!isMobile && <TextHeader labelText="0x Relayers" />}
@@ -549,7 +550,11 @@ export class Portal extends React.Component<PortalProps, PortalState> {
{this._renderStartOnboarding()}
</Container>
)}
- <RelayerIndex networkId={this.props.networkId} screenWidth={this.props.screenWidth} />
+ <RelayerIndex
+ networkId={this.props.networkId}
+ screenWidth={this.props.screenWidth}
+ cellStyle={RelayerIndexCellStyle.Minimized}
+ />
</Container>
}
/>
diff --git a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
index 193dd237a..a81ab107a 100644
--- a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
+++ b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
@@ -14,9 +14,15 @@ import { styled } from 'ts/style/theme';
import { WebsiteBackendRelayerInfo } from 'ts/types';
import { utils } from 'ts/utils/utils';
+export enum RelayerGridTileStyle {
+ Expanded = 0,
+ Minimized,
+}
+
export interface RelayerGridTileProps {
relayerInfo: WebsiteBackendRelayerInfo;
networkId: number;
+ style: RelayerGridTileStyle;
}
const styles: Styles = {
@@ -30,10 +36,14 @@ const styles: Styles = {
height: '100%',
boxSizing: 'border-box',
},
- header: {
+ expandedHeader: {
height: '50%',
width: '100%',
},
+ minimizedHeader: {
+ height: '100%',
+ width: '100%',
+ },
body: {
height: '50%',
width: '100%',
@@ -75,10 +85,12 @@ export const RelayerGridTile: React.StatelessComponent<RelayerGridTileProps> = (
!_.isUndefined(headerImageUrl) && !_.isUndefined(props.relayerInfo.primaryColor)
? props.relayerInfo.primaryColor
: FALLBACK_PRIMARY_COLOR;
+ const isExpanded = props.style === RelayerGridTileStyle.Expanded;
+ const headerStyle = isExpanded ? styles.expandedHeader : styles.minimizedHeader;
return (
<Island style={styles.root} Component={GridTile}>
<div style={styles.innerDiv} onClick={onClick}>
- <div className="flex items-center" style={{ ...styles.header, backgroundColor: headerBackgroundColor }}>
+ <div className="flex items-center" style={{ ...headerStyle, backgroundColor: headerBackgroundColor }}>
<Image
className="mx-auto"
src={props.relayerInfo.logoImgUrl}
@@ -86,21 +98,23 @@ export const RelayerGridTile: React.StatelessComponent<RelayerGridTileProps> = (
height={RELAYER_ICON_HEIGHT}
/>
</div>
- <div style={styles.body}>
- <div className="pb1" style={styles.relayerNameLabel}>
- {props.relayerInfo.name}
- </div>
- <Section titleText="Weekly Trade Volume">
- {!_.isUndefined(weeklyTxnVolume) && (
- <div style={styles.weeklyTradeVolumeLabel}>{props.relayerInfo.weeklyTxnVolume}</div>
- )}
- </Section>
- <Container marginTop="10px">
- <Section titleText="Top Tokens">
- {!_.isEmpty(topTokens) && <TopTokens tokens={topTokens} networkId={props.networkId} />}
+ {isExpanded && (
+ <div style={styles.body}>
+ <div className="pb1" style={styles.relayerNameLabel}>
+ {props.relayerInfo.name}
+ </div>
+ <Section titleText="Weekly Trade Volume">
+ {!_.isUndefined(weeklyTxnVolume) && (
+ <div style={styles.weeklyTradeVolumeLabel}>{props.relayerInfo.weeklyTxnVolume}</div>
+ )}
</Section>
- </Container>
- </div>
+ <Container marginTop="10px">
+ <Section titleText="Top Tokens">
+ {!_.isEmpty(topTokens) && <TopTokens tokens={topTokens} networkId={props.networkId} />}
+ </Section>
+ </Container>
+ </div>
+ )}
</div>
</Island>
);
diff --git a/packages/website/ts/components/relayer_index/relayer_index.tsx b/packages/website/ts/components/relayer_index/relayer_index.tsx
index 91dbeb27a..e88c20d7e 100644
--- a/packages/website/ts/components/relayer_index/relayer_index.tsx
+++ b/packages/website/ts/components/relayer_index/relayer_index.tsx
@@ -3,14 +3,20 @@ import CircularProgress from 'material-ui/CircularProgress';
import { GridList } from 'material-ui/GridList';
import * as React from 'react';
-import { RelayerGridTile } from 'ts/components/relayer_index/relayer_grid_tile';
+import { RelayerGridTile, RelayerGridTileStyle } from 'ts/components/relayer_index/relayer_grid_tile';
import { Retry } from 'ts/components/ui/retry';
import { ScreenWidths, WebsiteBackendRelayerInfo } from 'ts/types';
import { backendClient } from 'ts/utils/backend_client';
+export enum RelayerIndexCellStyle {
+ Expanded = 0,
+ Minimized,
+}
+
export interface RelayerIndexProps {
networkId: number;
screenWidth: ScreenWidths;
+ cellStyle: RelayerIndexCellStyle;
}
interface RelayerIndexState {
@@ -18,7 +24,8 @@ interface RelayerIndexState {
error?: Error;
}
-const CELL_HEIGHT = 290;
+const CELL_HEIGHT_EXPANDED = 290;
+const CELL_HEIGHT_MINIMIZED = 225;
const NUMBER_OF_COLUMNS_LARGE = 3;
const NUMBER_OF_COLUMNS_MEDIUM = 2;
const NUMBER_OF_COLUMNS_SMALL = 2;
@@ -61,15 +68,23 @@ export class RelayerIndex extends React.Component<RelayerIndexProps, RelayerInde
numberOfRelayers,
this._numberOfColumnsForScreenWidth(this.props.screenWidth),
);
+ const isExpanded = this.props.cellStyle === RelayerIndexCellStyle.Expanded;
+ const cellHeight = isExpanded ? CELL_HEIGHT_EXPANDED : CELL_HEIGHT_MINIMIZED;
+ const gridTileStyle = isExpanded ? RelayerGridTileStyle.Expanded : RelayerGridTileStyle.Minimized;
return (
<GridList
- cellHeight={CELL_HEIGHT}
+ cellHeight={cellHeight}
cols={numberOfColumns}
padding={GRID_PADDING}
style={{ marginTop: -10, marginBottom: 0 }}
>
{this.state.relayerInfos.map((relayerInfo: WebsiteBackendRelayerInfo, index) => (
- <RelayerGridTile key={index} relayerInfo={relayerInfo} networkId={this.props.networkId} />
+ <RelayerGridTile
+ key={index}
+ relayerInfo={relayerInfo}
+ networkId={this.props.networkId}
+ style={gridTileStyle}
+ />
))}
</GridList>
);
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 3297befad..ae76c8cf2 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -85,6 +85,7 @@ const DOC_WEBSITE_PATHS_TO_KEY = {
[WebsitePaths.ZeroExJs]: Key.ZeroExJs,
[WebsitePaths.OrderUtils]: Key.OrderUtils,
[WebsitePaths.OrderWatcher]: Key.OrderWatcher,
+ [WebsitePaths.AssetBuyer]: Key.AssetBuyer,
};
const DEFAULT_HEIGHT = 68;
diff --git a/packages/website/ts/containers/asset_buyer_documentation.ts b/packages/website/ts/containers/asset_buyer_documentation.ts
new file mode 100644
index 000000000..f794625de
--- /dev/null
+++ b/packages/website/ts/containers/asset_buyer_documentation.ts
@@ -0,0 +1,69 @@
+import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages } from 'ts/types';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/asset_buyer/introduction');
+const InstallationMarkdown = require('md/docs/asset_buyer/installation');
+const UsageMarkdown = require('md/docs/asset_buyer/usage');
+/* tslint:enable:no-var-requires */
+
+const markdownSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ usage: 'usage',
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.AssetBuyer,
+ packageName: '@0xproject/asset-buyer',
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'AssetBuyer',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ markdownMenu: {
+ introduction: [markdownSections.introduction],
+ install: [markdownSections.installation],
+ usage: [markdownSections.usage],
+ },
+ sectionNameToMarkdownByVersion: {
+ '0.0.1': {
+ [markdownSections.introduction]: IntroMarkdown,
+ [markdownSections.installation]: InstallationMarkdown,
+ [markdownSections.usage]: UsageMarkdown,
+ },
+ },
+ markdownSections,
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, _ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index 4f0a12f20..21157e427 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -69,6 +69,9 @@ const LazyOrderUtilsDocumentation = createLazyComponent('Documentation', async (
const LazyEthereumTypesDocumentation = createLazyComponent('Documentation', async () =>
import(/* webpackChunkName: "ethereumTypesDocs" */ 'ts/containers/ethereum_types_documentation'),
);
+const LazyAssetBuyerDocumentation = createLazyComponent('Documentation', async () =>
+ import(/* webpackChunkName: "assetBuyerDocs" */ 'ts/containers/asset_buyer_documentation'),
+);
const DOCUMENT_TITLE = '0x: The Protocol for Trading Tokens';
const DOCUMENT_DESCRIPTION = 'An Open Protocol For Decentralized Exchange On The Ethereum Blockchain';
@@ -134,8 +137,11 @@ render(
path={`${WebsitePaths.EthereumTypes}/:version?`}
component={LazyEthereumTypesDocumentation}
/>
+ <Route
+ path={`${WebsitePaths.AssetBuyer}/:version?`}
+ component={LazyAssetBuyerDocumentation}
+ />
<Route path={WebsitePaths.Docs} component={DocsHome as any} />
-
{/* Legacy endpoints */}
<Route
path={`${WebsiteLegacyPaths.ZeroExJs}/:version?`}
diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx
index 5f42dfa97..4d346327b 100644
--- a/packages/website/ts/pages/about/about.tsx
+++ b/packages/website/ts/pages/about/about.tsx
@@ -243,9 +243,10 @@ const teamRow9: ProfileInfo[] = [
{
name: 'Steve Klebanoff',
title: 'Senior Engineer',
- description: ` Full-stack engineer. Previously Staff Software Engineer at Appfolio. Computer Science & Cognitive Psychology at Northeastern University.`,
+ description: ` Full-stack engineer. Previously Staff Software Engineer at AppFolio. Computer Science & Cognitive Psychology at Northeastern University.`,
image: 'images/team/steve.png',
linkedIn: 'https://www.linkedin.com/in/steveklebanoff/',
+ github: 'https://github.com/steveklebanoff',
},
];
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index c64751f65..ca73254c6 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -43,6 +43,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.OrderUtils]: 'order-utils',
[DocPackages.OrderWatcher]: 'order-watcher',
[DocPackages.EthereumTypes]: 'ethereum-types',
+ [DocPackages.AssetBuyer]: 'asset-buyer',
};
export interface DocPageProps {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index a3d248a9d..c04810080 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -364,6 +364,7 @@ export enum WebsitePaths {
Subproviders = '/docs/subproviders',
OrderUtils = '/docs/order-utils',
EthereumTypes = '/docs/ethereum-types',
+ AssetBuyer = '/docs/asset-buyer',
Careers = '/careers',
}
@@ -380,6 +381,7 @@ export enum DocPackages {
EthereumTypes = 'ETHEREUM_TYPES',
ContractWrappers = 'CONTRACT_WRAPPERS',
OrderWatcher = 'ORDER_WATCHER',
+ AssetBuyer = 'ASSET_BUYER',
}
export enum Key {
@@ -441,6 +443,7 @@ export enum Key {
ZeroExJs = '0X_JS',
ContractWrappers = 'CONTRACT_WRAPPERS',
OrderWatcher = 'ORDER_WATCHER',
+ AssetBuyer = 'ASSET_BUYER',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',
diff --git a/typedoc-tsconfig.json b/typedoc-tsconfig.json
index 588285140..32efdb4cf 100644
--- a/typedoc-tsconfig.json
+++ b/typedoc-tsconfig.json
@@ -8,6 +8,7 @@
"experimentalDecorators": true,
"downlevelIteration": true,
"noImplicitReturns": true,
+ "resolveJsonModule": true,
"pretty": true,
"skipLibCheck": true,
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
diff --git a/yarn.lock b/yarn.lock
index d210d7a8c..38152c942 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -571,6 +571,12 @@
jsonschema "1.2.2"
lodash.values "4.3.0"
+"@0xproject/npm-cli-login@^0.0.11":
+ version "0.0.11"
+ resolved "https://registry.yarnpkg.com/@0xproject/npm-cli-login/-/npm-cli-login-0.0.11.tgz#3f1ec06112ce62aad300ff0575358f68aeecde2e"
+ dependencies:
+ npm-registry-client "7.0.9"
+
"@0xproject/order-utils@^0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@0xproject/order-utils/-/order-utils-0.0.9.tgz#75225dfbd87335d18810abf995d8e077b9a84868"
@@ -1022,6 +1028,10 @@
version "0.4.30"
resolved "https://registry.yarnpkg.com/@types/istanbul/-/istanbul-0.4.30.tgz#073159320ab3296b2cfeb481f756a1f8f4c9c8e4"
+"@types/jest@^23.3.5":
+ version "23.3.5"
+ resolved "https://registry.npmjs.org/@types/jest/-/jest-23.3.5.tgz#870a1434208b60603745bfd214fc3fc675142364"
+
"@types/js-combinatorics@^0.5.29":
version "0.5.29"
resolved "https://registry.yarnpkg.com/@types/js-combinatorics/-/js-combinatorics-0.5.29.tgz#47a7819a0b6925b6dc4bd2c2278a7e6329b29387"
@@ -10337,12 +10347,6 @@ npm-bundled@^1.0.1:
version "1.0.3"
resolved "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308"
-npm-cli-login@^0.0.10:
- version "0.0.10"
- resolved "https://registry.yarnpkg.com/npm-cli-login/-/npm-cli-login-0.0.10.tgz#b1e8b5b7405008e0a26ccc170443434a59c5364c"
- dependencies:
- npm-registry-client "7.0.9"
-
npm-lifecycle@^2.0.0:
version "2.0.3"
resolved "http://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.0.3.tgz#696bedf1143371163e9cc16fe872357e25d8d90e"
@@ -12483,6 +12487,10 @@ redux-devtools-extension@^2.13.2:
version "2.13.2"
resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.2.tgz#e0f9a8e8dfca7c17be92c7124958a3b94eb2911d"
+redux-devtools-extension@^2.13.5:
+ version "2.13.5"
+ resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.5.tgz#3ff34f7227acfeef3964194f5f7fc2765e5c5a39"
+
redux@*, redux@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
@@ -14693,6 +14701,10 @@ ts-node@^7.0.0:
source-map-support "^0.5.6"
yn "^2.0.0"
+ts-optchain@^0.1.1:
+ version "0.1.1"
+ resolved "https://registry.npmjs.org/ts-optchain/-/ts-optchain-0.1.1.tgz#9d45e2c3fc6201c2f9be82edad4c76fefb2a36d9"
+
tslib@1.9.0, tslib@^1.8.0, tslib@^1.8.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
@@ -14836,9 +14848,9 @@ typedoc-default-themes@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz#6dc2433e78ed8bea8e887a3acde2f31785bd6227"
-typedoc@0.12.0:
- version "0.12.0"
- resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.12.0.tgz#c5d606f52af29d841658e18d9faa1a72acf0e270"
+typedoc@0.13.0:
+ version "0.13.0"
+ resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.13.0.tgz#9efdf352bd54873955cd161bd4b75f24a8c59dde"
dependencies:
"@types/fs-extra" "^5.0.3"
"@types/handlebars" "^4.0.38"
@@ -14856,7 +14868,7 @@ typedoc@0.12.0:
progress "^2.0.0"
shelljs "^0.8.2"
typedoc-default-themes "^0.5.0"
- typescript "3.0.x"
+ typescript "3.1.x"
types-bn@^0.0.1:
version "0.0.1"
@@ -14864,10 +14876,14 @@ types-bn@^0.0.1:
dependencies:
bn.js "4.11.7"
-typescript@3.0.1, typescript@3.0.x:
+typescript@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
+typescript@3.1.x:
+ version "3.1.3"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.3.tgz#01b70247a6d3c2467f70c45795ef5ea18ce191d5"
+
typewise-core@^1.2, typewise-core@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/typewise-core/-/typewise-core-1.2.0.tgz#97eb91805c7f55d2f941748fa50d315d991ef195"