diff options
Diffstat (limited to 'packages')
52 files changed, 286 insertions, 90 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 9fd14b1f9..e43451ad9 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -15,14 +15,16 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", - "prebuild": "run-s clean generate_contract_wrappers", - "build": "run-p build:umd:prod build:commonjs; exit 0;", - "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && yarn build:all && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build:all": "run-p build:umd:prod build:commonjs; exit 0;", + "pre_build": "run-s generate_contract_wrappers copy_artifacts", + "copy_artifacts": "copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts", + "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project .", "test:circleci": "run-s test:coverage", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "clean": "shx rm -rf _bundles lib test_temp scripts src/contract_wrappers/generated", @@ -89,7 +91,6 @@ "npm-run-all": "^4.1.2", "nyc": "^11.0.1", "opn-cli": "^3.1.0", - "prettier": "^1.11.1", "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", diff --git a/packages/abi-gen/README.md b/packages/abi-gen/README.md index c5dd7f0f5..b6dd37cd1 100644 --- a/packages/abi-gen/README.md +++ b/packages/abi-gen/README.md @@ -4,8 +4,7 @@ This package allows you to generate TypeScript contract wrappers from ABI files. It's heavily inspired by [Geth abigen](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) but takes a different approach. You can write your custom handlebars templates which will allow you to seamlessly integrate the generated code into your existing codebase with existing conventions. -For an example of the generated [wrapper files](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/src/contract_wrappers/generated) check out 0x.js. -[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates) are the templates used to generate those files. +[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate the contract wrappers used by 0x.js.e ## Installation diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index e02b930ed..19977fc86 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -8,7 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "lint": "tslint --project .", "clean": "shx rm -rf lib scripts", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index a46209dad..66390174c 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -56,7 +56,7 @@ export const utils = { const componentType = `${component.name}: ${componentValueType}`; return componentType; }); - const tsType = `{${componentsType}}`; + const tsType = `{${componentsType.join(';')}}`; return tsType; } throw new Error(`Unknown Solidity type found: ${solType}`); diff --git a/packages/assert/package.json b/packages/assert/package.json index bec4a9137..9e4fcbbf0 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -8,14 +8,14 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib test_temp scripts", "lint": "tslint --project .", "run_mocha": "mocha lib/test/**/*_test.js --exit", "prepublishOnly": "run-p build", "test": "yarn run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 62e37d80b..d51362040 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -8,11 +8,11 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "test": "yarn run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", diff --git a/packages/connect/package.json b/packages/connect/package.json index fa91bf632..5079467e4 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -15,14 +15,14 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib test_temp scripts", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project .", "run_mocha": "mocha lib/test/**/*_test.js --exit", "test": "run-s copy_test_fixtures run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 1cef3d8cf..d49536b6f 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -11,18 +11,19 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", - "prebuild": "run-s clean generate_contract_wrappers", - "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "pre_build": "run-s generate_contract_wrappers update_test_artifacts update_compact_artifacts", + "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project .", "test:circleci": "run-s test:coverage", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/1.0.0/$i.json test/artifacts; done;", + "update_compact_artifacts": "copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts", + "update_test_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/1.0.0/$i.json test/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/contract_wrappers/generated", - "build": "tsc && yarn update_artifacts && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, @@ -68,7 +69,6 @@ "npm-run-all": "^4.1.2", "nyc": "^11.0.1", "opn-cli": "^3.1.0", - "prettier": "^1.11.1", "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 9a463d635..384f032c2 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -158,7 +158,7 @@ export interface MethodOpts { /** * gasPrice: Gas price in Wei to use for a transaction - * gasLimit: The amount of gas to send with a transaction + * gasLimit: The amount of gas to send with a transaction (in Gwei) */ export interface TransactionOpts { gasPrice?: BigNumber; diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 5fb19af11..75654b069 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -2,7 +2,7 @@ * This file is auto-generated using abi-gen. Don't edit directly. * Templates can be found at https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates. */ -// tslint:disable:no-consecutive-blank-lines ordered-imports +// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace // tslint:disable-next-line:no-unused-variable import { BaseContract } from '@0xproject/base-contract'; import { ContractArtifact } from '@0xproject/sol-compiler'; @@ -83,7 +83,7 @@ export class {{contractName}}Contract extends BaseContract { return contractInstance; } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super("{{contractName}}", abi, address, provider, txDefaults); + super('{{contractName}}', abi, address, provider, txDefaults); classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); } } // tslint:disable:max-file-line-count diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 99fda80e1..5d14b1823 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -18,7 +18,7 @@ async callAsync( data: encodedData, }, self._web3Wrapper.getContractDefaults(), - ) + ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); let resultArray = ethersFunction.parse(rawCallResult); const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 8e37a7819..fee22953e 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -11,18 +11,18 @@ "test": "test" }, "scripts": { - "watch": "tsc -w", - "prebuild": "run-s clean compile copy_artifacts generate_contract_wrappers", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc", + "pre_build": "run-s compile copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles -u 4 '../migrations/artifacts/2.0.0/**/*' ./lib/src/artifacts;", - "build": "tsc", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile": "sol-compiler", "clean": "shx rm -rf lib src/contract_wrappers/generated", "generate_contract_wrappers": - "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", + "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project .", "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", @@ -61,7 +61,6 @@ "make-promises-safe": "^1.1.0", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", - "prettier": "^1.11.1", "shx": "^0.2.2", "solc": "^0.4.24", "tslint": "5.8.0", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 997340010..e4beacd15 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -8,10 +8,10 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "test": "yarn run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 0c9519994..68755c206 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -8,11 +8,22 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "manual:postpublish": "yarn build; node ./scripts/postpublish.js", + "docs:stage": "node scripts/stage_docs.js", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", + "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + }, + "config": { + "postpublish": { + "docPublishConfigs": { + "s3BucketPath": "s3://doc-jsons/ethereum-types/", + "s3StagingBucketPath": "s3://staging-doc-jsons/ethereum-types/" + } + } }, "license": "Apache-2.0", "repository": { diff --git a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts new file mode 100644 index 000000000..e732ac8eb --- /dev/null +++ b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 8931958e9..99b39ecc6 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -5,11 +5,11 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "yarn update_contract_wrappers && tsc -w", - "build": "yarn update_contract_wrappers && tsc", - "update_contract_wrappers": "run-s clean update_artifacts generate_contract_wrappers", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc", + "pre_build": "run-s update_artifacts generate_contract_wrappers", "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json lib/artifacts; done;", - "generate_contract_wrappers": "abi-gen --abis 'lib/artifacts/@(Exchange|ERC20Token|DummyERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers && prettier --write 'src/generated_contract_wrappers/**.ts'", + "generate_contract_wrappers": "abi-gen --abis 'lib/artifacts/@(Exchange|ERC20Token|DummyERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "copy_monorepo_scripts": "copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts src/generated_contract_wrappers", "lint": "tslint --project .", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 75d01a1e9..cb4b998f4 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -8,10 +8,10 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "lint": "tslint --project .", "test": "yarn run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 19582327a..3d46d4f9f 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -7,17 +7,17 @@ "private": true, "description": "Example solidity project using 0x dev tools", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc", + "pre_build": "run-s compile generate_contract_wrappers copy_artifacts", "lint": "tslint --project .", "clean": "shx rm -rf lib artifacts src/contract_wrappers", - "prebuild": "run-s clean compile generate_contract_wrappers copy_artifacts", "copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib", - "build": "tsc", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --bail --exit", - "generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers && prettier --write 'src/contract_wrappers/**.ts'", + "generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers", "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", "coverage:report:lcov": "istanbul report lcov", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index cad64f5ca..cc765a772 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -8,10 +8,10 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", - "prebuild": "run-s clean copy_artifacts generate_contract_wrappers", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc", + "pre_build": "run-s copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles 'artifacts/**/*' ./lib", - "build": "tsc", "clean": "shx rm -rf lib src/contract_wrappers", "lint": "tslint --project .", "migrate:v1": "run-s build compile:v1 script:migrate:v1", @@ -20,9 +20,9 @@ "script:migrate:v2": "node ./lib/migrate.js --contracts-version 2.0.0", "generate_contract_wrappers": "run-p generate_contract_wrappers:*", "generate_contract_wrappers:v1": - "abi-gen --abis ${npm_package_config_abis_v1} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/v1/contract_wrappers --backend ethers && prettier --write 'src/v1/contract_wrappers/**.ts'", + "abi-gen --abis ${npm_package_config_abis_v1} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/v1/contract_wrappers --backend ethers", "generate_contract_wrappers:v2": - "abi-gen --abis ${npm_package_config_abis_v2} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/v2/contract_wrappers --backend ethers && prettier --write 'src/v2/contract_wrappers/**.ts'", + "abi-gen --abis ${npm_package_config_abis_v2} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/v2/contract_wrappers --backend ethers", "compile:v1": "sol-compiler --artifacts-dir artifacts/1.0.0 --contracts Exchange_v1,DummyERC20Token,ZRXToken,WETH9,TokenTransferProxy_v1,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,TokenRegistry", "compile:v2": "sol-compiler --artifacts-dir artifacts/2.0.0 --contracts ERC20Token,DummyERC20Token,ERC721Token,DummyERC721Token,ERC20Proxy,ERC721Proxy,Exchange,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,ZRXToken,WETH9,IWallet,IValidator" }, diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 2bbf4df11..5a6d7b25a 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -8,10 +8,10 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", + "build": "tsc", "lint": "tslint --project .", "clean": "shx rm -rf lib", - "build": "tsc", "test:publish": "run-s build script:publish", "find_unused_deps": "run-s build script:find_unused_deps", "remove_tags": "run-s build script:remove_tags", diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 5a04c58f7..661fbab4f 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -8,14 +8,15 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", - "build": "run-s clean update_artifacts generate_contract_wrappers transpile copy_monorepo_scripts", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "run-s pre_build transpile copy_monorepo_scripts", + "pre_build": "run-s update_artifacts generate_contract_wrappers", "transpile": "tsc", "copy_monorepo_scripts": "copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "generate_contract_wrappers": "abi-gen --abis 'lib/src/artifacts/@(Exchange|IWallet|IValidator).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers && prettier --write 'src/generated_contract_wrappers/**.ts'", + "generate_contract_wrappers": "abi-gen --abis 'lib/src/artifacts/@(Exchange|IWallet|IValidator).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json lib/src/artifacts; done;", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 44954165d..50afb8f9d 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -12,18 +12,19 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", - "prebuild": "run-s clean generate_contract_wrappers", - "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers && prettier --write 'src/generated_contract_wrappers/**.ts'", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "pre_build": "run-s update_test_artifacts update_compact_artifacts generate_contract_wrappers", + "generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "lint": "tslint --project .", "test:circleci": "run-s test:coverage", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/1.0.0/$i.json test/artifacts; done;", + "update_compact_artifacts": "copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts", + "update_test_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/1.0.0/$i.json test/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/generated_contract_wrappers", - "build": "tsc && yarn update_artifacts && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "run_mocha": "mocha lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, @@ -69,7 +70,6 @@ "npm-run-all": "^4.1.2", "nyc": "^11.0.1", "opn-cli": "^3.1.0", - "prettier": "^1.11.1", "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index a0538b933..76e780c44 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -10,7 +10,7 @@ "lint": "tslint --project .", "build": "tsc", "build:example": "NODE_ENV=production webpack", - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib; shx rm -f public/bundle*", "dev": "webpack-dev-server --open", "deploy_example": "npm run build:example; aws s3 sync ./public/. s3://react-docs-example --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers" diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 3d9ef08e8..5e8492d25 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -10,7 +10,7 @@ "scripts": { "lint": "tslint --project .", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index eb964a0f4..d6f748580 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -10,7 +10,7 @@ "scripts": { "lint": "tslint --project .", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 8d26179b5..0bd51972d 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -8,10 +8,12 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", - "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "pre_build": "run-s update_contract_fixtures", + "update_contract_fixtures": "copyfiles 'test/fixtures/contracts/**/*' ./lib", "test": "yarn run_mocha", - "rebuild-and-test": "run-s build test", + "rebuild_and_test": "run-s build test", "run_mocha": "mocha lib/test/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index d10d277b9..616b30912 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -8,16 +8,18 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "yarn pre_build && tsc -w", + "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "pre_build": "run-s copy_test_fixtures", "lint": "tslint --project .", "test": "run-s compile_test run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib scripts test/fixtures/artifacts src/artifacts", - "build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "copy_test_fixtures": "copyfiles 'test/fixtures/**/*' ./lib", "compile_test": "sol-compiler compile", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index 64a0f19ab..6c2ed8f8b 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -8,8 +8,8 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", - "build": "yarn clean && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "watch_without_deps": "tsc -w", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 27bf715a8..d2cc7f32a 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -8,12 +8,12 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "lint": "tslint --project .", "test": "run-s copy_test_environments copy_test_fixtures run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "copy_test_environments": "copyfiles -u 2 './test/environments/**/*.json' ./lib/test/environments", "run_mocha": "mocha lib/test/**/*_test.js --exit", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 3a28e5e8d..743bd6669 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -8,9 +8,9 @@ "types": "lib/src/index.d.ts", "license": "Apache-2.0", "scripts": { - "watch": "tsc -w", - "clean": "shx rm -rf lib scripts", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", "run_mocha_unit": "mocha lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", "run_mocha_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 06f8d3e84..2d1252596 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -8,7 +8,7 @@ "description": "A faucet micro-service that dispenses test ERC20 tokens or Ether", "main": "server.js", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "node ../../node_modules/gulp/bin/gulp.js build", "dev": "node ../../node_modules/gulp/bin/gulp.js run", "start": "node ./server/server.js", diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index a64feb836..452ac48a4 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -7,7 +7,7 @@ "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json index 77a1f41cc..ec414fb71 100644 --- a/packages/tslint-config/tslint.json +++ b/packages/tslint-config/tslint.json @@ -7,6 +7,7 @@ "async-suffix": true, "boolean-naming": true, "no-switch-case-fall-through": true, + "switch-default": true, "await-promise": true, "custom-no-magic-numbers": [true, 0, 1, 2, 3, -1], "binary-expression-operand-order": true, diff --git a/packages/types/package.json b/packages/types/package.json index 95b7721d3..fd2073db3 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -8,7 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 4bae1f437..0dde47c97 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -6,7 +6,7 @@ }, "description": "0x project typescript type definitions", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts", "clean": "shx rm -rf scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" diff --git a/packages/utils/package.json b/packages/utils/package.json index 89daadbec..3828fa9ee 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -8,7 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 01f0f3a26..694f07e45 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -8,12 +8,12 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", "test": "yarn run_mocha", - "rebuild-and-test": "run-s clean build test", + "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", diff --git a/packages/website/md/docs/ethereum_types/installation.md b/packages/website/md/docs/ethereum_types/installation.md new file mode 100644 index 000000000..5371cfa47 --- /dev/null +++ b/packages/website/md/docs/ethereum_types/installation.md @@ -0,0 +1,11 @@ +**Install** + +```bash +yarn add ethereum-types +``` + +**Import** + +```typescript +import { Provider } from 'ethereum-types'; +``` diff --git a/packages/website/md/docs/ethereum_types/introduction.md b/packages/website/md/docs/ethereum_types/introduction.md new file mode 100644 index 000000000..43484cdd1 --- /dev/null +++ b/packages/website/md/docs/ethereum_types/introduction.md @@ -0,0 +1 @@ +Welcome to the [ethereum-types](https://github.com/0xProject/0x-monorepo/packages/ethereum-types) documentation! This package provides ethereum specific (but not library-specific) types that are meant to be shared between other ethereum packages. diff --git a/packages/website/package.json b/packages/website/package.json index 54780f600..5287414c7 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -10,7 +10,7 @@ "build": "NODE_ENV=production webpack; exit 0;", "clean": "shx rm -f public/bundle*", "lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'", - "watch": "webpack-dev-server --content-base public --https", + "watch_without_deps": "webpack-dev-server --content-base public --https", "deploy_dogfood": "npm run build; aws s3 sync ./public/. s3://dogfood.0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers", "deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers", "deploy_live": "npm run build; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers" diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index 966457a93..3e9f21370 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "博客", "FORUM": "论坛", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index f3acea3be..04fb0507a 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -60,6 +60,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "blog", "FORUM": "forum", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index 7414207f7..c38de6677 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "블로그", "FORUM": "포럼", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index 75ab02a27..a7e06d646 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "Блог", "FORUM": "Форум", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index 8f537ea40..5a8920f61 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -60,6 +60,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "blog", "FORUM": "foro", diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 606fd845a..81ab2c06c 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -165,6 +165,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { primaryText={this.props.translate.get(Key.SolCov, Deco.CapWords)} /> </Link>, + <Link key="subMenuItem-ethereum-types" to={WebsitePaths.EthereumTypes} className="text-decoration-none"> + <MenuItem + style={{ fontSize: styles.menuItem.fontSize }} + primaryText={this.props.translate.get(Key.EthereumTypes, Deco.CapWords)} + /> + </Link>, <a key="subMenuItem-whitePaper" target="_blank" @@ -379,6 +385,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { </MenuItem> </Link> )} + {!this._isViewingEthereumTypesDocs() && ( + <Link to={WebsitePaths.EthereumTypes} className="text-decoration-none"> + <MenuItem className="py2"> + {this.props.translate.get(Key.EthereumTypes, Deco.Cap)}{' '} + {this.props.translate.get(Key.Docs, Deco.Cap)} + </MenuItem> + </Link> + )} {!this._isViewingPortal() && ( <Link to={`${WebsitePaths.Portal}`} className="text-decoration-none"> <MenuItem className="py2"> @@ -507,6 +521,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { private _isViewingSubprovidersDocs(): boolean { return _.includes(this.props.location.pathname, WebsitePaths.Subproviders); } + private _isViewingEthereumTypesDocs(): boolean { + return _.includes(this.props.location.pathname, WebsitePaths.EthereumTypes); + } private _isViewingWiki(): boolean { return _.includes(this.props.location.pathname, WebsitePaths.Wiki); } diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts new file mode 100644 index 000000000..28d3d92dc --- /dev/null +++ b/packages/website/ts/containers/ethereum_types_documentation.ts @@ -0,0 +1,124 @@ +import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import * as _ from 'lodash'; +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, Environments, WebsitePaths } from 'ts/types'; +import { configs } from 'ts/utils/configs'; +import { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; + +/* tslint:disable:no-var-requires */ +const IntroMarkdown = require('md/docs/ethereum_types/introduction'); +const InstallationMarkdown = require('md/docs/ethereum_types/installation'); +/* tslint:enable:no-var-requires */ + +const docSections = { + introduction: 'introduction', + installation: 'installation', + types: docConstants.TYPES_SECTION_NAME, +}; + +const docsInfoConfig: DocsInfoConfig = { + id: DocPackages.EthereumTypes, + type: SupportedDocJson.TypeDoc, + displayName: 'Ethereum Types', + packageUrl: 'https://github.com/0xProject/0x-monorepo/packages/ethereum-types', + menu: { + introduction: [docSections.introduction], + install: [docSections.installation], + types: [docSections.types], + }, + sectionNameToMarkdown: { + [docSections.introduction]: IntroMarkdown, + [docSections.installation]: InstallationMarkdown, + }, + sectionNameToModulePath: { + [docSections.types]: ['"index"'], + }, + visibleConstructors: [], + menuSubsectionToVersionWhenIntroduced: {}, + sections: docSections, + typeConfigs: { + // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is + // currently no way to extract the re-exported types from index.ts via TypeDoc :( + publicTypes: [ + 'Provider', + 'JSONRPCErrorCallback', + 'Provider', + 'ContractAbi', + 'AbiDefinition', + 'FunctionAbi', + 'ConstructorStateMutability', + 'StateMutability', + 'MethodAbi', + 'ConstructorAbi', + 'FallbackAbi', + 'EventParameter', + 'EventAbi', + 'DataItem', + 'OpCode', + // 'StructLog', // TODO: This type breaks the docs so we don't render it for now + 'TransactionTrace', + 'Unit', + 'JSONRPCRequestPayload', + 'JSONRPCResponsePayload', + 'BlockWithoutTransactionData', + 'BlockWithTransactionData', + 'Transaction', + 'TxData', + 'CallData', + 'FilterObject', + 'LogTopic', + 'DecodedLogEntry', + 'DecodedLogEntryEvent', + 'LogEntryEvent', + 'LogEntry', + 'TxDataPayable', + 'TransactionReceipt', + 'AbiType', + 'ContractEventArg', + 'DecodedLogArgs', + 'LogWithDecodedArgs', + 'RawLog', + 'BlockParamLiteral', + 'BlockParam', + 'RawLogEntry', + 'SolidityTypes', + 'TransactionReceiptWithDecodedLogs', + ], + typeNameToExternalLink: { + BigNumber: constants.URL_BIGNUMBERJS_GITHUB, + }, + }, +}; +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 a6bfe7dd2..719604c02 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -69,6 +69,9 @@ const LazySubprovidersDocumentation = createLazyComponent('Documentation', async const LazyOrderUtilsDocumentation = createLazyComponent('Documentation', async () => System.import<any>(/* webpackChunkName: "orderUtilsDocs" */ 'ts/containers/order_utils_documentation'), ); +const LazyEthereumTypesDocumentation = createLazyComponent('Documentation', async () => + System.import<any>(/* webpackChunkName: "ethereumTypesDocs" */ 'ts/containers/ethereum_types_documentation'), +); analytics.init(); // tslint:disable-next-line:no-floating-promises @@ -116,6 +119,10 @@ render( path={`${WebsitePaths.SmartContracts}/:version?`} component={LazySmartContractsDocumentation} /> + <Route + path={`${WebsitePaths.EthereumTypes}/:version?`} + component={LazyEthereumTypesDocumentation} + /> {/* Legacy endpoints */} <Route diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 17efc56ed..c25577628 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -35,6 +35,7 @@ const docIdToSubpackageName: { [id: string]: string } = { [DocPackages.SolCov]: 'sol-cov', [DocPackages.Subproviders]: 'subproviders', [DocPackages.OrderUtils]: 'order-utils', + [DocPackages.EthereumTypes]: 'ethereum-types', }; export interface DocPageProps { diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index f3428d475..ed6ec4ec6 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -342,6 +342,9 @@ export class Landing extends React.Component<LandingProps, LandingState> { case ScreenWidths.Lg: colWidth = isRelayersOnly ? 2 : 2 - i % 2; break; + + default: + throw new Error(`Encountered unknown ScreenWidths value: ${this.state.screenWidth}`); } return ( <div key={`project-${project.logoFileName}`} className={`col col-${colWidth} center`}> diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 9567e129b..6bc928048 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -370,6 +370,7 @@ export enum WebsitePaths { SolCov = '/docs/sol-cov', Subproviders = '/docs/subproviders', OrderUtils = '/docs/order-utils', + EthereumTypes = '/docs/ethereum-types', Jobs = '/jobs', } @@ -383,6 +384,7 @@ export enum DocPackages { SolCov = 'SOL_COV', Subproviders = 'SUBPROVIDERS', OrderUtils = 'ORDER_UTILS', + EthereumTypes = 'ETHEREUM_TYPES', } export enum Key { @@ -434,6 +436,7 @@ export enum Key { SolCompiler = 'SOL_COMPILER', JsonSchemas = 'JSON_SCHEMAS', SolCov = 'SOL_COV', + EthereumTypes = 'ETHEREUM_TYPES', Subproviders = 'SUBPROVIDERS', Blog = 'BLOG', Forum = 'FORUM', diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts index 2a599bcbe..4db7235da 100644 --- a/packages/website/ts/utils/doc_utils.ts +++ b/packages/website/ts/utils/doc_utils.ts @@ -8,7 +8,7 @@ import convert = require('xml-js'); export const docUtils = { async getVersionToFilePathAsync(s3DocJsonRoot: string, folderName: string): Promise<VersionToFilePath> { - const versionFilePaths = await this.getVersionFileNamesAsync(s3DocJsonRoot, folderName); + const versionFilePaths = await docUtils.getVersionFileNamesAsync(s3DocJsonRoot, folderName); const versionToFilePath: VersionToFilePath = {}; _.each(versionFilePaths, filePath => { const [version] = findVersions(filePath); |