aboutsummaryrefslogtreecommitdiffstats
path: root/autogen.sh
Commit message (Expand)AuthorAgeFilesLines
* First big sync of my GNOME 2 porting work (incomplete, and stillEttore Perazzoli2002-11-021-2/+16
* new class. Will handle all sort of information media (Mime mail messages,bertrand1999-08-251-1/+1
* groomf -> gnome-mailerbertrand1999-04-181-1/+1
* Initial revisionBertrand Guiheneuf1999-04-181-0/+10
ackages/order-utils/src/monorepo_scripts/stage_docs.ts delete mode 100644 packages/order-watcher/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/react-docs/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/react-shared/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/sol-compiler/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/sol-compiler/src/monorepo_scripts/stage_docs.ts delete mode 100644 packages/sol-cov/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/sol-cov/src/monorepo_scripts/stage_docs.ts delete mode 100644 packages/sol-resolver/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/sra-report/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/subproviders/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/subproviders/src/monorepo_scripts/stage_docs.ts delete mode 100644 packages/tslint-config/monorepo_scripts/globals.d.ts delete mode 100644 packages/tslint-config/monorepo_scripts/postpublish.ts delete mode 100644 packages/types/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/typescript-typings/monorepo_scripts/globals.d.ts delete mode 100644 packages/typescript-typings/monorepo_scripts/postpublish.ts delete mode 100644 packages/utils/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/web3-wrapper/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/web3-wrapper/src/monorepo_scripts/stage_docs.ts diff --git a/package.json b/package.json index 438fe5b68..5f50e58b6 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "rebuild": "run-s clean build", "rebuild:no_website": "run-s clean build:no_website", "test": "wsrun test $PKG --fast-exit --serial --exclude-missing", - "stage_docs": "wsrun docs:stage $PKG --fast-exit --parallel --exclude-missing", + "generate_docs": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js", "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete." }, diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 3b92752e1..16040cf26 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -16,7 +16,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && yarn build:all && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && yarn build:all", "build:all": "run-p build:umd:prod build:commonjs; exit 0;", "pre_build": "run-s update_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", @@ -28,14 +28,11 @@ "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/generated_contract_wrappers", + "clean": "shx rm -rf _bundles lib test_temp src/generated_contract_wrappers", "build:umd:prod": "NODE_ENV=production webpack", "build:commonjs": "tsc && yarn copy_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts": "ZRXToken", @@ -44,22 +41,7 @@ "packages/0x.js/_bundles/index.js", "packages/0x.js/_bundles/index.min.js" ], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts", - "../contract-wrappers/src/types.ts", - "../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts", - "../contract-wrappers/src/contract_wrappers/exchange_wrapper.ts", - "../contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts", - "../contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts", - "../contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts", - "../contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts", - "../order-watcher/src/order_watcher/order_watcher.ts" - ], - "s3BucketPath": "s3://doc-jsons/0x.js/", - "s3StagingBucketPath": "s3://staging-doc-jsons/0x.js/" - } + "shouldPublishDocs": true } }, "repository": { @@ -71,7 +53,6 @@ "@0xproject/abi-gen": "^1.0.4", "@0xproject/dev-utils": "^1.0.3", "@0xproject/migrations": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/0x.js/src/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/0x.js/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/0x.js/src/monorepo_scripts/stage_docs.ts b/packages/0x.js/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/0x.js/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/abi-gen/package.json b/packages/abi-gen/package.json index 2732cdb64..99234204c 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -10,14 +10,13 @@ "scripts": { "watch_without_deps": "tsc -w", "lint": "tslint --project .", - "clean": "shx rm -rf lib scripts", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib", + "build": "tsc", "test": "yarn run_mocha", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit", "test:circleci": "yarn test:coverage", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", - "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info" }, "bin": { "abi-gen": "bin/abi-gen.js" @@ -46,7 +45,6 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/glob": "5.0.35", "@types/handlebars": "^4.0.36", diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/abi-gen/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/assert/package.json b/packages/assert/package.json index 27fd51923..a54ca9651 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -9,16 +9,15 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib test_temp scripts", + "build": "tsc", + "clean": "shx rm -rf lib test_temp", "lint": "tslint --project .", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "test": "yarn run_mocha", "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", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "test:circleci": "yarn test:coverage" }, "license": "Apache-2.0", "repository": { @@ -30,7 +29,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/assert/src/monorepo_scripts/postpublish.ts b/packages/assert/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/assert/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 7ac629bbf..74a83664f 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -9,16 +9,15 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib scripts", + "build": "tsc", + "clean": "shx rm -rf lib", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "lint": "tslint --project . --exclude **/src/contract_wrappers/**/*", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "lint": "tslint --project . --exclude **/src/contract_wrappers/**/*" }, "license": "Apache-2.0", "repository": { @@ -30,7 +29,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "chai": "^4.0.1", diff --git a/packages/base-contract/src/monorepo_scripts/postpublish.ts b/packages/base-contract/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/base-contract/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/connect/package.json b/packages/connect/package.json index 57bd27c5e..423fada00 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -16,8 +16,8 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib test_temp scripts", + "build": "tsc", + "clean": "shx rm -rf lib test_temp", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project .", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", @@ -26,18 +26,12 @@ "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", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { "assets": [], - "docPublishConfigs": { - "s3BucketPath": "s3://doc-jsons/connect/", - "s3StagingBucketPath": "s3://staging-doc-jsons/connect/" - } + "shouldPublishDocs": true } }, "repository": { @@ -62,7 +56,6 @@ "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/fetch-mock": "^5.12.2", "@types/lodash": "4.14.104", @@ -82,7 +75,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "~0.8.0", + "typedoc": "0xProject/typedoc", "typescript": "2.7.1" }, "publishConfig": { diff --git a/packages/connect/src/monorepo_scripts/postpublish.ts b/packages/connect/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/connect/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/connect/src/monorepo_scripts/stage_docs.ts b/packages/connect/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/connect/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/contract-wrappers/package.json b/packages/contract-wrappers/package.json index ed0278caa..d21dfe505 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -12,7 +12,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && tsc", "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 generate_contract_wrappers copy_artifacts", "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*", @@ -24,9 +24,8 @@ "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", - "clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/contract_wrappers/generated src/artifacts", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit" }, "config": { "contracts_v2_beta": "Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken", @@ -44,7 +43,6 @@ "@0xproject/abi-gen": "^1.0.4", "@0xproject/dev-utils": "^1.0.3", "@0xproject/migrations": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/sol-compiler": "^1.0.4", "@0xproject/subproviders": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", diff --git a/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts b/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/contract-wrappers/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 2c7c53194..24d5c4c05 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -9,16 +9,15 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "tsc", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib scripts", - "lint": "tslint --project .", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib", + "lint": "tslint --project ." }, "license": "Apache-2.0", "repository": { @@ -30,7 +29,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/dev-utils/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 7ed99d419..a09c66085 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -9,20 +9,15 @@ "types": "lib/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib scripts", + "build": "tsc", + "clean": "shx rm -rf lib", "lint": "tslint --project .", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { - "docPublishConfigs": { - "s3BucketPath": "s3://doc-jsons/ethereum-types/", - "s3StagingBucketPath": "s3://staging-doc-jsons/ethereum-types/" - } + "assets": [], + "shouldPublishDocs": true } }, "license": "Apache-2.0", @@ -35,7 +30,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/ethereum-types/src/monorepo_scripts/postpublish.ts b/packages/ethereum-types/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/ethereum-types/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 281575107..5cf221b2e 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -6,14 +6,13 @@ "types": "lib/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "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|DummyERC20Token|DummyERC721Token).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 . --exclude **/src/generated_contract_wrappers/**/*", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib src/generated_contract_wrappers", + "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*" }, "config": { "contracts": "Exchange DummyERC20Token DummyERC721Token" @@ -29,7 +28,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { "@0xproject/abi-gen": "^1.0.4", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/sol-compiler": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", diff --git a/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts b/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/fill-scenarios/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 4793fc0d5..72db8c649 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -16,24 +16,14 @@ "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 scripts", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "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" + "clean": "shx rm -rf lib test_temp", + "build": "tsc", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/json-schemas/", - "s3StagingBucketPath": "s3://staging-doc-jsons/json-schemas/" - } + "shouldPublishDocs": true } }, "repository": { @@ -53,7 +43,6 @@ "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@0xproject/utils": "^1.0.4", "@types/lodash.foreach": "^4.5.3", diff --git a/packages/json-schemas/src/monorepo_scripts/postpublish.ts b/packages/json-schemas/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/json-schemas/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/json-schemas/src/monorepo_scripts/stage_docs.ts b/packages/json-schemas/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/json-schemas/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/migrations/package.json b/packages/migrations/package.json index 0a1186f6a..02111d22d 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -9,8 +9,7 @@ "types": "lib/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js", + "build": "yarn pre_build && tsc", "pre_build": "run-s copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles 'artifacts/**/*' ./lib", "clean": "shx rm -rf lib src/contract_wrappers", @@ -40,7 +39,6 @@ "devDependencies": { "@0xproject/abi-gen": "^1.0.4", "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@0xproject/types": "^1.0.1-rc.3", "@types/yargs": "^10.0.0", diff --git a/packages/migrations/src/monorepo_scripts/postpublish.ts b/packages/migrations/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/migrations/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 128bdcff5..24f1607c0 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -17,7 +17,8 @@ "script:deps_versions": "node ./lib/deps_versions.js", "script:prepublish_checks": "node ./lib/prepublish_checks.js", "script:publish": "IS_DRY_RUN=true node ./lib/publish.js", - "script:find_unused_deps": "node ./lib/find_unused_dependencies.js" + "script:find_unused_deps": "node ./lib/find_unused_dependencies.js", + "script:doc_generate_and_upload": "node ./lib/doc_generate_and_upload.js" }, "repository": { "type": "git", @@ -38,8 +39,7 @@ "make-promises-safe": "^1.1.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", - "tslint": "5.11.0", - "typescript": "2.7.1" + "tslint": "5.11.0" }, "dependencies": { "@lerna/batch-packages": "^3.0.0-beta.18", @@ -58,7 +58,9 @@ "rimraf": "^2.6.2", "semver": "5.5.0", "semver-diff": "^2.1.0", - "semver-sort": "0.0.4" + "semver-sort": "0.0.4", + "typedoc": "0xProject/typedoc", + "typescript": "2.7.1" }, "publishConfig": { "access": "public" diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts new file mode 100644 index 000000000..b6a4801e3 --- /dev/null +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -0,0 +1,215 @@ +import { readFileSync, writeFileSync } from 'fs'; +import * as _ from 'lodash'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import * as ts from 'typescript'; +import * as yargs from 'yargs'; + +import { constants } from './constants'; +import { utils } from './utils/utils'; + +export interface ExportPathToExportedItems { + [pkgName: string]: string[]; +} + +const args = yargs + .option('package', { + describe: 'Monorepo sub-package for which to generate DocJSON', + type: 'string', + demandOption: true, + }) + .option('isStaging', { + describe: 'Whether we with to publish docs to staging or production', + type: 'boolean', + demandOption: true, + }) + .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; + +(async () => { + const packageName = args.package; + const isStaging = args.isStaging; + + await generateAndUploadDocsAsync(packageName, isStaging); +})(); + +export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { + const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; + const indexPath = `${pathToPackage}/src/index.ts`; + const exportPathToExportedItems = getExportPathToExportedItems(indexPath); + + const monorepoPackages = utils.getPackages(constants.monorepoRootPath); + const pkg = _.find(monorepoPackages, monorepoPackage => { + return _.includes(monorepoPackage.packageJson.name, packageName); + }); + if (_.isUndefined(pkg)) { + throw new Error(`Couldn't find a package.json for ${packageName}`); + } + + const packageJson = pkg.packageJson; + const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); + if (!shouldPublishDocs) { + utils.log( + `GENERATE_UPLOAD_DOCS: ${ + packageJson.name + } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, + ); + return; + } + + const pkgNameToPath: { [name: string]: string } = {}; + _.each(monorepoPackages, pkg => { + pkgNameToPath[pkg.packageJson.name] = pkg.location; + }); + + // For each dep that is another one of our monorepo packages, we fetch it's index.ts + // and see which specific files we must pass to TypeDoc. + let typeDocExtraFileIncludes: string[] = []; + _.each(exportPathToExportedItems, (exportedItems, exportPath) => { + const isInternalToPkg = _.startsWith(exportPath, '.'); + if (isInternalToPkg) { + const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); + typeDocExtraFileIncludes.push(pathToInternalPkg); + } + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + const typeDocSourceIncludes = new Set(); + const pathToIndex = `${pathIfExists}/src/index.ts`; + const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); + _.each(exportedItems, exportName => { + _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { + if (!_.startsWith(innerExportPath, './')) { + // noop. Not an internal export... but rather an external one. Should we follow it? + return; + } + if (_.includes(innerExportItems, exportName)) { + const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); + typeDocSourceIncludes.add(absoluteSrcPath); + } + }); + }); + // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types + // directly, meaning no internal paths will exist to follow. This, we add the index file. + // TODO: Maybe we should add the index for all packages? + if (typeDocSourceIncludes.size === 0) { + typeDocSourceIncludes.add(pathToIndex); + } + typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; + }); + + // Generate Typedoc JSON file + const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); + const projectFiles = typeDocExtraFileIncludes.join(' '); + const cwd = path.join(constants.monorepoRootPath, 'packages/0x.js/'); + // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the + // packages root dir, does not work. It only works when called via a `package.json` script located + // in the packages root. + await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + + // For each entry, see if it was exported in index.ts. If not, remove it. + const typedocOutputString = readFileSync(jsonFilePath).toString(); + const typedocOutput = JSON.parse(typedocOutputString); + const finalTypeDocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (file, i) => { + const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); + // Map file "name" to exportPath... HOW?! + _.each(file.children, (child, j) => { + if (!_.includes(exportItems, child.name)) { + delete finalTypeDocOutput.children[i].children[j]; + } + }); + finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); + }); + // Write modified TypeDoc JSON, without all the unexported stuff + writeFileSync(jsonFilePath, JSON.stringify(finalTypeDocOutput, null, 2)); + + const fileName = `v${packageJson.version}.json`; + utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); + const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; + const s3Url = `${S3BucketPath}${fileName}`; + await execAsync( + `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, + { + cwd, + }, + ); + utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); + // Remove the generated docs directory + await execAsync(`rm -rf ${jsonFilePath}`, { + cwd, + }); +} + +function findExportItemsGivenTypedocName( + exportPathToExportedItems: ExportPathToExportedItems, + packageName: string, + typedocName: string, +): string[] { + const typeDocNameWithoutQuotes = _.replace(typedocName, '"', ''); + const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; + const exportPaths = _.keys(exportPathToExportedItems); + const sanitizedExportPaths = _.map(exportPaths, exportPath => { + if (_.startsWith(exportPath, './')) { + const sanitizedExportPath = path.join(packageName, 'src', exportPath); + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + const monorepoPrefix = '@0xproject/'; + if (_.startsWith(exportPath, monorepoPrefix)) { + const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + sanitizedExportPathToExportPath[exportPath] = exportPath; + return exportPath; + }); + const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPaths, p => { + return _.startsWith(typeDocNameWithoutQuotes, p); + }); + if (_.isUndefined(matchingSanitizedExportPathIfExists)) { + throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); + } + const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; + return exportPathToExportedItems[matchingExportPath]; +} + +function getExportPathToExportedItems(pkgPath: string): ExportPathToExportedItems { + const sourceFile = ts.createSourceFile( + 'indexFile', + readFileSync(pkgPath).toString(), + ts.ScriptTarget.ES2017, + /*setParentNodes */ true, + ); + const exportPathToExportedItems = _getExportPathToExportedItems(sourceFile); + return exportPathToExportedItems; +} + +function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedItems { + const exportPathToExportedItems: ExportPathToExportedItems = {}; + processNode(sf); + + function processNode(node: ts.Node): void { + switch (node.kind) { + case ts.SyntaxKind.ExportDeclaration: + // console.log(node); + const exportClause = (node as any).exportClause; + const pkgName = exportClause.parent.moduleSpecifier.text; + _.each(exportClause.elements, element => { + exportPathToExportedItems[pkgName] = _.isUndefined(exportPathToExportedItems[pkgName]) + ? [element.name.escapedText] + : [...exportPathToExportedItems[pkgName], element.name.escapedText]; + }); + break; + + default: + // noop + break; + } + + ts.forEachChild(node, processNode); + } + return exportPathToExportedItems; +} diff --git a/packages/monorepo-scripts/src/index.ts b/packages/monorepo-scripts/src/index.ts index 95c96ebe8..e69de29bb 100644 --- a/packages/monorepo-scripts/src/index.ts +++ b/packages/monorepo-scripts/src/index.ts @@ -1 +0,0 @@ -export { postpublishUtils } from './postpublish_utils'; diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts deleted file mode 100644 index 8e445a045..000000000 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { execAsync } from 'async-child-process'; -import * as promisify from 'es6-promisify'; -import * as fs from 'fs'; -import * as _ from 'lodash'; -import * as path from 'path'; -import * as publishRelease from 'publish-release'; - -import { constants } from './constants'; -import { configs } from './utils/configs'; -import { utils } from './utils/utils'; - -const publishReleaseAsync = promisify(publishRelease); -const generatedDocsDirectoryName = 'generated_docs'; - -export interface PostpublishConfigs { - cwd: string; - packageName: string; - version: string; - assets: string[]; - docPublishConfigs: DocPublishConfigs; -} - -export interface DocPublishConfigs { - fileIncludes: string[]; - s3BucketPath: string; - s3StagingBucketPath: string; -} - -export const postpublishUtils = { - generateConfig(packageJSON: any, tsConfigJSON: any, cwd: string): PostpublishConfigs { - if (_.isUndefined(packageJSON.name)) { - throw new Error('name field required in package.json. Cannot publish release notes to Github.'); - } - if (_.isUndefined(packageJSON.version)) { - throw new Error('version field required in package.json. Cannot publish release notes to Github.'); - } - const postpublishConfig = _.get(packageJSON, 'config.postpublish', {}); - const postpublishConfigs: PostpublishConfigs = { - cwd, - packageName: packageJSON.name, - version: packageJSON.version, - assets: _.get(postpublishConfig, 'assets', []), - docPublishConfigs: { - fileIncludes: [ - ...tsConfigJSON.include, - ..._.get(postpublishConfig, 'docPublishConfigs.extraFileIncludes', []), - ], - s3BucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3BucketPath'), - s3StagingBucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3StagingBucketPath'), - }, - }; - return postpublishConfigs; - }, - async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise { - if (configs.IS_LOCAL_PUBLISH) { - return; - } - const postpublishConfigs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd); - await postpublishUtils.publishReleaseNotesAsync( - postpublishConfigs.packageName, - postpublishConfigs.version, - postpublishConfigs.assets, - ); - if ( - !_.isUndefined(postpublishConfigs.docPublishConfigs.s3BucketPath) || - !_.isUndefined(postpublishConfigs.docPublishConfigs.s3StagingBucketPath) - ) { - utils.log('POSTPUBLISH: Release successful, generating docs...'); - await postpublishUtils.generateAndUploadDocsAsync( - postpublishConfigs.cwd, - postpublishConfigs.docPublishConfigs.fileIncludes, - postpublishConfigs.version, - postpublishConfigs.docPublishConfigs.s3BucketPath, - ); - } else { - utils.log(`POSTPUBLISH: No S3Bucket config found for ${packageJSON.name}. Skipping doc JSON generation.`); - } - }, - async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise { - const postpublishConfigs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd); - if (_.isUndefined(postpublishConfigs.docPublishConfigs.s3StagingBucketPath)) { - utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!'); - return; - } - - utils.log('POSTPUBLISH: Generating docs...'); - await postpublishUtils.generateAndUploadDocsAsync( - postpublishConfigs.cwd, - postpublishConfigs.docPublishConfigs.fileIncludes, - postpublishConfigs.version, - postpublishConfigs.docPublishConfigs.s3StagingBucketPath, - ); - }, - async publishReleaseNotesAsync(packageName: string, version: string, assets: string[]): Promise { - const notes = postpublishUtils.getReleaseNotes(packageName, version); - const releaseName = postpublishUtils.getReleaseName(packageName, version); - const tag = postpublishUtils.getTag(packageName, version); - postpublishUtils.adjustAssetPaths(assets); - utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); - await publishReleaseAsync({ - token: constants.githubPersonalAccessToken, - owner: '0xProject', - repo: '0x-monorepo', - tag, - name: releaseName, - notes, - draft: false, - prerelease: false, - reuseRelease: true, - reuseDraftOnly: false, - assets, - }); - }, - getReleaseNotes(packageName: string, version: string): string { - const packageNameWithNamespace = packageName.replace('@0xproject/', ''); - const changelogJSONPath = path.join( - constants.monorepoRootPath, - 'packages', - packageNameWithNamespace, - 'CHANGELOG.json', - ); - const changelogJSON = fs.readFileSync(changelogJSONPath, 'utf-8'); - const changelogs = JSON.parse(changelogJSON); - const latestLog = changelogs[0]; - // We sanity check that the version for the changelog notes we are about to publish to Github - // correspond to the new version of the package. - if (version !== latestLog.version) { - throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); - } - let notes = ''; - _.each(latestLog.changes, change => { - notes += `* ${change.note}`; - if (change.pr) { - notes += ` (#${change.pr})`; - } - notes += `\n`; - }); - return notes; - }, - getTag(packageName: string, version: string): string { - return `${packageName}@${version}`; - }, - getReleaseName(subPackageName: string, version: string): string { - const releaseName = `${subPackageName} v${version}`; - return releaseName; - }, - // Asset paths should described from the monorepo root. This method prefixes - // the supplied path with the absolute path to the monorepo root. - adjustAssetPaths(assets: string[]): string[] { - const finalAssets: string[] = []; - _.each(assets, (asset: string) => { - finalAssets.push(`${constants.monorepoRootPath}/${asset}`); - }); - return finalAssets; - }, - adjustFileIncludePaths(fileIncludes: string[], cwd: string): string[] { - const fileIncludesAdjusted = _.map(fileIncludes, fileInclude => { - let includePath = _.startsWith(fileInclude, './') - ? `${cwd}/${fileInclude.substr(2)}` - : `${cwd}/${fileInclude}`; - - // HACK: tsconfig.json needs wildcard directory endings as `/**/*` - // but TypeDoc needs it as `/**` in order to pick up files at the root - if (_.endsWith(includePath, '/**/*')) { - // tslint:disable-next-line:custom-no-magic-numbers - includePath = includePath.slice(0, -2); - } - return includePath; - }); - return fileIncludesAdjusted; - }, - async generateAndUploadDocsAsync( - cwd: string, - fileIncludes: string[], - version: string, - S3BucketPath: string, - ): Promise { - const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, cwd); - const projectFiles = fileIncludesAdjusted.join(' '); - const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`; - const result = await execAsync( - `JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, - { - cwd, - }, - ); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const fileName = `v${version}.json`; - utils.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); - const s3Url = S3BucketPath + fileName; - await execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { - cwd, - }); - // Remove the generated docs directory - await execAsync(`rm -rf ${generatedDocsDirectoryName}`, { - cwd, - }); - utils.log(`POSTPUBLISH: Docs uploaded to S3 bucket: ${S3BucketPath}`); - }, -}; diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 5992131db..7444c64b1 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -8,12 +8,16 @@ import { exec as execAsync } from 'promisify-child-process'; import * as prompt from 'prompt'; import semver = require('semver'); import semverSort = require('semver-sort'); +import * as publishRelease from 'publish-release'; + +const publishReleaseAsync = promisify(publishRelease); import { constants } from './constants'; import { Package, PackageToNextVersion, VersionChangelog } from './types'; import { changelogUtils } from './utils/changelog_utils'; import { configs } from './utils/configs'; import { utils } from './utils/utils'; +import { generateAndUploadDocsAsync } from './doc_generate_and_upload'; const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; @@ -70,15 +74,27 @@ const packageNameToWebsitePath: { [name: string]: string } = { }); utils.log(`Calling 'lerna publish'...`); await lernaPublishAsync(packageToNextVersion); + const isStaging = false; + await generateAndUploadDocJsonsAsync(updatedPublicPackages, isStaging); + await publishReleaseNotesAsync(updatedPublicPackages); })().catch(err => { utils.log(err); process.exit(1); }); +async function generateAndUploadDocJsonsAsync(updatedPublicPackages: Package[], isStaging: boolean) { + for (const pkg of updatedPublicPackages) { + const packageName = pkg.packageJson.name; + const nameWithoutPrefix = packageName.replace('@0xproject/', ''); + await generateAndUploadDocsAsync(nameWithoutPrefix, isStaging); + } +} + async function confirmDocPagesRenderAsync(packages: Package[]): Promise { // push docs to staging utils.log("Upload all docJson's to S3 staging..."); - await execAsync(`yarn stage_docs`, { cwd: constants.monorepoRootPath }); + const isStaging = true; + await generateAndUploadDocJsonsAsync(packages, isStaging); // deploy website to staging utils.log('Deploy website to staging...'); @@ -178,6 +194,86 @@ async function updateChangeLogsAsync(updatedPublicPackages: Package[]): Promise< return packageToNextVersion; } +async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { + // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) + const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); + const latestGitCommit = result.stdout; + const shortenedGitCommit = latestGitCommit.slice(0, 7); + const tagName = `monorepo@${shortenedGitCommit}`; + // TODO: We might need to handle the case where the tag already exists locally + await execAsync('git tag ${tagName}'); + await execAsync('git push origin ${tagName}'); + const releaseName = `0x monorepo - ${shortenedGitCommit}`; + + let assets: string[] = []; + let aggregateNotes = ''; + _.each(updatedPublishPackages, pkg => { + const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); + aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; + + const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); + if (!_.isUndefined(packageAssets)) { + assets = [...assets, ...packageAssets]; + } + }); + adjustAssetPaths(assets); + + utils.log('PUBLISH: Releasing ', releaseName, '...'); + // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded + // Ideally we would like to name the assets after the package they are from + // Source: https://github.com/remixz/publish-release/issues/39 + await publishReleaseAsync({ + token: constants.githubPersonalAccessToken, + owner: '0xProject', + tag: tagName, + repo: '0x-monorepo', + name: releaseName, + notes: aggregateNotes, + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets, + }); +} + +// Asset paths should described from the monorepo root. This method prefixes +// the supplied path with the absolute path to the monorepo root. +function adjustAssetPaths(assets: string[]): string[] { + const finalAssets: string[] = []; + _.each(assets, (asset: string) => { + finalAssets.push(`${constants.monorepoRootPath}/${asset}`); + }); + return finalAssets; +} + +function getReleaseNotesForPackage(packageName: string, version: string): string { + const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); + const changelogJSONPath = path.join( + constants.monorepoRootPath, + 'packages', + packageNameWithoutNamespace, + 'CHANGELOG.json', + ); + const changelogJSON = fs.readFileSync(changelogJSONPath, 'utf-8'); + const changelogs = JSON.parse(changelogJSON); + const latestLog = changelogs[0]; + // We sanity check that the version for the changelog notes we are about to publish to Github + // correspond to the new version of the package. + if (version !== latestLog.version) { + throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); + } + let notes = ''; + _.each(latestLog.changes, change => { + notes += `* ${change.note}`; + if (change.pr) { + notes += ` (#${change.pr})`; + } + notes += `\n`; + }); + return notes; +} + async function lernaPublishAsync(packageToNextVersion: { [name: string]: string }): Promise { const packageVersionString = _.map(packageToNextVersion, (nextVersion: string, packageName: string) => { return `${packageName}@${nextVersion}`; diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index cab917a82..21575162c 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -9,10 +9,9 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "run-s pre_build transpile copy_monorepo_scripts", + "build": "run-s pre_build transpile", "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 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|DummyERC20Token|ERC20Proxy|ERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json lib/src/artifacts; done;", "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json lib/src/artifacts; done;", @@ -22,25 +21,16 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib scripts lib/src/artifacts src/generated_contract_wrappers", + "clean": "shx rm -rf lib lib/src/artifacts src/generated_contract_wrappers", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "IWallet IValidator Exchange ERC20Proxy ERC20Token", "contracts_v2": "DummyERC20Token", "postpublish": { - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/order-utils/", - "s3StagingBucketPath": "s3://staging-doc-jsons/order-utils/" - } + "assets": [], + "shouldPublishDocs": true } }, "license": "Apache-2.0", @@ -54,7 +44,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", diff --git a/packages/order-utils/src/monorepo_scripts/postpublish.ts b/packages/order-utils/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/order-utils/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/order-utils/src/monorepo_scripts/stage_docs.ts b/packages/order-utils/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/order-utils/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/order-watcher/package.json b/packages/order-watcher/package.json index e4226f017..2b7507f02 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -13,7 +13,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && tsc", "pre_build": "run-s update_artifacts copy_artifacts generate_contract_wrappers", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", @@ -24,9 +24,8 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", - "clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/generated_contract_wrappers", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit" }, "config": { "contracts_v2_beta": "Exchange WETH9 ERC20Token ERC721Token" @@ -43,7 +42,6 @@ "@0xproject/abi-gen": "^1.0.4", "@0xproject/dev-utils": "^1.0.3", "@0xproject/migrations": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/sol-compiler": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/bintrees": "^1.0.2", diff --git a/packages/order-watcher/src/monorepo_scripts/postpublish.ts b/packages/order-watcher/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/order-watcher/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 1028f7fd6..e8db040be 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "lint": "tslint --project .", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "build": "tsc", "watch_without_deps": "tsc -w", - "clean": "shx rm -rf lib scripts", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib" }, "author": "Fabio Berger", "license": "Apache-2.0", @@ -26,7 +25,6 @@ }, "devDependencies": { "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/compare-versions": "^3.0.0", "copyfiles": "^1.2.0", diff --git a/packages/react-docs/src/monorepo_scripts/postpublish.ts b/packages/react-docs/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/react-docs/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index bb9211752..6b4501e83 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "lint": "tslint --project .", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "build": "tsc", "watch_without_deps": "tsc -w", - "clean": "shx rm -rf lib scripts", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib" }, "author": "Fabio Berger", "license": "Apache-2.0", @@ -26,7 +25,6 @@ }, "devDependencies": { "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/react-shared/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index c03477544..b0dfa455f 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -9,7 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && tsc", "pre_build": "run-s update_contract_fixtures", "update_contract_fixtures": "copyfiles 'test/fixtures/contracts/**/*' ./lib", "test": "yarn run_mocha", @@ -17,26 +17,16 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib scripts", + "clean": "shx rm -rf lib", "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", - "docs:stage": "node scripts/stage_docs.js", - "manual:postpublish": "yarn build; node ./scripts/postpublish.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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/sol-compiler/", - "s3StagingBucketPath": "s3://staging-doc-jsons/sol-compiler/" - } + "shouldPublishDocs": true } }, "bin": { @@ -54,7 +44,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", diff --git a/packages/sol-compiler/src/monorepo_scripts/postpublish.ts b/packages/sol-compiler/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/sol-compiler/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts b/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/sol-compiler/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/sol-cov/package.json b/packages/sol-cov/package.json index ee87543db..ad6a6a0a2 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -9,7 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "build": "yarn pre_build && tsc", "pre_build": "run-s copy_test_fixtures", "lint": "tslint --project .", "test": "run-s compile_test run_mocha", @@ -18,26 +18,15 @@ "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 scripts test/fixtures/artifacts src/artifacts", + "clean": "shx rm -rf lib test/fixtures/artifacts src/artifacts", "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", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../subproviders/src/types.ts", - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/sol-cov/", - "s3StagingBucketPath": "s3://staging-doc-jsons/sol-cov/" - } + "shouldPublishDocs": true } }, "repository": { @@ -69,7 +58,6 @@ "solidity-parser-antlr": "^0.2.12" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/istanbul": "^0.4.30", "@types/loglevel": "^1.5.3", diff --git a/packages/sol-cov/src/monorepo_scripts/postpublish.ts b/packages/sol-cov/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/sol-cov/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sol-cov/src/monorepo_scripts/stage_docs.ts b/packages/sol-cov/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/sol-cov/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/sol-resolver/package.json b/packages/sol-resolver/package.json index dd5915237..908417659 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "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" + "build": "tsc", + "clean": "shx rm -rf lib", + "lint": "tslint --project ." }, "repository": { "type": "git", @@ -24,7 +23,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/sol-resolver/src/monorepo_scripts/postpublish.ts b/packages/sol-resolver/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/sol-resolver/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 57e91a93c..8749384ee 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -9,8 +9,8 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "clean": "shx rm -rf lib scripts", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib", + "build": "tsc", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", @@ -20,7 +20,6 @@ "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 --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, "bin": { "sra-report": "bin/sra-report.js" @@ -48,7 +47,6 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.48", diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/sra-report/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 5e0153765..ad8ab9d29 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -9,8 +9,8 @@ "license": "Apache-2.0", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib scripts", + "build": "tsc", + "clean": "shx rm -rf lib", "lint": "tslint --project .", "run_mocha_unit": "mocha --require source-map-support/register --require make-promises-safe lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", "run_mocha_integration": "mocha --require source-map-support/register --require make-promises-safe lib/test/integration/**/*_test.js --timeout 10000 --bail --exit", @@ -21,22 +21,12 @@ "test:all": "run-s test:unit test:integration", "test:unit": "run-s clean build run_mocha_unit", "test:integration": "run-s clean build run_mocha_integration", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/subproviders/", - "s3StagingBucketPath": "s3://staging-doc-jsons/subproviders/" - } + "shouldPublishDocs": true } }, "dependencies": { @@ -62,7 +52,6 @@ "web3-provider-engine": "14.0.6" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/bip39": "^2.4.0", "@types/bn.js": "^4.11.0", diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/subproviders/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/subproviders/src/monorepo_scripts/stage_docs.ts b/packages/subproviders/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/subproviders/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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/tslint-config/monorepo_scripts/globals.d.ts b/packages/tslint-config/monorepo_scripts/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/tslint-config/monorepo_scripts/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/tslint-config/monorepo_scripts/postpublish.ts b/packages/tslint-config/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/tslint-config/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index f6fdb3649..10b82aaf1 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -8,10 +8,9 @@ "main": "tslint.json", "scripts": { "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" + "build": "tsc", + "clean": "shx rm -rf lib", + "lint": "tslint --project ." }, "repository": { "type": "git", @@ -34,7 +33,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/tslint-config/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/types/package.json b/packages/types/package.json index d2fefa136..88fa2b95a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "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" + "build": "tsc", + "clean": "shx rm -rf lib", + "lint": "tslint --project ." }, "license": "Apache-2.0", "repository": { @@ -24,7 +23,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/types/src/monorepo_scripts/postpublish.ts b/packages/types/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/types/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/typescript-typings/monorepo_scripts/globals.d.ts b/packages/typescript-typings/monorepo_scripts/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/typescript-typings/monorepo_scripts/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/typescript-typings/monorepo_scripts/postpublish.ts b/packages/typescript-typings/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/typescript-typings/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 34f2a224a..32235accb 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -7,9 +7,7 @@ "description": "0x project typescript type definitions", "scripts": { "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" + "build": "tsc" }, "repository": { "type": "git", @@ -32,7 +30,6 @@ "popper.js": "1.14.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "copyfiles": "^1.2.0", "shx": "^0.2.2" }, diff --git a/packages/utils/package.json b/packages/utils/package.json index b1a0d8eb9..b2ce9a17e 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "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" + "build": "tsc", + "clean": "shx rm -rf lib", + "lint": "tslint --project ." }, "license": "Apache-2.0", "repository": { @@ -24,7 +23,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "copyfiles": "^1.2.0", diff --git a/packages/utils/src/monorepo_scripts/postpublish.ts b/packages/utils/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/utils/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index d0f55c905..42f17aaac 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -9,8 +9,8 @@ "types": "lib/src/index.d.ts", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf lib scripts", + "build": "tsc", + "clean": "shx rm -rf lib", "lint": "tslint --project .", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", @@ -18,21 +18,12 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "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" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/web3-wrapper/", - "s3StagingBucketPath": "s3://staging-doc-jsons/web3-wrapper/" - } + "assets": [], + "shouldPublishDocs": true } }, "license": "Apache-2.0", @@ -45,7 +36,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "@types/lodash": "4.14.104", "chai": "^4.0.1", diff --git a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/web3-wrapper/src/monorepo_scripts/stage_docs.ts b/packages/web3-wrapper/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/web3-wrapper/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -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); -- cgit From 4579e1637d9f4d0d7badb23336af6785330c6ecc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 21:59:09 +0200 Subject: Add missing exports discovered by generating compact typedoc JSON --- packages/order-utils/src/index.ts | 13 ++++++++++++- packages/sol-compiler/src/index.ts | 3 +-- packages/sol-cov/src/index.ts | 2 +- packages/subproviders/src/index.ts | 4 ++++ packages/web3-wrapper/src/index.ts | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 76be63bb8..da53f620a 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -13,7 +13,16 @@ export { orderFactory } from './order_factory'; export { constants } from './constants'; export { crypto } from './crypto'; export { generatePseudoRandomSalt } from './salt'; -export { OrderError, MessagePrefixType, MessagePrefixOpts, EIP712Parameter, EIP712Schema, EIP712Types } from './types'; +export { + OrderError, + MessagePrefixType, + MessagePrefixOpts, + EIP712Parameter, + EIP712Schema, + EIP712Types, + TradeSide, + TransferType, +} from './types'; export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store'; @@ -24,3 +33,5 @@ export { assetDataUtils } from './asset_data_utils'; export { EIP712Utils } from './eip712_utils'; export { OrderValidationUtils } from './order_validation_utils'; export { ExchangeTransferSimulator } from './exchange_transfer_simulator'; +export { Provider } from 'ethereum-types'; +export { SignedOrder, Order, ECSignature, ERC20AssetData, ERC721AssetData, AssetProxyId } from '@0xproject/types'; diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 15c166992..de2de796e 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,3 +1,2 @@ export { Compiler } from './compiler'; -export { CompilerOptions } from './utils/types'; -export { ContractArtifact, ContractNetworks } from './utils/types'; +export { CompilerOptions, ContractArtifact, ContractNetworks } from './utils/types'; diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index 003a27374..0e70878ad 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -5,4 +5,4 @@ export { RevertTraceSubprovider } from './revert_trace_subprovider'; export { SolCompilerArtifactAdapter } from './artifact_adapters/sol_compiler_artifact_adapter'; export { TruffleArtifactAdapter } from './artifact_adapters/truffle_artifact_adapter'; export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; -export { ContractData } from './types'; +export { ContractData, TraceInfo, Subtrace, SourceRange, Coverage } from './types'; diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 9d4480e59..905590539 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -26,6 +26,8 @@ export { LedgerEthereumClient, NonceSubproviderErrors, LedgerSubproviderConfigs, + PartialTxParams, + DerivedHDKeyInfo, } from './types'; /** @@ -37,3 +39,5 @@ export async function ledgerEthereumBrowserClientFactoryAsync(): Promise Date: Sun, 29 Jul 2018 22:29:56 +0200 Subject: Improve doc gen script --- .../src/doc_generate_and_upload.ts | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index b6a4801e3..592c36ae2 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -19,7 +19,7 @@ const args = yargs demandOption: true, }) .option('isStaging', { - describe: 'Whether we with to publish docs to staging or production', + describe: 'Whether we wish to publish docs to staging or production', type: 'boolean', demandOption: true, }) @@ -65,23 +65,27 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // and see which specific files we must pass to TypeDoc. let typeDocExtraFileIncludes: string[] = []; _.each(exportPathToExportedItems, (exportedItems, exportPath) => { + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + const isInternalToPkg = _.startsWith(exportPath, '.'); if (isInternalToPkg) { const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); typeDocExtraFileIncludes.push(pathToInternalPkg); } - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - return; // It's an external package - } const typeDocSourceIncludes = new Set(); const pathToIndex = `${pathIfExists}/src/index.ts`; const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); _.each(exportedItems, exportName => { _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { if (!_.startsWith(innerExportPath, './')) { - // noop. Not an internal export... but rather an external one. Should we follow it? - return; + throw new Error( + `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting on of ${exportedItems} which is + itself exported from an external package. To fix this, export the external dependency directly, + not indirectly through ${exportPath}.`, + ); } if (_.includes(innerExportItems, exportName)) { const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); @@ -90,21 +94,20 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); }); // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types - // directly, meaning no internal paths will exist to follow. This, we add the index file. - // TODO: Maybe we should add the index for all packages? - if (typeDocSourceIncludes.size === 0) { - typeDocSourceIncludes.add(pathToIndex); - } + // directly, meaning no internal paths will exist to follow. Other packages also have direct exports + // in their index.ts, so we always add it to the source files passed to TypeDoc + typeDocSourceIncludes.add(pathToIndex); + typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; }); // Generate Typedoc JSON file const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages/0x.js/'); + const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the // packages root dir, does not work. It only works when called via a `package.json` script located - // in the packages root. + // in the package's root. await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { cwd, }); @@ -115,7 +118,6 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const finalTypeDocOutput = _.clone(typedocOutput); _.each(typedocOutput.children, (file, i) => { const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); - // Map file "name" to exportPath... HOW?! _.each(file.children, (child, j) => { if (!_.includes(exportItems, child.name)) { delete finalTypeDocOutput.children[i].children[j]; -- cgit From 454af2bda3ab30204b3398f2dec62214c03d880d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 22:49:34 +0200 Subject: Fix package.json --- packages/sra-report/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 8749384ee..26fd0a403 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -19,7 +19,7 @@ "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 --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit" }, "bin": { "sra-report": "bin/sra-report.js" -- cgit From 11778db05a6cfa526091cdf4602eee62edf18638 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:00:33 +0200 Subject: Remove no longer necessary include --- packages/typescript-typings/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/typescript-typings/tsconfig.json b/packages/typescript-typings/tsconfig.json index bc453af4b..a9a644b17 100644 --- a/packages/typescript-typings/tsconfig.json +++ b/packages/typescript-typings/tsconfig.json @@ -2,6 +2,5 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib" - }, - "include": ["./monorepo_scripts/**/*"] + } } -- cgit From fe2787fcc1d6684f2ded76c965b645414ab23718 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:00:44 +0200 Subject: Add back the 'clean' command --- packages/typescript-typings/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 32235accb..8e2196a4c 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -7,7 +7,8 @@ "description": "0x project typescript type definitions", "scripts": { "watch_without_deps": "tsc -w", - "build": "tsc" + "build": "tsc", + "clean": "shx rm -rf lib" }, "repository": { "type": "git", -- cgit From bb9237b0f41ffb484ff603a3e556919482187fbf Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:01:21 +0200 Subject: Make monorepo-scripts a private package now that no other package depends on it --- packages/monorepo-scripts/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 24f1607c0..2a885e389 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@0xproject/monorepo-scripts", "version": "1.0.4", "engines": { -- cgit From 1b24064c9f62b0b5638a5dab1878278e8e01649e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:34:42 +0200 Subject: Move publish_release_notes to own script and other publish cleanup --- packages/monorepo-scripts/package.json | 3 +- packages/monorepo-scripts/src/constants.ts | 1 + packages/monorepo-scripts/src/publish.ts | 100 +------------------ .../monorepo-scripts/src/publish_release_notes.ts | 110 +++++++++++++++++++++ 4 files changed, 116 insertions(+), 98 deletions(-) create mode 100644 packages/monorepo-scripts/src/publish_release_notes.ts diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 2a885e389..d7b83e37e 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -19,7 +19,8 @@ "script:prepublish_checks": "node ./lib/prepublish_checks.js", "script:publish": "IS_DRY_RUN=true node ./lib/publish.js", "script:find_unused_deps": "node ./lib/find_unused_dependencies.js", - "script:doc_generate_and_upload": "node ./lib/doc_generate_and_upload.js" + "script:doc_generate_and_upload": "node ./lib/doc_generate_and_upload.js", + "script:publish_release_notes": "node ./lib/publish_release_notes.js" }, "repository": { "type": "git", diff --git a/packages/monorepo-scripts/src/constants.ts b/packages/monorepo-scripts/src/constants.ts index e5d3348bd..acb4b211e 100644 --- a/packages/monorepo-scripts/src/constants.ts +++ b/packages/monorepo-scripts/src/constants.ts @@ -5,4 +5,5 @@ export const constants = { stagingWebsite: 'http://staging-0xproject.s3-website-us-east-1.amazonaws.com', lernaExecutable: path.join('node_modules', '@0x-lerna-fork', 'lerna', 'cli.js'), githubPersonalAccessToken: process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS, + dependenciesUpdatedMessage: 'Dependencies updated', }; diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 7444c64b1..faaa268fc 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -8,9 +8,6 @@ import { exec as execAsync } from 'promisify-child-process'; import * as prompt from 'prompt'; import semver = require('semver'); import semverSort = require('semver-sort'); -import * as publishRelease from 'publish-release'; - -const publishReleaseAsync = promisify(publishRelease); import { constants } from './constants'; import { Package, PackageToNextVersion, VersionChangelog } from './types'; @@ -18,22 +15,11 @@ import { changelogUtils } from './utils/changelog_utils'; import { configs } from './utils/configs'; import { utils } from './utils/utils'; import { generateAndUploadDocsAsync } from './doc_generate_and_upload'; +import { publishReleaseNotesAsync } from './publish_release_notes'; const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; const TODAYS_TIMESTAMP = moment().unix(); -const packageNameToWebsitePath: { [name: string]: string } = { - '0x.js': '0xjs', - 'web3-wrapper': 'web3_wrapper', - contracts: 'contracts', - connect: 'connect', - 'json-schemas': 'json-schemas', - 'sol-compiler': 'sol-compiler', - 'sol-cov': 'sol-cov', - subproviders: 'subproviders', - 'order-utils': 'order-utils', - 'ethereum-types': 'ethereum-types', -}; (async () => { // Fetch public, updated Lerna packages @@ -111,7 +97,7 @@ async function confirmDocPagesRenderAsync(packages: Package[]): Promise { _.each(packagesWithDocs, pkg => { const name = pkg.packageJson.name; const nameWithoutPrefix = _.startsWith(name, NPM_NAMESPACE) ? name.split('@0xproject/')[1] : name; - const docSegmentIfExists = packageNameToWebsitePath[nameWithoutPrefix]; + const docSegmentIfExists = nameWithoutPrefix; if (_.isUndefined(docSegmentIfExists)) { throw new Error( `Found package '${name}' with doc commands but no corresponding docSegment in monorepo_scripts @@ -163,7 +149,7 @@ async function updateChangeLogsAsync(updatedPublicPackages: Package[]): Promise< version: nextPatchVersionIfValid, changes: [ { - note: 'Dependencies updated', + note: constants.dependenciesUpdatedMessage, }, ], }; @@ -194,86 +180,6 @@ async function updateChangeLogsAsync(updatedPublicPackages: Package[]): Promise< return packageToNextVersion; } -async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { - // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) - const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); - const latestGitCommit = result.stdout; - const shortenedGitCommit = latestGitCommit.slice(0, 7); - const tagName = `monorepo@${shortenedGitCommit}`; - // TODO: We might need to handle the case where the tag already exists locally - await execAsync('git tag ${tagName}'); - await execAsync('git push origin ${tagName}'); - const releaseName = `0x monorepo - ${shortenedGitCommit}`; - - let assets: string[] = []; - let aggregateNotes = ''; - _.each(updatedPublishPackages, pkg => { - const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); - aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; - - const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); - if (!_.isUndefined(packageAssets)) { - assets = [...assets, ...packageAssets]; - } - }); - adjustAssetPaths(assets); - - utils.log('PUBLISH: Releasing ', releaseName, '...'); - // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded - // Ideally we would like to name the assets after the package they are from - // Source: https://github.com/remixz/publish-release/issues/39 - await publishReleaseAsync({ - token: constants.githubPersonalAccessToken, - owner: '0xProject', - tag: tagName, - repo: '0x-monorepo', - name: releaseName, - notes: aggregateNotes, - draft: false, - prerelease: false, - reuseRelease: true, - reuseDraftOnly: false, - assets, - }); -} - -// Asset paths should described from the monorepo root. This method prefixes -// the supplied path with the absolute path to the monorepo root. -function adjustAssetPaths(assets: string[]): string[] { - const finalAssets: string[] = []; - _.each(assets, (asset: string) => { - finalAssets.push(`${constants.monorepoRootPath}/${asset}`); - }); - return finalAssets; -} - -function getReleaseNotesForPackage(packageName: string, version: string): string { - const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); - const changelogJSONPath = path.join( - constants.monorepoRootPath, - 'packages', - packageNameWithoutNamespace, - 'CHANGELOG.json', - ); - const changelogJSON = fs.readFileSync(changelogJSONPath, 'utf-8'); - const changelogs = JSON.parse(changelogJSON); - const latestLog = changelogs[0]; - // We sanity check that the version for the changelog notes we are about to publish to Github - // correspond to the new version of the package. - if (version !== latestLog.version) { - throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); - } - let notes = ''; - _.each(latestLog.changes, change => { - notes += `* ${change.note}`; - if (change.pr) { - notes += ` (#${change.pr})`; - } - notes += `\n`; - }); - return notes; -} - async function lernaPublishAsync(packageToNextVersion: { [name: string]: string }): Promise { const packageVersionString = _.map(packageToNextVersion, (nextVersion: string, packageName: string) => { return `${packageName}@${nextVersion}`; diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts new file mode 100644 index 000000000..acfac0be7 --- /dev/null +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -0,0 +1,110 @@ +import { readFileSync } from 'fs'; +import * as _ from 'lodash'; +import * as promisify from 'es6-promisify'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import * as publishRelease from 'publish-release'; + +import { constants } from './constants'; +import { Package } from './types'; +import { utils } from './utils/utils'; + +const publishReleaseAsync = promisify(publishRelease); + +(async () => { + console.log('I RAN! - publishReleaseNotesAsync'); + const shouldIncludePrivate = false; + const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); + + await publishReleaseNotesAsync(allUpdatedPackages); +})(); + +export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { + // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) + const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); + const latestGitCommit = result.stdout; + const shortenedGitCommit = latestGitCommit.slice(0, 7); + const tagName = `monorepo@${shortenedGitCommit}`; + + await execAsync(`git rev-parse ${tagName}`); + await execAsync('git tag ${tagName}'); + + await execAsync('git push origin ${tagName}'); + const releaseName = `0x monorepo - ${shortenedGitCommit}`; + + let assets: string[] = []; + let aggregateNotes = ''; + _.each(updatedPublishPackages, pkg => { + const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); + if (_.isEmpty(notes)) { + return; // don't include it + } + aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; + + const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); + if (!_.isUndefined(packageAssets)) { + assets = [...assets, ...packageAssets]; + } + }); + const finalAssets = adjustAssetPaths(assets); + + utils.log('Publishing release notes ', releaseName, '...'); + // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded + // Ideally we would like to name the assets after the package they are from + // Source: https://github.com/remixz/publish-release/issues/39 + await publishReleaseAsync({ + token: constants.githubPersonalAccessToken, + owner: '0xProject', + tag: tagName, + repo: '0x-monorepo', + name: releaseName, + notes: aggregateNotes, + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets: finalAssets, + }); +} + +// Asset paths should described from the monorepo root. This method prefixes +// the supplied path with the absolute path to the monorepo root. +function adjustAssetPaths(assets: string[]): string[] { + const finalAssets: string[] = []; + _.each(assets, (asset: string) => { + const finalAsset = `${constants.monorepoRootPath}/${asset}`; + finalAssets.push(finalAsset); + }); + return finalAssets; +} + +function getReleaseNotesForPackage(packageName: string, version: string): string { + const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); + const changelogJSONPath = path.join( + constants.monorepoRootPath, + 'packages', + packageNameWithoutNamespace, + 'CHANGELOG.json', + ); + const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); + const changelogs = JSON.parse(changelogJSON); + const latestLog = changelogs[0]; + // If only has a `Dependencies updated` changelog, we don't include it in release notes + if (latestLog.changes.length === 1 && latestLog.changes[0].note === constants.dependenciesUpdatedMessage) { + return ''; + } + // We sanity check that the version for the changelog notes we are about to publish to Github + // correspond to the new version of the package. + // if (version !== latestLog.version) { + // throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); + // } + let notes = ''; + _.each(latestLog.changes, change => { + notes += `* ${change.note}`; + if (change.pr) { + notes += ` (#${change.pr})`; + } + notes += `\n`; + }); + return notes; +} -- cgit From b7ff1fe5d352b4f59664198d9fe852cbe1015357 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:34:49 +0200 Subject: Move type --- packages/monorepo-scripts/src/doc_generate_and_upload.ts | 9 +++++---- packages/monorepo-scripts/src/types.ts | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index 592c36ae2..03910c460 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -6,12 +6,9 @@ import * as ts from 'typescript'; import * as yargs from 'yargs'; import { constants } from './constants'; +import { ExportPathToExportedItems } from './types'; import { utils } from './utils/utils'; -export interface ExportPathToExportedItems { - [pkgName: string]: string[]; -} - const args = yargs .option('package', { describe: 'Monorepo sub-package for which to generate DocJSON', @@ -26,8 +23,12 @@ const args = yargs .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; (async () => { + console.log('I RAN! - generateAndUploadDocsAsync'); const packageName = args.package; const isStaging = args.isStaging; + if (_.isEmpty(packageName)) { + return; // We are not runninng in a command-line env. + } await generateAndUploadDocsAsync(packageName, isStaging); })(); diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index d9e1dfabb..4d4600abf 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -49,3 +49,7 @@ export interface Package { location: string; packageJson: PackageJSON; } + +export interface ExportPathToExportedItems { + [pkgName: string]: string[]; +} -- cgit From b56fc697c41649fdb3bdeaf9709781c9fd166b08 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 23:55:28 +0200 Subject: Move logic to publishUtils so can use as command-line and script import --- .../src/doc_generate_and_upload.ts | 197 +------------- packages/monorepo-scripts/src/publish.ts | 3 +- .../monorepo-scripts/src/publish_release_notes.ts | 100 +------ .../monorepo-scripts/src/utils/publish_utils.ts | 291 +++++++++++++++++++++ 4 files changed, 294 insertions(+), 297 deletions(-) create mode 100644 packages/monorepo-scripts/src/utils/publish_utils.ts diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index 03910c460..ab1f97ad8 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -1,13 +1,6 @@ -import { readFileSync, writeFileSync } from 'fs'; -import * as _ from 'lodash'; -import * as path from 'path'; -import { exec as execAsync } from 'promisify-child-process'; -import * as ts from 'typescript'; import * as yargs from 'yargs'; -import { constants } from './constants'; -import { ExportPathToExportedItems } from './types'; -import { utils } from './utils/utils'; +import { generateAndUploadDocsAsync } from './utils/publish_utils'; const args = yargs .option('package', { @@ -23,196 +16,8 @@ const args = yargs .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; (async () => { - console.log('I RAN! - generateAndUploadDocsAsync'); const packageName = args.package; const isStaging = args.isStaging; - if (_.isEmpty(packageName)) { - return; // We are not runninng in a command-line env. - } await generateAndUploadDocsAsync(packageName, isStaging); })(); - -export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { - const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; - const indexPath = `${pathToPackage}/src/index.ts`; - const exportPathToExportedItems = getExportPathToExportedItems(indexPath); - - const monorepoPackages = utils.getPackages(constants.monorepoRootPath); - const pkg = _.find(monorepoPackages, monorepoPackage => { - return _.includes(monorepoPackage.packageJson.name, packageName); - }); - if (_.isUndefined(pkg)) { - throw new Error(`Couldn't find a package.json for ${packageName}`); - } - - const packageJson = pkg.packageJson; - const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); - if (!shouldPublishDocs) { - utils.log( - `GENERATE_UPLOAD_DOCS: ${ - packageJson.name - } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, - ); - return; - } - - const pkgNameToPath: { [name: string]: string } = {}; - _.each(monorepoPackages, pkg => { - pkgNameToPath[pkg.packageJson.name] = pkg.location; - }); - - // For each dep that is another one of our monorepo packages, we fetch it's index.ts - // and see which specific files we must pass to TypeDoc. - let typeDocExtraFileIncludes: string[] = []; - _.each(exportPathToExportedItems, (exportedItems, exportPath) => { - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - return; // It's an external package - } - - const isInternalToPkg = _.startsWith(exportPath, '.'); - if (isInternalToPkg) { - const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); - typeDocExtraFileIncludes.push(pathToInternalPkg); - } - const typeDocSourceIncludes = new Set(); - const pathToIndex = `${pathIfExists}/src/index.ts`; - const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); - _.each(exportedItems, exportName => { - _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { - if (!_.startsWith(innerExportPath, './')) { - throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting on of ${exportedItems} which is - itself exported from an external package. To fix this, export the external dependency directly, - not indirectly through ${exportPath}.`, - ); - } - if (_.includes(innerExportItems, exportName)) { - const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); - typeDocSourceIncludes.add(absoluteSrcPath); - } - }); - }); - // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types - // directly, meaning no internal paths will exist to follow. Other packages also have direct exports - // in their index.ts, so we always add it to the source files passed to TypeDoc - typeDocSourceIncludes.add(pathToIndex); - - typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; - }); - - // Generate Typedoc JSON file - const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); - const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); - // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the - // packages root dir, does not work. It only works when called via a `package.json` script located - // in the package's root. - await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - - // For each entry, see if it was exported in index.ts. If not, remove it. - const typedocOutputString = readFileSync(jsonFilePath).toString(); - const typedocOutput = JSON.parse(typedocOutputString); - const finalTypeDocOutput = _.clone(typedocOutput); - _.each(typedocOutput.children, (file, i) => { - const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); - _.each(file.children, (child, j) => { - if (!_.includes(exportItems, child.name)) { - delete finalTypeDocOutput.children[i].children[j]; - } - }); - finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); - }); - // Write modified TypeDoc JSON, without all the unexported stuff - writeFileSync(jsonFilePath, JSON.stringify(finalTypeDocOutput, null, 2)); - - const fileName = `v${packageJson.version}.json`; - utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); - const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; - const s3Url = `${S3BucketPath}${fileName}`; - await execAsync( - `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, - { - cwd, - }, - ); - utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); - // Remove the generated docs directory - await execAsync(`rm -rf ${jsonFilePath}`, { - cwd, - }); -} - -function findExportItemsGivenTypedocName( - exportPathToExportedItems: ExportPathToExportedItems, - packageName: string, - typedocName: string, -): string[] { - const typeDocNameWithoutQuotes = _.replace(typedocName, '"', ''); - const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; - const exportPaths = _.keys(exportPathToExportedItems); - const sanitizedExportPaths = _.map(exportPaths, exportPath => { - if (_.startsWith(exportPath, './')) { - const sanitizedExportPath = path.join(packageName, 'src', exportPath); - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; - } - const monorepoPrefix = '@0xproject/'; - if (_.startsWith(exportPath, monorepoPrefix)) { - const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; - } - sanitizedExportPathToExportPath[exportPath] = exportPath; - return exportPath; - }); - const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPaths, p => { - return _.startsWith(typeDocNameWithoutQuotes, p); - }); - if (_.isUndefined(matchingSanitizedExportPathIfExists)) { - throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); - } - const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; - return exportPathToExportedItems[matchingExportPath]; -} - -function getExportPathToExportedItems(pkgPath: string): ExportPathToExportedItems { - const sourceFile = ts.createSourceFile( - 'indexFile', - readFileSync(pkgPath).toString(), - ts.ScriptTarget.ES2017, - /*setParentNodes */ true, - ); - const exportPathToExportedItems = _getExportPathToExportedItems(sourceFile); - return exportPathToExportedItems; -} - -function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedItems { - const exportPathToExportedItems: ExportPathToExportedItems = {}; - processNode(sf); - - function processNode(node: ts.Node): void { - switch (node.kind) { - case ts.SyntaxKind.ExportDeclaration: - // console.log(node); - const exportClause = (node as any).exportClause; - const pkgName = exportClause.parent.moduleSpecifier.text; - _.each(exportClause.elements, element => { - exportPathToExportedItems[pkgName] = _.isUndefined(exportPathToExportedItems[pkgName]) - ? [element.name.escapedText] - : [...exportPathToExportedItems[pkgName], element.name.escapedText]; - }); - break; - - default: - // noop - break; - } - - ts.forEachChild(node, processNode); - } - return exportPathToExportedItems; -} diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index faaa268fc..64ba73e36 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -14,8 +14,7 @@ import { Package, PackageToNextVersion, VersionChangelog } from './types'; import { changelogUtils } from './utils/changelog_utils'; import { configs } from './utils/configs'; import { utils } from './utils/utils'; -import { generateAndUploadDocsAsync } from './doc_generate_and_upload'; -import { publishReleaseNotesAsync } from './publish_release_notes'; +import { publishReleaseNotesAsync, generateAndUploadDocsAsync } from './utils/publish_utils'; const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts index acfac0be7..d708e8275 100644 --- a/packages/monorepo-scripts/src/publish_release_notes.ts +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -1,110 +1,12 @@ -import { readFileSync } from 'fs'; -import * as _ from 'lodash'; import * as promisify from 'es6-promisify'; -import * as path from 'path'; -import { exec as execAsync } from 'promisify-child-process'; import * as publishRelease from 'publish-release'; -import { constants } from './constants'; -import { Package } from './types'; import { utils } from './utils/utils'; - -const publishReleaseAsync = promisify(publishRelease); +import { publishReleaseNotesAsync } from './utils/publish_utils'; (async () => { - console.log('I RAN! - publishReleaseNotesAsync'); const shouldIncludePrivate = false; const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); await publishReleaseNotesAsync(allUpdatedPackages); })(); - -export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { - // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) - const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); - const latestGitCommit = result.stdout; - const shortenedGitCommit = latestGitCommit.slice(0, 7); - const tagName = `monorepo@${shortenedGitCommit}`; - - await execAsync(`git rev-parse ${tagName}`); - await execAsync('git tag ${tagName}'); - - await execAsync('git push origin ${tagName}'); - const releaseName = `0x monorepo - ${shortenedGitCommit}`; - - let assets: string[] = []; - let aggregateNotes = ''; - _.each(updatedPublishPackages, pkg => { - const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); - if (_.isEmpty(notes)) { - return; // don't include it - } - aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; - - const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); - if (!_.isUndefined(packageAssets)) { - assets = [...assets, ...packageAssets]; - } - }); - const finalAssets = adjustAssetPaths(assets); - - utils.log('Publishing release notes ', releaseName, '...'); - // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded - // Ideally we would like to name the assets after the package they are from - // Source: https://github.com/remixz/publish-release/issues/39 - await publishReleaseAsync({ - token: constants.githubPersonalAccessToken, - owner: '0xProject', - tag: tagName, - repo: '0x-monorepo', - name: releaseName, - notes: aggregateNotes, - draft: false, - prerelease: false, - reuseRelease: true, - reuseDraftOnly: false, - assets: finalAssets, - }); -} - -// Asset paths should described from the monorepo root. This method prefixes -// the supplied path with the absolute path to the monorepo root. -function adjustAssetPaths(assets: string[]): string[] { - const finalAssets: string[] = []; - _.each(assets, (asset: string) => { - const finalAsset = `${constants.monorepoRootPath}/${asset}`; - finalAssets.push(finalAsset); - }); - return finalAssets; -} - -function getReleaseNotesForPackage(packageName: string, version: string): string { - const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); - const changelogJSONPath = path.join( - constants.monorepoRootPath, - 'packages', - packageNameWithoutNamespace, - 'CHANGELOG.json', - ); - const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); - const changelogs = JSON.parse(changelogJSON); - const latestLog = changelogs[0]; - // If only has a `Dependencies updated` changelog, we don't include it in release notes - if (latestLog.changes.length === 1 && latestLog.changes[0].note === constants.dependenciesUpdatedMessage) { - return ''; - } - // We sanity check that the version for the changelog notes we are about to publish to Github - // correspond to the new version of the package. - // if (version !== latestLog.version) { - // throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); - // } - let notes = ''; - _.each(latestLog.changes, change => { - notes += `* ${change.note}`; - if (change.pr) { - notes += ` (#${change.pr})`; - } - notes += `\n`; - }); - return notes; -} diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts new file mode 100644 index 000000000..a0a414cda --- /dev/null +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -0,0 +1,291 @@ +import * as _ from 'lodash'; +import * as promisify from 'es6-promisify'; +import * as publishRelease from 'publish-release'; + +import { constants } from '../constants'; +import { Package } from '../types'; +import { utils } from './utils'; + +import { readFileSync, writeFileSync } from 'fs'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import * as ts from 'typescript'; + +import { ExportPathToExportedItems } from '../types'; + +const publishReleaseAsync = promisify(publishRelease); +export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { + // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) + const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); + const latestGitCommit = result.stdout; + const shortenedGitCommit = latestGitCommit.slice(0, 7); + const tagName = `monorepo@${shortenedGitCommit}`; + + await execAsync(`git rev-parse ${tagName}`); + await execAsync('git tag ${tagName}'); + + await execAsync('git push origin ${tagName}'); + const releaseName = `0x monorepo - ${shortenedGitCommit}`; + + let assets: string[] = []; + let aggregateNotes = ''; + _.each(updatedPublishPackages, pkg => { + const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); + if (_.isEmpty(notes)) { + return; // don't include it + } + aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; + + const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); + if (!_.isUndefined(packageAssets)) { + assets = [...assets, ...packageAssets]; + } + }); + const finalAssets = adjustAssetPaths(assets); + + utils.log('Publishing release notes ', releaseName, '...'); + // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded + // Ideally we would like to name the assets after the package they are from + // Source: https://github.com/remixz/publish-release/issues/39 + await publishReleaseAsync({ + token: constants.githubPersonalAccessToken, + owner: '0xProject', + tag: tagName, + repo: '0x-monorepo', + name: releaseName, + notes: aggregateNotes, + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets: finalAssets, + }); +} + +// Asset paths should described from the monorepo root. This method prefixes +// the supplied path with the absolute path to the monorepo root. +function adjustAssetPaths(assets: string[]): string[] { + const finalAssets: string[] = []; + _.each(assets, (asset: string) => { + const finalAsset = `${constants.monorepoRootPath}/${asset}`; + finalAssets.push(finalAsset); + }); + return finalAssets; +} + +function getReleaseNotesForPackage(packageName: string, version: string): string { + const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); + const changelogJSONPath = path.join( + constants.monorepoRootPath, + 'packages', + packageNameWithoutNamespace, + 'CHANGELOG.json', + ); + const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); + const changelogs = JSON.parse(changelogJSON); + const latestLog = changelogs[0]; + // If only has a `Dependencies updated` changelog, we don't include it in release notes + if (latestLog.changes.length === 1 && latestLog.changes[0].note === constants.dependenciesUpdatedMessage) { + return ''; + } + // We sanity check that the version for the changelog notes we are about to publish to Github + // correspond to the new version of the package. + // if (version !== latestLog.version) { + // throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); + // } + let notes = ''; + _.each(latestLog.changes, change => { + notes += `* ${change.note}`; + if (change.pr) { + notes += ` (#${change.pr})`; + } + notes += `\n`; + }); + return notes; +} + +export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { + const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; + const indexPath = `${pathToPackage}/src/index.ts`; + const exportPathToExportedItems = getExportPathToExportedItems(indexPath); + + const monorepoPackages = utils.getPackages(constants.monorepoRootPath); + const pkg = _.find(monorepoPackages, monorepoPackage => { + return _.includes(monorepoPackage.packageJson.name, packageName); + }); + if (_.isUndefined(pkg)) { + throw new Error(`Couldn't find a package.json for ${packageName}`); + } + + const packageJson = pkg.packageJson; + const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); + if (!shouldPublishDocs) { + utils.log( + `GENERATE_UPLOAD_DOCS: ${ + packageJson.name + } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, + ); + return; + } + + const pkgNameToPath: { [name: string]: string } = {}; + _.each(monorepoPackages, pkg => { + pkgNameToPath[pkg.packageJson.name] = pkg.location; + }); + + // For each dep that is another one of our monorepo packages, we fetch it's index.ts + // and see which specific files we must pass to TypeDoc. + let typeDocExtraFileIncludes: string[] = []; + _.each(exportPathToExportedItems, (exportedItems, exportPath) => { + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + + const isInternalToPkg = _.startsWith(exportPath, '.'); + if (isInternalToPkg) { + const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); + typeDocExtraFileIncludes.push(pathToInternalPkg); + return; // Right? + } + const typeDocSourceIncludes = new Set(); + const pathToIndex = `${pathIfExists}/src/index.ts`; + const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); + _.each(exportedItems, exportName => { + _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { + if (!_.startsWith(innerExportPath, './') && _.includes(innerExportItems, exportName)) { + throw new Error( + `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is + itself exported from an external package. To fix this, export the external dependency directly, + not indirectly through ${innerExportPath}.`, + ); + } else if (_.includes(innerExportItems, exportName)) { + const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); + typeDocSourceIncludes.add(absoluteSrcPath); + } + }); + }); + // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types + // directly, meaning no internal paths will exist to follow. Other packages also have direct exports + // in their index.ts, so we always add it to the source files passed to TypeDoc + if (typeDocSourceIncludes.size === 0) { + typeDocSourceIncludes.add(pathToIndex); + } + + typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; + }); + + // Generate Typedoc JSON file + const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); + const projectFiles = typeDocExtraFileIncludes.join(' '); + const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); + // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the + // packages root dir, does not work. It only works when called via a `package.json` script located + // in the package's root. + await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + + // For each entry, see if it was exported in index.ts. If not, remove it. + const typedocOutputString = readFileSync(jsonFilePath).toString(); + const typedocOutput = JSON.parse(typedocOutputString); + const finalTypeDocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (file, i) => { + const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); + _.each(file.children, (child, j) => { + if (!_.includes(exportItems, child.name)) { + delete finalTypeDocOutput.children[i].children[j]; + } + }); + finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); + }); + // Write modified TypeDoc JSON, without all the unexported stuff + writeFileSync(jsonFilePath, JSON.stringify(finalTypeDocOutput, null, 2)); + + const fileName = `v${packageJson.version}.json`; + utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); + const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; + const s3Url = `${S3BucketPath}${fileName}`; + await execAsync( + `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, + { + cwd, + }, + ); + utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); + // Remove the generated docs directory + await execAsync(`rm -rf ${jsonFilePath}`, { + cwd, + }); +} + +function findExportItemsGivenTypedocName( + exportPathToExportedItems: ExportPathToExportedItems, + packageName: string, + typedocName: string, +): string[] { + const typeDocNameWithoutQuotes = _.replace(typedocName, '"', ''); + const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; + const exportPaths = _.keys(exportPathToExportedItems); + const sanitizedExportPaths = _.map(exportPaths, exportPath => { + if (_.startsWith(exportPath, './')) { + const sanitizedExportPath = path.join(packageName, 'src', exportPath); + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + const monorepoPrefix = '@0xproject/'; + if (_.startsWith(exportPath, monorepoPrefix)) { + const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + sanitizedExportPathToExportPath[exportPath] = exportPath; + return exportPath; + }); + const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPaths, p => { + return _.startsWith(typeDocNameWithoutQuotes, p); + }); + if (_.isUndefined(matchingSanitizedExportPathIfExists)) { + throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); + } + const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; + return exportPathToExportedItems[matchingExportPath]; +} + +function getExportPathToExportedItems(pkgPath: string): ExportPathToExportedItems { + const sourceFile = ts.createSourceFile( + 'indexFile', + readFileSync(pkgPath).toString(), + ts.ScriptTarget.ES2017, + /*setParentNodes */ true, + ); + const exportPathToExportedItems = _getExportPathToExportedItems(sourceFile); + return exportPathToExportedItems; +} + +function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedItems { + const exportPathToExportedItems: ExportPathToExportedItems = {}; + processNode(sf); + + function processNode(node: ts.Node): void { + switch (node.kind) { + case ts.SyntaxKind.ExportDeclaration: + // console.log(node); + const exportClause = (node as any).exportClause; + const pkgName = exportClause.parent.moduleSpecifier.text; + _.each(exportClause.elements, element => { + exportPathToExportedItems[pkgName] = _.isUndefined(exportPathToExportedItems[pkgName]) + ? [element.name.escapedText] + : [...exportPathToExportedItems[pkgName], element.name.escapedText]; + }); + break; + + default: + // noop + break; + } + + ts.forEachChild(node, processNode); + } + return exportPathToExportedItems; +} -- cgit From 79b1b6c8e08f9cc61babd75fdaff14472216d0f2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 30 Jul 2018 15:40:10 +0200 Subject: Fix bugs in doc gen --- packages/monorepo-scripts/src/utils/publish_utils.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index a0a414cda..7209fa344 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -137,29 +137,33 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // and see which specific files we must pass to TypeDoc. let typeDocExtraFileIncludes: string[] = []; _.each(exportPathToExportedItems, (exportedItems, exportPath) => { - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - return; // It's an external package - } - const isInternalToPkg = _.startsWith(exportPath, '.'); if (isInternalToPkg) { const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); typeDocExtraFileIncludes.push(pathToInternalPkg); return; // Right? } + + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + const typeDocSourceIncludes = new Set(); const pathToIndex = `${pathIfExists}/src/index.ts`; const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); _.each(exportedItems, exportName => { _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { - if (!_.startsWith(innerExportPath, './') && _.includes(innerExportItems, exportName)) { + if (!_.includes(innerExportItems, exportName)) { + return; + } + if (!_.startsWith(innerExportPath, './')) { throw new Error( `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is itself exported from an external package. To fix this, export the external dependency directly, not indirectly through ${innerExportPath}.`, ); - } else if (_.includes(innerExportItems, exportName)) { + } else { const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); typeDocSourceIncludes.add(absoluteSrcPath); } -- cgit From 79faf7d3cb12a68ef336002b59b339f675d4c32a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 30 Jul 2018 15:40:20 +0200 Subject: Update yarn.lock --- yarn.lock | 132 +++----------------------------------------------------------- 1 file changed, 5 insertions(+), 127 deletions(-) diff --git a/yarn.lock b/yarn.lock index 506cb2144..4f8c1fe86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -565,37 +565,6 @@ lodash "4.17.10" uuid "3.2.1" -"@0xproject/contract-wrappers@^1.0.1-rc.2": - version "1.0.1-rc.1" - dependencies: - "@0xproject/assert" "^1.0.3" - "@0xproject/base-contract" "^1.0.3" - "@0xproject/fill-scenarios" "^1.0.1-rc.1" - "@0xproject/json-schemas" "^1.0.1-rc.2" - "@0xproject/order-utils" "^1.0.1-rc.1" - "@0xproject/types" "^1.0.1-rc.2" - "@0xproject/typescript-typings" "^1.0.3" - "@0xproject/utils" "^1.0.3" - "@0xproject/web3-wrapper" "^1.1.1" - ethereum-types "^1.0.3" - ethereumjs-blockstream "5.0.0" - ethereumjs-util "^5.1.1" - ethers "3.0.22" - js-sha3 "^0.7.0" - lodash "^4.17.4" - uuid "^3.1.0" - -"@0xproject/dev-utils@^1.0.3": - version "1.0.2" - dependencies: - "@0xproject/subproviders" "^1.0.3" - "@0xproject/types" "^1.0.1-rc.2" - "@0xproject/typescript-typings" "^1.0.3" - "@0xproject/utils" "^1.0.3" - "@0xproject/web3-wrapper" "^1.1.1" - ethereum-types "^1.0.3" - lodash "^4.17.4" - "@0xproject/fill-scenarios@^0.0.4": version "0.0.4" resolved "https://registry.yarnpkg.com/@0xproject/fill-scenarios/-/fill-scenarios-0.0.4.tgz#4d23c75abda7e9f117b698c0b8b142af07e0c69e" @@ -653,23 +622,6 @@ jsonschema "1.2.2" lodash.values "4.3.0" -"@0xproject/migrations@^1.0.3": - version "1.0.2" - dependencies: - "@0xproject/base-contract" "^1.0.3" - "@0xproject/order-utils" "^1.0.1-rc.1" - "@0xproject/sol-compiler" "^1.0.3" - "@0xproject/subproviders" "^1.0.3" - "@0xproject/typescript-typings" "^1.0.3" - "@0xproject/utils" "^1.0.3" - "@0xproject/web3-wrapper" "^1.1.1" - "@ledgerhq/hw-app-eth" "^4.3.0" - ethereum-types "^1.0.3" - ethers "3.0.22" - lodash "^4.17.4" - optionalDependencies: - "@ledgerhq/hw-transport-node-hid" "^4.3.0" - "@0xproject/order-utils@^0.0.7": version "0.0.7" resolved "https://registry.yarnpkg.com/@0xproject/order-utils/-/order-utils-0.0.7.tgz#eaa465782ea5745bdad54e1a851533172d993b7c" @@ -718,25 +670,6 @@ ethereumjs-util "5.1.5" lodash "4.17.10" -"@0xproject/order-utils@^1.0.1-rc.2": - version "1.0.1-rc.1" - dependencies: - "@0xproject/assert" "^1.0.3" - "@0xproject/base-contract" "^1.0.3" - "@0xproject/json-schemas" "^1.0.1-rc.2" - "@0xproject/sol-compiler" "^1.0.3" - "@0xproject/types" "^1.0.1-rc.2" - "@0xproject/typescript-typings" "^1.0.3" - "@0xproject/utils" "^1.0.3" - "@0xproject/web3-wrapper" "^1.1.1" - "@types/node" "^8.0.53" - bn.js "^4.11.8" - ethereum-types "^1.0.3" - ethereumjs-abi "0.6.5" - ethereumjs-util "^5.1.1" - ethers "3.0.22" - lodash "^4.17.4" - "@0xproject/order-watcher@^0.0.7": version "0.0.7" resolved "https://registry.yarnpkg.com/@0xproject/order-watcher/-/order-watcher-0.0.7.tgz#fbe019aa33447781096b5d562e7a3a4ec91a1da2" @@ -1014,12 +947,6 @@ dependencies: "@types/node" "*" -"@types/fs-extra@^4.0.0": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.8.tgz#6957ddaf9173195199cb96da3db44c74700463d2" - dependencies: - "@types/node" "*" - "@types/glob@*", "@types/glob@5.0.35", "@types/glob@^5.0.33": version "5.0.35" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.35.tgz#1ae151c802cece940443b5ac246925c85189f32a" @@ -1032,7 +959,7 @@ version "4.0.36" resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.36.tgz#ff57c77fa1ab6713bb446534ddc4d979707a3a79" -"@types/handlebars@^4.0.31", "@types/handlebars@^4.0.36": +"@types/handlebars@^4.0.36": version "4.0.37" resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.37.tgz#a3bc3eba0c0f03f753cac00841a5b21e26a02c03" @@ -1042,7 +969,7 @@ dependencies: "@types/node" "*" -"@types/highlight.js@9.12.2", "@types/highlight.js@^9.1.8": +"@types/highlight.js@9.12.2": version "9.12.2" resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.12.2.tgz#6ee7cd395effe5ec80b515d3ff1699068cd0cd1d" @@ -1080,7 +1007,7 @@ dependencies: "@types/lodash" "*" -"@types/lodash@*", "@types/lodash@^4.14.37": +"@types/lodash@*": version "4.14.107" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.107.tgz#b2d2ae3958bfb8ff828495cbe12214af9e4d035e" @@ -1096,10 +1023,6 @@ version "1.5.3" resolved "https://registry.yarnpkg.com/@types/loglevel/-/loglevel-1.5.3.tgz#adfce55383edc5998a2170ad581b3e23d6adb5b8" -"@types/marked@0.0.28": - version "0.0.28" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.0.28.tgz#44ba754e9fa51432583e8eb30a7c4dd249b52faa" - "@types/marked@0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524" @@ -1119,10 +1042,6 @@ version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" -"@types/minimatch@^2.0.29": - version "2.0.29" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" - "@types/mkdirp@^0.5.1", "@types/mkdirp@^0.5.2": version "0.5.2" resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f" @@ -1275,13 +1194,6 @@ "@types/glob" "*" "@types/node" "*" -"@types/shelljs@^0.7.0": - version "0.7.8" - resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.8.tgz#4b4d6ee7926e58d7bca448a50ba442fd9f6715bd" - dependencies: - "@types/glob" "*" - "@types/node" "*" - "@types/sinon@^2.2.2": version "2.3.7" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.7.tgz#e92c2fed3297eae078d78d1da032b26788b4af86" @@ -5821,14 +5733,6 @@ fs-extra@^2.0.0, fs-extra@^2.1.2: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" @@ -8410,7 +8314,7 @@ markdown-escapes@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.2.tgz#e639cbde7b99c841c0bacc8a07982873b46d2122" -marked@^0.3.12, marked@^0.3.5: +marked@^0.3.12: version "0.3.19" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" @@ -11788,7 +11692,7 @@ shelljs@0.8.0: interpret "^1.0.0" rechoir "^0.6.2" -shelljs@^0.7.0, shelljs@^0.7.3: +shelljs@^0.7.3: version "0.7.8" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" dependencies: @@ -13095,38 +12999,12 @@ typedoc@0xProject/typedoc: typedoc-default-themes "^0.5.0" typescript "2.7.1" -typedoc@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.8.0.tgz#d7172bc6a29964f451b7609c005beadadefe2361" - dependencies: - "@types/fs-extra" "^4.0.0" - "@types/handlebars" "^4.0.31" - "@types/highlight.js" "^9.1.8" - "@types/lodash" "^4.14.37" - "@types/marked" "0.0.28" - "@types/minimatch" "^2.0.29" - "@types/shelljs" "^0.7.0" - fs-extra "^4.0.0" - handlebars "^4.0.6" - highlight.js "^9.0.0" - lodash "^4.13.1" - marked "^0.3.5" - minimatch "^3.0.0" - progress "^2.0.0" - shelljs "^0.7.0" - typedoc-default-themes "^0.5.0" - typescript "2.4.1" - types-bn@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/types-bn/-/types-bn-0.0.1.tgz#4253c7c7251b14e1d77cdca6f58800e5e2b82c4b" dependencies: bn.js "4.11.7" -typescript@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc" - typescript@2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.1.tgz#bb3682c2c791ac90e7c6210b26478a8da085c359" -- cgit From b4f916d214dd80c11b4cb5db8af9545d5161f97d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 30 Jul 2018 21:09:17 +0200 Subject: Standardize child naming --- packages/monorepo-scripts/src/utils/publish_utils.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 7209fa344..9b5ff378e 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -190,10 +190,21 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: cwd, }); - // For each entry, see if it was exported in index.ts. If not, remove it. + // Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed + // TypeDoc files outside of the packages root path (i.e this package exports another package found in our + // monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add + // it here when necessary. const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); const finalTypeDocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (child, i) => { + if (!_.includes(child.name, '/src/')) { + const nameWithoutQuotes = child.name.replace(/"/g, ''); + finalTypeDocOutput.children[i].name = `"${packageName}/src/${nameWithoutQuotes}"`; + } + }); + + // For each entry, see if it was exported in index.ts. If not, remove it. _.each(typedocOutput.children, (file, i) => { const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); _.each(file.children, (child, j) => { -- cgit From ba00cd916aee451255ece0e5cc354091cc309bc5 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 30 Jul 2018 21:09:56 +0200 Subject: Remove console --- packages/monorepo-scripts/src/utils/publish_utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 9b5ff378e..ff65c779c 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -285,7 +285,6 @@ function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedI function processNode(node: ts.Node): void { switch (node.kind) { case ts.SyntaxKind.ExportDeclaration: - // console.log(node); const exportClause = (node as any).exportClause; const pkgName = exportClause.parent.moduleSpecifier.text; _.each(exportClause.elements, element => { -- cgit From 92fda0a9409b1bbe3b65dd5f94f44bc2c8a26677 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:27:10 +0200 Subject: Remove unused dep so that it's not re-compiled onWatcher --- packages/0x.js/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 16040cf26..a0d4533b3 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -50,7 +50,6 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.4", "@0xproject/dev-utils": "^1.0.3", "@0xproject/migrations": "^1.0.3", "@0xproject/tslint-config": "^1.0.4", -- cgit From 0413e3e77faa8dcc3f428019563f9115c82f67f1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:27:33 +0200 Subject: Change order of index.ts since it not dictates to ordering of the docs --- packages/0x.js/src/index.ts | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 95ca07eea..d99ce68fc 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,33 +1,7 @@ export { ZeroEx } from './0x'; -export { MessagePrefixType, MessagePrefixOpts } from '@0xproject/order-utils'; export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders'; -export { - ExchangeContractErrs, - Order, - SignedOrder, - ECSignature, - OrderStateValid, - OrderStateInvalid, - OrderState, - Token, - ERC20AssetData, - ERC721AssetData, - AssetProxyId, -} from '@0xproject/types'; - -export { - BlockParamLiteral, - FilterObject, - BlockParam, - LogWithDecodedArgs, - ContractEventArg, - Provider, - TransactionReceipt, - TransactionReceiptWithDecodedLogs, -} from 'ethereum-types'; - export { EventCallback, ContractEvent, @@ -64,3 +38,30 @@ export { ContractWrappersConfig, OrderInfo, } from '@0xproject/contract-wrappers'; + +export { MessagePrefixType, MessagePrefixOpts } from '@0xproject/order-utils'; + +export { + ExchangeContractErrs, + Order, + SignedOrder, + ECSignature, + OrderStateValid, + OrderStateInvalid, + OrderState, + Token, + ERC20AssetData, + ERC721AssetData, + AssetProxyId, +} from '@0xproject/types'; + +export { + BlockParamLiteral, + FilterObject, + BlockParam, + LogWithDecodedArgs, + ContractEventArg, + Provider, + TransactionReceipt, + TransactionReceiptWithDecodedLogs, +} from 'ethereum-types'; -- cgit From c5fbc5c9917457be47027002010b0a28cb90f157 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:28:48 +0200 Subject: Also add artifacts to src --- packages/order-utils/package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 21575162c..c49abfdae 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -10,11 +10,12 @@ "scripts": { "watch_without_deps": "yarn pre_build && tsc -w", "build": "run-s pre_build transpile", - "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 generate_contract_wrappers", + "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 copy_artifacts generate_contract_wrappers", "transpile": "tsc", - "generate_contract_wrappers": "abi-gen --abis 'lib/src/artifacts/@(Exchange|IWallet|IValidator|DummyERC20Token|ERC20Proxy|ERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", - "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json lib/src/artifacts; done;", - "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json lib/src/artifacts; done;", + "generate_contract_wrappers": "abi-gen --abis './src/artifacts/@(Exchange|IWallet|IValidator|DummyERC20Token|ERC20Proxy|ERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", + "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", + "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;", + "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "test": "yarn run_mocha", "rebuild_and_test": "run-s build test", "test:circleci": "yarn test:coverage", -- cgit From 9b24459108c826843cfddb377e66327e11b1d85b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:29:24 +0200 Subject: Add /src/artifacts in order-utils to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ef7cc0a3c..77053c958 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,7 @@ packages/order-watcher/test/artifacts/ packages/contract-wrappers/test/artifacts/ packages/contract-wrappers/src/artifacts/ packages/order-watcher/src/artifacts/ +packages/order-utils/src/artifacts/ # generated contract watcher packages/0x.js/src/generated_contract_wrappers/ -- cgit From 11869122b4fe00c834347f9911985d7b2572bc9b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:33:28 +0200 Subject: Update React-scroll, getting rid of the need to manually set the url hash --- packages/react-docs/package.json | 4 ++-- packages/react-docs/src/components/signature.tsx | 2 +- packages/react-docs/src/components/type.tsx | 1 + packages/react-shared/package.json | 4 ++-- packages/react-shared/src/components/anchor_title.tsx | 2 +- .../react-shared/src/components/nested_sidebar_menu.tsx | 17 +++-------------- packages/website/package.json | 4 ++-- 7 files changed, 12 insertions(+), 22 deletions(-) diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index e8db040be..c95051bde 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -41,7 +41,7 @@ "@types/node": "^8.0.53", "@types/react": "*", "@types/react-dom": "*", - "@types/react-scroll": "0.0.31", + "@types/react-scroll": "1.5.3", "basscss": "^8.0.3", "compare-versions": "^3.0.1", "lodash": "^4.17.4", @@ -49,7 +49,7 @@ "react": "15.6.1", "react-dom": "15.6.1", "react-markdown": "^3.2.2", - "react-scroll": "^1.5.2", + "react-scroll": "^1.7.10", "react-tooltip": "^3.2.7", "semver": "5.5.0" }, diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 77e9cc909..5f28050d2 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -27,7 +27,7 @@ const defaultProps = { }; export const Signature: React.SFC = (props: SignatureProps) => { - const sectionName = constants.TYPES_SECTION_NAME; + const sectionName = props.sectionName; const parameters = renderParameters(props.parameters, props.docsInfo, sectionName, props.typeDefinitionByName); const paramStringArray: any[] = []; // HACK: For now we don't put params on newlines if there are less then 2 of them. diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index e453349ef..04fcd9998 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -182,6 +182,7 @@ export function Type(props: TypeProps): any { diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 6b4501e83..9f4cfd624 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -39,7 +39,7 @@ "@types/node": "^8.0.53", "@types/react": "*", "@types/react-dom": "*", - "@types/react-scroll": "0.0.31", + "@types/react-scroll": "1.5.3", "basscss": "^8.0.3", "is-mobile": "^0.2.2", "lodash": "^4.17.4", @@ -48,7 +48,7 @@ "react-dom": "15.6.1", "react-highlight": "0xproject/react-highlight", "react-markdown": "^3.2.2", - "react-scroll": "^1.5.2", + "react-scroll": "^1.7.10", "react-tap-event-plugin": "^2.0.1" }, "publishConfig": { diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 473b994bf..451ba1729 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,13 +69,13 @@ export class AnchorTitle extends React.Component - + {finalMenuItemName} @@ -128,12 +125,11 @@ export class NestedSidebarMenu extends React.Component ); } - private _onMenuItemClick(name: string): void { - const id = utils.getIdFromName(name); - utils.setUrlHash(id); - if (!_.isUndefined(this.props.onMenuItemClick)) { - this.props.onMenuItemClick(); - } - } } diff --git a/packages/website/package.json b/packages/website/package.json index 12c729308..ef420ab07 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -49,7 +49,7 @@ "react-popper": "^1.0.0-beta.6", "react-redux": "^5.0.3", "react-router-dom": "^4.1.1", - "react-scroll": "^1.5.2", + "react-scroll": "^1.7.10", "react-tap-event-plugin": "^2.0.1", "react-tooltip": "^3.2.7", "redux": "^3.6.0", @@ -77,7 +77,7 @@ "@types/react-dom": "^16.0.3", "@types/react-redux": "^4.4.37", "@types/react-router-dom": "^4.0.4", - "@types/react-scroll": "0.0.31", + "@types/react-scroll": "1.5.3", "@types/react-tap-event-plugin": "0.0.30", "@types/redux": "^3.6.0", "awesome-typescript-loader": "^3.1.3", -- cgit From 3bdf6004ca74dd9eb380aa61cf9e69c47725116a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:36:37 +0200 Subject: Start refactoring docs to remove unnecessary configs given more concise TypeDoc JSON --- .../monorepo-scripts/src/utils/publish_utils.ts | 68 ++++++-- packages/react-docs-example/ts/docs.tsx | 25 --- .../react-docs/src/components/documentation.tsx | 44 +++--- .../react-docs/src/components/property_block.tsx | 70 +++++++++ packages/react-docs/src/components/type.tsx | 29 +--- .../react-docs/src/components/type_definition.tsx | 3 - packages/react-docs/src/docs_info.ts | 56 ++----- packages/react-docs/src/index.ts | 10 +- packages/react-docs/src/types.ts | 19 ++- packages/react-docs/src/utils/typedoc_utils.ts | 135 ++++++++-------- .../website/ts/containers/connect_documentation.ts | 30 ---- .../ts/containers/ethereum_types_documentation.ts | 52 ------- .../ts/containers/json_schemas_documentation.ts | 8 - .../ts/containers/order_utils_documentation.ts | 25 --- .../ts/containers/smart_contracts_documentation.ts | 1 - .../ts/containers/sol_compiler_documentation.ts | 9 -- .../website/ts/containers/sol_cov_documentation.ts | 32 ---- .../ts/containers/subproviders_documentation.ts | 47 ------ .../ts/containers/web3_wrapper_documentation.ts | 47 ------ .../ts/containers/zero_ex_js_documentation.ts | 172 --------------------- .../website/ts/pages/documentation/doc_page.tsx | 2 +- packages/website/ts/utils/doc_utils.ts | 4 +- yarn.lock | 12 +- 23 files changed, 272 insertions(+), 628 deletions(-) create mode 100644 packages/react-docs/src/components/property_block.tsx diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index ff65c779c..01d44a369 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -13,6 +13,20 @@ import * as ts from 'typescript'; import { ExportPathToExportedItems } from '../types'; +interface ExportInfo { + exportPathToExportedItems: ExportPathToExportedItems; + exportPathOrder: string[]; +} + +interface ExportNameToTypedocName { + [exportName: string]: string; +} + +interface Metadata { + exportPathToTypedocName: ExportNameToTypedocName; + exportPathOrder: string[]; +} + const publishReleaseAsync = promisify(publishRelease); export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) @@ -107,7 +121,7 @@ function getReleaseNotesForPackage(packageName: string, version: string): string export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; const indexPath = `${pathToPackage}/src/index.ts`; - const exportPathToExportedItems = getExportPathToExportedItems(indexPath); + const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath); const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const pkg = _.find(monorepoPackages, monorepoPackage => { @@ -151,7 +165,8 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const typeDocSourceIncludes = new Set(); const pathToIndex = `${pathIfExists}/src/index.ts`; - const innerExportPathToExportedItems = getExportPathToExportedItems(pathToIndex); + const exportInfo = getExportPathToExportedItems(pathToIndex); + const innerExportPathToExportedItems = exportInfo.exportPathToExportedItems; _.each(exportedItems, exportName => { _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { if (!_.includes(innerExportItems, exportName)) { @@ -200,13 +215,18 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: _.each(typedocOutput.children, (child, i) => { if (!_.includes(child.name, '/src/')) { const nameWithoutQuotes = child.name.replace(/"/g, ''); - finalTypeDocOutput.children[i].name = `"${packageName}/src/${nameWithoutQuotes}"`; + const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; + finalTypeDocOutput.children[i].name = standardizedName; } }); // For each entry, see if it was exported in index.ts. If not, remove it. + const exportPathToTypedocName: ExportNameToTypedocName = {}; _.each(typedocOutput.children, (file, i) => { - const exportItems = findExportItemsGivenTypedocName(exportPathToExportedItems, packageName, file.name); + const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); + exportPathToTypedocName[exportPath] = file.name; + + const exportItems = exportPathToExportedItems[exportPath]; _.each(file.children, (child, j) => { if (!_.includes(exportItems, child.name)) { delete finalTypeDocOutput.children[i].children[j]; @@ -214,8 +234,22 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); }); + + // TODO: Add extra metadata for Class properties that are class instances + // Look in file for imports of that class, get the import name and construct a link to + // it's definition on another docs page. + + // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON + const docJson = { + metadata: { + exportPathToTypedocName, + exportPathOrder, + }, + typedocJson: finalTypeDocOutput, + }; + // Write modified TypeDoc JSON, without all the unexported stuff - writeFileSync(jsonFilePath, JSON.stringify(finalTypeDocOutput, null, 2)); + writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); const fileName = `v${packageJson.version}.json`; utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); @@ -234,11 +268,11 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); } -function findExportItemsGivenTypedocName( +function findExportPathGivenTypedocName( exportPathToExportedItems: ExportPathToExportedItems, packageName: string, typedocName: string, -): string[] { +): string { const typeDocNameWithoutQuotes = _.replace(typedocName, '"', ''); const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; const exportPaths = _.keys(exportPathToExportedItems); @@ -264,22 +298,23 @@ function findExportItemsGivenTypedocName( throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); } const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; - return exportPathToExportedItems[matchingExportPath]; + return matchingExportPath; } -function getExportPathToExportedItems(pkgPath: string): ExportPathToExportedItems { +function getExportPathToExportedItems(filePath: string): ExportInfo { const sourceFile = ts.createSourceFile( 'indexFile', - readFileSync(pkgPath).toString(), + readFileSync(filePath).toString(), ts.ScriptTarget.ES2017, /*setParentNodes */ true, ); - const exportPathToExportedItems = _getExportPathToExportedItems(sourceFile); - return exportPathToExportedItems; + const exportInfo = _getExportPathToExportedItems(sourceFile); + return exportInfo; } -function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedItems { +function _getExportPathToExportedItems(sf: ts.SourceFile): ExportInfo { const exportPathToExportedItems: ExportPathToExportedItems = {}; + const exportPathOrder: string[] = []; processNode(sf); function processNode(node: ts.Node): void { @@ -287,6 +322,7 @@ function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedI case ts.SyntaxKind.ExportDeclaration: const exportClause = (node as any).exportClause; const pkgName = exportClause.parent.moduleSpecifier.text; + exportPathOrder.push(pkgName); _.each(exportClause.elements, element => { exportPathToExportedItems[pkgName] = _.isUndefined(exportPathToExportedItems[pkgName]) ? [element.name.escapedText] @@ -301,5 +337,9 @@ function _getExportPathToExportedItems(sf: ts.SourceFile): ExportPathToExportedI ts.forEachChild(node, processNode); } - return exportPathToExportedItems; + const exportInfo = { + exportPathToExportedItems, + exportPathOrder, + }; + return exportInfo; } diff --git a/packages/react-docs-example/ts/docs.tsx b/packages/react-docs-example/ts/docs.tsx index bb605806f..9ac94bd00 100644 --- a/packages/react-docs-example/ts/docs.tsx +++ b/packages/react-docs-example/ts/docs.tsx @@ -32,33 +32,8 @@ const docsInfoConfig: DocsInfoConfig = { web3Wrapper: [docSections.web3Wrapper], types: [docSections.types], }, - sectionNameToMarkdownByVersion: { - '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - }, - }, - sectionNameToModulePath: { - [docSections.web3Wrapper]: ['"web3-wrapper/src/index"'], - [docSections.types]: ['"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [docSections.web3Wrapper], 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: [ - 'TxData', - 'TransactionReceipt', - 'RawLogEntry', - 'BlockParam', - 'ContractAbi', - 'FilterObject', - 'LogEntry', - 'BlockWithoutTransactionData', - 'CallData', - 'LogEntryEvent', - ], typeNameToExternalLink: { Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API', Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150', diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index ff33220d2..4f776b237 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -1,7 +1,9 @@ import { + AnchorTitle, colors, constants as sharedConstants, EtherscanLinkSuffixes, + HeaderSizes, MarkdownSection, NestedSidebarMenu, Networks, @@ -32,8 +34,7 @@ import { Badge } from './badge'; import { Comment } from './comment'; import { EventDefinition } from './event_definition'; import { SignatureBlock } from './signature_block'; -import { SourceLink } from './source_link'; -import { Type } from './type'; +import { PropertyBlock } from './property_block'; import { TypeDefinition } from './type_definition'; const networkNameToColor: { [network: string]: string } = { @@ -129,7 +130,7 @@ export class Documentation extends React.Component @@ -172,7 +173,7 @@ export class Documentation extends React.Component {docSection.comment && } - {!_.isEmpty(docSection.constructors) && - this.props.docsInfo.isVisibleConstructor(sectionName) && ( -
-

Constructor

- {this._renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)} -
- )} + {!_.isEmpty(docSection.constructors) && ( +
+

Constructor

+ {this._renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)} +
+ )} {!_.isEmpty(docSection.properties) && (

Properties

@@ -345,20 +345,14 @@ export class Documentation extends React.Component - - {property.name}:{' '} - - - {property.source && ( - - )} - {property.comment && } -
+ ); } private _renderSignatureBlocks( diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx new file mode 100644 index 000000000..6e7f90c6c --- /dev/null +++ b/packages/react-docs/src/components/property_block.tsx @@ -0,0 +1,70 @@ +import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared'; +import * as React from 'react'; + +import { DocsInfo } from '../docs_info'; +import { Property } from '../types'; +import { constants } from '../utils/constants'; + +import { Comment } from './comment'; +import { Type } from './type'; +import { SourceLink } from './source_link'; + +export interface PropertyBlockProps { + property: Property; + sectionName: string; + docsInfo: DocsInfo; + sourceUrl: string; + selectedVersion: string; +} + +export interface PropertyBlockState { + shouldShowAnchor: boolean; +} + +export class PropertyBlock extends React.Component { + constructor(props: PropertyBlockProps) { + super(props); + this.state = { + shouldShowAnchor: false, + }; + } + public render(): React.ReactNode { + const property = this.props.property; + const sectionName = this.props.sectionName; + return ( +
+
+ +
+ + {property.name}:{' '} + + + {property.source && ( + + )} + {property.comment && } +
+ ); + } + private _setAnchorVisibility(shouldShowAnchor: boolean): void { + this.setState({ + shouldShowAnchor, + }); + } +} diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 04fcd9998..3504be303 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -9,6 +9,7 @@ import { DocsInfo } from '../docs_info'; import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types'; import { Signature } from './signature'; +import { constants } from '../utils/constants'; import { TypeDefinition } from './type_definition'; export interface TypeProps { @@ -43,7 +44,7 @@ export function Type(props: TypeProps): any { - {_.isUndefined(typeDefinition) || sharedUtils.isUserOnMobile() ? ( - - {typeName} - + {sharedUtils.isUserOnMobile() ? ( + {typeName} ) : ( { - const versionIntroducedIfExists = this._docsInfo.menuSubsectionToVersionWhenIntroduced[contractName]; - if (!_.isUndefined(versionIntroducedIfExists)) { - const doesExistInSelectedVersion = compareVersions(selectedVersion, versionIntroducedIfExists) >= 0; - return doesExistInSelectedVersion; - } else { - return true; - } - }); - return finalMenu; + return this._docsInfo.menu; } public getMenuSubsectionsBySection(docAgnosticFormat?: DocAgnosticFormat): MenuSubsectionsBySection { const menuSubsectionsBySection = {} as MenuSubsectionsBySection; @@ -96,12 +67,18 @@ export class DocsInfo { const sortedEventNames = _.sortBy(docSection.events, 'name'); eventNames = _.map(sortedEventNames, m => m.name); } - const sortedMethodNames = _.sortBy(docSection.methods, 'name'); - const methodNames = _.map(sortedMethodNames, m => m.name); - menuSubsectionsBySection[sectionName] = [...methodNames, ...eventNames]; + const propertiesSortedByName = _.sortBy(docSection.properties, 'name'); + const propertyNames = _.map(propertiesSortedByName, m => m.name); + const methodsSortedByName = _.sortBy(docSection.methods, 'name'); + const methodNames = _.map(methodsSortedByName, m => m.name); const sortedFunctionNames = _.sortBy(docSection.functions, 'name'); const functionNames = _.map(sortedFunctionNames, m => m.name); - menuSubsectionsBySection[sectionName] = [...eventNames, ...functionNames, ...methodNames]; + menuSubsectionsBySection[sectionName] = [ + ...eventNames, + ...propertyNames, + ...functionNames, + ...methodNames, + ]; } }); return menuSubsectionsBySection; @@ -115,14 +92,11 @@ export class DocsInfo { const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any; return typeDefinitionByName; } - public isVisibleConstructor(sectionName: string): boolean { - return _.includes(this._docsInfo.visibleConstructors, sectionName); - } - public convertToDocAgnosticFormat(docObj: DoxityDocObj | TypeDocNode): DocAgnosticFormat { + public convertToDocAgnosticFormat(docObj: DoxityDocObj | GeneratedDocJson): DocAgnosticFormat { if (this.type === SupportedDocJson.Doxity) { return doxityUtils.convertToDocAgnosticFormat(docObj as DoxityDocObj); } else { - return typeDocUtils.convertToDocAgnosticFormat(docObj as TypeDocNode, this); + return typeDocUtils.convertToDocAgnosticFormat(docObj as GeneratedDocJson, this); } } } diff --git a/packages/react-docs/src/index.ts b/packages/react-docs/src/index.ts index 30f5011b7..e4424f679 100644 --- a/packages/react-docs/src/index.ts +++ b/packages/react-docs/src/index.ts @@ -15,6 +15,14 @@ export { Type } from './components/type'; export { DocsInfo } from './docs_info'; -export { DocsInfoConfig, DocAgnosticFormat, DoxityDocObj, DocsMenu, SupportedDocJson, TypeDocNode } from './types'; +export { + DocsInfoConfig, + DocAgnosticFormat, + DoxityDocObj, + DocsMenu, + SupportedDocJson, + TypeDocNode, + GeneratedDocJson, +} from './types'; export { constants } from './utils/constants'; diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index cbc774c2e..83ad157d1 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -10,18 +10,13 @@ export interface DocsInfoConfig { menu: DocsMenu; sections: SectionsMap; sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion; - visibleConstructors: string[]; - sectionNameToModulePath?: { [sectionName: string]: string[] }; - menuSubsectionToVersionWhenIntroduced?: { [sectionName: string]: string }; contractsByVersionByNetworkId?: ContractsByVersionByNetworkId; typeConfigs?: DocsInfoTypeConfigs; } export interface DocsInfoTypeConfigs { typeNameToExternalLink?: { [typeName: string]: string }; - publicTypes?: string[]; typeNameToPrefix?: { [typeName: string]: string }; - typeNameToDocSection?: { [typeName: string]: string }; } export interface DocsMenu { @@ -292,3 +287,17 @@ export enum AbiTypes { Function = 'function', Event = 'event', } + +export interface ExportNameToTypedocName { + [exportName: string]: string; +} + +export interface Metadata { + exportPathToTypedocName: ExportNameToTypedocName; + exportPathOrder: string[]; +} + +export interface GeneratedDocJson { + metadata: Metadata; + typedocJson: TypeDocNode; +} diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index a6d938e94..1e7c29ce8 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -19,8 +19,11 @@ import { TypeParameter, TypescriptFunction, TypescriptMethod, + GeneratedDocJson, } from '../types'; +import { constants } from './constants'; + export const typeDocUtils = { isType(entity: TypeDocNode): boolean { return ( @@ -55,62 +58,68 @@ export const typeDocUtils = { }); return moduleDefinitions; }, - convertToDocAgnosticFormat(typeDocJson: TypeDocNode, docsInfo: DocsInfo): DocAgnosticFormat { - const subMenus = _.values(docsInfo.getMenu()); - const orderedSectionNames = _.flatten(subMenus); + convertToDocAgnosticFormat(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo): DocAgnosticFormat { + const exportPathOrder = generatedDocJson.metadata.exportPathOrder; + const exportPathToTypedocName = generatedDocJson.metadata.exportPathToTypedocName; + const typeDocJson = generatedDocJson.typedocJson; + + const typeDocNameOrder = _.map(exportPathOrder, exportPath => { + return exportPathToTypedocName[exportPath]; + }); + const docAgnosticFormat: DocAgnosticFormat = {}; - _.each(orderedSectionNames, sectionName => { - const modulePathsIfExists = docsInfo.getModulePathsIfExists(sectionName); - if (_.isUndefined(modulePathsIfExists)) { - return; // no-op - } - const packageDefinitions = typeDocUtils.getModuleDefinitionsBySectionName(typeDocJson, modulePathsIfExists); - let packageDefinitionWithMergedChildren; - if (_.isEmpty(packageDefinitions)) { - return; // no-op - } else if (packageDefinitions.length === 1) { - packageDefinitionWithMergedChildren = packageDefinitions[0]; - } else { - // HACK: For now, if there are two modules to display in a single section, - // we simply concat the children. This works for our limited use-case where - // we want to display types stored in two files under a single section - packageDefinitionWithMergedChildren = packageDefinitions[0]; - for (let i = 1; i < packageDefinitions.length; i++) { - packageDefinitionWithMergedChildren.children = [ - ...packageDefinitionWithMergedChildren.children, - ...packageDefinitions[i].children, - ]; + const typeEntities: TypeDocNode[] = []; + _.each(typeDocNameOrder, typeDocName => { + const fileChildIndex = _.findIndex(typeDocJson.children, child => child.name === typeDocName); + const fileChild = typeDocJson.children[fileChildIndex]; + let sectionName: string; + _.each(fileChild.children, (child, j) => { + switch (child.kindString) { + case KindString.Class: + case KindString.ObjectLiteral: { + sectionName = child.name; + docsInfo.sections[sectionName] = sectionName; + docsInfo.menu[sectionName] = [sectionName]; + const entities = child.children; + const commentObj = child.comment; + const sectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; + const docSection = typeDocUtils._convertEntitiesToDocSection(entities, docsInfo, sectionName); + docSection.comment = sectionComment; + docAgnosticFormat[sectionName] = docSection; + break; + } + case KindString.Function: { + sectionName = child.name; + docsInfo.sections[sectionName] = sectionName; + docsInfo.menu[sectionName] = [sectionName]; + const entities = [child]; + const commentObj = child.comment; + const SectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; + const docSection = typeDocUtils._convertEntitiesToDocSection(entities, docsInfo, sectionName); + docSection.comment = SectionComment; + docAgnosticFormat[sectionName] = docSection; + break; + } + case KindString.Interface: + case KindString.Variable: + case KindString.Enumeration: + case KindString.TypeAlias: + typeEntities.push(child); + break; + default: + throw errorUtils.spawnSwitchErr('kindString', child.kindString); } - } - - let entities; - let packageComment = ''; - // HACK: We assume 1 exported class per file - const classChildren = _.filter(packageDefinitionWithMergedChildren.children, (child: TypeDocNode) => { - return child.kindString === KindString.Class; }); - if (classChildren.length > 1 && sectionName !== 'types') { - throw new Error('`react-docs` only supports projects with 1 exported class per file'); - } - const isClassExport = packageDefinitionWithMergedChildren.children[0].kindString === KindString.Class; - const isObjectLiteralExport = - packageDefinitionWithMergedChildren.children[0].kindString === KindString.ObjectLiteral; - if (isClassExport) { - entities = packageDefinitionWithMergedChildren.children[0].children; - const commentObj = packageDefinitionWithMergedChildren.children[0].comment; - packageComment = !_.isUndefined(commentObj) ? commentObj.shortText : packageComment; - } else if (isObjectLiteralExport) { - entities = packageDefinitionWithMergedChildren.children[0].children; - const commentObj = packageDefinitionWithMergedChildren.children[0].comment; - packageComment = !_.isUndefined(commentObj) ? commentObj.shortText : packageComment; - } else { - entities = packageDefinitionWithMergedChildren.children; - } - - const docSection = typeDocUtils._convertEntitiesToDocSection(entities, docsInfo, sectionName); - docSection.comment = packageComment; - docAgnosticFormat[sectionName] = docSection; }); + docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; + docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; + const docSection = typeDocUtils._convertEntitiesToDocSection( + typeEntities, + docsInfo, + constants.TYPES_SECTION_NAME, + ); + docAgnosticFormat[constants.TYPES_SECTION_NAME] = docSection; + return docAgnosticFormat; }, _convertEntitiesToDocSection(entities: TypeDocNode[], docsInfo: DocsInfo, sectionName: string): DocSection { @@ -175,18 +184,16 @@ export const typeDocUtils = { case KindString.Variable: case KindString.Enumeration: case KindString.TypeAlias: - if (docsInfo.isPublicType(entity.name)) { - const customType = typeDocUtils._convertCustomType( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - ); - const seenTypeNames = _.map(docSection.types, t => t.name); - const isUnseen = !_.includes(seenTypeNames, customType.name); - if (isUnseen) { - docSection.types.push(customType); - } + const customType = typeDocUtils._convertCustomType( + entity, + docsInfo.sections, + sectionName, + docsInfo.id, + ); + const seenTypeNames = _.map(docSection.types, t => t.name); + const isUnseen = !_.includes(seenTypeNames, customType.name); + if (isUnseen) { + docSection.types.push(customType); } break; diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index abf419347..74464e650 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -40,42 +40,12 @@ const docsInfoConfig: DocsInfoConfig = { [connectDocSections.installation]: InstallationMarkdownV1, }, }, - sectionNameToModulePath: { - [connectDocSections.httpClient]: ['"src/http_client"'], - [connectDocSections.webSocketOrderbookChannel]: ['"src/ws_orderbook_channel"'], - [connectDocSections.types]: ['"src/types"', '"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: connectDocSections, - visibleConstructors: [connectDocSections.httpClient, connectDocSections.webSocketOrderbookChannel], typeConfigs: { typeNameToExternalLink: { Provider: constants.URL_WEB3_PROVIDER_DOCS, BigNumber: constants.URL_BIGNUMBERJS_GITHUB, }, - // 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: [ - 'Client', - 'FeesRequest', - 'FeesResponse', - 'OrderbookChannel', - 'OrderbookChannelHandler', - 'OrderbookChannelSubscriptionOpts', - 'OrderbookRequest', - 'OrderbookResponse', - 'OrdersRequest', - 'OrdersRequestOpts', - 'PagedRequestOpts', - 'TokenPairsItem', - 'TokenPairsRequest', - 'TokenPairsRequestOpts', - 'TokenTradeInfo', - 'WebSocketOrderbookChannelConfig', - 'Order', - 'SignedOrder', - 'ECSignature', - ], }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts index 0be8dd3bc..041a6bea3 100644 --- a/packages/website/ts/containers/ethereum_types_documentation.ts +++ b/packages/website/ts/containers/ethereum_types_documentation.ts @@ -36,60 +36,8 @@ const docsInfoConfig: DocsInfoConfig = { [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, }, diff --git a/packages/website/ts/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts index 523777114..3ecc0f312 100644 --- a/packages/website/ts/containers/json_schemas_documentation.ts +++ b/packages/website/ts/containers/json_schemas_documentation.ts @@ -43,16 +43,8 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.usage]: UsageMarkdownV1, }, }, - sectionNameToModulePath: { - [docSections.schemaValidator]: ['"json-schemas/src/schema_validator"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [docSections.schemaValidator], 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: [], typeNameToExternalLink: { Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', diff --git a/packages/website/ts/containers/order_utils_documentation.ts b/packages/website/ts/containers/order_utils_documentation.ts index c6570f514..29cbf9501 100644 --- a/packages/website/ts/containers/order_utils_documentation.ts +++ b/packages/website/ts/containers/order_utils_documentation.ts @@ -38,33 +38,8 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.installation]: InstallationMarkdownV1, }, }, - sectionNameToModulePath: { - [docSections.usage]: [ - '"order-utils/src/order_hash"', - '"order-utils/src/signature_utils"', - '"order-utils/src/order_factory"', - '"order-utils/src/salt"', - '"order-utils/src/assert"', - '"order-utils/src/constants"', - ], - [docSections.types]: ['"order-utils/src/types"', '"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [], 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: [ - 'OrderError', - 'Order', - 'SignedOrder', - 'ECSignature', - 'Provider', - 'JSONRPCRequestPayload', - 'JSONRPCResponsePayload', - 'JSONRPCErrorCallback', - ], typeNameToExternalLink: { BigNumber: constants.URL_BIGNUMBERJS_GITHUB, }, diff --git a/packages/website/ts/containers/smart_contracts_documentation.ts b/packages/website/ts/containers/smart_contracts_documentation.ts index b0a712477..e3a1bd7a6 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.ts +++ b/packages/website/ts/containers/smart_contracts_documentation.ts @@ -34,7 +34,6 @@ const docsInfoConfig: DocsInfoConfig = { TokenRegistry: Sections.TokenRegistry, ZRXToken: Sections.ZRXToken, }, - visibleConstructors: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy], contractsByVersionByNetworkId: { '1.0.0': { [Networks.Mainnet]: { diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index b289c8f34..bd6a85c83 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -41,17 +41,8 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.usage]: UsageMarkdown, }, }, - sectionNameToModulePath: { - [docSections.compiler]: ['"sol-compiler/src/compiler"'], - [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [docSections.compiler], 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: ['CompilerOptions'], typeNameToExternalLink: {}, typeNameToPrefix: {}, }, diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index d78c450ed..5567eb97e 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -47,42 +47,10 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.usage]: UsageMarkdown, }, }, - sectionNameToModulePath: { - [docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'], - [docSections.abstractArtifactAdapter]: ['"sol-cov/src/artifact_adapters/abstract_artifact_adapter"'], - [docSections.solCompilerArtifactAdapter]: ['"sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter"'], - [docSections.truffleArtifactAdapter]: ['"sol-cov/src/artifact_adapters/truffle_artifact_adapter"'], - [docSections.types]: ['"subproviders/src/types"', '"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [ - docSections.coverageSubprovider, - docSections.abstractArtifactAdapter, - docSections.solCompilerArtifactAdapter, - docSections.truffleArtifactAdapter, - ], 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: [ - 'JSONRPCRequestPayload', - 'NextCallback', - 'ErrorCallback', - 'AbstractArtifactAdapter', - 'CoverageSubprovider', - 'TruffleArtifactAdapter', - 'SolCompilerArtifactAdapter', - 'ContractData', - ], typeNameToExternalLink: {}, typeNameToPrefix: {}, - typeNameToDocSection: { - AbstractArtifactAdapter: docSections.abstractArtifactAdapter, - CoverageSubprovider: docSections.coverageSubprovider, - TruffleArtifactAdapter: docSections.truffleArtifactAdapter, - SolCompilerArtifactAdapter: docSections.solCompilerArtifactAdapter, - }, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 0e9150d7b..76c71902e 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -64,55 +64,8 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.ledgerNodeHid]: LedgerNodeHidMarkdown, }, }, - sectionNameToModulePath: { - [docSections.subprovider]: ['"subproviders/src/subproviders/subprovider"'], - [docSections.ledgerSubprovider]: ['"subproviders/src/subproviders/ledger"'], - [docSections.privateKeyWalletSubprovider]: ['"subproviders/src/subproviders/private_key_wallet"'], - [docSections.mnemonicWalletSubprovider]: ['"subproviders/src/subproviders/mnemonic_wallet"'], - [docSections.factoryMethods]: ['"subproviders/src/index"'], - [docSections.emptyWalletSubprovider]: ['"subproviders/src/subproviders/empty_wallet_subprovider"'], - [docSections.fakeGasEstimateSubprovider]: ['"subproviders/src/subproviders/fake_gas_estimate_subprovider"'], - [docSections.injectedWeb3Subprovider]: ['"subproviders/src/subproviders/injected_web3"'], - [docSections.signerSubprovider]: ['"subproviders/src/subproviders/signer"'], - [docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'], - [docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'], - [docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'], - [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [ - docSections.subprovider, - docSections.ledgerSubprovider, - docSections.privateKeyWalletSubprovider, - docSections.mnemonicWalletSubprovider, - docSections.emptyWalletSubprovider, - docSections.fakeGasEstimateSubprovider, - docSections.injectedWeb3Subprovider, - docSections.redundantRPCSubprovider, - docSections.ganacheSubprovider, - docSections.nonceTrackerSubprovider, - ], 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: [ - 'Callback', - 'NextCallback', - 'ErrorCallback', - 'ECSignature', - 'JSONRPCRequestPayloadWithMethod', - 'JSONRPCRequestPayload', - 'JSONRPCResponsePayload', - 'AccountFetchingConfigs', - 'LedgerEthereumClientFactoryAsync', - 'PartialTxParams', - 'LedgerEthereumClient', - 'LedgerSubproviderConfigs', - 'MnemonicWalletSubproviderConfigs', - 'OnNextCompleted', - 'Provider', - ], typeNameToExternalLink: { Web3: constants.URL_WEB3_DOCS, BigNumber: constants.URL_BIGNUMBERJS_GITHUB, diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index 8d98d9476..1a4101f5d 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -38,60 +38,13 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.installation]: InstallationMarkdownV1, }, }, - sectionNameToModulePath: { - [docSections.web3Wrapper]: ['"web3-wrapper/src/web3_wrapper"'], - [docSections.types]: ['"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, - visibleConstructors: [docSections.web3Wrapper], 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: [ - 'TxData', - 'TransactionReceipt', - 'RawLogEntry', - 'ContractAbi', - 'BlockParam', - 'FilterObject', - 'LogEntry', - 'BlockWithoutTransactionData', - 'CallData', - 'LogEntryEvent', - 'Provider', - 'AbiDefinition', - 'LogTopic', - 'JSONRPCRequestPayload', - 'JSONRPCResponsePayload', - 'BlockParamLiteral', - 'FunctionAbi', - 'EventAbi', - 'JSONRPCErrorCallback', - 'MethodAbi', - 'ConstructorAbi', - 'FallbackAbi', - 'EventParameter', - 'DataItem', - 'StateMutability', - 'Function', - 'Fallback', - 'Constructor', - 'Event', - 'ConstructorStateMutability', - 'TransactionReceiptWithDecodedLogs', - 'DecodedLogArgs', - 'LogWithDecodedArgs', - 'ContractEventArg', - ], typeNameToExternalLink: { Web3: constants.URL_WEB3_DOCS, BigNumber: constants.URL_BIGNUMBERJS_GITHUB, }, typeNameToPrefix: {}, - typeNameToDocSection: { - Web3Wrapper: docSections.web3Wrapper, - }, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 6be54595d..3b706f262 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -27,14 +27,6 @@ const zeroExJsDocSections = { async: 'async', errors: 'errors', versioning: 'versioning', - zeroEx: 'zeroEx', - exchange: 'exchange', - token: 'token', - tokenRegistry: 'tokenRegistry', - etherToken: 'etherToken', - proxy: 'proxy', - orderWatcher: 'orderWatcher', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -46,16 +38,6 @@ const docsInfoConfig: DocsInfoConfig = { introduction: [zeroExJsDocSections.introduction], install: [zeroExJsDocSections.installation], topics: [zeroExJsDocSections.async, zeroExJsDocSections.errors, zeroExJsDocSections.versioning], - zeroEx: [zeroExJsDocSections.zeroEx], - contracts: [ - zeroExJsDocSections.exchange, - zeroExJsDocSections.token, - zeroExJsDocSections.tokenRegistry, - zeroExJsDocSections.etherToken, - zeroExJsDocSections.proxy, - ], - orderWatcher: [zeroExJsDocSections.orderWatcher], - types: [zeroExJsDocSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { @@ -74,166 +56,12 @@ const docsInfoConfig: DocsInfoConfig = { [zeroExJsDocSections.errors]: ErrorsMarkdownV1, }, }, - sectionNameToModulePath: { - [zeroExJsDocSections.zeroEx]: ['"0x.js/src/0x"', '"src/0x"'], - [zeroExJsDocSections.exchange]: [ - '"0x.js/src/contract_wrappers/exchange_wrapper"', - '"src/contract_wrappers/exchange_wrapper"', - '"contract-wrappers/src/contract_wrappers/exchange_wrapper"', - ], - [zeroExJsDocSections.tokenRegistry]: [ - '"0x.js/src/contract_wrappers/token_registry_wrapper"', - '"src/contract_wrappers/token_registry_wrapper"', - '"contract-wrappers/src/contract_wrappers/token_registry_wrapper"', - ], - [zeroExJsDocSections.token]: [ - '"0x.js/src/contract_wrappers/token_wrapper"', - '"src/contract_wrappers/token_wrapper"', - '"contract-wrappers/src/contract_wrappers/token_wrapper"', - ], - [zeroExJsDocSections.etherToken]: [ - '"0x.js/src/contract_wrappers/ether_token_wrapper"', - '"src/contract_wrappers/ether_token_wrapper"', - '"contract-wrappers/src/contract_wrappers/ether_token_wrapper"', - ], - [zeroExJsDocSections.proxy]: [ - '"0x.js/src/contract_wrappers/proxy_wrapper"', - '"0x.js/src/contract_wrappers/token_transfer_proxy_wrapper"', - '"contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper"', - ], - [zeroExJsDocSections.orderWatcher]: [ - '"0x.js/src/order_watcher/order_state_watcher"', - '"src/order_watcher/order_state_watcher"', - '"order-watcher/src/order_watcher/order_watcher"', - ], - [zeroExJsDocSections.types]: [ - '"0x.js/src/types"', - '"src/types"', - '"types/src/index"', - '"contract-wrappers/src/types"', - '"0x.js/src/contract_wrappers/generated/ether_token"', - '"0x.js/src/contract_wrappers/generated/token"', - '"0x.js/src/contract_wrappers/generated/exchange"', - '"0x.js/src/generated_contract_wrappers/ether_token"', - '"0x.js/src/generated_contract_wrappers/token"', - '"0x.js/src/generated_contract_wrappers/exchange"', - ], - }, - menuSubsectionToVersionWhenIntroduced: { - [zeroExJsDocSections.etherToken]: '0.7.1', - [zeroExJsDocSections.proxy]: '0.8.0', - [zeroExJsDocSections.orderWatcher]: '0.27.1', - }, sections: zeroExJsDocSections, - visibleConstructors: [zeroExJsDocSections.zeroEx], 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 :( Make sure to only - // ADD types here, DO NOT REMOVE types since they might still be needed for older supported versions - publicTypes: [ - 'Order', - 'SignedOrder', - 'ECSignature', - 'ContractWrappersError', - 'EventCallback', - 'EventCallbackAsync', - 'EventCallbackSync', - 'ExchangeContractErrs', - 'ContractEvent', - 'Token', - 'Provider', - 'ExchangeEvents', - 'IndexedFilterValues', - 'SubscriptionOpts', - 'BlockRange', - 'BlockParam', - 'OrderFillOrKillRequest', - 'OrderCancellationRequest', - 'OrderFillRequest', - 'ContractEventEmitter', - 'Web3Provider', - 'ContractEventArgs', - 'LogCancelArgs', - 'LogFillArgs', - 'LogErrorContractEventArgs', - 'LogFillContractEventArgs', - 'LogCancelContractEventArgs', - 'EtherTokenContractEventArgs', - 'WithdrawalContractEventArgs', - 'DepositContractEventArgs', - 'TokenEvents', - 'ExchangeContractEventArgs', - 'TransferContractEventArgs', - 'ApprovalContractEventArgs', - 'TokenContractEventArgs', - 'ZeroExConfig', - 'TransactionReceipt', - 'TransactionReceiptWithDecodedLogs', - 'LogWithDecodedArgs', - 'EtherTokenEvents', - 'BlockParamLiteral', - 'DecodedLogArgs', - 'MethodOpts', - 'ValidateOrderFillableOpts', - 'OrderTransactionOpts', - 'TransactionOpts', - 'ContractEventArg', - 'LogEvent', - 'DecodedLogEvent', - 'EventWatcherCallback', - 'OnOrderStateChangeCallback', - 'OrderStateValid', - 'OrderStateInvalid', - 'OrderState', - 'OrderStateWatcherConfig', - 'OrderWatcherConfig', - 'FilterObject', - 'OrderRelevantState', - 'JSONRPCRequestPayload', - 'JSONRPCResponsePayload', - 'JSONRPCErrorCallback', - 'LogEntryEvent', - 'LogEntry', - 'ERC20AssetData', - 'ERC721AssetData', - 'AssetProxyId', - 'WETH9Events', - 'WETH9WithdrawalEventArgs', - 'WETH9ApprovalEventArgs', - 'WETH9EventArgs', - 'WETH9DepositEventArgs', - 'WETH9TransferEventArgs', - 'ERC20TokenTransferEventArgs', - 'ERC20TokenApprovalEventArgs', - 'ERC20TokenEvents', - 'ERC20TokenEventArgs', - 'ERC721TokenApprovalEventArgs', - 'ERC721TokenApprovalForAllEventArgs', - 'ERC721TokenTransferEventArgs', - 'ERC721TokenEvents', - 'ExchangeCancelUpToEventArgs', - 'ExchangeAssetProxyRegisteredEventArgs', - 'ExchangeFillEventArgs', - 'ExchangeCancelEventArgs', - 'ExchangeEventArgs', - 'ContractWrappersConfig', - 'MessagePrefixType', - 'MessagePrefixOpts', - 'OrderInfo', - ], typeNameToPrefix: {}, typeNameToExternalLink: { BigNumber: constants.URL_BIGNUMBERJS_GITHUB, }, - typeNameToDocSection: { - ExchangeWrapper: 'exchange', - TokenWrapper: 'token', - TokenRegistryWrapper: 'tokenRegistry', - EtherTokenWrapper: 'etherToken', - ProxyWrapper: 'proxy', - TokenTransferProxyWrapper: 'proxy', - OrderStateWatcher: 'orderWatcher', - }, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 8159bbd49..6e11dead9 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -84,7 +84,7 @@ export class DocPage extends React.Component { location={this.props.location} docsVersion={this.props.docsVersion} availableDocVersions={this.props.availableDocVersions} - menu={this.props.docsInfo.getMenu(this.props.docsVersion)} + menu={this.props.docsInfo.menu} menuSubsectionsBySection={menuSubsectionsBySection} docsInfo={this.props.docsInfo} translate={this.props.translate} diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts index b9084bba7..e313648bd 100644 --- a/packages/website/ts/utils/doc_utils.ts +++ b/packages/website/ts/utils/doc_utils.ts @@ -1,4 +1,4 @@ -import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs'; +import { DoxityDocObj, GeneratedDocJson } from '@0xproject/react-docs'; import { fetchAsync, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import { S3FileObject, VersionToFilePath } from 'ts/types'; @@ -70,7 +70,7 @@ export const docUtils = { }); return versionFilePaths; }, - async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise { + async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise { const endpoint = `${s3DocJsonRoot}/${filePath}`; const response = await fetchAsync(endpoint); if (response.status !== 200) { diff --git a/yarn.lock b/yarn.lock index 4f8c1fe86..57acb36fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1149,6 +1149,12 @@ dependencies: "@types/react" "*" +"@types/react-scroll@1.5.3": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-1.5.3.tgz#cc4e94db3d7d5b1cd244bfee24091c335d3e2598" + dependencies: + "@types/react" "*" + "@types/react-tap-event-plugin@0.0.30": version "0.0.30" resolved "https://registry.yarnpkg.com/@types/react-tap-event-plugin/-/react-tap-event-plugin-0.0.30.tgz#123f35080412f489b6770c5a65c159ff96654cb5" @@ -10655,9 +10661,9 @@ react-scroll@1.7.7: lodash.throttle "^4.1.1" prop-types "^15.5.8" -react-scroll@^1.5.2: - version "1.7.8" - resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.8.tgz#45d8bd0f3fb104a7a1c3adb358e3a742a7091409" +react-scroll@^1.7.10: + version "1.7.10" + resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.10.tgz#b59cfa11a899a362c6489607ed5865c9c5fd0b53" dependencies: lodash.throttle "^4.1.1" prop-types "^15.5.8" -- cgit From 5e3bbbbb3c5be91be7c81f92f42e34edd02ea264 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 18:56:31 +0200 Subject: Use our fork of react-scroll that fixes scrolling within an absolutely positioned div to work correctly. See: https://github.com/fisshy/react-scroll/pull/330 --- packages/react-docs/package.json | 2 +- packages/react-shared/package.json | 2 +- packages/website/package.json | 2 +- yarn.lock | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index c95051bde..f6d829cdf 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -49,7 +49,7 @@ "react": "15.6.1", "react-dom": "15.6.1", "react-markdown": "^3.2.2", - "react-scroll": "^1.7.10", + "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tooltip": "^3.2.7", "semver": "5.5.0" }, diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 9f4cfd624..ab0e2b7bd 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -48,7 +48,7 @@ "react-dom": "15.6.1", "react-highlight": "0xproject/react-highlight", "react-markdown": "^3.2.2", - "react-scroll": "^1.7.10", + "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tap-event-plugin": "^2.0.1" }, "publishConfig": { diff --git a/packages/website/package.json b/packages/website/package.json index ef420ab07..fda724fc8 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -49,7 +49,7 @@ "react-popper": "^1.0.0-beta.6", "react-redux": "^5.0.3", "react-router-dom": "^4.1.1", - "react-scroll": "^1.7.10", + "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tap-event-plugin": "^2.0.1", "react-tooltip": "^3.2.7", "redux": "^3.6.0", diff --git a/yarn.lock b/yarn.lock index 57acb36fe..9b8462257 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10654,16 +10654,16 @@ react-router@^4.2.0: prop-types "^15.5.4" warning "^3.0.0" -react-scroll@1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.7.tgz#948c40c9a189b62bf4a53ee0fd50e5d89d37260a" +react-scroll@0xproject/react-scroll#similar-to-pr-330: + version "1.7.10" + resolved "https://codeload.github.com/0xproject/react-scroll/tar.gz/f28a6c51800152fde11e7362383992aa60a15703" dependencies: lodash.throttle "^4.1.1" prop-types "^15.5.8" -react-scroll@^1.7.10: - version "1.7.10" - resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.10.tgz#b59cfa11a899a362c6489607ed5865c9c5fd0b53" +react-scroll@1.7.7: + version "1.7.7" + resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.7.tgz#948c40c9a189b62bf4a53ee0fd50e5d89d37260a" dependencies: lodash.throttle "^4.1.1" prop-types "^15.5.8" -- cgit From 32e1c2ac970069f5251bd3cd7a31072f0547cf2c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 19:02:20 +0200 Subject: Add padding above anchor titles so they show up nice when scrolled to --- packages/react-docs/src/components/property_block.tsx | 2 +- packages/react-docs/src/components/type_definition.tsx | 2 +- packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index 6e7f90c6c..466082a91 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -34,7 +34,7 @@ export class PropertyBlock extends React.Component Date: Wed, 1 Aug 2018 20:48:19 +0200 Subject: Add callpath to properties --- .../react-docs/src/components/property_block.tsx | 2 +- packages/react-docs/src/types.ts | 1 + packages/react-docs/src/utils/typedoc_utils.ts | 39 +++++++++++++--------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index 466082a91..074c59c5f 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -48,7 +48,7 @@ export class PropertyBlock extends React.Component - {property.name}:{' '} + {(property as any).callPath}{property.name}:{' '} {property.source && ( diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 83ad157d1..ca869df1c 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -202,6 +202,7 @@ export interface Property { type: Type; source?: Source; comment?: string; + callPath?: string; } export interface BaseMethod { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 1e7c29ce8..1c685f915 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -283,6 +283,9 @@ export const typeDocUtils = { _convertProperty(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): Property { const source = entity.sources[0]; const commentIfExists = !_.isUndefined(entity.comment) ? entity.comment.shortText : undefined; + const isConstructor = false; + const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; + const callPath = typeDocUtils._getCallPath(sectionName, sections, isStatic, isConstructor, docId, entity.name); const property = { name: entity.name, type: typeDocUtils._convertType(entity.type, sections, sectionName, docId), @@ -291,6 +294,7 @@ export const typeDocUtils = { line: source.line, }, comment: commentIfExists, + callPath, }; return property; }, @@ -306,22 +310,6 @@ export const typeDocUtils = { const hasComment = !_.isUndefined(signature.comment); const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; - // HACK: we use the fact that the sectionName is the same as the property name at the top-level - // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. - let callPath; - if (isConstructor || entity.name === '__type') { - callPath = ''; - // TODO: Get rid of this 0x-specific logic - } else if (docId === 'ZERO_EX_JS') { - const topLevelInterface = isStatic ? 'ZeroEx.' : 'zeroEx.'; - callPath = - !_.isUndefined(sections.zeroEx) && sectionName !== sections.zeroEx - ? `${topLevelInterface}${sectionName}.` - : topLevelInterface; - } else { - callPath = `${sectionName}.`; - } - const parameters = _.map(signature.parameters, param => { return typeDocUtils._convertParameter(param, sections, sectionName, docId); }); @@ -330,6 +318,7 @@ export const typeDocUtils = { ? undefined : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId); + const callPath = typeDocUtils._getCallPath(sectionName, sections, isStatic, isConstructor, docId, entity.name); const method = { isConstructor, isStatic, @@ -347,6 +336,24 @@ export const typeDocUtils = { }; return method; }, + _getCallPath(sectionName: string, sections: SectionsMap, isStatic: boolean, isConstructor: boolean, docId: string, entityName: string) { + // HACK: we use the fact that the sectionName is the same as the property name at the top-level + // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. + let callPath; + if (isConstructor || entityName === '__type') { + callPath = ''; + // TODO: Get rid of this 0x-specific logic + } else if (docId === 'ZERO_EX_JS') { + const topLevelInterface = isStatic ? 'ZeroEx.' : 'zeroEx.'; + callPath = + !_.isUndefined(sections.zeroEx) && sectionName !== sections.zeroEx + ? `${topLevelInterface}${sectionName}.` + : topLevelInterface; + } else { + callPath = `${sectionName}.`; + } + return callPath; + }, _convertFunction( entity: TypeDocNode, sections: SectionsMap, -- cgit From 2494af99aad4dd58c0d4e647dedf72946cb3c20b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 21:00:45 +0200 Subject: Prefix menu and sections with markdown as that is all the should now be defined --- packages/react-docs/src/docs_info.ts | 9 ++---- packages/react-docs/src/types.ts | 4 +-- .../website/ts/containers/connect_documentation.ts | 20 +++++++------- .../ts/containers/ethereum_types_documentation.ts | 16 +++++------ .../ts/containers/json_schemas_documentation.ts | 24 ++++++++-------- .../ts/containers/order_utils_documentation.ts | 18 ++++++------ .../ts/containers/smart_contracts_documentation.ts | 4 +-- .../ts/containers/sol_compiler_documentation.ts | 22 +++++++-------- .../website/ts/containers/sol_cov_documentation.ts | 28 ++++++------------- .../ts/containers/subproviders_documentation.ts | 30 ++------------------ .../ts/containers/web3_wrapper_documentation.ts | 8 ++---- .../ts/containers/zero_ex_js_documentation.ts | 32 +++++++++++----------- 12 files changed, 85 insertions(+), 130 deletions(-) diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index dd3cb9a96..0637f3e65 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -28,21 +28,16 @@ export class DocsInfo { public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion; public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId; public typeConfigs: DocsInfoTypeConfigs; - private readonly _docsInfo: DocsInfoConfig; constructor(config: DocsInfoConfig) { this.id = config.id; this.type = config.type; - this.menu = config.menu; + this.menu = config.markdownMenu; this.displayName = config.displayName; this.packageUrl = config.packageUrl; - this.sections = config.sections; + this.sections = config.markdownSections; this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion; this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId; this.typeConfigs = config.typeConfigs; - this._docsInfo = config; - } - public getMenu(selectedVersion?: string): { [section: string]: string[] } { - return this._docsInfo.menu; } public getMenuSubsectionsBySection(docAgnosticFormat?: DocAgnosticFormat): MenuSubsectionsBySection { const menuSubsectionsBySection = {} as MenuSubsectionsBySection; diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index ca869df1c..aebd823db 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -7,8 +7,8 @@ export interface DocsInfoConfig { type: SupportedDocJson; displayName: string; packageUrl: string; - menu: DocsMenu; - sections: SectionsMap; + markdownMenu: DocsMenu; + markdownSections: SectionsMap; sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion; contractsByVersionByNetworkId?: ContractsByVersionByNetworkId; typeConfigs?: DocsInfoTypeConfigs; diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index 74464e650..8e3b8d1c9 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -14,7 +14,7 @@ const IntroMarkdownV1 = require('md/docs/connect/1.0.0/introduction'); const InstallationMarkdownV1 = require('md/docs/connect/1.0.0/installation'); /* tslint:enable:no-var-requires */ -const connectDocSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', httpClient: 'httpClient', @@ -27,20 +27,20 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: '0x Connect', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [connectDocSections.introduction], - install: [connectDocSections.installation], - httpClient: [connectDocSections.httpClient], - webSocketOrderbookChannel: [connectDocSections.webSocketOrderbookChannel], - types: [connectDocSections.types], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + httpClient: [markdownSections.httpClient], + webSocketOrderbookChannel: [markdownSections.webSocketOrderbookChannel], + types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [connectDocSections.introduction]: IntroMarkdownV1, - [connectDocSections.installation]: InstallationMarkdownV1, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, }, }, - sections: connectDocSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: { Provider: constants.URL_WEB3_PROVIDER_DOCS, diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts index 041a6bea3..5f08e0236 100644 --- a/packages/website/ts/containers/ethereum_types_documentation.ts +++ b/packages/website/ts/containers/ethereum_types_documentation.ts @@ -14,7 +14,7 @@ const IntroMarkdown = require('md/docs/ethereum_types/introduction'); const InstallationMarkdown = require('md/docs/ethereum_types/installation'); /* tslint:enable:no-var-requires */ -const docSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', types: docConstants.TYPES_SECTION_NAME, @@ -25,18 +25,18 @@ const docsInfoConfig: DocsInfoConfig = { 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], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [docSections.introduction]: IntroMarkdown, - [docSections.installation]: InstallationMarkdown, + [markdownSections.introduction]: IntroMarkdown, + [markdownSections.installation]: InstallationMarkdown, }, }, - sections: docSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: { BigNumber: constants.URL_BIGNUMBERJS_GITHUB, diff --git a/packages/website/ts/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts index 3ecc0f312..f88cec6ec 100644 --- a/packages/website/ts/containers/json_schemas_documentation.ts +++ b/packages/website/ts/containers/json_schemas_documentation.ts @@ -15,7 +15,7 @@ const UsageMarkdownV1 = require('md/docs/json_schemas/1.0.0/usage'); const SchemasMarkdownV1 = require('md/docs/json_schemas/1.0.0/schemas'); /* tslint:enable:no-var-requires */ -const docSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', usage: 'usage', @@ -28,22 +28,22 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'JSON Schemas', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - install: [docSections.installation], - usage: [docSections.usage], - schemaValidator: [docSections.schemaValidator], - schemas: [docSections.schemas], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + usage: [markdownSections.usage], + schemaValidator: [markdownSections.schemaValidator], + schemas: [markdownSections.schemas], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - [docSections.installation]: InstallationMarkdownV1, - [docSections.schemas]: SchemasMarkdownV1, - [docSections.usage]: UsageMarkdownV1, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, + [markdownSections.schemas]: SchemasMarkdownV1, + [markdownSections.usage]: UsageMarkdownV1, }, }, - sections: docSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: { Schema: diff --git a/packages/website/ts/containers/order_utils_documentation.ts b/packages/website/ts/containers/order_utils_documentation.ts index 29cbf9501..9af863d8a 100644 --- a/packages/website/ts/containers/order_utils_documentation.ts +++ b/packages/website/ts/containers/order_utils_documentation.ts @@ -14,7 +14,7 @@ const IntroMarkdownV1 = require('md/docs/order_utils/1.0.0/introduction'); const InstallationMarkdownV1 = require('md/docs/order_utils/1.0.0/installation'); /* tslint:enable:no-var-requires */ -const docSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', usage: 'usage', @@ -26,19 +26,19 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'Order utils', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - install: [docSections.installation], - usage: [docSections.usage], - types: [docSections.types], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + usage: [markdownSections.usage], + types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - [docSections.installation]: InstallationMarkdownV1, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, }, }, - sections: docSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: { BigNumber: constants.URL_BIGNUMBERJS_GITHUB, diff --git a/packages/website/ts/containers/smart_contracts_documentation.ts b/packages/website/ts/containers/smart_contracts_documentation.ts index e3a1bd7a6..a2b3545ae 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.ts +++ b/packages/website/ts/containers/smart_contracts_documentation.ts @@ -18,7 +18,7 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.Doxity, displayName: '0x Smart Contracts', packageUrl: 'https://github.com/0xProject/contracts', - menu: { + markdownMenu: { introduction: [Sections.Introduction], contracts: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy], }, @@ -27,7 +27,7 @@ const docsInfoConfig: DocsInfoConfig = { [Sections.Introduction]: IntroMarkdownV1, }, }, - sections: { + markdownSections: { Introduction: Sections.Introduction, Exchange: Sections.Exchange, TokenTransferProxy: Sections.TokenTransferProxy, diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index bd6a85c83..635c2112b 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -14,7 +14,7 @@ const InstallationMarkdownV1 = require('md/docs/sol-compiler/installation'); const UsageMarkdown = require('md/docs/sol-compiler/usage'); /* tslint:enable:no-var-requires */ -const docSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', usage: 'usage', @@ -27,21 +27,21 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'Solidity Compiler', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - install: [docSections.installation], - usage: [docSections.usage], - compiler: [docSections.compiler], - types: [docSections.types], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + usage: [markdownSections.usage], + compiler: [markdownSections.compiler], + types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - [docSections.installation]: InstallationMarkdownV1, - [docSections.usage]: UsageMarkdown, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, + [markdownSections.usage]: UsageMarkdown, }, }, - sections: docSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: {}, typeNameToPrefix: {}, diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index 5567eb97e..0ad7bbfd4 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -14,15 +14,10 @@ const InstallationMarkdownV1 = require('md/docs/sol_cov/installation'); const UsageMarkdown = require('md/docs/sol_cov/usage'); /* tslint:enable:no-var-requires */ -const docSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', usage: 'usage', - coverageSubprovider: 'coverageSubprovider', - abstractArtifactAdapter: 'abstractArtifactAdapter', - solCompilerArtifactAdapter: 'solCompilerArtifactAdapter', - truffleArtifactAdapter: 'truffleArtifactAdapter', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -30,24 +25,19 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'Sol-cov', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - install: [docSections.installation], - usage: [docSections.usage], - 'coverage-subprovider': [docSections.coverageSubprovider], - 'abstract-artifact-adapter': [docSections.abstractArtifactAdapter], - 'sol-compiler-artifact-adapter': [docSections.solCompilerArtifactAdapter], - 'truffle-artifact-adapter': [docSections.truffleArtifactAdapter], - types: [docSections.types], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + usage: [markdownSections.usage], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - [docSections.installation]: InstallationMarkdownV1, - [docSections.usage]: UsageMarkdown, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, + [markdownSections.usage]: UsageMarkdown, }, }, - sections: docSections, + markdownSections: markdownSections, typeConfigs: { typeNameToExternalLink: {}, typeNameToPrefix: {}, diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 76c71902e..4aaffd908 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -18,20 +18,7 @@ const LedgerNodeHidMarkdown = require('md/docs/subproviders/ledger_node_hid'); const docSections = { introduction: 'introduction', installation: 'installation', - subprovider: 'subprovider', - ledgerSubprovider: 'ledgerSubprovider', ledgerNodeHid: 'ledger-node-hid-issue', - factoryMethods: 'factory-methods', - emptyWalletSubprovider: 'emptyWalletSubprovider', - fakeGasEstimateSubprovider: 'fakeGasEstimateSubprovider', - injectedWeb3Subprovider: 'injectedWeb3Subprovider', - signerSubprovider: 'signerSubprovider', - redundantRPCSubprovider: 'redundantRPCSubprovider', - ganacheSubprovider: 'ganacheSubprovider', - nonceTrackerSubprovider: 'nonceTrackerSubprovider', - privateKeyWalletSubprovider: 'privateKeyWalletSubprovider', - mnemonicWalletSubprovider: 'mnemonicWalletSubprovider', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -39,23 +26,10 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'Subproviders', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { + markdownMenu: { introduction: [docSections.introduction], install: [docSections.installation], - subprovider: [docSections.subprovider], - ['ledger-subprovider']: [docSections.ledgerSubprovider], ['ledger-node-hid-issue']: [docSections.ledgerNodeHid], - ['private-key-wallet-subprovider']: [docSections.privateKeyWalletSubprovider], - ['mnemonic-wallet-subprovider']: [docSections.mnemonicWalletSubprovider], - ['factory-methods']: [docSections.factoryMethods], - ['emptyWallet-subprovider']: [docSections.emptyWalletSubprovider], - ['fakeGasEstimate-subprovider']: [docSections.fakeGasEstimateSubprovider], - ['injectedWeb3-subprovider']: [docSections.injectedWeb3Subprovider], - ['signer-subprovider']: [docSections.signerSubprovider], - ['redundantRPC-subprovider']: [docSections.redundantRPCSubprovider], - ['ganache-subprovider']: [docSections.ganacheSubprovider], - ['nonceTracker-subprovider']: [docSections.nonceTrackerSubprovider], - types: [docSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { @@ -64,7 +38,7 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.ledgerNodeHid]: LedgerNodeHidMarkdown, }, }, - sections: docSections, + markdownSections: docSections, typeConfigs: { typeNameToExternalLink: { Web3: constants.URL_WEB3_DOCS, diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index 1a4101f5d..b015fd0d9 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -17,8 +17,6 @@ const InstallationMarkdownV1 = require('md/docs/web3_wrapper/installation'); const docSections = { introduction: 'introduction', installation: 'installation', - web3Wrapper: 'web3Wrapper', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -26,11 +24,9 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: 'Web3Wrapper', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { + markdownMenu: { introduction: [docSections.introduction], install: [docSections.installation], - web3Wrapper: [docSections.web3Wrapper], - types: [docSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { @@ -38,7 +34,7 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.installation]: InstallationMarkdownV1, }, }, - sections: docSections, + markdownSections: docSections, typeConfigs: { typeNameToExternalLink: { Web3: constants.URL_WEB3_DOCS, diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 3b706f262..79e342e01 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -20,7 +20,7 @@ const IntroMarkdownV2 = require('md/docs/0xjs/2.0.0/introduction'); const versioningMarkdownV2 = require('md/docs/0xjs/2.0.0/versioning'); /* tslint:enable:no-var-requires */ -const zeroExJsDocSections = { +const markdownSections = { introduction: 'introduction', installation: 'installation', testrpc: 'testrpc', @@ -34,29 +34,29 @@ const docsInfoConfig: DocsInfoConfig = { type: SupportedDocJson.TypeDoc, displayName: '0x.js', packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [zeroExJsDocSections.introduction], - install: [zeroExJsDocSections.installation], - topics: [zeroExJsDocSections.async, zeroExJsDocSections.errors, zeroExJsDocSections.versioning], + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + topics: [markdownSections.async, markdownSections.errors, markdownSections.versioning], }, sectionNameToMarkdownByVersion: { '0.0.1': { - [zeroExJsDocSections.introduction]: IntroMarkdownV1, - [zeroExJsDocSections.installation]: InstallationMarkdownV1, - [zeroExJsDocSections.async]: AsyncMarkdownV1, - [zeroExJsDocSections.errors]: ErrorsMarkdownV1, - [zeroExJsDocSections.versioning]: versioningMarkdownV1, + [markdownSections.introduction]: IntroMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, + [markdownSections.async]: AsyncMarkdownV1, + [markdownSections.errors]: ErrorsMarkdownV1, + [markdownSections.versioning]: versioningMarkdownV1, }, '1.0.0-rc.1': { - [zeroExJsDocSections.introduction]: IntroMarkdownV2, - [zeroExJsDocSections.versioning]: versioningMarkdownV2, + [markdownSections.introduction]: IntroMarkdownV2, + [markdownSections.versioning]: versioningMarkdownV2, // These are the same as for V1 - [zeroExJsDocSections.installation]: InstallationMarkdownV1, - [zeroExJsDocSections.async]: AsyncMarkdownV1, - [zeroExJsDocSections.errors]: ErrorsMarkdownV1, + [markdownSections.installation]: InstallationMarkdownV1, + [markdownSections.async]: AsyncMarkdownV1, + [markdownSections.errors]: ErrorsMarkdownV1, }, }, - sections: zeroExJsDocSections, + markdownSections: markdownSections, typeConfigs: { typeNameToPrefix: {}, typeNameToExternalLink: { -- cgit From 0132286cab49ff6c705abd70cdd89e36b3550c27 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 00:01:02 +0200 Subject: Add contract-wrappers page and make topBar component more concise --- packages/contract-wrappers/package.json | 10 +- packages/website/translations/chinese.json | 2 + packages/website/translations/english.json | 2 + packages/website/translations/korean.json | 2 + packages/website/translations/russian.json | 2 + packages/website/translations/spanish.json | 2 + packages/website/ts/components/top_bar/top_bar.tsx | 155 +++++---------------- .../containers/contract_wrappers_documentation.ts | 56 ++++++++ packages/website/ts/index.tsx | 4 + .../website/ts/pages/documentation/doc_page.tsx | 1 + packages/website/ts/types.ts | 4 + 11 files changed, 121 insertions(+), 119 deletions(-) create mode 100644 packages/website/ts/containers/contract_wrappers_documentation.ts diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index d21dfe505..7b6e5c3b4 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -25,11 +25,16 @@ "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit" + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "docs:json": "typedoc --excludePrivate --excludeExternals --ignoreCompilerErrors --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken", - "contracts_v2": "DummyERC20Token DummyERC721Token" + "contracts_v2": "DummyERC20Token DummyERC721Token", + "postpublish": { + "assets": [], + "shouldPublishDocs": true + } }, "repository": { "type": "git", @@ -66,6 +71,7 @@ "sinon": "^4.0.0", "source-map-support": "^0.5.0", "tslint": "5.11.0", + "typedoc": "0xProject/typedoc", "typescript": "2.7.1", "web3-provider-engine": "14.0.6" }, diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index 3e9f21370..8af9835ab 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -61,6 +61,8 @@ "SOL_COV": "Solidity Coverage", "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", + "CONTRACT_WRAPPERS": "Contract Wrappers", + "0x.js": "0x.js", "BLOG": "博客", "FORUM": "论坛", "CONNECT": "0x 连接", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index d94dbb29e..b6a8113d3 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -62,6 +62,8 @@ "SOL_COV": "Solidity Coverage", "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", + "CONTRACT_WRAPPERS": "Contract Wrappers", + "0X_JS": "0x.js", "BLOG": "blog", "FORUM": "forum", "CONNECT": "0x Connect", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index c38de6677..1c2b585bf 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -61,6 +61,8 @@ "SOL_COV": "Solidity Coverage", "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", + "CONTRACT_WRAPPERS": "Contract Wrappers", + "0X_JS": "0x.js", "BLOG": "블로그", "FORUM": "포럼", "CONNECT": "0x Connect", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index a7e06d646..c2df8ee2a 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -61,6 +61,8 @@ "SOL_COV": "Solidity Coverage", "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", + "CONTRACT_WRAPPERS": "Contract Wrappers", + "0X_JS": "0x.js", "BLOG": "Блог", "FORUM": "Форум", "CONNECT": "0x Connect", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index 5a8920f61..a874673cf 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -62,6 +62,8 @@ "SOL_COV": "Solidity Coverage", "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", + "CONTRACT_WRAPPERS": "Contract Wrappers", + "0X_JS": "0x.js", "BLOG": "blog", "FORUM": "foro", "CONNECT": "0x Connect", diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 646d3fc94..d2f530fb5 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -74,6 +74,18 @@ const styles: Styles = { }, }; +const DOC_WEBSITE_PATHS_TO_KEY = { + [WebsitePaths.SolCov]: Key.SolCov, + [WebsitePaths.SmartContracts]: Key.SmartContracts, + [WebsitePaths.Web3Wrapper]: Key.Web3Wrapper, + [WebsitePaths.SolCompiler]: Key.SolCompiler, + [WebsitePaths.JSONSchemas]: Key.JsonSchemas, + [WebsitePaths.Subproviders]: Key.Subproviders, + [WebsitePaths.ContractWrappers]: Key.ContractWrappers, + [WebsitePaths.Connect]: Key.Connect, + [WebsitePaths.ZeroExJs]: Key.ZeroExJs, +} + const DEFAULT_HEIGHT = 68; const EXPANDED_HEIGHT = 75; @@ -154,6 +166,12 @@ export class TopBar extends React.Component { primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)} /> , + + + , { {this.props.translate.get(Key.Wiki, Deco.Cap)} - {!this._isViewing0xjsDocs() && ( - - 0x.js {this.props.translate.get(Key.Docs, Deco.Cap)} - - )} - {!this._isViewingConnectDocs() && ( - - - {this.props.translate.get(Key.Connect, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingSmartContractsDocs() && ( - - - {this.props.translate.get(Key.SmartContract, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingWeb3WrapperDocs() && ( - - - {this.props.translate.get(Key.Web3Wrapper, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingSolCompilerDocs() && ( - - - {this.props.translate.get(Key.SolCompiler, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingJsonSchemasDocs() && ( - - - {this.props.translate.get(Key.JsonSchemas, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingSolCovDocs() && ( - - - {this.props.translate.get(Key.SolCov, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingSubprovidersDocs() && ( - - - {this.props.translate.get(Key.Subproviders, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} - {!this._isViewingEthereumTypesDocs() && ( - - - {this.props.translate.get(Key.EthereumTypes, Deco.Cap)}{' '} - {this.props.translate.get(Key.Docs, Deco.Cap)} - - - )} + {_.map(DOC_WEBSITE_PATHS_TO_KEY, (key, websitePath) => { + if (!this._doesUrlInclude(websitePath)) { + + + {this.props.translate.get(key, Deco.Cap)}{' '} + {this.props.translate.get(Key.Docs, Deco.Cap)} + + + } + })} {!this._isViewingPortal() && ( @@ -429,15 +388,11 @@ export class TopBar extends React.Component { ); } private _renderDocsMenu(): React.ReactNode { + const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => { + return this._doesUrlInclude(websitePath); + }); if ( - (!this._isViewing0xjsDocs() && - !this._isViewingSmartContractsDocs() && - !this._isViewingWeb3WrapperDocs() && - !this._isViewingSolCompilerDocs() && - !this._isViewingJsonSchemasDocs() && - !this._isViewingSolCovDocs() && - !this._isViewingSubprovidersDocs() && - !this._isViewingConnectDocs()) || + !isViewingDocsPage || _.isUndefined(this.props.menu) ) { return undefined; @@ -488,55 +443,21 @@ export class TopBar extends React.Component { private _isViewingFAQ(): boolean { return _.includes(this.props.location.pathname, WebsitePaths.FAQ); } - private _isViewing0xjsDocs(): boolean { - return ( - _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs) || - _.includes(this.props.location.pathname, WebsiteLegacyPaths.ZeroExJs) - ); - } - private _isViewingConnectDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.Connect); - } - private _isViewingSmartContractsDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts); - } - private _isViewingWeb3WrapperDocs(): boolean { - return ( - _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper) || - _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper) - ); - } - private _isViewingSolCompilerDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.SolCompiler); - } - private _isViewingJsonSchemasDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas); - } - private _isViewingSolCovDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.SolCov); - } - private _isViewingSubprovidersDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.Subproviders); - } - private _isViewingEthereumTypesDocs(): boolean { - return _.includes(this.props.location.pathname, WebsitePaths.EthereumTypes); + private _doesUrlInclude(aPath: string): boolean { + return _.includes(this.props.location.pathname, aPath); } private _isViewingWiki(): boolean { return _.includes(this.props.location.pathname, WebsitePaths.Wiki); } private _shouldDisplayBottomBar(): boolean { + const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => { + return this._doesUrlInclude(websitePath); + }); return ( + isViewingDocsPage || this._isViewingWiki() || this._isViewingFAQ() || this._isViewingDocs() || - this._isViewing0xjsDocs() || - this._isViewingSmartContractsDocs() || - this._isViewingWeb3WrapperDocs() || - this._isViewingSolCompilerDocs() || - this._isViewingJsonSchemasDocs() || - this._isViewingSolCovDocs() || - this._isViewingSubprovidersDocs() || - this._isViewingConnectDocs() || this._isViewingPortal() ); } diff --git a/packages/website/ts/containers/contract_wrappers_documentation.ts b/packages/website/ts/containers/contract_wrappers_documentation.ts new file mode 100644 index 000000000..f0547cecd --- /dev/null +++ b/packages/website/ts/containers/contract_wrappers_documentation.ts @@ -0,0 +1,56 @@ +import { constants as docConstants, 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 { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; + +// TODO: Add MD sections +const markdownSections = {}; + +const docsInfoConfig: DocsInfoConfig = { + id: DocPackages.ContractWrappers, + type: SupportedDocJson.TypeDoc, + displayName: 'Contract Wrappers', + packageUrl: 'https://github.com/0xProject/0x-monorepo', + markdownMenu: {}, + sectionNameToMarkdownByVersion: {}, + markdownSections, + typeConfigs: { + typeNameToPrefix: {}, + 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, + docsInfo, + translate: state.translate, +}); + +const mapDispatchToProps = (dispatch: Dispatch): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const Documentation: React.ComponentClass = connect(mapStateToProps, mapDispatchToProps)( + DocPageComponent, +); diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index ed52e28d2..36b2f6b87 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -37,6 +37,9 @@ const LazyPortal = createLazyComponent('Portal', async () => const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "zeroExDocs" */ 'ts/containers/zero_ex_js_documentation'), ); +const LazyContractWrappersDocumentation = createLazyComponent('Documentation', async () => + System.import(/* webpackChunkName: "contractWrapperDocs" */ 'ts/containers/contract_wrappers_documentation'), +); const LazySmartContractsDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "smartContractDocs" */ 'ts/containers/smart_contracts_documentation'), ); @@ -80,6 +83,7 @@ render( + Date: Thu, 2 Aug 2018 00:01:16 +0200 Subject: Don't ignore compiler errors --- packages/contract-wrappers/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 7b6e5c3b4..cbb12534e 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -26,7 +26,7 @@ "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "docs:json": "typedoc --excludePrivate --excludeExternals --ignoreCompilerErrors --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken", -- cgit From 238eef6bae53fbff9399e6490b1401a3412bd171 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 00:01:23 +0200 Subject: Fix connect docs --- packages/website/ts/containers/connect_documentation.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index 8e3b8d1c9..cecfefdef 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -17,9 +17,6 @@ const InstallationMarkdownV1 = require('md/docs/connect/1.0.0/installation'); const markdownSections = { introduction: 'introduction', installation: 'installation', - httpClient: 'httpClient', - webSocketOrderbookChannel: 'webSocketOrderbookChannel', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -30,9 +27,6 @@ const docsInfoConfig: DocsInfoConfig = { markdownMenu: { introduction: [markdownSections.introduction], install: [markdownSections.installation], - httpClient: [markdownSections.httpClient], - webSocketOrderbookChannel: [markdownSections.webSocketOrderbookChannel], - types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { -- cgit From 71a2f2d72172e4138b3d4d40ab6bbee4b90e4cf7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 17:25:18 +0200 Subject: We need to always include the globals.d.ts otherwise TS complains about .json imports --- packages/monorepo-scripts/src/utils/publish_utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 01d44a369..3cdd2c4fb 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -195,6 +195,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); // Generate Typedoc JSON file + typeDocExtraFileIncludes.push(path.join(pathToPackage, 'src', 'globals.d.ts')); const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); const projectFiles = typeDocExtraFileIncludes.join(' '); const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); -- cgit From 987971bd59c282e885679576262732e9afa297bb Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 17:26:53 +0200 Subject: Fix bug where if there were multiple matches, it wouldn't always take the longest match --- packages/monorepo-scripts/src/utils/publish_utils.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 3cdd2c4fb..974fb4d0d 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -274,7 +274,7 @@ function findExportPathGivenTypedocName( packageName: string, typedocName: string, ): string { - const typeDocNameWithoutQuotes = _.replace(typedocName, '"', ''); + const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; const exportPaths = _.keys(exportPathToExportedItems); const sanitizedExportPaths = _.map(exportPaths, exportPath => { @@ -292,7 +292,13 @@ function findExportPathGivenTypedocName( sanitizedExportPathToExportPath[exportPath] = exportPath; return exportPath; }); - const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPaths, p => { + // We need to sort the exportPaths by length (longest first), so that the match finding will pick + // longer matches before shorter matches, since it might match both, but the longer match is more + // precisely what we are looking for. + const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => { + return b.length - a.length; + }); + const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => { return _.startsWith(typeDocNameWithoutQuotes, p); }); if (_.isUndefined(matchingSanitizedExportPathIfExists)) { -- cgit From b3473ff89f4d276fe74dd8e62680ab975fe24639 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 17:27:10 +0200 Subject: Remove unused var --- packages/react-docs/src/utils/typedoc_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 1c685f915..e2b259b13 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -73,7 +73,7 @@ export const typeDocUtils = { const fileChildIndex = _.findIndex(typeDocJson.children, child => child.name === typeDocName); const fileChild = typeDocJson.children[fileChildIndex]; let sectionName: string; - _.each(fileChild.children, (child, j) => { + _.each(fileChild.children, child => { switch (child.kindString) { case KindString.Class: case KindString.ObjectLiteral: { -- cgit From 9a3b630b1989abbe1d6784f121fd0a60169e3012 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 17:27:29 +0200 Subject: prettier --- packages/react-docs/src/utils/typedoc_utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index e2b259b13..35d28627f 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -336,7 +336,14 @@ export const typeDocUtils = { }; return method; }, - _getCallPath(sectionName: string, sections: SectionsMap, isStatic: boolean, isConstructor: boolean, docId: string, entityName: string) { + _getCallPath( + sectionName: string, + sections: SectionsMap, + isStatic: boolean, + isConstructor: boolean, + docId: string, + entityName: string, + ) { // HACK: we use the fact that the sectionName is the same as the property name at the top-level // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. let callPath; -- cgit From faa980ffc3bde48e4aaca665c8be83ea4c44b106 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 21:08:21 +0200 Subject: Add ability to omit rendering specific exports and also support direct exports from index.ts --- packages/json-schemas/package.json | 3 +- .../monorepo-scripts/src/utils/publish_utils.ts | 52 ++++++++++++++++------ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 72db8c649..c421290ec 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -23,7 +23,8 @@ "config": { "postpublish": { "assets": [], - "shouldPublishDocs": true + "shouldPublishDocs": true, + "omitExports": ["schemas"] } }, "repository": { diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 974fb4d0d..2cf67946b 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -119,10 +119,6 @@ function getReleaseNotesForPackage(packageName: string, version: string): string } export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { - const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; - const indexPath = `${pathToPackage}/src/index.ts`; - const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath); - const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const pkg = _.find(monorepoPackages, monorepoPackage => { return _.includes(monorepoPackage.packageJson.name, packageName); @@ -132,6 +128,12 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: } const packageJson = pkg.packageJson; + const omitExports = _.get(packageJson, 'config.postpublish.omitExports', []); + + const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; + const indexPath = `${pathToPackage}/src/index.ts`; + const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath, omitExports); + const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); if (!shouldPublishDocs) { utils.log( @@ -308,35 +310,59 @@ function findExportPathGivenTypedocName( return matchingExportPath; } -function getExportPathToExportedItems(filePath: string): ExportInfo { +function getExportPathToExportedItems(filePath: string, omitExports?: string[]): ExportInfo { const sourceFile = ts.createSourceFile( 'indexFile', readFileSync(filePath).toString(), ts.ScriptTarget.ES2017, /*setParentNodes */ true, ); - const exportInfo = _getExportPathToExportedItems(sourceFile); + const exportInfo = _getExportPathToExportedItems(sourceFile, omitExports); return exportInfo; } -function _getExportPathToExportedItems(sf: ts.SourceFile): ExportInfo { +function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[]): ExportInfo { const exportPathToExportedItems: ExportPathToExportedItems = {}; const exportPathOrder: string[] = []; + const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; + console.log('exportsToOmit', exportsToOmit); processNode(sf); function processNode(node: ts.Node): void { switch (node.kind) { - case ts.SyntaxKind.ExportDeclaration: + case ts.SyntaxKind.ExportDeclaration: { const exportClause = (node as any).exportClause; - const pkgName = exportClause.parent.moduleSpecifier.text; - exportPathOrder.push(pkgName); + const exportPath = exportClause.parent.moduleSpecifier.text; _.each(exportClause.elements, element => { - exportPathToExportedItems[pkgName] = _.isUndefined(exportPathToExportedItems[pkgName]) - ? [element.name.escapedText] - : [...exportPathToExportedItems[pkgName], element.name.escapedText]; + const exportItem = element.name.escapedText; + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } }); + if (!_.isUndefined(exportPathToExportedItems[exportPath])) { + exportPathOrder.push(exportPath); + } break; + } + case ts.SyntaxKind.ExportKeyword: { + const foundNode: any = node; + const exportPath = './index'; + if (foundNode.parent && foundNode.parent.name) { + const exportItem = foundNode.parent.name.escapedText; + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } + } + if (!_.includes(exportPathOrder, exportPath) && !_.isUndefined(exportPathToExportedItems[exportPath])) { + exportPathOrder.push(exportPath); + } + break; + } default: // noop break; -- cgit From 90ead59d34bf5218cf4e1e5317a4ffeb497da8e1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 21:09:18 +0200 Subject: Add support for rendering nested IndexSignatures --- packages/react-docs/src/components/interface.tsx | 8 ++-- packages/react-docs/src/components/signature.tsx | 1 - packages/react-docs/src/components/type.tsx | 45 ++++++++++++++------ packages/react-docs/src/types.ts | 4 +- packages/react-docs/src/utils/typedoc_utils.ts | 53 ++++++++++++++---------- 5 files changed, 71 insertions(+), 40 deletions(-) diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index a881c7fec..915b4bbc6 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -2,7 +2,7 @@ import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType, TypeDocTypes } from '../types'; +import { CustomType } from '../types'; import { Signature } from './signature'; import { Type } from './type'; @@ -19,9 +19,7 @@ export const Interface = (props: InterfaceProps) => { return ( {property.name}:{' '} - {property.type && property.type.typeDocType !== TypeDocTypes.Reflection ? ( - - ) : ( + {property.type && !_.isUndefined(property.type.method) ? ( { shouldUseArrowSyntax={true} docsInfo={props.docsInfo} /> + ) : ( + )}, ); diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 5f28050d2..d9567c9f6 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -3,7 +3,6 @@ import * as React from 'react'; import { DocsInfo } from '../docs_info'; import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '../types'; -import { constants } from '../utils/constants'; import { Type } from './type'; diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 3504be303..ea66c7b1e 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -93,19 +93,38 @@ export function Type(props: TypeProps): any { break; case TypeDocTypes.Reflection: - typeName = ( - - ); + if (!_.isUndefined(type.method)) { + typeName = ( + + ); + } else if (!_.isUndefined(type.indexSignature)) { + const is = type.indexSignature; + const param = ( + + {is.keyName}:{' '} + + + ); + typeName = ( + + {'{'}[{param}]: {is.valueName} + {'}'} + + ); + } else { + throw new Error(`Unrecognized Reflection type that isn't a Method nor an Index Signature`); + } + break; case TypeDocTypes.TypeParameter: diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index aebd823db..79dfe9f4f 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -35,6 +35,7 @@ export interface TypeDocType { typeArguments?: TypeDocType[]; declaration: TypeDocNode; elementType?: TypeDocType; + indexSignature?: TypeDocNode; } export interface TypeDocFlags { @@ -64,7 +65,7 @@ export interface TypeDocNode { returns?: string; declaration: TypeDocNode; flags?: TypeDocFlags; - indexSignature?: TypeDocNode | TypeDocNode[]; // TypeDocNode in TypeDoc V0.9.0 + indexSignature?: TypeDocNode; signatures?: TypeDocNode[]; parameters?: TypeDocNode[]; typeParameter?: TypeDocNode[]; @@ -156,6 +157,7 @@ export interface Type { elementType?: ElementType; types?: Type[]; method?: TypescriptMethod; + indexSignature?: IndexSignature; } export interface ElementType { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 35d28627f..f1f42c36d 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -63,9 +63,12 @@ export const typeDocUtils = { const exportPathToTypedocName = generatedDocJson.metadata.exportPathToTypedocName; const typeDocJson = generatedDocJson.typedocJson; - const typeDocNameOrder = _.map(exportPathOrder, exportPath => { - return exportPathToTypedocName[exportPath]; - }); + // TODO: Extract the non typeDoc exports, and render them somehow + const typeDocNameOrder = _.compact( + _.map(exportPathOrder, exportPath => { + return exportPathToTypedocName[exportPath]; + }), + ); const docAgnosticFormat: DocAgnosticFormat = {}; const typeEntities: TypeDocNode[] = []; @@ -111,14 +114,16 @@ export const typeDocUtils = { } }); }); - docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; - docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; - const docSection = typeDocUtils._convertEntitiesToDocSection( - typeEntities, - docsInfo, - constants.TYPES_SECTION_NAME, - ); - docAgnosticFormat[constants.TYPES_SECTION_NAME] = docSection; + if (!_.isEmpty(typeEntities)) { + docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; + docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; + const docSection = typeDocUtils._convertEntitiesToDocSection( + typeEntities, + docsInfo, + constants.TYPES_SECTION_NAME, + ); + docAgnosticFormat[constants.TYPES_SECTION_NAME] = docSection; + } return docAgnosticFormat; }, @@ -218,13 +223,7 @@ export const typeDocUtils = { ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) : undefined; const doesIndexSignatureExist = !_.isUndefined(entity.indexSignature); - const isIndexSignatureArray = _.isArray(entity.indexSignature); - // HACK: TypeDoc Versions <0.9.0 indexSignature is of type TypeDocNode[] - // Versions >0.9.0 have it as type TypeDocNode - const indexSignature = - doesIndexSignatureExist && isIndexSignatureArray - ? (entity.indexSignature as TypeDocNode[])[0] - : (entity.indexSignature as TypeDocNode); + const indexSignature = entity.indexSignature as TypeDocNode; const indexSignatureIfExists = doesIndexSignatureExist ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId) : undefined; @@ -305,6 +304,9 @@ export const typeDocUtils = { sectionName: string, docId: string, ): TypescriptMethod { + if (_.isUndefined(entity.signatures)) { + console.log(entity); + } const signature = entity.signatures[0]; const source = entity.sources[0]; const hasComment = !_.isUndefined(signature.comment); @@ -436,9 +438,17 @@ export const typeDocUtils = { }); const isConstructor = false; - const methodIfExists = !_.isUndefined(entity.declaration) - ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) - : undefined; + const doesIndexSignatureExist = + !_.isUndefined(entity.declaration) && !_.isUndefined(entity.declaration.indexSignature); + let indexSignatureIfExists; + if (doesIndexSignatureExist) { + const indexSignature = entity.declaration.indexSignature as TypeDocNode; + indexSignatureIfExists = typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId); + } + const methodIfExists = + !_.isUndefined(entity.declaration) && !doesIndexSignatureExist + ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) + : undefined; const elementTypeIfExists = !_.isUndefined(entity.elementType) ? { @@ -455,6 +465,7 @@ export const typeDocUtils = { elementType: elementTypeIfExists, types, method: methodIfExists, + indexSignature: indexSignatureIfExists, }; return type; }, -- cgit From c7a5b8c776afd343d2a3484cb249120a3d0a5085 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 21:09:38 +0200 Subject: Add MD sections to contract-wrappers docs --- .../md/docs/contract_wrappers/installation.md | 11 +++++++++++ .../md/docs/contract_wrappers/introduction.md | 3 +++ .../containers/contract_wrappers_documentation.ts | 23 ++++++++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 packages/website/md/docs/contract_wrappers/installation.md create mode 100644 packages/website/md/docs/contract_wrappers/introduction.md diff --git a/packages/website/md/docs/contract_wrappers/installation.md b/packages/website/md/docs/contract_wrappers/installation.md new file mode 100644 index 000000000..d5c7fbdba --- /dev/null +++ b/packages/website/md/docs/contract_wrappers/installation.md @@ -0,0 +1,11 @@ +**Install** + +```bash +npm install @0xproject/contract-wrappers --save +``` + +**Import** + +```javascript +import { ContractWrappers } from '@0xproject/contract-wrappers'; +``` diff --git a/packages/website/md/docs/contract_wrappers/introduction.md b/packages/website/md/docs/contract_wrappers/introduction.md new file mode 100644 index 000000000..74254bdad --- /dev/null +++ b/packages/website/md/docs/contract_wrappers/introduction.md @@ -0,0 +1,3 @@ +**NOTE:** Release candidate versions are meant to work with V2 of 0x protocol. To interact with V1, select a 0.X version. + +Welcome to the [Contract-wrappers](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract-wrappers) documentation! Contract-wrappers is a library for interacting with the Ethereum smart contracts that make up the 0x protocol. With it, you can easily send transactions and make calls to the 0x smart contracts as well as any token adhering to the token standards supported by the protocol (currently ERC20 & ERC721). diff --git a/packages/website/ts/containers/contract_wrappers_documentation.ts b/packages/website/ts/containers/contract_wrappers_documentation.ts index f0547cecd..67d19bb2a 100644 --- a/packages/website/ts/containers/contract_wrappers_documentation.ts +++ b/packages/website/ts/containers/contract_wrappers_documentation.ts @@ -9,16 +9,31 @@ import { DocPackages } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; -// TODO: Add MD sections -const markdownSections = {}; +/* tslint:disable:no-var-requires */ +const IntroMarkdown = require('md/docs/contract_wrappers/introduction'); +const InstallMarkdown = require('md/docs/contract_wrappers/installation'); +/* tslint:enable:no-var-requires */ + +const markdownSections = { + introduction: 'introduction', + installation: 'installation', +}; const docsInfoConfig: DocsInfoConfig = { id: DocPackages.ContractWrappers, type: SupportedDocJson.TypeDoc, displayName: 'Contract Wrappers', packageUrl: 'https://github.com/0xProject/0x-monorepo', - markdownMenu: {}, - sectionNameToMarkdownByVersion: {}, + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + }, + sectionNameToMarkdownByVersion: { + '0.0.1': { + [markdownSections.introduction]: IntroMarkdown, + [markdownSections.installation]: InstallMarkdown, + }, + }, markdownSections, typeConfigs: { typeNameToPrefix: {}, -- cgit From b5d98a280352d8f697876b35741fcf7b60b3b569 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 2 Aug 2018 21:09:48 +0200 Subject: Fix link in 0x.js intro --- packages/website/md/docs/0xjs/2.0.0/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/md/docs/0xjs/2.0.0/introduction.md b/packages/website/md/docs/0xjs/2.0.0/introduction.md index b98aeef38..d228c6855 100644 --- a/packages/website/md/docs/0xjs/2.0.0/introduction.md +++ b/packages/website/md/docs/0xjs/2.0.0/introduction.md @@ -1,3 +1,3 @@ **NOTE:** Release candidate versions are meant to work with V2 of 0x protocol. To interact with V1, select a 0.X version. -Welcome to the [0x.js](https://github.com/0xProject/0x-monorepo) documentation! 0x.js is a Javascript library for interacting with the 0x protocol. With it, you can easily make calls to the 0x smart contracts as well as any token adhering to the token standards supported by the protocol (currently ERC20 & ERC721). Functionality includes generating, signing, filling and cancelling orders, verifying an orders signature, setting or checking a users ERC20/ERC721 token balance/allowance and much more. +Welcome to the [0x.js](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js) documentation! 0x.js is a Javascript library for interacting with the 0x protocol. With it, you can easily make calls to the 0x smart contracts as well as any token adhering to the token standards supported by the protocol (currently ERC20 & ERC721). Functionality includes generating, signing, filling and cancelling orders, verifying an orders signature, setting or checking a users ERC20/ERC721 token balance/allowance and much more. -- cgit From 6dd656bdfc5e9878a8a6e332b4ea844556f75d56 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 11:14:01 +0200 Subject: Add OrderWatcher docs page --- packages/order-watcher/package.json | 9 ++- .../website/md/docs/order_watcher/installation.md | 17 ++++++ .../website/md/docs/order_watcher/introduction.md | 1 + packages/website/translations/chinese.json | 1 + packages/website/translations/english.json | 1 + packages/website/translations/korean.json | 1 + packages/website/translations/russian.json | 1 + packages/website/translations/spanish.json | 1 + packages/website/ts/components/top_bar/top_bar.tsx | 29 ++++++--- .../ts/containers/order_watcher_documentation.ts | 70 ++++++++++++++++++++++ packages/website/ts/index.tsx | 12 +++- .../website/ts/pages/documentation/doc_page.tsx | 1 + packages/website/ts/pages/landing/landing.tsx | 2 +- packages/website/ts/types.ts | 5 +- 14 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 packages/website/md/docs/order_watcher/installation.md create mode 100644 packages/website/md/docs/order_watcher/introduction.md create mode 100644 packages/website/ts/containers/order_watcher_documentation.ts diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 2b7507f02..917998739 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -25,10 +25,15 @@ "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit" + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { - "contracts_v2_beta": "Exchange WETH9 ERC20Token ERC721Token" + "contracts_v2_beta": "Exchange WETH9 ERC20Token ERC721Token", + "postpublish": { + "assets": [], + "shouldPublishDocs": true + } }, "repository": { "type": "git", diff --git a/packages/website/md/docs/order_watcher/installation.md b/packages/website/md/docs/order_watcher/installation.md new file mode 100644 index 000000000..4b28f583d --- /dev/null +++ b/packages/website/md/docs/order_watcher/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0xproject/order-watcher +``` + +**Import** + +```javascript +import { OrderWatcher } from '@0xproject/order-watcher'; +``` + +or + +```javascript +var OrderWatcher = require('@0xproject/order-utils').OrderWatcher; +``` diff --git a/packages/website/md/docs/order_watcher/introduction.md b/packages/website/md/docs/order_watcher/introduction.md new file mode 100644 index 000000000..f922d922f --- /dev/null +++ b/packages/website/md/docs/order_watcher/introduction.md @@ -0,0 +1 @@ +Welcome to the [@0xproject/order-watcher](https://github.com/0xProject/0x-monorepo/tree/development/packages/order-watcher) documentation! OrderWatcher is a daemon that efficiently watches a set of orders, emitting events whenever the validity of an order changes. It can be used by relayers to prune an orderbook, or by traders to keep orders fetched from a Relayer up-to-date. diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index 8af9835ab..b590861b7 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0x.js": "0x.js", "BLOG": "博客", "FORUM": "论坛", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index b6a8113d3..0ae48d926 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -63,6 +63,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "blog", "FORUM": "forum", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index 1c2b585bf..f61e51e5c 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "블로그", "FORUM": "포럼", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index c2df8ee2a..107798a8c 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "Блог", "FORUM": "Форум", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index a874673cf..3c87b2878 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -63,6 +63,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "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 d2f530fb5..c921867d7 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -84,7 +84,9 @@ const DOC_WEBSITE_PATHS_TO_KEY = { [WebsitePaths.ContractWrappers]: Key.ContractWrappers, [WebsitePaths.Connect]: Key.Connect, [WebsitePaths.ZeroExJs]: Key.ZeroExJs, -} + [WebsitePaths.OrderUtils]: Key.OrderUtils, + [WebsitePaths.OrderWatcher]: Key.OrderWatcher, +}; const DEFAULT_HEIGHT = 68; const EXPANDED_HEIGHT = 75; @@ -166,12 +168,28 @@ export class TopBar extends React.Component { primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)} /> , - + , + + + , + + + , { {this.props.translate.get(key, Deco.Cap)}{' '} {this.props.translate.get(Key.Docs, Deco.Cap)} - + ; } })} {!this._isViewingPortal() && ( @@ -391,10 +409,7 @@ export class TopBar extends React.Component { const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => { return this._doesUrlInclude(websitePath); }); - if ( - !isViewingDocsPage || - _.isUndefined(this.props.menu) - ) { + if (!isViewingDocsPage || _.isUndefined(this.props.menu)) { return undefined; } return ( diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts new file mode 100644 index 000000000..29f1adf7c --- /dev/null +++ b/packages/website/ts/containers/order_watcher_documentation.ts @@ -0,0 +1,70 @@ +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 { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; + +/* tslint:disable:no-var-requires */ +const IntroMarkdown = require('md/docs/order_watcher/introduction'); +const InstallationMarkdown = require('md/docs/order_watcher/installation'); +/* tslint:enable:no-var-requires */ + +const markdownSections = { + introduction: 'introduction', + installation: 'installation', +}; + +const docsInfoConfig: DocsInfoConfig = { + id: DocPackages.OrderWatcher, + type: SupportedDocJson.TypeDoc, + displayName: 'OrderWatcher', + packageUrl: 'https://github.com/0xProject/0x-monorepo', + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + }, + sectionNameToMarkdownByVersion: { + '0.0.1': { + [markdownSections.introduction]: IntroMarkdown, + [markdownSections.installation]: InstallationMarkdown, + }, + }, + markdownSections, + typeConfigs: { + 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): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const Documentation: React.ComponentClass = connect(mapStateToProps, mapDispatchToProps)( + DocPageComponent, +); diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 36b2f6b87..cfe8a1c9c 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -40,6 +40,9 @@ const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () const LazyContractWrappersDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "contractWrapperDocs" */ 'ts/containers/contract_wrappers_documentation'), ); +const LazyOrderWatcherDocumentation = createLazyComponent('Documentation', async () => + System.import(/* webpackChunkName: "orderWatcherDocs" */ 'ts/containers/order_watcher_documentation'), +); const LazySmartContractsDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "smartContractDocs" */ 'ts/containers/smart_contracts_documentation'), ); @@ -83,7 +86,14 @@ render( - + + { style={{ fontFamily: 'Roboto Mono' }} >
{this.props.translate.get(Key.OffChainOrderRelay, Deco.Cap)}
-
{this.props.translate.get(Key.OonChainSettlement, Deco.Cap)}
+
{this.props.translate.get(Key.OnChainSettlement, Deco.Cap)}
Date: Fri, 3 Aug 2018 11:14:16 +0200 Subject: Fix-up Order-utils doc page --- packages/website/ts/containers/order_utils_documentation.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/website/ts/containers/order_utils_documentation.ts b/packages/website/ts/containers/order_utils_documentation.ts index 9af863d8a..2b9465d92 100644 --- a/packages/website/ts/containers/order_utils_documentation.ts +++ b/packages/website/ts/containers/order_utils_documentation.ts @@ -17,8 +17,6 @@ const InstallationMarkdownV1 = require('md/docs/order_utils/1.0.0/installation') const markdownSections = { introduction: 'introduction', installation: 'installation', - usage: 'usage', - types: 'types', }; const docsInfoConfig: DocsInfoConfig = { @@ -29,8 +27,6 @@ const docsInfoConfig: DocsInfoConfig = { markdownMenu: { introduction: [markdownSections.introduction], install: [markdownSections.installation], - usage: [markdownSections.usage], - types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { @@ -38,7 +34,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.installation]: InstallationMarkdownV1, }, }, - markdownSections: markdownSections, + markdownSections, typeConfigs: { typeNameToExternalLink: { BigNumber: constants.URL_BIGNUMBERJS_GITHUB, -- cgit From 4a2a22a43b5d904834cddae5768d9adf3efedf30 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 11:44:50 +0200 Subject: Refactor logic for clarity --- packages/react-docs/src/utils/typedoc_utils.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index f1f42c36d..ad794c0fa 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -437,18 +437,23 @@ export const typeDocUtils = { return typeDocUtils._convertType(t, sections, sectionName, docId); }); - const isConstructor = false; + let indexSignatureIfExists; + let methodIfExists; const doesIndexSignatureExist = !_.isUndefined(entity.declaration) && !_.isUndefined(entity.declaration.indexSignature); - let indexSignatureIfExists; if (doesIndexSignatureExist) { const indexSignature = entity.declaration.indexSignature as TypeDocNode; indexSignatureIfExists = typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId); + } else if (!_.isUndefined(entity.declaration)) { + const isConstructor = false; + methodIfExists = typeDocUtils._convertMethod( + entity.declaration, + isConstructor, + sections, + sectionName, + docId, + ); } - const methodIfExists = - !_.isUndefined(entity.declaration) && !doesIndexSignatureExist - ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) - : undefined; const elementTypeIfExists = !_.isUndefined(entity.elementType) ? { -- cgit From e4aed98a3dbbe95c7cac877bcbe06f51f3de81ba Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 12:40:01 +0200 Subject: Add missing type exports --- packages/sol-compiler/src/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index de2de796e..89d529887 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,2 +1,9 @@ export { Compiler } from './compiler'; -export { CompilerOptions, ContractArtifact, ContractNetworks } from './utils/types'; + +export { + CompilerOptions, + ContractArtifact, + ContractNetworks, + GeneratedCompilerOptions, + ContractNetworkData, +} from './utils/types'; -- cgit From d4bd4ec441317c916e515ba0c6f48d63ea8665f9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 12:40:35 +0200 Subject: Add comments for types and unnest type declarations --- packages/sol-compiler/src/utils/types.ts | 44 ++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index 4321a2235..e2e7a4e53 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -7,22 +7,39 @@ export enum AbiType { Fallback = 'fallback', } +/** + * This type defines the schema of the artifact.json file generated by Sol-compiler + * schemaVersion: The version of the artifact schema + * contractName: The contract name it represents + * networks: Network specific information by network (address, id, constructor args, etc...) + * compilerOutput: The Solidity compiler output generated from the specified compiler input + * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) + * compiler: The compiler settings used + * sourceCodes: The source code of the contract and all it's dependencies + * sources: A mapping from source filePath to sourceMap id + * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies. + * If any of the sources change, the hash would change notifying us that a re-compilation is necessary + */ export interface ContractArtifact extends ContractVersionData { schemaVersion: string; contractName: string; networks: ContractNetworks; } +export interface GeneratedCompilerOptions { + name: 'solc'; + version: string; + settings: solc.CompilerSettings; +} + +export interface Source { + id: number; +} + export interface ContractVersionData { - compiler: { - name: 'solc'; - version: string; - settings: solc.CompilerSettings; - }; + compiler: GeneratedCompilerOptions; sources: { - [sourceName: string]: { - id: number; - }; + [sourceName: string]: Source; }; sourceCodes: { [sourceName: string]: string; @@ -47,6 +64,17 @@ export interface SolcErrors { [key: string]: boolean; } +/** + * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler + * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories. + * artifactsDir: Directory where you want the generated artifacts.json written to + * compilerSettings: Desired settings to pass to the Solidity compiler during compilation. + * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) + * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the + * specified directory. + * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all + * contracts to compile with the the version specified here. + */ export interface CompilerOptions { contractsDir?: string; artifactsDir?: string; -- cgit From 8c96a31152064a94513c72daec1a66510a49fde4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 12:40:47 +0200 Subject: Fix sol-compiler doc configs --- packages/website/ts/containers/sol_compiler_documentation.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index 635c2112b..dda3840c7 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -18,8 +18,6 @@ const markdownSections = { introduction: 'introduction', installation: 'installation', usage: 'usage', - compiler: 'compiler', - types: docConstants.TYPES_SECTION_NAME, }; const docsInfoConfig: DocsInfoConfig = { @@ -31,8 +29,6 @@ const docsInfoConfig: DocsInfoConfig = { introduction: [markdownSections.introduction], install: [markdownSections.installation], usage: [markdownSections.usage], - compiler: [markdownSections.compiler], - types: [markdownSections.types], }, sectionNameToMarkdownByVersion: { '0.0.1': { -- cgit From d136df7679b85eff054178ae8103ecd1f3b324f9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 13:02:14 +0200 Subject: Color-code basic type arrays orange aswell --- packages/react-docs/src/components/type.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index ea66c7b1e..40564c0d6 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -12,6 +12,8 @@ import { Signature } from './signature'; import { constants } from '../utils/constants'; import { TypeDefinition } from './type_definition'; +const basicJsTypes = ['string', 'number', 'undefined', 'null', 'boolean']; + export interface TypeProps { type: TypeDef; docsInfo: DocsInfo; @@ -73,6 +75,9 @@ export function Type(props: TypeProps): any { case TypeDocTypes.Array: typeName = type.elementType.name; + if (_.includes(basicJsTypes, typeName)) { + typeNameColor = colors.orange; + } break; case TypeDocTypes.Union: -- cgit From 13520dbd94831cd93e419d000e933bfb75c99e84 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 13:02:29 +0200 Subject: Add missing types to sol-cov index.ts --- packages/sol-cov/src/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index 0e70878ad..35135c295 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -5,4 +5,15 @@ export { RevertTraceSubprovider } from './revert_trace_subprovider'; export { SolCompilerArtifactAdapter } from './artifact_adapters/sol_compiler_artifact_adapter'; export { TruffleArtifactAdapter } from './artifact_adapters/truffle_artifact_adapter'; export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; -export { ContractData, TraceInfo, Subtrace, SourceRange, Coverage } from './types'; +export { + ContractData, + TraceInfo, + Subtrace, + SourceRange, + Coverage, + TraceInfoNewContract, + TraceInfoExistingContract, + SingleFileSourceRange, +} from './types'; +export { StructLog, JSONRPCRequestPayload, Provider } from 'ethereum-types'; +export { ErrorCallback, NextCallback } from '@0xproject/subproviders'; -- cgit From 406b7c33f553ab40aee5e1fe068b9f3d190a4fdd Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 13:27:08 +0200 Subject: Re-order subproviders index.ts and add missing types --- packages/subproviders/src/index.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 905590539..eb9347bdb 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -1,11 +1,21 @@ import Eth from '@ledgerhq/hw-app-eth'; import TransportU2F from '@ledgerhq/hw-transport-u2f'; +import { LedgerEthereumClient } from './types'; + export import Web3ProviderEngine = require('web3-provider-engine'); -export { ECSignature } from '@0xproject/types'; -import { LedgerEthereumClient } from './types'; +/** + * A factory method for creating a LedgerEthereumClient usable in a browser context. + * @return LedgerEthereumClient A browser client for the LedgerSubprovider + */ +export async function ledgerEthereumBrowserClientFactoryAsync(): Promise { + const ledgerConnection = await TransportU2F.create(); + const ledgerEthClient = new Eth(ledgerConnection); + return ledgerEthClient; +} export { prependSubprovider } from './utils/subprovider_utils'; + export { EmptyWalletSubprovider } from './subproviders/empty_wallet_subprovider'; export { FakeGasEstimateSubprovider } from './subproviders/fake_gas_estimate_subprovider'; export { SignerSubprovider } from './subproviders/signer'; @@ -18,6 +28,7 @@ export { NonceTrackerSubprovider } from './subproviders/nonce_tracker'; export { PrivateKeyWalletSubprovider } from './subproviders/private_key_wallet'; export { MnemonicWalletSubprovider } from './subproviders/mnemonic_wallet'; export { EthLightwalletSubprovider } from './subproviders/eth_lightwallet_subprovider'; + export { Callback, ErrorCallback, @@ -28,16 +39,13 @@ export { LedgerSubproviderConfigs, PartialTxParams, DerivedHDKeyInfo, + JSONRPCRequestPayloadWithMethod, + ECSignatureString, + AccountFetchingConfigs, + LedgerEthereumClientFactoryAsync, + OnNextCompleted, } from './types'; -/** - * A factory method for creating a LedgerEthereumClient usable in a browser context. - * @return LedgerEthereumClient A browser client for the LedgerSubprovider - */ -export async function ledgerEthereumBrowserClientFactoryAsync(): Promise { - const ledgerConnection = await TransportU2F.create(); - const ledgerEthClient = new Eth(ledgerConnection); - return ledgerEthClient; -} +export { ECSignature } from '@0xproject/types'; -export { JSONRPCRequestPayload, Provider } from 'ethereum-types'; +export { JSONRPCRequestPayload, Provider, JSONRPCResponsePayload, JSONRPCErrorCallback } from 'ethereum-types'; -- cgit From 10f6647ab3ac17e25a755d9d1424c53f88e7151c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 13:27:20 +0200 Subject: Add missing types to web3-wrapper index.ts --- packages/web3-wrapper/src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index b6d1bf1b2..89cf566db 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -13,4 +13,13 @@ export { FilterObject, CallData, TransactionReceiptWithDecodedLogs, + BlockWithTransactionData, + LogTopic, + JSONRPCRequestPayload, + TransactionReceiptStatus, + LogWithDecodedArgs, + DecodedLogArgs, + StructLog, + JSONRPCErrorCallback, + BlockParamLiteral, } from 'ethereum-types'; -- cgit From 3ee3fc2fb35b5ecc8237363d6307b7135ed4f927 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:13:10 +0200 Subject: Add missing doc comments --- .../src/contract_wrappers/erc20_proxy_wrapper.ts | 8 ++++++++ .../src/contract_wrappers/erc20_token_wrapper.ts | 8 ++++++++ .../src/contract_wrappers/erc721_proxy_wrapper.ts | 8 ++++++++ .../src/contract_wrappers/erc721_token_wrapper.ts | 8 ++++++++ .../src/contract_wrappers/ether_token_wrapper.ts | 8 ++++++++ .../src/contract_wrappers/exchange_wrapper.ts | 17 +++++++++++++++-- packages/contracts/test/utils/erc20_wrapper.ts | 6 ++++++ packages/sol-cov/src/trace_collection_subprovider.ts | 1 + .../src/subproviders/eth_lightwallet_subprovider.ts | 5 +++++ packages/subproviders/src/subproviders/ganache.ts | 2 +- .../src/subproviders/redundant_subprovider.ts | 2 +- .../subproviders/src/subproviders/rpc_subprovider.ts | 6 +++++- packages/subproviders/src/subproviders/subprovider.ts | 6 ++++++ packages/web3-wrapper/src/web3_wrapper.ts | 1 + 14 files changed, 81 insertions(+), 5 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts index 821d1a8a2..d60d4339b 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts @@ -16,6 +16,14 @@ export class ERC20ProxyWrapper extends ContractWrapper { public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi; private _erc20ProxyContractIfExists?: ERC20ProxyContract; private _contractAddressIfExists?: string; + /** + * Instantiate ERC20ProxyWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.erc20Proxy). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param contractAddressIfExists The contract address to use. This is usually pulled from + * the artifacts but needs to be specified when using with your own custom testnet. + */ constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) { super(web3Wrapper, networkId); this._contractAddressIfExists = contractAddressIfExists; diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts index 17bda5085..7ff0ee72e 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts @@ -34,6 +34,14 @@ export class ERC20TokenWrapper extends ContractWrapper { public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; private _tokenContractsByAddress: { [address: string]: ERC20TokenContract }; private _erc20ProxyWrapper: ERC20ProxyWrapper; + /** + * Instantiate ERC20TokenWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.erc20Token). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param erc20ProxyWrapper The ERC20ProxyWrapper instance to use + * @param blockPollingIntervalMs The block polling interval to use for active subscriptions + */ constructor( web3Wrapper: Web3Wrapper, networkId: number, diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts index 38ecd4687..c17905cb7 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts @@ -16,6 +16,14 @@ export class ERC721ProxyWrapper extends ContractWrapper { public abi: ContractAbi = artifacts.ERC20Proxy.compilerOutput.abi; private _erc721ProxyContractIfExists?: ERC721ProxyContract; private _contractAddressIfExists?: string; + /** + * Instantiate ERC721ProxyWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.erc721Proxy). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param contractAddressIfExists The contract address to use. This is usually pulled from + * the artifacts but needs to be specified when using with your own custom testnet. + */ constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) { super(web3Wrapper, networkId); this._contractAddressIfExists = contractAddressIfExists; diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts index 7231e0bde..6e0eede70 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts @@ -33,6 +33,14 @@ export class ERC721TokenWrapper extends ContractWrapper { public abi: ContractAbi = artifacts.ERC721Token.compilerOutput.abi; private _tokenContractsByAddress: { [address: string]: ERC721TokenContract }; private _erc721ProxyWrapper: ERC721ProxyWrapper; + /** + * Instantiate ERC721TokenWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.erc721Token). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param erc721ProxyWrapper The ERC721ProxyWrapper instance to use + * @param blockPollingIntervalMs The block polling interval to use for active subscriptions + */ constructor( web3Wrapper: Web3Wrapper, networkId: number, diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts index 5046d3667..d7b6effd8 100644 --- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts @@ -24,6 +24,14 @@ export class EtherTokenWrapper extends ContractWrapper { [address: string]: WETH9Contract; } = {}; private _erc20TokenWrapper: ERC20TokenWrapper; + /** + * Instantiate EtherTokenWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.etherToken). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param erc20TokenWrapper The ERC20TokenWrapper instance to use + * @param blockPollingIntervalMs The block polling interval to use for active subscriptions + */ constructor( web3Wrapper: Web3Wrapper, networkId: number, diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index 3e7619228..5beb35a27 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -34,6 +34,17 @@ export class ExchangeWrapper extends ContractWrapper { private _exchangeContractIfExists?: ExchangeContract; private _contractAddressIfExists?: string; private _zrxContractAddressIfExists?: string; + /** + * Instantiate ExchangeWrapper. We recommend you don't instantiate this yourself, rather + * use it through the ContractWrappers class property (contractWrappers.exchange). + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + * @param contractAddressIfExists The exchange contract address to use. This is usually pulled from + * the artifacts but needs to be specified when using with your own custom testnet. + * @param zrxContractAddressIfExists The ZRXToken contract address to use. This is usually pulled from + * the artifacts but needs to be specified when using with your own custom testnet. + * @param blockPollingIntervalMs The block polling interval to use for active subscriptions + */ constructor( web3Wrapper: Web3Wrapper, networkId: number, @@ -626,7 +637,7 @@ export class ExchangeWrapper extends ContractWrapper { } /** * Batch version of cancelOrderAsync. Executes multiple cancels atomically in a single transaction. - * @param orders An array of orders to cancel. + * @param orders An array of orders to cancel.Optional arguments this method accepts. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @@ -665,6 +676,7 @@ export class ExchangeWrapper extends ContractWrapper { * @param leftSignedOrder First order to match. * @param rightSignedOrder Second order to match. * @param takerAddress The address that sends the transaction and gets the spread. + * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @decorators.asyncZeroExErrorHandler @@ -723,6 +735,7 @@ export class ExchangeWrapper extends ContractWrapper { * @param signerAddress Address that should have signed the given hash. * @param signature Proof that the hash has been signed by signer. * @param senderAddress Address that should send the transaction. + * @param orderTransactionOpts Optional arguments this method accepts. * @returns Transaction hash. */ @decorators.asyncZeroExErrorHandler @@ -881,7 +894,7 @@ export class ExchangeWrapper extends ContractWrapper { /** * Cancel a given order. * @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel. - * @param transactionOpts Optional arguments this method accepts. + * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @decorators.asyncZeroExErrorHandler diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts index 424aae579..95b31dfa6 100644 --- a/packages/contracts/test/utils/erc20_wrapper.ts +++ b/packages/contracts/test/utils/erc20_wrapper.ts @@ -20,6 +20,12 @@ export class ERC20Wrapper { private readonly _dummyTokenContracts: DummyERC20TokenContract[]; private _proxyContract?: ERC20ProxyContract; private _proxyIdIfExists?: string; + /** + * + * @param provider Web3 provider to use for all JSON RPC requests + * @param tokenOwnerAddresses + * @param contractOwnerAddress + */ constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._dummyTokenContracts = []; this._web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index b530b59db..5a101dfeb 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -109,6 +109,7 @@ export abstract class TraceCollectionSubprovider extends Subprovider { * Set's the subprovider's engine to the ProviderEngine it is added to. * This is only called within the ProviderEngine source code, do not call * directly. + * @param engine The ProviderEngine this subprovider is added to */ public setEngine(engine: Provider): void { super.setEngine(engine); diff --git a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts index 454dae58e..17fe59368 100644 --- a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts @@ -14,6 +14,11 @@ import { PrivateKeyWalletSubprovider } from './private_key_wallet'; export class EthLightwalletSubprovider extends BaseWalletSubprovider { private readonly _keystore: lightwallet.keystore; private readonly _pwDerivedKey: Uint8Array; + /** + * + * @param keystore The EthLightWallet keystore you wish to use + * @param pwDerivedKey The password derived key to use + */ constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) { super(); this._keystore = keystore; diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts index 986094dba..2b8544f8b 100644 --- a/packages/subproviders/src/subproviders/ganache.ts +++ b/packages/subproviders/src/subproviders/ganache.ts @@ -24,7 +24,7 @@ export class GanacheSubprovider extends Subprovider { * It is called internally by the ProviderEngine when it is this subproviders * turn to handle a JSON RPC request. * @param payload JSON RPC payload - * @param next Callback to call if this subprovider decides not to handle the request + * @param _next Callback to call if this subprovider decides not to handle the request * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix diff --git a/packages/subproviders/src/subproviders/redundant_subprovider.ts b/packages/subproviders/src/subproviders/redundant_subprovider.ts index 7aa6226d5..59a2986f8 100644 --- a/packages/subproviders/src/subproviders/redundant_subprovider.ts +++ b/packages/subproviders/src/subproviders/redundant_subprovider.ts @@ -34,7 +34,7 @@ export class RedundantSubprovider extends Subprovider { } /** * Instantiates a new RedundantSubprovider - * @param endpoints JSON RPC endpoints to attempt. Attempts are made in the order of the endpoints. + * @param subproviders Subproviders to attempt the request with */ constructor(subproviders: Subprovider[]) { super(); diff --git a/packages/subproviders/src/subproviders/rpc_subprovider.ts b/packages/subproviders/src/subproviders/rpc_subprovider.ts index d874c6f05..18d6da307 100644 --- a/packages/subproviders/src/subproviders/rpc_subprovider.ts +++ b/packages/subproviders/src/subproviders/rpc_subprovider.ts @@ -15,6 +15,10 @@ import { Subprovider } from './subprovider'; export class RPCSubprovider extends Subprovider { private readonly _rpcUrl: string; private readonly _requestTimeoutMs: number; + /** + * @param rpcUrl URL to the backing Ethereum node to which JSON RPC requests should be sent + * @param requestTimeoutMs Amount of miliseconds to wait before timing out the JSON RPC request + */ constructor(rpcUrl: string, requestTimeoutMs: number = 20000) { super(); assert.isString('rpcUrl', rpcUrl); @@ -27,7 +31,7 @@ export class RPCSubprovider extends Subprovider { * It is called internally by the ProviderEngine when it is this subproviders * turn to handle a JSON RPC request. * @param payload JSON RPC payload - * @param next Callback to call if this subprovider decides not to handle the request + * @param _next Callback to call if this subprovider decides not to handle the request * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts index 5dc273569..53a3d07ea 100644 --- a/packages/subproviders/src/subproviders/subprovider.ts +++ b/packages/subproviders/src/subproviders/subprovider.ts @@ -32,6 +32,11 @@ export abstract class Subprovider { // 16 digits return datePart + extraPart; } + /** + * @param payload JSON RPC request payload + * @param next A callback to pass the request to the next subprovider in the stack + * @param end A callback called once the subprovider is done handling the request + */ // tslint:disable-next-line:async-suffix public abstract async handleRequest( payload: JSONRPCRequestPayload, @@ -55,6 +60,7 @@ export abstract class Subprovider { * Set's the subprovider's engine to the ProviderEngine it is added to. * This is only called within the ProviderEngine source code, do not call * directly. + * @param engine The ProviderEngine this subprovider is added to */ public setEngine(engine: Provider): void { this.engine = engine; diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index dd35e2094..ea78f8801 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -237,6 +237,7 @@ export class Web3Wrapper { /** * Retrieves an accounts Ether balance in wei * @param owner Account whose balance you wish to check + * @param defaultBlock The block depth at which to fetch the balance (default=latest) * @returns Balance in wei */ public async getBalanceInWeiAsync(owner: string, defaultBlock?: BlockParam): Promise { -- cgit From b8c8258404fa7959b71dd9e87fba16d32b57a868 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:13:38 +0200 Subject: Don't render object literal properties that start with underscore since are private --- packages/react-docs/src/components/property_block.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index 074c59c5f..ea80ba7b7 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -48,7 +48,8 @@ export class PropertyBlock extends React.Component
- {(property as any).callPath}{property.name}:{' '} + {(property as any).callPath} + {property.name}:{' '} {property.source && ( -- cgit From 0d3d9dad846d01e84be3b52d48bfabd9e1853b66 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:14:14 +0200 Subject: Don't process functions beginning with underscores --- packages/react-docs/src/utils/typedoc_utils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index ad794c0fa..b74b9562b 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -154,8 +154,17 @@ export const typeDocUtils = { case KindString.Function: if (entity.flags.isExported) { - const func = typeDocUtils._convertFunction(entity, docsInfo.sections, sectionName, docsInfo.id); - docSection.functions.push(func); + const funcName = (entity as TypeDocNode).signatures[0].name; + const isPublicFunc = !_.startsWith(funcName, '_'); + if (isPublicFunc) { + const func = typeDocUtils._convertFunction( + entity, + docsInfo.sections, + sectionName, + docsInfo.id, + ); + docSection.functions.push(func); + } } break; -- cgit From d85ce6ac758a9a726c298b972a7c557e01f2ab2f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:15:14 +0200 Subject: Make signature_util into an object literal so related functions are rendered together in the docs --- packages/0x.js/src/0x.ts | 9 +- packages/contract-wrappers/src/utils/assert.ts | 4 +- .../contracts/test/exchange/signature_validator.ts | 22 +- packages/fill-scenarios/src/fill_scenarios.ts | 3 +- packages/order-utils/src/index.ts | 12 +- packages/order-utils/src/order_factory.ts | 9 +- packages/order-utils/src/order_validation_utils.ts | 4 +- packages/order-utils/src/signature_utils.ts | 559 +++++++++++---------- packages/order-utils/test/signature_utils_test.ts | 68 ++- packages/order-watcher/src/utils/assert.ts | 4 +- 10 files changed, 378 insertions(+), 316 deletions(-) diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 2a2b82f63..9c01ebd9e 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -11,9 +11,8 @@ import { } from '@0xproject/contract-wrappers'; import { assetDataUtils, - ecSignOrderHashAsync, generatePseudoRandomSalt, - isValidSignatureAsync, + signatureUtils, MessagePrefixOpts, orderHashUtils, } from '@0xproject/order-utils'; @@ -198,7 +197,7 @@ export class ZeroEx { * @return Whether the signature is valid for the supplied signerAddress and data. */ public async isValidSignatureAsync(data: string, signature: string, signerAddress: string): Promise { - const isValid = await isValidSignatureAsync( + const isValid = await signatureUtils.isValidSignatureAsync( this._contractWrappers.getProvider(), data, signature, @@ -238,7 +237,7 @@ export class ZeroEx { * @param orderHash Hex encoded orderHash to sign. * @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address * must be available via the Provider supplied to 0x.js. - * @param MessagePrefixOpts Options regarding the desired prefix and whether to add it before calling `eth_sign` + * @param messagePrefixOpts Options regarding the desired prefix and whether to add it before calling `eth_sign` * @return An object containing the Elliptic curve signature parameters generated by signing the orderHash. */ public async ecSignOrderHashAsync( @@ -246,7 +245,7 @@ export class ZeroEx { signerAddress: string, messagePrefixOpts: MessagePrefixOpts, ): Promise { - const signature = await ecSignOrderHashAsync( + const signature = await signatureUtils.ecSignOrderHashAsync( this._contractWrappers.getProvider(), orderHash, signerAddress, diff --git a/packages/contract-wrappers/src/utils/assert.ts b/packages/contract-wrappers/src/utils/assert.ts index 842b16fa0..652e5bec3 100644 --- a/packages/contract-wrappers/src/utils/assert.ts +++ b/packages/contract-wrappers/src/utils/assert.ts @@ -1,7 +1,7 @@ import { assert as sharedAssert } from '@0xproject/assert'; // HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here import { Schema } from '@0xproject/json-schemas'; // tslint:disable-line:no-unused-variable -import { isValidSignatureAsync } from '@0xproject/order-utils'; +import { signatureUtils } from '@0xproject/order-utils'; import { ECSignature } from '@0xproject/types'; // tslint:disable-line:no-unused-variable import { BigNumber } from '@0xproject/utils'; // tslint:disable-line:no-unused-variable import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -15,7 +15,7 @@ export const assert = { signature: string, signerAddress: string, ): Promise { - const isValid = await isValidSignatureAsync(provider, orderHash, signature, signerAddress); + const isValid = await signatureUtils.isValidSignatureAsync(provider, orderHash, signature, signerAddress); this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); }, isValidSubscriptionToken(variableName: string, subscriptionToken: string): void { diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index f2bb42c75..d5e522220 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { addSignedMessagePrefix, assetDataUtils, MessagePrefixType, orderHashUtils } from '@0xproject/order-utils'; +import { signatureUtils, assetDataUtils, MessagePrefixType, orderHashUtils } from '@0xproject/order-utils'; import { RevertReason, SignatureType, SignedOrder } from '@0xproject/types'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -213,7 +213,10 @@ describe('MixinSignatureValidator', () => { it('should return true when SignatureType=EthSign and signature is valid', async () => { // Create EthSign signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithEthSignPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.EthSign); + const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.EthSign, + ); const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey); // Create 0x signature from EthSign signature @@ -236,7 +239,10 @@ describe('MixinSignatureValidator', () => { it('should return false when SignatureType=EthSign and signature is invalid', async () => { // Create EthSign signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithEthSignPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.EthSign); + const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.EthSign, + ); const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey); // Create 0x signature from EthSign signature @@ -385,7 +391,10 @@ describe('MixinSignatureValidator', () => { it('should return true when SignatureType=Trezor and signature is valid', async () => { // Create Trezor signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithTrezorPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.Trezor); + const orderHashWithTrezorPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.Trezor, + ); const orderHashWithTrezorPrefixBuffer = ethUtil.toBuffer(orderHashWithTrezorPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithTrezorPrefixBuffer, signerPrivateKey); // Create 0x signature from Trezor signature @@ -408,7 +417,10 @@ describe('MixinSignatureValidator', () => { it('should return false when SignatureType=Trezor and signature is invalid', async () => { // Create Trezor signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithTrezorPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.Trezor); + const orderHashWithTrezorPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.Trezor, + ); const orderHashWithTrezorPrefixBuffer = ethUtil.toBuffer(orderHashWithTrezorPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithTrezorPrefixBuffer, signerPrivateKey); // Create 0x signature from Trezor signature diff --git a/packages/fill-scenarios/src/fill_scenarios.ts b/packages/fill-scenarios/src/fill_scenarios.ts index 8f2766e24..087fd37a5 100644 --- a/packages/fill-scenarios/src/fill_scenarios.ts +++ b/packages/fill-scenarios/src/fill_scenarios.ts @@ -1,4 +1,5 @@ -import { assetDataUtils, orderFactory } from '@0xproject/order-utils'; +import { assetDataUtils } from '@0xproject/order-utils'; +import { orderFactory } from '@0xproject/order-utils/lib/src/order_factory'; import { AssetProxyId, ERC721AssetData, OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index da53f620a..5852a01b9 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -1,15 +1,5 @@ export { orderHashUtils } from './order_hash'; -export { - isValidSignatureAsync, - isValidPresignedSignatureAsync, - isValidWalletSignatureAsync, - isValidValidatorSignatureAsync, - isValidECSignature, - ecSignOrderHashAsync, - addSignedMessagePrefix, - parseECSignature, -} from './signature_utils'; -export { orderFactory } from './order_factory'; +export { signatureUtils } from './signature_utils'; export { constants } from './constants'; export { crypto } from './crypto'; export { generatePseudoRandomSalt } from './salt'; diff --git a/packages/order-utils/src/order_factory.ts b/packages/order-utils/src/order_factory.ts index 803cb82b1..14122f353 100644 --- a/packages/order-utils/src/order_factory.ts +++ b/packages/order-utils/src/order_factory.ts @@ -6,7 +6,7 @@ import * as _ from 'lodash'; import { orderHashUtils } from './order_hash'; import { generatePseudoRandomSalt } from './salt'; -import { ecSignOrderHashAsync } from './signature_utils'; +import { signatureUtils } from './signature_utils'; import { MessagePrefixType } from './types'; export const orderFactory = { @@ -49,7 +49,12 @@ export const orderFactory = { prefixType: MessagePrefixType.EthSign, shouldAddPrefixBeforeCallingEthSign: false, }; - const ecSignature = await ecSignOrderHashAsync(provider, orderHash, makerAddress, messagePrefixOpts); + const ecSignature = await signatureUtils.ecSignOrderHashAsync( + provider, + orderHash, + makerAddress, + messagePrefixOpts, + ); const signature = getVRSHexString(ecSignature); const signedOrder: SignedOrder = _.assign(order, { signature }); return signedOrder; diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts index 67d747081..ccc6e653f 100644 --- a/packages/order-utils/src/order_validation_utils.ts +++ b/packages/order-utils/src/order_validation_utils.ts @@ -9,7 +9,7 @@ import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_f import { constants } from './constants'; import { ExchangeTransferSimulator } from './exchange_transfer_simulator'; import { orderHashUtils } from './order_hash'; -import { isValidSignatureAsync } from './signature_utils'; +import { signatureUtils } from './signature_utils'; import { utils } from './utils'; export class OrderValidationUtils { @@ -147,7 +147,7 @@ export class OrderValidationUtils { throw new Error(RevertReason.InvalidTakerAmount); } const orderHash = orderHashUtils.getOrderHashHex(signedOrder); - const isValid = await isValidSignatureAsync( + const isValid = await signatureUtils.isValidSignatureAsync( provider, orderHash, signedOrder.signature, diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 26fb24705..2dc465256 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -13,288 +13,307 @@ import { IWalletContract } from './generated_contract_wrappers/i_wallet'; import { MessagePrefixOpts, MessagePrefixType, OrderError } from './types'; import { utils } from './utils'; -/** - * Verifies that the provided signature is valid according to the 0x Protocol smart contracts - * @param data The hex encoded data signed by the supplied signature. - * @param signature A hex encoded 0x Protocol signature made up of: [TypeSpecificData][SignatureType]. - * E.g [vrs][SignatureType.EIP712] - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the signature is valid for the supplied signerAddress and data. - */ -export async function isValidSignatureAsync( - provider: Provider, - data: string, - signature: string, - signerAddress: string, -): Promise { - assert.isWeb3Provider('provider', provider); - assert.isHexString('data', data); - assert.isHexString('signature', signature); - assert.isETHAddressHex('signerAddress', signerAddress); - const signatureTypeIndexIfExists = utils.getSignatureTypeIndexIfExists(signature); - if (_.isUndefined(signatureTypeIndexIfExists)) { - throw new Error(`Unrecognized signatureType in signature: ${signature}`); - } - - switch (signatureTypeIndexIfExists) { - case SignatureType.Illegal: - case SignatureType.Invalid: - return false; - - case SignatureType.EIP712: { - const ecSignature = parseECSignature(signature); - return isValidECSignature(data, ecSignature, signerAddress); - } - - case SignatureType.EthSign: { - const ecSignature = parseECSignature(signature); - const prefixedMessageHex = addSignedMessagePrefix(data, MessagePrefixType.EthSign); - return isValidECSignature(prefixedMessageHex, ecSignature, signerAddress); +export const signatureUtils = { + /** + * Verifies that the provided signature is valid according to the 0x Protocol smart contracts + * @param provider Web3 provider to use for all JSON RPC requests + * @param data The hex encoded data signed by the supplied signature. + * @param signature A hex encoded 0x Protocol signature made up of: [TypeSpecificData][SignatureType]. + * E.g [vrs][SignatureType.EIP712] + * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. + * @return Whether the signature is valid for the supplied signerAddress and data. + */ + async isValidSignatureAsync( + provider: Provider, + data: string, + signature: string, + signerAddress: string, + ): Promise { + assert.isWeb3Provider('provider', provider); + assert.isHexString('data', data); + assert.isHexString('signature', signature); + assert.isETHAddressHex('signerAddress', signerAddress); + const signatureTypeIndexIfExists = utils.getSignatureTypeIndexIfExists(signature); + if (_.isUndefined(signatureTypeIndexIfExists)) { + throw new Error(`Unrecognized signatureType in signature: ${signature}`); } - case SignatureType.Caller: - // HACK: We currently do not "validate" the caller signature type. - // It can only be validated during Exchange contract execution. - throw new Error('Caller signature type cannot be validated off-chain'); - - case SignatureType.Wallet: { - const isValid = await isValidWalletSignatureAsync(provider, data, signature, signerAddress); - return isValid; - } - - case SignatureType.Validator: { - const isValid = await isValidValidatorSignatureAsync(provider, data, signature, signerAddress); - return isValid; + switch (signatureTypeIndexIfExists) { + case SignatureType.Illegal: + case SignatureType.Invalid: + return false; + + case SignatureType.EIP712: { + const ecSignature = signatureUtils.parseECSignature(signature); + return signatureUtils.isValidECSignature(data, ecSignature, signerAddress); + } + + case SignatureType.EthSign: { + const ecSignature = signatureUtils.parseECSignature(signature); + const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, MessagePrefixType.EthSign); + return signatureUtils.isValidECSignature(prefixedMessageHex, ecSignature, signerAddress); + } + + case SignatureType.Caller: + // HACK: We currently do not "validate" the caller signature type. + // It can only be validated during Exchange contract execution. + throw new Error('Caller signature type cannot be validated off-chain'); + + case SignatureType.Wallet: { + const isValid = await signatureUtils.isValidWalletSignatureAsync( + provider, + data, + signature, + signerAddress, + ); + return isValid; + } + + case SignatureType.Validator: { + const isValid = await signatureUtils.isValidValidatorSignatureAsync( + provider, + data, + signature, + signerAddress, + ); + return isValid; + } + + case SignatureType.PreSigned: { + return signatureUtils.isValidPresignedSignatureAsync(provider, data, signerAddress); + } + + case SignatureType.Trezor: { + const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, MessagePrefixType.Trezor); + const ecSignature = signatureUtils.parseECSignature(signature); + return signatureUtils.isValidECSignature(prefixedMessageHex, ecSignature, signerAddress); + } + + default: + throw new Error(`Unhandled SignatureType: ${signatureTypeIndexIfExists}`); } - - case SignatureType.PreSigned: { - return isValidPresignedSignatureAsync(provider, data, signerAddress); - } - - case SignatureType.Trezor: { - const prefixedMessageHex = addSignedMessagePrefix(data, MessagePrefixType.Trezor); - const ecSignature = parseECSignature(signature); - return isValidECSignature(prefixedMessageHex, ecSignature, signerAddress); + }, + /** + * Verifies that the provided presigned signature is valid according to the 0x Protocol smart contracts + * @param provider Web3 provider to use for all JSON RPC requests + * @param data The hex encoded data signed by the supplied signature + * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. + * @return Whether the data was preSigned by the supplied signerAddress + */ + async isValidPresignedSignatureAsync(provider: Provider, data: string, signerAddress: string): Promise { + assert.isWeb3Provider('provider', provider); + assert.isHexString('data', data); + assert.isETHAddressHex('signerAddress', signerAddress); + const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider); + const isValid = await exchangeContract.preSigned.callAsync(data, signerAddress); + return isValid; + }, + /** + * Verifies that the provided wallet signature is valid according to the 0x Protocol smart contracts + * @param provider Web3 provider to use for all JSON RPC requests + * @param data The hex encoded data signed by the supplied signature. + * @param signature A hex encoded presigned 0x Protocol signature made up of: [SignatureType.Presigned] + * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. + * @return Whether the data was preSigned by the supplied signerAddress. + */ + async isValidWalletSignatureAsync( + provider: Provider, + data: string, + signature: string, + signerAddress: string, + ): Promise { + assert.isWeb3Provider('provider', provider); + assert.isHexString('data', data); + assert.isHexString('signature', signature); + assert.isETHAddressHex('signerAddress', signerAddress); + // tslint:disable-next-line:custom-no-magic-numbers + const signatureWithoutType = signature.slice(-2); + const walletContract = new IWalletContract(artifacts.IWallet.compilerOutput.abi, signerAddress, provider); + const isValid = await walletContract.isValidSignature.callAsync(data, signatureWithoutType); + return isValid; + }, + /** + * Verifies that the provided validator signature is valid according to the 0x Protocol smart contracts + * @param provider Web3 provider to use for all JSON RPC requests + * @param data The hex encoded data signed by the supplied signature. + * @param signature A hex encoded presigned 0x Protocol signature made up of: [SignatureType.Presigned] + * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. + * @return Whether the data was preSigned by the supplied signerAddress. + */ + async isValidValidatorSignatureAsync( + provider: Provider, + data: string, + signature: string, + signerAddress: string, + ): Promise { + assert.isWeb3Provider('provider', provider); + assert.isHexString('data', data); + assert.isHexString('signature', signature); + assert.isETHAddressHex('signerAddress', signerAddress); + const validatorSignature = parseValidatorSignature(signature); + const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider); + const isValidatorApproved = await exchangeContract.allowedValidators.callAsync( + signerAddress, + validatorSignature.validatorAddress, + ); + if (!isValidatorApproved) { + throw new Error( + `Validator ${validatorSignature.validatorAddress} was not pre-approved by ${signerAddress}.`, + ); } - default: - throw new Error(`Unhandled SignatureType: ${signatureTypeIndexIfExists}`); - } -} - -/** - * Verifies that the provided presigned signature is valid according to the 0x Protocol smart contracts - * @param data The hex encoded data signed by the supplied signature. - * @param signature A hex encoded presigned 0x Protocol signature made up of: [SignatureType.Presigned] - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the data was preSigned by the supplied signerAddress. - */ -export async function isValidPresignedSignatureAsync( - provider: Provider, - data: string, - signerAddress: string, -): Promise { - assert.isWeb3Provider('provider', provider); - assert.isHexString('data', data); - assert.isETHAddressHex('signerAddress', signerAddress); - const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider); - const isValid = await exchangeContract.preSigned.callAsync(data, signerAddress); - return isValid; -} - -/** - * Verifies that the provided wallet signature is valid according to the 0x Protocol smart contracts - * @param data The hex encoded data signed by the supplied signature. - * @param signature A hex encoded presigned 0x Protocol signature made up of: [SignatureType.Presigned] - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the data was preSigned by the supplied signerAddress. - */ -export async function isValidWalletSignatureAsync( - provider: Provider, - data: string, - signature: string, - signerAddress: string, -): Promise { - assert.isWeb3Provider('provider', provider); - assert.isHexString('data', data); - assert.isHexString('signature', signature); - assert.isETHAddressHex('signerAddress', signerAddress); - // tslint:disable-next-line:custom-no-magic-numbers - const signatureWithoutType = signature.slice(-2); - const walletContract = new IWalletContract(artifacts.IWallet.compilerOutput.abi, signerAddress, provider); - const isValid = await walletContract.isValidSignature.callAsync(data, signatureWithoutType); - return isValid; -} - -/** - * Verifies that the provided validator signature is valid according to the 0x Protocol smart contracts - * @param data The hex encoded data signed by the supplied signature. - * @param signature A hex encoded presigned 0x Protocol signature made up of: [SignatureType.Presigned] - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the data was preSigned by the supplied signerAddress. - */ -export async function isValidValidatorSignatureAsync( - provider: Provider, - data: string, - signature: string, - signerAddress: string, -): Promise { - assert.isWeb3Provider('provider', provider); - assert.isHexString('data', data); - assert.isHexString('signature', signature); - assert.isETHAddressHex('signerAddress', signerAddress); - const validatorSignature = parseValidatorSignature(signature); - const exchangeContract = new ExchangeContract(artifacts.Exchange.compilerOutput.abi, signerAddress, provider); - const isValidatorApproved = await exchangeContract.allowedValidators.callAsync( - signerAddress, - validatorSignature.validatorAddress, - ); - if (!isValidatorApproved) { - throw new Error(`Validator ${validatorSignature.validatorAddress} was not pre-approved by ${signerAddress}.`); - } - - const validatorContract = new IValidatorContract(artifacts.IValidator.compilerOutput.abi, signerAddress, provider); - const isValid = await validatorContract.isValidSignature.callAsync( - data, - signerAddress, - validatorSignature.signature, - ); - return isValid; -} - -/** - * Checks if the supplied elliptic curve signature corresponds to signing `data` with - * the private key corresponding to `signerAddress` - * @param data The hex encoded data signed by the supplied signature. - * @param signature An object containing the elliptic curve signature parameters. - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the ECSignature is valid. - */ -export function isValidECSignature(data: string, signature: ECSignature, signerAddress: string): boolean { - assert.isHexString('data', data); - assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema); - assert.isETHAddressHex('signerAddress', signerAddress); - - const msgHashBuff = ethUtil.toBuffer(data); - try { - const pubKey = ethUtil.ecrecover( - msgHashBuff, - signature.v, - ethUtil.toBuffer(signature.r), - ethUtil.toBuffer(signature.s), + const validatorContract = new IValidatorContract( + artifacts.IValidator.compilerOutput.abi, + signerAddress, + provider, ); - const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey)); - return retrievedAddress === signerAddress; - } catch (err) { - return false; - } -} - -/** - * Signs an orderHash and returns it's elliptic curve signature. - * This method currently supports TestRPC, Geth and Parity above and below V1.6.6 - * @param orderHash Hex encoded orderHash to sign. - * @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address - * must be available via the Provider supplied to 0x.js. - * @param hashPrefixOpts Different signers add/require different prefixes be appended to the message being signed. - * Since we cannot know ahead of time which signer you are using, you must supply both a prefixType and - * whether it must be added before calling `eth_sign` (some signers add it themselves) - * @return An object containing the Elliptic curve signature parameters generated by signing the orderHash. - */ -export async function ecSignOrderHashAsync( - provider: Provider, - orderHash: string, - signerAddress: string, - messagePrefixOpts: MessagePrefixOpts, -): Promise { - assert.isWeb3Provider('provider', provider); - assert.isHexString('orderHash', orderHash); - assert.isETHAddressHex('signerAddress', signerAddress); - const web3Wrapper = new Web3Wrapper(provider); - await assert.isSenderAddressAsync('signerAddress', signerAddress, web3Wrapper); - const normalizedSignerAddress = signerAddress.toLowerCase(); - - let msgHashHex = orderHash; - const prefixedMsgHashHex = addSignedMessagePrefix(orderHash, messagePrefixOpts.prefixType); - if (messagePrefixOpts.shouldAddPrefixBeforeCallingEthSign) { - msgHashHex = prefixedMsgHashHex; - } - const signature = await web3Wrapper.signMessageAsync(normalizedSignerAddress, msgHashHex); - - // HACK: There is no consensus on whether the signatureHex string should be formatted as - // v + r + s OR r + s + v, and different clients (even different versions of the same client) - // return the signature params in different orders. In order to support all client implementations, - // we parse the signature in both ways, and evaluate if either one is a valid signature. - // tslint:disable-next-line:custom-no-magic-numbers - const validVParamValues = [27, 28]; - const ecSignatureVRS = parseSignatureHexAsVRS(signature); - if (_.includes(validVParamValues, ecSignatureVRS.v)) { - const isValidVRSSignature = isValidECSignature(prefixedMsgHashHex, ecSignatureVRS, normalizedSignerAddress); - if (isValidVRSSignature) { - return ecSignatureVRS; + const isValid = await validatorContract.isValidSignature.callAsync( + data, + signerAddress, + validatorSignature.signature, + ); + return isValid; + }, + /** + * Checks if the supplied elliptic curve signature corresponds to signing `data` with + * the private key corresponding to `signerAddress` + * @param data The hex encoded data signed by the supplied signature. + * @param signature An object containing the elliptic curve signature parameters. + * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. + * @return Whether the ECSignature is valid. + */ + isValidECSignature(data: string, signature: ECSignature, signerAddress: string): boolean { + assert.isHexString('data', data); + assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema); + assert.isETHAddressHex('signerAddress', signerAddress); + + const msgHashBuff = ethUtil.toBuffer(data); + try { + const pubKey = ethUtil.ecrecover( + msgHashBuff, + signature.v, + ethUtil.toBuffer(signature.r), + ethUtil.toBuffer(signature.s), + ); + const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey)); + return retrievedAddress === signerAddress; + } catch (err) { + return false; } - } - - const ecSignatureRSV = parseSignatureHexAsRSV(signature); - if (_.includes(validVParamValues, ecSignatureRSV.v)) { - const isValidRSVSignature = isValidECSignature(prefixedMsgHashHex, ecSignatureRSV, normalizedSignerAddress); - if (isValidRSVSignature) { - return ecSignatureRSV; + }, + /** + * Signs an orderHash and returns it's elliptic curve signature. + * This method currently supports TestRPC, Geth and Parity above and below V1.6.6 + * @param provider The provider to use for JSON RPC calls + * @param orderHash Hex encoded orderHash to sign. + * @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address + * must be available via the Provider supplied to 0x.js. + * @param messagePrefixOpts Different signers add/require different prefixes be appended to the message being signed. + * Since we cannot know ahead of time which signer you are using, you must supply both a prefixType and + * whether it must be added before calling `eth_sign` (some signers add it themselves) + * @return An object containing the Elliptic curve signature parameters generated by signing the orderHash. + */ + async ecSignOrderHashAsync( + provider: Provider, + orderHash: string, + signerAddress: string, + messagePrefixOpts: MessagePrefixOpts, + ): Promise { + assert.isWeb3Provider('provider', provider); + assert.isHexString('orderHash', orderHash); + assert.isETHAddressHex('signerAddress', signerAddress); + const web3Wrapper = new Web3Wrapper(provider); + await assert.isSenderAddressAsync('signerAddress', signerAddress, web3Wrapper); + const normalizedSignerAddress = signerAddress.toLowerCase(); + + let msgHashHex = orderHash; + const prefixedMsgHashHex = signatureUtils.addSignedMessagePrefix(orderHash, messagePrefixOpts.prefixType); + if (messagePrefixOpts.shouldAddPrefixBeforeCallingEthSign) { + msgHashHex = prefixedMsgHashHex; } - } - - throw new Error(OrderError.InvalidSignature); -} - -/** - * Adds the relevant prefix to the message being signed. - * @param message Message to sign - * @param messagePrefixType The type of message prefix to add. Different signers expect - * specific message prefixes. - * @return Prefixed message - */ -export function addSignedMessagePrefix(message: string, messagePrefixType: MessagePrefixType): string { - assert.isString('message', message); - assert.doesBelongToStringEnum('messagePrefixType', messagePrefixType, MessagePrefixType); - switch (messagePrefixType) { - case MessagePrefixType.None: - return message; - - case MessagePrefixType.EthSign: { - const msgBuff = ethUtil.toBuffer(message); - const prefixedMsgBuff = ethUtil.hashPersonalMessage(msgBuff); - const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff); - return prefixedMsgHex; + const signature = await web3Wrapper.signMessageAsync(normalizedSignerAddress, msgHashHex); + + // HACK: There is no consensus on whether the signatureHex string should be formatted as + // v + r + s OR r + s + v, and different clients (even different versions of the same client) + // return the signature params in different orders. In order to support all client implementations, + // we parse the signature in both ways, and evaluate if either one is a valid signature. + // tslint:disable-next-line:custom-no-magic-numbers + const validVParamValues = [27, 28]; + const ecSignatureVRS = parseSignatureHexAsVRS(signature); + if (_.includes(validVParamValues, ecSignatureVRS.v)) { + const isValidVRSSignature = signatureUtils.isValidECSignature( + prefixedMsgHashHex, + ecSignatureVRS, + normalizedSignerAddress, + ); + if (isValidVRSSignature) { + return ecSignatureVRS; + } } - case MessagePrefixType.Trezor: { - const msgBuff = ethUtil.toBuffer(message); - const prefixedMsgBuff = hashTrezorPersonalMessage(msgBuff); - const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff); - return prefixedMsgHex; + const ecSignatureRSV = parseSignatureHexAsRSV(signature); + if (_.includes(validVParamValues, ecSignatureRSV.v)) { + const isValidRSVSignature = signatureUtils.isValidECSignature( + prefixedMsgHashHex, + ecSignatureRSV, + normalizedSignerAddress, + ); + if (isValidRSVSignature) { + return ecSignatureRSV; + } } - default: - throw new Error(`Unrecognized MessagePrefixType: ${messagePrefixType}`); - } -} - -/** - * Parse a 0x protocol hex-encoded signature string into it's ECSignature components - * @param signature A hex encoded ecSignature 0x Protocol signature - * @return An ECSignature object with r,s,v parameters - */ -export function parseECSignature(signature: string): ECSignature { - assert.isHexString('signature', signature); - const ecSignatureTypes = [SignatureType.EthSign, SignatureType.EIP712, SignatureType.Trezor]; - assert.isOneOfExpectedSignatureTypes(signature, ecSignatureTypes); - - // tslint:disable-next-line:custom-no-magic-numbers - const vrsHex = signature.slice(0, -2); - const ecSignature = parseSignatureHexAsVRS(vrsHex); - - return ecSignature; -} + throw new Error(OrderError.InvalidSignature); + }, + /** + * Adds the relevant prefix to the message being signed. + * @param message Message to sign + * @param messagePrefixType The type of message prefix to add. Different signers expect + * specific message prefixes. + * @return Prefixed message + */ + addSignedMessagePrefix(message: string, messagePrefixType: MessagePrefixType): string { + assert.isString('message', message); + assert.doesBelongToStringEnum('messagePrefixType', messagePrefixType, MessagePrefixType); + switch (messagePrefixType) { + case MessagePrefixType.None: + return message; + + case MessagePrefixType.EthSign: { + const msgBuff = ethUtil.toBuffer(message); + const prefixedMsgBuff = ethUtil.hashPersonalMessage(msgBuff); + const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff); + return prefixedMsgHex; + } + + case MessagePrefixType.Trezor: { + const msgBuff = ethUtil.toBuffer(message); + const prefixedMsgBuff = hashTrezorPersonalMessage(msgBuff); + const prefixedMsgHex = ethUtil.bufferToHex(prefixedMsgBuff); + return prefixedMsgHex; + } + + default: + throw new Error(`Unrecognized MessagePrefixType: ${messagePrefixType}`); + } + }, + /** + * Parse a 0x protocol hex-encoded signature string into it's ECSignature components + * @param signature A hex encoded ecSignature 0x Protocol signature + * @return An ECSignature object with r,s,v parameters + */ + parseECSignature(signature: string): ECSignature { + assert.isHexString('signature', signature); + const ecSignatureTypes = [SignatureType.EthSign, SignatureType.EIP712, SignatureType.Trezor]; + assert.isOneOfExpectedSignatureTypes(signature, ecSignatureTypes); + + // tslint:disable-next-line:custom-no-magic-numbers + const vrsHex = signature.slice(0, -2); + const ecSignature = parseSignatureHexAsVRS(vrsHex); + + return ecSignature; + }, +}; function hashTrezorPersonalMessage(message: Buffer): Buffer { const prefix = ethUtil.toBuffer('\x19Ethereum Signed Message:\n' + String.fromCharCode(message.byteLength)); diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts index 5714f9671..2f36386ad 100644 --- a/packages/order-utils/test/signature_utils_test.ts +++ b/packages/order-utils/test/signature_utils_test.ts @@ -5,8 +5,8 @@ import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { ecSignOrderHashAsync, generatePseudoRandomSalt, MessagePrefixType } from '../src'; -import { isValidECSignature, isValidSignatureAsync } from '../src/signature_utils'; +import { generatePseudoRandomSalt, MessagePrefixType } from '../src'; +import { signatureUtils } from '../src/signature_utils'; import { chaiSetup } from './utils/chai_setup'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -22,12 +22,14 @@ describe('Signature utils', () => { let address = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; it("should return false if the data doesn't pertain to the signature & address", async () => { - expect(await isValidSignatureAsync(provider, '0x0', ethSignSignature, address)).to.be.false(); + expect( + await signatureUtils.isValidSignatureAsync(provider, '0x0', ethSignSignature, address), + ).to.be.false(); }); it("should return false if the address doesn't pertain to the signature & data", async () => { const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42'; expect( - await isValidSignatureAsync(provider, dataHex, ethSignSignature, validUnrelatedAddress), + await signatureUtils.isValidSignatureAsync(provider, dataHex, ethSignSignature, validUnrelatedAddress), ).to.be.false(); }); it("should return false if the signature doesn't pertain to the dataHex & address", async () => { @@ -35,18 +37,27 @@ describe('Signature utils', () => { // tslint:disable-next-line:custom-no-magic-numbers signatureArray[5] = 'C'; // V = 28, instead of 27 const wrongSignature = signatureArray.join(''); - expect(await isValidSignatureAsync(provider, dataHex, wrongSignature, address)).to.be.false(); + expect( + await signatureUtils.isValidSignatureAsync(provider, dataHex, wrongSignature, address), + ).to.be.false(); }); it('should throw if signatureType is invalid', () => { const signatureArray = ethSignSignature.split(''); signatureArray[3] = '9'; // SignatureType w/ index 9 doesn't exist const signatureWithInvalidType = signatureArray.join(''); - expect(isValidSignatureAsync(provider, dataHex, signatureWithInvalidType, address)).to.be.rejected(); + expect( + signatureUtils.isValidSignatureAsync(provider, dataHex, signatureWithInvalidType, address), + ).to.be.rejected(); }); it('should return true for a valid Ecrecover (EthSign) signature', async () => { - const isValidSignatureLocal = await isValidSignatureAsync(provider, dataHex, ethSignSignature, address); + const isValidSignatureLocal = await signatureUtils.isValidSignatureAsync( + provider, + dataHex, + ethSignSignature, + address, + ); expect(isValidSignatureLocal).to.be.true(); }); @@ -55,7 +66,12 @@ describe('Signature utils', () => { address = '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb'; const eip712Signature = '0x1bdde07aac4bf12c12ddbb155919c43eba4146a2cfcf904a862950dbebe332554c6674975603eb5a4eaf8fd7f2e06350267e5b36cda9851a89f8bb49fe2fc9afe202'; - const isValidSignatureLocal = await isValidSignatureAsync(provider, dataHex, eip712Signature, address); + const isValidSignatureLocal = await signatureUtils.isValidSignatureAsync( + provider, + dataHex, + eip712Signature, + address, + ); expect(isValidSignatureLocal).to.be.true(); }); @@ -64,7 +80,12 @@ describe('Signature utils', () => { address = '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb'; const trezorSignature = '0x1ce4760660e6495b5ae6723087bea073b3a99ce98ea81fdf00c240279c010e63d05b87bc34c4d67d4776e8d5aeb023a67484f4eaf0fd353b40893e5101e845cd9908'; - const isValidSignatureLocal = await isValidSignatureAsync(provider, dataHex, trezorSignature, address); + const isValidSignatureLocal = await signatureUtils.isValidSignatureAsync( + provider, + dataHex, + trezorSignature, + address, + ); expect(isValidSignatureLocal).to.be.true(); }); }); @@ -78,18 +99,18 @@ describe('Signature utils', () => { const address = '0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a'; it("should return false if the data doesn't pertain to the signature & address", async () => { - expect(isValidECSignature('0x0', signature, address)).to.be.false(); + expect(signatureUtils.isValidECSignature('0x0', signature, address)).to.be.false(); }); it("should return false if the address doesn't pertain to the signature & data", async () => { const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42'; - expect(isValidECSignature(data, signature, validUnrelatedAddress)).to.be.false(); + expect(signatureUtils.isValidECSignature(data, signature, validUnrelatedAddress)).to.be.false(); }); it("should return false if the signature doesn't pertain to the data & address", async () => { const wrongSignature = _.assign({}, signature, { v: 28 }); - expect(isValidECSignature(data, wrongSignature, address)).to.be.false(); + expect(signatureUtils.isValidECSignature(data, wrongSignature, address)).to.be.false(); }); it('should return true if the signature does pertain to the data & address', async () => { - const isValidSignatureLocal = isValidECSignature(data, signature, address); + const isValidSignatureLocal = signatureUtils.isValidECSignature(data, signature, address); expect(isValidSignatureLocal).to.be.true(); }); }); @@ -129,7 +150,12 @@ describe('Signature utils', () => { prefixType: MessagePrefixType.EthSign, shouldAddPrefixBeforeCallingEthSign: false, }; - const ecSignature = await ecSignOrderHashAsync(provider, orderHash, makerAddress, messagePrefixOpts); + const ecSignature = await signatureUtils.ecSignOrderHashAsync( + provider, + orderHash, + makerAddress, + messagePrefixOpts, + ); expect(ecSignature).to.deep.equal(expectedECSignature); }); it('should return the correct ECSignature for signatureHex concatenated as R + S + V', async () => { @@ -162,7 +188,12 @@ describe('Signature utils', () => { prefixType: MessagePrefixType.EthSign, shouldAddPrefixBeforeCallingEthSign: false, }; - const ecSignature = await ecSignOrderHashAsync(fakeProvider, orderHash, makerAddress, messagePrefixOpts); + const ecSignature = await signatureUtils.ecSignOrderHashAsync( + fakeProvider, + orderHash, + makerAddress, + messagePrefixOpts, + ); expect(ecSignature).to.deep.equal(expectedECSignature); }); it('should return the correct ECSignature for signatureHex concatenated as V + R + S', async () => { @@ -192,7 +223,12 @@ describe('Signature utils', () => { prefixType: MessagePrefixType.EthSign, shouldAddPrefixBeforeCallingEthSign: false, }; - const ecSignature = await ecSignOrderHashAsync(fakeProvider, orderHash, makerAddress, messagePrefixOpts); + const ecSignature = await signatureUtils.ecSignOrderHashAsync( + fakeProvider, + orderHash, + makerAddress, + messagePrefixOpts, + ); expect(ecSignature).to.deep.equal(expectedECSignature); }); }); diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts index a891a60d2..e4a1e2c7b 100644 --- a/packages/order-watcher/src/utils/assert.ts +++ b/packages/order-watcher/src/utils/assert.ts @@ -7,7 +7,7 @@ import { BigNumber } from '@0xproject/utils'; // tslint:enable:no-unused-variable import { Provider } from 'ethereum-types'; -import { isValidSignatureAsync } from '@0xproject/order-utils'; +import { signatureUtils } from '@0xproject/order-utils'; export const assert = { ...sharedAssert, @@ -17,7 +17,7 @@ export const assert = { signature: string, signerAddress: string, ): Promise { - const isValid = await isValidSignatureAsync(provider, orderHash, signature, signerAddress); + const isValid = await signatureUtils.isValidSignatureAsync(provider, orderHash, signature, signerAddress); assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); }, }; -- cgit From 0e82be1bdad10fda083b360aecf548d9e948ed86 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:18:18 +0200 Subject: Remove react-docs-example package and links to it --- packages/react-docs-example/README.md | 81 - packages/react-docs-example/less/all.less | 41 - packages/react-docs-example/md/introduction.md | 1 - packages/react-docs-example/package.json | 61 - .../public/css/basscss_responsive_custom.css | 85 - .../public/css/basscss_responsive_margin.css | 453 --- .../public/css/basscss_responsive_padding.css | 370 --- .../public/css/basscss_responsive_type_scale.css | 84 - .../react-docs-example/public/css/github-gist.css | 71 - .../public/css/material-design-iconic-font.min.css | 1 - packages/react-docs-example/public/css/roboto.css | 89 - .../react-docs-example/public/css/roboto_mono.css | 69 - .../public/fonts/Material-Design-Iconic-Font.eot | Bin 42495 -> 0 bytes .../public/fonts/Material-Design-Iconic-Font.svg | 787 ----- .../public/fonts/Material-Design-Iconic-Font.ttf | Bin 99212 -> 0 bytes .../public/fonts/Material-Design-Iconic-Font.woff | Bin 50312 -> 0 bytes .../public/fonts/Material-Design-Iconic-Font.woff2 | Bin 38384 -> 0 bytes .../public/fonts/Roboto-Black.ttf | Bin 171480 -> 0 bytes .../public/fonts/Roboto-BlackItalic.ttf | Bin 177552 -> 0 bytes .../public/fonts/Roboto-Bold.ttf | Bin 170760 -> 0 bytes .../public/fonts/Roboto-BoldItalic.ttf | Bin 174952 -> 0 bytes .../public/fonts/Roboto-Italic.ttf | Bin 173932 -> 0 bytes .../public/fonts/Roboto-Light.ttf | Bin 170420 -> 0 bytes .../public/fonts/Roboto-LightItalic.ttf | Bin 176616 -> 0 bytes .../public/fonts/Roboto-Medium.ttf | Bin 172064 -> 0 bytes .../public/fonts/Roboto-MediumItalic.ttf | Bin 176864 -> 0 bytes .../public/fonts/Roboto-Regular.ttf | Bin 171676 -> 0 bytes .../public/fonts/Roboto-Thin.ttf | Bin 171904 -> 0 bytes .../public/fonts/Roboto-ThinItalic.ttf | Bin 176300 -> 0 bytes .../public/fonts/RobotoMono-Bold.ttf | Bin 114752 -> 0 bytes .../public/fonts/RobotoMono-BoldItalic.ttf | Bin 122808 -> 0 bytes .../public/fonts/RobotoMono-Italic.ttf | Bin 120832 -> 0 bytes .../public/fonts/RobotoMono-Light.ttf | Bin 118976 -> 0 bytes .../public/fonts/RobotoMono-LightItalic.ttf | Bin 127568 -> 0 bytes .../public/fonts/RobotoMono-Medium.ttf | Bin 114696 -> 0 bytes .../public/fonts/RobotoMono-MediumItalic.ttf | Bin 123640 -> 0 bytes .../public/fonts/RobotoMono-Regular.ttf | Bin 114624 -> 0 bytes .../public/fonts/RobotoMono-Thin.ttf | Bin 118132 -> 0 bytes .../public/fonts/RobotoMono-ThinItalic.ttf | Bin 121456 -> 0 bytes packages/react-docs-example/public/index.html | 24 - packages/react-docs-example/ts/docs.tsx | 98 - packages/react-docs-example/ts/globals.d.ts | 6 - packages/react-docs-example/ts/index.tsx | 17 - packages/react-docs-example/ts/json/0.1.12.json | 3318 ------------------- packages/react-docs-example/ts/json/0.2.0.json | 3401 -------------------- packages/react-docs-example/tsconfig.json | 13 - packages/react-docs-example/tslint.json | 8 - packages/react-docs-example/webpack.config.js | 83 - packages/react-docs/README.md | 6 +- 49 files changed, 3 insertions(+), 9164 deletions(-) delete mode 100644 packages/react-docs-example/README.md delete mode 100644 packages/react-docs-example/less/all.less delete mode 100644 packages/react-docs-example/md/introduction.md delete mode 100644 packages/react-docs-example/package.json delete mode 100644 packages/react-docs-example/public/css/basscss_responsive_custom.css delete mode 100644 packages/react-docs-example/public/css/basscss_responsive_margin.css delete mode 100644 packages/react-docs-example/public/css/basscss_responsive_padding.css delete mode 100644 packages/react-docs-example/public/css/basscss_responsive_type_scale.css delete mode 100644 packages/react-docs-example/public/css/github-gist.css delete mode 100755 packages/react-docs-example/public/css/material-design-iconic-font.min.css delete mode 100644 packages/react-docs-example/public/css/roboto.css delete mode 100644 packages/react-docs-example/public/css/roboto_mono.css delete mode 100755 packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.eot delete mode 100755 packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.svg delete mode 100755 packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.ttf delete mode 100755 packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff delete mode 100755 packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff2 delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Black.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-BlackItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Bold.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-BoldItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Italic.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Light.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-LightItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Medium.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-MediumItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Regular.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-Thin.ttf delete mode 100755 packages/react-docs-example/public/fonts/Roboto-ThinItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Bold.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-BoldItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Italic.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Light.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-LightItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Medium.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-MediumItalic.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Regular.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-Thin.ttf delete mode 100755 packages/react-docs-example/public/fonts/RobotoMono-ThinItalic.ttf delete mode 100644 packages/react-docs-example/public/index.html delete mode 100644 packages/react-docs-example/ts/docs.tsx delete mode 100644 packages/react-docs-example/ts/globals.d.ts delete mode 100644 packages/react-docs-example/ts/index.tsx delete mode 100644 packages/react-docs-example/ts/json/0.1.12.json delete mode 100644 packages/react-docs-example/ts/json/0.2.0.json delete mode 100644 packages/react-docs-example/tsconfig.json delete mode 100644 packages/react-docs-example/tslint.json delete mode 100644 packages/react-docs-example/webpack.config.js diff --git a/packages/react-docs-example/README.md b/packages/react-docs-example/README.md deleted file mode 100644 index c7dfcd3aa..000000000 --- a/packages/react-docs-example/README.md +++ /dev/null @@ -1,81 +0,0 @@ -## @0xproject/react-docs-example - -An [example documentation page](http://react-docs-example.s3-website-us-east-1.amazonaws.com/) built using [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) rendering the [@0xproject/web3-wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) Typescript package. This is a great starter project for hosting your own Solidity or Typescript documentation page. - -## Usage - -This package is intended as a boilerplate for creating and hosting your own documentation page. Easiest way to get started is to fork the `0x-monorepo` and start modifying `react-docs-example`. - -#### Install Dependencies - -If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: - -```bash -yarn config set workspaces-experimental true -``` - -Then install dependencies - -```bash -yarn install -``` - -### Initial setup - -The **first** time you work with this package, you must build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: - -```bash -PKG=0x.js yarn build -``` - -Note: If you move this package out of the monorepo, it will work without this step. Make sure you copy it out on the `master` branch since the `development` version might rely on not-yet published changes to other packages. - -### Run dev server - -The the `react-docs-example` root directory, run: - -```bash -PKG=0x.js yarn watch -``` - -### Deploy Example to S3 bucket - -You will need to adapt the `deploy_example` command in the `package.json` to point to an S3 bucket you've created. Make sure the bucket is publicly accessible to everyone. - -You will also need to install the [aws-cli](https://github.com/aws/aws-cli) and configure it with your AWS credentials. - -```bash -yarn deploy_example -``` - -### Build - -To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: - -```bash -PKG=@0xproject/react-docs-example yarn build -``` - -Or continuously rebuild on change: - -```bash -PKG=@0xproject/react-docs-example yarn watch -``` - -### Clean - -```bash -yarn clean -``` - -### Lint - -```bash -yarn lint -``` - -## Contributing - -We strongly encourage the community to help us make improvements. To report bugs within this package, please create an issue in this repository. - -Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. diff --git a/packages/react-docs-example/less/all.less b/packages/react-docs-example/less/all.less deleted file mode 100644 index 8e891946d..000000000 --- a/packages/react-docs-example/less/all.less +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Adds always visible scrollbars on OSX so that user knows the content is scrollable - * Source: https://davidwalsh.name/osx-overflow - */ -::-webkit-scrollbar { - -webkit-appearance: none; - width: 4px; - height: 2px; -} -::-webkit-scrollbar-thumb { - border-radius: 4px; - background-color: rgba(0, 0, 0, 0.5); - -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5); -} - -#documentation { - p { - line-height: 1.5; - } - - a { - color: #1d5cde; // linkBlue - } - - .comment { - p { - margin: 0px; - } - } - - .typeTooltip { - border: 1px solid lightgray; - opacity: 1; - } -} - -code { - border: 1px solid #e3eefe; - font-family: 'Roboto Mono'; - background-color: #f2f6ff !important; // lightBlue -} diff --git a/packages/react-docs-example/md/introduction.md b/packages/react-docs-example/md/introduction.md deleted file mode 100644 index b8569576e..000000000 --- a/packages/react-docs-example/md/introduction.md +++ /dev/null @@ -1 +0,0 @@ -Welcome to the [Web3Wrapper](https://github.com/0xProject/0x-monorepo/packages/web3-wrapper) documentation! Web3Wrapper is a convenience wrapper around Web3.js, adding support for promises and other niceties. diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json deleted file mode 100644 index ca7a85b76..000000000 --- a/packages/react-docs-example/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "private": true, - "name": "@0xproject/react-docs-example", - "version": "0.0.19", - "engines": { - "node": ">=6.12" - }, - "description": "An example app using react-docs", - "scripts": { - "lint": "tslint --project .", - "build": "tsc", - "build:example": "NODE_ENV=production webpack", - "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" - }, - "author": "Fabio Berger", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/0xProject/0x-monorepo/issues" - }, - "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-docs-example/README.md", - "repository": { - "type": "git", - "url": "https://github.com/0xProject/0x-monorepo.git" - }, - "devDependencies": { - "@0xproject/tslint-config": "^1.0.4", - "@types/lodash": "4.14.104", - "@types/material-ui": "0.18.0", - "@types/node": "^8.0.53", - "@types/react": "16.3.13", - "@types/react-dom": "^16.0.3", - "@types/react-tap-event-plugin": "0.0.30", - "awesome-typescript-loader": "^3.1.3", - "copyfiles": "^1.2.0", - "css-loader": "^0.28.9", - "json-loader": "^0.5.4", - "less": "^2.7.2", - "less-loader": "^2.2.3", - "make-promises-safe": "^1.1.0", - "raw-loader": "^0.5.1", - "shx": "^0.2.2", - "source-map-loader": "^0.2.3", - "style-loader": "^0.20.2", - "tslint": "^5.9.1", - "typescript": "2.7.1", - "webpack": "^3.11.0", - "webpack-dev-server": "^2.11.1" - }, - "dependencies": { - "@0xproject/react-docs": "^1.0.4", - "basscss": "^8.0.3", - "lodash": "^4.17.4", - "material-ui": "^0.17.1", - "react": "15.6.1", - "react-dom": "15.6.1", - "react-tap-event-plugin": "^2.0.1" - } -} diff --git a/packages/react-docs-example/public/css/basscss_responsive_custom.css b/packages/react-docs-example/public/css/basscss_responsive_custom.css deleted file mode 100644 index 5f8bd9117..000000000 --- a/packages/react-docs-example/public/css/basscss_responsive_custom.css +++ /dev/null @@ -1,85 +0,0 @@ -/* Custom Basscss Responsive Utilities */ - -@media (max-width: 52em) { - .sm-center { - text-align: center; - } - .sm-align-middle { - vertical-align: middle; - } - .sm-align-top { - vertical-align: top; - } - .sm-left-align { - text-align: left; - } - .sm-right-align { - text-align: right; - } - .sm-table-cell { - display: table-cell; - } - .sm-mx-auto { - margin-left: auto; - margin-right: auto; - } - .sm-right { - float: right; - } -} - -@media (min-width: 52em) { - .md-center { - text-align: center; - } - .md-align-middle { - vertical-align: middle; - } - .md-align-top { - vertical-align: top; - } - .md-left-align { - text-align: left; - } - .md-right-align { - text-align: right; - } - .md-table-cell { - display: table-cell; - } - .md-mx-auto { - margin-left: auto; - margin-right: auto; - } - .md-right { - float: right; - } -} - -@media (min-width: 64em) { - .lg-center { - text-align: center; - } - .lg-align-middle { - vertical-align: middle; - } - .lg-align-top { - vertical-align: top; - } - .lg-left-align { - text-align: left; - } - .lg-right-align { - text-align: right; - } - .lg-table-cell { - display: table-cell; - } - .lg-mx-auto { - margin-left: auto; - margin-right: auto; - } - .lg-right { - float: right; - } -} diff --git a/packages/react-docs-example/public/css/basscss_responsive_margin.css b/packages/react-docs-example/public/css/basscss_responsive_margin.css deleted file mode 100644 index c9f3e855c..000000000 --- a/packages/react-docs-example/public/css/basscss_responsive_margin.css +++ /dev/null @@ -1,453 +0,0 @@ -/* Basscss Responsive Margin */ - -@media (max-width: 52em) { - /* Modified by Fabio Berger to max-width from min-width */ - - .sm-m0 { - margin: 0; - } - .sm-mt0 { - margin-top: 0; - } - .sm-mr0 { - margin-right: 0; - } - .sm-mb0 { - margin-bottom: 0; - } - .sm-ml0 { - margin-left: 0; - } - .sm-mx0 { - margin-left: 0; - margin-right: 0; - } - .sm-my0 { - margin-top: 0; - margin-bottom: 0; - } - - .sm-m1 { - margin: 0.5rem; - } - .sm-mt1 { - margin-top: 0.5rem; - } - .sm-mr1 { - margin-right: 0.5rem; - } - .sm-mb1 { - margin-bottom: 0.5rem; - } - .sm-ml1 { - margin-left: 0.5rem; - } - .sm-mx1 { - margin-left: 0.5rem; - margin-right: 0.5rem; - } - .sm-my1 { - margin-top: 0.5rem; - margin-bottom: 0.5rem; - } - - .sm-m2 { - margin: 1rem; - } - .sm-mt2 { - margin-top: 1rem; - } - .sm-mr2 { - margin-right: 1rem; - } - .sm-mb2 { - margin-bottom: 1rem; - } - .sm-ml2 { - margin-left: 1rem; - } - .sm-mx2 { - margin-left: 1rem; - margin-right: 1rem; - } - .sm-my2 { - margin-top: 1rem; - margin-bottom: 1rem; - } - - .sm-m3 { - margin: 2rem; - } - .sm-mt3 { - margin-top: 2rem; - } - .sm-mr3 { - margin-right: 2rem; - } - .sm-mb3 { - margin-bottom: 2rem; - } - .sm-ml3 { - margin-left: 2rem; - } - .sm-mx3 { - margin-left: 2rem; - margin-right: 2rem; - } - .sm-my3 { - margin-top: 2rem; - margin-bottom: 2rem; - } - - .sm-m4 { - margin: 4rem; - } - .sm-mt4 { - margin-top: 4rem; - } - .sm-mr4 { - margin-right: 4rem; - } - .sm-mb4 { - margin-bottom: 4rem; - } - .sm-ml4 { - margin-left: 4rem; - } - .sm-mx4 { - margin-left: 4rem; - margin-right: 4rem; - } - .sm-my4 { - margin-top: 4rem; - margin-bottom: 4rem; - } - - .sm-mxn1 { - margin-left: -0.5rem; - margin-right: -0.5rem; - } - .sm-mxn2 { - margin-left: -1rem; - margin-right: -1rem; - } - .sm-mxn3 { - margin-left: -2rem; - margin-right: -2rem; - } - .sm-mxn4 { - margin-left: -4rem; - margin-right: -4rem; - } - - .sm-ml-auto { - margin-left: auto; - } - .sm-mr-auto { - margin-right: auto; - } - .sm-mx-auto { - margin-left: auto; - margin-right: auto; - } -} - -@media (min-width: 52em) { - .md-m0 { - margin: 0; - } - .md-mt0 { - margin-top: 0; - } - .md-mr0 { - margin-right: 0; - } - .md-mb0 { - margin-bottom: 0; - } - .md-ml0 { - margin-left: 0; - } - .md-mx0 { - margin-left: 0; - margin-right: 0; - } - .md-my0 { - margin-top: 0; - margin-bottom: 0; - } - - .md-m1 { - margin: 0.5rem; - } - .md-mt1 { - margin-top: 0.5rem; - } - .md-mr1 { - margin-right: 0.5rem; - } - .md-mb1 { - margin-bottom: 0.5rem; - } - .md-ml1 { - margin-left: 0.5rem; - } - .md-mx1 { - margin-left: 0.5rem; - margin-right: 0.5rem; - } - .md-my1 { - margin-top: 0.5rem; - margin-bottom: 0.5rem; - } - - .md-m2 { - margin: 1rem; - } - .md-mt2 { - margin-top: 1rem; - } - .md-mr2 { - margin-right: 1rem; - } - .md-mb2 { - margin-bottom: 1rem; - } - .md-ml2 { - margin-left: 1rem; - } - .md-mx2 { - margin-left: 1rem; - margin-right: 1rem; - } - .md-my2 { - margin-top: 1rem; - margin-bottom: 1rem; - } - - .md-m3 { - margin: 2rem; - } - .md-mt3 { - margin-top: 2rem; - } - .md-mr3 { - margin-right: 2rem; - } - .md-mb3 { - margin-bottom: 2rem; - } - .md-ml3 { - margin-left: 2rem; - } - .md-mx3 { - margin-left: 2rem; - margin-right: 2rem; - } - .md-my3 { - margin-top: 2rem; - margin-bottom: 2rem; - } - - .md-m4 { - margin: 4rem; - } - .md-mt4 { - margin-top: 4rem; - } - .md-mr4 { - margin-right: 4rem; - } - .md-mb4 { - margin-bottom: 4rem; - } - .md-ml4 { - margin-left: 4rem; - } - .md-mx4 { - margin-left: 4rem; - margin-right: 4rem; - } - .md-my4 { - margin-top: 4rem; - margin-bottom: 4rem; - } - - .md-mxn1 { - margin-left: -0.5rem; - margin-right: -0.5rem; - } - .md-mxn2 { - margin-left: -1rem; - margin-right: -1rem; - } - .md-mxn3 { - margin-left: -2rem; - margin-right: -2rem; - } - .md-mxn4 { - margin-left: -4rem; - margin-right: -4rem; - } - - .md-ml-auto { - margin-left: auto; - } - .md-mr-auto { - margin-right: auto; - } - .md-mx-auto { - margin-left: auto; - margin-right: auto; - } -} - -@media (min-width: 64em) { - .lg-m0 { - margin: 0; - } - .lg-mt0 { - margin-top: 0; - } - .lg-mr0 { - margin-right: 0; - } - .lg-mb0 { - margin-bottom: 0; - } - .lg-ml0 { - margin-left: 0; - } - .lg-mx0 { - margin-left: 0; - margin-right: 0; - } - .lg-my0 { - margin-top: 0; - margin-bottom: 0; - } - - .lg-m1 { - margin: 0.5rem; - } - .lg-mt1 { - margin-top: 0.5rem; - } - .lg-mr1 { - margin-right: 0.5rem; - } - .lg-mb1 { - margin-bottom: 0.5rem; - } - .lg-ml1 { - margin-left: 0.5rem; - } - .lg-mx1 { - margin-left: 0.5rem; - margin-right: 0.5rem; - } - .lg-my1 { - margin-top: 0.5rem; - margin-bottom: 0.5rem; - } - - .lg-m2 { - margin: 1rem; - } - .lg-mt2 { - margin-top: 1rem; - } - .lg-mr2 { - margin-right: 1rem; - } - .lg-mb2 { - margin-bottom: 1rem; - } - .lg-ml2 { - margin-left: 1rem; - } - .lg-mx2 { - margin-left: 1rem; - margin-right: 1rem; - } - .lg-my2 { - margin-top: 1rem; - margin-bottom: 1rem; - } - - .lg-m3 { - margin: 2rem; - } - .lg-mt3 { - margin-top: 2rem; - } - .lg-mr3 { - margin-right: 2rem; - } - .lg-mb3 { - margin-bottom: 2rem; - } - .lg-ml3 { - margin-left: 2rem; - } - .lg-mx3 { - margin-left: 2rem; - margin-right: 2rem; - } - .lg-my3 { - margin-top: 2rem; - margin-bottom: 2rem; - } - - .lg-m4 { - margin: 4rem; - } - .lg-mt4 { - margin-top: 4rem; - } - .lg-mr4 { - margin-right: 4rem; - } - .lg-mb4 { - margin-bottom: 4rem; - } - .lg-ml4 { - margin-left: 4rem; - } - .lg-mx4 { - margin-left: 4rem; - margin-right: 4rem; - } - .lg-my4 { - margin-top: 4rem; - margin-bottom: 4rem; - } - - .lg-mxn1 { - margin-left: -0.5rem; - margin-right: -0.5rem; - } - .lg-mxn2 { - margin-left: -1rem; - margin-right: -1rem; - } - .lg-mxn3 { - margin-left: -2rem; - margin-right: -2rem; - } - .lg-mxn4 { - margin-left: -4rem; - margin-right: -4rem; - } - - .lg-ml-auto { - margin-left: auto; - } - .lg-mr-auto { - margin-right: auto; - } - .lg-mx-auto { - margin-left: auto; - margin-right: auto; - } -} diff --git a/packages/react-docs-example/public/css/basscss_responsive_padding.css b/packages/react-docs-example/public/css/basscss_responsive_padding.css deleted file mode 100644 index 773a91743..000000000 --- a/packages/react-docs-example/public/css/basscss_responsive_padding.css +++ /dev/null @@ -1,370 +0,0 @@ -/* Basscss Responsive Padding */ -/* Modified by Fabio Berger to include xs prefix */ - -@media (max-width: 52em) { - /* Modified by Fabio Berger to max-width from min-width */ - - .sm-p0 { - padding: 0; - } - .sm-pt0 { - padding-top: 0; - } - .sm-pr0 { - padding-right: 0; - } - .sm-pb0 { - padding-bottom: 0; - } - .sm-pl0 { - padding-left: 0; - } - .sm-px0 { - padding-left: 0; - padding-right: 0; - } - .sm-py0 { - padding-top: 0; - padding-bottom: 0; - } - - .sm-p1 { - padding: 0.5rem; - } - .sm-pt1 { - padding-top: 0.5rem; - } - .sm-pr1 { - padding-right: 0.5rem; - } - .sm-pb1 { - padding-bottom: 0.5rem; - } - .sm-pl1 { - padding-left: 0.5rem; - } - .sm-px1 { - padding-left: 0.5rem; - padding-right: 0.5rem; - } - .sm-py1 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; - } - - .sm-p2 { - padding: 1rem; - } - .sm-pt2 { - padding-top: 1rem; - } - .sm-pr2 { - padding-right: 1rem; - } - .sm-pb2 { - padding-bottom: 1rem; - } - .sm-pl2 { - padding-left: 1rem; - } - .sm-px2 { - padding-left: 1rem; - padding-right: 1rem; - } - .sm-py2 { - padding-top: 1rem; - padding-bottom: 1rem; - } - - .sm-p3 { - padding: 2rem; - } - .sm-pt3 { - padding-top: 2rem; - } - .sm-pr3 { - padding-right: 2rem; - } - .sm-pb3 { - padding-bottom: 2rem; - } - .sm-pl3 { - padding-left: 2rem; - } - .sm-px3 { - padding-left: 2rem; - padding-right: 2rem; - } - .sm-py3 { - padding-top: 2rem; - padding-bottom: 2rem; - } - - .sm-p4 { - padding: 4rem; - } - .sm-pt4 { - padding-top: 4rem; - } - .sm-pr4 { - padding-right: 4rem; - } - .sm-pb4 { - padding-bottom: 4rem; - } - .sm-pl4 { - padding-left: 4rem; - } - .sm-px4 { - padding-left: 4rem; - padding-right: 4rem; - } - .sm-py4 { - padding-top: 4rem; - padding-bottom: 4rem; - } -} - -@media (min-width: 52em) { - .md-p0 { - padding: 0; - } - .md-pt0 { - padding-top: 0; - } - .md-pr0 { - padding-right: 0; - } - .md-pb0 { - padding-bottom: 0; - } - .md-pl0 { - padding-left: 0; - } - .md-px0 { - padding-left: 0; - padding-right: 0; - } - .md-py0 { - padding-top: 0; - padding-bottom: 0; - } - - .md-p1 { - padding: 0.5rem; - } - .md-pt1 { - padding-top: 0.5rem; - } - .md-pr1 { - padding-right: 0.5rem; - } - .md-pb1 { - padding-bottom: 0.5rem; - } - .md-pl1 { - padding-left: 0.5rem; - } - .md-px1 { - padding-left: 0.5rem; - padding-right: 0.5rem; - } - .md-py1 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; - } - - .md-p2 { - padding: 1rem; - } - .md-pt2 { - padding-top: 1rem; - } - .md-pr2 { - padding-right: 1rem; - } - .md-pb2 { - padding-bottom: 1rem; - } - .md-pl2 { - padding-left: 1rem; - } - .md-px2 { - padding-left: 1rem; - padding-right: 1rem; - } - .md-py2 { - padding-top: 1rem; - padding-bottom: 1rem; - } - - .md-p3 { - padding: 2rem; - } - .md-pt3 { - padding-top: 2rem; - } - .md-pr3 { - padding-right: 2rem; - } - .md-pb3 { - padding-bottom: 2rem; - } - .md-pl3 { - padding-left: 2rem; - } - .md-px3 { - padding-left: 2rem; - padding-right: 2rem; - } - .md-py3 { - padding-top: 2rem; - padding-bottom: 2rem; - } - - .md-p4 { - padding: 4rem; - } - .md-pt4 { - padding-top: 4rem; - } - .md-pr4 { - padding-right: 4rem; - } - .md-pb4 { - padding-bottom: 4rem; - } - .md-pl4 { - padding-left: 4rem; - } - .md-px4 { - padding-left: 4rem; - padding-right: 4rem; - } - .md-py4 { - padding-top: 4rem; - padding-bottom: 4rem; - } -} - -@media (min-width: 64em) { - .lg-p0 { - padding: 0; - } - .lg-pt0 { - padding-top: 0; - } - .lg-pr0 { - padding-right: 0; - } - .lg-pb0 { - padding-bottom: 0; - } - .lg-pl0 { - padding-left: 0; - } - .lg-px0 { - padding-left: 0; - padding-right: 0; - } - .lg-py0 { - padding-top: 0; - padding-bottom: 0; - } - - .lg-p1 { - padding: 0.5rem; - } - .lg-pt1 { - padding-top: 0.5rem; - } - .lg-pr1 { - padding-right: 0.5rem; - } - .lg-pb1 { - padding-bottom: 0.5rem; - } - .lg-pl1 { - padding-left: 0.5rem; - } - .lg-px1 { - padding-left: 0.5rem; - padding-right: 0.5rem; - } - .lg-py1 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; - } - - .lg-p2 { - padding: 1rem; - } - .lg-pt2 { - padding-top: 1rem; - } - .lg-pr2 { - padding-right: 1rem; - } - .lg-pb2 { - padding-bottom: 1rem; - } - .lg-pl2 { - padding-left: 1rem; - } - .lg-px2 { - padding-left: 1rem; - padding-right: 1rem; - } - .lg-py2 { - padding-top: 1rem; - padding-bottom: 1rem; - } - - .lg-p3 { - padding: 2rem; - } - .lg-pt3 { - padding-top: 2rem; - } - .lg-pr3 { - padding-right: 2rem; - } - .lg-pb3 { - padding-bottom: 2rem; - } - .lg-pl3 { - padding-left: 2rem; - } - .lg-px3 { - padding-left: 2rem; - padding-right: 2rem; - } - .lg-py3 { - padding-top: 2rem; - padding-bottom: 2rem; - } - - .lg-p4 { - padding: 4rem; - } - .lg-pt4 { - padding-top: 4rem; - } - .lg-pr4 { - padding-right: 4rem; - } - .lg-pb4 { - padding-bottom: 4rem; - } - .lg-pl4 { - padding-left: 4rem; - } - .lg-px4 { - padding-left: 4rem; - padding-right: 4rem; - } - .lg-py4 { - padding-top: 4rem; - padding-bottom: 4rem; - } -} diff --git a/packages/react-docs-example/public/css/basscss_responsive_type_scale.css b/packages/react-docs-example/public/css/basscss_responsive_type_scale.css deleted file mode 100644 index 27de3da94..000000000 --- a/packages/react-docs-example/public/css/basscss_responsive_type_scale.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Basscss Responsive Type Scale */ -/* Modified by Fabio Berger to include xs prefix */ - -@media (max-width: 52em) { - /* Modified by Fabio Berger to max-width from min-width */ - .sm-h00 { - font-size: 4rem; - } - .sm-h0 { - font-size: 3rem; - } - .sm-h1 { - font-size: 2rem; - } - .sm-h2 { - font-size: 1.5rem; - } - .sm-h3 { - font-size: 1.25rem; - } - .sm-h4 { - font-size: 1rem; - } - .sm-h5 { - font-size: 0.875rem; - } - .sm-h6 { - font-size: 0.75rem; - } -} - -@media (min-width: 52em) { - .md-h00 { - font-size: 4rem; - } - .md-h0 { - font-size: 3rem; - } - .md-h1 { - font-size: 2rem; - } - .md-h2 { - font-size: 1.5rem; - } - .md-h3 { - font-size: 1.25rem; - } - .md-h4 { - font-size: 1rem; - } - .md-h5 { - font-size: 0.875rem; - } - .md-h6 { - font-size: 0.75rem; - } -} - -@media (min-width: 64em) { - .lg-h00 { - font-size: 4rem; - } - .lg-h0 { - font-size: 3rem; - } - .lg-h1 { - font-size: 2rem; - } - .lg-h2 { - font-size: 1.5rem; - } - .lg-h3 { - font-size: 1.25rem; - } - .lg-h4 { - font-size: 1rem; - } - .lg-h5 { - font-size: 0.875rem; - } - .lg-h6 { - font-size: 0.75rem; - } -} diff --git a/packages/react-docs-example/public/css/github-gist.css b/packages/react-docs-example/public/css/github-gist.css deleted file mode 100644 index d5c8751c5..000000000 --- a/packages/react-docs-example/public/css/github-gist.css +++ /dev/null @@ -1,71 +0,0 @@ -/** - * GitHub Gist Theme - * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro - */ - -.hljs { - display: block; - background: white; - padding: 0.5em; - color: #333333; - overflow-x: auto; -} - -.hljs-comment, -.hljs-meta { - color: #969896; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-strong, -.hljs-emphasis, -.hljs-quote { - color: #df5000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #a71d5d; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute { - color: #0086b3; -} - -.hljs-section, -.hljs-name { - color: #63a35c; -} - -.hljs-tag { - color: #333333; -} - -.hljs-title, -.hljs-attr, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #795da3; -} - -.hljs-addition { - color: #55a532; - background-color: #eaffea; -} - -.hljs-deletion { - color: #bd2c00; - background-color: #ffecec; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/packages/react-docs-example/public/css/material-design-iconic-font.min.css b/packages/react-docs-example/public/css/material-design-iconic-font.min.css deleted file mode 100755 index e1a58fe2f..000000000 --- a/packages/react-docs-example/public/css/material-design-iconic-font.min.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:Material-Design-Iconic-Font;src:url(../fonts/Material-Design-Iconic-Font.woff2?v=2.2.0) format('woff2'),url(../fonts/Material-Design-Iconic-Font.woff?v=2.2.0) format('woff'),url(../fonts/Material-Design-Iconic-Font.ttf?v=2.2.0) format('truetype')}.zmdi{display:inline-block;font:normal normal normal 14px/1 'Material-Design-Iconic-Font';font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.zmdi-hc-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.zmdi-hc-2x{font-size:2em}.zmdi-hc-3x{font-size:3em}.zmdi-hc-4x{font-size:4em}.zmdi-hc-5x{font-size:5em}.zmdi-hc-fw{width:1.28571429em;text-align:center}.zmdi-hc-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.zmdi-hc-ul>li{position:relative}.zmdi-hc-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.zmdi-hc-li.zmdi-hc-lg{left:-1.85714286em}.zmdi-hc-border{padding:.1em .25em;border:solid .1em #9e9e9e;border-radius:2px}.zmdi-hc-border-circle{padding:.1em .25em;border:solid .1em #9e9e9e;border-radius:50%}.zmdi.pull-left{float:left;margin-right:.15em}.zmdi.pull-right{float:right;margin-left:.15em}.zmdi-hc-spin{-webkit-animation:zmdi-spin 1.5s infinite linear;animation:zmdi-spin 1.5s infinite linear}.zmdi-hc-spin-reverse{-webkit-animation:zmdi-spin-reverse 1.5s infinite linear;animation:zmdi-spin-reverse 1.5s infinite linear}@-webkit-keyframes zmdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes zmdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@-webkit-keyframes zmdi-spin-reverse{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(-359deg);transform:rotate(-359deg)}}@keyframes zmdi-spin-reverse{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(-359deg);transform:rotate(-359deg)}}.zmdi-hc-rotate-90{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.zmdi-hc-rotate-180{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.zmdi-hc-rotate-270{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.zmdi-hc-flip-horizontal{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.zmdi-hc-flip-vertical{-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}.zmdi-hc-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.zmdi-hc-stack-1x,.zmdi-hc-stack-2x{position:absolute;left:0;width:100%;text-align:center}.zmdi-hc-stack-1x{line-height:inherit}.zmdi-hc-stack-2x{font-size:2em}.zmdi-hc-inverse{color:#fff}.zmdi-3d-rotation:before{content:'\f101'}.zmdi-airplane-off:before{content:'\f102'}.zmdi-airplane:before{content:'\f103'}.zmdi-album:before{content:'\f104'}.zmdi-archive:before{content:'\f105'}.zmdi-assignment-account:before{content:'\f106'}.zmdi-assignment-alert:before{content:'\f107'}.zmdi-assignment-check:before{content:'\f108'}.zmdi-assignment-o:before{content:'\f109'}.zmdi-assignment-return:before{content:'\f10a'}.zmdi-assignment-returned:before{content:'\f10b'}.zmdi-assignment:before{content:'\f10c'}.zmdi-attachment-alt:before{content:'\f10d'}.zmdi-attachment:before{content:'\f10e'}.zmdi-audio:before{content:'\f10f'}.zmdi-badge-check:before{content:'\f110'}.zmdi-balance-wallet:before{content:'\f111'}.zmdi-balance:before{content:'\f112'}.zmdi-battery-alert:before{content:'\f113'}.zmdi-battery-flash:before{content:'\f114'}.zmdi-battery-unknown:before{content:'\f115'}.zmdi-battery:before{content:'\f116'}.zmdi-bike:before{content:'\f117'}.zmdi-block-alt:before{content:'\f118'}.zmdi-block:before{content:'\f119'}.zmdi-boat:before{content:'\f11a'}.zmdi-book-image:before{content:'\f11b'}.zmdi-book:before{content:'\f11c'}.zmdi-bookmark-outline:before{content:'\f11d'}.zmdi-bookmark:before{content:'\f11e'}.zmdi-brush:before{content:'\f11f'}.zmdi-bug:before{content:'\f120'}.zmdi-bus:before{content:'\f121'}.zmdi-cake:before{content:'\f122'}.zmdi-car-taxi:before{content:'\f123'}.zmdi-car-wash:before{content:'\f124'}.zmdi-car:before{content:'\f125'}.zmdi-card-giftcard:before{content:'\f126'}.zmdi-card-membership:before{content:'\f127'}.zmdi-card-travel:before{content:'\f128'}.zmdi-card:before{content:'\f129'}.zmdi-case-check:before{content:'\f12a'}.zmdi-case-download:before{content:'\f12b'}.zmdi-case-play:before{content:'\f12c'}.zmdi-case:before{content:'\f12d'}.zmdi-cast-connected:before{content:'\f12e'}.zmdi-cast:before{content:'\f12f'}.zmdi-chart-donut:before{content:'\f130'}.zmdi-chart:before{content:'\f131'}.zmdi-city-alt:before{content:'\f132'}.zmdi-city:before{content:'\f133'}.zmdi-close-circle-o:before{content:'\f134'}.zmdi-close-circle:before{content:'\f135'}.zmdi-close:before{content:'\f136'}.zmdi-cocktail:before{content:'\f137'}.zmdi-code-setting:before{content:'\f138'}.zmdi-code-smartphone:before{content:'\f139'}.zmdi-code:before{content:'\f13a'}.zmdi-coffee:before{content:'\f13b'}.zmdi-collection-bookmark:before{content:'\f13c'}.zmdi-collection-case-play:before{content:'\f13d'}.zmdi-collection-folder-image:before{content:'\f13e'}.zmdi-collection-image-o:before{content:'\f13f'}.zmdi-collection-image:before{content:'\f140'}.zmdi-collection-item-1:before{content:'\f141'}.zmdi-collection-item-2:before{content:'\f142'}.zmdi-collection-item-3:before{content:'\f143'}.zmdi-collection-item-4:before{content:'\f144'}.zmdi-collection-item-5:before{content:'\f145'}.zmdi-collection-item-6:before{content:'\f146'}.zmdi-collection-item-7:before{content:'\f147'}.zmdi-collection-item-8:before{content:'\f148'}.zmdi-collection-item-9-plus:before{content:'\f149'}.zmdi-collection-item-9:before{content:'\f14a'}.zmdi-collection-item:before{content:'\f14b'}.zmdi-collection-music:before{content:'\f14c'}.zmdi-collection-pdf:before{content:'\f14d'}.zmdi-collection-plus:before{content:'\f14e'}.zmdi-collection-speaker:before{content:'\f14f'}.zmdi-collection-text:before{content:'\f150'}.zmdi-collection-video:before{content:'\f151'}.zmdi-compass:before{content:'\f152'}.zmdi-cutlery:before{content:'\f153'}.zmdi-delete:before{content:'\f154'}.zmdi-dialpad:before{content:'\f155'}.zmdi-dns:before{content:'\f156'}.zmdi-drink:before{content:'\f157'}.zmdi-edit:before{content:'\f158'}.zmdi-email-open:before{content:'\f159'}.zmdi-email:before{content:'\f15a'}.zmdi-eye-off:before{content:'\f15b'}.zmdi-eye:before{content:'\f15c'}.zmdi-eyedropper:before{content:'\f15d'}.zmdi-favorite-outline:before{content:'\f15e'}.zmdi-favorite:before{content:'\f15f'}.zmdi-filter-list:before{content:'\f160'}.zmdi-fire:before{content:'\f161'}.zmdi-flag:before{content:'\f162'}.zmdi-flare:before{content:'\f163'}.zmdi-flash-auto:before{content:'\f164'}.zmdi-flash-off:before{content:'\f165'}.zmdi-flash:before{content:'\f166'}.zmdi-flip:before{content:'\f167'}.zmdi-flower-alt:before{content:'\f168'}.zmdi-flower:before{content:'\f169'}.zmdi-font:before{content:'\f16a'}.zmdi-fullscreen-alt:before{content:'\f16b'}.zmdi-fullscreen-exit:before{content:'\f16c'}.zmdi-fullscreen:before{content:'\f16d'}.zmdi-functions:before{content:'\f16e'}.zmdi-gas-station:before{content:'\f16f'}.zmdi-gesture:before{content:'\f170'}.zmdi-globe-alt:before{content:'\f171'}.zmdi-globe-lock:before{content:'\f172'}.zmdi-globe:before{content:'\f173'}.zmdi-graduation-cap:before{content:'\f174'}.zmdi-home:before{content:'\f175'}.zmdi-hospital-alt:before{content:'\f176'}.zmdi-hospital:before{content:'\f177'}.zmdi-hotel:before{content:'\f178'}.zmdi-hourglass-alt:before{content:'\f179'}.zmdi-hourglass-outline:before{content:'\f17a'}.zmdi-hourglass:before{content:'\f17b'}.zmdi-http:before{content:'\f17c'}.zmdi-image-alt:before{content:'\f17d'}.zmdi-image-o:before{content:'\f17e'}.zmdi-image:before{content:'\f17f'}.zmdi-inbox:before{content:'\f180'}.zmdi-invert-colors-off:before{content:'\f181'}.zmdi-invert-colors:before{content:'\f182'}.zmdi-key:before{content:'\f183'}.zmdi-label-alt-outline:before{content:'\f184'}.zmdi-label-alt:before{content:'\f185'}.zmdi-label-heart:before{content:'\f186'}.zmdi-label:before{content:'\f187'}.zmdi-labels:before{content:'\f188'}.zmdi-lamp:before{content:'\f189'}.zmdi-landscape:before{content:'\f18a'}.zmdi-layers-off:before{content:'\f18b'}.zmdi-layers:before{content:'\f18c'}.zmdi-library:before{content:'\f18d'}.zmdi-link:before{content:'\f18e'}.zmdi-lock-open:before{content:'\f18f'}.zmdi-lock-outline:before{content:'\f190'}.zmdi-lock:before{content:'\f191'}.zmdi-mail-reply-all:before{content:'\f192'}.zmdi-mail-reply:before{content:'\f193'}.zmdi-mail-send:before{content:'\f194'}.zmdi-mall:before{content:'\f195'}.zmdi-map:before{content:'\f196'}.zmdi-menu:before{content:'\f197'}.zmdi-money-box:before{content:'\f198'}.zmdi-money-off:before{content:'\f199'}.zmdi-money:before{content:'\f19a'}.zmdi-more-vert:before{content:'\f19b'}.zmdi-more:before{content:'\f19c'}.zmdi-movie-alt:before{content:'\f19d'}.zmdi-movie:before{content:'\f19e'}.zmdi-nature-people:before{content:'\f19f'}.zmdi-nature:before{content:'\f1a0'}.zmdi-navigation:before{content:'\f1a1'}.zmdi-open-in-browser:before{content:'\f1a2'}.zmdi-open-in-new:before{content:'\f1a3'}.zmdi-palette:before{content:'\f1a4'}.zmdi-parking:before{content:'\f1a5'}.zmdi-pin-account:before{content:'\f1a6'}.zmdi-pin-assistant:before{content:'\f1a7'}.zmdi-pin-drop:before{content:'\f1a8'}.zmdi-pin-help:before{content:'\f1a9'}.zmdi-pin-off:before{content:'\f1aa'}.zmdi-pin:before{content:'\f1ab'}.zmdi-pizza:before{content:'\f1ac'}.zmdi-plaster:before{content:'\f1ad'}.zmdi-power-setting:before{content:'\f1ae'}.zmdi-power:before{content:'\f1af'}.zmdi-print:before{content:'\f1b0'}.zmdi-puzzle-piece:before{content:'\f1b1'}.zmdi-quote:before{content:'\f1b2'}.zmdi-railway:before{content:'\f1b3'}.zmdi-receipt:before{content:'\f1b4'}.zmdi-refresh-alt:before{content:'\f1b5'}.zmdi-refresh-sync-alert:before{content:'\f1b6'}.zmdi-refresh-sync-off:before{content:'\f1b7'}.zmdi-refresh-sync:before{content:'\f1b8'}.zmdi-refresh:before{content:'\f1b9'}.zmdi-roller:before{content:'\f1ba'}.zmdi-ruler:before{content:'\f1bb'}.zmdi-scissors:before{content:'\f1bc'}.zmdi-screen-rotation-lock:before{content:'\f1bd'}.zmdi-screen-rotation:before{content:'\f1be'}.zmdi-search-for:before{content:'\f1bf'}.zmdi-search-in-file:before{content:'\f1c0'}.zmdi-search-in-page:before{content:'\f1c1'}.zmdi-search-replace:before{content:'\f1c2'}.zmdi-search:before{content:'\f1c3'}.zmdi-seat:before{content:'\f1c4'}.zmdi-settings-square:before{content:'\f1c5'}.zmdi-settings:before{content:'\f1c6'}.zmdi-shield-check:before{content:'\f1c7'}.zmdi-shield-security:before{content:'\f1c8'}.zmdi-shopping-basket:before{content:'\f1c9'}.zmdi-shopping-cart-plus:before{content:'\f1ca'}.zmdi-shopping-cart:before{content:'\f1cb'}.zmdi-sign-in:before{content:'\f1cc'}.zmdi-sort-amount-asc:before{content:'\f1cd'}.zmdi-sort-amount-desc:before{content:'\f1ce'}.zmdi-sort-asc:before{content:'\f1cf'}.zmdi-sort-desc:before{content:'\f1d0'}.zmdi-spellcheck:before{content:'\f1d1'}.zmdi-storage:before{content:'\f1d2'}.zmdi-store-24:before{content:'\f1d3'}.zmdi-store:before{content:'\f1d4'}.zmdi-subway:before{content:'\f1d5'}.zmdi-sun:before{content:'\f1d6'}.zmdi-tab-unselected:before{content:'\f1d7'}.zmdi-tab:before{content:'\f1d8'}.zmdi-tag-close:before{content:'\f1d9'}.zmdi-tag-more:before{content:'\f1da'}.zmdi-tag:before{content:'\f1db'}.zmdi-thumb-down:before{content:'\f1dc'}.zmdi-thumb-up-down:before{content:'\f1dd'}.zmdi-thumb-up:before{content:'\f1de'}.zmdi-ticket-star:before{content:'\f1df'}.zmdi-toll:before{content:'\f1e0'}.zmdi-toys:before{content:'\f1e1'}.zmdi-traffic:before{content:'\f1e2'}.zmdi-translate:before{content:'\f1e3'}.zmdi-triangle-down:before{content:'\f1e4'}.zmdi-triangle-up:before{content:'\f1e5'}.zmdi-truck:before{content:'\f1e6'}.zmdi-turning-sign:before{content:'\f1e7'}.zmdi-wallpaper:before{content:'\f1e8'}.zmdi-washing-machine:before{content:'\f1e9'}.zmdi-window-maximize:before{content:'\f1ea'}.zmdi-window-minimize:before{content:'\f1eb'}.zmdi-window-restore:before{content:'\f1ec'}.zmdi-wrench:before{content:'\f1ed'}.zmdi-zoom-in:before{content:'\f1ee'}.zmdi-zoom-out:before{content:'\f1ef'}.zmdi-alert-circle-o:before{content:'\f1f0'}.zmdi-alert-circle:before{content:'\f1f1'}.zmdi-alert-octagon:before{content:'\f1f2'}.zmdi-alert-polygon:before{content:'\f1f3'}.zmdi-alert-triangle:before{content:'\f1f4'}.zmdi-help-outline:before{content:'\f1f5'}.zmdi-help:before{content:'\f1f6'}.zmdi-info-outline:before{content:'\f1f7'}.zmdi-info:before{content:'\f1f8'}.zmdi-notifications-active:before{content:'\f1f9'}.zmdi-notifications-add:before{content:'\f1fa'}.zmdi-notifications-none:before{content:'\f1fb'}.zmdi-notifications-off:before{content:'\f1fc'}.zmdi-notifications-paused:before{content:'\f1fd'}.zmdi-notifications:before{content:'\f1fe'}.zmdi-account-add:before{content:'\f1ff'}.zmdi-account-box-mail:before{content:'\f200'}.zmdi-account-box-o:before{content:'\f201'}.zmdi-account-box-phone:before{content:'\f202'}.zmdi-account-box:before{content:'\f203'}.zmdi-account-calendar:before{content:'\f204'}.zmdi-account-circle:before{content:'\f205'}.zmdi-account-o:before{content:'\f206'}.zmdi-account:before{content:'\f207'}.zmdi-accounts-add:before{content:'\f208'}.zmdi-accounts-alt:before{content:'\f209'}.zmdi-accounts-list-alt:before{content:'\f20a'}.zmdi-accounts-list:before{content:'\f20b'}.zmdi-accounts-outline:before{content:'\f20c'}.zmdi-accounts:before{content:'\f20d'}.zmdi-face:before{content:'\f20e'}.zmdi-female:before{content:'\f20f'}.zmdi-male-alt:before{content:'\f210'}.zmdi-male-female:before{content:'\f211'}.zmdi-male:before{content:'\f212'}.zmdi-mood-bad:before{content:'\f213'}.zmdi-mood:before{content:'\f214'}.zmdi-run:before{content:'\f215'}.zmdi-walk:before{content:'\f216'}.zmdi-cloud-box:before{content:'\f217'}.zmdi-cloud-circle:before{content:'\f218'}.zmdi-cloud-done:before{content:'\f219'}.zmdi-cloud-download:before{content:'\f21a'}.zmdi-cloud-off:before{content:'\f21b'}.zmdi-cloud-outline-alt:before{content:'\f21c'}.zmdi-cloud-outline:before{content:'\f21d'}.zmdi-cloud-upload:before{content:'\f21e'}.zmdi-cloud:before{content:'\f21f'}.zmdi-download:before{content:'\f220'}.zmdi-file-plus:before{content:'\f221'}.zmdi-file-text:before{content:'\f222'}.zmdi-file:before{content:'\f223'}.zmdi-folder-outline:before{content:'\f224'}.zmdi-folder-person:before{content:'\f225'}.zmdi-folder-star-alt:before{content:'\f226'}.zmdi-folder-star:before{content:'\f227'}.zmdi-folder:before{content:'\f228'}.zmdi-gif:before{content:'\f229'}.zmdi-upload:before{content:'\f22a'}.zmdi-border-all:before{content:'\f22b'}.zmdi-border-bottom:before{content:'\f22c'}.zmdi-border-clear:before{content:'\f22d'}.zmdi-border-color:before{content:'\f22e'}.zmdi-border-horizontal:before{content:'\f22f'}.zmdi-border-inner:before{content:'\f230'}.zmdi-border-left:before{content:'\f231'}.zmdi-border-outer:before{content:'\f232'}.zmdi-border-right:before{content:'\f233'}.zmdi-border-style:before{content:'\f234'}.zmdi-border-top:before{content:'\f235'}.zmdi-border-vertical:before{content:'\f236'}.zmdi-copy:before{content:'\f237'}.zmdi-crop:before{content:'\f238'}.zmdi-format-align-center:before{content:'\f239'}.zmdi-format-align-justify:before{content:'\f23a'}.zmdi-format-align-left:before{content:'\f23b'}.zmdi-format-align-right:before{content:'\f23c'}.zmdi-format-bold:before{content:'\f23d'}.zmdi-format-clear-all:before{content:'\f23e'}.zmdi-format-clear:before{content:'\f23f'}.zmdi-format-color-fill:before{content:'\f240'}.zmdi-format-color-reset:before{content:'\f241'}.zmdi-format-color-text:before{content:'\f242'}.zmdi-format-indent-decrease:before{content:'\f243'}.zmdi-format-indent-increase:before{content:'\f244'}.zmdi-format-italic:before{content:'\f245'}.zmdi-format-line-spacing:before{content:'\f246'}.zmdi-format-list-bulleted:before{content:'\f247'}.zmdi-format-list-numbered:before{content:'\f248'}.zmdi-format-ltr:before{content:'\f249'}.zmdi-format-rtl:before{content:'\f24a'}.zmdi-format-size:before{content:'\f24b'}.zmdi-format-strikethrough-s:before{content:'\f24c'}.zmdi-format-strikethrough:before{content:'\f24d'}.zmdi-format-subject:before{content:'\f24e'}.zmdi-format-underlined:before{content:'\f24f'}.zmdi-format-valign-bottom:before{content:'\f250'}.zmdi-format-valign-center:before{content:'\f251'}.zmdi-format-valign-top:before{content:'\f252'}.zmdi-redo:before{content:'\f253'}.zmdi-select-all:before{content:'\f254'}.zmdi-space-bar:before{content:'\f255'}.zmdi-text-format:before{content:'\f256'}.zmdi-transform:before{content:'\f257'}.zmdi-undo:before{content:'\f258'}.zmdi-wrap-text:before{content:'\f259'}.zmdi-comment-alert:before{content:'\f25a'}.zmdi-comment-alt-text:before{content:'\f25b'}.zmdi-comment-alt:before{content:'\f25c'}.zmdi-comment-edit:before{content:'\f25d'}.zmdi-comment-image:before{content:'\f25e'}.zmdi-comment-list:before{content:'\f25f'}.zmdi-comment-more:before{content:'\f260'}.zmdi-comment-outline:before{content:'\f261'}.zmdi-comment-text-alt:before{content:'\f262'}.zmdi-comment-text:before{content:'\f263'}.zmdi-comment-video:before{content:'\f264'}.zmdi-comment:before{content:'\f265'}.zmdi-comments:before{content:'\f266'}.zmdi-check-all:before{content:'\f267'}.zmdi-check-circle-u:before{content:'\f268'}.zmdi-check-circle:before{content:'\f269'}.zmdi-check-square:before{content:'\f26a'}.zmdi-check:before{content:'\f26b'}.zmdi-circle-o:before{content:'\f26c'}.zmdi-circle:before{content:'\f26d'}.zmdi-dot-circle-alt:before{content:'\f26e'}.zmdi-dot-circle:before{content:'\f26f'}.zmdi-minus-circle-outline:before{content:'\f270'}.zmdi-minus-circle:before{content:'\f271'}.zmdi-minus-square:before{content:'\f272'}.zmdi-minus:before{content:'\f273'}.zmdi-plus-circle-o-duplicate:before{content:'\f274'}.zmdi-plus-circle-o:before{content:'\f275'}.zmdi-plus-circle:before{content:'\f276'}.zmdi-plus-square:before{content:'\f277'}.zmdi-plus:before{content:'\f278'}.zmdi-square-o:before{content:'\f279'}.zmdi-star-circle:before{content:'\f27a'}.zmdi-star-half:before{content:'\f27b'}.zmdi-star-outline:before{content:'\f27c'}.zmdi-star:before{content:'\f27d'}.zmdi-bluetooth-connected:before{content:'\f27e'}.zmdi-bluetooth-off:before{content:'\f27f'}.zmdi-bluetooth-search:before{content:'\f280'}.zmdi-bluetooth-setting:before{content:'\f281'}.zmdi-bluetooth:before{content:'\f282'}.zmdi-camera-add:before{content:'\f283'}.zmdi-camera-alt:before{content:'\f284'}.zmdi-camera-bw:before{content:'\f285'}.zmdi-camera-front:before{content:'\f286'}.zmdi-camera-mic:before{content:'\f287'}.zmdi-camera-party-mode:before{content:'\f288'}.zmdi-camera-rear:before{content:'\f289'}.zmdi-camera-roll:before{content:'\f28a'}.zmdi-camera-switch:before{content:'\f28b'}.zmdi-camera:before{content:'\f28c'}.zmdi-card-alert:before{content:'\f28d'}.zmdi-card-off:before{content:'\f28e'}.zmdi-card-sd:before{content:'\f28f'}.zmdi-card-sim:before{content:'\f290'}.zmdi-desktop-mac:before{content:'\f291'}.zmdi-desktop-windows:before{content:'\f292'}.zmdi-device-hub:before{content:'\f293'}.zmdi-devices-off:before{content:'\f294'}.zmdi-devices:before{content:'\f295'}.zmdi-dock:before{content:'\f296'}.zmdi-floppy:before{content:'\f297'}.zmdi-gamepad:before{content:'\f298'}.zmdi-gps-dot:before{content:'\f299'}.zmdi-gps-off:before{content:'\f29a'}.zmdi-gps:before{content:'\f29b'}.zmdi-headset-mic:before{content:'\f29c'}.zmdi-headset:before{content:'\f29d'}.zmdi-input-antenna:before{content:'\f29e'}.zmdi-input-composite:before{content:'\f29f'}.zmdi-input-hdmi:before{content:'\f2a0'}.zmdi-input-power:before{content:'\f2a1'}.zmdi-input-svideo:before{content:'\f2a2'}.zmdi-keyboard-hide:before{content:'\f2a3'}.zmdi-keyboard:before{content:'\f2a4'}.zmdi-laptop-chromebook:before{content:'\f2a5'}.zmdi-laptop-mac:before{content:'\f2a6'}.zmdi-laptop:before{content:'\f2a7'}.zmdi-mic-off:before{content:'\f2a8'}.zmdi-mic-outline:before{content:'\f2a9'}.zmdi-mic-setting:before{content:'\f2aa'}.zmdi-mic:before{content:'\f2ab'}.zmdi-mouse:before{content:'\f2ac'}.zmdi-network-alert:before{content:'\f2ad'}.zmdi-network-locked:before{content:'\f2ae'}.zmdi-network-off:before{content:'\f2af'}.zmdi-network-outline:before{content:'\f2b0'}.zmdi-network-setting:before{content:'\f2b1'}.zmdi-network:before{content:'\f2b2'}.zmdi-phone-bluetooth:before{content:'\f2b3'}.zmdi-phone-end:before{content:'\f2b4'}.zmdi-phone-forwarded:before{content:'\f2b5'}.zmdi-phone-in-talk:before{content:'\f2b6'}.zmdi-phone-locked:before{content:'\f2b7'}.zmdi-phone-missed:before{content:'\f2b8'}.zmdi-phone-msg:before{content:'\f2b9'}.zmdi-phone-paused:before{content:'\f2ba'}.zmdi-phone-ring:before{content:'\f2bb'}.zmdi-phone-setting:before{content:'\f2bc'}.zmdi-phone-sip:before{content:'\f2bd'}.zmdi-phone:before{content:'\f2be'}.zmdi-portable-wifi-changes:before{content:'\f2bf'}.zmdi-portable-wifi-off:before{content:'\f2c0'}.zmdi-portable-wifi:before{content:'\f2c1'}.zmdi-radio:before{content:'\f2c2'}.zmdi-reader:before{content:'\f2c3'}.zmdi-remote-control-alt:before{content:'\f2c4'}.zmdi-remote-control:before{content:'\f2c5'}.zmdi-router:before{content:'\f2c6'}.zmdi-scanner:before{content:'\f2c7'}.zmdi-smartphone-android:before{content:'\f2c8'}.zmdi-smartphone-download:before{content:'\f2c9'}.zmdi-smartphone-erase:before{content:'\f2ca'}.zmdi-smartphone-info:before{content:'\f2cb'}.zmdi-smartphone-iphone:before{content:'\f2cc'}.zmdi-smartphone-landscape-lock:before{content:'\f2cd'}.zmdi-smartphone-landscape:before{content:'\f2ce'}.zmdi-smartphone-lock:before{content:'\f2cf'}.zmdi-smartphone-portrait-lock:before{content:'\f2d0'}.zmdi-smartphone-ring:before{content:'\f2d1'}.zmdi-smartphone-setting:before{content:'\f2d2'}.zmdi-smartphone-setup:before{content:'\f2d3'}.zmdi-smartphone:before{content:'\f2d4'}.zmdi-speaker:before{content:'\f2d5'}.zmdi-tablet-android:before{content:'\f2d6'}.zmdi-tablet-mac:before{content:'\f2d7'}.zmdi-tablet:before{content:'\f2d8'}.zmdi-tv-alt-play:before{content:'\f2d9'}.zmdi-tv-list:before{content:'\f2da'}.zmdi-tv-play:before{content:'\f2db'}.zmdi-tv:before{content:'\f2dc'}.zmdi-usb:before{content:'\f2dd'}.zmdi-videocam-off:before{content:'\f2de'}.zmdi-videocam-switch:before{content:'\f2df'}.zmdi-videocam:before{content:'\f2e0'}.zmdi-watch:before{content:'\f2e1'}.zmdi-wifi-alt-2:before{content:'\f2e2'}.zmdi-wifi-alt:before{content:'\f2e3'}.zmdi-wifi-info:before{content:'\f2e4'}.zmdi-wifi-lock:before{content:'\f2e5'}.zmdi-wifi-off:before{content:'\f2e6'}.zmdi-wifi-outline:before{content:'\f2e7'}.zmdi-wifi:before{content:'\f2e8'}.zmdi-arrow-left-bottom:before{content:'\f2e9'}.zmdi-arrow-left:before{content:'\f2ea'}.zmdi-arrow-merge:before{content:'\f2eb'}.zmdi-arrow-missed:before{content:'\f2ec'}.zmdi-arrow-right-top:before{content:'\f2ed'}.zmdi-arrow-right:before{content:'\f2ee'}.zmdi-arrow-split:before{content:'\f2ef'}.zmdi-arrows:before{content:'\f2f0'}.zmdi-caret-down-circle:before{content:'\f2f1'}.zmdi-caret-down:before{content:'\f2f2'}.zmdi-caret-left-circle:before{content:'\f2f3'}.zmdi-caret-left:before{content:'\f2f4'}.zmdi-caret-right-circle:before{content:'\f2f5'}.zmdi-caret-right:before{content:'\f2f6'}.zmdi-caret-up-circle:before{content:'\f2f7'}.zmdi-caret-up:before{content:'\f2f8'}.zmdi-chevron-down:before{content:'\f2f9'}.zmdi-chevron-left:before{content:'\f2fa'}.zmdi-chevron-right:before{content:'\f2fb'}.zmdi-chevron-up:before{content:'\f2fc'}.zmdi-forward:before{content:'\f2fd'}.zmdi-long-arrow-down:before{content:'\f2fe'}.zmdi-long-arrow-left:before{content:'\f2ff'}.zmdi-long-arrow-return:before{content:'\f300'}.zmdi-long-arrow-right:before{content:'\f301'}.zmdi-long-arrow-tab:before{content:'\f302'}.zmdi-long-arrow-up:before{content:'\f303'}.zmdi-rotate-ccw:before{content:'\f304'}.zmdi-rotate-cw:before{content:'\f305'}.zmdi-rotate-left:before{content:'\f306'}.zmdi-rotate-right:before{content:'\f307'}.zmdi-square-down:before{content:'\f308'}.zmdi-square-right:before{content:'\f309'}.zmdi-swap-alt:before{content:'\f30a'}.zmdi-swap-vertical-circle:before{content:'\f30b'}.zmdi-swap-vertical:before{content:'\f30c'}.zmdi-swap:before{content:'\f30d'}.zmdi-trending-down:before{content:'\f30e'}.zmdi-trending-flat:before{content:'\f30f'}.zmdi-trending-up:before{content:'\f310'}.zmdi-unfold-less:before{content:'\f311'}.zmdi-unfold-more:before{content:'\f312'}.zmdi-apps:before{content:'\f313'}.zmdi-grid-off:before{content:'\f314'}.zmdi-grid:before{content:'\f315'}.zmdi-view-agenda:before{content:'\f316'}.zmdi-view-array:before{content:'\f317'}.zmdi-view-carousel:before{content:'\f318'}.zmdi-view-column:before{content:'\f319'}.zmdi-view-comfy:before{content:'\f31a'}.zmdi-view-compact:before{content:'\f31b'}.zmdi-view-dashboard:before{content:'\f31c'}.zmdi-view-day:before{content:'\f31d'}.zmdi-view-headline:before{content:'\f31e'}.zmdi-view-list-alt:before{content:'\f31f'}.zmdi-view-list:before{content:'\f320'}.zmdi-view-module:before{content:'\f321'}.zmdi-view-quilt:before{content:'\f322'}.zmdi-view-stream:before{content:'\f323'}.zmdi-view-subtitles:before{content:'\f324'}.zmdi-view-toc:before{content:'\f325'}.zmdi-view-web:before{content:'\f326'}.zmdi-view-week:before{content:'\f327'}.zmdi-widgets:before{content:'\f328'}.zmdi-alarm-check:before{content:'\f329'}.zmdi-alarm-off:before{content:'\f32a'}.zmdi-alarm-plus:before{content:'\f32b'}.zmdi-alarm-snooze:before{content:'\f32c'}.zmdi-alarm:before{content:'\f32d'}.zmdi-calendar-alt:before{content:'\f32e'}.zmdi-calendar-check:before{content:'\f32f'}.zmdi-calendar-close:before{content:'\f330'}.zmdi-calendar-note:before{content:'\f331'}.zmdi-calendar:before{content:'\f332'}.zmdi-time-countdown:before{content:'\f333'}.zmdi-time-interval:before{content:'\f334'}.zmdi-time-restore-setting:before{content:'\f335'}.zmdi-time-restore:before{content:'\f336'}.zmdi-time:before{content:'\f337'}.zmdi-timer-off:before{content:'\f338'}.zmdi-timer:before{content:'\f339'}.zmdi-android-alt:before{content:'\f33a'}.zmdi-android:before{content:'\f33b'}.zmdi-apple:before{content:'\f33c'}.zmdi-behance:before{content:'\f33d'}.zmdi-codepen:before{content:'\f33e'}.zmdi-dribbble:before{content:'\f33f'}.zmdi-dropbox:before{content:'\f340'}.zmdi-evernote:before{content:'\f341'}.zmdi-facebook-box:before{content:'\f342'}.zmdi-facebook:before{content:'\f343'}.zmdi-github-box:before{content:'\f344'}.zmdi-github:before{content:'\f345'}.zmdi-google-drive:before{content:'\f346'}.zmdi-google-earth:before{content:'\f347'}.zmdi-google-glass:before{content:'\f348'}.zmdi-google-maps:before{content:'\f349'}.zmdi-google-pages:before{content:'\f34a'}.zmdi-google-play:before{content:'\f34b'}.zmdi-google-plus-box:before{content:'\f34c'}.zmdi-google-plus:before{content:'\f34d'}.zmdi-google:before{content:'\f34e'}.zmdi-instagram:before{content:'\f34f'}.zmdi-language-css3:before{content:'\f350'}.zmdi-language-html5:before{content:'\f351'}.zmdi-language-javascript:before{content:'\f352'}.zmdi-language-python-alt:before{content:'\f353'}.zmdi-language-python:before{content:'\f354'}.zmdi-lastfm:before{content:'\f355'}.zmdi-linkedin-box:before{content:'\f356'}.zmdi-paypal:before{content:'\f357'}.zmdi-pinterest-box:before{content:'\f358'}.zmdi-pocket:before{content:'\f359'}.zmdi-polymer:before{content:'\f35a'}.zmdi-share:before{content:'\f35b'}.zmdi-stackoverflow:before{content:'\f35c'}.zmdi-steam-square:before{content:'\f35d'}.zmdi-steam:before{content:'\f35e'}.zmdi-twitter-box:before{content:'\f35f'}.zmdi-twitter:before{content:'\f360'}.zmdi-vk:before{content:'\f361'}.zmdi-wikipedia:before{content:'\f362'}.zmdi-windows:before{content:'\f363'}.zmdi-aspect-ratio-alt:before{content:'\f364'}.zmdi-aspect-ratio:before{content:'\f365'}.zmdi-blur-circular:before{content:'\f366'}.zmdi-blur-linear:before{content:'\f367'}.zmdi-blur-off:before{content:'\f368'}.zmdi-blur:before{content:'\f369'}.zmdi-brightness-2:before{content:'\f36a'}.zmdi-brightness-3:before{content:'\f36b'}.zmdi-brightness-4:before{content:'\f36c'}.zmdi-brightness-5:before{content:'\f36d'}.zmdi-brightness-6:before{content:'\f36e'}.zmdi-brightness-7:before{content:'\f36f'}.zmdi-brightness-auto:before{content:'\f370'}.zmdi-brightness-setting:before{content:'\f371'}.zmdi-broken-image:before{content:'\f372'}.zmdi-center-focus-strong:before{content:'\f373'}.zmdi-center-focus-weak:before{content:'\f374'}.zmdi-compare:before{content:'\f375'}.zmdi-crop-16-9:before{content:'\f376'}.zmdi-crop-3-2:before{content:'\f377'}.zmdi-crop-5-4:before{content:'\f378'}.zmdi-crop-7-5:before{content:'\f379'}.zmdi-crop-din:before{content:'\f37a'}.zmdi-crop-free:before{content:'\f37b'}.zmdi-crop-landscape:before{content:'\f37c'}.zmdi-crop-portrait:before{content:'\f37d'}.zmdi-crop-square:before{content:'\f37e'}.zmdi-exposure-alt:before{content:'\f37f'}.zmdi-exposure:before{content:'\f380'}.zmdi-filter-b-and-w:before{content:'\f381'}.zmdi-filter-center-focus:before{content:'\f382'}.zmdi-filter-frames:before{content:'\f383'}.zmdi-filter-tilt-shift:before{content:'\f384'}.zmdi-gradient:before{content:'\f385'}.zmdi-grain:before{content:'\f386'}.zmdi-graphic-eq:before{content:'\f387'}.zmdi-hdr-off:before{content:'\f388'}.zmdi-hdr-strong:before{content:'\f389'}.zmdi-hdr-weak:before{content:'\f38a'}.zmdi-hdr:before{content:'\f38b'}.zmdi-iridescent:before{content:'\f38c'}.zmdi-leak-off:before{content:'\f38d'}.zmdi-leak:before{content:'\f38e'}.zmdi-looks:before{content:'\f38f'}.zmdi-loupe:before{content:'\f390'}.zmdi-panorama-horizontal:before{content:'\f391'}.zmdi-panorama-vertical:before{content:'\f392'}.zmdi-panorama-wide-angle:before{content:'\f393'}.zmdi-photo-size-select-large:before{content:'\f394'}.zmdi-photo-size-select-small:before{content:'\f395'}.zmdi-picture-in-picture:before{content:'\f396'}.zmdi-slideshow:before{content:'\f397'}.zmdi-texture:before{content:'\f398'}.zmdi-tonality:before{content:'\f399'}.zmdi-vignette:before{content:'\f39a'}.zmdi-wb-auto:before{content:'\f39b'}.zmdi-eject-alt:before{content:'\f39c'}.zmdi-eject:before{content:'\f39d'}.zmdi-equalizer:before{content:'\f39e'}.zmdi-fast-forward:before{content:'\f39f'}.zmdi-fast-rewind:before{content:'\f3a0'}.zmdi-forward-10:before{content:'\f3a1'}.zmdi-forward-30:before{content:'\f3a2'}.zmdi-forward-5:before{content:'\f3a3'}.zmdi-hearing:before{content:'\f3a4'}.zmdi-pause-circle-outline:before{content:'\f3a5'}.zmdi-pause-circle:before{content:'\f3a6'}.zmdi-pause:before{content:'\f3a7'}.zmdi-play-circle-outline:before{content:'\f3a8'}.zmdi-play-circle:before{content:'\f3a9'}.zmdi-play:before{content:'\f3aa'}.zmdi-playlist-audio:before{content:'\f3ab'}.zmdi-playlist-plus:before{content:'\f3ac'}.zmdi-repeat-one:before{content:'\f3ad'}.zmdi-repeat:before{content:'\f3ae'}.zmdi-replay-10:before{content:'\f3af'}.zmdi-replay-30:before{content:'\f3b0'}.zmdi-replay-5:before{content:'\f3b1'}.zmdi-replay:before{content:'\f3b2'}.zmdi-shuffle:before{content:'\f3b3'}.zmdi-skip-next:before{content:'\f3b4'}.zmdi-skip-previous:before{content:'\f3b5'}.zmdi-stop:before{content:'\f3b6'}.zmdi-surround-sound:before{content:'\f3b7'}.zmdi-tune:before{content:'\f3b8'}.zmdi-volume-down:before{content:'\f3b9'}.zmdi-volume-mute:before{content:'\f3ba'}.zmdi-volume-off:before{content:'\f3bb'}.zmdi-volume-up:before{content:'\f3bc'}.zmdi-n-1-square:before{content:'\f3bd'}.zmdi-n-2-square:before{content:'\f3be'}.zmdi-n-3-square:before{content:'\f3bf'}.zmdi-n-4-square:before{content:'\f3c0'}.zmdi-n-5-square:before{content:'\f3c1'}.zmdi-n-6-square:before{content:'\f3c2'}.zmdi-neg-1:before{content:'\f3c3'}.zmdi-neg-2:before{content:'\f3c4'}.zmdi-plus-1:before{content:'\f3c5'}.zmdi-plus-2:before{content:'\f3c6'}.zmdi-sec-10:before{content:'\f3c7'}.zmdi-sec-3:before{content:'\f3c8'}.zmdi-zero:before{content:'\f3c9'}.zmdi-airline-seat-flat-angled:before{content:'\f3ca'}.zmdi-airline-seat-flat:before{content:'\f3cb'}.zmdi-airline-seat-individual-suite:before{content:'\f3cc'}.zmdi-airline-seat-legroom-extra:before{content:'\f3cd'}.zmdi-airline-seat-legroom-normal:before{content:'\f3ce'}.zmdi-airline-seat-legroom-reduced:before{content:'\f3cf'}.zmdi-airline-seat-recline-extra:before{content:'\f3d0'}.zmdi-airline-seat-recline-normal:before{content:'\f3d1'}.zmdi-airplay:before{content:'\f3d2'}.zmdi-closed-caption:before{content:'\f3d3'}.zmdi-confirmation-number:before{content:'\f3d4'}.zmdi-developer-board:before{content:'\f3d5'}.zmdi-disc-full:before{content:'\f3d6'}.zmdi-explicit:before{content:'\f3d7'}.zmdi-flight-land:before{content:'\f3d8'}.zmdi-flight-takeoff:before{content:'\f3d9'}.zmdi-flip-to-back:before{content:'\f3da'}.zmdi-flip-to-front:before{content:'\f3db'}.zmdi-group-work:before{content:'\f3dc'}.zmdi-hd:before{content:'\f3dd'}.zmdi-hq:before{content:'\f3de'}.zmdi-markunread-mailbox:before{content:'\f3df'}.zmdi-memory:before{content:'\f3e0'}.zmdi-nfc:before{content:'\f3e1'}.zmdi-play-for-work:before{content:'\f3e2'}.zmdi-power-input:before{content:'\f3e3'}.zmdi-present-to-all:before{content:'\f3e4'}.zmdi-satellite:before{content:'\f3e5'}.zmdi-tap-and-play:before{content:'\f3e6'}.zmdi-vibration:before{content:'\f3e7'}.zmdi-voicemail:before{content:'\f3e8'}.zmdi-group:before{content:'\f3e9'}.zmdi-rss:before{content:'\f3ea'}.zmdi-shape:before{content:'\f3eb'}.zmdi-spinner:before{content:'\f3ec'}.zmdi-ungroup:before{content:'\f3ed'}.zmdi-500px:before{content:'\f3ee'}.zmdi-8tracks:before{content:'\f3ef'}.zmdi-amazon:before{content:'\f3f0'}.zmdi-blogger:before{content:'\f3f1'}.zmdi-delicious:before{content:'\f3f2'}.zmdi-disqus:before{content:'\f3f3'}.zmdi-flattr:before{content:'\f3f4'}.zmdi-flickr:before{content:'\f3f5'}.zmdi-github-alt:before{content:'\f3f6'}.zmdi-google-old:before{content:'\f3f7'}.zmdi-linkedin:before{content:'\f3f8'}.zmdi-odnoklassniki:before{content:'\f3f9'}.zmdi-outlook:before{content:'\f3fa'}.zmdi-paypal-alt:before{content:'\f3fb'}.zmdi-pinterest:before{content:'\f3fc'}.zmdi-playstation:before{content:'\f3fd'}.zmdi-reddit:before{content:'\f3fe'}.zmdi-skype:before{content:'\f3ff'}.zmdi-slideshare:before{content:'\f400'}.zmdi-soundcloud:before{content:'\f401'}.zmdi-tumblr:before{content:'\f402'}.zmdi-twitch:before{content:'\f403'}.zmdi-vimeo:before{content:'\f404'}.zmdi-whatsapp:before{content:'\f405'}.zmdi-xbox:before{content:'\f406'}.zmdi-yahoo:before{content:'\f407'}.zmdi-youtube-play:before{content:'\f408'}.zmdi-youtube:before{content:'\f409'}.zmdi-3d-rotation:before{content:'\f101'}.zmdi-airplane-off:before{content:'\f102'}.zmdi-airplane:before{content:'\f103'}.zmdi-album:before{content:'\f104'}.zmdi-archive:before{content:'\f105'}.zmdi-assignment-account:before{content:'\f106'}.zmdi-assignment-alert:before{content:'\f107'}.zmdi-assignment-check:before{content:'\f108'}.zmdi-assignment-o:before{content:'\f109'}.zmdi-assignment-return:before{content:'\f10a'}.zmdi-assignment-returned:before{content:'\f10b'}.zmdi-assignment:before{content:'\f10c'}.zmdi-attachment-alt:before{content:'\f10d'}.zmdi-attachment:before{content:'\f10e'}.zmdi-audio:before{content:'\f10f'}.zmdi-badge-check:before{content:'\f110'}.zmdi-balance-wallet:before{content:'\f111'}.zmdi-balance:before{content:'\f112'}.zmdi-battery-alert:before{content:'\f113'}.zmdi-battery-flash:before{content:'\f114'}.zmdi-battery-unknown:before{content:'\f115'}.zmdi-battery:before{content:'\f116'}.zmdi-bike:before{content:'\f117'}.zmdi-block-alt:before{content:'\f118'}.zmdi-block:before{content:'\f119'}.zmdi-boat:before{content:'\f11a'}.zmdi-book-image:before{content:'\f11b'}.zmdi-book:before{content:'\f11c'}.zmdi-bookmark-outline:before{content:'\f11d'}.zmdi-bookmark:before{content:'\f11e'}.zmdi-brush:before{content:'\f11f'}.zmdi-bug:before{content:'\f120'}.zmdi-bus:before{content:'\f121'}.zmdi-cake:before{content:'\f122'}.zmdi-car-taxi:before{content:'\f123'}.zmdi-car-wash:before{content:'\f124'}.zmdi-car:before{content:'\f125'}.zmdi-card-giftcard:before{content:'\f126'}.zmdi-card-membership:before{content:'\f127'}.zmdi-card-travel:before{content:'\f128'}.zmdi-card:before{content:'\f129'}.zmdi-case-check:before{content:'\f12a'}.zmdi-case-download:before{content:'\f12b'}.zmdi-case-play:before{content:'\f12c'}.zmdi-case:before{content:'\f12d'}.zmdi-cast-connected:before{content:'\f12e'}.zmdi-cast:before{content:'\f12f'}.zmdi-chart-donut:before{content:'\f130'}.zmdi-chart:before{content:'\f131'}.zmdi-city-alt:before{content:'\f132'}.zmdi-city:before{content:'\f133'}.zmdi-close-circle-o:before{content:'\f134'}.zmdi-close-circle:before{content:'\f135'}.zmdi-close:before{content:'\f136'}.zmdi-cocktail:before{content:'\f137'}.zmdi-code-setting:before{content:'\f138'}.zmdi-code-smartphone:before{content:'\f139'}.zmdi-code:before{content:'\f13a'}.zmdi-coffee:before{content:'\f13b'}.zmdi-collection-bookmark:before{content:'\f13c'}.zmdi-collection-case-play:before{content:'\f13d'}.zmdi-collection-folder-image:before{content:'\f13e'}.zmdi-collection-image-o:before{content:'\f13f'}.zmdi-collection-image:before{content:'\f140'}.zmdi-collection-item-1:before{content:'\f141'}.zmdi-collection-item-2:before{content:'\f142'}.zmdi-collection-item-3:before{content:'\f143'}.zmdi-collection-item-4:before{content:'\f144'}.zmdi-collection-item-5:before{content:'\f145'}.zmdi-collection-item-6:before{content:'\f146'}.zmdi-collection-item-7:before{content:'\f147'}.zmdi-collection-item-8:before{content:'\f148'}.zmdi-collection-item-9-plus:before{content:'\f149'}.zmdi-collection-item-9:before{content:'\f14a'}.zmdi-collection-item:before{content:'\f14b'}.zmdi-collection-music:before{content:'\f14c'}.zmdi-collection-pdf:before{content:'\f14d'}.zmdi-collection-plus:before{content:'\f14e'}.zmdi-collection-speaker:before{content:'\f14f'}.zmdi-collection-text:before{content:'\f150'}.zmdi-collection-video:before{content:'\f151'}.zmdi-compass:before{content:'\f152'}.zmdi-cutlery:before{content:'\f153'}.zmdi-delete:before{content:'\f154'}.zmdi-dialpad:before{content:'\f155'}.zmdi-dns:before{content:'\f156'}.zmdi-drink:before{content:'\f157'}.zmdi-edit:before{content:'\f158'}.zmdi-email-open:before{content:'\f159'}.zmdi-email:before{content:'\f15a'}.zmdi-eye-off:before{content:'\f15b'}.zmdi-eye:before{content:'\f15c'}.zmdi-eyedropper:before{content:'\f15d'}.zmdi-favorite-outline:before{content:'\f15e'}.zmdi-favorite:before{content:'\f15f'}.zmdi-filter-list:before{content:'\f160'}.zmdi-fire:before{content:'\f161'}.zmdi-flag:before{content:'\f162'}.zmdi-flare:before{content:'\f163'}.zmdi-flash-auto:before{content:'\f164'}.zmdi-flash-off:before{content:'\f165'}.zmdi-flash:before{content:'\f166'}.zmdi-flip:before{content:'\f167'}.zmdi-flower-alt:before{content:'\f168'}.zmdi-flower:before{content:'\f169'}.zmdi-font:before{content:'\f16a'}.zmdi-fullscreen-alt:before{content:'\f16b'}.zmdi-fullscreen-exit:before{content:'\f16c'}.zmdi-fullscreen:before{content:'\f16d'}.zmdi-functions:before{content:'\f16e'}.zmdi-gas-station:before{content:'\f16f'}.zmdi-gesture:before{content:'\f170'}.zmdi-globe-alt:before{content:'\f171'}.zmdi-globe-lock:before{content:'\f172'}.zmdi-globe:before{content:'\f173'}.zmdi-graduation-cap:before{content:'\f174'}.zmdi-home:before{content:'\f175'}.zmdi-hospital-alt:before{content:'\f176'}.zmdi-hospital:before{content:'\f177'}.zmdi-hotel:before{content:'\f178'}.zmdi-hourglass-alt:before{content:'\f179'}.zmdi-hourglass-outline:before{content:'\f17a'}.zmdi-hourglass:before{content:'\f17b'}.zmdi-http:before{content:'\f17c'}.zmdi-image-alt:before{content:'\f17d'}.zmdi-image-o:before{content:'\f17e'}.zmdi-image:before{content:'\f17f'}.zmdi-inbox:before{content:'\f180'}.zmdi-invert-colors-off:before{content:'\f181'}.zmdi-invert-colors:before{content:'\f182'}.zmdi-key:before{content:'\f183'}.zmdi-label-alt-outline:before{content:'\f184'}.zmdi-label-alt:before{content:'\f185'}.zmdi-label-heart:before{content:'\f186'}.zmdi-label:before{content:'\f187'}.zmdi-labels:before{content:'\f188'}.zmdi-lamp:before{content:'\f189'}.zmdi-landscape:before{content:'\f18a'}.zmdi-layers-off:before{content:'\f18b'}.zmdi-layers:before{content:'\f18c'}.zmdi-library:before{content:'\f18d'}.zmdi-link:before{content:'\f18e'}.zmdi-lock-open:before{content:'\f18f'}.zmdi-lock-outline:before{content:'\f190'}.zmdi-lock:before{content:'\f191'}.zmdi-mail-reply-all:before{content:'\f192'}.zmdi-mail-reply:before{content:'\f193'}.zmdi-mail-send:before{content:'\f194'}.zmdi-mall:before{content:'\f195'}.zmdi-map:before{content:'\f196'}.zmdi-menu:before{content:'\f197'}.zmdi-money-box:before{content:'\f198'}.zmdi-money-off:before{content:'\f199'}.zmdi-money:before{content:'\f19a'}.zmdi-more-vert:before{content:'\f19b'}.zmdi-more:before{content:'\f19c'}.zmdi-movie-alt:before{content:'\f19d'}.zmdi-movie:before{content:'\f19e'}.zmdi-nature-people:before{content:'\f19f'}.zmdi-nature:before{content:'\f1a0'}.zmdi-navigation:before{content:'\f1a1'}.zmdi-open-in-browser:before{content:'\f1a2'}.zmdi-open-in-new:before{content:'\f1a3'}.zmdi-palette:before{content:'\f1a4'}.zmdi-parking:before{content:'\f1a5'}.zmdi-pin-account:before{content:'\f1a6'}.zmdi-pin-assistant:before{content:'\f1a7'}.zmdi-pin-drop:before{content:'\f1a8'}.zmdi-pin-help:before{content:'\f1a9'}.zmdi-pin-off:before{content:'\f1aa'}.zmdi-pin:before{content:'\f1ab'}.zmdi-pizza:before{content:'\f1ac'}.zmdi-plaster:before{content:'\f1ad'}.zmdi-power-setting:before{content:'\f1ae'}.zmdi-power:before{content:'\f1af'}.zmdi-print:before{content:'\f1b0'}.zmdi-puzzle-piece:before{content:'\f1b1'}.zmdi-quote:before{content:'\f1b2'}.zmdi-railway:before{content:'\f1b3'}.zmdi-receipt:before{content:'\f1b4'}.zmdi-refresh-alt:before{content:'\f1b5'}.zmdi-refresh-sync-alert:before{content:'\f1b6'}.zmdi-refresh-sync-off:before{content:'\f1b7'}.zmdi-refresh-sync:before{content:'\f1b8'}.zmdi-refresh:before{content:'\f1b9'}.zmdi-roller:before{content:'\f1ba'}.zmdi-ruler:before{content:'\f1bb'}.zmdi-scissors:before{content:'\f1bc'}.zmdi-screen-rotation-lock:before{content:'\f1bd'}.zmdi-screen-rotation:before{content:'\f1be'}.zmdi-search-for:before{content:'\f1bf'}.zmdi-search-in-file:before{content:'\f1c0'}.zmdi-search-in-page:before{content:'\f1c1'}.zmdi-search-replace:before{content:'\f1c2'}.zmdi-search:before{content:'\f1c3'}.zmdi-seat:before{content:'\f1c4'}.zmdi-settings-square:before{content:'\f1c5'}.zmdi-settings:before{content:'\f1c6'}.zmdi-shield-check:before{content:'\f1c7'}.zmdi-shield-security:before{content:'\f1c8'}.zmdi-shopping-basket:before{content:'\f1c9'}.zmdi-shopping-cart-plus:before{content:'\f1ca'}.zmdi-shopping-cart:before{content:'\f1cb'}.zmdi-sign-in:before{content:'\f1cc'}.zmdi-sort-amount-asc:before{content:'\f1cd'}.zmdi-sort-amount-desc:before{content:'\f1ce'}.zmdi-sort-asc:before{content:'\f1cf'}.zmdi-sort-desc:before{content:'\f1d0'}.zmdi-spellcheck:before{content:'\f1d1'}.zmdi-storage:before{content:'\f1d2'}.zmdi-store-24:before{content:'\f1d3'}.zmdi-store:before{content:'\f1d4'}.zmdi-subway:before{content:'\f1d5'}.zmdi-sun:before{content:'\f1d6'}.zmdi-tab-unselected:before{content:'\f1d7'}.zmdi-tab:before{content:'\f1d8'}.zmdi-tag-close:before{content:'\f1d9'}.zmdi-tag-more:before{content:'\f1da'}.zmdi-tag:before{content:'\f1db'}.zmdi-thumb-down:before{content:'\f1dc'}.zmdi-thumb-up-down:before{content:'\f1dd'}.zmdi-thumb-up:before{content:'\f1de'}.zmdi-ticket-star:before{content:'\f1df'}.zmdi-toll:before{content:'\f1e0'}.zmdi-toys:before{content:'\f1e1'}.zmdi-traffic:before{content:'\f1e2'}.zmdi-translate:before{content:'\f1e3'}.zmdi-triangle-down:before{content:'\f1e4'}.zmdi-triangle-up:before{content:'\f1e5'}.zmdi-truck:before{content:'\f1e6'}.zmdi-turning-sign:before{content:'\f1e7'}.zmdi-wallpaper:before{content:'\f1e8'}.zmdi-washing-machine:before{content:'\f1e9'}.zmdi-window-maximize:before{content:'\f1ea'}.zmdi-window-minimize:before{content:'\f1eb'}.zmdi-window-restore:before{content:'\f1ec'}.zmdi-wrench:before{content:'\f1ed'}.zmdi-zoom-in:before{content:'\f1ee'}.zmdi-zoom-out:before{content:'\f1ef'}.zmdi-alert-circle-o:before{content:'\f1f0'}.zmdi-alert-circle:before{content:'\f1f1'}.zmdi-alert-octagon:before{content:'\f1f2'}.zmdi-alert-polygon:before{content:'\f1f3'}.zmdi-alert-triangle:before{content:'\f1f4'}.zmdi-help-outline:before{content:'\f1f5'}.zmdi-help:before{content:'\f1f6'}.zmdi-info-outline:before{content:'\f1f7'}.zmdi-info:before{content:'\f1f8'}.zmdi-notifications-active:before{content:'\f1f9'}.zmdi-notifications-add:before{content:'\f1fa'}.zmdi-notifications-none:before{content:'\f1fb'}.zmdi-notifications-off:before{content:'\f1fc'}.zmdi-notifications-paused:before{content:'\f1fd'}.zmdi-notifications:before{content:'\f1fe'}.zmdi-account-add:before{content:'\f1ff'}.zmdi-account-box-mail:before{content:'\f200'}.zmdi-account-box-o:before{content:'\f201'}.zmdi-account-box-phone:before{content:'\f202'}.zmdi-account-box:before{content:'\f203'}.zmdi-account-calendar:before{content:'\f204'}.zmdi-account-circle:before{content:'\f205'}.zmdi-account-o:before{content:'\f206'}.zmdi-account:before{content:'\f207'}.zmdi-accounts-add:before{content:'\f208'}.zmdi-accounts-alt:before{content:'\f209'}.zmdi-accounts-list-alt:before{content:'\f20a'}.zmdi-accounts-list:before{content:'\f20b'}.zmdi-accounts-outline:before{content:'\f20c'}.zmdi-accounts:before{content:'\f20d'}.zmdi-face:before{content:'\f20e'}.zmdi-female:before{content:'\f20f'}.zmdi-male-alt:before{content:'\f210'}.zmdi-male-female:before{content:'\f211'}.zmdi-male:before{content:'\f212'}.zmdi-mood-bad:before{content:'\f213'}.zmdi-mood:before{content:'\f214'}.zmdi-run:before{content:'\f215'}.zmdi-walk:before{content:'\f216'}.zmdi-cloud-box:before{content:'\f217'}.zmdi-cloud-circle:before{content:'\f218'}.zmdi-cloud-done:before{content:'\f219'}.zmdi-cloud-download:before{content:'\f21a'}.zmdi-cloud-off:before{content:'\f21b'}.zmdi-cloud-outline-alt:before{content:'\f21c'}.zmdi-cloud-outline:before{content:'\f21d'}.zmdi-cloud-upload:before{content:'\f21e'}.zmdi-cloud:before{content:'\f21f'}.zmdi-download:before{content:'\f220'}.zmdi-file-plus:before{content:'\f221'}.zmdi-file-text:before{content:'\f222'}.zmdi-file:before{content:'\f223'}.zmdi-folder-outline:before{content:'\f224'}.zmdi-folder-person:before{content:'\f225'}.zmdi-folder-star-alt:before{content:'\f226'}.zmdi-folder-star:before{content:'\f227'}.zmdi-folder:before{content:'\f228'}.zmdi-gif:before{content:'\f229'}.zmdi-upload:before{content:'\f22a'}.zmdi-border-all:before{content:'\f22b'}.zmdi-border-bottom:before{content:'\f22c'}.zmdi-border-clear:before{content:'\f22d'}.zmdi-border-color:before{content:'\f22e'}.zmdi-border-horizontal:before{content:'\f22f'}.zmdi-border-inner:before{content:'\f230'}.zmdi-border-left:before{content:'\f231'}.zmdi-border-outer:before{content:'\f232'}.zmdi-border-right:before{content:'\f233'}.zmdi-border-style:before{content:'\f234'}.zmdi-border-top:before{content:'\f235'}.zmdi-border-vertical:before{content:'\f236'}.zmdi-copy:before{content:'\f237'}.zmdi-crop:before{content:'\f238'}.zmdi-format-align-center:before{content:'\f239'}.zmdi-format-align-justify:before{content:'\f23a'}.zmdi-format-align-left:before{content:'\f23b'}.zmdi-format-align-right:before{content:'\f23c'}.zmdi-format-bold:before{content:'\f23d'}.zmdi-format-clear-all:before{content:'\f23e'}.zmdi-format-clear:before{content:'\f23f'}.zmdi-format-color-fill:before{content:'\f240'}.zmdi-format-color-reset:before{content:'\f241'}.zmdi-format-color-text:before{content:'\f242'}.zmdi-format-indent-decrease:before{content:'\f243'}.zmdi-format-indent-increase:before{content:'\f244'}.zmdi-format-italic:before{content:'\f245'}.zmdi-format-line-spacing:before{content:'\f246'}.zmdi-format-list-bulleted:before{content:'\f247'}.zmdi-format-list-numbered:before{content:'\f248'}.zmdi-format-ltr:before{content:'\f249'}.zmdi-format-rtl:before{content:'\f24a'}.zmdi-format-size:before{content:'\f24b'}.zmdi-format-strikethrough-s:before{content:'\f24c'}.zmdi-format-strikethrough:before{content:'\f24d'}.zmdi-format-subject:before{content:'\f24e'}.zmdi-format-underlined:before{content:'\f24f'}.zmdi-format-valign-bottom:before{content:'\f250'}.zmdi-format-valign-center:before{content:'\f251'}.zmdi-format-valign-top:before{content:'\f252'}.zmdi-redo:before{content:'\f253'}.zmdi-select-all:before{content:'\f254'}.zmdi-space-bar:before{content:'\f255'}.zmdi-text-format:before{content:'\f256'}.zmdi-transform:before{content:'\f257'}.zmdi-undo:before{content:'\f258'}.zmdi-wrap-text:before{content:'\f259'}.zmdi-comment-alert:before{content:'\f25a'}.zmdi-comment-alt-text:before{content:'\f25b'}.zmdi-comment-alt:before{content:'\f25c'}.zmdi-comment-edit:before{content:'\f25d'}.zmdi-comment-image:before{content:'\f25e'}.zmdi-comment-list:before{content:'\f25f'}.zmdi-comment-more:before{content:'\f260'}.zmdi-comment-outline:before{content:'\f261'}.zmdi-comment-text-alt:before{content:'\f262'}.zmdi-comment-text:before{content:'\f263'}.zmdi-comment-video:before{content:'\f264'}.zmdi-comment:before{content:'\f265'}.zmdi-comments:before{content:'\f266'}.zmdi-check-all:before{content:'\f267'}.zmdi-check-circle-u:before{content:'\f268'}.zmdi-check-circle:before{content:'\f269'}.zmdi-check-square:before{content:'\f26a'}.zmdi-check:before{content:'\f26b'}.zmdi-circle-o:before{content:'\f26c'}.zmdi-circle:before{content:'\f26d'}.zmdi-dot-circle-alt:before{content:'\f26e'}.zmdi-dot-circle:before{content:'\f26f'}.zmdi-minus-circle-outline:before{content:'\f270'}.zmdi-minus-circle:before{content:'\f271'}.zmdi-minus-square:before{content:'\f272'}.zmdi-minus:before{content:'\f273'}.zmdi-plus-circle-o-duplicate:before{content:'\f274'}.zmdi-plus-circle-o:before{content:'\f275'}.zmdi-plus-circle:before{content:'\f276'}.zmdi-plus-square:before{content:'\f277'}.zmdi-plus:before{content:'\f278'}.zmdi-square-o:before{content:'\f279'}.zmdi-star-circle:before{content:'\f27a'}.zmdi-star-half:before{content:'\f27b'}.zmdi-star-outline:before{content:'\f27c'}.zmdi-star:before{content:'\f27d'}.zmdi-bluetooth-connected:before{content:'\f27e'}.zmdi-bluetooth-off:before{content:'\f27f'}.zmdi-bluetooth-search:before{content:'\f280'}.zmdi-bluetooth-setting:before{content:'\f281'}.zmdi-bluetooth:before{content:'\f282'}.zmdi-camera-add:before{content:'\f283'}.zmdi-camera-alt:before{content:'\f284'}.zmdi-camera-bw:before{content:'\f285'}.zmdi-camera-front:before{content:'\f286'}.zmdi-camera-mic:before{content:'\f287'}.zmdi-camera-party-mode:before{content:'\f288'}.zmdi-camera-rear:before{content:'\f289'}.zmdi-camera-roll:before{content:'\f28a'}.zmdi-camera-switch:before{content:'\f28b'}.zmdi-camera:before{content:'\f28c'}.zmdi-card-alert:before{content:'\f28d'}.zmdi-card-off:before{content:'\f28e'}.zmdi-card-sd:before{content:'\f28f'}.zmdi-card-sim:before{content:'\f290'}.zmdi-desktop-mac:before{content:'\f291'}.zmdi-desktop-windows:before{content:'\f292'}.zmdi-device-hub:before{content:'\f293'}.zmdi-devices-off:before{content:'\f294'}.zmdi-devices:before{content:'\f295'}.zmdi-dock:before{content:'\f296'}.zmdi-floppy:before{content:'\f297'}.zmdi-gamepad:before{content:'\f298'}.zmdi-gps-dot:before{content:'\f299'}.zmdi-gps-off:before{content:'\f29a'}.zmdi-gps:before{content:'\f29b'}.zmdi-headset-mic:before{content:'\f29c'}.zmdi-headset:before{content:'\f29d'}.zmdi-input-antenna:before{content:'\f29e'}.zmdi-input-composite:before{content:'\f29f'}.zmdi-input-hdmi:before{content:'\f2a0'}.zmdi-input-power:before{content:'\f2a1'}.zmdi-input-svideo:before{content:'\f2a2'}.zmdi-keyboard-hide:before{content:'\f2a3'}.zmdi-keyboard:before{content:'\f2a4'}.zmdi-laptop-chromebook:before{content:'\f2a5'}.zmdi-laptop-mac:before{content:'\f2a6'}.zmdi-laptop:before{content:'\f2a7'}.zmdi-mic-off:before{content:'\f2a8'}.zmdi-mic-outline:before{content:'\f2a9'}.zmdi-mic-setting:before{content:'\f2aa'}.zmdi-mic:before{content:'\f2ab'}.zmdi-mouse:before{content:'\f2ac'}.zmdi-network-alert:before{content:'\f2ad'}.zmdi-network-locked:before{content:'\f2ae'}.zmdi-network-off:before{content:'\f2af'}.zmdi-network-outline:before{content:'\f2b0'}.zmdi-network-setting:before{content:'\f2b1'}.zmdi-network:before{content:'\f2b2'}.zmdi-phone-bluetooth:before{content:'\f2b3'}.zmdi-phone-end:before{content:'\f2b4'}.zmdi-phone-forwarded:before{content:'\f2b5'}.zmdi-phone-in-talk:before{content:'\f2b6'}.zmdi-phone-locked:before{content:'\f2b7'}.zmdi-phone-missed:before{content:'\f2b8'}.zmdi-phone-msg:before{content:'\f2b9'}.zmdi-phone-paused:before{content:'\f2ba'}.zmdi-phone-ring:before{content:'\f2bb'}.zmdi-phone-setting:before{content:'\f2bc'}.zmdi-phone-sip:before{content:'\f2bd'}.zmdi-phone:before{content:'\f2be'}.zmdi-portable-wifi-changes:before{content:'\f2bf'}.zmdi-portable-wifi-off:before{content:'\f2c0'}.zmdi-portable-wifi:before{content:'\f2c1'}.zmdi-radio:before{content:'\f2c2'}.zmdi-reader:before{content:'\f2c3'}.zmdi-remote-control-alt:before{content:'\f2c4'}.zmdi-remote-control:before{content:'\f2c5'}.zmdi-router:before{content:'\f2c6'}.zmdi-scanner:before{content:'\f2c7'}.zmdi-smartphone-android:before{content:'\f2c8'}.zmdi-smartphone-download:before{content:'\f2c9'}.zmdi-smartphone-erase:before{content:'\f2ca'}.zmdi-smartphone-info:before{content:'\f2cb'}.zmdi-smartphone-iphone:before{content:'\f2cc'}.zmdi-smartphone-landscape-lock:before{content:'\f2cd'}.zmdi-smartphone-landscape:before{content:'\f2ce'}.zmdi-smartphone-lock:before{content:'\f2cf'}.zmdi-smartphone-portrait-lock:before{content:'\f2d0'}.zmdi-smartphone-ring:before{content:'\f2d1'}.zmdi-smartphone-setting:before{content:'\f2d2'}.zmdi-smartphone-setup:before{content:'\f2d3'}.zmdi-smartphone:before{content:'\f2d4'}.zmdi-speaker:before{content:'\f2d5'}.zmdi-tablet-android:before{content:'\f2d6'}.zmdi-tablet-mac:before{content:'\f2d7'}.zmdi-tablet:before{content:'\f2d8'}.zmdi-tv-alt-play:before{content:'\f2d9'}.zmdi-tv-list:before{content:'\f2da'}.zmdi-tv-play:before{content:'\f2db'}.zmdi-tv:before{content:'\f2dc'}.zmdi-usb:before{content:'\f2dd'}.zmdi-videocam-off:before{content:'\f2de'}.zmdi-videocam-switch:before{content:'\f2df'}.zmdi-videocam:before{content:'\f2e0'}.zmdi-watch:before{content:'\f2e1'}.zmdi-wifi-alt-2:before{content:'\f2e2'}.zmdi-wifi-alt:before{content:'\f2e3'}.zmdi-wifi-info:before{content:'\f2e4'}.zmdi-wifi-lock:before{content:'\f2e5'}.zmdi-wifi-off:before{content:'\f2e6'}.zmdi-wifi-outline:before{content:'\f2e7'}.zmdi-wifi:before{content:'\f2e8'}.zmdi-arrow-left-bottom:before{content:'\f2e9'}.zmdi-arrow-left:before{content:'\f2ea'}.zmdi-arrow-merge:before{content:'\f2eb'}.zmdi-arrow-missed:before{content:'\f2ec'}.zmdi-arrow-right-top:before{content:'\f2ed'}.zmdi-arrow-right:before{content:'\f2ee'}.zmdi-arrow-split:before{content:'\f2ef'}.zmdi-arrows:before{content:'\f2f0'}.zmdi-caret-down-circle:before{content:'\f2f1'}.zmdi-caret-down:before{content:'\f2f2'}.zmdi-caret-left-circle:before{content:'\f2f3'}.zmdi-caret-left:before{content:'\f2f4'}.zmdi-caret-right-circle:before{content:'\f2f5'}.zmdi-caret-right:before{content:'\f2f6'}.zmdi-caret-up-circle:before{content:'\f2f7'}.zmdi-caret-up:before{content:'\f2f8'}.zmdi-chevron-down:before{content:'\f2f9'}.zmdi-chevron-left:before{content:'\f2fa'}.zmdi-chevron-right:before{content:'\f2fb'}.zmdi-chevron-up:before{content:'\f2fc'}.zmdi-forward:before{content:'\f2fd'}.zmdi-long-arrow-down:before{content:'\f2fe'}.zmdi-long-arrow-left:before{content:'\f2ff'}.zmdi-long-arrow-return:before{content:'\f300'}.zmdi-long-arrow-right:before{content:'\f301'}.zmdi-long-arrow-tab:before{content:'\f302'}.zmdi-long-arrow-up:before{content:'\f303'}.zmdi-rotate-ccw:before{content:'\f304'}.zmdi-rotate-cw:before{content:'\f305'}.zmdi-rotate-left:before{content:'\f306'}.zmdi-rotate-right:before{content:'\f307'}.zmdi-square-down:before{content:'\f308'}.zmdi-square-right:before{content:'\f309'}.zmdi-swap-alt:before{content:'\f30a'}.zmdi-swap-vertical-circle:before{content:'\f30b'}.zmdi-swap-vertical:before{content:'\f30c'}.zmdi-swap:before{content:'\f30d'}.zmdi-trending-down:before{content:'\f30e'}.zmdi-trending-flat:before{content:'\f30f'}.zmdi-trending-up:before{content:'\f310'}.zmdi-unfold-less:before{content:'\f311'}.zmdi-unfold-more:before{content:'\f312'}.zmdi-apps:before{content:'\f313'}.zmdi-grid-off:before{content:'\f314'}.zmdi-grid:before{content:'\f315'}.zmdi-view-agenda:before{content:'\f316'}.zmdi-view-array:before{content:'\f317'}.zmdi-view-carousel:before{content:'\f318'}.zmdi-view-column:before{content:'\f319'}.zmdi-view-comfy:before{content:'\f31a'}.zmdi-view-compact:before{content:'\f31b'}.zmdi-view-dashboard:before{content:'\f31c'}.zmdi-view-day:before{content:'\f31d'}.zmdi-view-headline:before{content:'\f31e'}.zmdi-view-list-alt:before{content:'\f31f'}.zmdi-view-list:before{content:'\f320'}.zmdi-view-module:before{content:'\f321'}.zmdi-view-quilt:before{content:'\f322'}.zmdi-view-stream:before{content:'\f323'}.zmdi-view-subtitles:before{content:'\f324'}.zmdi-view-toc:before{content:'\f325'}.zmdi-view-web:before{content:'\f326'}.zmdi-view-week:before{content:'\f327'}.zmdi-widgets:before{content:'\f328'}.zmdi-alarm-check:before{content:'\f329'}.zmdi-alarm-off:before{content:'\f32a'}.zmdi-alarm-plus:before{content:'\f32b'}.zmdi-alarm-snooze:before{content:'\f32c'}.zmdi-alarm:before{content:'\f32d'}.zmdi-calendar-alt:before{content:'\f32e'}.zmdi-calendar-check:before{content:'\f32f'}.zmdi-calendar-close:before{content:'\f330'}.zmdi-calendar-note:before{content:'\f331'}.zmdi-calendar:before{content:'\f332'}.zmdi-time-countdown:before{content:'\f333'}.zmdi-time-interval:before{content:'\f334'}.zmdi-time-restore-setting:before{content:'\f335'}.zmdi-time-restore:before{content:'\f336'}.zmdi-time:before{content:'\f337'}.zmdi-timer-off:before{content:'\f338'}.zmdi-timer:before{content:'\f339'}.zmdi-android-alt:before{content:'\f33a'}.zmdi-android:before{content:'\f33b'}.zmdi-apple:before{content:'\f33c'}.zmdi-behance:before{content:'\f33d'}.zmdi-codepen:before{content:'\f33e'}.zmdi-dribbble:before{content:'\f33f'}.zmdi-dropbox:before{content:'\f340'}.zmdi-evernote:before{content:'\f341'}.zmdi-facebook-box:before{content:'\f342'}.zmdi-facebook:before{content:'\f343'}.zmdi-github-box:before{content:'\f344'}.zmdi-github:before{content:'\f345'}.zmdi-google-drive:before{content:'\f346'}.zmdi-google-earth:before{content:'\f347'}.zmdi-google-glass:before{content:'\f348'}.zmdi-google-maps:before{content:'\f349'}.zmdi-google-pages:before{content:'\f34a'}.zmdi-google-play:before{content:'\f34b'}.zmdi-google-plus-box:before{content:'\f34c'}.zmdi-google-plus:before{content:'\f34d'}.zmdi-google:before{content:'\f34e'}.zmdi-instagram:before{content:'\f34f'}.zmdi-language-css3:before{content:'\f350'}.zmdi-language-html5:before{content:'\f351'}.zmdi-language-javascript:before{content:'\f352'}.zmdi-language-python-alt:before{content:'\f353'}.zmdi-language-python:before{content:'\f354'}.zmdi-lastfm:before{content:'\f355'}.zmdi-linkedin-box:before{content:'\f356'}.zmdi-paypal:before{content:'\f357'}.zmdi-pinterest-box:before{content:'\f358'}.zmdi-pocket:before{content:'\f359'}.zmdi-polymer:before{content:'\f35a'}.zmdi-share:before{content:'\f35b'}.zmdi-stackoverflow:before{content:'\f35c'}.zmdi-steam-square:before{content:'\f35d'}.zmdi-steam:before{content:'\f35e'}.zmdi-twitter-box:before{content:'\f35f'}.zmdi-twitter:before{content:'\f360'}.zmdi-vk:before{content:'\f361'}.zmdi-wikipedia:before{content:'\f362'}.zmdi-windows:before{content:'\f363'}.zmdi-aspect-ratio-alt:before{content:'\f364'}.zmdi-aspect-ratio:before{content:'\f365'}.zmdi-blur-circular:before{content:'\f366'}.zmdi-blur-linear:before{content:'\f367'}.zmdi-blur-off:before{content:'\f368'}.zmdi-blur:before{content:'\f369'}.zmdi-brightness-2:before{content:'\f36a'}.zmdi-brightness-3:before{content:'\f36b'}.zmdi-brightness-4:before{content:'\f36c'}.zmdi-brightness-5:before{content:'\f36d'}.zmdi-brightness-6:before{content:'\f36e'}.zmdi-brightness-7:before{content:'\f36f'}.zmdi-brightness-auto:before{content:'\f370'}.zmdi-brightness-setting:before{content:'\f371'}.zmdi-broken-image:before{content:'\f372'}.zmdi-center-focus-strong:before{content:'\f373'}.zmdi-center-focus-weak:before{content:'\f374'}.zmdi-compare:before{content:'\f375'}.zmdi-crop-16-9:before{content:'\f376'}.zmdi-crop-3-2:before{content:'\f377'}.zmdi-crop-5-4:before{content:'\f378'}.zmdi-crop-7-5:before{content:'\f379'}.zmdi-crop-din:before{content:'\f37a'}.zmdi-crop-free:before{content:'\f37b'}.zmdi-crop-landscape:before{content:'\f37c'}.zmdi-crop-portrait:before{content:'\f37d'}.zmdi-crop-square:before{content:'\f37e'}.zmdi-exposure-alt:before{content:'\f37f'}.zmdi-exposure:before{content:'\f380'}.zmdi-filter-b-and-w:before{content:'\f381'}.zmdi-filter-center-focus:before{content:'\f382'}.zmdi-filter-frames:before{content:'\f383'}.zmdi-filter-tilt-shift:before{content:'\f384'}.zmdi-gradient:before{content:'\f385'}.zmdi-grain:before{content:'\f386'}.zmdi-graphic-eq:before{content:'\f387'}.zmdi-hdr-off:before{content:'\f388'}.zmdi-hdr-strong:before{content:'\f389'}.zmdi-hdr-weak:before{content:'\f38a'}.zmdi-hdr:before{content:'\f38b'}.zmdi-iridescent:before{content:'\f38c'}.zmdi-leak-off:before{content:'\f38d'}.zmdi-leak:before{content:'\f38e'}.zmdi-looks:before{content:'\f38f'}.zmdi-loupe:before{content:'\f390'}.zmdi-panorama-horizontal:before{content:'\f391'}.zmdi-panorama-vertical:before{content:'\f392'}.zmdi-panorama-wide-angle:before{content:'\f393'}.zmdi-photo-size-select-large:before{content:'\f394'}.zmdi-photo-size-select-small:before{content:'\f395'}.zmdi-picture-in-picture:before{content:'\f396'}.zmdi-slideshow:before{content:'\f397'}.zmdi-texture:before{content:'\f398'}.zmdi-tonality:before{content:'\f399'}.zmdi-vignette:before{content:'\f39a'}.zmdi-wb-auto:before{content:'\f39b'}.zmdi-eject-alt:before{content:'\f39c'}.zmdi-eject:before{content:'\f39d'}.zmdi-equalizer:before{content:'\f39e'}.zmdi-fast-forward:before{content:'\f39f'}.zmdi-fast-rewind:before{content:'\f3a0'}.zmdi-forward-10:before{content:'\f3a1'}.zmdi-forward-30:before{content:'\f3a2'}.zmdi-forward-5:before{content:'\f3a3'}.zmdi-hearing:before{content:'\f3a4'}.zmdi-pause-circle-outline:before{content:'\f3a5'}.zmdi-pause-circle:before{content:'\f3a6'}.zmdi-pause:before{content:'\f3a7'}.zmdi-play-circle-outline:before{content:'\f3a8'}.zmdi-play-circle:before{content:'\f3a9'}.zmdi-play:before{content:'\f3aa'}.zmdi-playlist-audio:before{content:'\f3ab'}.zmdi-playlist-plus:before{content:'\f3ac'}.zmdi-repeat-one:before{content:'\f3ad'}.zmdi-repeat:before{content:'\f3ae'}.zmdi-replay-10:before{content:'\f3af'}.zmdi-replay-30:before{content:'\f3b0'}.zmdi-replay-5:before{content:'\f3b1'}.zmdi-replay:before{content:'\f3b2'}.zmdi-shuffle:before{content:'\f3b3'}.zmdi-skip-next:before{content:'\f3b4'}.zmdi-skip-previous:before{content:'\f3b5'}.zmdi-stop:before{content:'\f3b6'}.zmdi-surround-sound:before{content:'\f3b7'}.zmdi-tune:before{content:'\f3b8'}.zmdi-volume-down:before{content:'\f3b9'}.zmdi-volume-mute:before{content:'\f3ba'}.zmdi-volume-off:before{content:'\f3bb'}.zmdi-volume-up:before{content:'\f3bc'}.zmdi-n-1-square:before{content:'\f3bd'}.zmdi-n-2-square:before{content:'\f3be'}.zmdi-n-3-square:before{content:'\f3bf'}.zmdi-n-4-square:before{content:'\f3c0'}.zmdi-n-5-square:before{content:'\f3c1'}.zmdi-n-6-square:before{content:'\f3c2'}.zmdi-neg-1:before{content:'\f3c3'}.zmdi-neg-2:before{content:'\f3c4'}.zmdi-plus-1:before{content:'\f3c5'}.zmdi-plus-2:before{content:'\f3c6'}.zmdi-sec-10:before{content:'\f3c7'}.zmdi-sec-3:before{content:'\f3c8'}.zmdi-zero:before{content:'\f3c9'}.zmdi-airline-seat-flat-angled:before{content:'\f3ca'}.zmdi-airline-seat-flat:before{content:'\f3cb'}.zmdi-airline-seat-individual-suite:before{content:'\f3cc'}.zmdi-airline-seat-legroom-extra:before{content:'\f3cd'}.zmdi-airline-seat-legroom-normal:before{content:'\f3ce'}.zmdi-airline-seat-legroom-reduced:before{content:'\f3cf'}.zmdi-airline-seat-recline-extra:before{content:'\f3d0'}.zmdi-airline-seat-recline-normal:before{content:'\f3d1'}.zmdi-airplay:before{content:'\f3d2'}.zmdi-closed-caption:before{content:'\f3d3'}.zmdi-confirmation-number:before{content:'\f3d4'}.zmdi-developer-board:before{content:'\f3d5'}.zmdi-disc-full:before{content:'\f3d6'}.zmdi-explicit:before{content:'\f3d7'}.zmdi-flight-land:before{content:'\f3d8'}.zmdi-flight-takeoff:before{content:'\f3d9'}.zmdi-flip-to-back:before{content:'\f3da'}.zmdi-flip-to-front:before{content:'\f3db'}.zmdi-group-work:before{content:'\f3dc'}.zmdi-hd:before{content:'\f3dd'}.zmdi-hq:before{content:'\f3de'}.zmdi-markunread-mailbox:before{content:'\f3df'}.zmdi-memory:before{content:'\f3e0'}.zmdi-nfc:before{content:'\f3e1'}.zmdi-play-for-work:before{content:'\f3e2'}.zmdi-power-input:before{content:'\f3e3'}.zmdi-present-to-all:before{content:'\f3e4'}.zmdi-satellite:before{content:'\f3e5'}.zmdi-tap-and-play:before{content:'\f3e6'}.zmdi-vibration:before{content:'\f3e7'}.zmdi-voicemail:before{content:'\f3e8'}.zmdi-group:before{content:'\f3e9'}.zmdi-rss:before{content:'\f3ea'}.zmdi-shape:before{content:'\f3eb'}.zmdi-spinner:before{content:'\f3ec'}.zmdi-ungroup:before{content:'\f3ed'}.zmdi-500px:before{content:'\f3ee'}.zmdi-8tracks:before{content:'\f3ef'}.zmdi-amazon:before{content:'\f3f0'}.zmdi-blogger:before{content:'\f3f1'}.zmdi-delicious:before{content:'\f3f2'}.zmdi-disqus:before{content:'\f3f3'}.zmdi-flattr:before{content:'\f3f4'}.zmdi-flickr:before{content:'\f3f5'}.zmdi-github-alt:before{content:'\f3f6'}.zmdi-google-old:before{content:'\f3f7'}.zmdi-linkedin:before{content:'\f3f8'}.zmdi-odnoklassniki:before{content:'\f3f9'}.zmdi-outlook:before{content:'\f3fa'}.zmdi-paypal-alt:before{content:'\f3fb'}.zmdi-pinterest:before{content:'\f3fc'}.zmdi-playstation:before{content:'\f3fd'}.zmdi-reddit:before{content:'\f3fe'}.zmdi-skype:before{content:'\f3ff'}.zmdi-slideshare:before{content:'\f400'}.zmdi-soundcloud:before{content:'\f401'}.zmdi-tumblr:before{content:'\f402'}.zmdi-twitch:before{content:'\f403'}.zmdi-vimeo:before{content:'\f404'}.zmdi-whatsapp:before{content:'\f405'}.zmdi-xbox:before{content:'\f406'}.zmdi-yahoo:before{content:'\f407'}.zmdi-youtube-play:before{content:'\f408'}.zmdi-youtube:before{content:'\f409'}.zmdi-import-export:before{content:'\f30c'}.zmdi-swap-vertical-:before{content:'\f30c'}.zmdi-airplanemode-inactive:before{content:'\f102'}.zmdi-airplanemode-active:before{content:'\f103'}.zmdi-rate-review:before{content:'\f103'}.zmdi-comment-sign:before{content:'\f25a'}.zmdi-network-warning:before{content:'\f2ad'}.zmdi-shopping-cart-add:before{content:'\f1ca'}.zmdi-file-add:before{content:'\f221'}.zmdi-network-wifi-scan:before{content:'\f2e4'}.zmdi-collection-add:before{content:'\f14e'}.zmdi-format-playlist-add:before{content:'\f3ac'}.zmdi-format-queue-music:before{content:'\f3ab'}.zmdi-plus-box:before{content:'\f277'}.zmdi-tag-backspace:before{content:'\f1d9'}.zmdi-alarm-add:before{content:'\f32b'}.zmdi-battery-charging:before{content:'\f114'}.zmdi-daydream-setting:before{content:'\f217'}.zmdi-more-horiz:before{content:'\f19c'}.zmdi-book-photo:before{content:'\f11b'}.zmdi-incandescent:before{content:'\f189'}.zmdi-wb-iridescent:before{content:'\f38c'}.zmdi-calendar-remove:before{content:'\f330'}.zmdi-refresh-sync-disabled:before{content:'\f1b7'}.zmdi-refresh-sync-problem:before{content:'\f1b6'}.zmdi-crop-original:before{content:'\f17e'}.zmdi-power-off:before{content:'\f1af'}.zmdi-power-off-setting:before{content:'\f1ae'}.zmdi-leak-remove:before{content:'\f38d'}.zmdi-star-border:before{content:'\f27c'}.zmdi-brightness-low:before{content:'\f36d'}.zmdi-brightness-medium:before{content:'\f36e'}.zmdi-brightness-high:before{content:'\f36f'}.zmdi-smartphone-portrait:before{content:'\f2d4'}.zmdi-live-tv:before{content:'\f2d9'}.zmdi-format-textdirection-l-to-r:before{content:'\f249'}.zmdi-format-textdirection-r-to-l:before{content:'\f24a'}.zmdi-arrow-back:before{content:'\f2ea'}.zmdi-arrow-forward:before{content:'\f2ee'}.zmdi-arrow-in:before{content:'\f2e9'}.zmdi-arrow-out:before{content:'\f2ed'}.zmdi-rotate-90-degrees-ccw:before{content:'\f304'}.zmdi-adb:before{content:'\f33a'}.zmdi-network-wifi:before{content:'\f2e8'}.zmdi-network-wifi-alt:before{content:'\f2e3'}.zmdi-network-wifi-lock:before{content:'\f2e5'}.zmdi-network-wifi-off:before{content:'\f2e6'}.zmdi-network-wifi-outline:before{content:'\f2e7'}.zmdi-network-wifi-info:before{content:'\f2e4'}.zmdi-layers-clear:before{content:'\f18b'}.zmdi-colorize:before{content:'\f15d'}.zmdi-format-paint:before{content:'\f1ba'}.zmdi-format-quote:before{content:'\f1b2'}.zmdi-camera-monochrome-photos:before{content:'\f285'}.zmdi-sort-by-alpha:before{content:'\f1cf'}.zmdi-folder-shared:before{content:'\f225'}.zmdi-folder-special:before{content:'\f226'}.zmdi-comment-dots:before{content:'\f260'}.zmdi-reorder:before{content:'\f31e'}.zmdi-dehaze:before{content:'\f197'}.zmdi-sort:before{content:'\f1ce'}.zmdi-pages:before{content:'\f34a'}.zmdi-stack-overflow:before{content:'\f35c'}.zmdi-calendar-account:before{content:'\f204'}.zmdi-paste:before{content:'\f109'}.zmdi-cut:before{content:'\f1bc'}.zmdi-save:before{content:'\f297'}.zmdi-smartphone-code:before{content:'\f139'}.zmdi-directions-bike:before{content:'\f117'}.zmdi-directions-boat:before{content:'\f11a'}.zmdi-directions-bus:before{content:'\f121'}.zmdi-directions-car:before{content:'\f125'}.zmdi-directions-railway:before{content:'\f1b3'}.zmdi-directions-run:before{content:'\f215'}.zmdi-directions-subway:before{content:'\f1d5'}.zmdi-directions-walk:before{content:'\f216'}.zmdi-local-hotel:before{content:'\f178'}.zmdi-local-activity:before{content:'\f1df'}.zmdi-local-play:before{content:'\f1df'}.zmdi-local-airport:before{content:'\f103'}.zmdi-local-atm:before{content:'\f198'}.zmdi-local-bar:before{content:'\f137'}.zmdi-local-cafe:before{content:'\f13b'}.zmdi-local-car-wash:before{content:'\f124'}.zmdi-local-convenience-store:before{content:'\f1d3'}.zmdi-local-dining:before{content:'\f153'}.zmdi-local-drink:before{content:'\f157'}.zmdi-local-florist:before{content:'\f168'}.zmdi-local-gas-station:before{content:'\f16f'}.zmdi-local-grocery-store:before{content:'\f1cb'}.zmdi-local-hospital:before{content:'\f177'}.zmdi-local-laundry-service:before{content:'\f1e9'}.zmdi-local-library:before{content:'\f18d'}.zmdi-local-mall:before{content:'\f195'}.zmdi-local-movies:before{content:'\f19d'}.zmdi-local-offer:before{content:'\f187'}.zmdi-local-parking:before{content:'\f1a5'}.zmdi-local-parking:before{content:'\f1a5'}.zmdi-local-pharmacy:before{content:'\f176'}.zmdi-local-phone:before{content:'\f2be'}.zmdi-local-pizza:before{content:'\f1ac'}.zmdi-local-post-office:before{content:'\f15a'}.zmdi-local-printshop:before{content:'\f1b0'}.zmdi-local-see:before{content:'\f28c'}.zmdi-local-shipping:before{content:'\f1e6'}.zmdi-local-store:before{content:'\f1d4'}.zmdi-local-taxi:before{content:'\f123'}.zmdi-local-wc:before{content:'\f211'}.zmdi-my-location:before{content:'\f299'}.zmdi-directions:before{content:'\f1e7'} \ No newline at end of file diff --git a/packages/react-docs-example/public/css/roboto.css b/packages/react-docs-example/public/css/roboto.css deleted file mode 100644 index 4c4a126b0..000000000 --- a/packages/react-docs-example/public/css/roboto.css +++ /dev/null @@ -1,89 +0,0 @@ -/* -NOTE: This file includes several font faces that are commented out. They are -not currently used by this app but could be at a future point. For this reason, -we leave them commented out rather then removing them completely. -*/ - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Thin.ttf') format('truetype'); - font-weight: 100; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-ThinItalic.ttf') format('truetype'); - font-weight: 100; - font-style: italic; -}*/ - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Light.ttf') format('truetype'); - font-weight: 300; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-LightItalic.ttf') format('truetype'); - font-weight: 300; - font-style: italic; -}*/ - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Regular.ttf') format('truetype'); - font-weight: 400; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-RegularItalic.ttf') format('truetype'); - font-weight: 400; - font-style: italic; -}*/ - -/*@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Medium.ttf') format('truetype'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-MediumItalic.ttf') format('truetype'); - font-weight: 500; - font-style: italic; -} - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Bold.ttf') format('truetype'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype'); - font-weight: 700; - font-style: italic; -} - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Black.ttf') format('truetype'); - font-weight: 900; - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-BlackItalic.ttf') format('truetype'); - font-weight: 900; - font-style: italic; -}*/ diff --git a/packages/react-docs-example/public/css/roboto_mono.css b/packages/react-docs-example/public/css/roboto_mono.css deleted file mode 100644 index 392ea5224..000000000 --- a/packages/react-docs-example/public/css/roboto_mono.css +++ /dev/null @@ -1,69 +0,0 @@ -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-Thin.ttf') format('truetype'); - font-weight: 100; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-ThinItalic.ttf') format('truetype'); - font-weight: 100; - font-style: italic; -}*/ - -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-Light.ttf') format('truetype'); - font-weight: 300; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-LightItalic.ttf') format('truetype'); - font-weight: 300; - font-style: italic; -}*/ - -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-Regular.ttf') format('truetype'); - font-weight: 400; - font-style: normal; -} - -/*@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-RegularItalic.ttf') format('truetype'); - font-weight: 400; - font-style: italic; -}*/ - -/*@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-Medium.ttf') format('truetype'); - font-weight: 500; - font-style: normal; -} - -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-MediumItalic.ttf') format('truetype'); - font-weight: 500; - font-style: italic; -} - -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-Bold.ttf') format('truetype'); - font-weight: 700; - font-style: normal; -} - -@font-face { - font-family: 'Roboto Mono'; - src: url('../fonts/RobotoMono-BoldItalic.ttf') format('truetype'); - font-weight: 700; - font-style: italic; -}*/ diff --git a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.eot b/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.eot deleted file mode 100755 index 5e2519150..000000000 Binary files a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.eot and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.svg b/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.svg deleted file mode 100755 index 1d3d2eaa2..000000000 --- a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.svg +++ /dev/null @@ -1,787 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.ttf b/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.ttf deleted file mode 100755 index 5d489fdd1..000000000 Binary files a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff b/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff deleted file mode 100755 index 933b2bf85..000000000 Binary files a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff2 b/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff2 deleted file mode 100755 index 35970e277..000000000 Binary files a/packages/react-docs-example/public/fonts/Material-Design-Iconic-Font.woff2 and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Black.ttf b/packages/react-docs-example/public/fonts/Roboto-Black.ttf deleted file mode 100755 index 689fe5cb3..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Black.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-BlackItalic.ttf b/packages/react-docs-example/public/fonts/Roboto-BlackItalic.ttf deleted file mode 100755 index 0b4e0ee10..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-BlackItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Bold.ttf b/packages/react-docs-example/public/fonts/Roboto-Bold.ttf deleted file mode 100755 index d3f01ad24..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Bold.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-BoldItalic.ttf b/packages/react-docs-example/public/fonts/Roboto-BoldItalic.ttf deleted file mode 100755 index 41cc1e753..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-BoldItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Italic.ttf b/packages/react-docs-example/public/fonts/Roboto-Italic.ttf deleted file mode 100755 index 6a1cee5b2..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Italic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Light.ttf b/packages/react-docs-example/public/fonts/Roboto-Light.ttf deleted file mode 100755 index 219063a57..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Light.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-LightItalic.ttf b/packages/react-docs-example/public/fonts/Roboto-LightItalic.ttf deleted file mode 100755 index 0e81e876f..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-LightItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Medium.ttf b/packages/react-docs-example/public/fonts/Roboto-Medium.ttf deleted file mode 100755 index 1a7f3b0bb..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Medium.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-MediumItalic.ttf b/packages/react-docs-example/public/fonts/Roboto-MediumItalic.ttf deleted file mode 100755 index 003029527..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-MediumItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Regular.ttf b/packages/react-docs-example/public/fonts/Roboto-Regular.ttf deleted file mode 100755 index 2c97eeadf..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Regular.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-Thin.ttf b/packages/react-docs-example/public/fonts/Roboto-Thin.ttf deleted file mode 100755 index b74a4fd1a..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-Thin.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/Roboto-ThinItalic.ttf b/packages/react-docs-example/public/fonts/Roboto-ThinItalic.ttf deleted file mode 100755 index dd0ddb852..000000000 Binary files a/packages/react-docs-example/public/fonts/Roboto-ThinItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Bold.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Bold.ttf deleted file mode 100755 index 07ef607d5..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Bold.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-BoldItalic.ttf b/packages/react-docs-example/public/fonts/RobotoMono-BoldItalic.ttf deleted file mode 100755 index 1cca0bf45..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-BoldItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Italic.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Italic.ttf deleted file mode 100755 index ef92c372c..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Italic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Light.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Light.ttf deleted file mode 100755 index 63229b280..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Light.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-LightItalic.ttf b/packages/react-docs-example/public/fonts/RobotoMono-LightItalic.ttf deleted file mode 100755 index f25bed56a..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-LightItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Medium.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Medium.ttf deleted file mode 100755 index 88ff0c15a..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Medium.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-MediumItalic.ttf b/packages/react-docs-example/public/fonts/RobotoMono-MediumItalic.ttf deleted file mode 100755 index 307efad8f..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-MediumItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Regular.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Regular.ttf deleted file mode 100755 index b158a334e..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Regular.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-Thin.ttf b/packages/react-docs-example/public/fonts/RobotoMono-Thin.ttf deleted file mode 100755 index 309484d32..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-Thin.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/fonts/RobotoMono-ThinItalic.ttf b/packages/react-docs-example/public/fonts/RobotoMono-ThinItalic.ttf deleted file mode 100755 index e1bb9121e..000000000 Binary files a/packages/react-docs-example/public/fonts/RobotoMono-ThinItalic.ttf and /dev/null differ diff --git a/packages/react-docs-example/public/index.html b/packages/react-docs-example/public/index.html deleted file mode 100644 index fcc1c6e0c..000000000 --- a/packages/react-docs-example/public/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - Example Docs Page - - - - - - - - - - - - -
- - - - diff --git a/packages/react-docs-example/ts/docs.tsx b/packages/react-docs-example/ts/docs.tsx deleted file mode 100644 index 9ac94bd00..000000000 --- a/packages/react-docs-example/ts/docs.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import * as React from 'react'; - -import { - constants, - DocAgnosticFormat, - DocsInfo, - DocsInfoConfig, - Documentation, - SupportedDocJson, - TypeDocNode, -} from '@0xproject/react-docs'; - -import * as v0TypeDocJson from './json/0.1.12.json'; -import * as v2TypeDocJson from './json/0.2.0.json'; - -// tslint:disable-next-line:no-implicit-dependencies no-var-requires -const IntroMarkdownV1 = require('md/introduction'); - -const docSections = { - introduction: 'introduction', - web3Wrapper: 'web3Wrapper', - types: constants.TYPES_SECTION_NAME, -}; - -const docsInfoConfig: DocsInfoConfig = { - id: 'web3Wrapper', - type: SupportedDocJson.TypeDoc, - displayName: 'Web3 Wrapper', - packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - web3Wrapper: [docSections.web3Wrapper], - types: [docSections.types], - }, - sections: docSections, - typeConfigs: { - typeNameToExternalLink: { - Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API', - Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150', - BigNumber: 'http://mikemcl.github.io/bignumber.js', - }, - typeNameToPrefix: { - Provider: 'Web3', - }, - typeNameToDocSection: { - Web3Wrapper: docSections.web3Wrapper, - }, - }, -}; -const docsInfo = new DocsInfo(docsInfoConfig); - -const availableVersions = ['0.1.12', '0.2.0']; -const versionToDocJSON: { [semver: string]: object } = { - [availableVersions[0]]: v0TypeDocJson, - [availableVersions[1]]: v2TypeDocJson, -}; - -export interface DocsProps {} - -export interface DocsState { - selectedVersion: string; - docAgnosticFormat?: DocAgnosticFormat; -} - -export class Docs extends React.Component { - constructor(props: DocsProps) { - super(props); - this.state = { - selectedVersion: availableVersions[1], - docAgnosticFormat: docsInfo.convertToDocAgnosticFormat(v2TypeDocJson), - }; - } - public render(): React.ReactNode { - return ( - - ); - } - private _onVersionSelected(semver: string): void { - const selectedDocJSON = versionToDocJSON[semver]; - this.setState({ - selectedVersion: semver, - docAgnosticFormat: docsInfo.convertToDocAgnosticFormat(selectedDocJSON as TypeDocNode), - }); - } - private _getSourceUrl(): string { - const sourceUrl = `${docsInfoConfig.packageUrl}/blob/@0xproject/web3-wrapper@${ - this.state.selectedVersion - }/packages`; - return sourceUrl; - } -} diff --git a/packages/react-docs-example/ts/globals.d.ts b/packages/react-docs-example/ts/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/react-docs-example/ts/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/react-docs-example/ts/index.tsx b/packages/react-docs-example/ts/index.tsx deleted file mode 100644 index 84a544766..000000000 --- a/packages/react-docs-example/ts/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import 'basscss/css/basscss.css'; -import 'less/all.less'; -import { MuiThemeProvider } from 'material-ui/styles'; -import * as React from 'react'; -import { render } from 'react-dom'; -import * as injectTapEventPlugin from 'react-tap-event-plugin'; - -import { Docs } from './docs'; - -injectTapEventPlugin(); - -render( - - - , - document.getElementById('app'), -); diff --git a/packages/react-docs-example/ts/json/0.1.12.json b/packages/react-docs-example/ts/json/0.1.12.json deleted file mode 100644 index 385684f30..000000000 --- a/packages/react-docs-example/ts/json/0.1.12.json +++ /dev/null @@ -1,3318 +0,0 @@ -{ - "id": 0, - "name": "@0xproject/web3-wrapper", - "kind": 0, - "flags": {}, - "children": [ - { - "id": 75, - "name": "\"types/src/index\"", - "kind": 1, - "kindString": "External module", - "flags": { - "isExported": true - }, - "originalName": "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/types/src/index.ts", - "children": [ - { - "id": 102, - "name": "AbiType", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 104, - "name": "Constructor", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 36, - "character": 15 - } - ], - "defaultValue": "\"constructor\"" - }, - { - "id": 105, - "name": "Event", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 37, - "character": 9 - } - ], - "defaultValue": "\"event\"" - }, - { - "id": 106, - "name": "Fallback", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 38, - "character": 12 - } - ], - "defaultValue": "\"fallback\"" - }, - { - "id": 103, - "name": "Function", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 35, - "character": 12 - } - ], - "defaultValue": "\"function\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [104, 105, 106, 103] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 34, - "character": 19 - } - ] - }, - { - "id": 139, - "name": "BlockParamLiteral", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 140, - "name": "Latest", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 64, - "character": 10 - } - ], - "defaultValue": "\"latest\"" - }, - { - "id": 141, - "name": "Pending", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 65, - "character": 11 - } - ], - "defaultValue": "\"pending\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [140, 141] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 63, - "character": 29 - } - ] - }, - { - "id": 122, - "name": "SolidityTypes", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 123, - "name": "Address", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 50, - "character": 11 - } - ], - "defaultValue": "\"address\"" - }, - { - "id": 126, - "name": "Uint", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 53, - "character": 8 - } - ], - "defaultValue": "\"uint\"" - }, - { - "id": 124, - "name": "Uint256", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 51, - "character": 11 - } - ], - "defaultValue": "\"uint256\"" - }, - { - "id": 125, - "name": "Uint8", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 52, - "character": 9 - } - ], - "defaultValue": "\"uint8\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [123, 126, 124, 125] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 49, - "character": 25 - } - ] - }, - { - "id": 107, - "name": "DecodedLogArgs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "indexSignature": { - "id": 108, - "name": "__index", - "kind": 8192, - "kindString": "Index signature", - "flags": {}, - "parameters": [ - { - "id": 109, - "name": "argName", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "ContractEventArg", - "id": 151 - } - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 43, - "character": 31 - } - ] - }, - { - "id": 99, - "name": "JSONRPCPayload", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 101, - "name": "method", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 31, - "character": 10 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 100, - "name": "params", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 30, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "any" - } - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [101, 100] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 29, - "character": 31 - } - ] - }, - { - "id": 110, - "name": "LogWithDecodedArgs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "typeParameter": [ - { - "id": 111, - "name": "ArgsType", - "kind": 131072, - "kindString": "Type parameter", - "flags": {} - } - ], - "children": [ - { - "id": 119, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 414, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.address" - } - }, - { - "id": 113, - "name": "args", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 125, - "character": 16 - } - ], - "type": { - "type": "typeParameter", - "name": "ArgsType" - }, - "inheritedFrom": { - "type": "reference", - "name": "DecodedLogEntry.args" - } - }, - { - "id": 117, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 412, - "character": 21 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.blockHash" - } - }, - { - "id": 118, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 413, - "character": 23 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.blockNumber" - } - }, - { - "id": 120, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 415, - "character": 16 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.data" - } - }, - { - "id": 112, - "name": "event", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 124, - "character": 17 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "DecodedLogEntry.event" - } - }, - { - "id": 114, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 409, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.logIndex" - } - }, - { - "id": 121, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 416, - "character": 18 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.topics" - } - }, - { - "id": 116, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 411, - "character": 27 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.transactionHash" - } - }, - { - "id": 115, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 410, - "character": 28 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.transactionIndex" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [119, 113, 117, 118, 120, 112, 114, 121, 116, 115] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 47, - "character": 35 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "DecodedLogEntry", - "typeArguments": [ - { - "type": "typeParameter", - "name": "ArgsType" - } - ] - } - ] - }, - { - "id": 142, - "name": "RawLogEntry", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 148, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 76, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 146, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 74, - "character": 13 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 147, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 75, - "character": 15 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 149, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 77, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 143, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 71, - "character": 12 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 150, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 78, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - }, - { - "id": 145, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 73, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 144, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 72, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [148, 146, 147, 149, 143, 150, 145, 144] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 70, - "character": 28 - } - ] - }, - { - "id": 87, - "name": "TransactionReceipt", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 88, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 16, - "character": 13 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 89, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 17, - "character": 15 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 97, - "name": "contractAddress", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 25, - "character": 19 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 95, - "name": "cumulativeGasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 23, - "character": 21 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 92, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 20, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 96, - "name": "gasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 24, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 98, - "name": "logs", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 26, - "character": 8 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "reference", - "name": "LogEntry" - } - } - }, - { - "id": 94, - "name": "status", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 22, - "character": 10 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "null" - }, - { - "type": "unknown", - "name": "0" - }, - { - "type": "unknown", - "name": "1" - } - ] - } - }, - { - "id": 93, - "name": "to", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 21, - "character": 6 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 90, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 18, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 91, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 19, - "character": 20 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [88, 89, 97, 95, 92, 96, 98, 94, 93, 90, 91] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 15, - "character": 35 - } - ], - "extendedBy": [ - { - "type": "reference", - "name": "TransactionReceiptWithDecodedLogs", - "id": 127 - } - ] - }, - { - "id": 127, - "name": "TransactionReceiptWithDecodedLogs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 129, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 16, - "character": 13 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.blockHash", - "id": 88 - } - }, - { - "id": 130, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 17, - "character": 15 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.blockNumber", - "id": 89 - } - }, - { - "id": 138, - "name": "contractAddress", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 25, - "character": 19 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.contractAddress", - "id": 97 - } - }, - { - "id": 136, - "name": "cumulativeGasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 23, - "character": 21 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.cumulativeGasUsed", - "id": 95 - } - }, - { - "id": 133, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 20, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.from", - "id": 92 - } - }, - { - "id": 137, - "name": "gasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 24, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.gasUsed", - "id": 96 - } - }, - { - "id": 128, - "name": "logs", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 57, - "character": 8 - } - ], - "type": { - "type": "reference", - "name": "Array", - "typeArguments": [ - { - "type": "union", - "types": [ - { - "type": "reference", - "name": "LogWithDecodedArgs", - "id": 110, - "typeArguments": [ - { - "type": "reference", - "name": "DecodedLogArgs", - "id": 107 - } - ] - }, - { - "type": "reference", - "name": "LogEntry" - } - ] - } - ] - }, - "overwrites": { - "type": "reference", - "name": "TransactionReceipt.logs", - "id": 98 - } - }, - { - "id": 135, - "name": "status", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 22, - "character": 10 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "null" - }, - { - "type": "unknown", - "name": "0" - }, - { - "type": "unknown", - "name": "1" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.status", - "id": 94 - } - }, - { - "id": 134, - "name": "to", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 21, - "character": 6 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.to", - "id": 93 - } - }, - { - "id": 131, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 18, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.transactionHash", - "id": 90 - } - }, - { - "id": 132, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 19, - "character": 20 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.transactionIndex", - "id": 91 - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [129, 130, 138, 136, 133, 137, 128, 135, 134, 131, 132] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 56, - "character": 50 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "TransactionReceipt", - "id": 87 - } - ] - }, - { - "id": 76, - "name": "TxData", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 77, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 5, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - } - }, - { - "id": 78, - "name": "gas", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 6, - "character": 7 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - }, - { - "id": 79, - "name": "gasPrice", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 7, - "character": 12 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - }, - { - "id": 80, - "name": "nonce", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 8, - "character": 9 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [77, 78, 79, 80] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 4, - "character": 23 - } - ], - "extendedBy": [ - { - "type": "reference", - "name": "TxDataPayable", - "id": 81 - } - ] - }, - { - "id": 81, - "name": "TxDataPayable", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 83, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 5, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.from", - "id": 77 - } - }, - { - "id": 84, - "name": "gas", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 6, - "character": 7 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.gas", - "id": 78 - } - }, - { - "id": 85, - "name": "gasPrice", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 7, - "character": 12 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.gasPrice", - "id": 79 - } - }, - { - "id": 86, - "name": "nonce", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 8, - "character": 9 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.nonce", - "id": 80 - } - }, - { - "id": 82, - "name": "value", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 12, - "character": 9 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [83, 84, 85, 86, 82] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 11, - "character": 30 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "TxData", - "id": 76 - } - ] - }, - { - "id": 153, - "name": "BlockParam", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 68, - "character": 22 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "reference", - "name": "BlockParamLiteral", - "id": 139 - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - }, - { - "id": 151, - "name": "ContractEventArg", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 41, - "character": 28 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "BigNumber" - } - ] - } - }, - { - "id": 152, - "name": "RawLog", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 48, - "character": 18 - } - ], - "type": { - "type": "reference", - "name": "LogEntry" - } - } - ], - "groups": [ - { - "title": "Enumerations", - "kind": 4, - "children": [102, 139, 122] - }, - { - "title": "Interfaces", - "kind": 256, - "children": [107, 99, 110, 142, 87, 127, 76, 81] - }, - { - "title": "Type aliases", - "kind": 4194304, - "children": [153, 151, 152] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 1, - "character": 0 - } - ] - }, - { - "id": 1, - "name": "\"web3-wrapper/src/index\"", - "kind": 1, - "kindString": "External module", - "flags": { - "isExported": true - }, - "originalName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/web3-wrapper/src/index.ts", - "children": [ - { - "id": 11, - "name": "Web3Wrapper", - "kind": 128, - "kindString": "Class", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 12, - "name": "constructor", - "kind": 512, - "kindString": "Constructor", - "flags": { - "isExported": true - }, - "signatures": [ - { - "id": 13, - "name": "new Web3Wrapper", - "kind": 16384, - "kindString": "Constructor signature", - "flags": {}, - "parameters": [ - { - "id": 14, - "name": "provider", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - }, - { - "id": 15, - "name": "defaults", - "kind": 32768, - "kindString": "Parameter", - "flags": { - "isOptional": true - }, - "type": { - "type": "reference", - "name": "Partial", - "typeArguments": [ - { - "type": "reference", - "name": "TxData" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Web3Wrapper", - "id": 11 - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 20, - "character": 38 - } - ] - }, - { - "id": 42, - "name": "doesContractExistAtAddressAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 43, - "name": "doesContractExistAtAddressAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 44, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "boolean" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 75, - "character": 48 - } - ] - }, - { - "id": 69, - "name": "estimateGasAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 70, - "name": "estimateGasAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 71, - "name": "data", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 133, - "character": 33 - } - ] - }, - { - "id": 57, - "name": "getAvailableAddressesAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 58, - "name": "getAvailableAddressesAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 97, - "character": 43 - } - ] - }, - { - "id": 39, - "name": "getBalanceInWeiAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 40, - "name": "getBalanceInWeiAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 41, - "name": "owner", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "BigNumber" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 69, - "character": 37 - } - ] - }, - { - "id": 51, - "name": "getBlockAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 52, - "name": "getBlockAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 53, - "name": "blockParam", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "Web3.BlockParam" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "BlockWithoutTransactionData" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 89, - "character": 30 - } - ] - }, - { - "id": 49, - "name": "getBlockNumberAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 50, - "name": "getBlockNumberAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 85, - "character": 36 - } - ] - }, - { - "id": 54, - "name": "getBlockTimestampAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 55, - "name": "getBlockTimestampAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 56, - "name": "blockParam", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "Web3.BlockParam" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 93, - "character": 39 - } - ] - }, - { - "id": 16, - "name": "getContractDefaults", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 17, - "name": "getContractDefaults", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Partial", - "typeArguments": [ - { - "type": "reference", - "name": "TxData" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 33, - "character": 30 - } - ] - }, - { - "id": 62, - "name": "getContractFromAbi", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 63, - "name": "getContractFromAbi", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 64, - "name": "abi", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Web3.ContractAbi" - } - } - ], - "type": { - "type": "reference", - "name": "Contract", - "typeArguments": [ - { - "type": "intrinsic", - "name": "any" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 125, - "character": 29 - } - ] - }, - { - "id": 65, - "name": "getContractInstance", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 66, - "name": "getContractInstance", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 67, - "name": "abi", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Web3.ContractAbi" - } - }, - { - "id": 68, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "ContractInstance" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 129, - "character": 30 - } - ] - }, - { - "id": 34, - "name": "getCurrentProvider", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 35, - "name": "getCurrentProvider", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 62, - "character": 29 - } - ] - }, - { - "id": 59, - "name": "getLogsAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 60, - "name": "getLogsAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 61, - "name": "filter", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "FilterObject" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "array", - "elementType": { - "type": "reference", - "name": "LogEntry" - } - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 101, - "character": 29 - } - ] - }, - { - "id": 29, - "name": "getNetworkIdAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 30, - "name": "getNetworkIdAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 50, - "character": 34 - } - ] - }, - { - "id": 27, - "name": "getNodeVersionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 28, - "name": "getNodeVersionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 46, - "character": 36 - } - ] - }, - { - "id": 31, - "name": "getTransactionReceiptAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 32, - "name": "getTransactionReceiptAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 33, - "name": "txHash", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "TransactionReceipt" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 55, - "character": 43 - } - ] - }, - { - "id": 21, - "name": "isAddress", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 22, - "name": "isAddress", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 23, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "intrinsic", - "name": "boolean" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 39, - "character": 20 - } - ] - }, - { - "id": 24, - "name": "isSenderAddressAvailableAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 25, - "name": "isSenderAddressAvailableAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 26, - "name": "senderAddress", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "boolean" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 42, - "character": 46 - } - ] - }, - { - "id": 72, - "name": "sendTransactionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 73, - "name": "sendTransactionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 74, - "name": "txData", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "TxData" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 137, - "character": 37 - } - ] - }, - { - "id": 18, - "name": "setProvider", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 19, - "name": "setProvider", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 20, - "name": "provider", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - } - ], - "type": { - "type": "intrinsic", - "name": "void" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 36, - "character": 22 - } - ] - }, - { - "id": 45, - "name": "signTransactionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 46, - "name": "signTransactionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 47, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 48, - "name": "message", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 81, - "character": 37 - } - ] - }, - { - "id": 36, - "name": "toWei", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 37, - "name": "toWei", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 38, - "name": "ethAmount", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 65, - "character": 16 - } - ] - } - ], - "groups": [ - { - "title": "Constructors", - "kind": 512, - "children": [12] - }, - { - "title": "Methods", - "kind": 2048, - "children": [ - 42, - 69, - 57, - 39, - 51, - 49, - 54, - 16, - 62, - 65, - 34, - 59, - 29, - 27, - 31, - 21, - 24, - 72, - 18, - 45, - 36 - ] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 17, - "character": 24 - } - ] - }, - { - "id": 2, - "name": "RawLogEntry", - "kind": 256, - "kindString": "Interface", - "flags": {}, - "children": [ - { - "id": 8, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 12, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 6, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 10, - "character": 13 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 7, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 11, - "character": 15 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 9, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 13, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 3, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 7, - "character": 12 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 10, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 14, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - }, - { - "id": 5, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 9, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 4, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 8, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [8, 6, 7, 9, 3, 10, 5, 4] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 6, - "character": 21 - } - ] - } - ], - "groups": [ - { - "title": "Classes", - "kind": 128, - "children": [11] - }, - { - "title": "Interfaces", - "kind": 256, - "children": [2] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 1, - "character": 0 - } - ] - } - ], - "groups": [ - { - "title": "External modules", - "kind": 1, - "children": [75, 1] - } - ] -} diff --git a/packages/react-docs-example/ts/json/0.2.0.json b/packages/react-docs-example/ts/json/0.2.0.json deleted file mode 100644 index 48bcb61a7..000000000 --- a/packages/react-docs-example/ts/json/0.2.0.json +++ /dev/null @@ -1,3401 +0,0 @@ -{ - "id": 0, - "name": "@0xproject/web3-wrapper", - "kind": 0, - "flags": {}, - "children": [ - { - "id": 75, - "name": "\"types/src/index\"", - "kind": 1, - "kindString": "External module", - "flags": { - "isExported": true - }, - "originalName": "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/types/src/index.ts", - "children": [ - { - "id": 104, - "name": "AbiType", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 106, - "name": "Constructor", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 37, - "character": 15 - } - ], - "defaultValue": "\"constructor\"" - }, - { - "id": 107, - "name": "Event", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 38, - "character": 9 - } - ], - "defaultValue": "\"event\"" - }, - { - "id": 108, - "name": "Fallback", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 39, - "character": 12 - } - ], - "defaultValue": "\"fallback\"" - }, - { - "id": 105, - "name": "Function", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 36, - "character": 12 - } - ], - "defaultValue": "\"function\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [106, 107, 108, 105] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 35, - "character": 19 - } - ] - }, - { - "id": 141, - "name": "BlockParamLiteral", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 142, - "name": "Latest", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 65, - "character": 10 - } - ], - "defaultValue": "\"latest\"" - }, - { - "id": 143, - "name": "Pending", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 66, - "character": 11 - } - ], - "defaultValue": "\"pending\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [142, 143] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 64, - "character": 29 - } - ] - }, - { - "id": 124, - "name": "SolidityTypes", - "kind": 4, - "kindString": "Enumeration", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 125, - "name": "Address", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 51, - "character": 11 - } - ], - "defaultValue": "\"address\"" - }, - { - "id": 128, - "name": "Uint", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 54, - "character": 8 - } - ], - "defaultValue": "\"uint\"" - }, - { - "id": 126, - "name": "Uint256", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 52, - "character": 11 - } - ], - "defaultValue": "\"uint256\"" - }, - { - "id": 127, - "name": "Uint8", - "kind": 16, - "kindString": "Enumeration member", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 53, - "character": 9 - } - ], - "defaultValue": "\"uint8\"" - } - ], - "groups": [ - { - "title": "Enumeration members", - "kind": 16, - "children": [125, 128, 126, 127] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 50, - "character": 25 - } - ] - }, - { - "id": 109, - "name": "DecodedLogArgs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "indexSignature": { - "id": 110, - "name": "__index", - "kind": 8192, - "kindString": "Index signature", - "flags": {}, - "parameters": [ - { - "id": 111, - "name": "argName", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "ContractEventArg", - "id": 153 - } - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 44, - "character": 31 - } - ] - }, - { - "id": 101, - "name": "JSONRPCPayload", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 103, - "name": "method", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 32, - "character": 10 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 102, - "name": "params", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 31, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "any" - } - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [103, 102] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 30, - "character": 31 - } - ] - }, - { - "id": 112, - "name": "LogWithDecodedArgs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "typeParameter": [ - { - "id": 113, - "name": "ArgsType", - "kind": 131072, - "kindString": "Type parameter", - "flags": {} - } - ], - "children": [ - { - "id": 121, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 413, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.address" - } - }, - { - "id": 115, - "name": "args", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 124, - "character": 16 - } - ], - "type": { - "type": "typeParameter", - "name": "ArgsType" - }, - "inheritedFrom": { - "type": "reference", - "name": "DecodedLogEntry.args" - } - }, - { - "id": 119, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 411, - "character": 21 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.blockHash" - } - }, - { - "id": 120, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 412, - "character": 23 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.blockNumber" - } - }, - { - "id": 122, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 414, - "character": 16 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.data" - } - }, - { - "id": 114, - "name": "event", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 123, - "character": 17 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "DecodedLogEntry.event" - } - }, - { - "id": 116, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 408, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.logIndex" - } - }, - { - "id": 123, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 415, - "character": 18 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.topics" - } - }, - { - "id": 118, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 410, - "character": 27 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.transactionHash" - } - }, - { - "id": 117, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/node_modules/web3-typescript-typings/index.d.ts", - "line": 409, - "character": 28 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "number" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "LogEntry.transactionIndex" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [121, 115, 119, 120, 122, 114, 116, 123, 118, 117] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 48, - "character": 35 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "DecodedLogEntry", - "typeArguments": [ - { - "type": "typeParameter", - "name": "ArgsType" - } - ] - } - ] - }, - { - "id": 144, - "name": "RawLogEntry", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 150, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 77, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 148, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 75, - "character": 13 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 149, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 76, - "character": 15 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 151, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 78, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 145, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 72, - "character": 12 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 152, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 79, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - }, - { - "id": 147, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 74, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 146, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 73, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [150, 148, 149, 151, 145, 152, 147, 146] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 71, - "character": 28 - } - ] - }, - { - "id": 89, - "name": "TransactionReceipt", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 90, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 17, - "character": 13 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 91, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 18, - "character": 15 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 99, - "name": "contractAddress", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 26, - "character": 19 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 97, - "name": "cumulativeGasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 24, - "character": 21 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 94, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 21, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 98, - "name": "gasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 25, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - }, - { - "id": 100, - "name": "logs", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 27, - "character": 8 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "reference", - "name": "LogEntry" - } - } - }, - { - "id": 96, - "name": "status", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 23, - "character": 10 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "null" - }, - { - "type": "unknown", - "name": "0" - }, - { - "type": "unknown", - "name": "1" - } - ] - } - }, - { - "id": 95, - "name": "to", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 22, - "character": 6 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 92, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 19, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 93, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 20, - "character": 20 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [90, 91, 99, 97, 94, 98, 100, 96, 95, 92, 93] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 16, - "character": 35 - } - ], - "extendedBy": [ - { - "type": "reference", - "name": "TransactionReceiptWithDecodedLogs", - "id": 129 - } - ] - }, - { - "id": 129, - "name": "TransactionReceiptWithDecodedLogs", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 131, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 17, - "character": 13 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.blockHash", - "id": 90 - } - }, - { - "id": 132, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 18, - "character": 15 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.blockNumber", - "id": 91 - } - }, - { - "id": 140, - "name": "contractAddress", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 26, - "character": 19 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.contractAddress", - "id": 99 - } - }, - { - "id": 138, - "name": "cumulativeGasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 24, - "character": 21 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.cumulativeGasUsed", - "id": 97 - } - }, - { - "id": 135, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 21, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.from", - "id": 94 - } - }, - { - "id": 139, - "name": "gasUsed", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 25, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.gasUsed", - "id": 98 - } - }, - { - "id": 130, - "name": "logs", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 58, - "character": 8 - } - ], - "type": { - "type": "reference", - "name": "Array", - "typeArguments": [ - { - "type": "union", - "types": [ - { - "type": "reference", - "name": "LogWithDecodedArgs", - "id": 112, - "typeArguments": [ - { - "type": "reference", - "name": "DecodedLogArgs", - "id": 109 - } - ] - }, - { - "type": "reference", - "name": "LogEntry" - } - ] - } - ] - }, - "overwrites": { - "type": "reference", - "name": "TransactionReceipt.logs", - "id": 100 - } - }, - { - "id": 137, - "name": "status", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 23, - "character": 10 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "null" - }, - { - "type": "unknown", - "name": "0" - }, - { - "type": "unknown", - "name": "1" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.status", - "id": 96 - } - }, - { - "id": 136, - "name": "to", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 22, - "character": 6 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.to", - "id": 95 - } - }, - { - "id": 133, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 19, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.transactionHash", - "id": 92 - } - }, - { - "id": 134, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 20, - "character": 20 - } - ], - "type": { - "type": "intrinsic", - "name": "number" - }, - "inheritedFrom": { - "type": "reference", - "name": "TransactionReceipt.transactionIndex", - "id": 93 - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [131, 132, 140, 138, 135, 139, 130, 137, 136, 133, 134] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 57, - "character": 50 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "TransactionReceipt", - "id": 89 - } - ] - }, - { - "id": 76, - "name": "TxData", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 77, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 5, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - } - }, - { - "id": 78, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 6, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - } - }, - { - "id": 79, - "name": "gas", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 7, - "character": 7 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - }, - { - "id": 80, - "name": "gasPrice", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 8, - "character": 12 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - }, - { - "id": 81, - "name": "nonce", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 9, - "character": 9 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [77, 78, 79, 80, 81] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 4, - "character": 23 - } - ], - "extendedBy": [ - { - "type": "reference", - "name": "TxDataPayable", - "id": 82 - } - ] - }, - { - "id": 82, - "name": "TxDataPayable", - "kind": 256, - "kindString": "Interface", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 84, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 5, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.data", - "id": 77 - } - }, - { - "id": 85, - "name": "from", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 6, - "character": 8 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "string" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.from", - "id": 78 - } - }, - { - "id": 86, - "name": "gas", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 7, - "character": 7 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.gas", - "id": 79 - } - }, - { - "id": 87, - "name": "gasPrice", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 8, - "character": 12 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.gasPrice", - "id": 80 - } - }, - { - "id": 88, - "name": "nonce", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 9, - "character": 9 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "undefined" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - }, - "inheritedFrom": { - "type": "reference", - "name": "TxData.nonce", - "id": 81 - } - }, - { - "id": 83, - "name": "value", - "kind": 1024, - "kindString": "Property", - "flags": { - "isExported": true, - "isOptional": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 13, - "character": 9 - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [84, 85, 86, 87, 88, 83] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 12, - "character": 30 - } - ], - "extendedTypes": [ - { - "type": "reference", - "name": "TxData", - "id": 76 - } - ] - }, - { - "id": 155, - "name": "BlockParam", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 69, - "character": 22 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "reference", - "name": "BlockParamLiteral", - "id": 141 - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - }, - { - "id": 153, - "name": "ContractEventArg", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 42, - "character": 28 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "BigNumber" - }, - { - "type": "intrinsic", - "name": "number" - } - ] - } - }, - { - "id": 154, - "name": "RawLog", - "kind": 4194304, - "kindString": "Type alias", - "flags": { - "isExported": true - }, - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 49, - "character": 18 - } - ], - "type": { - "type": "reference", - "name": "LogEntry" - } - } - ], - "groups": [ - { - "title": "Enumerations", - "kind": 4, - "children": [104, 141, 124] - }, - { - "title": "Interfaces", - "kind": 256, - "children": [109, 101, 112, 144, 89, 129, 76, 82] - }, - { - "title": "Type aliases", - "kind": 4194304, - "children": [155, 153, 154] - } - ], - "sources": [ - { - "fileName": "types/src/index.ts", - "line": 1, - "character": 0 - } - ] - }, - { - "id": 1, - "name": "\"web3-wrapper/src/index\"", - "kind": 1, - "kindString": "External module", - "flags": { - "isExported": true - }, - "originalName": - "/Users/fabioberger/Documents/projects/0x_project/0x-monorepo/packages/web3-wrapper/src/index.ts", - "children": [ - { - "id": 11, - "name": "Web3Wrapper", - "kind": 128, - "kindString": "Class", - "flags": { - "isExported": true - }, - "children": [ - { - "id": 12, - "name": "constructor", - "kind": 512, - "kindString": "Constructor", - "flags": { - "isExported": true - }, - "signatures": [ - { - "id": 13, - "name": "new Web3Wrapper", - "kind": 16384, - "kindString": "Constructor signature", - "flags": {}, - "parameters": [ - { - "id": 14, - "name": "provider", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - }, - { - "id": 15, - "name": "defaults", - "kind": 32768, - "kindString": "Parameter", - "flags": { - "isOptional": true - }, - "type": { - "type": "reference", - "name": "Partial", - "typeArguments": [ - { - "type": "reference", - "name": "TxData" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Web3Wrapper", - "id": 11 - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 20, - "character": 38 - } - ] - }, - { - "id": 68, - "name": "callAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 69, - "name": "callAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 70, - "name": "callData", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "CallData" - } - }, - { - "id": 71, - "name": "defaultBlock", - "kind": 32768, - "kindString": "Parameter", - "flags": { - "isOptional": true - }, - "type": { - "type": "reference", - "name": "Web3.BlockParam" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 135, - "character": 26 - } - ] - }, - { - "id": 42, - "name": "doesContractExistAtAddressAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 43, - "name": "doesContractExistAtAddressAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 44, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "boolean" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 76, - "character": 48 - } - ] - }, - { - "id": 65, - "name": "estimateGasAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 66, - "name": "estimateGasAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 67, - "name": "txData", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Partial", - "typeArguments": [ - { - "type": "reference", - "name": "TxData" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 131, - "character": 33 - } - ] - }, - { - "id": 57, - "name": "getAvailableAddressesAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 58, - "name": "getAvailableAddressesAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 98, - "character": 43 - } - ] - }, - { - "id": 39, - "name": "getBalanceInWeiAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 40, - "name": "getBalanceInWeiAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 41, - "name": "owner", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "BigNumber" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 70, - "character": 37 - } - ] - }, - { - "id": 51, - "name": "getBlockAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 52, - "name": "getBlockAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 53, - "name": "blockParam", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "Web3.BlockParam" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "BlockWithoutTransactionData" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 90, - "character": 30 - } - ] - }, - { - "id": 49, - "name": "getBlockNumberAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 50, - "name": "getBlockNumberAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 86, - "character": 36 - } - ] - }, - { - "id": 54, - "name": "getBlockTimestampAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 55, - "name": "getBlockTimestampAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 56, - "name": "blockParam", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "reference", - "name": "Web3.BlockParam" - } - ] - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 94, - "character": 39 - } - ] - }, - { - "id": 16, - "name": "getContractDefaults", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 17, - "name": "getContractDefaults", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Partial", - "typeArguments": [ - { - "type": "reference", - "name": "TxData" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 33, - "character": 30 - } - ] - }, - { - "id": 62, - "name": "getContractFromAbi", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 63, - "name": "getContractFromAbi", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 64, - "name": "abi", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Web3.ContractAbi" - } - } - ], - "type": { - "type": "reference", - "name": "Contract", - "typeArguments": [ - { - "type": "intrinsic", - "name": "any" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 127, - "character": 29 - } - ] - }, - { - "id": 34, - "name": "getCurrentProvider", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 35, - "name": "getCurrentProvider", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 63, - "character": 29 - } - ] - }, - { - "id": 59, - "name": "getLogsAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 60, - "name": "getLogsAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 61, - "name": "filter", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "FilterObject" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "array", - "elementType": { - "type": "reference", - "name": "LogEntry" - } - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 103, - "character": 29 - } - ] - }, - { - "id": 29, - "name": "getNetworkIdAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 30, - "name": "getNetworkIdAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "number" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 51, - "character": 34 - } - ] - }, - { - "id": 27, - "name": "getNodeVersionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 28, - "name": "getNodeVersionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 47, - "character": 36 - } - ] - }, - { - "id": 31, - "name": "getTransactionReceiptAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 32, - "name": "getTransactionReceiptAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 33, - "name": "txHash", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "reference", - "name": "TransactionReceipt" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 56, - "character": 43 - } - ] - }, - { - "id": 21, - "name": "isAddress", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 22, - "name": "isAddress", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 23, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "intrinsic", - "name": "boolean" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 39, - "character": 20 - } - ] - }, - { - "id": 24, - "name": "isSenderAddressAvailableAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 25, - "name": "isSenderAddressAvailableAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 26, - "name": "senderAddress", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "boolean" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 42, - "character": 46 - } - ] - }, - { - "id": 72, - "name": "sendTransactionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 73, - "name": "sendTransactionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 74, - "name": "txData", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "TxData" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 139, - "character": 37 - } - ] - }, - { - "id": 18, - "name": "setProvider", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 19, - "name": "setProvider", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 20, - "name": "provider", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "Provider" - } - } - ], - "type": { - "type": "intrinsic", - "name": "void" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 36, - "character": 22 - } - ] - }, - { - "id": 45, - "name": "signTransactionAsync", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 46, - "name": "signTransactionAsync", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 47, - "name": "address", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 48, - "name": "message", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "intrinsic", - "name": "string" - } - } - ], - "type": { - "type": "reference", - "name": "Promise", - "typeArguments": [ - { - "type": "intrinsic", - "name": "string" - } - ] - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 82, - "character": 37 - } - ] - }, - { - "id": 36, - "name": "toWei", - "kind": 2048, - "kindString": "Method", - "flags": { - "isExported": true, - "isPublic": true - }, - "signatures": [ - { - "id": 37, - "name": "toWei", - "kind": 4096, - "kindString": "Call signature", - "flags": {}, - "parameters": [ - { - "id": 38, - "name": "ethAmount", - "kind": 32768, - "kindString": "Parameter", - "flags": {}, - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "type": { - "type": "reference", - "name": "BigNumber" - } - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 66, - "character": 16 - } - ] - } - ], - "groups": [ - { - "title": "Constructors", - "kind": 512, - "children": [12] - }, - { - "title": "Methods", - "kind": 2048, - "children": [ - 68, - 42, - 65, - 57, - 39, - 51, - 49, - 54, - 16, - 62, - 34, - 59, - 29, - 27, - 31, - 21, - 24, - 72, - 18, - 45, - 36 - ] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 17, - "character": 24 - } - ] - }, - { - "id": 2, - "name": "RawLogEntry", - "kind": 256, - "kindString": "Interface", - "flags": {}, - "children": [ - { - "id": 8, - "name": "address", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 12, - "character": 11 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 6, - "name": "blockHash", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 10, - "character": 13 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 7, - "name": "blockNumber", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 11, - "character": 15 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 9, - "name": "data", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 13, - "character": 8 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 3, - "name": "logIndex", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 7, - "character": 12 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - }, - { - "id": 10, - "name": "topics", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 14, - "character": 10 - } - ], - "type": { - "type": "array", - "elementType": { - "type": "intrinsic", - "name": "string" - } - } - }, - { - "id": 5, - "name": "transactionHash", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 9, - "character": 19 - } - ], - "type": { - "type": "intrinsic", - "name": "string" - } - }, - { - "id": 4, - "name": "transactionIndex", - "kind": 1024, - "kindString": "Property", - "flags": {}, - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 8, - "character": 20 - } - ], - "type": { - "type": "union", - "types": [ - { - "type": "intrinsic", - "name": "string" - }, - { - "type": "intrinsic", - "name": "null" - } - ] - } - } - ], - "groups": [ - { - "title": "Properties", - "kind": 1024, - "children": [8, 6, 7, 9, 3, 10, 5, 4] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 6, - "character": 21 - } - ] - } - ], - "groups": [ - { - "title": "Classes", - "kind": 128, - "children": [11] - }, - { - "title": "Interfaces", - "kind": 256, - "children": [2] - } - ], - "sources": [ - { - "fileName": "web3-wrapper/src/index.ts", - "line": 1, - "character": 0 - } - ] - } - ], - "groups": [ - { - "title": "External modules", - "kind": 1, - "children": [75, 1] - } - ] -} diff --git a/packages/react-docs-example/tsconfig.json b/packages/react-docs-example/tsconfig.json deleted file mode 100644 index 2f12470d6..000000000 --- a/packages/react-docs-example/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../tsconfig", - "compilerOptions": { - "outDir": "./lib/", - "jsx": "react", - "baseUrl": "./", - "strictNullChecks": false, - "paths": { - "*": ["node_modules/@types/*", "*"] - } - }, - "include": ["./ts/**/*"] -} diff --git a/packages/react-docs-example/tslint.json b/packages/react-docs-example/tslint.json deleted file mode 100644 index ee918e360..000000000 --- a/packages/react-docs-example/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["@0xproject/tslint-config"], - "rules": { - "no-object-literal-type-assertion": false, - "completed-docs": false, - "prefer-function-over-method": false - } -} diff --git a/packages/react-docs-example/webpack.config.js b/packages/react-docs-example/webpack.config.js deleted file mode 100644 index 30f3132da..000000000 --- a/packages/react-docs-example/webpack.config.js +++ /dev/null @@ -1,83 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); - -module.exports = { - entry: ['./ts/index.tsx'], - output: { - path: path.join(__dirname, '/public'), - filename: 'bundle.js', - chunkFilename: 'bundle-[name].js', - publicPath: '/', - }, - devtool: 'source-map', - resolve: { - modules: [path.join(__dirname, '/ts'), 'node_modules'], - extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.md'], - alias: { - ts: path.join(__dirname, '/ts'), - less: path.join(__dirname, '/less'), - md: path.join(__dirname, '/md'), - }, - }, - module: { - rules: [ - { - test: /\.js$/, - loader: 'source-map-loader', - exclude: [ - // instead of /\/node_modules\// - path.join(process.cwd(), 'node_modules'), - ], - }, - { - test: /\.tsx?$/, - loader: 'awesome-typescript-loader', - }, - { - test: /\.css$/, - loaders: ['style-loader', 'css-loader'], - }, - { - test: /\.less$/, - loader: 'style-loader!css-loader!less-loader', - exclude: /node_modules/, - }, - { - test: /\.json$/, - loader: 'json-loader', - }, - { - test: /\.md$/, - use: 'raw-loader', - }, - ], - }, - devServer: { - port: 3000, - disableHostCheck: true, - historyApiFallback: { - // Fixes issue where having dots in URL path that aren't part of fileNames causes webpack-dev-server - // to fail. - // Source: https://github.com/cvut/fittable/issues/171 - rewrites: [ - { - from: /.*$/, - to: function() { - return 'index.html'; - }, - }, - ], - }, - contentBase: path.join(__dirname, '/public'), - }, - plugins: - process.env.NODE_ENV === 'production' - ? [ - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify(process.env.NODE_ENV), - }, - }), - ] - : [], -}; diff --git a/packages/react-docs/README.md b/packages/react-docs/README.md index c0efc4a0b..5d56207de 100644 --- a/packages/react-docs/README.md +++ b/packages/react-docs/README.md @@ -1,6 +1,8 @@ ## @0xproject/react-docs -A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [Doxity](https://github.com/0xproject/doxity). See a [live example](http://react-docs-example.s3-website-us-east-1.amazonaws.com/). +#### WARNING: Alpha software. Expect things to break when trying to use. + +A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [Doxity](https://github.com/0xproject/doxity).
@@ -27,8 +29,6 @@ yarn add @0xproject/react-docs ## Usage -View the [live example](http://react-docs-example.s3-website-us-east-1.amazonaws.com/) that renders the [@0xproject/web3-wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) Typescript package. It's source code is in the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) 0x monorepo subpackage. - This package exposes both a single `Documentation` react component that will render a docs page, as well as all of it's sub-components in case someone wants to build their own layout. Currently this package still has some external dependencies outside of the `Documentation` component, so please start your project off by copying the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) directory and modifying it there. If you need changes in the [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) package, fork the 0x monorepo, make the required changes and submit a PR. Until we merge it, you can have your project depend on your own custom fork. -- cgit From 1588f4ac391038b9206ba2220226f2f11fd8fe0f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:51:58 +0200 Subject: Stop exporting crypto --- packages/contracts/test/utils/address_utils.ts | 3 ++- packages/order-utils/src/index.ts | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/test/utils/address_utils.ts b/packages/contracts/test/utils/address_utils.ts index a9fb6921a..3cf8ec786 100644 --- a/packages/contracts/test/utils/address_utils.ts +++ b/packages/contracts/test/utils/address_utils.ts @@ -1,4 +1,5 @@ -import { crypto, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { crypto } from '@0xproject/order-utils/lib/src/crypto'; export const addressUtils = { generatePseudoRandomAddress(): string { diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 5852a01b9..c685a94e2 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -1,7 +1,6 @@ export { orderHashUtils } from './order_hash'; export { signatureUtils } from './signature_utils'; export { constants } from './constants'; -export { crypto } from './crypto'; export { generatePseudoRandomSalt } from './salt'; export { OrderError, -- cgit From 36d615318d7a0d63c254b42f029d393aea04c674 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:52:09 +0200 Subject: Omit several exports from order-utils docs --- packages/order-utils/package.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index c49abfdae..d4b04df1c 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -31,7 +31,14 @@ "contracts_v2": "DummyERC20Token", "postpublish": { "assets": [], - "shouldPublishDocs": true + "shouldPublishDocs": true, + "omitExports": [ + "AbstractBalanceAndProxyAllowanceFetcher", + "AbstractOrderFilledCancelledFetcher", + "BalanceAndProxyAllowanceLazyStore", + "OrderFilledCancelledLazyStore", + "ExchangeTransferSimulator" + ] } }, "license": "Apache-2.0", -- cgit From a728247d6c4819d15a7fadd4cd6dd582f150b258 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 18:28:56 +0200 Subject: Display camelCase names all-caps properly --- .../src/components/markdown_section.tsx | 2 +- .../src/components/nested_sidebar_menu.tsx | 2 +- packages/react-shared/src/utils/utils.ts | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/react-shared/src/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx index 3b65b3075..09b214548 100644 --- a/packages/react-shared/src/components/markdown_section.tsx +++ b/packages/react-shared/src/components/markdown_section.tsx @@ -42,7 +42,7 @@ export class MarkdownSection extends React.Component { - const finalSectionName = utils.convertDashesToSpaces(sectionName); + const finalSectionName = utils.convertCamelCaseToSpaces(sectionName); if (this.props.shouldDisplaySectionHeaders) { // tslint:disable-next-line:no-unused-variable const id = utils.getIdFromName(sectionName); diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 93c7e9f7b..6dd0b9993 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -33,6 +33,28 @@ export const utils = { convertDashesToSpaces(text: string): string { return text.replace(/-/g, ' '); }, + convertCamelCaseToSpaces(text: string): string { + const charArray = _.map(text, (char, i) => { + const isNumber = !_.eq(_.parseInt(char), NaN); + const isPrevNumber = i !== 0 && !_.eq(_.parseInt(text[i - 1]), NaN); + if (isNumber && (i == 0 || isPrevNumber)) { + return char; + } + if (char === char.toUpperCase() && i !== 0) { + return ` ${char}`; + } + return char; + }); + let finalText = charArray.join(''); + const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; + _.each(exceptions, (spaced, normal) => { + console.log(finalText, spaced, normal); + if (_.includes(finalText, spaced)) { + finalText = finalText.replace(spaced, normal); + } + }); + return finalText; + }, getEtherScanLinkIfExists( addressOrTxHash: string, networkId: number, -- cgit From c17d6c47c3253cf32c2dada8f7f871563f7209e9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 19:24:58 +0200 Subject: Properly render class/objectLiteral properties that are simple variables --- packages/react-docs/src/utils/typedoc_utils.ts | 42 ++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index b74b9562b..2eee2fa59 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -86,7 +86,13 @@ export const typeDocUtils = { const entities = child.children; const commentObj = child.comment; const sectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; - const docSection = typeDocUtils._convertEntitiesToDocSection(entities, docsInfo, sectionName); + const isClassOrObjectLiteral = true; + const docSection = typeDocUtils._convertEntitiesToDocSection( + entities, + docsInfo, + sectionName, + isClassOrObjectLiteral, + ); docSection.comment = sectionComment; docAgnosticFormat[sectionName] = docSection; break; @@ -127,7 +133,12 @@ export const typeDocUtils = { return docAgnosticFormat; }, - _convertEntitiesToDocSection(entities: TypeDocNode[], docsInfo: DocsInfo, sectionName: string): DocSection { + _convertEntitiesToDocSection( + entities: TypeDocNode[], + docsInfo: DocsInfo, + sectionName: string, + isClassOrObjectLiteral: boolean = false, + ): DocSection { const docSection: DocSection = { comment: '', constructors: [], @@ -194,6 +205,32 @@ export const typeDocUtils = { } break; + case KindString.Variable: + if (isClassOrObjectLiteral) { + // Render as a property + const property = typeDocUtils._convertProperty( + entity, + docsInfo.sections, + sectionName, + docsInfo.id, + ); + docSection.properties.push(property); + } else { + // Otherwise, render as a type + const customType = typeDocUtils._convertCustomType( + entity, + docsInfo.sections, + sectionName, + docsInfo.id, + ); + const seenTypeNames = _.map(docSection.types, t => t.name); + const isUnseen = !_.includes(seenTypeNames, customType.name); + if (isUnseen) { + docSection.types.push(customType); + } + } + break; + case KindString.Interface: case KindString.Variable: case KindString.Enumeration: @@ -221,6 +258,7 @@ export const typeDocUtils = { throw errorUtils.spawnSwitchErr('kindString', entity.kindString); } }); + console.log('docSection', docSection); return docSection; }, _convertCustomType(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): CustomType { -- cgit From 9337d207a1f4d5c28b42d1364a2a8bdc0dc841cf Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 19:41:55 +0200 Subject: Stop exporting constants from order-utils --- packages/order-utils/src/index.ts | 1 - packages/order-utils/test/order_hash_test.ts | 4 +++- packages/website/ts/redux/reducer.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index c685a94e2..85d26de81 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -1,6 +1,5 @@ export { orderHashUtils } from './order_hash'; export { signatureUtils } from './signature_utils'; -export { constants } from './constants'; export { generatePseudoRandomSalt } from './salt'; export { OrderError, diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts index 0a6be83d0..3fdbbad21 100644 --- a/packages/order-utils/test/order_hash_test.ts +++ b/packages/order-utils/test/order_hash_test.ts @@ -3,7 +3,9 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; -import { constants, orderHashUtils } from '../src'; +import { orderHashUtils } from '../src'; + +import { constants } from '../src/constants'; import { chaiSetup } from './utils/chai_setup'; diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts index caddabcf0..15f118813 100644 --- a/packages/website/ts/redux/reducer.ts +++ b/packages/website/ts/redux/reducer.ts @@ -1,4 +1,4 @@ -import { constants, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { generatePseudoRandomSalt } from '@0xproject/order-utils'; import { ECSignature } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; @@ -16,6 +16,7 @@ import { } from 'ts/types'; import { Translate } from 'ts/utils/translate'; import { utils } from 'ts/utils/utils'; +import { constants } from 'ts/utils/constants'; // Instead of defaulting the docs version to an empty string, we pre-populate it with // a valid version value. This does not need to be updated however, since onLoad, it -- cgit From d9f09b5e1e7ecc8dc56ac7184cfc0152b3c2ff32 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 19:45:09 +0200 Subject: Make rendering of individually exported functions lighter-weight --- packages/react-docs/src/components/documentation.tsx | 10 +++++++++- packages/react-docs/src/docs_info.ts | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 4f776b237..5393652d4 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -211,6 +211,14 @@ export class Documentation extends React.Component { return ( @@ -279,7 +287,7 @@ export class Documentation extends React.Component -

Functions

+ {!isExportedFunctionSection &&

Functions

}
{functionDefs}
)} diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index 0637f3e65..36a6a7301 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -52,10 +52,20 @@ export class DocsInfo { return; // no-op } + const isExportedFunctionSection = + docSection.functions.length === 1 && + _.isEmpty(docSection.types) && + _.isEmpty(docSection.methods) && + _.isEmpty(docSection.constructors) && + _.isEmpty(docSection.properties) && + _.isEmpty(docSection.events); + if (!_.isUndefined(this.sections.types) && sectionName === this.sections.types) { const sortedTypesNames = _.sortBy(docSection.types, 'name'); const typeNames = _.map(sortedTypesNames, t => t.name); menuSubsectionsBySection[sectionName] = typeNames; + } else if (isExportedFunctionSection) { + // Noop so that we don't have the method listed underneath itself. } else { let eventNames: string[] = []; if (!_.isUndefined(docSection.events)) { @@ -76,6 +86,7 @@ export class DocsInfo { ]; } }); + console.log('menuSubsectionsBySection', menuSubsectionsBySection); return menuSubsectionsBySection; } public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } { -- cgit From 343cd05363166a7a93fca361d5547b39f3e83d99 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 21:27:01 +0200 Subject: Add missing comments --- packages/order-utils/package.json | 9 +--- ...abstract_balance_and_proxy_allowance_fetcher.ts | 17 +++++++ .../abstract_order_filled_cancelled_fetcher.ts | 15 ++++++ packages/order-utils/src/eip712_utils.ts | 28 +++++++++--- .../order-utils/src/exchange_transfer_simulator.ts | 9 ++++ packages/order-utils/src/order_state_utils.ts | 53 +++++++++++----------- packages/order-utils/src/order_validation_utils.ts | 50 ++++++++++++++++++++ .../balance_and_proxy_allowance_lazy_store.ts | 43 ++++++++++++++++++ .../src/store/order_filled_cancelled_lazy_store.ts | 45 ++++++++++++++++++ 9 files changed, 229 insertions(+), 40 deletions(-) diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index d4b04df1c..c49abfdae 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -31,14 +31,7 @@ "contracts_v2": "DummyERC20Token", "postpublish": { "assets": [], - "shouldPublishDocs": true, - "omitExports": [ - "AbstractBalanceAndProxyAllowanceFetcher", - "AbstractOrderFilledCancelledFetcher", - "BalanceAndProxyAllowanceLazyStore", - "OrderFilledCancelledLazyStore", - "ExchangeTransferSimulator" - ] + "shouldPublishDocs": true } }, "license": "Apache-2.0", diff --git a/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts b/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts index b2760d98e..7cb859ca7 100644 --- a/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts +++ b/packages/order-utils/src/abstract/abstract_balance_and_proxy_allowance_fetcher.ts @@ -1,6 +1,23 @@ import { BigNumber } from '@0xproject/utils'; +/**l + * An abstract class to be implemented in order to use OrderStateUtils. The class that + * implements this interface must be capable of fetching the balance and proxyAllowance + * for an Ethereum address and assetData + */ export abstract class AbstractBalanceAndProxyAllowanceFetcher { + /** + * Get balance of assetData for userAddress + * @param assetData AssetData for which to fetch the balance + * @param userAddress Ethereum address for which to fetch the balance + * @return Balance amount in base units + */ public abstract async getBalanceAsync(assetData: string, userAddress: string): Promise; + /** + * Get the 0x asset proxy allowance of assetData for userAddress + * @param assetData AssetData for which to fetch the allowance + * @param userAddress Ethereum address for which to fetch the allowance + * @return Allowance amount in base units + */ public abstract async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise; } diff --git a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts index 865ea4e43..d2b01c359 100644 --- a/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts +++ b/packages/order-utils/src/abstract/abstract_order_filled_cancelled_fetcher.ts @@ -1,7 +1,22 @@ import { BigNumber } from '@0xproject/utils'; +/**l + * An abstract class to be implemented in order to use OrderStateUtils. The class that + * implements this interface must be capable of fetching the amount filled of an order + * and whether it's been cancelled. + */ export abstract class AbstractOrderFilledCancelledFetcher { + /** + * Get the amount of the order's takerToken amount already filled + * @param orderHash OrderHash of order we are interested in + * @return FilledTakerAmount + */ public abstract async getFilledTakerAmountAsync(orderHash: string): Promise; + /** + * Whether an order is cancelled + * @param orderHash OrderHash of order we are interested in + * @return Whether or not the order is cancelled + */ public abstract async isOrderCancelledAsync(orderHash: string): Promise; public abstract getZRXAssetData(): string; } diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts index 2594e6d6d..c7b20f824 100644 --- a/packages/order-utils/src/eip712_utils.ts +++ b/packages/order-utils/src/eip712_utils.ts @@ -40,15 +40,37 @@ export const EIP712Utils = { const messageBuff = crypto.solSHA3([EIP191_PREFIX, domainSeparatorHashBuffer, hashStruct]); return messageBuff; }, + /** + * Pad an address to 32 bytes + * @param address Address to pad + * @return padded address + */ pad32Address(address: string): Buffer { const addressBuffer = ethUtil.toBuffer(address); const addressPadded = EIP712Utils.pad32Buffer(addressBuffer); return addressPadded; }, + /** + * Pad an buffer to 32 bytes + * @param buffer Address to pad + * @return padded buffer + */ pad32Buffer(buffer: Buffer): Buffer { const bufferPadded = ethUtil.setLengthLeft(buffer, EIP712_VALUE_LENGTH); return bufferPadded; }, + /** + * Hash together a EIP712 schema with the corresponding data + * @param schema EIP712-compliant schema + * @param data Data the complies to the schema + * @return A buffer containing the SHA256 hash of the schema and encoded data + */ + structHash(schema: EIP712Schema, data: { [key: string]: any }): Buffer { + const encodedData = EIP712Utils._encodeData(schema, data); + const schemaHash = EIP712Utils.compileSchema(schema); + const hashBuffer = crypto.solSHA3([schemaHash, ...encodedData]); + return hashBuffer; + }, _getDomainSeparatorSchemaBuffer(): Buffer { return EIP712Utils.compileSchema(EIP712_DOMAIN_SCHEMA); }, @@ -84,10 +106,4 @@ export const EIP712Utils = { } return encodedValues; }, - structHash(schema: EIP712Schema, data: { [key: string]: any }): Buffer { - const encodedData = EIP712Utils._encodeData(schema, data); - const schemaHash = EIP712Utils.compileSchema(schema); - const hashBuffer = crypto.solSHA3([schemaHash, ...encodedData]); - return hashBuffer; - }, }; diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts index c3a4f9c2a..81c849c64 100644 --- a/packages/order-utils/src/exchange_transfer_simulator.ts +++ b/packages/order-utils/src/exchange_transfer_simulator.ts @@ -33,6 +33,10 @@ const ERR_MSG_MAPPING = { }, }; +/** + * An exchange transfer simulator which simulates asset transfers exactly how the + * 0x exchange contract would do them. + */ export class ExchangeTransferSimulator { private readonly _store: AbstractBalanceAndProxyAllowanceLazyStore; private static _throwValidationError( @@ -43,6 +47,11 @@ export class ExchangeTransferSimulator { const errMsg = ERR_MSG_MAPPING[failureReason][tradeSide][transferType]; throw new Error(errMsg); } + /** + * Instantiate a ExchangeTransferSimulator + * @param store A class that implements AbstractBalanceAndProxyAllowanceLazyStore + * @return an instance of ExchangeTransferSimulator + */ constructor(store: AbstractBalanceAndProxyAllowanceLazyStore) { this._store = store; } diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index 189bf4180..cb08c5ae2 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -91,6 +91,14 @@ export class OrderStateUtils { throw new Error(ExchangeContractErrs.OrderFillRoundingError); } } + /** + * Instantiate OrderStateUtils + * @param balanceAndProxyAllowanceFetcher A class that is capable of fetching balances + * and proxyAllowances for Ethereum addresses. It must implement AbstractBalanceAndProxyAllowanceFetcher + * @param orderFilledCancelledFetcher A class that is capable of fetching whether an order + * is cancelled and how much of it has been filled. It must implement AbstractOrderFilledCancelledFetcher + * @return Instance of OrderStateUtils + */ constructor( balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher, orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher, @@ -98,6 +106,14 @@ export class OrderStateUtils { this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } + /** + * Get the orderState for an "open" order (i.e where takerAddress=NULL_ADDRESS) + * This method will only check the maker's balance/allowance to calculate the + * OrderState. + * @param signedOrder The order of interest + * @return State relevant to the signedOrder, as well as whether the signedOrder is "valid". + * Validity is defined as a non-zero amount of the order can still be filled. + */ public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise { const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder); const orderHash = orderHashUtils.getOrderHashHex(signedOrder); @@ -127,6 +143,11 @@ export class OrderStateUtils { return orderState; } } + /** + * Get state relevant to an order (i.e makerBalance, makerAllowance, filledTakerAssetAmount, etc... + * @param signedOrder Order of interest + * @return An instance of OrderRelevantState + */ public async getOpenOrderRelevantStateAsync(signedOrder: SignedOrder): Promise { const isMaker = true; const sidedOrderRelevantState = await this._getSidedOrderRelevantStateAsync( @@ -149,6 +170,12 @@ export class OrderStateUtils { }; return orderRelevantState; } + /** + * Get the max amount of the supplied order's takerAmount that could still be filled + * @param signedOrder Order of interest + * @param takerAddress Hypothetical taker of the order + * @return fillableTakerAssetAmount + */ public async getMaxFillableTakerAssetAmountAsync( signedOrder: SignedOrder, takerAddress: string, @@ -181,32 +208,6 @@ export class OrderStateUtils { return fillableTakerAssetAmount; } - public async getMaxFillableTakerAssetAmountForFailingOrderAsync( - signedOrder: SignedOrder, - takerAddress: string, - ): Promise { - // Get min of taker balance & allowance - const takerAssetBalanceOfTaker = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync( - signedOrder.takerAssetData, - takerAddress, - ); - const takerAssetAllowanceOfTaker = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync( - signedOrder.takerAssetData, - takerAddress, - ); - const minTakerAssetAmount = BigNumber.min([takerAssetBalanceOfTaker, takerAssetAllowanceOfTaker]); - - // get remainingFillAmount - const orderHash = orderHashUtils.getOrderHashHex(signedOrder); - const filledTakerAssetAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); - const remainingFillTakerAssetAmount = signedOrder.takerAssetAmount.minus(filledTakerAssetAmount); - - if (minTakerAssetAmount.gte(remainingFillTakerAssetAmount)) { - return remainingFillTakerAssetAmount; - } else { - return minTakerAssetAmount; - } - } private async _getSidedOrderRelevantStateAsync( isMakerSide: boolean, signedOrder: SignedOrder, diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts index ccc6e653f..972e6f6d6 100644 --- a/packages/order-utils/src/order_validation_utils.ts +++ b/packages/order-utils/src/order_validation_utils.ts @@ -12,8 +12,18 @@ import { orderHashUtils } from './order_hash'; import { signatureUtils } from './signature_utils'; import { utils } from './utils'; +/** + * A utility class for validating orders + */ export class OrderValidationUtils { private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher; + /** + * A Typescript implementation mirroring the implementation of isRoundingError in the + * Exchange smart contract + * @param numerator Numerator value. When used to check an order, pass in `takerAssetFilledAmount` + * @param denominator Denominator value. When used to check an order, pass in `order.takerAssetAmount` + * @param target Target value. When used to check an order, pass in `order.makerAssetAmount` + */ public static isRoundingError(numerator: BigNumber, denominator: BigNumber, target: BigNumber): boolean { // Solidity's mulmod() in JS // Source: https://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions @@ -31,6 +41,15 @@ export class OrderValidationUtils { const isError = errPercentageTimes1000000.gt(1000); return isError; } + /** + * Validate that the maker & taker have sufficient balances/allowances + * to fill the supplied order to the fillTakerAssetAmount amount + * @param exchangeTradeEmulator ExchangeTradeEmulator to use + * @param signedOrder SignedOrder to test + * @param fillTakerAssetAmount Amount of takerAsset to fill the signedOrder + * @param senderAddress Sender of the fillOrder tx + * @param zrxAssetData AssetData for the ZRX token + */ public static async validateFillOrderBalancesAllowancesThrowIfInvalidAsync( exchangeTradeEmulator: ExchangeTransferSimulator, signedOrder: SignedOrder, @@ -104,9 +123,22 @@ export class OrderValidationUtils { throw new Error(RevertReason.OrderUnfillable); } } + /** + * Instantiate OrderValidationUtils + * @param orderFilledCancelledFetcher A module that implements the AbstractOrderFilledCancelledFetcher + * @return An instance of OrderValidationUtils + */ constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher) { this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; } + /** + * Validate if the supplied order is fillable, and throw if it isn't + * @param exchangeTradeEmulator ExchangeTradeEmulator instance + * @param signedOrder SignedOrder of interest + * @param zrxAssetData ZRX assetData + * @param expectedFillTakerTokenAmount If supplied, this call will make sure this amount is fillable. + * If it isn't supplied, we check if the order is fillable for a non-zero amount + */ public async validateOrderFillableOrThrowAsync( exchangeTradeEmulator: ExchangeTransferSimulator, signedOrder: SignedOrder, @@ -132,6 +164,15 @@ export class OrderValidationUtils { zrxAssetData, ); } + /** + * Validate a call to FillOrder and throw if it wouldn't succeed + * @param exchangeTradeEmulator ExchangeTradeEmulator to use + * @param provider Web3 provider to use for JSON RPC requests + * @param signedOrder SignedOrder of interest + * @param fillTakerAssetAmount Amount we'd like to fill the order for + * @param takerAddress The taker of the order + * @param zrxAssetData ZRX asset data + */ public async validateFillOrderThrowIfInvalidAsync( exchangeTradeEmulator: ExchangeTransferSimulator, provider: Provider, @@ -187,6 +228,15 @@ export class OrderValidationUtils { } return filledTakerTokenAmount; } + /** + * Validate a call to fillOrKillOrder and throw if it would fail + * @param exchangeTradeEmulator ExchangeTradeEmulator to use + * @param provider Web3 provider to use for JSON RPC requests + * @param signedOrder SignedOrder of interest + * @param fillTakerAssetAmount Amount we'd like to fill the order for + * @param takerAddress The taker of the order + * @param zrxAssetData ZRX asset data + */ public async validateFillOrKillOrderThrowIfInvalidAsync( exchangeTradeEmulator: ExchangeTransferSimulator, provider: Provider, diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts index 5a2c1d7ff..8a65178b0 100644 --- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts +++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts @@ -21,11 +21,21 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx [userAddress: string]: BigNumber; }; }; + /** + * Instantiates a BalanceAndProxyAllowanceLazyStore + * @param balanceAndProxyAllowanceFetcher Class the implements the AbstractBalanceAndProxyAllowanceFetcher + * @return Instance of BalanceAndProxyAllowanceLazyStore + */ constructor(balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher) { this._balanceAndProxyAllowanceFetcher = balanceAndProxyAllowanceFetcher; this._balance = {}; this._proxyAllowance = {}; } + /** + * Get a users balance of an asset + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public async getBalanceAsync(assetData: string, userAddress: string): Promise { if (_.isUndefined(this._balance[assetData]) || _.isUndefined(this._balance[assetData][userAddress])) { const balance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, userAddress); @@ -34,12 +44,22 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx const cachedBalance = this._balance[assetData][userAddress]; return cachedBalance; } + /** + * Set the balance of an asset for a user + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public setBalance(assetData: string, userAddress: string, balance: BigNumber): void { if (_.isUndefined(this._balance[assetData])) { this._balance[assetData] = {}; } this._balance[assetData][userAddress] = balance; } + /** + * Clear the balance of an asset for a user + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public deleteBalance(assetData: string, userAddress: string): void { if (!_.isUndefined(this._balance[assetData])) { delete this._balance[assetData][userAddress]; @@ -48,6 +68,11 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx } } } + /** + * Get the 0x asset proxy allowance + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise { if ( _.isUndefined(this._proxyAllowance[assetData]) || @@ -62,12 +87,22 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx const cachedProxyAllowance = this._proxyAllowance[assetData][userAddress]; return cachedProxyAllowance; } + /** + * Set the 0x asset proxy allowance + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public setProxyAllowance(assetData: string, userAddress: string, proxyAllowance: BigNumber): void { if (_.isUndefined(this._proxyAllowance[assetData])) { this._proxyAllowance[assetData] = {}; } this._proxyAllowance[assetData][userAddress] = proxyAllowance; } + /** + * Clear the 0x asset proxy allowance + * @param assetData AssetData of interest + * @param userAddress Ethereum address of interest + */ public deleteProxyAllowance(assetData: string, userAddress: string): void { if (!_.isUndefined(this._proxyAllowance[assetData])) { delete this._proxyAllowance[assetData][userAddress]; @@ -76,6 +111,11 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx } } } + /** + * Clear all ERC721 0x proxy allowances a user has on all items of a specific ERC721 contract + * @param tokenAddress ERc721 token address + * @param userAddress Owner Ethereum address + */ public deleteAllERC721ProxyAllowance(tokenAddress: string, userAddress: string): void { for (const assetData in this._proxyAllowance) { if (this._proxyAllowance.hasOwnProperty(assetData)) { @@ -90,6 +130,9 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx } } } + /** + * Delete all balances & allowances + */ public deleteAll(): void { this._balance = {}; this._proxyAllowance = {}; diff --git a/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts b/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts index 336c6d0ba..6155c2064 100644 --- a/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts +++ b/packages/order-utils/src/store/order_filled_cancelled_lazy_store.ts @@ -15,11 +15,21 @@ export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancell private _isCancelled: { [orderHash: string]: boolean; }; + /** + * Instantiate a OrderFilledCancelledLazyStore + * @param orderFilledCancelledFetcher Class instance that implements the AbstractOrderFilledCancelledFetcher + * @returns An instance of OrderFilledCancelledLazyStore + */ constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher) { this._orderFilledCancelledFetcher = orderFilledCancelledFetcher; this._filledTakerAmount = {}; this._isCancelled = {}; } + /** + * Get the filledTakerAssetAmount of an order + * @param orderHash OrderHash from order of interest + * @return filledTakerAssetAmount + */ public async getFilledTakerAmountAsync(orderHash: string): Promise { if (_.isUndefined(this._filledTakerAmount[orderHash])) { const filledTakerAmount = await this._orderFilledCancelledFetcher.getFilledTakerAmountAsync(orderHash); @@ -28,12 +38,26 @@ export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancell const cachedFilledTakerAmount = this._filledTakerAmount[orderHash]; return cachedFilledTakerAmount; } + /** + * Set the filledTakerAssetAmount of an order + * @param orderHash OrderHash from order of interest + * @param filledTakerAmount Desired filledTakerAssetAmount + */ public setFilledTakerAmount(orderHash: string, filledTakerAmount: BigNumber): void { this._filledTakerAmount[orderHash] = filledTakerAmount; } + /** + * Clear the filledTakerAssetAmount of an order + * @param orderHash OrderHash from order of interest + */ public deleteFilledTakerAmount(orderHash: string): void { delete this._filledTakerAmount[orderHash]; } + /** + * Check if an order has been cancelled + * @param orderHash OrderHash from order of interest + * @return Whether the order has been cancelled + */ public async getIsCancelledAsync(orderHash: string): Promise { if (_.isUndefined(this._isCancelled[orderHash])) { const isCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); @@ -42,22 +66,43 @@ export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancell const cachedIsCancelled = this._isCancelled[orderHash]; // tslint:disable-line:boolean-naming return cachedIsCancelled; } + /** + * Set whether an order has been cancelled or not + * @param orderHash OrderHash from order of interest + * @param isCancelled Whether this order should be cancelled or not + */ public setIsCancelled(orderHash: string, isCancelled: boolean): void { this._isCancelled[orderHash] = isCancelled; } + /** + * Clear whether the order has been cancelled if already set + * @param orderHash OrderHash from order of interest + */ public deleteIsCancelled(orderHash: string): void { delete this._isCancelled[orderHash]; } + /** + * Clear all filled/cancelled state + */ public deleteAll(): void { this.deleteAllFilled(); this.deleteAllIsCancelled(); } + /** + * Clear all cancelled state + */ public deleteAllIsCancelled(): void { this._isCancelled = {}; } + /** + * Clear all filled state + */ public deleteAllFilled(): void { this._filledTakerAmount = {}; } + /** + * Get the ZRX assetData + */ public getZRXAssetData(): string { const zrxAssetData = this._orderFilledCancelledFetcher.getZRXAssetData(); return zrxAssetData; -- cgit From bcc1ad20869d10fb16678619e6fa411e53a07742 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 21:30:57 +0200 Subject: Re-order index.ts and add missing types --- packages/order-utils/src/index.ts | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 85d26de81..50a5106ca 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -1,6 +1,29 @@ export { orderHashUtils } from './order_hash'; export { signatureUtils } from './signature_utils'; export { generatePseudoRandomSalt } from './salt'; +export { assetDataUtils } from './asset_data_utils'; +export { EIP712Utils } from './eip712_utils'; + +export { OrderStateUtils } from './order_state_utils'; +export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; +export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; + +export { OrderValidationUtils } from './order_validation_utils'; +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 { Provider } from 'ethereum-types'; +export { + SignedOrder, + Order, + OrderRelevantState, + OrderState, + ECSignature, + ERC20AssetData, + ERC721AssetData, + AssetProxyId, +} from '@0xproject/types'; export { OrderError, MessagePrefixType, @@ -11,15 +34,3 @@ export { TradeSide, TransferType, } from './types'; -export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; -export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; -export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store'; -export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store'; -export { RemainingFillableCalculator } from './remaining_fillable_calculator'; -export { OrderStateUtils } from './order_state_utils'; -export { assetDataUtils } from './asset_data_utils'; -export { EIP712Utils } from './eip712_utils'; -export { OrderValidationUtils } from './order_validation_utils'; -export { ExchangeTransferSimulator } from './exchange_transfer_simulator'; -export { Provider } from 'ethereum-types'; -export { SignedOrder, Order, ECSignature, ERC20AssetData, ERC721AssetData, AssetProxyId } from '@0xproject/types'; -- cgit From 30be039570d6a533a339c47d068e3d4ef0f4c92a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 22:24:42 +0200 Subject: Add missing comments --- packages/order-watcher/src/order_watcher/order_watcher.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index e2d6fc270..d4c5cca4b 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -87,6 +87,12 @@ export class OrderWatcher { private readonly _cleanupJobInterval: number; private _cleanupJobIntervalIdIfExists?: NodeJS.Timer; private _callbackIfExists?: OnOrderStateChangeCallback; + /** + * Instantiate a new OrderWatcher + * @param provider Web3 provider to use for JSON RPC calls + * @param networkId NetworkId to watch orders on + * @param partialConfig Optional configurations + */ constructor( provider: Provider, networkId: number, -- cgit From f42119c9286ad70504b6f8395bcdd801a1ac52c3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 22:36:32 +0200 Subject: Add missing compiler comments --- packages/sol-compiler/src/compiler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 3620a3ec1..2503f7315 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -67,6 +67,7 @@ export class Compiler { private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER; /** * Instantiates a new instance of the Compiler class. + * @param opts Optional compiler options * @return An instance of the Compiler class. */ constructor(opts?: CompilerOptions) { -- cgit From c68e1839535e0eeb7c66e8712d1ce786d0f964df Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 22:36:44 +0200 Subject: Add missing sol-cov comments --- .../sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 5 +++++ packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts | 5 +++++ packages/sol-cov/src/trace_collection_subprovider.ts | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index 8e03bf7fd..0601c5729 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -14,6 +14,11 @@ const CONFIG_FILE = 'compiler.json'; export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { private readonly _artifactsPath: string; private readonly _sourcesPath: string; + /** + * Instantiates a SolCompilerArtifactAdapter + * @param artifactsPath Path to your artifacts directory + * @param sourcesPath Path to your contract sources directory + */ constructor(artifactsPath?: string, sourcesPath?: string) { super(); const config: CompilerOptions = fs.existsSync(CONFIG_FILE) diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts index 53b77aed5..2f76f730a 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -9,6 +9,11 @@ import { SolCompilerArtifactAdapter } from './sol_compiler_artifact_adapter'; export class TruffleArtifactAdapter extends AbstractArtifactAdapter { private readonly _solcVersion: string; private readonly _sourcesPath: string; + /** + * Instantiates a TruffleArtifactAdapter + * @param artifactsPath Path to the truffle project's artifacts directory + * @param sourcesPath Path to the truffle project's contract sources directory + */ constructor(sourcesPath: string, solcVersion: string) { super(); this._solcVersion = solcVersion; diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 5a101dfeb..91c21fe94 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -63,7 +63,7 @@ export abstract class TraceCollectionSubprovider extends Subprovider { * turn to handle a JSON RPC request. * @param payload JSON RPC payload * @param next Callback to call if this subprovider decides not to handle the request - * @param end Callback to call if subprovider handled the request and wants to pass back the request. + * @param _end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix public async handleRequest(payload: JSONRPCRequestPayload, next: NextCallback, _end: ErrorCallback): Promise { -- cgit From 6df874687150be40d5e93d7d8c0e3e191ea08982 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 22:37:02 +0200 Subject: Omit certain exports and re-org index.ts --- packages/sol-cov/package.json | 3 ++- packages/sol-cov/src/index.ts | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index ad6a6a0a2..6021435d6 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -26,7 +26,8 @@ "config": { "postpublish": { "assets": [], - "shouldPublishDocs": true + "shouldPublishDocs": true, + "omitExports": ["ProfilerSubprovider", "RevertTraceSubprovider"] } }, "repository": { diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index 35135c295..dd102a13b 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -1,10 +1,12 @@ export { CoverageSubprovider } from './coverage_subprovider'; -// HACK: ProfilerSubprovider is a hacky way to do profiling using coverage tools. Not production ready -export { ProfilerSubprovider } from './profiler_subprovider'; -export { RevertTraceSubprovider } from './revert_trace_subprovider'; export { SolCompilerArtifactAdapter } from './artifact_adapters/sol_compiler_artifact_adapter'; export { TruffleArtifactAdapter } from './artifact_adapters/truffle_artifact_adapter'; export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_adapter'; + +// HACK: ProfilerSubprovider is a hacky way to do profiling using coverage tools. Not production ready +export { ProfilerSubprovider } from './profiler_subprovider'; +export { RevertTraceSubprovider } from './revert_trace_subprovider'; + export { ContractData, TraceInfo, -- cgit From 4d75689790075f734df9a2e3b80443c85e1ddc95 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 22:42:17 +0200 Subject: Fix commebt --- packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts index 2f76f730a..dc6807cd6 100644 --- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts @@ -12,7 +12,7 @@ export class TruffleArtifactAdapter extends AbstractArtifactAdapter { /** * Instantiates a TruffleArtifactAdapter * @param artifactsPath Path to the truffle project's artifacts directory - * @param sourcesPath Path to the truffle project's contract sources directory + * @param solcVersion Solidity version with which to compile all the contracts */ constructor(sourcesPath: string, solcVersion: string) { super(); -- cgit From 7759e67a5a51a213e19083f63df13e80ea4aefa2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 4 Aug 2018 10:09:08 +0200 Subject: Rename EIP712Utils to eip712Utils since objectLiterals shouldn't start with caps --- packages/contracts/test/exchange/libs.ts | 4 ++-- packages/contracts/test/utils/transaction_factory.ts | 6 +++--- packages/order-utils/src/eip712_utils.ts | 20 ++++++++++---------- packages/order-utils/src/index.ts | 2 +- packages/order-utils/src/order_hash.ts | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts index 5c9f9aac7..6c3305d1d 100644 --- a/packages/contracts/test/exchange/libs.ts +++ b/packages/contracts/test/exchange/libs.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { assetDataUtils, EIP712Utils, orderHashUtils } from '@0xproject/order-utils'; +import { assetDataUtils, eip712Utils, orderHashUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; @@ -109,7 +109,7 @@ describe('Exchange libs', () => { describe('getDomainSeparatorSchema', () => { it('should output the correct domain separator schema hash', async () => { const domainSeparatorSchema = await libs.getDomainSeparatorSchemaHash.callAsync(); - const domainSchemaBuffer = EIP712Utils._getDomainSeparatorSchemaBuffer(); + const domainSchemaBuffer = eip712Utils._getDomainSeparatorSchemaBuffer(); const schemaHashHex = `0x${domainSchemaBuffer.toString('hex')}`; expect(schemaHashHex).to.be.equal(domainSeparatorSchema); }); diff --git a/packages/contracts/test/utils/transaction_factory.ts b/packages/contracts/test/utils/transaction_factory.ts index 281c1e30d..8465a6a30 100644 --- a/packages/contracts/test/utils/transaction_factory.ts +++ b/packages/contracts/test/utils/transaction_factory.ts @@ -1,4 +1,4 @@ -import { EIP712Schema, EIP712Types, EIP712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils'; +import { EIP712Schema, EIP712Types, eip712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils'; import { SignatureType } from '@0xproject/types'; import * as ethUtil from 'ethereumjs-util'; @@ -31,11 +31,11 @@ export class TransactionFactory { signerAddress, data, }; - const executeTransactionHashBuff = EIP712Utils.structHash( + const executeTransactionHashBuff = eip712Utils.structHash( EIP712_ZEROEX_TRANSACTION_SCHEMA, executeTransactionData, ); - const txHash = EIP712Utils.createEIP712Message(executeTransactionHashBuff, this._exchangeAddress); + const txHash = eip712Utils.createEIP712Message(executeTransactionHashBuff, this._exchangeAddress); const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType); const signedTx = { exchangeAddress: this._exchangeAddress, diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts index c7b20f824..b303c93dc 100644 --- a/packages/order-utils/src/eip712_utils.ts +++ b/packages/order-utils/src/eip712_utils.ts @@ -18,14 +18,14 @@ const EIP712_DOMAIN_SCHEMA: EIP712Schema = { ], }; -export const EIP712Utils = { +export const eip712Utils = { /** * Compiles the EIP712Schema and returns the hash of the schema. * @param schema The EIP712 schema. * @return The hash of the compiled schema */ compileSchema(schema: EIP712Schema): Buffer { - const eip712Schema = EIP712Utils._encodeType(schema); + const eip712Schema = eip712Utils._encodeType(schema); const eip712SchemaHashBuffer = crypto.solSHA3([eip712Schema]); return eip712SchemaHashBuffer; }, @@ -36,7 +36,7 @@ export const EIP712Utils = { * @return The hash of an EIP712 message with domain separator prefixed */ createEIP712Message(hashStruct: Buffer, contractAddress: string): Buffer { - const domainSeparatorHashBuffer = EIP712Utils._getDomainSeparatorHashBuffer(contractAddress); + const domainSeparatorHashBuffer = eip712Utils._getDomainSeparatorHashBuffer(contractAddress); const messageBuff = crypto.solSHA3([EIP191_PREFIX, domainSeparatorHashBuffer, hashStruct]); return messageBuff; }, @@ -47,7 +47,7 @@ export const EIP712Utils = { */ pad32Address(address: string): Buffer { const addressBuffer = ethUtil.toBuffer(address); - const addressPadded = EIP712Utils.pad32Buffer(addressBuffer); + const addressPadded = eip712Utils.pad32Buffer(addressBuffer); return addressPadded; }, /** @@ -66,17 +66,17 @@ export const EIP712Utils = { * @return A buffer containing the SHA256 hash of the schema and encoded data */ structHash(schema: EIP712Schema, data: { [key: string]: any }): Buffer { - const encodedData = EIP712Utils._encodeData(schema, data); - const schemaHash = EIP712Utils.compileSchema(schema); + const encodedData = eip712Utils._encodeData(schema, data); + const schemaHash = eip712Utils.compileSchema(schema); const hashBuffer = crypto.solSHA3([schemaHash, ...encodedData]); return hashBuffer; }, _getDomainSeparatorSchemaBuffer(): Buffer { - return EIP712Utils.compileSchema(EIP712_DOMAIN_SCHEMA); + return eip712Utils.compileSchema(EIP712_DOMAIN_SCHEMA); }, _getDomainSeparatorHashBuffer(exchangeAddress: string): Buffer { - const domainSeparatorSchemaBuffer = EIP712Utils._getDomainSeparatorSchemaBuffer(); - const encodedData = EIP712Utils._encodeData(EIP712_DOMAIN_SCHEMA, { + const domainSeparatorSchemaBuffer = eip712Utils._getDomainSeparatorSchemaBuffer(); + const encodedData = eip712Utils._encodeData(EIP712_DOMAIN_SCHEMA, { name: EIP712_DOMAIN_NAME, version: EIP712_DOMAIN_VERSION, verifyingContract: exchangeAddress, @@ -99,7 +99,7 @@ export const EIP712Utils = { } else if (parameter.type === EIP712Types.Uint256) { encodedValues.push(value); } else if (parameter.type === EIP712Types.Address) { - encodedValues.push(EIP712Utils.pad32Address(value)); + encodedValues.push(eip712Utils.pad32Address(value)); } else { throw new Error(`Unable to encode ${parameter.type}`); } diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 50a5106ca..f3b00a583 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -2,7 +2,7 @@ export { orderHashUtils } from './order_hash'; export { signatureUtils } from './signature_utils'; export { generatePseudoRandomSalt } from './salt'; export { assetDataUtils } from './asset_data_utils'; -export { EIP712Utils } from './eip712_utils'; +export { eip712Utils } from './eip712_utils'; export { OrderStateUtils } from './order_state_utils'; export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; diff --git a/packages/order-utils/src/order_hash.ts b/packages/order-utils/src/order_hash.ts index 54c500653..8e98f8767 100644 --- a/packages/order-utils/src/order_hash.ts +++ b/packages/order-utils/src/order_hash.ts @@ -3,7 +3,7 @@ import { Order, SignedOrder } from '@0xproject/types'; import * as _ from 'lodash'; import { assert } from './assert'; -import { EIP712Utils } from './eip712_utils'; +import { eip712Utils } from './eip712_utils'; import { EIP712Schema, EIP712Types } from './types'; const INVALID_TAKER_FORMAT = 'instance.takerAddress is not of a type(s) string'; @@ -69,11 +69,11 @@ export const orderHashUtils = { * @return The resulting orderHash from hashing the supplied order as a Buffer */ getOrderHashBuffer(order: SignedOrder | Order): Buffer { - const orderParamsHashBuff = EIP712Utils.structHash(EIP712_ORDER_SCHEMA, order); - const orderHashBuff = EIP712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress); + const orderParamsHashBuff = eip712Utils.structHash(EIP712_ORDER_SCHEMA, order); + const orderHashBuff = eip712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress); return orderHashBuff; }, _getOrderSchemaBuffer(): Buffer { - return EIP712Utils.compileSchema(EIP712_ORDER_SCHEMA); + return eip712Utils.compileSchema(EIP712_ORDER_SCHEMA); }, }; -- cgit From 4527e9ce000d3eafcd55552df0809ea31271ba89 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 4 Aug 2018 10:09:59 +0200 Subject: Remove prefix hack and add prefix for objectLiteral functions --- packages/react-docs/src/types.ts | 1 + packages/react-docs/src/utils/typedoc_utils.ts | 31 ++++++++++++-------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 79dfe9f4f..a34e06c94 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -124,6 +124,7 @@ export interface TypescriptMethod extends BaseMethod { export interface TypescriptFunction extends BaseFunction { source?: Source; typeParameter?: TypeParameter; + callPath: string; } export interface SolidityMethod extends BaseMethod { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 2eee2fa59..b1d9850ef 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -173,6 +173,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + isClassOrObjectLiteral, ); docSection.functions.push(func); } @@ -331,7 +332,7 @@ export const typeDocUtils = { const commentIfExists = !_.isUndefined(entity.comment) ? entity.comment.shortText : undefined; const isConstructor = false; const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; - const callPath = typeDocUtils._getCallPath(sectionName, sections, isStatic, isConstructor, docId, entity.name); + const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); const property = { name: entity.name, type: typeDocUtils._convertType(entity.type, sections, sectionName, docId), @@ -367,7 +368,7 @@ export const typeDocUtils = { ? undefined : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId); - const callPath = typeDocUtils._getCallPath(sectionName, sections, isStatic, isConstructor, docId, entity.name); + const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); const method = { isConstructor, isStatic, @@ -385,28 +386,16 @@ export const typeDocUtils = { }; return method; }, - _getCallPath( - sectionName: string, - sections: SectionsMap, - isStatic: boolean, - isConstructor: boolean, - docId: string, - entityName: string, - ) { + _getCallPath(sectionName: string, isStatic: boolean, isConstructor: boolean, entityName: string) { // HACK: we use the fact that the sectionName is the same as the property name at the top-level // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. let callPath; if (isConstructor || entityName === '__type') { callPath = ''; // TODO: Get rid of this 0x-specific logic - } else if (docId === 'ZERO_EX_JS') { - const topLevelInterface = isStatic ? 'ZeroEx.' : 'zeroEx.'; - callPath = - !_.isUndefined(sections.zeroEx) && sectionName !== sections.zeroEx - ? `${topLevelInterface}${sectionName}.` - : topLevelInterface; } else { - callPath = `${sectionName}.`; + const prefix = isStatic ? sectionName : `${sectionName[0].toLowerCase()}${sectionName.slice(1)}`; + callPath = `${prefix}.`; } return callPath; }, @@ -415,6 +404,7 @@ export const typeDocUtils = { sections: SectionsMap, sectionName: string, docId: string, + isObjectLiteral: boolean, ): TypescriptFunction { const signature = entity.signatures[0]; const source = entity.sources[0]; @@ -428,10 +418,17 @@ export const typeDocUtils = { ? undefined : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId); + let callPath = ''; + if (isObjectLiteral) { + const isConstructor = false; + const isStatic = false; + callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); + } const func = { name: signature.name, comment: hasComment ? signature.comment.shortText : undefined, returnComment: hasComment && signature.comment.returns ? signature.comment.returns : undefined, + callPath, source: { fileName: source.fileName, line: source.line, -- cgit From ff3c77f7c47475d77defecfeb894a8c86c003997 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:48:18 -0400 Subject: Remove stray console.lgos --- packages/react-docs/src/docs_info.ts | 1 - packages/react-docs/src/utils/typedoc_utils.ts | 4 ---- packages/react-shared/src/utils/utils.ts | 1 - 3 files changed, 6 deletions(-) diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index 36a6a7301..4267d8a98 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -86,7 +86,6 @@ export class DocsInfo { ]; } }); - console.log('menuSubsectionsBySection', menuSubsectionsBySection); return menuSubsectionsBySection; } public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index b1d9850ef..01385c982 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -259,7 +259,6 @@ export const typeDocUtils = { throw errorUtils.spawnSwitchErr('kindString', entity.kindString); } }); - console.log('docSection', docSection); return docSection; }, _convertCustomType(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): CustomType { @@ -352,9 +351,6 @@ export const typeDocUtils = { sectionName: string, docId: string, ): TypescriptMethod { - if (_.isUndefined(entity.signatures)) { - console.log(entity); - } const signature = entity.signatures[0]; const source = entity.sources[0]; const hasComment = !_.isUndefined(signature.comment); diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 6dd0b9993..ce7effaff 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -48,7 +48,6 @@ export const utils = { let finalText = charArray.join(''); const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; _.each(exceptions, (spaced, normal) => { - console.log(finalText, spaced, normal); if (_.includes(finalText, spaced)) { finalText = finalText.replace(spaced, normal); } -- cgit From da304de3fc732bd7b5df0c313887627a10958a5b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:48:45 -0400 Subject: Re-order deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f50e58b6..896c12fdf 100644 --- a/package.json +++ b/package.json @@ -38,11 +38,11 @@ "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic" }, "devDependencies": { + "@0x-lerna-fork/lerna": "3.0.0-beta.23", "async-child-process": "^1.1.1", "coveralls": "^3.0.0", "ganache-cli": "6.1.3", "lcov-result-merger": "^3.0.0", - "@0x-lerna-fork/lerna": "3.0.0-beta.23", "npm-run-all": "^4.1.2", "prettier": "^1.11.1", "source-map-support": "^0.5.6", -- cgit From 50e0ddcf799319d1ed963a646ab74e078810ebe6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:49:02 -0400 Subject: Update dep --- packages/website/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/package.json b/packages/website/package.json index fda724fc8..1bc2d94f8 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -21,7 +21,7 @@ "@0xproject/contract-wrappers": "^0.0.5", "@0xproject/order-utils": "^0.0.9", "@0xproject/react-docs": "^1.0.4", - "@0xproject/react-shared": "^0.2.3", + "@0xproject/react-shared": "^1.0.5", "@0xproject/subproviders": "^1.0.4", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.3", -- cgit From d234ee12debc816c52b4f47fa4f2c900edfebb04 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:49:11 -0400 Subject: Update yarn.lock --- yarn.lock | 157 ++++++-------------------------------------------------------- 1 file changed, 13 insertions(+), 144 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9b8462257..5a77b4aec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -690,27 +690,6 @@ ethers "3.0.22" lodash "4.17.10" -"@0xproject/react-shared@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@0xproject/react-shared/-/react-shared-0.2.3.tgz#f0403b9b7f1cfbe2853b53cc983ebb13ee8753a5" - dependencies: - "@types/lodash" "4.14.104" - "@types/material-ui" "0.18.0" - "@types/node" "9.6.0" - "@types/react" "16.3.13" - "@types/react-dom" "16.0.4" - "@types/react-scroll" "0.0.31" - basscss "8.0.4" - is-mobile "0.2.2" - lodash "4.17.10" - material-ui "0.17.4" - react "15.6.1" - react-dom "15.6.1" - react-highlight "0xproject/react-highlight" - react-markdown "3.2.2" - react-scroll "1.7.7" - react-tap-event-plugin "2.0.1" - "@0xproject/sol-compiler@^0.5.3", "@0xproject/sol-compiler@^0.5.4": version "0.5.4" resolved "https://registry.yarnpkg.com/@0xproject/sol-compiler/-/sol-compiler-0.5.4.tgz#3e0b04b0c02c5ec046ebb962b5ed20978c6b4cdd" @@ -1107,13 +1086,6 @@ "@types/node" "*" "@types/react" "*" -"@types/react-dom@16.0.4": - version "16.0.4" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.4.tgz#2e8fd45f5443780ed49bf2cdd9809e6091177a7d" - dependencies: - "@types/node" "*" - "@types/react" "*" - "@types/react-dom@^16.0.3": version "16.0.5" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.5.tgz#a757457662e3819409229e8f86795ff37b371f96" @@ -1143,12 +1115,6 @@ "@types/history" "*" "@types/react" "*" -"@types/react-scroll@0.0.31": - version "0.0.31" - resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-0.0.31.tgz#1bb26bfd9f595da6403c2f13c2f9a3ed4d2929fa" - dependencies: - "@types/react" "*" - "@types/react-scroll@1.5.3": version "1.5.3" resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-1.5.3.tgz#cc4e94db3d7d5b1cd244bfee24091c335d3e2598" @@ -2446,7 +2412,7 @@ basscss-typography@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/basscss-typography/-/basscss-typography-3.0.4.tgz#ec946a2bad8dd1af97be9ea108ad4bb7be932464" -basscss@8.0.4, basscss@^8.0.3: +basscss@^8.0.3: version "8.0.4" resolved "https://registry.yarnpkg.com/basscss/-/basscss-8.0.4.tgz#b371a2ce25aeb9b322302f37f4e425753dd29ae1" dependencies: @@ -3870,25 +3836,6 @@ css-loader@0.23.x: postcss-modules-values "^1.1.0" source-list-map "^0.1.4" -css-loader@^0.28.9: - version "0.28.11" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.11.tgz#c3f9864a700be2711bb5a2462b2389b1a392dab7" - dependencies: - babel-code-frame "^6.26.0" - css-selector-tokenizer "^0.7.0" - cssnano "^3.10.0" - icss-utils "^2.1.0" - loader-utils "^1.0.2" - lodash.camelcase "^4.3.0" - object-assign "^4.1.1" - postcss "^5.0.6" - postcss-modules-extract-imports "^1.2.0" - postcss-modules-local-by-default "^1.2.0" - postcss-modules-scope "^1.1.0" - postcss-modules-values "^1.3.0" - postcss-value-parser "^3.3.0" - source-list-map "^2.0.0" - css-selector-tokenizer@^0.5.1: version "0.5.4" resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.5.4.tgz#139bafd34a35fd0c1428487049e0699e6f6a2c21" @@ -3916,7 +3863,7 @@ cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" -"cssnano@>=2.6.1 <4", cssnano@^3.10.0: +"cssnano@>=2.6.1 <4": version "3.10.0" resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38" dependencies: @@ -6717,12 +6664,6 @@ icss-replace-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" -icss-utils@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-2.1.0.tgz#83f0a0ec378bf3246178b6c2ad9136f135b1c962" - dependencies: - postcss "^6.0.1" - ieee754@^1.1.4: version "1.1.11" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.11.tgz#c16384ffe00f5b7835824e67b6f2bd44a5229455" @@ -7131,7 +7072,7 @@ is-installed-globally@^0.1.0: global-dirs "^0.1.0" is-path-inside "^1.0.0" -is-mobile@0.2.2, is-mobile@^0.2.2: +is-mobile@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/is-mobile/-/is-mobile-0.2.2.tgz#0e2e006d99ed2c2155b761df80f2a3619ae2ad9f" @@ -8031,10 +7972,6 @@ lodash.camelcase@^3.0.1: dependencies: lodash._createcompounder "^3.0.0" -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - lodash.deburr@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash.deburr/-/lodash.deburr-3.2.0.tgz#6da8f54334a366a7cf4c4c76ef8d80aa1b365ed5" @@ -8324,7 +8261,7 @@ marked@^0.3.12: version "0.3.19" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" -material-ui@0.17.4, material-ui@^0.17.1: +material-ui@^0.17.1: version "0.17.4" resolved "https://registry.yarnpkg.com/material-ui/-/material-ui-0.17.4.tgz#193999ecb49c3ec15ae0abb4e90fdf9a7bd343e0" dependencies: @@ -9503,17 +9440,6 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" -parse-entities@^1.0.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.2.tgz#9eaf719b29dc3bd62246b4332009072e01527777" - dependencies: - character-entities "^1.0.0" - character-entities-legacy "^1.0.0" - character-reference-invalid "^1.0.0" - is-alphanumerical "^1.0.0" - is-decimal "^1.0.0" - is-hexadecimal "^1.0.0" - parse-entities@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.1.tgz#8112d88471319f27abae4d64964b122fe4e1b890" @@ -9890,27 +9816,21 @@ postcss-modules-extract-imports@^1.0.0: dependencies: postcss "^6.0.1" -postcss-modules-extract-imports@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.0.tgz#66140ecece38ef06bf0d3e355d69bf59d141ea85" - dependencies: - postcss "^6.0.1" - -postcss-modules-local-by-default@^1.0.1, postcss-modules-local-by-default@^1.2.0: +postcss-modules-local-by-default@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-scope@^1.0.0, postcss-modules-scope@^1.1.0: +postcss-modules-scope@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-values@^1.1.0, postcss-modules-values@^1.3.0: +postcss-modules-values@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20" dependencies: @@ -10589,16 +10509,6 @@ react-is@^16.3.1: version "16.4.0" resolved "https://registry.npmjs.org/react-is/-/react-is-16.4.0.tgz#cc9fdc855ac34d2e7d9d2eb7059bbc240d35ffcf" -react-markdown@3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-3.2.2.tgz#439774c14f25eb25d1b96c126f28ca1486fb0a24" - dependencies: - prop-types "^15.6.0" - remark-parse "^4.0.0" - unified "^6.1.5" - unist-util-visit "^1.1.3" - xtend "^4.0.1" - react-markdown@^3.2.2: version "3.3.0" resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-3.3.0.tgz#a87cdd822aa9302d6add9687961dd1a82a45d02e" @@ -10661,9 +10571,9 @@ react-scroll@0xproject/react-scroll#similar-to-pr-330: lodash.throttle "^4.1.1" prop-types "^15.5.8" -react-scroll@1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.7.tgz#948c40c9a189b62bf4a53ee0fd50e5d89d37260a" +"react-scroll@github:0xproject/react-scroll#similar-to-pr-330": + version "1.7.10" + resolved "https://codeload.github.com/0xproject/react-scroll/tar.gz/091a41f8a6fd9e94bd41b9bba27356da470cb8a5" dependencies: lodash.throttle "^4.1.1" prop-types "^15.5.8" @@ -10675,7 +10585,7 @@ react-side-effect@^1.0.2: exenv "^1.2.1" shallowequal "^1.0.1" -react-tap-event-plugin@2.0.1, react-tap-event-plugin@^2.0.1: +react-tap-event-plugin@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/react-tap-event-plugin/-/react-tap-event-plugin-2.0.1.tgz#316beb3bc6556e29ec869a7293e89c826a9074d2" dependencies: @@ -11012,26 +10922,6 @@ regjsparser@^0.1.4: dependencies: jsesc "~0.5.0" -remark-parse@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-4.0.0.tgz#99f1f049afac80382366e2e0d0bd55429dd45d8b" - dependencies: - collapse-white-space "^1.0.2" - is-alphabetical "^1.0.0" - is-decimal "^1.0.0" - is-whitespace-character "^1.0.0" - is-word-character "^1.0.0" - markdown-escapes "^1.0.0" - parse-entities "^1.0.2" - repeat-string "^1.5.4" - state-toggle "^1.0.0" - trim "0.0.1" - trim-trailing-lines "^1.0.0" - unherit "^1.0.4" - unist-util-remove-position "^1.0.0" - vfile-location "^2.0.0" - xtend "^4.0.1" - remark-parse@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" @@ -11924,14 +11814,6 @@ source-map-loader@^0.1.6: loader-utils "~0.2.2" source-map "~0.1.33" -source-map-loader@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.3.tgz#d4b0c8cd47d54edce3e6bfa0f523f452b5b0e521" - dependencies: - async "^2.5.0" - loader-utils "~0.2.2" - source-map "~0.6.1" - source-map-resolve@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" @@ -12359,13 +12241,6 @@ style-loader@0.13.x: dependencies: loader-utils "^1.0.2" -style-loader@^0.20.2: - version "0.20.3" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.20.3.tgz#ebef06b89dec491bcb1fdb3452e913a6fd1c10c4" - dependencies: - loader-utils "^1.1.0" - schema-utils "^0.4.5" - styled-components@^3.3.0: version "3.3.0" resolved "https://registry.npmjs.org/styled-components/-/styled-components-3.3.0.tgz#335b1b2b673b416cd5ec012010e237ed1f877fe9" @@ -13210,12 +13085,6 @@ unist-util-visit@^1.1.0, unist-util-visit@^1.3.0: dependencies: unist-util-is "^2.1.1" -unist-util-visit@^1.1.3: - version "1.3.1" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.3.1.tgz#c019ac9337a62486be58531bc27e7499ae7d55c7" - dependencies: - unist-util-is "^2.1.1" - universalify@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" @@ -13951,7 +13820,7 @@ webpack-dev-middleware@1.12.2, webpack-dev-middleware@^1.10.0: range-parser "^1.0.3" time-stamp "^2.0.0" -webpack-dev-server@^2.11.1, webpack-dev-server@^2.5.0: +webpack-dev-server@^2.5.0: version "2.11.2" resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-2.11.2.tgz#1f4f4c78bf1895378f376815910812daf79a216f" dependencies: @@ -13994,7 +13863,7 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@^3.1.0, webpack@^3.11.0: +webpack@^3.1.0: version "3.11.0" resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.11.0.tgz#77da451b1d7b4b117adaf41a1a93b5742f24d894" dependencies: -- cgit From a1a777e71521a2f718264edc4bd7f9b48ccb6cce Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:49:17 -0400 Subject: Add missing type --- packages/0x.js/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index d99ce68fc..5a451859a 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -64,4 +64,5 @@ export { Provider, TransactionReceipt, TransactionReceiptWithDecodedLogs, + LogTopic, } from 'ethereum-types'; -- cgit From 50bbd793c6520247629f078806226839f5b89651 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:55:19 -0400 Subject: Fix key --- packages/website/translations/chinese.json | 2 +- packages/website/translations/english.json | 2 +- packages/website/translations/korean.json | 2 +- packages/website/translations/russian.json | 2 +- packages/website/translations/spanish.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index b590861b7..ed1a6044a 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -13,7 +13,7 @@ "TRADITIONAL_ASSETS": "传统资产", "DIGITAL_GOODS": "数字商品", "OFFCHAIN_ORDER_RELAY": "链下订单中继", - "OONCHAIN_SETTLEMENT": "链上最终结算", + "ONCHAIN_SETTLEMENT": "链上最终结算", "OFFCHAIN_ONCHAIN_DESCRIPTION": "在 0x 协议中,所有订单都通过链下传输,大幅削减了损耗成本,能够有效避免区块链膨胀。任何人都可以构建中继方,由中继方广播订单,每促成一笔交易,就可以收取一笔交易费。", "RELAYERS_HEADER": "基于 0X 协议构建的中继方", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 0ae48d926..541c29997 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -14,7 +14,7 @@ "TRADITIONAL_ASSETS": "traditional assets", "DIGITAL_GOODS": "digital goods", "OFFCHAIN_ORDER_RELAY": "off-chain order relay", - "OONCHAIN_SETTLEMENT": "on-chain settlement", + "ONCHAIN_SETTLEMENT": "on-chain settlement", "OFFCHAIN_ONCHAIN_DESCRIPTION": "in 0x protocol, orders are transported off-chain, massively reducing gas costs and eliminating blockchain bloat. Relayers help broadcast orders and collect a fee each time they facilitate a trade. Anyone can build a relayer.", "RELAYERS_HEADER": "relayers building on 0x", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index f61e51e5c..8892f2dee 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -13,7 +13,7 @@ "TRADITIONAL_ASSETS": "전통적 자산", "DIGITAL_GOODS": "디지털 상품", "OFFCHAIN_ORDER_RELAY": "오프체인 주문 릴레이", - "OONCHAIN_SETTLEMENT": "온체인 정산", + "ONCHAIN_SETTLEMENT": "온체인 정산", "OFFCHAIN_ONCHAIN_DESCRIPTION": "0x 프로토콜에서 주문은 오프체인으로 전달되므로, 가스 비용이 대폭 줄고 블록체인이 불필요하게 커지지 않습니다. Relayer는 주문을 브로드캐스팅할 수 있게 해 주고, 주문에서 거래가 진행될 때마다 수수료를 받을 수 있습니다. 누구든지 Relayer를 생성할 수 있습니다.", "RELAYERS_HEADER": "0x 기반 Relayer", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index 107798a8c..41a7a990d 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -13,7 +13,7 @@ "TRADITIONAL_ASSETS": "Традиционные активы", "DIGITAL_GOODS": "Цифровые товары", "OFFCHAIN_ORDER_RELAY": "Офчейн-ордер", - "OONCHAIN_SETTLEMENT": "Ончейн-транзакция", + "ONCHAIN_SETTLEMENT": "Ончейн-транзакция", "OFFCHAIN_ONCHAIN_DESCRIPTION": "При использовании протокола 0x ордера проводятся вне блокчейна, что сокращает расходы на газ (топливо) и предотвращает раздувание блокчейна. Релейеры помогают провести ордера и берут комиссию каждый раз, когда способствуют торгам. Любой может создать релейера.", "RELAYERS_HEADER": "РЕЛЕЙЕРЫ, РАЗРАБОТАННЫЕ НА 0X", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index 3c87b2878..7780190ac 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -14,7 +14,7 @@ "TRADITIONAL_ASSETS": "activos tradicionales", "DIGITAL_GOODS": "bienes digitales", "OFFCHAIN_ORDER_RELAY": "orden retransmisión fuera de cadena", - "OONCHAIN_SETTLEMENT": "liquidación en cadena", + "ONCHAIN_SETTLEMENT": "liquidación en cadena", "OFFCHAIN_ONCHAIN_DESCRIPTION": "en el protocolo 0x, las órdenes se transportan fuera de la cadena, lo que reduce enormemente los costos de combustible y elimina el sobredimensionamiento de la cadena de bloques. Los transmisores ayudan a emitir órdenes y a cobrar un cargo cada vez que facilitan un intercambio. Cualquier persona puede crear un transmisor.", "RELAYERS_HEADER": "transmisores creados en 0x", -- cgit From ea5684e0546f25fa213dfb1a780941e4056a2128 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 11:01:12 -0400 Subject: Remove unused imports --- packages/react-docs/src/components/documentation.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 5393652d4..d9a7dcd59 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -1,9 +1,7 @@ import { - AnchorTitle, colors, constants as sharedConstants, EtherscanLinkSuffixes, - HeaderSizes, MarkdownSection, NestedSidebarMenu, Networks, @@ -28,7 +26,6 @@ import { TypescriptFunction, TypescriptMethod, } from '../types'; -import { constants } from '../utils/constants'; import { Badge } from './badge'; import { Comment } from './comment'; @@ -186,6 +183,7 @@ export class Documentation extends React.Component { return semver.lte(mdVersion, this.props.selectedVersion); }); + console.log('this.props.selectedVersion', this.props.selectedVersion); if (_.isEmpty(eligibleVersions)) { throw new Error( `No eligible markdown sections found for ${this.props.docsInfo.displayName} version ${ -- cgit From 6e122691d114d042a76e1d585a11a238a1f35f47 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 11:57:56 -0400 Subject: Fix bug related to react-scroll's scrollSpy and the render order of elements --- packages/website/ts/components/top_bar/top_bar.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index c921867d7..41b01c57b 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -1,5 +1,11 @@ import { DocsInfo, DocsMenu } from '@0xproject/react-docs'; -import { colors, MenuSubsectionsBySection, NestedSidebarMenu, Styles } from '@0xproject/react-shared'; +import { + colors, + MenuSubsectionsBySection, + NestedSidebarMenu, + Styles, + constants as sharedConstants, +} from '@0xproject/react-shared'; import * as _ from 'lodash'; import Drawer from 'material-ui/Drawer'; import Menu from 'material-ui/Menu'; @@ -409,7 +415,11 @@ export class TopBar extends React.Component { const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => { return this._doesUrlInclude(websitePath); }); - if (!isViewingDocsPage || _.isUndefined(this.props.menu)) { + // HACK: We need to make sure the SCROLL_CONTAINER is loaded before rendering the Sidebar + // because the sidebar renders `react-scroll` links which depend on the scroll container already + // being rendered. + const documentationContainer = document.getElementById(sharedConstants.SCROLL_CONTAINER_ID); + if (!isViewingDocsPage || _.isUndefined(this.props.menu) || _.isNull(documentationContainer)) { return undefined; } return ( -- cgit From 4e6322beb55302e10770c4e16bf480e17bbf27e9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:26:39 -0400 Subject: Add missing type exports --- packages/0x.js/src/index.ts | 10 ++++++++++ packages/contract-wrappers/CHANGELOG.json | 9 +++++++++ packages/contract-wrappers/src/index.ts | 1 + 3 files changed, 20 insertions(+) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 5a451859a..54b5e6928 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -26,12 +26,14 @@ export { ERC20TokenApprovalEventArgs, ERC20TokenEvents, ERC20TokenEventArgs, + ERC721TokenEventArgs, ERC721TokenApprovalEventArgs, ERC721TokenApprovalForAllEventArgs, ERC721TokenTransferEventArgs, ERC721TokenEvents, ExchangeCancelUpToEventArgs, ExchangeAssetProxyRegisteredEventArgs, + ExchangeSignatureValidatorApprovalEventArgs, ExchangeFillEventArgs, ExchangeCancelEventArgs, ExchangeEventArgs, @@ -53,6 +55,7 @@ export { ERC20AssetData, ERC721AssetData, AssetProxyId, + OrderRelevantState, } from '@0xproject/types'; export { @@ -65,4 +68,11 @@ export { TransactionReceipt, TransactionReceiptWithDecodedLogs, LogTopic, + JSONRPCRequestPayload, + JSONRPCResponsePayload, + JSONRPCErrorCallback, + TransactionReceiptStatus, + LogEntry, + DecodedLogArgs, + LogEntryEvent, } from 'ethereum-types'; diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index d9eef089f..4c12cd592 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "1.0.1-rc.3", + "changes": [ + { + "note": "Export missing ExchangeSignatureValidatorApprovalEventArgs type", + "pr": 924 + } + ] + }, { "version": "1.0.1-rc.2", "changes": [ diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index e5485d7a6..da9453640 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -74,6 +74,7 @@ export { export { ExchangeCancelUpToEventArgs, ExchangeAssetProxyRegisteredEventArgs, + ExchangeSignatureValidatorApprovalEventArgs, ExchangeFillEventArgs, ExchangeCancelEventArgs, ExchangeEventArgs, -- cgit From fdcb42d8e17f4f5f324dd644077a07cbd4be65c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:27:28 -0400 Subject: Fix bug where we only rendered one TypeDoc JSON key per export, instead of all of them --- packages/monorepo-scripts/src/utils/publish_utils.ts | 14 ++++++++------ packages/react-docs/src/utils/typedoc_utils.ts | 11 +++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 2cf67946b..709a48799 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -18,12 +18,12 @@ interface ExportInfo { exportPathOrder: string[]; } -interface ExportNameToTypedocName { - [exportName: string]: string; +interface ExportNameToTypedocNames { + [exportName: string]: string[]; } interface Metadata { - exportPathToTypedocName: ExportNameToTypedocName; + exportPathToTypedocNames: ExportNameToTypedocNames; exportPathOrder: string[]; } @@ -224,10 +224,12 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); // For each entry, see if it was exported in index.ts. If not, remove it. - const exportPathToTypedocName: ExportNameToTypedocName = {}; + const exportPathToTypedocNames: ExportNameToTypedocNames = {}; _.each(typedocOutput.children, (file, i) => { const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); - exportPathToTypedocName[exportPath] = file.name; + exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) + ? [file.name] + : [...exportPathToTypedocNames[exportPath], file.name]; const exportItems = exportPathToExportedItems[exportPath]; _.each(file.children, (child, j) => { @@ -245,7 +247,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON const docJson = { metadata: { - exportPathToTypedocName, + exportPathToTypedocNames, exportPathOrder, }, typedocJson: finalTypeDocOutput, diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 01385c982..9ee1de2b4 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -60,14 +60,16 @@ export const typeDocUtils = { }, convertToDocAgnosticFormat(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo): DocAgnosticFormat { const exportPathOrder = generatedDocJson.metadata.exportPathOrder; - const exportPathToTypedocName = generatedDocJson.metadata.exportPathToTypedocName; + const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; const typeDocJson = generatedDocJson.typedocJson; // TODO: Extract the non typeDoc exports, and render them somehow const typeDocNameOrder = _.compact( - _.map(exportPathOrder, exportPath => { - return exportPathToTypedocName[exportPath]; - }), + _.flatten( + _.map(exportPathOrder, exportPath => { + return exportPathToTypedocNames[exportPath]; + }), + ), ); const docAgnosticFormat: DocAgnosticFormat = {}; @@ -121,6 +123,7 @@ export const typeDocUtils = { }); }); if (!_.isEmpty(typeEntities)) { + console.log('typeEntities', typeEntities); docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; const docSection = typeDocUtils._convertEntitiesToDocSection( -- cgit From af90a777c6d6cdd59b4d398b6b0f5051047bc5d3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:27:39 -0400 Subject: Update types --- packages/react-docs/src/types.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index a34e06c94..18c386a2b 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -292,12 +292,12 @@ export enum AbiTypes { Event = 'event', } -export interface ExportNameToTypedocName { - [exportName: string]: string; +export interface ExportNameToTypedocNames { + [exportName: string]: string[]; } export interface Metadata { - exportPathToTypedocName: ExportNameToTypedocName; + exportPathToTypedocNames: ExportNameToTypedocNames; exportPathOrder: string[]; } -- cgit From 6182d2c7f60967a978f2b885e63fab067794b452 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:28:21 -0400 Subject: Pass in typeDefinitionByName so that type declarations also link to inner-types and show the popover --- packages/react-docs/src/components/documentation.tsx | 13 +++++++++++-- packages/react-docs/src/components/interface.tsx | 19 ++++++++++++++++--- packages/react-docs/src/components/property_block.tsx | 10 ++++++++-- packages/react-docs/src/components/type.tsx | 8 +++++++- .../react-docs/src/components/type_definition.tsx | 12 ++++++++++-- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index d9a7dcd59..1c32b2e16 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -225,12 +225,16 @@ export class Documentation extends React.Component ); }); const sortedProperties = _.sortBy(docSection.properties, 'name'); - const propertyDefs = _.map(sortedProperties, this._renderProperty.bind(this, sectionName)); + const propertyDefs = _.map( + sortedProperties, + this._renderProperty.bind(this, sectionName, typeDefinitionByName), + ); const sortedMethods = _.sortBy(docSection.methods, 'name'); const methodDefs = _.map(sortedMethods, method => { @@ -349,7 +353,11 @@ export class Documentation extends React.Component{constructorDefs}; } - private _renderProperty(sectionName: string, property: Property): React.ReactNode { + private _renderProperty( + sectionName: string, + typeDefinitionByName: TypeDefinitionByName, + property: Property, + ): React.ReactNode { return ( ); } diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index 915b4bbc6..eaf57ce93 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -2,7 +2,7 @@ import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType } from '../types'; +import { CustomType, TypeDefinitionByName } from '../types'; import { Signature } from './signature'; import { Type } from './type'; @@ -11,6 +11,7 @@ export interface InterfaceProps { type: CustomType; sectionName: string; docsInfo: DocsInfo; + typeDefinitionByName: TypeDefinitionByName; } export const Interface = (props: InterfaceProps) => { @@ -29,9 +30,15 @@ export const Interface = (props: InterfaceProps) => { shouldHideMethodName={true} shouldUseArrowSyntax={true} docsInfo={props.docsInfo} + typeDefinitionByName={props.typeDefinitionByName} /> ) : ( - + )},
); @@ -41,7 +48,13 @@ export const Interface = (props: InterfaceProps) => { const is = type.indexSignature; const param = ( - {is.keyName}: + {is.keyName}:{' '} + ); properties.push( diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index ea80ba7b7..6e5c451be 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -2,7 +2,7 @@ import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { Property } from '../types'; +import { Property, TypeDefinitionByName } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; @@ -15,6 +15,7 @@ export interface PropertyBlockProps { docsInfo: DocsInfo; sourceUrl: string; selectedVersion: string; + typeDefinitionByName: TypeDefinitionByName; } export interface PropertyBlockState { @@ -50,7 +51,12 @@ export class PropertyBlock extends React.Component {(property as any).callPath} {property.name}:{' '} - + {property.source && ( {is.keyName}:{' '} - +
); typeName = ( @@ -222,6 +227,7 @@ export function Type(props: TypeProps): any { customType={typeDefinition} shouldAddId={false} docsInfo={props.docsInfo} + typeDefinitionByName={props.typeDefinitionByName} /> diff --git a/packages/react-docs/src/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx index 26fbbf75c..775d9890f 100644 --- a/packages/react-docs/src/components/type_definition.tsx +++ b/packages/react-docs/src/components/type_definition.tsx @@ -4,7 +4,7 @@ import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType, CustomTypeChild, KindString, TypeDocTypes } from '../types'; +import { CustomType, CustomTypeChild, KindString, TypeDocTypes, TypeDefinitionByName } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; @@ -19,6 +19,7 @@ export interface TypeDefinitionProps { customType: CustomType; shouldAddId?: boolean; docsInfo: DocsInfo; + typeDefinitionByName?: TypeDefinitionByName; } export interface TypeDefinitionState { @@ -44,7 +45,12 @@ export class TypeDefinition extends React.Component + ); break; @@ -74,6 +80,7 @@ export class TypeDefinition extends React.Component ) : ( )} -- cgit From bc5835229df6e68473279a1ac646ca50bf4092a3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:31:52 -0400 Subject: Remove stray console log --- packages/monorepo-scripts/src/utils/publish_utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts index 709a48799..13edb70d2 100644 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ b/packages/monorepo-scripts/src/utils/publish_utils.ts @@ -327,7 +327,6 @@ function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[] const exportPathToExportedItems: ExportPathToExportedItems = {}; const exportPathOrder: string[] = []; const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; - console.log('exportsToOmit', exportsToOmit); processNode(sf); function processNode(node: ts.Node): void { -- cgit From b2b3c24fd231fd78b4af167ff0823d846e8859b4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:39:11 -0400 Subject: Remove console.log --- packages/react-docs/src/components/documentation.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 1c32b2e16..f4f1d2aa9 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -183,7 +183,6 @@ export class Documentation extends React.Component { return semver.lte(mdVersion, this.props.selectedVersion); }); - console.log('this.props.selectedVersion', this.props.selectedVersion); if (_.isEmpty(eligibleVersions)) { throw new Error( `No eligible markdown sections found for ${this.props.docsInfo.displayName} version ${ -- cgit From 1a89905ab9602ccd81c5702bcc13246cd1f6960b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:39:21 -0400 Subject: Remove hash spy for now --- packages/react-docs/src/components/type.tsx | 1 - packages/react-shared/src/components/anchor_title.tsx | 1 - packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 -- 3 files changed, 4 deletions(-) diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 1c580caab..7e96f75c3 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -204,7 +204,6 @@ export function Type(props: TypeProps): any { diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 451ba1729..01857aa6b 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,7 +69,6 @@ export class AnchorTitle extends React.Component @@ -125,7 +124,6 @@ export class NestedSidebarMenu extends React.Component -- cgit From d49af66add3f59a5da48d3d2b364cfcfd18fe04a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:32:14 -0400 Subject: Add additional special-case acronym --- packages/react-shared/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index ce7effaff..0c0e7722c 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -46,7 +46,7 @@ export const utils = { return char; }); let finalText = charArray.join(''); - const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; + const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C', RPC: 'R P C' }; _.each(exceptions, (spaced, normal) => { if (_.includes(finalText, spaced)) { finalText = finalText.replace(spaced, normal); -- cgit From ca67e7d36fb5eb91626a60156dbec4f67a7d52f7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:32:32 -0400 Subject: Remove console.log --- packages/react-docs/src/utils/typedoc_utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 9ee1de2b4..b45dc73a8 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -123,7 +123,6 @@ export const typeDocUtils = { }); }); if (!_.isEmpty(typeEntities)) { - console.log('typeEntities', typeEntities); docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; const docSection = typeDocUtils._convertEntitiesToDocSection( -- cgit From 386b5bb122c189496e83da46cf53e8dfe83f0ee6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:33:20 -0400 Subject: Add back hashSpy --- packages/react-docs/src/components/type.tsx | 1 + packages/react-shared/src/components/anchor_title.tsx | 1 + packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 ++ 3 files changed, 4 insertions(+) diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 7e96f75c3..1c580caab 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -204,6 +204,7 @@ export function Type(props: TypeProps): any { diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 01857aa6b..451ba1729 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,6 +69,7 @@ export class AnchorTitle extends React.Component @@ -124,6 +125,7 @@ export class NestedSidebarMenu extends React.Component -- cgit From 9f42ceb5a3962c3e9e251da8791182e561139b08 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:47:06 -0400 Subject: Split publish_utils since it was becoming too big and unwieldy --- .../src/doc_generate_and_upload.ts | 2 +- packages/monorepo-scripts/src/publish.ts | 3 +- .../monorepo-scripts/src/publish_release_notes.ts | 2 +- .../src/utils/doc_generate_and_upload_utils.ts | 280 +++++++++++++++ .../src/utils/github_release_utils.ts | 102 ++++++ .../monorepo-scripts/src/utils/publish_utils.ts | 379 --------------------- 6 files changed, 386 insertions(+), 382 deletions(-) create mode 100644 packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts create mode 100644 packages/monorepo-scripts/src/utils/github_release_utils.ts delete mode 100644 packages/monorepo-scripts/src/utils/publish_utils.ts diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index ab1f97ad8..e0e7e1bb5 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -1,6 +1,6 @@ import * as yargs from 'yargs'; -import { generateAndUploadDocsAsync } from './utils/publish_utils'; +import { generateAndUploadDocsAsync } from './utils/doc_generate_and_upload_utils'; const args = yargs .option('package', { diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 64ba73e36..932d912b8 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -14,7 +14,8 @@ import { Package, PackageToNextVersion, VersionChangelog } from './types'; import { changelogUtils } from './utils/changelog_utils'; import { configs } from './utils/configs'; import { utils } from './utils/utils'; -import { publishReleaseNotesAsync, generateAndUploadDocsAsync } from './utils/publish_utils'; +import { publishReleaseNotesAsync } from './utils/github_release_utils'; +import { generateAndUploadDocsAsync } from './utils/doc_generate_and_upload_utils'; const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts index d708e8275..964f5b0bb 100644 --- a/packages/monorepo-scripts/src/publish_release_notes.ts +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -2,7 +2,7 @@ import * as promisify from 'es6-promisify'; import * as publishRelease from 'publish-release'; import { utils } from './utils/utils'; -import { publishReleaseNotesAsync } from './utils/publish_utils'; +import { publishReleaseNotesAsync } from './utils/github_release_utils'; (async () => { const shouldIncludePrivate = false; 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 new file mode 100644 index 000000000..870cbe17c --- /dev/null +++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts @@ -0,0 +1,280 @@ +import * as _ from 'lodash'; + +import { constants } from '../constants'; +import { utils } from './utils'; + +import { readFileSync, writeFileSync } from 'fs'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import * as ts from 'typescript'; + +import { ExportPathToExportedItems } from '../types'; + +interface ExportInfo { + exportPathToExportedItems: ExportPathToExportedItems; + exportPathOrder: string[]; +} + +interface ExportNameToTypedocNames { + [exportName: string]: string[]; +} + +export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { + const monorepoPackages = utils.getPackages(constants.monorepoRootPath); + const pkg = _.find(monorepoPackages, monorepoPackage => { + return _.includes(monorepoPackage.packageJson.name, packageName); + }); + if (_.isUndefined(pkg)) { + throw new Error(`Couldn't find a package.json for ${packageName}`); + } + + const packageJson = pkg.packageJson; + const omitExports = _.get(packageJson, 'config.postpublish.omitExports', []); + + const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; + const indexPath = `${pathToPackage}/src/index.ts`; + const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath, omitExports); + + const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); + if (!shouldPublishDocs) { + utils.log( + `GENERATE_UPLOAD_DOCS: ${ + packageJson.name + } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, + ); + return; + } + + const pkgNameToPath: { [name: string]: string } = {}; + _.each(monorepoPackages, pkg => { + pkgNameToPath[pkg.packageJson.name] = pkg.location; + }); + + // For each dep that is another one of our monorepo packages, we fetch it's index.ts + // and see which specific files we must pass to TypeDoc. + let typeDocExtraFileIncludes: string[] = []; + _.each(exportPathToExportedItems, (exportedItems, exportPath) => { + const isInternalToPkg = _.startsWith(exportPath, '.'); + if (isInternalToPkg) { + const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); + typeDocExtraFileIncludes.push(pathToInternalPkg); + return; // Right? + } + + const pathIfExists = pkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + + const typeDocSourceIncludes = new Set(); + const pathToIndex = `${pathIfExists}/src/index.ts`; + const exportInfo = getExportPathToExportedItems(pathToIndex); + const innerExportPathToExportedItems = exportInfo.exportPathToExportedItems; + _.each(exportedItems, exportName => { + _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { + if (!_.includes(innerExportItems, exportName)) { + return; + } + if (!_.startsWith(innerExportPath, './')) { + throw new Error( + `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is + itself exported from an external package. To fix this, export the external dependency directly, + not indirectly through ${innerExportPath}.`, + ); + } else { + const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); + typeDocSourceIncludes.add(absoluteSrcPath); + } + }); + }); + // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types + // directly, meaning no internal paths will exist to follow. Other packages also have direct exports + // in their index.ts, so we always add it to the source files passed to TypeDoc + if (typeDocSourceIncludes.size === 0) { + typeDocSourceIncludes.add(pathToIndex); + } + + typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; + }); + + // Generate Typedoc JSON file + typeDocExtraFileIncludes.push(path.join(pathToPackage, 'src', 'globals.d.ts')); + const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); + const projectFiles = typeDocExtraFileIncludes.join(' '); + const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); + // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the + // packages root dir, does not work. It only works when called via a `package.json` script located + // in the package's root. + await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + + // Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed + // TypeDoc files outside of the packages root path (i.e this package exports another package found in our + // monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add + // it here when necessary. + const typedocOutputString = readFileSync(jsonFilePath).toString(); + const typedocOutput = JSON.parse(typedocOutputString); + const finalTypeDocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (child, i) => { + if (!_.includes(child.name, '/src/')) { + const nameWithoutQuotes = child.name.replace(/"/g, ''); + const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; + finalTypeDocOutput.children[i].name = standardizedName; + } + }); + + // For each entry, see if it was exported in index.ts. If not, remove it. + const exportPathToTypedocNames: ExportNameToTypedocNames = {}; + _.each(typedocOutput.children, (file, i) => { + const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); + exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) + ? [file.name] + : [...exportPathToTypedocNames[exportPath], file.name]; + + const exportItems = exportPathToExportedItems[exportPath]; + _.each(file.children, (child, j) => { + if (!_.includes(exportItems, child.name)) { + delete finalTypeDocOutput.children[i].children[j]; + } + }); + finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); + }); + + // TODO: Add extra metadata for Class properties that are class instances + // Look in file for imports of that class, get the import name and construct a link to + // it's definition on another docs page. + + // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON + const docJson = { + metadata: { + exportPathToTypedocNames, + exportPathOrder, + }, + typedocJson: finalTypeDocOutput, + }; + + // Write modified TypeDoc JSON, without all the unexported stuff + writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); + + const fileName = `v${packageJson.version}.json`; + utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); + const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; + const s3Url = `${S3BucketPath}${fileName}`; + await execAsync( + `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, + { + cwd, + }, + ); + utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); + // Remove the generated docs directory + await execAsync(`rm -rf ${jsonFilePath}`, { + cwd, + }); +} + +function findExportPathGivenTypedocName( + exportPathToExportedItems: ExportPathToExportedItems, + packageName: string, + typedocName: string, +): string { + const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); + const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; + const exportPaths = _.keys(exportPathToExportedItems); + const sanitizedExportPaths = _.map(exportPaths, exportPath => { + if (_.startsWith(exportPath, './')) { + const sanitizedExportPath = path.join(packageName, 'src', exportPath); + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + const monorepoPrefix = '@0xproject/'; + if (_.startsWith(exportPath, monorepoPrefix)) { + const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + sanitizedExportPathToExportPath[exportPath] = exportPath; + return exportPath; + }); + // We need to sort the exportPaths by length (longest first), so that the match finding will pick + // longer matches before shorter matches, since it might match both, but the longer match is more + // precisely what we are looking for. + const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => { + return b.length - a.length; + }); + const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => { + return _.startsWith(typeDocNameWithoutQuotes, p); + }); + if (_.isUndefined(matchingSanitizedExportPathIfExists)) { + throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); + } + const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; + return matchingExportPath; +} + +function getExportPathToExportedItems(filePath: string, omitExports?: string[]): ExportInfo { + const sourceFile = ts.createSourceFile( + 'indexFile', + readFileSync(filePath).toString(), + ts.ScriptTarget.ES2017, + /*setParentNodes */ true, + ); + const exportInfo = _getExportPathToExportedItems(sourceFile, omitExports); + return exportInfo; +} + +function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[]): ExportInfo { + const exportPathToExportedItems: ExportPathToExportedItems = {}; + const exportPathOrder: string[] = []; + const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; + processNode(sf); + + function processNode(node: ts.Node): void { + switch (node.kind) { + case ts.SyntaxKind.ExportDeclaration: { + const exportClause = (node as any).exportClause; + const exportPath = exportClause.parent.moduleSpecifier.text; + _.each(exportClause.elements, element => { + const exportItem = element.name.escapedText; + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } + }); + if (!_.isUndefined(exportPathToExportedItems[exportPath])) { + exportPathOrder.push(exportPath); + } + break; + } + + case ts.SyntaxKind.ExportKeyword: { + const foundNode: any = node; + const exportPath = './index'; + if (foundNode.parent && foundNode.parent.name) { + const exportItem = foundNode.parent.name.escapedText; + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } + } + if (!_.includes(exportPathOrder, exportPath) && !_.isUndefined(exportPathToExportedItems[exportPath])) { + exportPathOrder.push(exportPath); + } + break; + } + default: + // noop + break; + } + + ts.forEachChild(node, processNode); + } + const exportInfo = { + exportPathToExportedItems, + exportPathOrder, + }; + return exportInfo; +} diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts new file mode 100644 index 000000000..1f4c4f1e9 --- /dev/null +++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts @@ -0,0 +1,102 @@ +import * as _ from 'lodash'; +import * as promisify from 'es6-promisify'; +import * as publishRelease from 'publish-release'; + +import { constants } from '../constants'; +import { Package } from '../types'; +import { utils } from './utils'; + +import { readFileSync } from 'fs'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; + +const publishReleaseAsync = promisify(publishRelease); +export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { + // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) + const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); + const latestGitCommit = result.stdout; + const shortenedGitCommit = latestGitCommit.slice(0, 7); + const tagName = `monorepo@${shortenedGitCommit}`; + + await execAsync(`git rev-parse ${tagName}`); + await execAsync('git tag ${tagName}'); + + await execAsync('git push origin ${tagName}'); + const releaseName = `0x monorepo - ${shortenedGitCommit}`; + + let assets: string[] = []; + let aggregateNotes = ''; + _.each(updatedPublishPackages, pkg => { + const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); + if (_.isEmpty(notes)) { + return; // don't include it + } + aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; + + const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); + if (!_.isUndefined(packageAssets)) { + assets = [...assets, ...packageAssets]; + } + }); + const finalAssets = adjustAssetPaths(assets); + + utils.log('Publishing release notes ', releaseName, '...'); + // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded + // Ideally we would like to name the assets after the package they are from + // Source: https://github.com/remixz/publish-release/issues/39 + await publishReleaseAsync({ + token: constants.githubPersonalAccessToken, + owner: '0xProject', + tag: tagName, + repo: '0x-monorepo', + name: releaseName, + notes: aggregateNotes, + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets: finalAssets, + }); +} + +// Asset paths should described from the monorepo root. This method prefixes +// the supplied path with the absolute path to the monorepo root. +function adjustAssetPaths(assets: string[]): string[] { + const finalAssets: string[] = []; + _.each(assets, (asset: string) => { + const finalAsset = `${constants.monorepoRootPath}/${asset}`; + finalAssets.push(finalAsset); + }); + return finalAssets; +} + +function getReleaseNotesForPackage(packageName: string, version: string): string { + const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); + const changelogJSONPath = path.join( + constants.monorepoRootPath, + 'packages', + packageNameWithoutNamespace, + 'CHANGELOG.json', + ); + const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); + const changelogs = JSON.parse(changelogJSON); + const latestLog = changelogs[0]; + // If only has a `Dependencies updated` changelog, we don't include it in release notes + if (latestLog.changes.length === 1 && latestLog.changes[0].note === constants.dependenciesUpdatedMessage) { + return ''; + } + // We sanity check that the version for the changelog notes we are about to publish to Github + // correspond to the new version of the package. + // if (version !== latestLog.version) { + // throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); + // } + let notes = ''; + _.each(latestLog.changes, change => { + notes += `* ${change.note}`; + if (change.pr) { + notes += ` (#${change.pr})`; + } + notes += `\n`; + }); + return notes; +} diff --git a/packages/monorepo-scripts/src/utils/publish_utils.ts b/packages/monorepo-scripts/src/utils/publish_utils.ts deleted file mode 100644 index 13edb70d2..000000000 --- a/packages/monorepo-scripts/src/utils/publish_utils.ts +++ /dev/null @@ -1,379 +0,0 @@ -import * as _ from 'lodash'; -import * as promisify from 'es6-promisify'; -import * as publishRelease from 'publish-release'; - -import { constants } from '../constants'; -import { Package } from '../types'; -import { utils } from './utils'; - -import { readFileSync, writeFileSync } from 'fs'; -import * as path from 'path'; -import { exec as execAsync } from 'promisify-child-process'; -import * as ts from 'typescript'; - -import { ExportPathToExportedItems } from '../types'; - -interface ExportInfo { - exportPathToExportedItems: ExportPathToExportedItems; - exportPathOrder: string[]; -} - -interface ExportNameToTypedocNames { - [exportName: string]: string[]; -} - -interface Metadata { - exportPathToTypedocNames: ExportNameToTypedocNames; - exportPathOrder: string[]; -} - -const publishReleaseAsync = promisify(publishRelease); -export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { - // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) - const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); - const latestGitCommit = result.stdout; - const shortenedGitCommit = latestGitCommit.slice(0, 7); - const tagName = `monorepo@${shortenedGitCommit}`; - - await execAsync(`git rev-parse ${tagName}`); - await execAsync('git tag ${tagName}'); - - await execAsync('git push origin ${tagName}'); - const releaseName = `0x monorepo - ${shortenedGitCommit}`; - - let assets: string[] = []; - let aggregateNotes = ''; - _.each(updatedPublishPackages, pkg => { - const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); - if (_.isEmpty(notes)) { - return; // don't include it - } - aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; - - const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); - if (!_.isUndefined(packageAssets)) { - assets = [...assets, ...packageAssets]; - } - }); - const finalAssets = adjustAssetPaths(assets); - - utils.log('Publishing release notes ', releaseName, '...'); - // TODO: Currently publish-release doesn't let you specify the labels for each asset uploaded - // Ideally we would like to name the assets after the package they are from - // Source: https://github.com/remixz/publish-release/issues/39 - await publishReleaseAsync({ - token: constants.githubPersonalAccessToken, - owner: '0xProject', - tag: tagName, - repo: '0x-monorepo', - name: releaseName, - notes: aggregateNotes, - draft: false, - prerelease: false, - reuseRelease: true, - reuseDraftOnly: false, - assets: finalAssets, - }); -} - -// Asset paths should described from the monorepo root. This method prefixes -// the supplied path with the absolute path to the monorepo root. -function adjustAssetPaths(assets: string[]): string[] { - const finalAssets: string[] = []; - _.each(assets, (asset: string) => { - const finalAsset = `${constants.monorepoRootPath}/${asset}`; - finalAssets.push(finalAsset); - }); - return finalAssets; -} - -function getReleaseNotesForPackage(packageName: string, version: string): string { - const packageNameWithoutNamespace = packageName.replace('@0xproject/', ''); - const changelogJSONPath = path.join( - constants.monorepoRootPath, - 'packages', - packageNameWithoutNamespace, - 'CHANGELOG.json', - ); - const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); - const changelogs = JSON.parse(changelogJSON); - const latestLog = changelogs[0]; - // If only has a `Dependencies updated` changelog, we don't include it in release notes - if (latestLog.changes.length === 1 && latestLog.changes[0].note === constants.dependenciesUpdatedMessage) { - return ''; - } - // We sanity check that the version for the changelog notes we are about to publish to Github - // correspond to the new version of the package. - // if (version !== latestLog.version) { - // throw new Error('Expected CHANGELOG.json latest entry version to coincide with published version.'); - // } - let notes = ''; - _.each(latestLog.changes, change => { - notes += `* ${change.note}`; - if (change.pr) { - notes += ` (#${change.pr})`; - } - notes += `\n`; - }); - return notes; -} - -export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { - const monorepoPackages = utils.getPackages(constants.monorepoRootPath); - const pkg = _.find(monorepoPackages, monorepoPackage => { - return _.includes(monorepoPackage.packageJson.name, packageName); - }); - if (_.isUndefined(pkg)) { - throw new Error(`Couldn't find a package.json for ${packageName}`); - } - - const packageJson = pkg.packageJson; - const omitExports = _.get(packageJson, 'config.postpublish.omitExports', []); - - const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; - const indexPath = `${pathToPackage}/src/index.ts`; - const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath, omitExports); - - const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); - if (!shouldPublishDocs) { - utils.log( - `GENERATE_UPLOAD_DOCS: ${ - packageJson.name - } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, - ); - return; - } - - const pkgNameToPath: { [name: string]: string } = {}; - _.each(monorepoPackages, pkg => { - pkgNameToPath[pkg.packageJson.name] = pkg.location; - }); - - // For each dep that is another one of our monorepo packages, we fetch it's index.ts - // and see which specific files we must pass to TypeDoc. - let typeDocExtraFileIncludes: string[] = []; - _.each(exportPathToExportedItems, (exportedItems, exportPath) => { - const isInternalToPkg = _.startsWith(exportPath, '.'); - if (isInternalToPkg) { - const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); - typeDocExtraFileIncludes.push(pathToInternalPkg); - return; // Right? - } - - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - return; // It's an external package - } - - const typeDocSourceIncludes = new Set(); - const pathToIndex = `${pathIfExists}/src/index.ts`; - const exportInfo = getExportPathToExportedItems(pathToIndex); - const innerExportPathToExportedItems = exportInfo.exportPathToExportedItems; - _.each(exportedItems, exportName => { - _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { - if (!_.includes(innerExportItems, exportName)) { - return; - } - if (!_.startsWith(innerExportPath, './')) { - throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is - itself exported from an external package. To fix this, export the external dependency directly, - not indirectly through ${innerExportPath}.`, - ); - } else { - const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); - typeDocSourceIncludes.add(absoluteSrcPath); - } - }); - }); - // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types - // directly, meaning no internal paths will exist to follow. Other packages also have direct exports - // in their index.ts, so we always add it to the source files passed to TypeDoc - if (typeDocSourceIncludes.size === 0) { - typeDocSourceIncludes.add(pathToIndex); - } - - typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; - }); - - // Generate Typedoc JSON file - typeDocExtraFileIncludes.push(path.join(pathToPackage, 'src', 'globals.d.ts')); - const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); - const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); - // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the - // packages root dir, does not work. It only works when called via a `package.json` script located - // in the package's root. - await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - - // Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed - // TypeDoc files outside of the packages root path (i.e this package exports another package found in our - // monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add - // it here when necessary. - const typedocOutputString = readFileSync(jsonFilePath).toString(); - const typedocOutput = JSON.parse(typedocOutputString); - const finalTypeDocOutput = _.clone(typedocOutput); - _.each(typedocOutput.children, (child, i) => { - if (!_.includes(child.name, '/src/')) { - const nameWithoutQuotes = child.name.replace(/"/g, ''); - const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; - finalTypeDocOutput.children[i].name = standardizedName; - } - }); - - // For each entry, see if it was exported in index.ts. If not, remove it. - const exportPathToTypedocNames: ExportNameToTypedocNames = {}; - _.each(typedocOutput.children, (file, i) => { - const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); - exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) - ? [file.name] - : [...exportPathToTypedocNames[exportPath], file.name]; - - const exportItems = exportPathToExportedItems[exportPath]; - _.each(file.children, (child, j) => { - if (!_.includes(exportItems, child.name)) { - delete finalTypeDocOutput.children[i].children[j]; - } - }); - finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); - }); - - // TODO: Add extra metadata for Class properties that are class instances - // Look in file for imports of that class, get the import name and construct a link to - // it's definition on another docs page. - - // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON - const docJson = { - metadata: { - exportPathToTypedocNames, - exportPathOrder, - }, - typedocJson: finalTypeDocOutput, - }; - - // Write modified TypeDoc JSON, without all the unexported stuff - writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); - - const fileName = `v${packageJson.version}.json`; - utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); - const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; - const s3Url = `${S3BucketPath}${fileName}`; - await execAsync( - `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, - { - cwd, - }, - ); - utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); - // Remove the generated docs directory - await execAsync(`rm -rf ${jsonFilePath}`, { - cwd, - }); -} - -function findExportPathGivenTypedocName( - exportPathToExportedItems: ExportPathToExportedItems, - packageName: string, - typedocName: string, -): string { - const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); - const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; - const exportPaths = _.keys(exportPathToExportedItems); - const sanitizedExportPaths = _.map(exportPaths, exportPath => { - if (_.startsWith(exportPath, './')) { - const sanitizedExportPath = path.join(packageName, 'src', exportPath); - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; - } - const monorepoPrefix = '@0xproject/'; - if (_.startsWith(exportPath, monorepoPrefix)) { - const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; - } - sanitizedExportPathToExportPath[exportPath] = exportPath; - return exportPath; - }); - // We need to sort the exportPaths by length (longest first), so that the match finding will pick - // longer matches before shorter matches, since it might match both, but the longer match is more - // precisely what we are looking for. - const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => { - return b.length - a.length; - }); - const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => { - return _.startsWith(typeDocNameWithoutQuotes, p); - }); - if (_.isUndefined(matchingSanitizedExportPathIfExists)) { - throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); - } - const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; - return matchingExportPath; -} - -function getExportPathToExportedItems(filePath: string, omitExports?: string[]): ExportInfo { - const sourceFile = ts.createSourceFile( - 'indexFile', - readFileSync(filePath).toString(), - ts.ScriptTarget.ES2017, - /*setParentNodes */ true, - ); - const exportInfo = _getExportPathToExportedItems(sourceFile, omitExports); - return exportInfo; -} - -function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[]): ExportInfo { - const exportPathToExportedItems: ExportPathToExportedItems = {}; - const exportPathOrder: string[] = []; - const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; - processNode(sf); - - function processNode(node: ts.Node): void { - switch (node.kind) { - case ts.SyntaxKind.ExportDeclaration: { - const exportClause = (node as any).exportClause; - const exportPath = exportClause.parent.moduleSpecifier.text; - _.each(exportClause.elements, element => { - const exportItem = element.name.escapedText; - if (!_.includes(exportsToOmit, exportItem)) { - exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) - ? [exportItem] - : [...exportPathToExportedItems[exportPath], exportItem]; - } - }); - if (!_.isUndefined(exportPathToExportedItems[exportPath])) { - exportPathOrder.push(exportPath); - } - break; - } - - case ts.SyntaxKind.ExportKeyword: { - const foundNode: any = node; - const exportPath = './index'; - if (foundNode.parent && foundNode.parent.name) { - const exportItem = foundNode.parent.name.escapedText; - if (!_.includes(exportsToOmit, exportItem)) { - exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) - ? [exportItem] - : [...exportPathToExportedItems[exportPath], exportItem]; - } - } - if (!_.includes(exportPathOrder, exportPath) && !_.isUndefined(exportPathToExportedItems[exportPath])) { - exportPathOrder.push(exportPath); - } - break; - } - default: - // noop - break; - } - - ts.forEachChild(node, processNode); - } - const exportInfo = { - exportPathToExportedItems, - exportPathOrder, - }; - return exportInfo; -} -- cgit From 3d1c8dfe06ba23696bb1fadb7754145da2f108be Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 16:52:45 -0700 Subject: Remove old comment --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 870cbe17c..a7ac9765a 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 @@ -58,7 +58,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: if (isInternalToPkg) { const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); typeDocExtraFileIncludes.push(pathToInternalPkg); - return; // Right? + return; } const pathIfExists = pkgNameToPath[exportPath]; -- cgit From 67666446bf6620bd83e4f90f6fffaac71c1bb00c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 16:55:37 -0700 Subject: Add a check to make sure types part of the exported interface are also exported from the packages index.ts --- .../src/utils/doc_generate_and_upload_utils.ts | 54 ++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) 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 a7ac9765a..84fb9d20c 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 @@ -19,6 +19,12 @@ interface ExportNameToTypedocNames { [exportName: string]: string[]; } +// TODO: Add the EXTERNAL_TYPE_TO_LINK mapping to the Doc JSON +const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { + BigNumber: 'http://mikemcl.github.io/bignumber.js', + Error: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L134', +}; + export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const pkg = _.find(monorepoPackages, monorepoPackage => { @@ -141,9 +147,24 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); }); - // TODO: Add extra metadata for Class properties that are class instances - // Look in file for imports of that class, get the import name and construct a link to - // it's definition on another docs page. + const allExportedItems = _.flatten(_.values(exportPathToExportedItems)); + const propertyName = ''; // Root has no property name + const referenceNamesWithDuplicates = getAllReferenceNames(propertyName, finalTypeDocOutput, []); + const referenceNames = _.uniq(referenceNamesWithDuplicates); + + const missingReferences: string[] = []; + _.each(referenceNames, referenceName => { + if (!_.includes(allExportedItems, referenceName) && _.isUndefined(EXTERNAL_TYPE_TO_LINK[referenceName])) { + missingReferences.push(referenceName); + } + }); + if (!_.isEmpty(missingReferences)) { + throw new Error( + `${packageName} package needs to export ${missingReferences.join( + ', ', + )} from it's index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, + ); + } // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON const docJson = { @@ -171,7 +192,34 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // Remove the generated docs directory await execAsync(`rm -rf ${jsonFilePath}`, { cwd, + +function getAllReferenceNames(propertyName: string, node: any, referenceNames: string[]): string[] { + let updatedReferenceNames = referenceNames; + if (!_.isObject(node)) { + return updatedReferenceNames; + } + // Some nodes of type reference are for subtypes, which we don't want to return. + // We therefore filter them out. + const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites']; + if ( + !_.isUndefined(node.type) && + _.isString(node.type) && + node.type === 'reference' && + _.isUndefined(node.typeArguments) && + !_.includes(SUB_TYPE_PROPERTY_NAMES, propertyName) + ) { + return [...referenceNames, node.name]; + } + _.each(node, (nodeValue, innerPropertyName) => { + if (_.isArray(nodeValue)) { + _.each(nodeValue, aNode => { + updatedReferenceNames = getAllReferenceNames(innerPropertyName, aNode, updatedReferenceNames); + }); + } else if (_.isObject(nodeValue)) { + updatedReferenceNames = getAllReferenceNames(innerPropertyName, nodeValue, updatedReferenceNames); + } }); + return updatedReferenceNames; } function findExportPathGivenTypedocName( -- cgit From 952367d5328e0f2a0d1361aed326fbbf0364dd2b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 16:55:52 -0700 Subject: Add missing types from 0x.js index.ts --- packages/0x.js/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 54b5e6928..7bb624a64 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,6 +1,13 @@ export { ZeroEx } from './0x'; -export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders'; +export { + Web3ProviderEngine, + RPCSubprovider, + Callback, + JSONRPCRequestPayloadWithMethod, + ErrorCallback, + Subprovider, +} from '@0xproject/subproviders'; export { EventCallback, @@ -75,4 +82,6 @@ export { LogEntry, DecodedLogArgs, LogEntryEvent, + DecodedLogEntry, + DecodedLogEntryEvent, } from 'ethereum-types'; -- cgit From 8169155a6547fb0283cd0f5362aad3c0b173b00b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 16:56:05 -0700 Subject: Update yarn.lock --- yarn.lock | 7 ------- 1 file changed, 7 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5a77b4aec..f8c5b3980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10571,13 +10571,6 @@ react-scroll@0xproject/react-scroll#similar-to-pr-330: lodash.throttle "^4.1.1" prop-types "^15.5.8" -"react-scroll@github:0xproject/react-scroll#similar-to-pr-330": - version "1.7.10" - resolved "https://codeload.github.com/0xproject/react-scroll/tar.gz/091a41f8a6fd9e94bd41b9bba27356da470cb8a5" - dependencies: - lodash.throttle "^4.1.1" - prop-types "^15.5.8" - react-side-effect@^1.0.2: version "1.1.5" resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-1.1.5.tgz#f26059e50ed9c626d91d661b9f3c8bb38cd0ff2d" -- cgit From b10cba600da44318f1d8246124c211ab92683626 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 18:10:11 -0700 Subject: Refactor 0x.js to simply re-export it's own sub-dependencies rather then wrapping them in a ZeroEx object --- packages/0x.js/package.json | 18 +- packages/0x.js/src/0x.ts | 279 - packages/0x.js/src/artifacts.ts | 7 - packages/0x.js/src/artifacts/ZRXToken.json | 10031 ------------------- packages/0x.js/src/index.ts | 84 +- .../0x.js/src/schemas/zero_ex_config_schema.ts | 5 - .../zero_ex_private_network_config_schema.ts | 35 - .../zero_ex_public_network_config_schema.ts | 43 - packages/0x.js/src/types.ts | 7 - packages/0x.js/src/utils/constants.ts | 4 - packages/0x.js/test/0x.js_test.ts | 150 - packages/0x.js/test/global_hooks.ts | 17 - packages/0x.js/test/utils/chai_setup.ts | 13 - packages/0x.js/test/utils/constants.ts | 9 - packages/0x.js/test/utils/token_utils.ts | 9 - packages/0x.js/test/utils/web3_wrapper.ts | 12 - yarn.lock | 8 +- 17 files changed, 60 insertions(+), 10671 deletions(-) delete mode 100644 packages/0x.js/src/0x.ts delete mode 100644 packages/0x.js/src/artifacts.ts delete mode 100644 packages/0x.js/src/artifacts/ZRXToken.json delete mode 100644 packages/0x.js/src/schemas/zero_ex_config_schema.ts delete mode 100644 packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts delete mode 100644 packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts delete mode 100644 packages/0x.js/src/types.ts delete mode 100644 packages/0x.js/src/utils/constants.ts delete mode 100644 packages/0x.js/test/0x.js_test.ts delete mode 100644 packages/0x.js/test/global_hooks.ts delete mode 100644 packages/0x.js/test/utils/chai_setup.ts delete mode 100644 packages/0x.js/test/utils/constants.ts delete mode 100644 packages/0x.js/test/utils/token_utils.ts delete mode 100644 packages/0x.js/test/utils/web3_wrapper.ts diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index b023ce525..98a74633d 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -15,30 +15,19 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && yarn build:all && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "watch_without_deps": "tsc -w", + "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 update_artifacts generate_contract_wrappers", - "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", - "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;", - "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(ZRXToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", - "test:circleci": "run-s test:coverage", - "test": "yarn run_mocha", - "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/generated_contract_wrappers", + "clean": "shx rm -rf _bundles lib scripts src/generated_contract_wrappers", "build:umd:prod": "NODE_ENV=production webpack", "build:commonjs": "tsc && yarn copy_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "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": { - "contracts": "ZRXToken", "postpublish": { "assets": [ "packages/0x.js/_bundles/index.js", @@ -102,6 +91,7 @@ "@0xproject/base-contract": "^1.0.4", "@0xproject/contract-wrappers": "^1.0.1-rc.2", "@0xproject/order-utils": "^1.0.1-rc.2", + "@0xproject/order-watcher": "1.0.1-rc.2", "@0xproject/sol-compiler": "^1.0.4", "@0xproject/subproviders": "^1.0.4", "@0xproject/types": "^1.0.1-rc.3", diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts deleted file mode 100644 index 48d00c1ac..000000000 --- a/packages/0x.js/src/0x.ts +++ /dev/null @@ -1,279 +0,0 @@ -import { assert } from '@0xproject/assert'; -import { - ContractWrappers, - ContractWrappersConfig, - ERC20ProxyWrapper, - ERC20TokenWrapper, - ERC721ProxyWrapper, - ERC721TokenWrapper, - EtherTokenWrapper, - ExchangeWrapper, -} from '@0xproject/contract-wrappers'; -import { - assetDataUtils, - ecSignOrderHashAsync, - generatePseudoRandomSalt, - isValidSignatureAsync, - orderHashUtils, -} from '@0xproject/order-utils'; -// HACK: Since we export assetDataUtils from ZeroEx and it has AssetProxyId, ERC20AssetData and ERC721AssetData -// in it's public interface, we need to import these types here. -// tslint:disable-next-line:no-unused-variable -import { AssetProxyId, ERC20AssetData, ERC721AssetData, Order, SignedOrder, SignerType } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; - -import { constants } from './utils/constants'; - -/** - * The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality - * and all calls to the library should be made through a ZeroEx instance. - */ -export class ZeroEx { - /** - * When creating an order without a specified taker or feeRecipient you must supply the Solidity - * address null type (as opposed to Javascripts `null`, `undefined` or empty string). We expose - * this constant for your convenience. - */ - public static NULL_ADDRESS = constants.NULL_ADDRESS; - /** - * An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract. - */ - public exchange: ExchangeWrapper; - /** - * An instance of the ERC20TokenWrapper class containing methods for interacting with any ERC20 token smart contract. - */ - public erc20Token: ERC20TokenWrapper; - /** - * An instance of the ERC721TokenWrapper class containing methods for interacting with any ERC721 token smart contract. - */ - public erc721Token: ERC721TokenWrapper; - /** - * An instance of the EtherTokenWrapper class containing methods for interacting with the - * wrapped ETH ERC20 token smart contract. - */ - public etherToken: EtherTokenWrapper; - /** - * An instance of the ERC20ProxyWrapper class containing methods for interacting with the - * ERC20 proxy smart contract. - */ - public erc20Proxy: ERC20ProxyWrapper; - /** - * An instance of the ERC721ProxyWrapper class containing methods for interacting with the - * ERC721 proxy smart contract. - */ - public erc721Proxy: ERC721ProxyWrapper; - private readonly _contractWrappers: ContractWrappers; - /** - * Generates a pseudo-random 256-bit salt. - * The salt can be included in a 0x order, ensuring that the order generates a unique orderHash - * and will not collide with other outstanding orders that are identical in all other parameters. - * @return A pseudo-random 256-bit number that can be used as a salt. - */ - public static generatePseudoRandomSalt(): BigNumber { - return generatePseudoRandomSalt(); - } - /** - * Computes the orderHash for a supplied order. - * @param order An object that conforms to the Order or SignedOrder interface definitions. - * @return The resulting orderHash from hashing the supplied order. - */ - public static getOrderHashHex(order: Order | SignedOrder): string { - return orderHashUtils.getOrderHashHex(order); - } - /** - * Checks if the supplied hex encoded order hash is valid. - * Note: Valid means it has the expected format, not that an order with the orderHash exists. - * Use this method when processing orderHashes submitted as user input. - * @param orderHash Hex encoded orderHash. - * @return Whether the supplied orderHash has the expected format. - */ - public static isValidOrderHash(orderHash: string): boolean { - return orderHashUtils.isValidOrderHash(orderHash); - } - /** - * A unit amount is defined as the amount of a token above the specified decimal places (integer part). - * E.g: If a currency has 18 decimal places, 1e18 or one quintillion of the currency is equivalent - * to 1 unit. - * @param amount The amount in baseUnits that you would like converted to units. - * @param decimals The number of decimal places the unit amount has. - * @return The amount in units. - */ - public static toUnitAmount(amount: BigNumber, decimals: number): BigNumber { - assert.isValidBaseUnitAmount('amount', amount); - assert.isNumber('decimals', decimals); - const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals); - return unitAmount; - } - /** - * A baseUnit is defined as the smallest denomination of a token. An amount expressed in baseUnits - * is the amount expressed in the smallest denomination. - * E.g: 1 unit of a token with 18 decimal places is expressed in baseUnits as 1000000000000000000 - * @param amount The amount of units that you would like converted to baseUnits. - * @param decimals The number of decimal places the unit amount has. - * @return The amount in baseUnits. - */ - public static toBaseUnitAmount(amount: BigNumber, decimals: number): BigNumber { - assert.isBigNumber('amount', amount); - assert.isNumber('decimals', decimals); - const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, decimals); - return baseUnitAmount; - } - /** - * Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or - * takerAssetData fields in a 0x order. - * @param tokenAddress The ERC20 token address to encode - * @return The hex encoded assetData string - */ - public static encodeERC20AssetData(tokenAddress: string): string { - return assetDataUtils.encodeERC20AssetData(tokenAddress); - } - /** - * Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId - * @param assetData Hex encoded assetData string to decode - * @return An object containing the decoded tokenAddress & assetProxyId - */ - public static decodeERC20AssetData(assetData: string): ERC20AssetData { - return assetDataUtils.decodeERC20AssetData(assetData); - } - /** - * Encodes an ERC721 token address into a hex encoded assetData string, usable in the makerAssetData or - * takerAssetData fields in a 0x order. - * @param tokenAddress The ERC721 token address to encode - * @param tokenId The ERC721 tokenId to encode - * @return The hex encoded assetData string - */ - public static encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string { - return assetDataUtils.encodeERC721AssetData(tokenAddress, tokenId); - } - /** - * Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId - * @param assetData Hex encoded assetData string to decode - * @return An object containing the decoded tokenAddress, tokenId & assetProxyId - */ - public static decodeERC721AssetData(assetData: string): ERC721AssetData { - return assetDataUtils.decodeERC721AssetData(assetData); - } - /** - * Decode and return the assetProxyId from the assetData - * @param assetData Hex encoded assetData string to decode - * @return The assetProxyId - */ - public static decodeAssetProxyId(assetData: string): AssetProxyId { - return assetDataUtils.decodeAssetProxyId(assetData); - } - /** - * Decode any assetData into it's corresponding assetData object - * @param assetData Hex encoded assetData string to decode - * @return Either a ERC20 or ERC721 assetData object - */ - public static decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData { - return assetDataUtils.decodeAssetDataOrThrow(assetData); - } - /** - * Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library. - * @param provider The Provider instance you would like the 0x.js library to use for interacting with - * the Ethereum network. - * @param config The configuration object. Look up the type for the description. - * @return An instance of the 0x.js ZeroEx class. - */ - constructor(provider: Provider, config: ContractWrappersConfig) { - assert.isWeb3Provider('provider', provider); - this._contractWrappers = new ContractWrappers(provider, config); - - this.erc20Proxy = this._contractWrappers.erc20Proxy; - this.erc721Proxy = this._contractWrappers.erc721Proxy; - this.erc20Token = this._contractWrappers.erc20Token; - this.erc721Token = this._contractWrappers.erc721Token; - this.exchange = this._contractWrappers.exchange; - this.etherToken = this._contractWrappers.etherToken; - } - /** - * Verifies that the provided signature is valid according to the 0x Protocol smart contracts - * @param data The hex encoded data signed by the supplied signature. - * @param signature The hex encoded signature. - * @param signerAddress The hex encoded address that signed the data, producing the supplied signature. - * @return Whether the signature is valid for the supplied signerAddress and data. - */ - public async isValidSignatureAsync(data: string, signature: string, signerAddress: string): Promise { - const isValid = await isValidSignatureAsync( - this._contractWrappers.getProvider(), - data, - signature, - signerAddress, - ); - return isValid; - } - /** - * Sets a new web3 provider for 0x.js. Updating the provider will stop all - * subscriptions so you will need to re-subscribe to all events relevant to your app after this call. - * @param provider The Web3Provider you would like the 0x.js library to use from now on. - * @param networkId The id of the network your provider is connected to - */ - public setProvider(provider: Provider, networkId: number): void { - this._contractWrappers.setProvider(provider, networkId); - } - /** - * Get the provider instance currently used by 0x.js - * @return Web3 provider instance - */ - public getProvider(): Provider { - return this._contractWrappers.getProvider(); - } - /** - * Get user Ethereum addresses available through the supplied web3 provider available for sending transactions. - * @return An array of available user Ethereum addresses. - */ - public async getAvailableAddressesAsync(): Promise { - // Hack: Get Web3Wrapper from ContractWrappers - const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper; - const availableAddresses = await web3Wrapper.getAvailableAddressesAsync(); - return availableAddresses; - } - /** - * Signs an orderHash and returns it's elliptic curve signature. - * This method currently supports TestRPC, Geth and Parity above and below V1.6.6 - * @param orderHash Hex encoded orderHash to sign. - * @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address - * must be available via the Provider supplied to 0x.js. - * @param signerType the signer type that will perform the `eth_sign` operation. E.g Default, Metamask, Ledger or Trezor. - * Some implementations exhibit different behaviour. Default will assume a spec compliant eth_sign implementation. - * This parameter is defaulted to `SignerType.Default`. - * @return A hex encoded string of the Elliptic curve signature parameters generated by signing the orderHash and signature type. - */ - public async ecSignOrderHashAsync( - orderHash: string, - signerAddress: string, - signerType: SignerType = SignerType.Default, - ): Promise { - const signature = await ecSignOrderHashAsync( - this._contractWrappers.getProvider(), - orderHash, - signerAddress, - signerType, - ); - return signature; - } - /** - * Waits for a transaction to be mined and returns the transaction receipt. - * @param txHash Transaction hash - * @param pollingIntervalMs How often (in ms) should we check if the transaction is mined. - * @param timeoutMs How long (in ms) to poll for transaction mined until aborting. - * @return Transaction receipt with decoded log args. - */ - public async awaitTransactionMinedAsync( - txHash: string, - pollingIntervalMs: number = 1000, - timeoutMs?: number, - ): Promise { - // Hack: Get Web3Wrapper from ContractWrappers - const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper; - const transactionReceiptWithDecodedLogs = await web3Wrapper.awaitTransactionMinedAsync( - txHash, - pollingIntervalMs, - timeoutMs, - ); - return transactionReceiptWithDecodedLogs; - } -} diff --git a/packages/0x.js/src/artifacts.ts b/packages/0x.js/src/artifacts.ts deleted file mode 100644 index f68969d28..000000000 --- a/packages/0x.js/src/artifacts.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; - -import * as ZRXToken from './artifacts/ZRXToken.json'; - -export const artifacts = { - ZRXToken: (ZRXToken as any) as ContractArtifact, -}; diff --git a/packages/0x.js/src/artifacts/ZRXToken.json b/packages/0x.js/src/artifacts/ZRXToken.json deleted file mode 100644 index becbb83df..000000000 --- a/packages/0x.js/src/artifacts/ZRXToken.json +++ /dev/null @@ -1,10031 +0,0 @@ -{ - "schemaVersion": "2.0.0", - "contractName": "ZRXToken", - "compilerOutput": { - "abi": [ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_spender", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_from", - "type": "address" - }, - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - }, - { - "name": "_spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "type": "function" - }, - { - "inputs": [], - "payable": false, - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_from", - "type": "address" - }, - { - "indexed": true, - "name": "_to", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_owner", - "type": "address" - }, - { - "indexed": true, - "name": "_spender", - "type": "address" - }, - { - "indexed": false, - "name": "_value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - } - ], - "devdoc": { - "methods": { - "transferFrom(address,address,uint256)": { - "details": "ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.", - "params": { - "_from": "Address to transfer from.", - "_to": "Address to transfer to.", - "_value": "Amount to transfer." - }, - "return": "Success of transfer." - } - } - }, - "evm": { - "assembly": " /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":795:1242 contract ZRXToken is UnlimitedAllowanceToken {... */\n mstore(0x40, 0x60)\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":958:964 10**27 */\n 0x33b2e3c9fd0803ce8000000\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":932:964 uint public totalSupply = 10**27 */\n 0x3\n sstore\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1150:1240 function ZRXToken()... */\n jumpi(tag_1, iszero(callvalue))\n invalid\ntag_1:\ntag_2:\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1222:1233 totalSupply */\n sload(0x3)\n sub(exp(0x2, 0xa0), 0x1)\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1208:1218 msg.sender */\n caller\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1199:1219 balances[msg.sender] */\n and\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1199:1207 balances */\n 0x0\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1199:1219 balances[msg.sender] */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1199:1233 balances[msg.sender] = totalSupply */\n sstore\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1150:1240 function ZRXToken()... */\ntag_3:\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":795:1242 contract ZRXToken is UnlimitedAllowanceToken {... */\ntag_4:\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n return\nstop\n\nsub_0: assembly {\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":795:1242 contract ZRXToken is UnlimitedAllowanceToken {... */\n mstore(0x40, 0x60)\n jumpi(tag_1, iszero(calldatasize))\n and(div(calldataload(0x0), 0x100000000000000000000000000000000000000000000000000000000), 0xffffffff)\n 0x6fdde03\n dup2\n eq\n tag_2\n jumpi\n dup1\n 0x95ea7b3\n eq\n tag_3\n jumpi\n dup1\n 0x18160ddd\n eq\n tag_4\n jumpi\n dup1\n 0x23b872dd\n eq\n tag_5\n jumpi\n dup1\n 0x313ce567\n eq\n tag_6\n jumpi\n dup1\n 0x70a08231\n eq\n tag_7\n jumpi\n dup1\n 0x95d89b41\n eq\n tag_8\n jumpi\n dup1\n 0xa9059cbb\n eq\n tag_9\n jumpi\n dup1\n 0xdd62ed3e\n eq\n tag_10\n jumpi\n tag_1:\n invalid\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1009:1058 string constant public name = \"0x Protocol Token\" */\n tag_2:\n jumpi(tag_11, iszero(callvalue))\n invalid\n tag_11:\n tag_12\n jump(tag_13)\n tag_12:\n 0x40\n dup1\n mload\n 0x20\n dup1\n dup3\n mstore\n dup4\n mload\n dup2\n dup4\n add\n mstore\n dup4\n mload\n swap2\n swap3\n dup4\n swap3\n swap1\n dup4\n add\n swap2\n dup6\n add\n swap1\n dup1\n dup4\n dup4\n /* \"--CODEGEN--\":18:20 */\n dup3\n iszero\n /* \"--CODEGEN--\":13:16 */\n tag_14\n /* \"--CODEGEN--\":7:12 */\n jumpi\n /* \"--CODEGEN--\":32:37 */\n tag_15:\n /* \"--CODEGEN--\":59:62 */\n dup1\n /* \"--CODEGEN--\":53:58 */\n mload\n /* \"--CODEGEN--\":48:51 */\n dup3\n /* \"--CODEGEN--\":41:47 */\n mstore\n /* \"--CODEGEN--\":93:95 */\n 0x20\n /* \"--CODEGEN--\":88:91 */\n dup4\n /* \"--CODEGEN--\":85:87 */\n gt\n /* \"--CODEGEN--\":78:84 */\n iszero\n /* \"--CODEGEN--\":73:76 */\n tag_14\n /* \"--CODEGEN--\":67:72 */\n jumpi\n /* \"--CODEGEN--\":152:155 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0\n swap1\n swap3\n add\n swap2\n /* \"--CODEGEN--\":117:119 */\n 0x20\n /* \"--CODEGEN--\":108:111 */\n swap2\n dup3\n add\n swap2\n /* \"--CODEGEN--\":130:133 */\n add\n /* \"--CODEGEN--\":172:177 */\n tag_15\n /* \"--CODEGEN--\":167:171 */\n jump\n /* \"--CODEGEN--\":181:184 */\n tag_14:\n /* \"--CODEGEN--\":3:189 */\n pop\n pop\n pop\n swap1\n pop\n swap1\n dup2\n add\n swap1\n 0x1f\n and\n dup1\n iszero\n tag_16\n jumpi\n dup1\n dup3\n sub\n dup1\n mload\n 0x1\n dup4\n 0x20\n sub\n 0x100\n exp\n sub\n not\n and\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n tag_16:\n pop\n swap3\n pop\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1087:1274 */\n tag_3:\n jumpi(tag_17, iszero(callvalue))\n invalid\n tag_17:\n tag_18\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n calldataload(0x24)\n jump(tag_19)\n tag_18:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":932:964 uint public totalSupply = 10**27 */\n tag_4:\n jumpi(tag_20, iszero(callvalue))\n invalid\n tag_20:\n tag_21\n jump(tag_22)\n tag_21:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1066:1675 */\n tag_5:\n jumpi(tag_23, iszero(callvalue))\n invalid\n tag_23:\n tag_18\n 0xffffffffffffffffffffffffffffffffffffffff\n calldataload(0x4)\n dup2\n and\n swap1\n calldataload(0x24)\n and\n calldataload(0x44)\n jump(tag_25)\n tag_24:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":891:926 uint8 constant public decimals = 18 */\n tag_6:\n jumpi(tag_26, iszero(callvalue))\n invalid\n tag_26:\n tag_27\n jump(tag_28)\n tag_27:\n 0x40\n dup1\n mload\n 0xff\n swap1\n swap3\n and\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":982:1081 */\n tag_7:\n jumpi(tag_29, iszero(callvalue))\n invalid\n tag_29:\n tag_21\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n jump(tag_31)\n tag_30:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1064:1101 string constant public symbol = \"ZRX\" */\n tag_8:\n jumpi(tag_32, iszero(callvalue))\n invalid\n tag_32:\n tag_12\n jump(tag_34)\n tag_33:\n 0x40\n dup1\n mload\n 0x20\n dup1\n dup3\n mstore\n dup4\n mload\n dup2\n dup4\n add\n mstore\n dup4\n mload\n swap2\n swap3\n dup4\n swap3\n swap1\n dup4\n add\n swap2\n dup6\n add\n swap1\n dup1\n dup4\n dup4\n /* \"--CODEGEN--\":18:20 */\n dup3\n iszero\n /* \"--CODEGEN--\":13:16 */\n tag_14\n /* \"--CODEGEN--\":7:12 */\n jumpi\n /* \"--CODEGEN--\":32:37 */\n tag_36:\n /* \"--CODEGEN--\":59:62 */\n dup1\n /* \"--CODEGEN--\":53:58 */\n mload\n /* \"--CODEGEN--\":48:51 */\n dup3\n /* \"--CODEGEN--\":41:47 */\n mstore\n /* \"--CODEGEN--\":93:95 */\n 0x20\n /* \"--CODEGEN--\":88:91 */\n dup4\n /* \"--CODEGEN--\":85:87 */\n gt\n /* \"--CODEGEN--\":78:84 */\n iszero\n /* \"--CODEGEN--\":73:76 */\n tag_14\n /* \"--CODEGEN--\":67:72 */\n jumpi\n /* \"--CODEGEN--\":152:155 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0\n swap1\n swap3\n add\n swap2\n /* \"--CODEGEN--\":117:119 */\n 0x20\n /* \"--CODEGEN--\":108:111 */\n swap2\n dup3\n add\n swap2\n /* \"--CODEGEN--\":130:133 */\n add\n /* \"--CODEGEN--\":172:177 */\n tag_15\n /* \"--CODEGEN--\":167:171 */\n jump\n /* \"--CODEGEN--\":181:184 */\n tag_35:\n /* \"--CODEGEN--\":3:189 */\n pop\n pop\n pop\n swap1\n pop\n swap1\n dup2\n add\n swap1\n 0x1f\n and\n dup1\n iszero\n tag_16\n jumpi\n dup1\n dup3\n sub\n dup1\n mload\n 0x1\n dup4\n 0x20\n sub\n 0x100\n exp\n sub\n not\n and\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n tag_37:\n pop\n swap3\n pop\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":125:535 */\n tag_9:\n jumpi(tag_38, iszero(callvalue))\n invalid\n tag_38:\n tag_18\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n calldataload(0x24)\n jump(tag_40)\n tag_39:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1280:1406 */\n tag_10:\n jumpi(tag_41, iszero(callvalue))\n invalid\n tag_41:\n tag_21\n 0xffffffffffffffffffffffffffffffffffffffff\n calldataload(0x4)\n dup2\n and\n swap1\n calldataload(0x24)\n and\n jump(tag_43)\n tag_42:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1009:1058 string constant public name = \"0x Protocol Token\" */\n tag_13:\n 0x40\n dup1\n mload\n dup1\n dup3\n add\n swap1\n swap2\n mstore\n 0x11\n dup2\n mstore\n 0x30782050726f746f636f6c20546f6b656e000000000000000000000000000000\n 0x20\n dup3\n add\n mstore\n dup2\n jump\t// out\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1087:1274 */\n tag_19:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1179 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1168:1178 */\n caller\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1179 */\n dup2\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1144:1148 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1179 */\n dup2\n dup2\n mstore\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1167 */\n 0x1\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1179 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1189 */\n swap5\n dup8\n and\n dup1\n dup5\n mstore\n swap5\n dup3\n mstore\n dup1\n dup4\n sha3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1198 */\n dup7\n swap1\n sstore\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1208:1246 */\n dup1\n mload\n dup7\n dup2\n mstore\n swap1\n mload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1144:1148 */\n swap3\n swap5\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1189 */\n swap4\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1160:1179 */\n swap3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1208:1246 */\n 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925\n swap3\n swap2\n dup2\n swap1\n sub\n swap1\n swap2\n add\n swap1\n log3\n pop\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1263:1267 */\n 0x1\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1087:1274 */\n tag_44:\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":932:964 uint public totalSupply = 10**27 */\n tag_22:\n sload(0x3)\n dup2\n jump\t// out\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1066:1675 */\n tag_25:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1198:1212 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup5\n and\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1161:1165 */\n 0x0\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1198:1212 */\n dup2\n dup2\n mstore\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1198:1205 */\n 0x1\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1198:1212 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1213:1223 */\n caller\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1198:1224 */\n swap1\n swap6\n and\n dup4\n mstore\n swap4\n dup2\n mstore\n dup4\n dup3\n sha3\n sload\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1253 */\n swap3\n dup3\n mstore\n dup2\n swap1\n mstore\n swap2\n dup3\n sha3\n sload\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1263 */\n dup4\n swap1\n lt\n dup1\n iszero\n swap1\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1298 */\n tag_46\n jumpi\n pop\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1292:1298 */\n dup3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1279:1288 */\n dup2\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1279:1298 */\n lt\n iszero\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1298 */\n tag_46:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1353 */\n dup1\n iszero\n tag_47\n jumpi\n pop\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1340:1353 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup5\n and\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1340:1348 */\n 0x0\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1340:1353 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1314:1336 */\n dup4\n dup2\n add\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1314:1353 */\n lt\n iszero\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1238:1353 */\n tag_47:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1234:1669 */\n iszero\n tag_48\n jumpi\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1378:1391 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup6\n and\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1378:1386 */\n 0x0\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1378:1391 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n dup1\n dup3\n sha3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1378:1401 */\n dup1\n sload\n dup8\n add\n swap1\n sstore\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1415:1430 */\n swap2\n dup8\n and\n dup2\n mstore\n sha3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1415:1440 */\n dup1\n sload\n dup5\n swap1\n sub\n swap1\n sstore\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":768:778 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1458:1478 */\n dup2\n lt\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1454:1549 */\n iszero\n tag_49\n jumpi\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1498:1512 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup7\n and\n 0x0\n swap1\n dup2\n mstore\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1498:1505 */\n 0x1\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1498:1512 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1513:1523 */\n caller\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1498:1524 */\n swap1\n swap5\n and\n dup4\n mstore\n swap3\n swap1\n mstore\n sha3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1498:1534 */\n dup1\n sload\n dup5\n swap1\n sub\n swap1\n sstore\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1454:1549 */\n tag_49:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1578:1581 */\n dup4\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1562:1590 */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1571:1576 */\n dup6\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1562:1590 */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1583:1589 */\n dup6\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1562:1590 */\n mload(0x40)\n dup1\n dup3\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n log3\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1611:1615 */\n 0x1\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1604:1615 */\n swap2\n pop\n jump(tag_50)\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1234:1669 */\n tag_48:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1653:1658 */\n 0x0\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1646:1658 */\n swap2\n pop\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1234:1669 */\n tag_50:\n /* \"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":1066:1675 */\n tag_45:\n pop\n swap4\n swap3\n pop\n pop\n pop\n jump\t// out\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":891:926 uint8 constant public decimals = 18 */\n tag_28:\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":924:926 18 */\n 0x12\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":891:926 uint8 constant public decimals = 18 */\n dup2\n jump\t// out\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":982:1081 */\n tag_31:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1058:1074 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup2\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1035:1039 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1058:1074 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":982:1081 */\n tag_51:\n swap2\n swap1\n pop\n jump\t// out\n /* \"2.0.0/tokens/ZRXToken/ZRXToken.sol\":1064:1101 string constant public symbol = \"ZRX\" */\n tag_34:\n 0x40\n dup1\n mload\n dup1\n dup3\n add\n swap1\n swap2\n mstore\n 0x3\n dup2\n mstore\n 0x5a52580000000000000000000000000000000000000000000000000000000000\n 0x20\n dup3\n add\n mstore\n dup2\n jump\t// out\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":125:535 */\n tag_40:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:287 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":276:286 */\n caller\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:287 */\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":178:182 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:287 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n dup2\n sha3\n sload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:297 */\n dup3\n swap1\n lt\n dup1\n iszero\n swap1\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:340 */\n tag_53\n jumpi\n pop\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":327:340 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup4\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":327:335 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":327:340 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":301:323 */\n dup3\n dup2\n add\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":301:340 */\n lt\n iszero\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":267:340 */\n tag_53:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":263:529 */\n iszero\n tag_54\n jumpi\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":356:376 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":365:375 */\n caller\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":356:376 */\n dup2\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":356:364 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":356:376 */\n dup2\n dup2\n mstore\n 0x20\n dup2\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":356:386 */\n dup1\n sload\n dup9\n swap1\n sub\n swap1\n sstore\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":400:413 */\n swap4\n dup8\n and\n dup1\n dup4\n mstore\n swap2\n dup5\n swap1\n sha3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":400:423 */\n dup1\n sload\n dup8\n add\n swap1\n sstore\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":437:470 */\n dup4\n mload\n dup7\n dup2\n mstore\n swap4\n mload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":400:413 */\n swap2\n swap4\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":437:470 */\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n swap3\n swap1\n dup2\n swap1\n sub\n swap1\n swap2\n add\n swap1\n log3\n pop\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":491:495 */\n 0x1\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":484:495 */\n jump(tag_44)\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":263:529 */\n tag_54:\n pop\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":521:526 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":514:526 */\n jump(tag_44)\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":263:529 */\n tag_55:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":125:535 */\n tag_52:\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1280:1406 */\n tag_43:\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1374:1389 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup4\n and\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1351:1355 */\n 0x0\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1374:1389 */\n swap1\n dup2\n mstore\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1374:1381 */\n 0x1\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1374:1389 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1374:1399 */\n swap4\n dup6\n and\n dup4\n mstore\n swap3\n swap1\n mstore\n sha3\n sload\n /* \"1.0.0/ERC20Token/ERC20Token_v1.sol\":1280:1406 */\n tag_56:\n swap3\n swap2\n pop\n pop\n jump\t// out\n}\n", - "bytecode": { - "linkReferences": {}, - "object": "0x60606040526b033b2e3c9fd0803ce8000000600355341561001c57fe5b5b600354600160a060020a0333166000908152602081905260409020555b5b61078d8061004a6000396000f300606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610098578063095ea7b31461014657806318160ddd1461018657806323b872dd146101a8578063313ce567146101ee57806370a082311461021457806395d89b411461024f578063a9059cbb146102fd578063dd62ed3e1461033d575bfe5b34156100a057fe5b6100a861037e565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014e57fe5b61017273ffffffffffffffffffffffffffffffffffffffff600435166024356103b5565b604080519115158252519081900360200190f35b341561018e57fe5b61019661042d565b60408051918252519081900360200190f35b34156101b057fe5b61017273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610433565b604080519115158252519081900360200190f35b34156101f657fe5b6101fe6105d4565b6040805160ff9092168252519081900360200190f35b341561021c57fe5b61019673ffffffffffffffffffffffffffffffffffffffff600435166105d9565b60408051918252519081900360200190f35b341561025757fe5b6100a8610605565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030557fe5b61017273ffffffffffffffffffffffffffffffffffffffff6004351660243561063c565b604080519115158252519081900360200190f35b341561034557fe5b61019673ffffffffffffffffffffffffffffffffffffffff60043581169060243516610727565b60408051918252519081900360200190f35b60408051808201909152601181527f30782050726f746f636f6c20546f6b656e000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832033909516835293815283822054928252819052918220548390108015906104835750828110155b80156104b6575073ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090205483810110155b156105c65773ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156105585773ffffffffffffffffffffffffffffffffffffffff808616600090815260016020908152604080832033909416835292905220805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191506105cb565b600091505b5b509392505050565b601281565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60408051808201909152600381527f5a52580000000000000000000000000000000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff3316600090815260208190526040812054829010801590610699575073ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110155b156107185773ffffffffffffffffffffffffffffffffffffffff33811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610427565b506000610427565b5b92915050565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040808320938516835292905220545b929150505600a165627a7a723058208999c5329f53064aac58d4b553cb379a45bfca17e024506ff916637cfc36f7b20029", - "opcodes": "PUSH1 0x60 PUSH1 0x40 MSTORE PUSH12 0x33B2E3C9FD0803CE8000000 PUSH1 0x3 SSTORE CALLVALUE ISZERO PUSH2 0x1C JUMPI INVALID JUMPDEST JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SSTORE JUMPDEST JUMPDEST PUSH2 0x78D DUP1 PUSH2 0x4A PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0x96 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0x98 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x186 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1A8 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2FD JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x33D JUMPI JUMPDEST INVALID JUMPDEST CALLVALUE ISZERO PUSH2 0xA0 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x14E JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3B5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x18E JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH2 0x42D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1B0 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x433 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F6 JUMPI INVALID JUMPDEST PUSH2 0x1FE PUSH2 0x5D4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21C JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5D9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x305 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x63C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x345 JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x727 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x11 DUP2 MSTORE PUSH32 0x30782050726F746F636F6C20546F6B656E000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP5 DUP8 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE DUP1 DUP4 SHA3 DUP7 SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP5 SWAP4 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP6 AND DUP4 MSTORE SWAP4 DUP2 MSTORE DUP4 DUP3 SHA3 SLOAD SWAP3 DUP3 MSTORE DUP2 SWAP1 MSTORE SWAP2 DUP3 SHA3 SLOAD DUP4 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x483 JUMPI POP DUP3 DUP2 LT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x4B6 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP4 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x5C6 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x558 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 SWAP2 POP PUSH2 0x5CB JUMP JUMPDEST PUSH1 0x0 SWAP2 POP JUMPDEST JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x12 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x3 DUP2 MSTORE PUSH32 0x5A52580000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 SHA3 SLOAD DUP3 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x699 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP3 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x718 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 PUSH2 0x427 JUMP JUMPDEST POP PUSH1 0x0 PUSH2 0x427 JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 SLOAD JUMPDEST SWAP3 SWAP2 POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 DUP10 SWAP10 0xc5 ORIGIN SWAP16 MSTORE8 MOD 0x4a 0xac PC 0xd4 0xb5 MSTORE8 0xcb CALLDATACOPY SWAP11 GASLIMIT 0xbf 0xca OR 0xe0 0x24 POP PUSH16 0xF916637CFC36F7B20029000000000000 ", - "sourceMap": "795:447:3:-;;;958:6;932:32;;1150:90;;;;;;;1222:11;;-1:-1:-1;;;;;1208:10:3;1199:20;:8;:20;;;;;;;;;;:34;1150:90;795:447;;;;;;;" - }, - "deployedBytecode": { - "linkReferences": {}, - "object": "0x606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610098578063095ea7b31461014657806318160ddd1461018657806323b872dd146101a8578063313ce567146101ee57806370a082311461021457806395d89b411461024f578063a9059cbb146102fd578063dd62ed3e1461033d575bfe5b34156100a057fe5b6100a861037e565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014e57fe5b61017273ffffffffffffffffffffffffffffffffffffffff600435166024356103b5565b604080519115158252519081900360200190f35b341561018e57fe5b61019661042d565b60408051918252519081900360200190f35b34156101b057fe5b61017273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610433565b604080519115158252519081900360200190f35b34156101f657fe5b6101fe6105d4565b6040805160ff9092168252519081900360200190f35b341561021c57fe5b61019673ffffffffffffffffffffffffffffffffffffffff600435166105d9565b60408051918252519081900360200190f35b341561025757fe5b6100a8610605565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030557fe5b61017273ffffffffffffffffffffffffffffffffffffffff6004351660243561063c565b604080519115158252519081900360200190f35b341561034557fe5b61019673ffffffffffffffffffffffffffffffffffffffff60043581169060243516610727565b60408051918252519081900360200190f35b60408051808201909152601181527f30782050726f746f636f6c20546f6b656e000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832033909516835293815283822054928252819052918220548390108015906104835750828110155b80156104b6575073ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090205483810110155b156105c65773ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156105585773ffffffffffffffffffffffffffffffffffffffff808616600090815260016020908152604080832033909416835292905220805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191506105cb565b600091505b5b509392505050565b601281565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60408051808201909152600381527f5a52580000000000000000000000000000000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff3316600090815260208190526040812054829010801590610699575073ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110155b156107185773ffffffffffffffffffffffffffffffffffffffff33811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610427565b506000610427565b5b92915050565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040808320938516835292905220545b929150505600a165627a7a723058208999c5329f53064aac58d4b553cb379a45bfca17e024506ff916637cfc36f7b20029", - "opcodes": "PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0x96 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0x98 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x186 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1A8 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2FD JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x33D JUMPI JUMPDEST INVALID JUMPDEST CALLVALUE ISZERO PUSH2 0xA0 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x14E JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3B5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x18E JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH2 0x42D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1B0 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x433 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F6 JUMPI INVALID JUMPDEST PUSH2 0x1FE PUSH2 0x5D4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21C JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5D9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x305 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x63C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x345 JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x727 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x11 DUP2 MSTORE PUSH32 0x30782050726F746F636F6C20546F6B656E000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP5 DUP8 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE DUP1 DUP4 SHA3 DUP7 SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP5 SWAP4 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP6 AND DUP4 MSTORE SWAP4 DUP2 MSTORE DUP4 DUP3 SHA3 SLOAD SWAP3 DUP3 MSTORE DUP2 SWAP1 MSTORE SWAP2 DUP3 SHA3 SLOAD DUP4 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x483 JUMPI POP DUP3 DUP2 LT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x4B6 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP4 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x5C6 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x558 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 SWAP2 POP PUSH2 0x5CB JUMP JUMPDEST PUSH1 0x0 SWAP2 POP JUMPDEST JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x12 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x3 DUP2 MSTORE PUSH32 0x5A52580000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 SHA3 SLOAD DUP3 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x699 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP3 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x718 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 PUSH2 0x427 JUMP JUMPDEST POP PUSH1 0x0 PUSH2 0x427 JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 SLOAD JUMPDEST SWAP3 SWAP2 POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 DUP10 SWAP10 0xc5 ORIGIN SWAP16 MSTORE8 MOD 0x4a 0xac PC 0xd4 0xb5 MSTORE8 0xcb CALLDATACOPY SWAP11 GASLIMIT 0xbf 0xca OR 0xe0 0x24 POP PUSH16 0xF916637CFC36F7B20029000000000000 ", - "sourceMap": "795:447:3:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1009:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18:2:-1;;13:3;7:5;32;59:3;53:5;48:3;41:6;93:2;88:3;85:2;78:6;73:3;67:5;152:3;;;;;117:2;108:3;;;;130;172:5;167:4;181:3;3:186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1087:187:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;932:32:3;;;;;;;;;;;;;;;;;;;;;;;;;;1066:609:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;891:35:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;982:99:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1064:37:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18:2:-1;;13:3;7:5;32;59:3;53:5;48:3;41:6;93:2;88:3;85:2;78:6;73:3;67:5;152:3;;;;;117:2;108:3;;;;130;172:5;167:4;181:3;3:186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125:410:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1280:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1009:49:3;;;;;;;;;;;;;;;;;;;:::o;1087:187:0:-;1160:19;1168:10;1160:19;;1144:4;1160:19;;;:7;:19;;;;;;;;:29;;;;;;;;;;;;:38;;;1208;;;;;;;1144:4;;1160:29;:19;1208:38;;;;;;;;;;;-1:-1:-1;1263:4:0;1087:187;;;;;:::o;932:32:3:-;;;;:::o;1066:609:2:-;1198:14;;;;1161:4;1198:14;;;:7;:14;;;;;;;;1213:10;1198:26;;;;;;;;;;;;1238:15;;;;;;;;;;:25;;;;;;:60;;;1292:6;1279:9;:19;;1238:60;:115;;;;-1:-1:-1;1340:13:2;;;:8;:13;;;;;;;;;;;1314:22;;;:39;;1238:115;1234:435;;;1378:13;;;;:8;:13;;;;;;;;;;;:23;;;;;;1415:15;;;;;;:25;;;;;;;768:10;1458:20;;1454:95;;;1498:14;;;;;;;;:7;:14;;;;;;;;1513:10;1498:26;;;;;;;;;:36;;;;;;;1454:95;1578:3;1562:28;;1571:5;1562:28;;;1583:6;1562:28;;;;;;;;;;;;;;;;;;1611:4;1604:11;;;;1234:435;1653:5;1646:12;;1234:435;1066:609;;;;;;;:::o;891:35:3:-;924:2;891:35;:::o;982:99:0:-;1058:16;;;1035:4;1058:16;;;;;;;;;;;982:99;;;;:::o;1064:37:3:-;;;;;;;;;;;;;;;;;;;:::o;125:410:0:-;267:20;276:10;267:20;178:4;267:20;;;;;;;;;;;:30;;;;;;:73;;-1:-1:-1;327:13:0;;;:8;:13;;;;;;;;;;;301:22;;;:39;;267:73;263:266;;;356:20;365:10;356:20;;:8;:20;;;;;;;;;;;:30;;;;;;;400:13;;;;;;;;;;:23;;;;;;437:33;;;;;;;400:13;;437:33;;;;;;;;;;;-1:-1:-1;491:4:0;484:11;;263:266;-1:-1:-1;521:5:0;514:12;;263:266;125:410;;;;;:::o;1280:126::-;1374:15;;;;1351:4;1374:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;1280:126;;;;;:::o" - }, - "gasEstimates": { - "creation": { - "codeDepositCost": "386600", - "executionCost": "40780", - "totalCost": "427380" - }, - "external": { - "allowance(address,address)": "737", - "approve(address,uint256)": "22218", - "balanceOf(address)": "579", - "decimals()": "270", - "name()": "530", - "symbol()": "662", - "totalSupply()": "417", - "transfer(address,uint256)": "43393", - "transferFrom(address,address,uint256)": "64116" - } - }, - "legacyAssembly": { - ".code": [ - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "60" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "40" - }, - { - "begin": 795, - "end": 1242, - "name": "MSTORE" - }, - { - "begin": 958, - "end": 964, - "name": "PUSH", - "value": "33B2E3C9FD0803CE8000000" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH", - "value": "3" - }, - { - "begin": 932, - "end": 964, - "name": "SSTORE" - }, - { - "begin": 1150, - "end": 1240, - "name": "CALLVALUE" - }, - { - "begin": 1150, - "end": 1240, - "name": "ISZERO" - }, - { - "begin": 1150, - "end": 1240, - "name": "PUSH [tag]", - "value": "1" - }, - { - "begin": 1150, - "end": 1240, - "name": "JUMPI" - }, - { - "begin": 1150, - "end": 1240, - "name": "INVALID" - }, - { - "begin": 1150, - "end": 1240, - "name": "tag", - "value": "1" - }, - { - "begin": 1150, - "end": 1240, - "name": "JUMPDEST" - }, - { - "begin": 1150, - "end": 1240, - "name": "tag", - "value": "2" - }, - { - "begin": 1150, - "end": 1240, - "name": "JUMPDEST" - }, - { - "begin": 1222, - "end": 1233, - "name": "PUSH", - "value": "3" - }, - { - "begin": 1222, - "end": 1233, - "name": "SLOAD" - }, - { - "begin": -1, - "end": -1, - "name": "PUSH", - "value": "1" - }, - { - "begin": -1, - "end": -1, - "name": "PUSH", - "value": "A0" - }, - { - "begin": -1, - "end": -1, - "name": "PUSH", - "value": "2" - }, - { - "begin": -1, - "end": -1, - "name": "EXP" - }, - { - "begin": -1, - "end": -1, - "name": "SUB" - }, - { - "begin": 1208, - "end": 1218, - "name": "CALLER" - }, - { - "begin": 1199, - "end": 1219, - "name": "AND" - }, - { - "begin": 1199, - "end": 1207, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1199, - "end": 1219, - "name": "SWAP1" - }, - { - "begin": 1199, - "end": 1219, - "name": "DUP2" - }, - { - "begin": 1199, - "end": 1219, - "name": "MSTORE" - }, - { - "begin": 1199, - "end": 1219, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1199, - "end": 1219, - "name": "DUP2" - }, - { - "begin": 1199, - "end": 1219, - "name": "SWAP1" - }, - { - "begin": 1199, - "end": 1219, - "name": "MSTORE" - }, - { - "begin": 1199, - "end": 1219, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1199, - "end": 1219, - "name": "SWAP1" - }, - { - "begin": 1199, - "end": 1219, - "name": "SHA3" - }, - { - "begin": 1199, - "end": 1233, - "name": "SSTORE" - }, - { - "begin": 1150, - "end": 1240, - "name": "tag", - "value": "3" - }, - { - "begin": 1150, - "end": 1240, - "name": "JUMPDEST" - }, - { - "begin": 795, - "end": 1242, - "name": "tag", - "value": "4" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPDEST" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH #[$]", - "value": "0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [$]", - "value": "0000000000000000000000000000000000000000000000000000000000000000" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "0" - }, - { - "begin": 795, - "end": 1242, - "name": "CODECOPY" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "0" - }, - { - "begin": 795, - "end": 1242, - "name": "RETURN" - } - ], - ".data": { - "0": { - ".code": [ - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "60" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "40" - }, - { - "begin": 795, - "end": 1242, - "name": "MSTORE" - }, - { - "begin": 795, - "end": 1242, - "name": "CALLDATASIZE" - }, - { - "begin": 795, - "end": 1242, - "name": "ISZERO" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "1" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "FFFFFFFF" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "100000000000000000000000000000000000000000000000000000000" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "0" - }, - { - "begin": 795, - "end": 1242, - "name": "CALLDATALOAD" - }, - { - "begin": 795, - "end": 1242, - "name": "DIV" - }, - { - "begin": 795, - "end": 1242, - "name": "AND" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "6FDDE03" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP2" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "2" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "95EA7B3" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "3" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "18160DDD" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "4" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "23B872DD" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "5" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "313CE567" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "6" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "70A08231" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "7" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "95D89B41" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "8" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "A9059CBB" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "9" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "DUP1" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH", - "value": "DD62ED3E" - }, - { - "begin": 795, - "end": 1242, - "name": "EQ" - }, - { - "begin": 795, - "end": 1242, - "name": "PUSH [tag]", - "value": "10" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPI" - }, - { - "begin": 795, - "end": 1242, - "name": "tag", - "value": "1" - }, - { - "begin": 795, - "end": 1242, - "name": "JUMPDEST" - }, - { - "begin": 795, - "end": 1242, - "name": "INVALID" - }, - { - "begin": 1009, - "end": 1058, - "name": "tag", - "value": "2" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMPDEST" - }, - { - "begin": 1009, - "end": 1058, - "name": "CALLVALUE" - }, - { - "begin": 1009, - "end": 1058, - "name": "ISZERO" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH [tag]", - "value": "11" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMPI" - }, - { - "begin": 1009, - "end": 1058, - "name": "INVALID" - }, - { - "begin": 1009, - "end": 1058, - "name": "tag", - "value": "11" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMPDEST" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH [tag]", - "value": "12" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH [tag]", - "value": "13" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMP" - }, - { - "begin": 1009, - "end": 1058, - "name": "tag", - "value": "12" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMPDEST" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "MLOAD" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP3" - }, - { - "begin": 1009, - "end": 1058, - "name": "MSTORE" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "MLOAD" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "ADD" - }, - { - "begin": 1009, - "end": 1058, - "name": "MSTORE" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "MLOAD" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP3" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP3" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "ADD" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP6" - }, - { - "begin": 1009, - "end": 1058, - "name": "ADD" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP4" - }, - { - "begin": 18, - "end": 20, - "name": "DUP3" - }, - { - "begin": 18, - "end": 20, - "name": "ISZERO" - }, - { - "begin": 13, - "end": 16, - "name": "PUSH [tag]", - "value": "14" - }, - { - "begin": 7, - "end": 12, - "name": "JUMPI" - }, - { - "begin": 32, - "end": 37, - "name": "tag", - "value": "15" - }, - { - "begin": 32, - "end": 37, - "name": "JUMPDEST" - }, - { - "begin": 59, - "end": 62, - "name": "DUP1" - }, - { - "begin": 53, - "end": 58, - "name": "MLOAD" - }, - { - "begin": 48, - "end": 51, - "name": "DUP3" - }, - { - "begin": 41, - "end": 47, - "name": "MSTORE" - }, - { - "begin": 93, - "end": 95, - "name": "PUSH", - "value": "20" - }, - { - "begin": 88, - "end": 91, - "name": "DUP4" - }, - { - "begin": 85, - "end": 87, - "name": "GT" - }, - { - "begin": 78, - "end": 84, - "name": "ISZERO" - }, - { - "begin": 73, - "end": 76, - "name": "PUSH [tag]", - "value": "14" - }, - { - "begin": 67, - "end": 72, - "name": "JUMPI" - }, - { - "begin": 152, - "end": 155, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP1" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP3" - }, - { - "begin": 152, - "end": 155, - "name": "ADD" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP2" - }, - { - "begin": 117, - "end": 119, - "name": "PUSH", - "value": "20" - }, - { - "begin": 108, - "end": 111, - "name": "SWAP2" - }, - { - "begin": 108, - "end": 111, - "name": "DUP3" - }, - { - "begin": 108, - "end": 111, - "name": "ADD" - }, - { - "begin": 108, - "end": 111, - "name": "SWAP2" - }, - { - "begin": 130, - "end": 133, - "name": "ADD" - }, - { - "begin": 172, - "end": 177, - "name": "PUSH [tag]", - "value": "15" - }, - { - "begin": 167, - "end": 171, - "name": "JUMP" - }, - { - "begin": 181, - "end": 184, - "name": "tag", - "value": "14" - }, - { - "begin": 181, - "end": 184, - "name": "JUMPDEST" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP2" - }, - { - "begin": 3, - "end": 189, - "name": "ADD" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "1F" - }, - { - "begin": 3, - "end": 189, - "name": "AND" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "ISZERO" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH [tag]", - "value": "16" - }, - { - "begin": 3, - "end": 189, - "name": "JUMPI" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP3" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "MLOAD" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP4" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "20" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "100" - }, - { - "begin": 3, - "end": 189, - "name": "EXP" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "NOT" - }, - { - "begin": 3, - "end": 189, - "name": "AND" - }, - { - "begin": 3, - "end": 189, - "name": "DUP2" - }, - { - "begin": 3, - "end": 189, - "name": "MSTORE" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "20" - }, - { - "begin": 3, - "end": 189, - "name": "ADD" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP2" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "tag", - "value": "16" - }, - { - "begin": 3, - "end": 189, - "name": "JUMPDEST" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP3" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "40" - }, - { - "begin": 3, - "end": 189, - "name": "MLOAD" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP2" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "RETURN" - }, - { - "begin": 1087, - "end": 1274, - "name": "tag", - "value": "3" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPDEST" - }, - { - "begin": 1087, - "end": 1274, - "name": "CALLVALUE" - }, - { - "begin": 1087, - "end": 1274, - "name": "ISZERO" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH [tag]", - "value": "17" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPI" - }, - { - "begin": 1087, - "end": 1274, - "name": "INVALID" - }, - { - "begin": 1087, - "end": 1274, - "name": "tag", - "value": "17" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPDEST" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH [tag]", - "value": "18" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH", - "value": "4" - }, - { - "begin": 1087, - "end": 1274, - "name": "CALLDATALOAD" - }, - { - "begin": 1087, - "end": 1274, - "name": "AND" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH", - "value": "24" - }, - { - "begin": 1087, - "end": 1274, - "name": "CALLDATALOAD" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH [tag]", - "value": "19" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMP" - }, - { - "begin": 1087, - "end": 1274, - "name": "tag", - "value": "18" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPDEST" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1087, - "end": 1274, - "name": "DUP1" - }, - { - "begin": 1087, - "end": 1274, - "name": "MLOAD" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP2" - }, - { - "begin": 1087, - "end": 1274, - "name": "ISZERO" - }, - { - "begin": 1087, - "end": 1274, - "name": "ISZERO" - }, - { - "begin": 1087, - "end": 1274, - "name": "DUP3" - }, - { - "begin": 1087, - "end": 1274, - "name": "MSTORE" - }, - { - "begin": 1087, - "end": 1274, - "name": "MLOAD" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP1" - }, - { - "begin": 1087, - "end": 1274, - "name": "DUP2" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP1" - }, - { - "begin": 1087, - "end": 1274, - "name": "SUB" - }, - { - "begin": 1087, - "end": 1274, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1087, - "end": 1274, - "name": "ADD" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP1" - }, - { - "begin": 1087, - "end": 1274, - "name": "RETURN" - }, - { - "begin": 932, - "end": 964, - "name": "tag", - "value": "4" - }, - { - "begin": 932, - "end": 964, - "name": "JUMPDEST" - }, - { - "begin": 932, - "end": 964, - "name": "CALLVALUE" - }, - { - "begin": 932, - "end": 964, - "name": "ISZERO" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH [tag]", - "value": "20" - }, - { - "begin": 932, - "end": 964, - "name": "JUMPI" - }, - { - "begin": 932, - "end": 964, - "name": "INVALID" - }, - { - "begin": 932, - "end": 964, - "name": "tag", - "value": "20" - }, - { - "begin": 932, - "end": 964, - "name": "JUMPDEST" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH [tag]", - "value": "21" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH [tag]", - "value": "22" - }, - { - "begin": 932, - "end": 964, - "name": "JUMP" - }, - { - "begin": 932, - "end": 964, - "name": "tag", - "value": "21" - }, - { - "begin": 932, - "end": 964, - "name": "JUMPDEST" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH", - "value": "40" - }, - { - "begin": 932, - "end": 964, - "name": "DUP1" - }, - { - "begin": 932, - "end": 964, - "name": "MLOAD" - }, - { - "begin": 932, - "end": 964, - "name": "SWAP2" - }, - { - "begin": 932, - "end": 964, - "name": "DUP3" - }, - { - "begin": 932, - "end": 964, - "name": "MSTORE" - }, - { - "begin": 932, - "end": 964, - "name": "MLOAD" - }, - { - "begin": 932, - "end": 964, - "name": "SWAP1" - }, - { - "begin": 932, - "end": 964, - "name": "DUP2" - }, - { - "begin": 932, - "end": 964, - "name": "SWAP1" - }, - { - "begin": 932, - "end": 964, - "name": "SUB" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH", - "value": "20" - }, - { - "begin": 932, - "end": 964, - "name": "ADD" - }, - { - "begin": 932, - "end": 964, - "name": "SWAP1" - }, - { - "begin": 932, - "end": 964, - "name": "RETURN" - }, - { - "begin": 1066, - "end": 1675, - "name": "tag", - "value": "5" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPDEST" - }, - { - "begin": 1066, - "end": 1675, - "name": "CALLVALUE" - }, - { - "begin": 1066, - "end": 1675, - "name": "ISZERO" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH [tag]", - "value": "23" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPI" - }, - { - "begin": 1066, - "end": 1675, - "name": "INVALID" - }, - { - "begin": 1066, - "end": 1675, - "name": "tag", - "value": "23" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPDEST" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH [tag]", - "value": "18" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "4" - }, - { - "begin": 1066, - "end": 1675, - "name": "CALLDATALOAD" - }, - { - "begin": 1066, - "end": 1675, - "name": "DUP2" - }, - { - "begin": 1066, - "end": 1675, - "name": "AND" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP1" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "24" - }, - { - "begin": 1066, - "end": 1675, - "name": "CALLDATALOAD" - }, - { - "begin": 1066, - "end": 1675, - "name": "AND" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "44" - }, - { - "begin": 1066, - "end": 1675, - "name": "CALLDATALOAD" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH [tag]", - "value": "25" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMP" - }, - { - "begin": 1066, - "end": 1675, - "name": "tag", - "value": "24" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPDEST" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1066, - "end": 1675, - "name": "DUP1" - }, - { - "begin": 1066, - "end": 1675, - "name": "MLOAD" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP2" - }, - { - "begin": 1066, - "end": 1675, - "name": "ISZERO" - }, - { - "begin": 1066, - "end": 1675, - "name": "ISZERO" - }, - { - "begin": 1066, - "end": 1675, - "name": "DUP3" - }, - { - "begin": 1066, - "end": 1675, - "name": "MSTORE" - }, - { - "begin": 1066, - "end": 1675, - "name": "MLOAD" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP1" - }, - { - "begin": 1066, - "end": 1675, - "name": "DUP2" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP1" - }, - { - "begin": 1066, - "end": 1675, - "name": "SUB" - }, - { - "begin": 1066, - "end": 1675, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1066, - "end": 1675, - "name": "ADD" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP1" - }, - { - "begin": 1066, - "end": 1675, - "name": "RETURN" - }, - { - "begin": 891, - "end": 926, - "name": "tag", - "value": "6" - }, - { - "begin": 891, - "end": 926, - "name": "JUMPDEST" - }, - { - "begin": 891, - "end": 926, - "name": "CALLVALUE" - }, - { - "begin": 891, - "end": 926, - "name": "ISZERO" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH [tag]", - "value": "26" - }, - { - "begin": 891, - "end": 926, - "name": "JUMPI" - }, - { - "begin": 891, - "end": 926, - "name": "INVALID" - }, - { - "begin": 891, - "end": 926, - "name": "tag", - "value": "26" - }, - { - "begin": 891, - "end": 926, - "name": "JUMPDEST" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH [tag]", - "value": "27" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH [tag]", - "value": "28" - }, - { - "begin": 891, - "end": 926, - "name": "JUMP" - }, - { - "begin": 891, - "end": 926, - "name": "tag", - "value": "27" - }, - { - "begin": 891, - "end": 926, - "name": "JUMPDEST" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH", - "value": "40" - }, - { - "begin": 891, - "end": 926, - "name": "DUP1" - }, - { - "begin": 891, - "end": 926, - "name": "MLOAD" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH", - "value": "FF" - }, - { - "begin": 891, - "end": 926, - "name": "SWAP1" - }, - { - "begin": 891, - "end": 926, - "name": "SWAP3" - }, - { - "begin": 891, - "end": 926, - "name": "AND" - }, - { - "begin": 891, - "end": 926, - "name": "DUP3" - }, - { - "begin": 891, - "end": 926, - "name": "MSTORE" - }, - { - "begin": 891, - "end": 926, - "name": "MLOAD" - }, - { - "begin": 891, - "end": 926, - "name": "SWAP1" - }, - { - "begin": 891, - "end": 926, - "name": "DUP2" - }, - { - "begin": 891, - "end": 926, - "name": "SWAP1" - }, - { - "begin": 891, - "end": 926, - "name": "SUB" - }, - { - "begin": 891, - "end": 926, - "name": "PUSH", - "value": "20" - }, - { - "begin": 891, - "end": 926, - "name": "ADD" - }, - { - "begin": 891, - "end": 926, - "name": "SWAP1" - }, - { - "begin": 891, - "end": 926, - "name": "RETURN" - }, - { - "begin": 982, - "end": 1081, - "name": "tag", - "value": "7" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPDEST" - }, - { - "begin": 982, - "end": 1081, - "name": "CALLVALUE" - }, - { - "begin": 982, - "end": 1081, - "name": "ISZERO" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH [tag]", - "value": "29" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPI" - }, - { - "begin": 982, - "end": 1081, - "name": "INVALID" - }, - { - "begin": 982, - "end": 1081, - "name": "tag", - "value": "29" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPDEST" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH [tag]", - "value": "21" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH", - "value": "4" - }, - { - "begin": 982, - "end": 1081, - "name": "CALLDATALOAD" - }, - { - "begin": 982, - "end": 1081, - "name": "AND" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH [tag]", - "value": "31" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMP" - }, - { - "begin": 982, - "end": 1081, - "name": "tag", - "value": "30" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPDEST" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH", - "value": "40" - }, - { - "begin": 982, - "end": 1081, - "name": "DUP1" - }, - { - "begin": 982, - "end": 1081, - "name": "MLOAD" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP2" - }, - { - "begin": 982, - "end": 1081, - "name": "DUP3" - }, - { - "begin": 982, - "end": 1081, - "name": "MSTORE" - }, - { - "begin": 982, - "end": 1081, - "name": "MLOAD" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP1" - }, - { - "begin": 982, - "end": 1081, - "name": "DUP2" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP1" - }, - { - "begin": 982, - "end": 1081, - "name": "SUB" - }, - { - "begin": 982, - "end": 1081, - "name": "PUSH", - "value": "20" - }, - { - "begin": 982, - "end": 1081, - "name": "ADD" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP1" - }, - { - "begin": 982, - "end": 1081, - "name": "RETURN" - }, - { - "begin": 1064, - "end": 1101, - "name": "tag", - "value": "8" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMPDEST" - }, - { - "begin": 1064, - "end": 1101, - "name": "CALLVALUE" - }, - { - "begin": 1064, - "end": 1101, - "name": "ISZERO" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH [tag]", - "value": "32" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMPI" - }, - { - "begin": 1064, - "end": 1101, - "name": "INVALID" - }, - { - "begin": 1064, - "end": 1101, - "name": "tag", - "value": "32" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMPDEST" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH [tag]", - "value": "12" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH [tag]", - "value": "34" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMP" - }, - { - "begin": 1064, - "end": 1101, - "name": "tag", - "value": "33" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMPDEST" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "MLOAD" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP3" - }, - { - "begin": 1064, - "end": 1101, - "name": "MSTORE" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "MLOAD" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "ADD" - }, - { - "begin": 1064, - "end": 1101, - "name": "MSTORE" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "MLOAD" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP3" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP3" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "ADD" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP6" - }, - { - "begin": 1064, - "end": 1101, - "name": "ADD" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP4" - }, - { - "begin": 18, - "end": 20, - "name": "DUP3" - }, - { - "begin": 18, - "end": 20, - "name": "ISZERO" - }, - { - "begin": 13, - "end": 16, - "name": "PUSH [tag]", - "value": "14" - }, - { - "begin": 7, - "end": 12, - "name": "JUMPI" - }, - { - "begin": 32, - "end": 37, - "name": "tag", - "value": "36" - }, - { - "begin": 32, - "end": 37, - "name": "JUMPDEST" - }, - { - "begin": 59, - "end": 62, - "name": "DUP1" - }, - { - "begin": 53, - "end": 58, - "name": "MLOAD" - }, - { - "begin": 48, - "end": 51, - "name": "DUP3" - }, - { - "begin": 41, - "end": 47, - "name": "MSTORE" - }, - { - "begin": 93, - "end": 95, - "name": "PUSH", - "value": "20" - }, - { - "begin": 88, - "end": 91, - "name": "DUP4" - }, - { - "begin": 85, - "end": 87, - "name": "GT" - }, - { - "begin": 78, - "end": 84, - "name": "ISZERO" - }, - { - "begin": 73, - "end": 76, - "name": "PUSH [tag]", - "value": "14" - }, - { - "begin": 67, - "end": 72, - "name": "JUMPI" - }, - { - "begin": 152, - "end": 155, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP1" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP3" - }, - { - "begin": 152, - "end": 155, - "name": "ADD" - }, - { - "begin": 152, - "end": 155, - "name": "SWAP2" - }, - { - "begin": 117, - "end": 119, - "name": "PUSH", - "value": "20" - }, - { - "begin": 108, - "end": 111, - "name": "SWAP2" - }, - { - "begin": 108, - "end": 111, - "name": "DUP3" - }, - { - "begin": 108, - "end": 111, - "name": "ADD" - }, - { - "begin": 108, - "end": 111, - "name": "SWAP2" - }, - { - "begin": 130, - "end": 133, - "name": "ADD" - }, - { - "begin": 172, - "end": 177, - "name": "PUSH [tag]", - "value": "15" - }, - { - "begin": 167, - "end": 171, - "name": "JUMP" - }, - { - "begin": 181, - "end": 184, - "name": "tag", - "value": "35" - }, - { - "begin": 181, - "end": 184, - "name": "JUMPDEST" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP2" - }, - { - "begin": 3, - "end": 189, - "name": "ADD" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "1F" - }, - { - "begin": 3, - "end": 189, - "name": "AND" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "ISZERO" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH [tag]", - "value": "16" - }, - { - "begin": 3, - "end": 189, - "name": "JUMPI" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP3" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "MLOAD" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "1" - }, - { - "begin": 3, - "end": 189, - "name": "DUP4" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "20" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "100" - }, - { - "begin": 3, - "end": 189, - "name": "EXP" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "NOT" - }, - { - "begin": 3, - "end": 189, - "name": "AND" - }, - { - "begin": 3, - "end": 189, - "name": "DUP2" - }, - { - "begin": 3, - "end": 189, - "name": "MSTORE" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "20" - }, - { - "begin": 3, - "end": 189, - "name": "ADD" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP2" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "tag", - "value": "37" - }, - { - "begin": 3, - "end": 189, - "name": "JUMPDEST" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP3" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "POP" - }, - { - "begin": 3, - "end": 189, - "name": "PUSH", - "value": "40" - }, - { - "begin": 3, - "end": 189, - "name": "MLOAD" - }, - { - "begin": 3, - "end": 189, - "name": "DUP1" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP2" - }, - { - "begin": 3, - "end": 189, - "name": "SUB" - }, - { - "begin": 3, - "end": 189, - "name": "SWAP1" - }, - { - "begin": 3, - "end": 189, - "name": "RETURN" - }, - { - "begin": 125, - "end": 535, - "name": "tag", - "value": "9" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPDEST" - }, - { - "begin": 125, - "end": 535, - "name": "CALLVALUE" - }, - { - "begin": 125, - "end": 535, - "name": "ISZERO" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH [tag]", - "value": "38" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPI" - }, - { - "begin": 125, - "end": 535, - "name": "INVALID" - }, - { - "begin": 125, - "end": 535, - "name": "tag", - "value": "38" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPDEST" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH [tag]", - "value": "18" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH", - "value": "4" - }, - { - "begin": 125, - "end": 535, - "name": "CALLDATALOAD" - }, - { - "begin": 125, - "end": 535, - "name": "AND" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH", - "value": "24" - }, - { - "begin": 125, - "end": 535, - "name": "CALLDATALOAD" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH [tag]", - "value": "40" - }, - { - "begin": 125, - "end": 535, - "name": "JUMP" - }, - { - "begin": 125, - "end": 535, - "name": "tag", - "value": "39" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPDEST" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH", - "value": "40" - }, - { - "begin": 125, - "end": 535, - "name": "DUP1" - }, - { - "begin": 125, - "end": 535, - "name": "MLOAD" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP2" - }, - { - "begin": 125, - "end": 535, - "name": "ISZERO" - }, - { - "begin": 125, - "end": 535, - "name": "ISZERO" - }, - { - "begin": 125, - "end": 535, - "name": "DUP3" - }, - { - "begin": 125, - "end": 535, - "name": "MSTORE" - }, - { - "begin": 125, - "end": 535, - "name": "MLOAD" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP1" - }, - { - "begin": 125, - "end": 535, - "name": "DUP2" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP1" - }, - { - "begin": 125, - "end": 535, - "name": "SUB" - }, - { - "begin": 125, - "end": 535, - "name": "PUSH", - "value": "20" - }, - { - "begin": 125, - "end": 535, - "name": "ADD" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP1" - }, - { - "begin": 125, - "end": 535, - "name": "RETURN" - }, - { - "begin": 1280, - "end": 1406, - "name": "tag", - "value": "10" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPDEST" - }, - { - "begin": 1280, - "end": 1406, - "name": "CALLVALUE" - }, - { - "begin": 1280, - "end": 1406, - "name": "ISZERO" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH [tag]", - "value": "41" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPI" - }, - { - "begin": 1280, - "end": 1406, - "name": "INVALID" - }, - { - "begin": 1280, - "end": 1406, - "name": "tag", - "value": "41" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPDEST" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH [tag]", - "value": "21" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH", - "value": "4" - }, - { - "begin": 1280, - "end": 1406, - "name": "CALLDATALOAD" - }, - { - "begin": 1280, - "end": 1406, - "name": "DUP2" - }, - { - "begin": 1280, - "end": 1406, - "name": "AND" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP1" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH", - "value": "24" - }, - { - "begin": 1280, - "end": 1406, - "name": "CALLDATALOAD" - }, - { - "begin": 1280, - "end": 1406, - "name": "AND" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH [tag]", - "value": "43" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMP" - }, - { - "begin": 1280, - "end": 1406, - "name": "tag", - "value": "42" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPDEST" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1280, - "end": 1406, - "name": "DUP1" - }, - { - "begin": 1280, - "end": 1406, - "name": "MLOAD" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP2" - }, - { - "begin": 1280, - "end": 1406, - "name": "DUP3" - }, - { - "begin": 1280, - "end": 1406, - "name": "MSTORE" - }, - { - "begin": 1280, - "end": 1406, - "name": "MLOAD" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP1" - }, - { - "begin": 1280, - "end": 1406, - "name": "DUP2" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP1" - }, - { - "begin": 1280, - "end": 1406, - "name": "SUB" - }, - { - "begin": 1280, - "end": 1406, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1280, - "end": 1406, - "name": "ADD" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP1" - }, - { - "begin": 1280, - "end": 1406, - "name": "RETURN" - }, - { - "begin": 1009, - "end": 1058, - "name": "tag", - "value": "13" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMPDEST" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "MLOAD" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP3" - }, - { - "begin": 1009, - "end": 1058, - "name": "ADD" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP1" - }, - { - "begin": 1009, - "end": 1058, - "name": "SWAP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "MSTORE" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "11" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "MSTORE" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "30782050726F746F636F6C20546F6B656E000000000000000000000000000000" - }, - { - "begin": 1009, - "end": 1058, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP3" - }, - { - "begin": 1009, - "end": 1058, - "name": "ADD" - }, - { - "begin": 1009, - "end": 1058, - "name": "MSTORE" - }, - { - "begin": 1009, - "end": 1058, - "name": "DUP2" - }, - { - "begin": 1009, - "end": 1058, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 1087, - "end": 1274, - "name": "tag", - "value": "19" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPDEST" - }, - { - "begin": 1160, - "end": 1179, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1168, - "end": 1178, - "name": "CALLER" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP2" - }, - { - "begin": 1160, - "end": 1179, - "name": "AND" - }, - { - "begin": 1144, - "end": 1148, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP2" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP2" - }, - { - "begin": 1160, - "end": 1179, - "name": "MSTORE" - }, - { - "begin": 1160, - "end": 1167, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1160, - "end": 1179, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1160, - "end": 1179, - "name": "SWAP1" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP2" - }, - { - "begin": 1160, - "end": 1179, - "name": "MSTORE" - }, - { - "begin": 1160, - "end": 1179, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP1" - }, - { - "begin": 1160, - "end": 1179, - "name": "DUP4" - }, - { - "begin": 1160, - "end": 1179, - "name": "SHA3" - }, - { - "begin": 1160, - "end": 1189, - "name": "SWAP5" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP8" - }, - { - "begin": 1160, - "end": 1189, - "name": "AND" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP1" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP5" - }, - { - "begin": 1160, - "end": 1189, - "name": "MSTORE" - }, - { - "begin": 1160, - "end": 1189, - "name": "SWAP5" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP3" - }, - { - "begin": 1160, - "end": 1189, - "name": "MSTORE" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP1" - }, - { - "begin": 1160, - "end": 1189, - "name": "DUP4" - }, - { - "begin": 1160, - "end": 1189, - "name": "SHA3" - }, - { - "begin": 1160, - "end": 1198, - "name": "DUP7" - }, - { - "begin": 1160, - "end": 1198, - "name": "SWAP1" - }, - { - "begin": 1160, - "end": 1198, - "name": "SSTORE" - }, - { - "begin": 1208, - "end": 1246, - "name": "DUP1" - }, - { - "begin": 1208, - "end": 1246, - "name": "MLOAD" - }, - { - "begin": 1208, - "end": 1246, - "name": "DUP7" - }, - { - "begin": 1208, - "end": 1246, - "name": "DUP2" - }, - { - "begin": 1208, - "end": 1246, - "name": "MSTORE" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP1" - }, - { - "begin": 1208, - "end": 1246, - "name": "MLOAD" - }, - { - "begin": 1144, - "end": 1148, - "name": "SWAP3" - }, - { - "begin": 1144, - "end": 1148, - "name": "SWAP5" - }, - { - "begin": 1160, - "end": 1189, - "name": "SWAP4" - }, - { - "begin": 1160, - "end": 1179, - "name": "SWAP3" - }, - { - "begin": 1208, - "end": 1246, - "name": "PUSH", - "value": "8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP3" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP2" - }, - { - "begin": 1208, - "end": 1246, - "name": "DUP2" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP1" - }, - { - "begin": 1208, - "end": 1246, - "name": "SUB" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP1" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP2" - }, - { - "begin": 1208, - "end": 1246, - "name": "ADD" - }, - { - "begin": 1208, - "end": 1246, - "name": "SWAP1" - }, - { - "begin": 1208, - "end": 1246, - "name": "LOG3" - }, - { - "begin": -1, - "end": -1, - "name": "POP" - }, - { - "begin": 1263, - "end": 1267, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1087, - "end": 1274, - "name": "tag", - "value": "44" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMPDEST" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP3" - }, - { - "begin": 1087, - "end": 1274, - "name": "SWAP2" - }, - { - "begin": 1087, - "end": 1274, - "name": "POP" - }, - { - "begin": 1087, - "end": 1274, - "name": "POP" - }, - { - "begin": 1087, - "end": 1274, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 932, - "end": 964, - "name": "tag", - "value": "22" - }, - { - "begin": 932, - "end": 964, - "name": "JUMPDEST" - }, - { - "begin": 932, - "end": 964, - "name": "PUSH", - "value": "3" - }, - { - "begin": 932, - "end": 964, - "name": "SLOAD" - }, - { - "begin": 932, - "end": 964, - "name": "DUP2" - }, - { - "begin": 932, - "end": 964, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 1066, - "end": 1675, - "name": "tag", - "value": "25" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPDEST" - }, - { - "begin": 1198, - "end": 1212, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP1" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP5" - }, - { - "begin": 1198, - "end": 1212, - "name": "AND" - }, - { - "begin": 1161, - "end": 1165, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP2" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP2" - }, - { - "begin": 1198, - "end": 1212, - "name": "MSTORE" - }, - { - "begin": 1198, - "end": 1205, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1198, - "end": 1212, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1198, - "end": 1212, - "name": "SWAP1" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP2" - }, - { - "begin": 1198, - "end": 1212, - "name": "MSTORE" - }, - { - "begin": 1198, - "end": 1212, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP1" - }, - { - "begin": 1198, - "end": 1212, - "name": "DUP4" - }, - { - "begin": 1198, - "end": 1212, - "name": "SHA3" - }, - { - "begin": 1213, - "end": 1223, - "name": "CALLER" - }, - { - "begin": 1198, - "end": 1224, - "name": "SWAP1" - }, - { - "begin": 1198, - "end": 1224, - "name": "SWAP6" - }, - { - "begin": 1198, - "end": 1224, - "name": "AND" - }, - { - "begin": 1198, - "end": 1224, - "name": "DUP4" - }, - { - "begin": 1198, - "end": 1224, - "name": "MSTORE" - }, - { - "begin": 1198, - "end": 1224, - "name": "SWAP4" - }, - { - "begin": 1198, - "end": 1224, - "name": "DUP2" - }, - { - "begin": 1198, - "end": 1224, - "name": "MSTORE" - }, - { - "begin": 1198, - "end": 1224, - "name": "DUP4" - }, - { - "begin": 1198, - "end": 1224, - "name": "DUP3" - }, - { - "begin": 1198, - "end": 1224, - "name": "SHA3" - }, - { - "begin": 1198, - "end": 1224, - "name": "SLOAD" - }, - { - "begin": 1238, - "end": 1253, - "name": "SWAP3" - }, - { - "begin": 1238, - "end": 1253, - "name": "DUP3" - }, - { - "begin": 1238, - "end": 1253, - "name": "MSTORE" - }, - { - "begin": 1238, - "end": 1253, - "name": "DUP2" - }, - { - "begin": 1238, - "end": 1253, - "name": "SWAP1" - }, - { - "begin": 1238, - "end": 1253, - "name": "MSTORE" - }, - { - "begin": 1238, - "end": 1253, - "name": "SWAP2" - }, - { - "begin": 1238, - "end": 1253, - "name": "DUP3" - }, - { - "begin": 1238, - "end": 1253, - "name": "SHA3" - }, - { - "begin": 1238, - "end": 1253, - "name": "SLOAD" - }, - { - "begin": 1238, - "end": 1263, - "name": "DUP4" - }, - { - "begin": 1238, - "end": 1263, - "name": "SWAP1" - }, - { - "begin": 1238, - "end": 1263, - "name": "LT" - }, - { - "begin": 1238, - "end": 1263, - "name": "DUP1" - }, - { - "begin": 1238, - "end": 1263, - "name": "ISZERO" - }, - { - "begin": 1238, - "end": 1263, - "name": "SWAP1" - }, - { - "begin": 1238, - "end": 1298, - "name": "PUSH [tag]", - "value": "46" - }, - { - "begin": 1238, - "end": 1298, - "name": "JUMPI" - }, - { - "begin": 1238, - "end": 1298, - "name": "POP" - }, - { - "begin": 1292, - "end": 1298, - "name": "DUP3" - }, - { - "begin": 1279, - "end": 1288, - "name": "DUP2" - }, - { - "begin": 1279, - "end": 1298, - "name": "LT" - }, - { - "begin": 1279, - "end": 1298, - "name": "ISZERO" - }, - { - "begin": 1238, - "end": 1298, - "name": "tag", - "value": "46" - }, - { - "begin": 1238, - "end": 1298, - "name": "JUMPDEST" - }, - { - "begin": 1238, - "end": 1353, - "name": "DUP1" - }, - { - "begin": 1238, - "end": 1353, - "name": "ISZERO" - }, - { - "begin": 1238, - "end": 1353, - "name": "PUSH [tag]", - "value": "47" - }, - { - "begin": 1238, - "end": 1353, - "name": "JUMPI" - }, - { - "begin": -1, - "end": -1, - "name": "POP" - }, - { - "begin": 1340, - "end": 1353, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1340, - "end": 1353, - "name": "DUP5" - }, - { - "begin": 1340, - "end": 1353, - "name": "AND" - }, - { - "begin": 1340, - "end": 1348, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1340, - "end": 1353, - "name": "SWAP1" - }, - { - "begin": 1340, - "end": 1353, - "name": "DUP2" - }, - { - "begin": 1340, - "end": 1353, - "name": "MSTORE" - }, - { - "begin": 1340, - "end": 1353, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1340, - "end": 1353, - "name": "DUP2" - }, - { - "begin": 1340, - "end": 1353, - "name": "SWAP1" - }, - { - "begin": 1340, - "end": 1353, - "name": "MSTORE" - }, - { - "begin": 1340, - "end": 1353, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1340, - "end": 1353, - "name": "SWAP1" - }, - { - "begin": 1340, - "end": 1353, - "name": "SHA3" - }, - { - "begin": 1340, - "end": 1353, - "name": "SLOAD" - }, - { - "begin": 1314, - "end": 1336, - "name": "DUP4" - }, - { - "begin": 1314, - "end": 1336, - "name": "DUP2" - }, - { - "begin": 1314, - "end": 1336, - "name": "ADD" - }, - { - "begin": 1314, - "end": 1353, - "name": "LT" - }, - { - "begin": 1314, - "end": 1353, - "name": "ISZERO" - }, - { - "begin": 1238, - "end": 1353, - "name": "tag", - "value": "47" - }, - { - "begin": 1238, - "end": 1353, - "name": "JUMPDEST" - }, - { - "begin": 1234, - "end": 1669, - "name": "ISZERO" - }, - { - "begin": 1234, - "end": 1669, - "name": "PUSH [tag]", - "value": "48" - }, - { - "begin": 1234, - "end": 1669, - "name": "JUMPI" - }, - { - "begin": 1378, - "end": 1391, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP1" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP6" - }, - { - "begin": 1378, - "end": 1391, - "name": "AND" - }, - { - "begin": 1378, - "end": 1386, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1378, - "end": 1391, - "name": "SWAP1" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP2" - }, - { - "begin": 1378, - "end": 1391, - "name": "MSTORE" - }, - { - "begin": 1378, - "end": 1391, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP2" - }, - { - "begin": 1378, - "end": 1391, - "name": "SWAP1" - }, - { - "begin": 1378, - "end": 1391, - "name": "MSTORE" - }, - { - "begin": 1378, - "end": 1391, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP1" - }, - { - "begin": 1378, - "end": 1391, - "name": "DUP3" - }, - { - "begin": 1378, - "end": 1391, - "name": "SHA3" - }, - { - "begin": 1378, - "end": 1401, - "name": "DUP1" - }, - { - "begin": 1378, - "end": 1401, - "name": "SLOAD" - }, - { - "begin": 1378, - "end": 1401, - "name": "DUP8" - }, - { - "begin": 1378, - "end": 1401, - "name": "ADD" - }, - { - "begin": 1378, - "end": 1401, - "name": "SWAP1" - }, - { - "begin": 1378, - "end": 1401, - "name": "SSTORE" - }, - { - "begin": 1415, - "end": 1430, - "name": "SWAP2" - }, - { - "begin": 1415, - "end": 1430, - "name": "DUP8" - }, - { - "begin": 1415, - "end": 1430, - "name": "AND" - }, - { - "begin": 1415, - "end": 1430, - "name": "DUP2" - }, - { - "begin": 1415, - "end": 1430, - "name": "MSTORE" - }, - { - "begin": 1415, - "end": 1430, - "name": "SHA3" - }, - { - "begin": 1415, - "end": 1440, - "name": "DUP1" - }, - { - "begin": 1415, - "end": 1440, - "name": "SLOAD" - }, - { - "begin": 1415, - "end": 1440, - "name": "DUP5" - }, - { - "begin": 1415, - "end": 1440, - "name": "SWAP1" - }, - { - "begin": 1415, - "end": 1440, - "name": "SUB" - }, - { - "begin": 1415, - "end": 1440, - "name": "SWAP1" - }, - { - "begin": 1415, - "end": 1440, - "name": "SSTORE" - }, - { - "begin": 768, - "end": 778, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1458, - "end": 1478, - "name": "DUP2" - }, - { - "begin": 1458, - "end": 1478, - "name": "LT" - }, - { - "begin": 1454, - "end": 1549, - "name": "ISZERO" - }, - { - "begin": 1454, - "end": 1549, - "name": "PUSH [tag]", - "value": "49" - }, - { - "begin": 1454, - "end": 1549, - "name": "JUMPI" - }, - { - "begin": 1498, - "end": 1512, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP1" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP7" - }, - { - "begin": 1498, - "end": 1512, - "name": "AND" - }, - { - "begin": 1498, - "end": 1512, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1498, - "end": 1512, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP2" - }, - { - "begin": 1498, - "end": 1512, - "name": "MSTORE" - }, - { - "begin": 1498, - "end": 1505, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1498, - "end": 1512, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1498, - "end": 1512, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP2" - }, - { - "begin": 1498, - "end": 1512, - "name": "MSTORE" - }, - { - "begin": 1498, - "end": 1512, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP1" - }, - { - "begin": 1498, - "end": 1512, - "name": "DUP4" - }, - { - "begin": 1498, - "end": 1512, - "name": "SHA3" - }, - { - "begin": 1513, - "end": 1523, - "name": "CALLER" - }, - { - "begin": 1498, - "end": 1524, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1524, - "name": "SWAP5" - }, - { - "begin": 1498, - "end": 1524, - "name": "AND" - }, - { - "begin": 1498, - "end": 1524, - "name": "DUP4" - }, - { - "begin": 1498, - "end": 1524, - "name": "MSTORE" - }, - { - "begin": 1498, - "end": 1524, - "name": "SWAP3" - }, - { - "begin": 1498, - "end": 1524, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1524, - "name": "MSTORE" - }, - { - "begin": 1498, - "end": 1524, - "name": "SHA3" - }, - { - "begin": 1498, - "end": 1534, - "name": "DUP1" - }, - { - "begin": 1498, - "end": 1534, - "name": "SLOAD" - }, - { - "begin": 1498, - "end": 1534, - "name": "DUP5" - }, - { - "begin": 1498, - "end": 1534, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1534, - "name": "SUB" - }, - { - "begin": 1498, - "end": 1534, - "name": "SWAP1" - }, - { - "begin": 1498, - "end": 1534, - "name": "SSTORE" - }, - { - "begin": 1454, - "end": 1549, - "name": "tag", - "value": "49" - }, - { - "begin": 1454, - "end": 1549, - "name": "JUMPDEST" - }, - { - "begin": 1578, - "end": 1581, - "name": "DUP4" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1562, - "end": 1590, - "name": "AND" - }, - { - "begin": 1571, - "end": 1576, - "name": "DUP6" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1562, - "end": 1590, - "name": "AND" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF" - }, - { - "begin": 1583, - "end": 1589, - "name": "DUP6" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1562, - "end": 1590, - "name": "MLOAD" - }, - { - "begin": 1562, - "end": 1590, - "name": "DUP1" - }, - { - "begin": 1562, - "end": 1590, - "name": "DUP3" - }, - { - "begin": 1562, - "end": 1590, - "name": "DUP2" - }, - { - "begin": 1562, - "end": 1590, - "name": "MSTORE" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1562, - "end": 1590, - "name": "ADD" - }, - { - "begin": 1562, - "end": 1590, - "name": "SWAP2" - }, - { - "begin": 1562, - "end": 1590, - "name": "POP" - }, - { - "begin": 1562, - "end": 1590, - "name": "POP" - }, - { - "begin": 1562, - "end": 1590, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1562, - "end": 1590, - "name": "MLOAD" - }, - { - "begin": 1562, - "end": 1590, - "name": "DUP1" - }, - { - "begin": 1562, - "end": 1590, - "name": "SWAP2" - }, - { - "begin": 1562, - "end": 1590, - "name": "SUB" - }, - { - "begin": 1562, - "end": 1590, - "name": "SWAP1" - }, - { - "begin": 1562, - "end": 1590, - "name": "LOG3" - }, - { - "begin": 1611, - "end": 1615, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1604, - "end": 1615, - "name": "SWAP2" - }, - { - "begin": 1604, - "end": 1615, - "name": "POP" - }, - { - "begin": 1604, - "end": 1615, - "name": "PUSH [tag]", - "value": "50" - }, - { - "begin": 1604, - "end": 1615, - "name": "JUMP" - }, - { - "begin": 1234, - "end": 1669, - "name": "tag", - "value": "48" - }, - { - "begin": 1234, - "end": 1669, - "name": "JUMPDEST" - }, - { - "begin": 1653, - "end": 1658, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1646, - "end": 1658, - "name": "SWAP2" - }, - { - "begin": 1646, - "end": 1658, - "name": "POP" - }, - { - "begin": 1234, - "end": 1669, - "name": "tag", - "value": "50" - }, - { - "begin": 1234, - "end": 1669, - "name": "JUMPDEST" - }, - { - "begin": 1066, - "end": 1675, - "name": "tag", - "value": "45" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMPDEST" - }, - { - "begin": 1066, - "end": 1675, - "name": "POP" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP4" - }, - { - "begin": 1066, - "end": 1675, - "name": "SWAP3" - }, - { - "begin": 1066, - "end": 1675, - "name": "POP" - }, - { - "begin": 1066, - "end": 1675, - "name": "POP" - }, - { - "begin": 1066, - "end": 1675, - "name": "POP" - }, - { - "begin": 1066, - "end": 1675, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 891, - "end": 926, - "name": "tag", - "value": "28" - }, - { - "begin": 891, - "end": 926, - "name": "JUMPDEST" - }, - { - "begin": 924, - "end": 926, - "name": "PUSH", - "value": "12" - }, - { - "begin": 891, - "end": 926, - "name": "DUP2" - }, - { - "begin": 891, - "end": 926, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 982, - "end": 1081, - "name": "tag", - "value": "31" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPDEST" - }, - { - "begin": 1058, - "end": 1074, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1058, - "end": 1074, - "name": "DUP2" - }, - { - "begin": 1058, - "end": 1074, - "name": "AND" - }, - { - "begin": 1035, - "end": 1039, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1058, - "end": 1074, - "name": "SWAP1" - }, - { - "begin": 1058, - "end": 1074, - "name": "DUP2" - }, - { - "begin": 1058, - "end": 1074, - "name": "MSTORE" - }, - { - "begin": 1058, - "end": 1074, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1058, - "end": 1074, - "name": "DUP2" - }, - { - "begin": 1058, - "end": 1074, - "name": "SWAP1" - }, - { - "begin": 1058, - "end": 1074, - "name": "MSTORE" - }, - { - "begin": 1058, - "end": 1074, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1058, - "end": 1074, - "name": "SWAP1" - }, - { - "begin": 1058, - "end": 1074, - "name": "SHA3" - }, - { - "begin": 1058, - "end": 1074, - "name": "SLOAD" - }, - { - "begin": 982, - "end": 1081, - "name": "tag", - "value": "51" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMPDEST" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP2" - }, - { - "begin": 982, - "end": 1081, - "name": "SWAP1" - }, - { - "begin": 982, - "end": 1081, - "name": "POP" - }, - { - "begin": 982, - "end": 1081, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 1064, - "end": 1101, - "name": "tag", - "value": "34" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMPDEST" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "MLOAD" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP3" - }, - { - "begin": 1064, - "end": 1101, - "name": "ADD" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP1" - }, - { - "begin": 1064, - "end": 1101, - "name": "SWAP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "MSTORE" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "3" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "MSTORE" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "5A52580000000000000000000000000000000000000000000000000000000000" - }, - { - "begin": 1064, - "end": 1101, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP3" - }, - { - "begin": 1064, - "end": 1101, - "name": "ADD" - }, - { - "begin": 1064, - "end": 1101, - "name": "MSTORE" - }, - { - "begin": 1064, - "end": 1101, - "name": "DUP2" - }, - { - "begin": 1064, - "end": 1101, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 125, - "end": 535, - "name": "tag", - "value": "40" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPDEST" - }, - { - "begin": 267, - "end": 287, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 276, - "end": 286, - "name": "CALLER" - }, - { - "begin": 267, - "end": 287, - "name": "AND" - }, - { - "begin": 178, - "end": 182, - "name": "PUSH", - "value": "0" - }, - { - "begin": 267, - "end": 287, - "name": "SWAP1" - }, - { - "begin": 267, - "end": 287, - "name": "DUP2" - }, - { - "begin": 267, - "end": 287, - "name": "MSTORE" - }, - { - "begin": 267, - "end": 287, - "name": "PUSH", - "value": "20" - }, - { - "begin": 267, - "end": 287, - "name": "DUP2" - }, - { - "begin": 267, - "end": 287, - "name": "SWAP1" - }, - { - "begin": 267, - "end": 287, - "name": "MSTORE" - }, - { - "begin": 267, - "end": 287, - "name": "PUSH", - "value": "40" - }, - { - "begin": 267, - "end": 287, - "name": "DUP2" - }, - { - "begin": 267, - "end": 287, - "name": "SHA3" - }, - { - "begin": 267, - "end": 287, - "name": "SLOAD" - }, - { - "begin": 267, - "end": 297, - "name": "DUP3" - }, - { - "begin": 267, - "end": 297, - "name": "SWAP1" - }, - { - "begin": 267, - "end": 297, - "name": "LT" - }, - { - "begin": 267, - "end": 297, - "name": "DUP1" - }, - { - "begin": 267, - "end": 297, - "name": "ISZERO" - }, - { - "begin": 267, - "end": 297, - "name": "SWAP1" - }, - { - "begin": 267, - "end": 340, - "name": "PUSH [tag]", - "value": "53" - }, - { - "begin": 267, - "end": 340, - "name": "JUMPI" - }, - { - "begin": -1, - "end": -1, - "name": "POP" - }, - { - "begin": 327, - "end": 340, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 327, - "end": 340, - "name": "DUP4" - }, - { - "begin": 327, - "end": 340, - "name": "AND" - }, - { - "begin": 327, - "end": 335, - "name": "PUSH", - "value": "0" - }, - { - "begin": 327, - "end": 340, - "name": "SWAP1" - }, - { - "begin": 327, - "end": 340, - "name": "DUP2" - }, - { - "begin": 327, - "end": 340, - "name": "MSTORE" - }, - { - "begin": 327, - "end": 340, - "name": "PUSH", - "value": "20" - }, - { - "begin": 327, - "end": 340, - "name": "DUP2" - }, - { - "begin": 327, - "end": 340, - "name": "SWAP1" - }, - { - "begin": 327, - "end": 340, - "name": "MSTORE" - }, - { - "begin": 327, - "end": 340, - "name": "PUSH", - "value": "40" - }, - { - "begin": 327, - "end": 340, - "name": "SWAP1" - }, - { - "begin": 327, - "end": 340, - "name": "SHA3" - }, - { - "begin": 327, - "end": 340, - "name": "SLOAD" - }, - { - "begin": 301, - "end": 323, - "name": "DUP3" - }, - { - "begin": 301, - "end": 323, - "name": "DUP2" - }, - { - "begin": 301, - "end": 323, - "name": "ADD" - }, - { - "begin": 301, - "end": 340, - "name": "LT" - }, - { - "begin": 301, - "end": 340, - "name": "ISZERO" - }, - { - "begin": 267, - "end": 340, - "name": "tag", - "value": "53" - }, - { - "begin": 267, - "end": 340, - "name": "JUMPDEST" - }, - { - "begin": 263, - "end": 529, - "name": "ISZERO" - }, - { - "begin": 263, - "end": 529, - "name": "PUSH [tag]", - "value": "54" - }, - { - "begin": 263, - "end": 529, - "name": "JUMPI" - }, - { - "begin": 356, - "end": 376, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 365, - "end": 375, - "name": "CALLER" - }, - { - "begin": 356, - "end": 376, - "name": "DUP2" - }, - { - "begin": 356, - "end": 376, - "name": "AND" - }, - { - "begin": 356, - "end": 364, - "name": "PUSH", - "value": "0" - }, - { - "begin": 356, - "end": 376, - "name": "DUP2" - }, - { - "begin": 356, - "end": 376, - "name": "DUP2" - }, - { - "begin": 356, - "end": 376, - "name": "MSTORE" - }, - { - "begin": 356, - "end": 376, - "name": "PUSH", - "value": "20" - }, - { - "begin": 356, - "end": 376, - "name": "DUP2" - }, - { - "begin": 356, - "end": 376, - "name": "DUP2" - }, - { - "begin": 356, - "end": 376, - "name": "MSTORE" - }, - { - "begin": 356, - "end": 376, - "name": "PUSH", - "value": "40" - }, - { - "begin": 356, - "end": 376, - "name": "DUP1" - }, - { - "begin": 356, - "end": 376, - "name": "DUP4" - }, - { - "begin": 356, - "end": 376, - "name": "SHA3" - }, - { - "begin": 356, - "end": 386, - "name": "DUP1" - }, - { - "begin": 356, - "end": 386, - "name": "SLOAD" - }, - { - "begin": 356, - "end": 386, - "name": "DUP9" - }, - { - "begin": 356, - "end": 386, - "name": "SWAP1" - }, - { - "begin": 356, - "end": 386, - "name": "SUB" - }, - { - "begin": 356, - "end": 386, - "name": "SWAP1" - }, - { - "begin": 356, - "end": 386, - "name": "SSTORE" - }, - { - "begin": 400, - "end": 413, - "name": "SWAP4" - }, - { - "begin": 400, - "end": 413, - "name": "DUP8" - }, - { - "begin": 400, - "end": 413, - "name": "AND" - }, - { - "begin": 400, - "end": 413, - "name": "DUP1" - }, - { - "begin": 400, - "end": 413, - "name": "DUP4" - }, - { - "begin": 400, - "end": 413, - "name": "MSTORE" - }, - { - "begin": 400, - "end": 413, - "name": "SWAP2" - }, - { - "begin": 400, - "end": 413, - "name": "DUP5" - }, - { - "begin": 400, - "end": 413, - "name": "SWAP1" - }, - { - "begin": 400, - "end": 413, - "name": "SHA3" - }, - { - "begin": 400, - "end": 423, - "name": "DUP1" - }, - { - "begin": 400, - "end": 423, - "name": "SLOAD" - }, - { - "begin": 400, - "end": 423, - "name": "DUP8" - }, - { - "begin": 400, - "end": 423, - "name": "ADD" - }, - { - "begin": 400, - "end": 423, - "name": "SWAP1" - }, - { - "begin": 400, - "end": 423, - "name": "SSTORE" - }, - { - "begin": 437, - "end": 470, - "name": "DUP4" - }, - { - "begin": 437, - "end": 470, - "name": "MLOAD" - }, - { - "begin": 437, - "end": 470, - "name": "DUP7" - }, - { - "begin": 437, - "end": 470, - "name": "DUP2" - }, - { - "begin": 437, - "end": 470, - "name": "MSTORE" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP4" - }, - { - "begin": 437, - "end": 470, - "name": "MLOAD" - }, - { - "begin": 400, - "end": 413, - "name": "SWAP2" - }, - { - "begin": 400, - "end": 413, - "name": "SWAP4" - }, - { - "begin": 437, - "end": 470, - "name": "PUSH", - "value": "DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP3" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP1" - }, - { - "begin": 437, - "end": 470, - "name": "DUP2" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP1" - }, - { - "begin": 437, - "end": 470, - "name": "SUB" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP1" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP2" - }, - { - "begin": 437, - "end": 470, - "name": "ADD" - }, - { - "begin": 437, - "end": 470, - "name": "SWAP1" - }, - { - "begin": 437, - "end": 470, - "name": "LOG3" - }, - { - "begin": -1, - "end": -1, - "name": "POP" - }, - { - "begin": 491, - "end": 495, - "name": "PUSH", - "value": "1" - }, - { - "begin": 484, - "end": 495, - "name": "PUSH [tag]", - "value": "44" - }, - { - "begin": 484, - "end": 495, - "name": "JUMP" - }, - { - "begin": 263, - "end": 529, - "name": "tag", - "value": "54" - }, - { - "begin": 263, - "end": 529, - "name": "JUMPDEST" - }, - { - "begin": -1, - "end": -1, - "name": "POP" - }, - { - "begin": 521, - "end": 526, - "name": "PUSH", - "value": "0" - }, - { - "begin": 514, - "end": 526, - "name": "PUSH [tag]", - "value": "44" - }, - { - "begin": 514, - "end": 526, - "name": "JUMP" - }, - { - "begin": 263, - "end": 529, - "name": "tag", - "value": "55" - }, - { - "begin": 263, - "end": 529, - "name": "JUMPDEST" - }, - { - "begin": 125, - "end": 535, - "name": "tag", - "value": "52" - }, - { - "begin": 125, - "end": 535, - "name": "JUMPDEST" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP3" - }, - { - "begin": 125, - "end": 535, - "name": "SWAP2" - }, - { - "begin": 125, - "end": 535, - "name": "POP" - }, - { - "begin": 125, - "end": 535, - "name": "POP" - }, - { - "begin": 125, - "end": 535, - "name": "JUMP", - "value": "[out]" - }, - { - "begin": 1280, - "end": 1406, - "name": "tag", - "value": "43" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPDEST" - }, - { - "begin": 1374, - "end": 1389, - "name": "PUSH", - "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP1" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP4" - }, - { - "begin": 1374, - "end": 1389, - "name": "AND" - }, - { - "begin": 1351, - "end": 1355, - "name": "PUSH", - "value": "0" - }, - { - "begin": 1374, - "end": 1389, - "name": "SWAP1" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP2" - }, - { - "begin": 1374, - "end": 1389, - "name": "MSTORE" - }, - { - "begin": 1374, - "end": 1381, - "name": "PUSH", - "value": "1" - }, - { - "begin": 1374, - "end": 1389, - "name": "PUSH", - "value": "20" - }, - { - "begin": 1374, - "end": 1389, - "name": "SWAP1" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP2" - }, - { - "begin": 1374, - "end": 1389, - "name": "MSTORE" - }, - { - "begin": 1374, - "end": 1389, - "name": "PUSH", - "value": "40" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP1" - }, - { - "begin": 1374, - "end": 1389, - "name": "DUP4" - }, - { - "begin": 1374, - "end": 1389, - "name": "SHA3" - }, - { - "begin": 1374, - "end": 1399, - "name": "SWAP4" - }, - { - "begin": 1374, - "end": 1399, - "name": "DUP6" - }, - { - "begin": 1374, - "end": 1399, - "name": "AND" - }, - { - "begin": 1374, - "end": 1399, - "name": "DUP4" - }, - { - "begin": 1374, - "end": 1399, - "name": "MSTORE" - }, - { - "begin": 1374, - "end": 1399, - "name": "SWAP3" - }, - { - "begin": 1374, - "end": 1399, - "name": "SWAP1" - }, - { - "begin": 1374, - "end": 1399, - "name": "MSTORE" - }, - { - "begin": 1374, - "end": 1399, - "name": "SHA3" - }, - { - "begin": 1374, - "end": 1399, - "name": "SLOAD" - }, - { - "begin": 1280, - "end": 1406, - "name": "tag", - "value": "56" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMPDEST" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP3" - }, - { - "begin": 1280, - "end": 1406, - "name": "SWAP2" - }, - { - "begin": 1280, - "end": 1406, - "name": "POP" - }, - { - "begin": 1280, - "end": 1406, - "name": "POP" - }, - { - "begin": 1280, - "end": 1406, - "name": "JUMP", - "value": "[out]" - } - ] - } - } - }, - "methodIdentifiers": { - "allowance(address,address)": "dd62ed3e", - "approve(address,uint256)": "095ea7b3", - "balanceOf(address)": "70a08231", - "decimals()": "313ce567", - "name()": "06fdde03", - "symbol()": "95d89b41", - "totalSupply()": "18160ddd", - "transfer(address,uint256)": "a9059cbb", - "transferFrom(address,address,uint256)": "23b872dd" - } - }, - "metadata": "{\"compiler\":{\"version\":\"0.4.11+commit.68ef5810\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"transferFrom(address,address,uint256)\":{\"details\":\"ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.\",\"params\":{\"_from\":\"Address to transfer from.\",\"_to\":\"Address to transfer to.\",\"_value\":\"Amount to transfer.\"},\"return\":\"Success of transfer.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"2.0.0/tokens/ZRXToken/ZRXToken.sol\":\"ZRXToken\"},\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"1.0.0/ERC20Token/ERC20Token_v1.sol\":{\"keccak256\":\"0x3d710b436c430d6fe49f64b091555405360d76da6454b93faa8e213eea34a96d\",\"urls\":[\"bzzr://d12710a563415ad98ff28ecb3aab0b68467b3d023e7c130c73ed9918ef86158e\"]},\"1.0.0/Token/Token_v1.sol\":{\"keccak256\":\"0x35a82bc7bc0994caa97f8ea44660b9b5e796acfe72705b5ff7ed8f2a3c47ff37\",\"urls\":[\"bzzr://a62ae857a4cf2e8948e36d02470c612ac1a5ac20ebe1c1b553ad1ed8becb634e\"]},\"1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\":{\"keccak256\":\"0x2e1f4b899081cedd8940a9cd0f0f7413264c883312ed0ba9c53885766fe0a1a5\",\"urls\":[\"bzzr://47c42a58e56ffe81e49c8aabd3c391f5fa807fea299b3a2178501e3669baeb52\"]},\"2.0.0/tokens/ZRXToken/ZRXToken.sol\":{\"keccak256\":\"0x9eeb623d48909b083c77688b13b610811c53e37622b3fcbaa23c01873230f5d6\",\"urls\":[\"bzzr://84f3b5c2653068092771d443281018ff2ee0543817426d0fb6f9037a3570e37f\"]}},\"version\":1}", - "userdoc": { - "methods": {} - } - }, - "sources": { - "1.0.0/ERC20Token/ERC20Token_v1.sol": { - "id": 0, - "legacyAST": { - "children": [ - { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".11" - ] - }, - "id": 126, - "name": "PragmaDirective", - "src": "0:24:0" - }, - { - "attributes": { - "file": "../Token/Token_v1.sol" - }, - "id": 128, - "name": "ImportDirective", - "src": "26:58:0" - }, - { - "attributes": { - "fullyImplemented": true, - "isLibrary": false, - "linearizedBaseContracts": [ - 322, - 397 - ], - "name": "ERC20Token_v1" - }, - "children": [ - { - "children": [ - { - "attributes": { - "name": "Token" - }, - "id": 129, - "name": "UserDefinedTypeName", - "src": "112:5:0" - } - ], - "id": 130, - "name": "InheritanceSpecifier", - "src": "112:5:0" - }, - { - "attributes": { - "constant": false, - "name": "transfer", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 131, - "name": "ElementaryTypeName", - "src": "143:7:0" - } - ], - "id": 132, - "name": "VariableDeclaration", - "src": "143:11:0" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 133, - "name": "ElementaryTypeName", - "src": "156:4:0" - } - ], - "id": 134, - "name": "VariableDeclaration", - "src": "156:11:0" - } - ], - "id": 135, - "name": "ParameterList", - "src": "142:26:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 136, - "name": "ElementaryTypeName", - "src": "178:4:0" - } - ], - "id": 137, - "name": "VariableDeclaration", - "src": "178:4:0" - } - ], - "id": 138, - "name": "ParameterList", - "src": "177:6:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 139, - "name": "Identifier", - "src": "267:8:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 140, - "name": "Identifier", - "src": "276:3:0" - } - ], - "id": 141, - "name": "MemberAccess", - "src": "276:10:0" - } - ], - "id": 142, - "name": "IndexAccess", - "src": "267:20:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 143, - "name": "Identifier", - "src": "291:6:0" - } - ], - "id": 144, - "name": "BinaryOperation", - "src": "267:30:0" - }, - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": "+", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 145, - "name": "Identifier", - "src": "301:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 146, - "name": "Identifier", - "src": "310:3:0" - } - ], - "id": 147, - "name": "IndexAccess", - "src": "301:13:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 148, - "name": "Identifier", - "src": "317:6:0" - } - ], - "id": 149, - "name": "BinaryOperation", - "src": "301:22:0" - }, - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 150, - "name": "Identifier", - "src": "327:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 151, - "name": "Identifier", - "src": "336:3:0" - } - ], - "id": 152, - "name": "IndexAccess", - "src": "327:13:0" - } - ], - "id": 153, - "name": "BinaryOperation", - "src": "301:39:0" - } - ], - "id": 154, - "name": "BinaryOperation", - "src": "267:73:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "-=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 155, - "name": "Identifier", - "src": "356:8:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 156, - "name": "Identifier", - "src": "365:3:0" - } - ], - "id": 157, - "name": "MemberAccess", - "src": "365:10:0" - } - ], - "id": 158, - "name": "IndexAccess", - "src": "356:20:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 159, - "name": "Identifier", - "src": "380:6:0" - } - ], - "id": 160, - "name": "Assignment", - "src": "356:30:0" - } - ], - "id": 161, - "name": "ExpressionStatement", - "src": "356:30:0" - }, - { - "children": [ - { - "attributes": { - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 162, - "name": "Identifier", - "src": "400:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 163, - "name": "Identifier", - "src": "409:3:0" - } - ], - "id": 164, - "name": "IndexAccess", - "src": "400:13:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 165, - "name": "Identifier", - "src": "417:6:0" - } - ], - "id": 166, - "name": "Assignment", - "src": "400:23:0" - } - ], - "id": 167, - "name": "ExpressionStatement", - "src": "400:23:0" - }, - { - "children": [ - { - "attributes": { - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "type": "function (address,address,uint256) constant", - "value": "Transfer" - }, - "id": 168, - "name": "Identifier", - "src": "437:8:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 169, - "name": "Identifier", - "src": "446:3:0" - } - ], - "id": 170, - "name": "MemberAccess", - "src": "446:10:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 171, - "name": "Identifier", - "src": "458:3:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 172, - "name": "Identifier", - "src": "463:6:0" - } - ], - "id": 173, - "name": "FunctionCall", - "src": "437:33:0" - } - ], - "id": 174, - "name": "ExpressionStatement", - "src": "437:33:0" - }, - { - "children": [ - { - "attributes": { - "hexvalue": "74727565", - "subdenomination": null, - "token": "true", - "type": "bool", - "value": "true" - }, - "id": 175, - "name": "Literal", - "src": "491:4:0" - } - ], - "id": 176, - "name": "Return", - "src": "484:11:0" - } - ], - "id": 177, - "name": "Block", - "src": "342:164:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "hexvalue": "66616c7365", - "subdenomination": null, - "token": "false", - "type": "bool", - "value": "false" - }, - "id": 178, - "name": "Literal", - "src": "521:5:0" - } - ], - "id": 179, - "name": "Return", - "src": "514:12:0" - } - ], - "id": 180, - "name": "Block", - "src": "512:17:0" - } - ], - "id": 181, - "name": "IfStatement", - "src": "263:266:0" - } - ], - "id": 182, - "name": "Block", - "src": "184:351:0" - } - ], - "id": 183, - "name": "FunctionDefinition", - "src": "125:410:0" - }, - { - "attributes": { - "constant": false, - "name": "transferFrom", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_from", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 184, - "name": "ElementaryTypeName", - "src": "563:7:0" - } - ], - "id": 185, - "name": "VariableDeclaration", - "src": "563:13:0" - }, - { - "attributes": { - "constant": false, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 186, - "name": "ElementaryTypeName", - "src": "578:7:0" - } - ], - "id": 187, - "name": "VariableDeclaration", - "src": "578:11:0" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 188, - "name": "ElementaryTypeName", - "src": "591:4:0" - } - ], - "id": 189, - "name": "VariableDeclaration", - "src": "591:11:0" - } - ], - "id": 190, - "name": "ParameterList", - "src": "562:41:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 191, - "name": "ElementaryTypeName", - "src": "613:4:0" - } - ], - "id": 192, - "name": "VariableDeclaration", - "src": "613:4:0" - } - ], - "id": 193, - "name": "ParameterList", - "src": "612:6:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 194, - "name": "Identifier", - "src": "633:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 195, - "name": "Identifier", - "src": "642:5:0" - } - ], - "id": 196, - "name": "IndexAccess", - "src": "633:15:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 197, - "name": "Identifier", - "src": "652:6:0" - } - ], - "id": 198, - "name": "BinaryOperation", - "src": "633:25:0" - }, - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 199, - "name": "Identifier", - "src": "662:7:0" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 200, - "name": "Identifier", - "src": "670:5:0" - } - ], - "id": 201, - "name": "IndexAccess", - "src": "662:14:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 202, - "name": "Identifier", - "src": "677:3:0" - } - ], - "id": 203, - "name": "MemberAccess", - "src": "677:10:0" - } - ], - "id": 204, - "name": "IndexAccess", - "src": "662:26:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 205, - "name": "Identifier", - "src": "692:6:0" - } - ], - "id": 206, - "name": "BinaryOperation", - "src": "662:36:0" - } - ], - "id": 207, - "name": "BinaryOperation", - "src": "633:65:0" - }, - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": "+", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 208, - "name": "Identifier", - "src": "702:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 209, - "name": "Identifier", - "src": "711:3:0" - } - ], - "id": 210, - "name": "IndexAccess", - "src": "702:13:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 211, - "name": "Identifier", - "src": "718:6:0" - } - ], - "id": 212, - "name": "BinaryOperation", - "src": "702:22:0" - }, - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 213, - "name": "Identifier", - "src": "728:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 214, - "name": "Identifier", - "src": "737:3:0" - } - ], - "id": 215, - "name": "IndexAccess", - "src": "728:13:0" - } - ], - "id": 216, - "name": "BinaryOperation", - "src": "702:39:0" - } - ], - "id": 217, - "name": "BinaryOperation", - "src": "633:108:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 218, - "name": "Identifier", - "src": "757:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 219, - "name": "Identifier", - "src": "766:3:0" - } - ], - "id": 220, - "name": "IndexAccess", - "src": "757:13:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 221, - "name": "Identifier", - "src": "774:6:0" - } - ], - "id": 222, - "name": "Assignment", - "src": "757:23:0" - } - ], - "id": 223, - "name": "ExpressionStatement", - "src": "757:23:0" - }, - { - "children": [ - { - "attributes": { - "operator": "-=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 224, - "name": "Identifier", - "src": "794:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 225, - "name": "Identifier", - "src": "803:5:0" - } - ], - "id": 226, - "name": "IndexAccess", - "src": "794:15:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 227, - "name": "Identifier", - "src": "813:6:0" - } - ], - "id": 228, - "name": "Assignment", - "src": "794:25:0" - } - ], - "id": 229, - "name": "ExpressionStatement", - "src": "794:25:0" - }, - { - "children": [ - { - "attributes": { - "operator": "-=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 230, - "name": "Identifier", - "src": "833:7:0" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 231, - "name": "Identifier", - "src": "841:5:0" - } - ], - "id": 234, - "name": "IndexAccess", - "src": "833:14:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 232, - "name": "Identifier", - "src": "848:3:0" - } - ], - "id": 233, - "name": "MemberAccess", - "src": "848:10:0" - } - ], - "id": 235, - "name": "IndexAccess", - "src": "833:26:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 236, - "name": "Identifier", - "src": "863:6:0" - } - ], - "id": 237, - "name": "Assignment", - "src": "833:36:0" - } - ], - "id": 238, - "name": "ExpressionStatement", - "src": "833:36:0" - }, - { - "children": [ - { - "attributes": { - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "type": "function (address,address,uint256) constant", - "value": "Transfer" - }, - "id": 239, - "name": "Identifier", - "src": "883:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 240, - "name": "Identifier", - "src": "892:5:0" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 241, - "name": "Identifier", - "src": "899:3:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 242, - "name": "Identifier", - "src": "904:6:0" - } - ], - "id": 243, - "name": "FunctionCall", - "src": "883:28:0" - } - ], - "id": 244, - "name": "ExpressionStatement", - "src": "883:28:0" - }, - { - "children": [ - { - "attributes": { - "hexvalue": "74727565", - "subdenomination": null, - "token": "true", - "type": "bool", - "value": "true" - }, - "id": 245, - "name": "Literal", - "src": "932:4:0" - } - ], - "id": 246, - "name": "Return", - "src": "925:11:0" - } - ], - "id": 247, - "name": "Block", - "src": "743:204:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "hexvalue": "66616c7365", - "subdenomination": null, - "token": "false", - "type": "bool", - "value": "false" - }, - "id": 248, - "name": "Literal", - "src": "962:5:0" - } - ], - "id": 249, - "name": "Return", - "src": "955:12:0" - } - ], - "id": 250, - "name": "Block", - "src": "953:17:0" - } - ], - "id": 251, - "name": "IfStatement", - "src": "629:341:0" - } - ], - "id": 252, - "name": "Block", - "src": "619:357:0" - } - ], - "id": 253, - "name": "FunctionDefinition", - "src": "541:435:0" - }, - { - "attributes": { - "constant": true, - "name": "balanceOf", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_owner", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 254, - "name": "ElementaryTypeName", - "src": "1001:7:0" - } - ], - "id": 255, - "name": "VariableDeclaration", - "src": "1001:14:0" - } - ], - "id": 256, - "name": "ParameterList", - "src": "1000:16:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 257, - "name": "ElementaryTypeName", - "src": "1035:4:0" - } - ], - "id": 258, - "name": "VariableDeclaration", - "src": "1035:4:0" - } - ], - "id": 259, - "name": "ParameterList", - "src": "1034:6:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 260, - "name": "Identifier", - "src": "1058:8:0" - }, - { - "attributes": { - "type": "address", - "value": "_owner" - }, - "id": 261, - "name": "Identifier", - "src": "1067:6:0" - } - ], - "id": 262, - "name": "IndexAccess", - "src": "1058:16:0" - } - ], - "id": 263, - "name": "Return", - "src": "1051:23:0" - } - ], - "id": 264, - "name": "Block", - "src": "1041:40:0" - } - ], - "id": 265, - "name": "FunctionDefinition", - "src": "982:99:0" - }, - { - "attributes": { - "constant": false, - "name": "approve", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_spender", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 266, - "name": "ElementaryTypeName", - "src": "1104:7:0" - } - ], - "id": 267, - "name": "VariableDeclaration", - "src": "1104:16:0" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 268, - "name": "ElementaryTypeName", - "src": "1122:4:0" - } - ], - "id": 269, - "name": "VariableDeclaration", - "src": "1122:11:0" - } - ], - "id": 270, - "name": "ParameterList", - "src": "1103:31:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 271, - "name": "ElementaryTypeName", - "src": "1144:4:0" - } - ], - "id": 272, - "name": "VariableDeclaration", - "src": "1144:4:0" - } - ], - "id": 273, - "name": "ParameterList", - "src": "1143:6:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 274, - "name": "Identifier", - "src": "1160:7:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 275, - "name": "Identifier", - "src": "1168:3:0" - } - ], - "id": 276, - "name": "MemberAccess", - "src": "1168:10:0" - } - ], - "id": 278, - "name": "IndexAccess", - "src": "1160:19:0" - }, - { - "attributes": { - "type": "address", - "value": "_spender" - }, - "id": 277, - "name": "Identifier", - "src": "1180:8:0" - } - ], - "id": 279, - "name": "IndexAccess", - "src": "1160:29:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 280, - "name": "Identifier", - "src": "1192:6:0" - } - ], - "id": 281, - "name": "Assignment", - "src": "1160:38:0" - } - ], - "id": 282, - "name": "ExpressionStatement", - "src": "1160:38:0" - }, - { - "children": [ - { - "attributes": { - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "type": "function (address,address,uint256) constant", - "value": "Approval" - }, - "id": 283, - "name": "Identifier", - "src": "1208:8:0" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 284, - "name": "Identifier", - "src": "1217:3:0" - } - ], - "id": 285, - "name": "MemberAccess", - "src": "1217:10:0" - }, - { - "attributes": { - "type": "address", - "value": "_spender" - }, - "id": 286, - "name": "Identifier", - "src": "1229:8:0" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 287, - "name": "Identifier", - "src": "1239:6:0" - } - ], - "id": 288, - "name": "FunctionCall", - "src": "1208:38:0" - } - ], - "id": 289, - "name": "ExpressionStatement", - "src": "1208:38:0" - }, - { - "children": [ - { - "attributes": { - "hexvalue": "74727565", - "subdenomination": null, - "token": "true", - "type": "bool", - "value": "true" - }, - "id": 290, - "name": "Literal", - "src": "1263:4:0" - } - ], - "id": 291, - "name": "Return", - "src": "1256:11:0" - } - ], - "id": 292, - "name": "Block", - "src": "1150:124:0" - } - ], - "id": 293, - "name": "FunctionDefinition", - "src": "1087:187:0" - }, - { - "attributes": { - "constant": true, - "name": "allowance", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_owner", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 294, - "name": "ElementaryTypeName", - "src": "1299:7:0" - } - ], - "id": 295, - "name": "VariableDeclaration", - "src": "1299:14:0" - }, - { - "attributes": { - "constant": false, - "name": "_spender", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 296, - "name": "ElementaryTypeName", - "src": "1315:7:0" - } - ], - "id": 297, - "name": "VariableDeclaration", - "src": "1315:16:0" - } - ], - "id": 298, - "name": "ParameterList", - "src": "1298:34:0" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 299, - "name": "ElementaryTypeName", - "src": "1351:4:0" - } - ], - "id": 300, - "name": "VariableDeclaration", - "src": "1351:4:0" - } - ], - "id": 301, - "name": "ParameterList", - "src": "1350:6:0" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 302, - "name": "Identifier", - "src": "1374:7:0" - }, - { - "attributes": { - "type": "address", - "value": "_owner" - }, - "id": 303, - "name": "Identifier", - "src": "1382:6:0" - } - ], - "id": 304, - "name": "IndexAccess", - "src": "1374:15:0" - }, - { - "attributes": { - "type": "address", - "value": "_spender" - }, - "id": 305, - "name": "Identifier", - "src": "1390:8:0" - } - ], - "id": 306, - "name": "IndexAccess", - "src": "1374:25:0" - } - ], - "id": 307, - "name": "Return", - "src": "1367:32:0" - } - ], - "id": 308, - "name": "Block", - "src": "1357:49:0" - } - ], - "id": 309, - "name": "FunctionDefinition", - "src": "1280:126:0" - }, - { - "attributes": { - "constant": false, - "name": "balances", - "storageLocation": "default", - "type": "mapping(address => uint256)", - "visibility": "internal" - }, - "children": [ - { - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 310, - "name": "ElementaryTypeName", - "src": "1421:7:0" - }, - { - "attributes": { - "name": "uint" - }, - "id": 311, - "name": "ElementaryTypeName", - "src": "1432:4:0" - } - ], - "id": 312, - "name": "Mapping", - "src": "1412:25:0" - } - ], - "id": 313, - "name": "VariableDeclaration", - "src": "1412:34:0" - }, - { - "attributes": { - "constant": false, - "name": "allowed", - "storageLocation": "default", - "type": "mapping(address => mapping(address => uint256))", - "visibility": "internal" - }, - "children": [ - { - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 314, - "name": "ElementaryTypeName", - "src": "1461:7:0" - }, - { - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 315, - "name": "ElementaryTypeName", - "src": "1481:7:0" - }, - { - "attributes": { - "name": "uint" - }, - "id": 316, - "name": "ElementaryTypeName", - "src": "1492:4:0" - } - ], - "id": 317, - "name": "Mapping", - "src": "1472:25:0" - } - ], - "id": 318, - "name": "Mapping", - "src": "1452:46:0" - } - ], - "id": 319, - "name": "VariableDeclaration", - "src": "1452:54:0" - }, - { - "attributes": { - "constant": false, - "name": "totalSupply", - "storageLocation": "default", - "type": "uint256", - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 320, - "name": "ElementaryTypeName", - "src": "1512:4:0" - } - ], - "id": 321, - "name": "VariableDeclaration", - "src": "1512:23:0" - } - ], - "id": 322, - "name": "ContractDefinition", - "src": "86:1452:0" - } - ], - "name": "SourceUnit" - } - }, - "1.0.0/Token/Token_v1.sol": { - "id": 1, - "legacyAST": { - "children": [ - { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".11" - ] - }, - "id": 324, - "name": "PragmaDirective", - "src": "0:24:1" - }, - { - "attributes": { - "fullyImplemented": true, - "isLibrary": false, - "linearizedBaseContracts": [ - 397 - ], - "name": "Token_v1" - }, - "children": [ - { - "attributes": { - "constant": true, - "name": "totalSupply", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [], - "id": 325, - "name": "ParameterList", - "src": "110:2:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "supply", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 326, - "name": "ElementaryTypeName", - "src": "131:4:1" - } - ], - "id": 327, - "name": "VariableDeclaration", - "src": "131:11:1" - } - ], - "id": 328, - "name": "ParameterList", - "src": "130:13:1" - }, - { - "children": [], - "id": 329, - "name": "Block", - "src": "144:2:1" - } - ], - "id": 330, - "name": "FunctionDefinition", - "src": "90:56:1" - }, - { - "attributes": { - "constant": true, - "name": "balanceOf", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_owner", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 331, - "name": "ElementaryTypeName", - "src": "274:7:1" - } - ], - "id": 332, - "name": "VariableDeclaration", - "src": "274:14:1" - } - ], - "id": 333, - "name": "ParameterList", - "src": "273:16:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "balance", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 334, - "name": "ElementaryTypeName", - "src": "308:4:1" - } - ], - "id": 335, - "name": "VariableDeclaration", - "src": "308:12:1" - } - ], - "id": 336, - "name": "ParameterList", - "src": "307:14:1" - }, - { - "children": [], - "id": 337, - "name": "Block", - "src": "322:2:1" - } - ], - "id": 338, - "name": "FunctionDefinition", - "src": "255:69:1" - }, - { - "attributes": { - "constant": false, - "name": "transfer", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 339, - "name": "ElementaryTypeName", - "src": "578:7:1" - } - ], - "id": 340, - "name": "VariableDeclaration", - "src": "578:11:1" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 341, - "name": "ElementaryTypeName", - "src": "591:4:1" - } - ], - "id": 342, - "name": "VariableDeclaration", - "src": "591:11:1" - } - ], - "id": 343, - "name": "ParameterList", - "src": "577:26:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "success", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 344, - "name": "ElementaryTypeName", - "src": "613:4:1" - } - ], - "id": 345, - "name": "VariableDeclaration", - "src": "613:12:1" - } - ], - "id": 346, - "name": "ParameterList", - "src": "612:14:1" - }, - { - "children": [], - "id": 347, - "name": "Block", - "src": "627:2:1" - } - ], - "id": 348, - "name": "FunctionDefinition", - "src": "560:69:1" - }, - { - "attributes": { - "constant": false, - "name": "transferFrom", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_from", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 349, - "name": "ElementaryTypeName", - "src": "972:7:1" - } - ], - "id": 350, - "name": "VariableDeclaration", - "src": "972:13:1" - }, - { - "attributes": { - "constant": false, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 351, - "name": "ElementaryTypeName", - "src": "987:7:1" - } - ], - "id": 352, - "name": "VariableDeclaration", - "src": "987:11:1" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 353, - "name": "ElementaryTypeName", - "src": "1000:4:1" - } - ], - "id": 354, - "name": "VariableDeclaration", - "src": "1000:11:1" - } - ], - "id": 355, - "name": "ParameterList", - "src": "971:41:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "success", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 356, - "name": "ElementaryTypeName", - "src": "1022:4:1" - } - ], - "id": 357, - "name": "VariableDeclaration", - "src": "1022:12:1" - } - ], - "id": 358, - "name": "ParameterList", - "src": "1021:14:1" - }, - { - "children": [], - "id": 359, - "name": "Block", - "src": "1036:2:1" - } - ], - "id": 360, - "name": "FunctionDefinition", - "src": "950:88:1" - }, - { - "attributes": { - "constant": false, - "name": "approve", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_spender", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 361, - "name": "ElementaryTypeName", - "src": "1338:7:1" - } - ], - "id": 362, - "name": "VariableDeclaration", - "src": "1338:16:1" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 363, - "name": "ElementaryTypeName", - "src": "1356:4:1" - } - ], - "id": 364, - "name": "VariableDeclaration", - "src": "1356:11:1" - } - ], - "id": 365, - "name": "ParameterList", - "src": "1337:31:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "success", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 366, - "name": "ElementaryTypeName", - "src": "1378:4:1" - } - ], - "id": 367, - "name": "VariableDeclaration", - "src": "1378:12:1" - } - ], - "id": 368, - "name": "ParameterList", - "src": "1377:14:1" - }, - { - "children": [], - "id": 369, - "name": "Block", - "src": "1392:2:1" - } - ], - "id": 370, - "name": "FunctionDefinition", - "src": "1321:73:1" - }, - { - "attributes": { - "constant": true, - "name": "allowance", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_owner", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 371, - "name": "ElementaryTypeName", - "src": "1621:7:1" - } - ], - "id": 372, - "name": "VariableDeclaration", - "src": "1621:14:1" - }, - { - "attributes": { - "constant": false, - "name": "_spender", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 373, - "name": "ElementaryTypeName", - "src": "1637:7:1" - } - ], - "id": 374, - "name": "VariableDeclaration", - "src": "1637:16:1" - } - ], - "id": 375, - "name": "ParameterList", - "src": "1620:34:1" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "remaining", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 376, - "name": "ElementaryTypeName", - "src": "1673:4:1" - } - ], - "id": 377, - "name": "VariableDeclaration", - "src": "1673:14:1" - } - ], - "id": 378, - "name": "ParameterList", - "src": "1672:16:1" - }, - { - "children": [], - "id": 379, - "name": "Block", - "src": "1689:2:1" - } - ], - "id": 380, - "name": "FunctionDefinition", - "src": "1602:89:1" - }, - { - "attributes": { - "name": "Transfer" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": true, - "name": "_from", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 381, - "name": "ElementaryTypeName", - "src": "1712:7:1" - } - ], - "id": 382, - "name": "VariableDeclaration", - "src": "1712:21:1" - }, - { - "attributes": { - "constant": false, - "indexed": true, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 383, - "name": "ElementaryTypeName", - "src": "1735:7:1" - } - ], - "id": 384, - "name": "VariableDeclaration", - "src": "1735:19:1" - }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 385, - "name": "ElementaryTypeName", - "src": "1756:4:1" - } - ], - "id": 386, - "name": "VariableDeclaration", - "src": "1756:11:1" - } - ], - "id": 387, - "name": "ParameterList", - "src": "1711:57:1" - } - ], - "id": 388, - "name": "EventDefinition", - "src": "1697:72:1" - }, - { - "attributes": { - "name": "Approval" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "indexed": true, - "name": "_owner", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 389, - "name": "ElementaryTypeName", - "src": "1789:7:1" - } - ], - "id": 390, - "name": "VariableDeclaration", - "src": "1789:22:1" - }, - { - "attributes": { - "constant": false, - "indexed": true, - "name": "_spender", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 391, - "name": "ElementaryTypeName", - "src": "1813:7:1" - } - ], - "id": 392, - "name": "VariableDeclaration", - "src": "1813:24:1" - }, - { - "attributes": { - "constant": false, - "indexed": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 393, - "name": "ElementaryTypeName", - "src": "1839:4:1" - } - ], - "id": 394, - "name": "VariableDeclaration", - "src": "1839:11:1" - } - ], - "id": 395, - "name": "ParameterList", - "src": "1788:63:1" - } - ], - "id": 396, - "name": "EventDefinition", - "src": "1774:78:1" - } - ], - "id": 397, - "name": "ContractDefinition", - "src": "26:1828:1" - } - ], - "name": "SourceUnit" - } - }, - "1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol": { - "id": 2, - "legacyAST": { - "children": [ - { - "attributes": { - "literals": [ - "solidity", - "^", - "0.4", - ".11" - ] - }, - "id": 33, - "name": "PragmaDirective", - "src": "580:24:2" - }, - { - "attributes": { - "file": "../ERC20Token/ERC20Token_v1.sol" - }, - "id": 35, - "name": "ImportDirective", - "src": "606:78:2" - }, - { - "attributes": { - "fullyImplemented": true, - "isLibrary": false, - "linearizedBaseContracts": [ - 124, - 322, - 397 - ], - "name": "UnlimitedAllowanceToken_v1" - }, - "children": [ - { - "children": [ - { - "attributes": { - "name": "ERC20Token" - }, - "id": 36, - "name": "UserDefinedTypeName", - "src": "725:10:2" - } - ], - "id": 37, - "name": "InheritanceSpecifier", - "src": "725:10:2" - }, - { - "attributes": { - "constant": true, - "name": "MAX_UINT", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 38, - "name": "ElementaryTypeName", - "src": "743:4:2" - }, - { - "attributes": { - "operator": "-", - "type": "int_const 115792089237316195423570985008687907853269984665640564039457584007913129639935" - }, - "children": [ - { - "attributes": { - "operator": "**", - "type": "int_const 115792089237316195423570985008687907853269984665640564039457584007913129639936" - }, - "children": [ - { - "attributes": { - "hexvalue": "32", - "subdenomination": null, - "token": null, - "type": "int_const 2", - "value": "2" - }, - "id": 39, - "name": "Literal", - "src": "768:1:2" - }, - { - "attributes": { - "hexvalue": "323536", - "subdenomination": null, - "token": null, - "type": "int_const 256", - "value": "256" - }, - "id": 40, - "name": "Literal", - "src": "771:3:2" - } - ], - "id": 41, - "name": "BinaryOperation", - "src": "768:6:2" - }, - { - "attributes": { - "hexvalue": "31", - "subdenomination": null, - "token": null, - "type": "int_const 1", - "value": "1" - }, - "id": 42, - "name": "Literal", - "src": "777:1:2" - } - ], - "id": 43, - "name": "BinaryOperation", - "src": "768:10:2" - } - ], - "id": 44, - "name": "VariableDeclaration", - "src": "743:35:2" - }, - { - "attributes": { - "constant": false, - "name": "transferFrom", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "_from", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 45, - "name": "ElementaryTypeName", - "src": "1088:7:2" - } - ], - "id": 46, - "name": "VariableDeclaration", - "src": "1088:13:2" - }, - { - "attributes": { - "constant": false, - "name": "_to", - "storageLocation": "default", - "type": "address", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "address" - }, - "id": 47, - "name": "ElementaryTypeName", - "src": "1103:7:2" - } - ], - "id": 48, - "name": "VariableDeclaration", - "src": "1103:11:2" - }, - { - "attributes": { - "constant": false, - "name": "_value", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 49, - "name": "ElementaryTypeName", - "src": "1116:4:2" - } - ], - "id": 50, - "name": "VariableDeclaration", - "src": "1116:11:2" - } - ], - "id": 51, - "name": "ParameterList", - "src": "1087:41:2" - }, - { - "children": [ - { - "attributes": { - "constant": false, - "name": "", - "storageLocation": "default", - "type": "bool", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "bool" - }, - "id": 52, - "name": "ElementaryTypeName", - "src": "1161:4:2" - } - ], - "id": 53, - "name": "VariableDeclaration", - "src": "1161:4:2" - } - ], - "id": 54, - "name": "ParameterList", - "src": "1160:6:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "constant": false, - "name": "allowance", - "storageLocation": "default", - "type": "uint256", - "visibility": "internal" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 55, - "name": "ElementaryTypeName", - "src": "1181:4:2" - } - ], - "id": 56, - "name": "VariableDeclaration", - "src": "1181:14:2" - }, - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 57, - "name": "Identifier", - "src": "1198:7:2" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 58, - "name": "Identifier", - "src": "1206:5:2" - } - ], - "id": 59, - "name": "IndexAccess", - "src": "1198:14:2" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 60, - "name": "Identifier", - "src": "1213:3:2" - } - ], - "id": 61, - "name": "MemberAccess", - "src": "1213:10:2" - } - ], - "id": 62, - "name": "IndexAccess", - "src": "1198:26:2" - } - ], - "id": 63, - "name": "VariableDeclarationStatement", - "src": "1181:43:2" - }, - { - "children": [ - { - "attributes": { - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": "&&", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 64, - "name": "Identifier", - "src": "1238:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 65, - "name": "Identifier", - "src": "1247:5:2" - } - ], - "id": 66, - "name": "IndexAccess", - "src": "1238:15:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 67, - "name": "Identifier", - "src": "1257:6:2" - } - ], - "id": 68, - "name": "BinaryOperation", - "src": "1238:25:2" - }, - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256", - "value": "allowance" - }, - "id": 69, - "name": "Identifier", - "src": "1279:9:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 70, - "name": "Identifier", - "src": "1292:6:2" - } - ], - "id": 71, - "name": "BinaryOperation", - "src": "1279:19:2" - } - ], - "id": 72, - "name": "BinaryOperation", - "src": "1238:60:2" - }, - { - "attributes": { - "operator": ">=", - "type": "bool" - }, - "children": [ - { - "attributes": { - "operator": "+", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 73, - "name": "Identifier", - "src": "1314:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 74, - "name": "Identifier", - "src": "1323:3:2" - } - ], - "id": 75, - "name": "IndexAccess", - "src": "1314:13:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 76, - "name": "Identifier", - "src": "1330:6:2" - } - ], - "id": 77, - "name": "BinaryOperation", - "src": "1314:22:2" - }, - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 78, - "name": "Identifier", - "src": "1340:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 79, - "name": "Identifier", - "src": "1349:3:2" - } - ], - "id": 80, - "name": "IndexAccess", - "src": "1340:13:2" - } - ], - "id": 81, - "name": "BinaryOperation", - "src": "1314:39:2" - } - ], - "id": 82, - "name": "BinaryOperation", - "src": "1238:115:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "+=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 83, - "name": "Identifier", - "src": "1378:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 84, - "name": "Identifier", - "src": "1387:3:2" - } - ], - "id": 85, - "name": "IndexAccess", - "src": "1378:13:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 86, - "name": "Identifier", - "src": "1395:6:2" - } - ], - "id": 87, - "name": "Assignment", - "src": "1378:23:2" - } - ], - "id": 88, - "name": "ExpressionStatement", - "src": "1378:23:2" - }, - { - "children": [ - { - "attributes": { - "operator": "-=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 89, - "name": "Identifier", - "src": "1415:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 90, - "name": "Identifier", - "src": "1424:5:2" - } - ], - "id": 91, - "name": "IndexAccess", - "src": "1415:15:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 92, - "name": "Identifier", - "src": "1434:6:2" - } - ], - "id": 93, - "name": "Assignment", - "src": "1415:25:2" - } - ], - "id": 94, - "name": "ExpressionStatement", - "src": "1415:25:2" - }, - { - "children": [ - { - "attributes": { - "operator": "<", - "type": "bool" - }, - "children": [ - { - "attributes": { - "type": "uint256", - "value": "allowance" - }, - "id": 95, - "name": "Identifier", - "src": "1458:9:2" - }, - { - "attributes": { - "type": "uint256", - "value": "MAX_UINT" - }, - "id": 96, - "name": "Identifier", - "src": "1470:8:2" - } - ], - "id": 97, - "name": "BinaryOperation", - "src": "1458:20:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "-=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => mapping(address => uint256))", - "value": "allowed" - }, - "id": 98, - "name": "Identifier", - "src": "1498:7:2" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 99, - "name": "Identifier", - "src": "1506:5:2" - } - ], - "id": 102, - "name": "IndexAccess", - "src": "1498:14:2" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 100, - "name": "Identifier", - "src": "1513:3:2" - } - ], - "id": 101, - "name": "MemberAccess", - "src": "1513:10:2" - } - ], - "id": 103, - "name": "IndexAccess", - "src": "1498:26:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 104, - "name": "Identifier", - "src": "1528:6:2" - } - ], - "id": 105, - "name": "Assignment", - "src": "1498:36:2" - } - ], - "id": 106, - "name": "ExpressionStatement", - "src": "1498:36:2" - } - ], - "id": 107, - "name": "Block", - "src": "1480:69:2" - } - ], - "id": 108, - "name": "IfStatement", - "src": "1454:95:2" - }, - { - "children": [ - { - "attributes": { - "type": "tuple()", - "type_conversion": false - }, - "children": [ - { - "attributes": { - "type": "function (address,address,uint256) constant", - "value": "Transfer" - }, - "id": 109, - "name": "Identifier", - "src": "1562:8:2" - }, - { - "attributes": { - "type": "address", - "value": "_from" - }, - "id": 110, - "name": "Identifier", - "src": "1571:5:2" - }, - { - "attributes": { - "type": "address", - "value": "_to" - }, - "id": 111, - "name": "Identifier", - "src": "1578:3:2" - }, - { - "attributes": { - "type": "uint256", - "value": "_value" - }, - "id": 112, - "name": "Identifier", - "src": "1583:6:2" - } - ], - "id": 113, - "name": "FunctionCall", - "src": "1562:28:2" - } - ], - "id": 114, - "name": "ExpressionStatement", - "src": "1562:28:2" - }, - { - "children": [ - { - "attributes": { - "hexvalue": "74727565", - "subdenomination": null, - "token": "true", - "type": "bool", - "value": "true" - }, - "id": 115, - "name": "Literal", - "src": "1611:4:2" - } - ], - "id": 116, - "name": "Return", - "src": "1604:11:2" - } - ], - "id": 117, - "name": "Block", - "src": "1364:262:2" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "hexvalue": "66616c7365", - "subdenomination": null, - "token": "false", - "type": "bool", - "value": "false" - }, - "id": 118, - "name": "Literal", - "src": "1653:5:2" - } - ], - "id": 119, - "name": "Return", - "src": "1646:12:2" - } - ], - "id": 120, - "name": "Block", - "src": "1632:37:2" - } - ], - "id": 121, - "name": "IfStatement", - "src": "1234:435:2" - } - ], - "id": 122, - "name": "Block", - "src": "1171:504:2" - } - ], - "id": 123, - "name": "FunctionDefinition", - "src": "1066:609:2" - } - ], - "id": 124, - "name": "ContractDefinition", - "src": "686:991:2" - } - ], - "name": "SourceUnit" - } - }, - "2.0.0/tokens/ZRXToken/ZRXToken.sol": { - "id": 3, - "legacyAST": { - "children": [ - { - "attributes": { - "literals": [ - "solidity", - "0.4", - ".11" - ] - }, - "id": 1, - "name": "PragmaDirective", - "src": "580:23:3" - }, - { - "attributes": { - "file": "../../../1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol" - }, - "id": 3, - "name": "ImportDirective", - "src": "650:142:3" - }, - { - "attributes": { - "fullyImplemented": true, - "isLibrary": false, - "linearizedBaseContracts": [ - 31, - 124, - 322, - 397 - ], - "name": "ZRXToken" - }, - "children": [ - { - "children": [ - { - "attributes": { - "name": "UnlimitedAllowanceToken" - }, - "id": 4, - "name": "UserDefinedTypeName", - "src": "816:23:3" - } - ], - "id": 5, - "name": "InheritanceSpecifier", - "src": "816:23:3" - }, - { - "attributes": { - "constant": true, - "name": "decimals", - "storageLocation": "default", - "type": "uint8", - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint8" - }, - "id": 6, - "name": "ElementaryTypeName", - "src": "891:5:3" - }, - { - "attributes": { - "hexvalue": "3138", - "subdenomination": null, - "token": null, - "type": "int_const 18", - "value": "18" - }, - "id": 7, - "name": "Literal", - "src": "924:2:3" - } - ], - "id": 8, - "name": "VariableDeclaration", - "src": "891:35:3" - }, - { - "attributes": { - "constant": false, - "name": "totalSupply", - "storageLocation": "default", - "type": "uint256", - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "uint" - }, - "id": 9, - "name": "ElementaryTypeName", - "src": "932:4:3" - }, - { - "attributes": { - "operator": "**", - "type": "int_const 1000000000000000000000000000" - }, - "children": [ - { - "attributes": { - "hexvalue": "3130", - "subdenomination": null, - "token": null, - "type": "int_const 10", - "value": "10" - }, - "id": 10, - "name": "Literal", - "src": "958:2:3" - }, - { - "attributes": { - "hexvalue": "3237", - "subdenomination": null, - "token": null, - "type": "int_const 27", - "value": "27" - }, - "id": 11, - "name": "Literal", - "src": "962:2:3" - } - ], - "id": 12, - "name": "BinaryOperation", - "src": "958:6:3" - } - ], - "id": 13, - "name": "VariableDeclaration", - "src": "932:32:3" - }, - { - "attributes": { - "constant": true, - "name": "name", - "storageLocation": "default", - "type": "string memory", - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "string" - }, - "id": 14, - "name": "ElementaryTypeName", - "src": "1009:6:3" - }, - { - "attributes": { - "hexvalue": "30782050726f746f636f6c20546f6b656e", - "subdenomination": null, - "token": null, - "type": "literal_string \"0x Protocol Token\"", - "value": "0x Protocol Token" - }, - "id": 15, - "name": "Literal", - "src": "1039:19:3" - } - ], - "id": 16, - "name": "VariableDeclaration", - "src": "1009:49:3" - }, - { - "attributes": { - "constant": true, - "name": "symbol", - "storageLocation": "default", - "type": "string memory", - "visibility": "public" - }, - "children": [ - { - "attributes": { - "name": "string" - }, - "id": 17, - "name": "ElementaryTypeName", - "src": "1064:6:3" - }, - { - "attributes": { - "hexvalue": "5a5258", - "subdenomination": null, - "token": null, - "type": "literal_string \"ZRX\"", - "value": "ZRX" - }, - "id": 18, - "name": "Literal", - "src": "1096:5:3" - } - ], - "id": 19, - "name": "VariableDeclaration", - "src": "1064:37:3" - }, - { - "attributes": { - "constant": false, - "name": "ZRXToken", - "payable": false, - "visibility": "public" - }, - "children": [ - { - "children": [], - "id": 20, - "name": "ParameterList", - "src": "1167:2:3" - }, - { - "children": [], - "id": 21, - "name": "ParameterList", - "src": "1189:0:3" - }, - { - "children": [ - { - "children": [ - { - "attributes": { - "operator": "=", - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "uint256" - }, - "children": [ - { - "attributes": { - "type": "mapping(address => uint256)", - "value": "balances" - }, - "id": 22, - "name": "Identifier", - "src": "1199:8:3" - }, - { - "attributes": { - "member_name": "sender", - "type": "address" - }, - "children": [ - { - "attributes": { - "type": "msg", - "value": "msg" - }, - "id": 23, - "name": "Identifier", - "src": "1208:3:3" - } - ], - "id": 24, - "name": "MemberAccess", - "src": "1208:10:3" - } - ], - "id": 25, - "name": "IndexAccess", - "src": "1199:20:3" - }, - { - "attributes": { - "type": "uint256", - "value": "totalSupply" - }, - "id": 26, - "name": "Identifier", - "src": "1222:11:3" - } - ], - "id": 27, - "name": "Assignment", - "src": "1199:34:3" - } - ], - "id": 28, - "name": "ExpressionStatement", - "src": "1199:34:3" - } - ], - "id": 29, - "name": "Block", - "src": "1189:51:3" - } - ], - "id": 30, - "name": "FunctionDefinition", - "src": "1150:90:3" - } - ], - "id": 31, - "name": "ContractDefinition", - "src": "795:447:3" - } - ], - "name": "SourceUnit" - } - } - }, - "sourceCodes": { - "1.0.0/ERC20Token/ERC20Token_v1.sol": "pragma solidity ^0.4.11;\n\nimport { Token_v1 as Token } from \"../Token/Token_v1.sol\";\n\ncontract ERC20Token_v1 is Token {\n\n function transfer(address _to, uint _value) returns (bool) {\n //Default assumes totalSupply can't be over max (2^256 - 1).\n if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n Transfer(msg.sender, _to, _value);\n return true;\n } else { return false; }\n }\n\n function transferFrom(address _from, address _to, uint _value) returns (bool) {\n if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n Transfer(_from, _to, _value);\n return true;\n } else { return false; }\n }\n\n function balanceOf(address _owner) constant returns (uint) {\n return balances[_owner];\n }\n\n function approve(address _spender, uint _value) returns (bool) {\n allowed[msg.sender][_spender] = _value;\n Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function allowance(address _owner, address _spender) constant returns (uint) {\n return allowed[_owner][_spender];\n }\n\n mapping (address => uint) balances;\n mapping (address => mapping (address => uint)) allowed;\n uint public totalSupply;\n}\n", - "1.0.0/Token/Token_v1.sol": "pragma solidity ^0.4.11;\n\ncontract Token_v1 {\n\n /// @return total amount of tokens\n function totalSupply() constant returns (uint supply) {}\n\n /// @param _owner The address from which the balance will be retrieved\n /// @return The balance\n function balanceOf(address _owner) constant returns (uint balance) {}\n\n /// @notice send `_value` token to `_to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return Whether the transfer was successful or not\n function transfer(address _to, uint _value) returns (bool success) {}\n\n /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return Whether the transfer was successful or not\n function transferFrom(address _from, address _to, uint _value) returns (bool success) {}\n\n /// @notice `msg.sender` approves `_addr` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Whether the approval was successful or not\n function approve(address _spender, uint _value) returns (bool success) {}\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender) constant returns (uint remaining) {}\n\n event Transfer(address indexed _from, address indexed _to, uint _value);\n event Approval(address indexed _owner, address indexed _spender, uint _value);\n}\n\n", - "1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.11;\n\nimport { ERC20Token_v1 as ERC20Token } from \"../ERC20Token/ERC20Token_v1.sol\";\n\ncontract UnlimitedAllowanceToken_v1 is ERC20Token {\n\n uint constant MAX_UINT = 2**256 - 1;\n\n /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.\n /// @param _from Address to transfer from.\n /// @param _to Address to transfer to.\n /// @param _value Amount to transfer.\n /// @return Success of transfer.\n function transferFrom(address _from, address _to, uint _value)\n public\n returns (bool)\n {\n uint allowance = allowed[_from][msg.sender];\n if (balances[_from] >= _value\n && allowance >= _value\n && balances[_to] + _value >= balances[_to]\n ) {\n balances[_to] += _value;\n balances[_from] -= _value;\n if (allowance < MAX_UINT) {\n allowed[_from][msg.sender] -= _value;\n }\n Transfer(_from, _to, _value);\n return true;\n } else {\n return false;\n }\n }\n}\n", - "2.0.0/tokens/ZRXToken/ZRXToken.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.11;\n\n// solhint-disable-next-line max-line-length\nimport { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from \"../../../1.0.0/UnlimitedAllowanceToken/UnlimitedAllowanceToken_v1.sol\";\n\n\ncontract ZRXToken is UnlimitedAllowanceToken {\n\n // solhint-disable const-name-snakecase\n uint8 constant public decimals = 18;\n uint public totalSupply = 10**27; // 1 billion tokens, 18 decimal places\n string constant public name = \"0x Protocol Token\";\n string constant public symbol = \"ZRX\";\n // solhint-enableconst-name-snakecase\n\n function ZRXToken()\n public\n {\n balances[msg.sender] = totalSupply;\n }\n}\n" - }, - "sourceTreeHashHex": "0xbcce67d129fe53ddb9717b4f567b33108c41a4f4324aa47ac609037e41f5b95d", - "compiler": { - "name": "solc", - "version": "soljson-v0.4.11+commit.68ef5810.js", - "settings": { - "optimizer": { - "enabled": true, - "runs": 1000000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode.object", - "evm.bytecode.sourceMap", - "evm.deployedBytecode.object", - "evm.deployedBytecode.sourceMap" - ] - } - } - } - }, - "networks": { - "50": { - "address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c", - "links": {}, - "constructorArgs": "[]" - } - } -} diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 2ba60e730..975de7e70 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,47 +1,35 @@ -export { ZeroEx } from './0x'; - -export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders'; - export { - ExchangeContractErrs, - Order, - SignedOrder, - SignerType, - ECSignature, - OrderStateValid, - OrderStateInvalid, - OrderState, - Token, - ERC20AssetData, - ERC721AssetData, - AssetProxyId, -} from '@0xproject/types'; - -export { - BlockParamLiteral, - FilterObject, - BlockParam, - LogWithDecodedArgs, - ContractEventArg, - Provider, - TransactionReceipt, - TransactionReceiptWithDecodedLogs, -} from 'ethereum-types'; + assetDataUtils, + ecSignOrderHashAsync, + generatePseudoRandomSalt, + isValidSignatureAsync, + orderHashUtils, +} from '@0xproject/order-utils'; export { + ContractWrappers, + ERC20TokenWrapper, + ERC721TokenWrapper, + EtherTokenWrapper, + ExchangeWrapper, + ERC20ProxyWrapper, + ERC721ProxyWrapper, + ForwarderWrapper, + ContractWrappersError, EventCallback, ContractEvent, IndexedFilterValues, BlockRange, OrderFillRequest, ContractEventArgs, + ContractWrappersConfig, MethodOpts, OrderTransactionOpts, TransactionOpts, LogEvent, DecodedLogEvent, - OnOrderStateChangeCallback, - ContractWrappersError, + OrderStatus, + OrderInfo, WETH9Events, WETH9WithdrawalEventArgs, WETH9ApprovalEventArgs, @@ -56,11 +44,43 @@ export { ERC721TokenApprovalForAllEventArgs, ERC721TokenTransferEventArgs, ERC721TokenEvents, + ERC721TokenEventArgs, ExchangeCancelUpToEventArgs, ExchangeAssetProxyRegisteredEventArgs, ExchangeFillEventArgs, ExchangeCancelEventArgs, ExchangeEventArgs, - ContractWrappersConfig, - OrderInfo, + ExchangeEvents, } from '@0xproject/contract-wrappers'; + +export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; + +export { Web3ProviderEngine, RPCSubprovider, Callback, ErrorCallback, Subprovider } from '@0xproject/subproviders'; + +export { BigNumber } from '@0xproject/utils'; + +export { + Order, + SignedOrder, + ECSignature, + OrderStateValid, + OrderStateInvalid, + OrderState, + AssetProxyId, + ExchangeContractErrs, + SignerType, + Token, + ERC20AssetData, + ERC721AssetData, +} from '@0xproject/types'; + +export { + BlockParamLiteral, + FilterObject, + BlockParam, + ContractEventArg, + LogWithDecodedArgs, + Provider, + TransactionReceipt, + TransactionReceiptWithDecodedLogs, +} from 'ethereum-types'; diff --git a/packages/0x.js/src/schemas/zero_ex_config_schema.ts b/packages/0x.js/src/schemas/zero_ex_config_schema.ts deleted file mode 100644 index a9c3c64fc..000000000 --- a/packages/0x.js/src/schemas/zero_ex_config_schema.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const zeroExConfigSchema = { - id: '/ZeroExConfig', - oneOf: [{ $ref: '/ZeroExPrivateNetworkConfig' }, { $ref: '/ZeroExPublicNetworkConfig' }], - type: 'object', -}; diff --git a/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts b/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts deleted file mode 100644 index 378b86e77..000000000 --- a/packages/0x.js/src/schemas/zero_ex_private_network_config_schema.ts +++ /dev/null @@ -1,35 +0,0 @@ -export const zeroExPrivateNetworkConfigSchema = { - id: '/ZeroExPrivateNetworkConfig', - properties: { - networkId: { - type: 'number', - minimum: 1, - }, - gasPrice: { $ref: '/Number' }, - zrxContractAddress: { $ref: '/Address' }, - exchangeContractAddress: { $ref: '/Address' }, - erc20ProxyContractAddress: { $ref: '/Address' }, - erc721ProxyContractAddress: { $ref: '/Address' }, - orderWatcherConfig: { - type: 'object', - properties: { - pollingIntervalMs: { - type: 'number', - minimum: 0, - }, - numConfirmations: { - type: 'number', - minimum: 0, - }, - }, - }, - }, - type: 'object', - required: [ - 'networkId', - 'zrxContractAddress', - 'exchangeContractAddress', - 'erc20ProxyContractAddress', - 'erc721ProxyContractAddress', - ], -}; diff --git a/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts b/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts deleted file mode 100644 index f2a9a4d56..000000000 --- a/packages/0x.js/src/schemas/zero_ex_public_network_config_schema.ts +++ /dev/null @@ -1,43 +0,0 @@ -const networkNameToId: { [networkName: string]: number } = { - mainnet: 1, - ropsten: 3, - rinkeby: 4, - kovan: 42, - ganache: 50, -}; - -export const zeroExPublicNetworkConfigSchema = { - id: '/ZeroExPublicNetworkConfig', - properties: { - networkId: { - type: 'number', - enum: [ - networkNameToId.mainnet, - networkNameToId.ropsten, - networkNameToId.rinkeby, - networkNameToId.kovan, - networkNameToId.ganache, - ], - }, - gasPrice: { $ref: '/Number' }, - zrxContractAddress: { $ref: '/Address' }, - exchangeContractAddress: { $ref: '/Address' }, - erc20ProxyContractAddress: { $ref: '/Address' }, - erc721ProxyContractAddress: { $ref: '/Address' }, - orderWatcherConfig: { - type: 'object', - properties: { - pollingIntervalMs: { - type: 'number', - minimum: 0, - }, - numConfirmations: { - type: 'number', - minimum: 0, - }, - }, - }, - }, - type: 'object', - required: ['networkId'], -}; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts deleted file mode 100644 index 651b15abd..000000000 --- a/packages/0x.js/src/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum InternalZeroExError { - NoAbiDecoder = 'NO_ABI_DECODER', - ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY', - WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', -} - -// tslint:disable:max-file-line-count diff --git a/packages/0x.js/src/utils/constants.ts b/packages/0x.js/src/utils/constants.ts deleted file mode 100644 index 5a5ba0e0a..000000000 --- a/packages/0x.js/src/utils/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const constants = { - NULL_ADDRESS: '0x0000000000000000000000000000000000000000', - TESTRPC_NETWORK_ID: 50, -}; diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts deleted file mode 100644 index be2a94482..000000000 --- a/packages/0x.js/test/0x.js_test.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { ContractWrappers } from '@0xproject/contract-wrappers'; -import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { BigNumber } from '@0xproject/utils'; -import * as chai from 'chai'; -import 'mocha'; - -import { ERC20TokenApprovalEventArgs, ERC20TokenEvents, LogWithDecodedArgs, ZeroEx } from '../src'; - -import { chaiSetup } from './utils/chai_setup'; -import { constants } from './utils/constants'; -import { tokenUtils } from './utils/token_utils'; -import { provider, web3Wrapper } from './utils/web3_wrapper'; - -const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -chaiSetup.configure(); -const expect = chai.expect; - -describe('ZeroEx library', () => { - let zeroEx: ZeroEx; - before(async () => { - const config = { - networkId: constants.TESTRPC_NETWORK_ID, - }; - zeroEx = new ZeroEx(provider, config); - }); - describe('#setProvider', () => { - it('overrides provider in nested web3s and invalidates contractInstances', async () => { - // Instantiate the contract instances with the current provider - await (zeroEx.exchange as any)._getExchangeContractAsync(); - expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined(); - - // Add property to newProvider so that we can differentiate it from old provider - (provider as any).zeroExTestId = 1; - zeroEx.setProvider(provider, constants.TESTRPC_NETWORK_ID); - - // Check that contractInstances with old provider are removed after provider update - expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined(); - - // Check that all nested zeroExContract/web3Wrapper instances return the updated provider - const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider(); - expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number'); - const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider(); - expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number'); - }); - }); - describe('#isValidSignature', () => { - const dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0'; - const ethSignSignature = - '0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403'; - const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; - const bytes32Zeros = '0x0000000000000000000000000000000000000000000000000000000000000000'; - it("should return false if the data doesn't pertain to the signature & address", async () => { - return expect( - (zeroEx.exchange as any).isValidSignatureAsync(bytes32Zeros, address, ethSignSignature), - ).to.become(false); - }); - it("should return false if the address doesn't pertain to the signature & data", async () => { - const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42'; - return expect( - (zeroEx.exchange as any).isValidSignatureAsync(dataHex, validUnrelatedAddress, ethSignSignature), - ).to.become(false); - }); - it("should return false if the signature doesn't pertain to the dataHex & address", async () => { - const signatureArray = ethSignSignature.split(''); - // tslint:disable-next-line:custom-no-magic-numbers - signatureArray[5] = 'C'; // V = 28, instead of 27 - const wrongSignature = signatureArray.join(''); - return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, wrongSignature)).to.become( - false, - ); - }); - it('should return true if the signature does pertain to the dataHex & address', async () => { - return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, ethSignSignature)).to.become( - true, - ); - }); - }); - describe('#toUnitAmount', () => { - it('should throw if invalid baseUnit amount supplied as argument', () => { - const invalidBaseUnitAmount = new BigNumber(1000000000.4); - const decimals = 6; - expect(() => ZeroEx.toUnitAmount(invalidBaseUnitAmount, decimals)).to.throw( - 'amount should be in baseUnits (no decimals), found value: 1000000000.4', - ); - }); - it('Should return the expected unit amount for the decimals passed in', () => { - const baseUnitAmount = new BigNumber(1000000000); - const decimals = 6; - const unitAmount = ZeroEx.toUnitAmount(baseUnitAmount, decimals); - const expectedUnitAmount = new BigNumber(1000); - expect(unitAmount).to.be.bignumber.equal(expectedUnitAmount); - }); - }); - describe('#toBaseUnitAmount', () => { - it('Should return the expected base unit amount for the decimals passed in', () => { - const unitAmount = new BigNumber(1000); - const decimals = 6; - const baseUnitAmount = ZeroEx.toBaseUnitAmount(unitAmount, decimals); - const expectedUnitAmount = new BigNumber(1000000000); - expect(baseUnitAmount).to.be.bignumber.equal(expectedUnitAmount); - }); - it('should throw if unitAmount has more decimals then specified as the max decimal precision', () => { - const unitAmount = new BigNumber(0.823091); - const decimals = 5; - expect(() => ZeroEx.toBaseUnitAmount(unitAmount, decimals)).to.throw( - 'Invalid unit amount: 0.823091 - Too many decimal places', - ); - }); - }); - describe('#awaitTransactionMinedAsync', () => { - beforeEach(async () => { - await blockchainLifecycle.startAsync(); - }); - afterEach(async () => { - await blockchainLifecycle.revertAsync(); - }); - it('returns transaction receipt with decoded logs', async () => { - const availableAddresses = await zeroEx.getAvailableAddressesAsync(); - const coinbase = availableAddresses[0]; - const zrxTokenAddress = tokenUtils.getProtocolTokenAddress(); - const erc20ProxyAddress = zeroEx.erc20Proxy.getContractAddress(); - const txHash = await zeroEx.erc20Token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase); - const txReceiptWithDecodedLogs = await zeroEx.awaitTransactionMinedAsync(txHash); - // tslint:disable-next-line:no-unnecessary-type-assertion - const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs; - expect(log.event).to.be.equal(ERC20TokenEvents.Approval); - expect(log.args._owner).to.be.equal(coinbase); - expect(log.args._spender).to.be.equal(erc20ProxyAddress); - expect(log.args._value).to.be.bignumber.equal(zeroEx.erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); - }); - }); - describe('#config', () => { - it('allows to specify exchange contract address', async () => { - const zeroExConfig = { - exchangeContractAddress: ZeroEx.NULL_ADDRESS, - networkId: constants.TESTRPC_NETWORK_ID, - }; - const zeroExWithWrongExchangeAddress = new ZeroEx(provider, zeroExConfig); - expect(zeroExWithWrongExchangeAddress.exchange.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS); - }); - it('allows to specify erc20Proxy contract address', async () => { - const zeroExConfig = { - erc20ProxyContractAddress: ZeroEx.NULL_ADDRESS, - networkId: constants.TESTRPC_NETWORK_ID, - }; - const zeroExWithWrongERC20ProxyAddress = new ZeroEx(provider, zeroExConfig); - expect(zeroExWithWrongERC20ProxyAddress.erc20Proxy.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS); - }); - }); -}); diff --git a/packages/0x.js/test/global_hooks.ts b/packages/0x.js/test/global_hooks.ts deleted file mode 100644 index 364828231..000000000 --- a/packages/0x.js/test/global_hooks.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { devConstants } from '@0xproject/dev-utils'; -import { runV2MigrationsAsync } from '@0xproject/migrations'; - -import { provider } from './utils/web3_wrapper'; - -before('migrate contracts', async function(): Promise { - // HACK: Since the migrations take longer then our global mocha timeout limit - // we manually increase it for this before hook. - const mochaTestTimeoutMs = 20000; - this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this - const txDefaults = { - gas: devConstants.GAS_LIMIT, - from: devConstants.TESTRPC_FIRST_ADDRESS, - }; - const artifactsDir = `../migrations/artifacts/2.0.0`; - await runV2MigrationsAsync(provider, artifactsDir, txDefaults); -}); diff --git a/packages/0x.js/test/utils/chai_setup.ts b/packages/0x.js/test/utils/chai_setup.ts deleted file mode 100644 index 1a8733093..000000000 --- a/packages/0x.js/test/utils/chai_setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as chai from 'chai'; -import chaiAsPromised = require('chai-as-promised'); -import ChaiBigNumber = require('chai-bignumber'); -import * as dirtyChai from 'dirty-chai'; - -export const chaiSetup = { - configure(): void { - chai.config.includeStack = true; - chai.use(ChaiBigNumber()); - chai.use(dirtyChai); - chai.use(chaiAsPromised); - }, -}; diff --git a/packages/0x.js/test/utils/constants.ts b/packages/0x.js/test/utils/constants.ts deleted file mode 100644 index cf030259c..000000000 --- a/packages/0x.js/test/utils/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const constants = { - NULL_ADDRESS: '0x0000000000000000000000000000000000000000', - ROPSTEN_NETWORK_ID: 3, - KOVAN_NETWORK_ID: 42, - TESTRPC_NETWORK_ID: 50, - KOVAN_RPC_URL: 'https://kovan.infura.io/', - ROPSTEN_RPC_URL: 'https://ropsten.infura.io/', - ZRX_DECIMALS: 18, -}; diff --git a/packages/0x.js/test/utils/token_utils.ts b/packages/0x.js/test/utils/token_utils.ts deleted file mode 100644 index a439c464d..000000000 --- a/packages/0x.js/test/utils/token_utils.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { artifacts } from '../../src/artifacts'; - -import { constants } from './constants'; - -export const tokenUtils = { - getProtocolTokenAddress(): string { - return artifacts.ZRXToken.networks[constants.TESTRPC_NETWORK_ID].address; - }, -}; diff --git a/packages/0x.js/test/utils/web3_wrapper.ts b/packages/0x.js/test/utils/web3_wrapper.ts deleted file mode 100644 index 02c8c5918..000000000 --- a/packages/0x.js/test/utils/web3_wrapper.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { devConstants, web3Factory } from '@0xproject/dev-utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { Provider } from 'ethereum-types'; - -const txDefaults = { - from: devConstants.TESTRPC_FIRST_ADDRESS, - gas: devConstants.GAS_LIMIT, -}; -const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true }); -const web3Wrapper = new Web3Wrapper(provider); - -export { provider, web3Wrapper, txDefaults }; diff --git a/yarn.lock b/yarn.lock index 598af599b..e8d5f3018 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5275,9 +5275,9 @@ ethereumjs-wallet@0.6.0: utf8 "^2.1.1" uuid "^2.0.1" -ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: - version "3.0.18" - resolved "https://codeload.github.com/0xproject/ethers.js/tar.gz/b91342bd200d142af0165d6befddf783c8ae8447" +ethers@3.0.22: + version "3.0.22" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-3.0.22.tgz#7fab1ea16521705837aa43c15831877b2716b436" dependencies: aes-js "3.0.0" bn.js "^4.4.0" @@ -6028,7 +6028,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "0.6.0" + ethereumjs-wallet "~0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" -- cgit From c320c8742e140f00d93a82ade91c01e6602b861d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 18:20:45 -0700 Subject: Add CHANGELOG entry about public interface refactor --- packages/0x.js/CHANGELOG.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 756a8991f..66ada59e8 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "1.0.1-rc.4", + "changes": [ + { + "note": + "Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher`" + } + ] + }, { "version": "1.0.1-rc.3", "changes": [ -- cgit From 336519a690ab694344c95f5102c324a4fc48f438 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 18:50:12 -0700 Subject: Add PR nr. --- packages/0x.js/CHANGELOG.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 8196a039f..0f5a10e43 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -4,7 +4,8 @@ "changes": [ { "note": - "Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher`" + "Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher`", + "pr": 963 } ] }, -- cgit From f2d9dfb56b52a0316f618232b8054d8993adcdd4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 13 Aug 2018 20:51:04 -0700 Subject: Remove 0x.js from Circle CI --- .circleci/config.yml | 482 +++++++++++++++++++++++++-------------------------- 1 file changed, 237 insertions(+), 245 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a6fb511b9..d4082f511 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,250 +1,242 @@ version: 2 jobs: - build: - docker: - - image: circleci/node:9 - environment: - CONTRACTS_COMMIT_HASH: '9ed05f5' - working_directory: ~/repo - steps: - - checkout - - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV - - restore_cache: - name: Restore Yarn Package Cache - keys: - - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-{{ .Branch }} - - yarn-packages-master - - yarn-packages- - - run: - name: yarn - command: yarn --frozen-lockfile install - - save_cache: - name: Save Yarn Package Cache - key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} - paths: - - node_modules/ - - run: > - if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then - yarn build --exclude website - else - yarn build - fi - - save_cache: - key: repo-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo - test-contracts-ganache: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci contracts - test-contracts-geth: - docker: - - image: circleci/node:9 - - image: albrow/0x-devnet - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is - # initialized - - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts - test-publish: - docker: - - image: circleci/node:9 - - image: verdaccio/verdaccio - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn test:publish:circleci - test-rest: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci 0x.js - - run: yarn wsrun test:circleci @0xproject/abi-gen - - run: yarn wsrun test:circleci @0xproject/assert - - run: yarn wsrun test:circleci @0xproject/base-contract - - run: yarn wsrun test:circleci @0xproject/connect - - run: yarn wsrun test:circleci @0xproject/contract-wrappers - - run: yarn wsrun test:circleci @0xproject/dev-utils - - run: yarn wsrun test:circleci @0xproject/json-schemas - - run: yarn wsrun test:circleci @0xproject/metacoin - - run: yarn wsrun test:circleci @0xproject/order-utils - - run: yarn wsrun test:circleci @0xproject/order-watcher - - run: yarn wsrun test:circleci @0xproject/sol-compiler - - run: yarn wsrun test:circleci @0xproject/sol-cov - - run: yarn wsrun test:circleci @0xproject/sra-report - - run: yarn wsrun test:circleci @0xproject/subproviders - - run: yarn wsrun test:circleci @0xproject/web3-wrapper - - run: yarn wsrun test:circleci @0xproject/utils - - save_cache: - key: coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/0x.js/coverage/lcov.info - - save_cache: - key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/abi-gen/coverage/lcov.info - - save_cache: - key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/assert/coverage/lcov.info - - save_cache: - key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/base-contract/coverage/lcov.info - - save_cache: - key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/connect/coverage/lcov.info - - save_cache: - key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/contract-wrappers/coverage/lcov.info - - save_cache: - key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/dev-utils/coverage/lcov.info - - save_cache: - key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/json-schemas/coverage/lcov.info - - save_cache: - key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/metacoin/coverage/lcov.info - - save_cache: - key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/order-utils/coverage/lcov.info - - save_cache: - key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/order-watcher/coverage/lcov.info - - save_cache: - key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sol-compiler/coverage/lcov.info - - save_cache: - key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sol-cov/coverage/lcov.info - - save_cache: - key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sra-report/coverage/lcov.info - - save_cache: - key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/subproviders/coverage/lcov.info - - save_cache: - key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/web3-wrapper/coverage/lcov.info - static-tests: - working_directory: ~/repo - docker: - - image: circleci/node:9 - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn prettier:ci - - run: yarn lerna run lint - submit-coverage: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-assert-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-connect-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-contracts-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn report_coverage + build: + docker: + - image: circleci/node:9 + environment: + CONTRACTS_COMMIT_HASH: '9ed05f5' + working_directory: ~/repo + steps: + - checkout + - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-packages-{{ .Branch }} + - yarn-packages-master + - yarn-packages- + - run: + name: yarn + command: yarn --frozen-lockfile install + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} + paths: + - node_modules/ + - run: > + if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then + yarn build --exclude website + else + yarn build + fi + - save_cache: + key: repo-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo + test-contracts-ganache: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn wsrun test:circleci contracts + test-contracts-geth: + docker: + - image: circleci/node:9 + - image: albrow/0x-devnet + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is + # initialized + - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts + test-publish: + docker: + - image: circleci/node:9 + - image: verdaccio/verdaccio + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn test:publish:circleci + test-rest: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn wsrun test:circleci @0xproject/abi-gen + - run: yarn wsrun test:circleci @0xproject/assert + - run: yarn wsrun test:circleci @0xproject/base-contract + - run: yarn wsrun test:circleci @0xproject/connect + - run: yarn wsrun test:circleci @0xproject/contract-wrappers + - run: yarn wsrun test:circleci @0xproject/dev-utils + - run: yarn wsrun test:circleci @0xproject/json-schemas + - run: yarn wsrun test:circleci @0xproject/metacoin + - run: yarn wsrun test:circleci @0xproject/order-utils + - run: yarn wsrun test:circleci @0xproject/order-watcher + - run: yarn wsrun test:circleci @0xproject/sol-compiler + - run: yarn wsrun test:circleci @0xproject/sol-cov + - run: yarn wsrun test:circleci @0xproject/sra-report + - run: yarn wsrun test:circleci @0xproject/subproviders + - run: yarn wsrun test:circleci @0xproject/web3-wrapper + - run: yarn wsrun test:circleci @0xproject/utils + - save_cache: + key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/abi-gen/coverage/lcov.info + - save_cache: + key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/assert/coverage/lcov.info + - save_cache: + key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/base-contract/coverage/lcov.info + - save_cache: + key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/connect/coverage/lcov.info + - save_cache: + key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/contract-wrappers/coverage/lcov.info + - save_cache: + key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/dev-utils/coverage/lcov.info + - save_cache: + key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/json-schemas/coverage/lcov.info + - save_cache: + key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/metacoin/coverage/lcov.info + - save_cache: + key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/order-utils/coverage/lcov.info + - save_cache: + key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/order-watcher/coverage/lcov.info + - save_cache: + key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sol-compiler/coverage/lcov.info + - save_cache: + key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sol-cov/coverage/lcov.info + - save_cache: + key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sra-report/coverage/lcov.info + - save_cache: + key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/subproviders/coverage/lcov.info + - save_cache: + key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/web3-wrapper/coverage/lcov.info + static-tests: + working_directory: ~/repo + docker: + - image: circleci/node:9 + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn prettier:ci + - run: yarn lerna run lint + submit-coverage: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-assert-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-connect-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-contracts-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn report_coverage workflows: - version: 2 - main: - jobs: - - build - - test-contracts-ganache: - requires: + version: 2 + main: + jobs: - build - - test-contracts-geth: - requires: - - build - - test-rest: - requires: - - build - - static-tests: - requires: - - build - - test-publish: - requires: - - build - - submit-coverage: - requires: - - test-rest + - test-contracts-ganache: + requires: + - build + - test-contracts-geth: + requires: + - build + - test-rest: + requires: + - build + - static-tests: + requires: + - build + - test-publish: + requires: + - build + - submit-coverage: + requires: + - test-rest -- cgit From 1d9408a8e04aaea35bcf517fd3332b9bcc62bba0 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 14:39:59 -0700 Subject: Fix additional merge conflicts --- .../test/calldata_optimization_utils_test.ts | 2 +- .../src/utils/doc_generate_and_upload_utils.ts | 15 +-- packages/order-utils/src/signature_utils.ts | 2 +- packages/order-utils/test/market_utils_test.ts | 3 +- packages/order-utils/test/signature_utils_test.ts | 39 +++++--- .../order-utils/test/utils/test_order_factory.ts | 3 +- yarn.lock | 104 ++++++++++++++++++--- 7 files changed, 135 insertions(+), 33 deletions(-) diff --git a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts index a4cea772f..a3abb8503 100644 --- a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts +++ b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts @@ -1,4 +1,4 @@ -import { orderFactory } from '@0xproject/order-utils'; +import { orderFactory } from '@0xproject/order-utils/lib/src/order_factory'; import * as chai from 'chai'; import * as _ from 'lodash'; import 'mocha'; 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 84fb9d20c..777d908fb 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 @@ -1,15 +1,14 @@ -import * as _ from 'lodash'; - -import { constants } from '../constants'; -import { utils } from './utils'; - import { readFileSync, writeFileSync } from 'fs'; +import * as _ from 'lodash'; import * as path from 'path'; import { exec as execAsync } from 'promisify-child-process'; import * as ts from 'typescript'; +import { constants } from '../constants'; import { ExportPathToExportedItems } from '../types'; +import { utils } from './utils'; + interface ExportInfo { exportPathToExportedItems: ExportPathToExportedItems; exportPathOrder: string[]; @@ -83,8 +82,8 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: } if (!_.startsWith(innerExportPath, './')) { throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is - itself exported from an external package. To fix this, export the external dependency directly, + `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is + itself exported from an external package. To fix this, export the external dependency directly, not indirectly through ${innerExportPath}.`, ); } else { @@ -192,6 +191,8 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // Remove the generated docs directory await execAsync(`rm -rf ${jsonFilePath}`, { cwd, + }); +} function getAllReferenceNames(propertyName: string, node: any, referenceNames: string[]): string[] { let updatedReferenceNames = referenceNames; diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index d466bb00d..40bbcef98 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -49,7 +49,7 @@ export const signatureUtils = { case SignatureType.EthSign: { const ecSignature = signatureUtils.parseECSignature(signature); - const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, SignerType.EthSign); + const prefixedMessageHex = signatureUtils.addSignedMessagePrefix(data, SignerType.Default); return signatureUtils.isValidECSignature(prefixedMessageHex, ecSignature, signerAddress); } diff --git a/packages/order-utils/test/market_utils_test.ts b/packages/order-utils/test/market_utils_test.ts index 21c0a4802..5d94cc55c 100644 --- a/packages/order-utils/test/market_utils_test.ts +++ b/packages/order-utils/test/market_utils_test.ts @@ -2,7 +2,8 @@ import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; -import { constants, marketUtils } from '../src'; +import { marketUtils } from '../src'; +import { constants } from '../src/constants'; import { chaiSetup } from './utils/chai_setup'; import { testOrderFactory } from './utils/test_order_factory'; diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts index 06ff86515..4ce99a1c7 100644 --- a/packages/order-utils/test/signature_utils_test.ts +++ b/packages/order-utils/test/signature_utils_test.ts @@ -6,8 +6,8 @@ import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { signatureUtils, generatePseudoRandomSalt } from '../src'; -import { convertECSignatureToSignatureHex, isValidSignatureAsync } from '../src/signature_utils'; +import { generatePseudoRandomSalt } from '../src'; +import { signatureUtils } from '../src/signature_utils'; import { chaiSetup } from './utils/chai_setup'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -16,7 +16,7 @@ chaiSetup.configure(); const expect = chai.expect; describe('Signature utils', () => { - describe('#isValidSignature', () => { + describe('#isValidSignatureAsync', () => { let dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0'; const ethSignSignature = '0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403'; @@ -255,7 +255,12 @@ describe('Signature utils', () => { SignerType.Default, ); - const isValidSignature = await isValidSignatureAsync(provider, orderHash, ecSignature, makerAddress); + const isValidSignature = await signatureUtils.isValidSignatureAsync( + provider, + orderHash, + ecSignature, + makerAddress, + ); expect(isValidSignature).to.be.true(); }); }); @@ -268,32 +273,44 @@ describe('Signature utils', () => { it('should concatenate v,r,s and append the Trezor signature type', async () => { const expectedSignatureWithSignatureType = '0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf208'; - const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Trezor); + const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex( + ecSignature, + SignerType.Trezor, + ); expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType); }); it('should concatenate v,r,s and append the EthSign signature type when SignerType is Default', async () => { const expectedSignatureWithSignatureType = '0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203'; - const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Default); + const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex( + ecSignature, + SignerType.Default, + ); expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType); }); it('should concatenate v,r,s and append the EthSign signature type when SignerType is Ledger', async () => { const expectedSignatureWithSignatureType = '0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203'; - const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Ledger); + const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex( + ecSignature, + SignerType.Ledger, + ); expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType); }); it('should concatenate v,r,s and append the EthSign signature type when SignerType is Metamask', async () => { const expectedSignatureWithSignatureType = '0x1baca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf203'; - const signatureWithSignatureType = convertECSignatureToSignatureHex(ecSignature, SignerType.Metamask); + const signatureWithSignatureType = signatureUtils.convertECSignatureToSignatureHex( + ecSignature, + SignerType.Metamask, + ); expect(signatureWithSignatureType).to.equal(expectedSignatureWithSignatureType); }); it('should throw if the SignerType is invalid', async () => { const expectedMessage = 'Unrecognized SignerType: INVALID_SIGNER'; - expect(() => convertECSignatureToSignatureHex(ecSignature, 'INVALID_SIGNER' as SignerType)).to.throw( - expectedMessage, - ); + expect(() => + signatureUtils.convertECSignatureToSignatureHex(ecSignature, 'INVALID_SIGNER' as SignerType), + ).to.throw(expectedMessage); }); }); }); diff --git a/packages/order-utils/test/utils/test_order_factory.ts b/packages/order-utils/test/utils/test_order_factory.ts index 75dc6f1f2..69184f129 100644 --- a/packages/order-utils/test/utils/test_order_factory.ts +++ b/packages/order-utils/test/utils/test_order_factory.ts @@ -1,7 +1,8 @@ import { Order, SignedOrder } from '@0xproject/types'; import * as _ from 'lodash'; -import { constants, orderFactory } from '../../src'; +import { constants } from '../../src/constants'; +import { orderFactory } from '../../src/order_factory'; const BASE_TEST_ORDER: Order = orderFactory.createOrder( constants.NULL_ADDRESS, diff --git a/yarn.lock b/yarn.lock index 50a5ef161..6fafdb83f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -690,6 +690,27 @@ ethers "3.0.22" lodash "4.17.10" +"@0xproject/react-shared@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@0xproject/react-shared/-/react-shared-0.2.3.tgz#f0403b9b7f1cfbe2853b53cc983ebb13ee8753a5" + dependencies: + "@types/lodash" "4.14.104" + "@types/material-ui" "0.18.0" + "@types/node" "9.6.0" + "@types/react" "16.3.13" + "@types/react-dom" "16.0.4" + "@types/react-scroll" "0.0.31" + basscss "8.0.4" + is-mobile "0.2.2" + lodash "4.17.10" + material-ui "0.17.4" + react "15.6.1" + react-dom "15.6.1" + react-highlight "0xproject/react-highlight" + react-markdown "3.2.2" + react-scroll "1.7.7" + react-tap-event-plugin "2.0.1" + "@0xproject/sol-compiler@^0.5.3", "@0xproject/sol-compiler@^0.5.4": version "0.5.4" resolved "https://registry.yarnpkg.com/@0xproject/sol-compiler/-/sol-compiler-0.5.4.tgz#3e0b04b0c02c5ec046ebb962b5ed20978c6b4cdd" @@ -1101,6 +1122,13 @@ "@types/node" "*" "@types/react" "*" +"@types/react-dom@16.0.4": + version "16.0.4" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.4.tgz#2e8fd45f5443780ed49bf2cdd9809e6091177a7d" + dependencies: + "@types/node" "*" + "@types/react" "*" + "@types/react-dom@^16.0.3": version "16.0.5" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.5.tgz#a757457662e3819409229e8f86795ff37b371f96" @@ -1136,6 +1164,12 @@ "@types/history" "*" "@types/react" "*" +"@types/react-scroll@0.0.31": + version "0.0.31" + resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-0.0.31.tgz#1bb26bfd9f595da6403c2f13c2f9a3ed4d2929fa" + dependencies: + "@types/react" "*" + "@types/react-scroll@1.5.3": version "1.5.3" resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-1.5.3.tgz#cc4e94db3d7d5b1cd244bfee24091c335d3e2598" @@ -2454,7 +2488,7 @@ basscss-typography@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/basscss-typography/-/basscss-typography-3.0.4.tgz#ec946a2bad8dd1af97be9ea108ad4bb7be932464" -basscss@^8.0.3: +basscss@8.0.4, basscss@^8.0.3: version "8.0.4" resolved "https://registry.yarnpkg.com/basscss/-/basscss-8.0.4.tgz#b371a2ce25aeb9b322302f37f4e425753dd29ae1" dependencies: @@ -5952,7 +5986,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "0.6.0" + ethereumjs-wallet "~0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" @@ -6850,12 +6884,6 @@ icss-replace-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" -icss-utils@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-2.1.0.tgz#83f0a0ec378bf3246178b6c2ad9136f135b1c962" - dependencies: - postcss "^6.0.1" - ieee754@1.1.8: version "1.1.8" resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" @@ -7274,7 +7302,7 @@ is-installed-globally@^0.1.0: global-dirs "^0.1.0" is-path-inside "^1.0.0" -is-mobile@^0.2.2: +is-mobile@0.2.2, is-mobile@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/is-mobile/-/is-mobile-0.2.2.tgz#0e2e006d99ed2c2155b761df80f2a3619ae2ad9f" @@ -8559,11 +8587,11 @@ marked@0.3.18: version "0.3.18" resolved "https://registry.npmjs.org/marked/-/marked-0.3.18.tgz#3ef058cd926101849b92a7a7c15db18c7fc76b2f" -marked@^0.3.12, marked@^0.3.5: +marked@^0.3.12: version "0.3.19" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790" -material-ui@^0.17.1: +material-ui@0.17.4, material-ui@^0.17.1: version "0.17.4" resolved "https://registry.yarnpkg.com/material-ui/-/material-ui-0.17.4.tgz#193999ecb49c3ec15ae0abb4e90fdf9a7bd343e0" dependencies: @@ -9848,6 +9876,17 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" +parse-entities@^1.0.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.2.tgz#9eaf719b29dc3bd62246b4332009072e01527777" + dependencies: + character-entities "^1.0.0" + character-entities-legacy "^1.0.0" + character-reference-invalid "^1.0.0" + is-alphanumerical "^1.0.0" + is-decimal "^1.0.0" + is-hexadecimal "^1.0.0" + parse-entities@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.1.tgz#8112d88471319f27abae4d64964b122fe4e1b890" @@ -11058,6 +11097,13 @@ react-scroll@0xproject/react-scroll#similar-to-pr-330: lodash.throttle "^4.1.1" prop-types "^15.5.8" +react-scroll@1.7.7: + version "1.7.7" + resolved "https://registry.yarnpkg.com/react-scroll/-/react-scroll-1.7.7.tgz#948c40c9a189b62bf4a53ee0fd50e5d89d37260a" + dependencies: + lodash.throttle "^4.1.1" + prop-types "^15.5.8" + react-side-effect@^1.0.2, react-side-effect@^1.1.0: version "1.1.5" resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-1.1.5.tgz#f26059e50ed9c626d91d661b9f3c8bb38cd0ff2d" @@ -11460,6 +11506,26 @@ regjsparser@^0.1.4: dependencies: jsesc "~0.5.0" +remark-parse@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-4.0.0.tgz#99f1f049afac80382366e2e0d0bd55429dd45d8b" + dependencies: + collapse-white-space "^1.0.2" + is-alphabetical "^1.0.0" + is-decimal "^1.0.0" + is-whitespace-character "^1.0.0" + is-word-character "^1.0.0" + markdown-escapes "^1.0.0" + parse-entities "^1.0.2" + repeat-string "^1.5.4" + state-toggle "^1.0.0" + trim "0.0.1" + trim-trailing-lines "^1.0.0" + unherit "^1.0.4" + unist-util-remove-position "^1.0.0" + vfile-location "^2.0.0" + xtend "^4.0.1" + remark-parse@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" @@ -13723,6 +13789,10 @@ unist-util-is@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-2.1.1.tgz#0c312629e3f960c66e931e812d3d80e77010947b" +unist-util-is@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-2.1.2.tgz#1193fa8f2bfbbb82150633f3a8d2eb9a1c1d55db" + unist-util-remove-position@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz#5a85c1555fc1ba0c101b86707d15e50fa4c871bb" @@ -13733,12 +13803,24 @@ unist-util-stringify-position@^1.0.0, unist-util-stringify-position@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz#3ccbdc53679eed6ecf3777dd7f5e3229c1b6aa3c" +unist-util-visit-parents@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz#63fffc8929027bee04bfef7d2cce474f71cb6217" + dependencies: + unist-util-is "^2.1.2" + unist-util-visit@^1.1.0, unist-util-visit@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.3.0.tgz#41ca7c82981fd1ce6c762aac397fc24e35711444" dependencies: unist-util-is "^2.1.1" +unist-util-visit@^1.1.3: + version "1.4.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.4.0.tgz#1cb763647186dc26f5e1df5db6bd1e48b3cc2fb1" + dependencies: + unist-util-visit-parents "^2.0.0" + universalify@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" -- cgit From 8bebffb14775234d5cc8dd730ba6d55ebfa941c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 16:25:37 -0700 Subject: Flesh out 0x.js index.ts and added some exports to other index.ts in the process --- packages/0x.js/src/index.ts | 46 +++++++++++++++++++++++++++++++-- packages/contract-wrappers/src/index.ts | 1 + packages/ethereum-types/src/index.ts | 8 +++--- packages/sol-compiler/src/index.ts | 2 ++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index bb93b86ea..a26d827d7 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -46,18 +46,24 @@ export { ExchangeCancelEventArgs, ExchangeEventArgs, ExchangeEvents, + ContractEvents, } from '@0xproject/contract-wrappers'; +export { ContractWrapper } from '@0xproject/contract-wrappers/lib/src/contract_wrappers/contract_wrapper'; + +export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; + export { Web3ProviderEngine, RPCSubprovider, Callback, JSONRPCRequestPayloadWithMethod, ErrorCallback, - Subprovider, } from '@0xproject/subproviders'; -export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; +export { Web3Wrapper, NodeType } from '@0xproject/web3-wrapper'; + +export { AbiDecoder } from '@0xproject/utils'; export { BigNumber } from '@0xproject/utils'; @@ -74,10 +80,22 @@ export { Token, ERC20AssetData, ERC721AssetData, + SignatureType, + OrderRelevantState, } from '@0xproject/types'; +export { + ContractArtifact, + GeneratedCompilerOptions, + ContractNetworks, + ContractVersionData, + ContractNetworkData, + Source, +} from '@0xproject/sol-compiler'; + export { BlockParamLiteral, + ContractAbi, FilterObject, BlockParam, LogWithDecodedArgs, @@ -95,4 +113,28 @@ export { LogEntryEvent, DecodedLogEntry, DecodedLogEntryEvent, + RawLog, + AbiDefinition, + TxData, + CallData, + BlockWithoutTransactionData, + BlockWithTransactionData, + Transaction, + TraceParams, + TransactionTrace, + AbstractBlock, + CallTxDataBase, + StructLog, + TxDataPayable, + FunctionAbi, + EventAbi, + EventParameter, + OpCode, + MethodAbi, + ConstructorAbi, + FallbackAbi, + DataItem, + ConstructorStateMutability, + StateMutability, + AbiType, } from 'ethereum-types'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 41d60f05a..647636cb0 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -25,6 +25,7 @@ export { OnOrderStateChangeCallback, OrderStatus, OrderInfo, + ContractEvents, } from './types'; export { diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index f4d445e3b..b2af028fb 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -20,7 +20,7 @@ export type ConstructorStateMutability = 'nonpayable' | 'payable'; export type StateMutability = 'pure' | 'view' | ConstructorStateMutability; export interface MethodAbi { - type: AbiType.Function; + type: 'function'; name: string; inputs: DataItem[]; outputs: DataItem[]; @@ -30,14 +30,14 @@ export interface MethodAbi { } export interface ConstructorAbi { - type: AbiType.Constructor; + type: 'constructor'; inputs: DataItem[]; payable: boolean; stateMutability: ConstructorStateMutability; } export interface FallbackAbi { - type: AbiType.Fallback; + type: 'fallback'; payable: boolean; } @@ -46,7 +46,7 @@ export interface EventParameter extends DataItem { } export interface EventAbi { - type: AbiType.Event; + type: 'event'; name: string; inputs: EventParameter[]; anonymous: boolean; diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 89d529887..fe72a37d6 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -6,4 +6,6 @@ export { ContractNetworks, GeneratedCompilerOptions, ContractNetworkData, + ContractVersionData, + Source, } from './utils/types'; -- cgit From 04e00e0c2849951b352692a8d8327160dc7475f8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 16:34:21 -0700 Subject: Improve missing type detection --- .../src/utils/doc_generate_and_upload_utils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 777d908fb..dfaaf1c07 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 @@ -22,6 +22,10 @@ interface ExportNameToTypedocNames { const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { BigNumber: 'http://mikemcl.github.io/bignumber.js', Error: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L134', + Buffer: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L262', + 'solc.StandardContractOutput': + 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', + 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', }; export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { @@ -159,9 +163,9 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); if (!_.isEmpty(missingReferences)) { throw new Error( - `${packageName} package needs to export ${missingReferences.join( - ', ', - )} from it's index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, + `${packageName} package needs to export: \n${missingReferences.join( + '\n', + )} \nFrom it\'s index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, ); } @@ -201,7 +205,7 @@ function getAllReferenceNames(propertyName: string, node: any, referenceNames: s } // Some nodes of type reference are for subtypes, which we don't want to return. // We therefore filter them out. - const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites']; + const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites', 'extendedTypes']; if ( !_.isUndefined(node.type) && _.isString(node.type) && -- cgit From 19e17ba12859a9cc94ce480fc6b29e28c711321e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 16:34:48 -0700 Subject: Add ability to hide specific class constructors --- .../src/utils/doc_generate_and_upload_utils.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 dfaaf1c07..187358421 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 @@ -28,6 +28,16 @@ const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', }; +const CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[] = [ + 'ERC20ProxyWrapper', + 'ERC20TokenWrapper', + 'ERC721ProxyWrapper', + 'ERC721TokenWrapper', + 'EtherTokenWrapper', + 'ExchangeWrapper', + 'ForwarderWrapper', +]; + export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const pkg = _.find(monorepoPackages, monorepoPackage => { @@ -146,6 +156,17 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: if (!_.includes(exportItems, child.name)) { delete finalTypeDocOutput.children[i].children[j]; } + if (child.kindString === 'Class' && _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name)) { + const classChildren = typedocOutput.children[i].children[j].children; + _.each(classChildren, (classChild, k) => { + if (classChild.kindString === 'Constructor') { + delete finalTypeDocOutput.children[i].children[j].children[k]; + finalTypeDocOutput.children[i].children[j].children = _.compact( + finalTypeDocOutput.children[i].children[j].children, + ); + } + }); + } }); finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); }); -- cgit From 267078ed6cea11aa8accc2336898694b77e8f169 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 17:23:36 -0700 Subject: Remove duplicate Typescript import --- packages/monorepo-scripts/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index c8c74ebd2..a5b03ac80 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -64,8 +64,7 @@ "semver": "5.5.0", "semver-diff": "^2.1.0", "semver-sort": "0.0.4", - "typedoc": "0xProject/typedoc", - "typescript": "2.7.1" + "typedoc": "0xProject/typedoc" }, "publishConfig": { "access": "public" -- cgit From cb5d8d75bf03910d1e763eb34907ada296ed3062 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 17:24:48 -0700 Subject: Link class reference types exported in same package to their declaration --- .../react-docs/src/components/documentation.tsx | 3 +- .../react-docs/src/components/event_definition.tsx | 7 +- packages/react-docs/src/components/interface.tsx | 10 +- .../react-docs/src/components/property_block.tsx | 3 +- packages/react-docs/src/components/signature.tsx | 22 +++- .../react-docs/src/components/signature_block.tsx | 1 + packages/react-docs/src/components/type.tsx | 31 ++++-- .../react-docs/src/components/type_definition.tsx | 7 +- packages/react-docs/src/types.ts | 1 + packages/react-docs/src/utils/typedoc_utils.ts | 122 ++++++++++++++++----- 10 files changed, 163 insertions(+), 44 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index f4f1d2aa9..82e444018 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -30,8 +30,8 @@ import { import { Badge } from './badge'; import { Comment } from './comment'; import { EventDefinition } from './event_definition'; -import { SignatureBlock } from './signature_block'; import { PropertyBlock } from './property_block'; +import { SignatureBlock } from './signature_block'; import { TypeDefinition } from './type_definition'; const networkNameToColor: { [network: string]: string } = { @@ -225,6 +225,7 @@ export class Documentation extends React.Component ); }); diff --git a/packages/react-docs/src/components/event_definition.tsx b/packages/react-docs/src/components/event_definition.tsx index b4dc729a9..6cb80c6b0 100644 --- a/packages/react-docs/src/components/event_definition.tsx +++ b/packages/react-docs/src/components/event_definition.tsx @@ -53,7 +53,12 @@ export class EventDefinition extends React.Component indexed; const eventArgs = _.map(this.props.event.eventArgs, (eventArg: EventArg) => { const type = ( - + ); return ( diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index eaf57ce93..93b10e96d 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -7,14 +7,17 @@ import { CustomType, TypeDefinitionByName } from '../types'; import { Signature } from './signature'; import { Type } from './type'; +const defaultProps = {}; + export interface InterfaceProps { type: CustomType; sectionName: string; docsInfo: DocsInfo; typeDefinitionByName: TypeDefinitionByName; + isInPopover: boolean; } -export const Interface = (props: InterfaceProps) => { +export const Interface: React.SFC = (props: InterfaceProps): any => { const type = props.type; const properties = _.map(type.children, property => { return ( @@ -31,6 +34,7 @@ export const Interface = (props: InterfaceProps) => { shouldUseArrowSyntax={true} docsInfo={props.docsInfo} typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> ) : ( { sectionName={props.sectionName} docsInfo={props.docsInfo} typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> )}, @@ -54,6 +59,7 @@ export const Interface = (props: InterfaceProps) => { sectionName={props.sectionName} docsInfo={props.docsInfo} typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> ); @@ -77,3 +83,5 @@ export const Interface = (props: InterfaceProps) => { ); }; + +Interface.defaultProps = defaultProps; diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index 6e5c451be..f181e21d2 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -6,8 +6,8 @@ import { Property, TypeDefinitionByName } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; -import { Type } from './type'; import { SourceLink } from './source_link'; +import { Type } from './type'; export interface PropertyBlockProps { property: Property; @@ -56,6 +56,7 @@ export class PropertyBlock extends React.Component {property.source && ( diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index d9567c9f6..bf9c8be24 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -17,6 +17,7 @@ export interface SignatureProps { typeParameter?: TypeParameter; callPath?: string; docsInfo: DocsInfo; + isInPopover: boolean; } const defaultProps = { @@ -27,7 +28,13 @@ const defaultProps = { export const Signature: React.SFC = (props: SignatureProps) => { const sectionName = props.sectionName; - const parameters = renderParameters(props.parameters, props.docsInfo, sectionName, props.typeDefinitionByName); + const parameters = renderParameters( + props.parameters, + props.docsInfo, + sectionName, + props.isInPopover, + props.typeDefinitionByName, + ); const paramStringArray: any[] = []; // HACK: For now we don't put params on newlines if there are less then 2 of them. // Ideally we would check the character length of the resulting method signature and @@ -57,7 +64,13 @@ export const Signature: React.SFC = (props: SignatureProps) => { const methodName = props.shouldHideMethodName ? '' : props.name; const typeParameterIfExists = _.isUndefined(props.typeParameter) ? undefined - : renderTypeParameter(props.typeParameter, props.docsInfo, sectionName, props.typeDefinitionByName); + : renderTypeParameter( + props.typeParameter, + props.docsInfo, + sectionName, + props.isInPopover, + props.typeDefinitionByName, + ); return ( {props.callPath} @@ -72,6 +85,7 @@ export const Signature: React.SFC = (props: SignatureProps) => { sectionName={sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} + isInPopover={props.isInPopover} /> )} @@ -85,6 +99,7 @@ function renderParameters( parameters: Parameter[], docsInfo: DocsInfo, sectionName: string, + isInPopover: boolean, typeDefinitionByName?: TypeDefinitionByName, ): React.ReactNode[] { const params = _.map(parameters, (p: Parameter) => { @@ -96,6 +111,7 @@ function renderParameters( sectionName={sectionName} typeDefinitionByName={typeDefinitionByName} docsInfo={docsInfo} + isInPopover={isInPopover} /> ); return ( @@ -113,6 +129,7 @@ function renderTypeParameter( typeParameter: TypeParameter, docsInfo: DocsInfo, sectionName: string, + isInPopover: boolean, typeDefinitionByName?: TypeDefinitionByName, ): React.ReactNode { const typeParam = ( @@ -123,6 +140,7 @@ function renderTypeParameter( sectionName={sectionName} typeDefinitionByName={typeDefinitionByName} docsInfo={docsInfo} + isInPopover={isInPopover} /> {`>`} diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 9e5198e16..934232efe 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -81,6 +81,7 @@ export class SignatureBlock extends React.Component {(method as TypescriptMethod).source && ( diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 1c580caab..eae52e950 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -7,23 +7,26 @@ import * as ReactTooltip from 'react-tooltip'; import { DocsInfo } from '../docs_info'; import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types'; +import { constants } from '../utils/constants'; import { Signature } from './signature'; -import { constants } from '../utils/constants'; import { TypeDefinition } from './type_definition'; const basicJsTypes = ['string', 'number', 'undefined', 'null', 'boolean']; +const defaultProps = {}; + export interface TypeProps { type: TypeDef; docsInfo: DocsInfo; sectionName: string; typeDefinitionByName?: TypeDefinitionByName; + isInPopover: boolean; } // The return type needs to be `any` here so that we can recursively define components within // components (e.g when rendering the union type). -export function Type(props: TypeProps): any { +export const Type: React.SFC = (props: TypeProps): any => { const type = props.type; const isReference = type.typeDocType === TypeDocTypes.Reference; const isArray = type.typeDocType === TypeDocTypes.Array; @@ -50,6 +53,7 @@ export function Type(props: TypeProps): any { sectionName={props.sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} + isInPopover={props.isInPopover} />[] ); @@ -61,6 +65,7 @@ export function Type(props: TypeProps): any { sectionName={props.sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} + isInPopover={props.isInPopover} /> ); return subType; @@ -89,6 +94,7 @@ export function Type(props: TypeProps): any { sectionName={props.sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} + isInPopover={props.isInPopover} /> ); }); @@ -110,6 +116,7 @@ export function Type(props: TypeProps): any { shouldUseArrowSyntax={true} docsInfo={props.docsInfo} typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> ); } else if (!_.isUndefined(type.indexSignature)) { @@ -122,6 +129,7 @@ export function Type(props: TypeProps): any { sectionName={props.sectionName} docsInfo={props.docsInfo} typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> ); @@ -150,6 +158,7 @@ export function Type(props: TypeProps): any { sectionName={props.sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} + isInPopover={props.isInPopover} /> ); }); @@ -180,6 +189,7 @@ export function Type(props: TypeProps): any { ? props.docsInfo.typeConfigs.typeNameToPrefix[typeName as string] : undefined; } + const isExportedClassReference = !!props.type.isExportedClassReference; if (!_.isUndefined(typeNameUrlIfExists)) { typeName = ( - {sharedUtils.isUserOnMobile() ? ( + {sharedUtils.isUserOnMobile() || props.isInPopover || isExportedClassReference ? ( {typeName} ) : ( @@ -248,4 +259,6 @@ export function Type(props: TypeProps): any { )} ); -} +}; + +Type.defaultProps = defaultProps; diff --git a/packages/react-docs/src/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx index 775d9890f..8d1f88490 100644 --- a/packages/react-docs/src/components/type_definition.tsx +++ b/packages/react-docs/src/components/type_definition.tsx @@ -4,7 +4,7 @@ import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType, CustomTypeChild, KindString, TypeDocTypes, TypeDefinitionByName } from '../types'; +import { CustomType, CustomTypeChild, KindString, TypeDefinitionByName, TypeDocTypes } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; @@ -20,6 +20,7 @@ export interface TypeDefinitionProps { shouldAddId?: boolean; docsInfo: DocsInfo; typeDefinitionByName?: TypeDefinitionByName; + isInPopover?: boolean; } export interface TypeDefinitionState { @@ -29,6 +30,7 @@ export interface TypeDefinitionState { export class TypeDefinition extends React.Component { public static defaultProps: Partial = { shouldAddId: true, + isInPopover: false, }; constructor(props: TypeDefinitionProps) { super(props); @@ -50,6 +52,7 @@ export class TypeDefinition extends React.Component ); break; @@ -81,6 +84,7 @@ export class TypeDefinition extends React.Component ) : ( )} diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 18c386a2b..c39dfcba8 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -154,6 +154,7 @@ export interface Type { name: string; typeDocType: TypeDocTypes; value?: string; + isExportedClassReference?: boolean; typeArguments?: Type[]; elementType?: ElementType; types?: Type[]; diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index b45dc73a8..ab5408ec2 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -7,6 +7,7 @@ import { CustomTypeChild, DocAgnosticFormat, DocSection, + GeneratedDocJson, IndexSignature, KindString, Parameter, @@ -19,7 +20,6 @@ import { TypeParameter, TypescriptFunction, TypescriptMethod, - GeneratedDocJson, } from '../types'; import { constants } from './constants'; @@ -72,6 +72,15 @@ export const typeDocUtils = { ), ); + const classNames: string[] = []; + _.each(typeDocJson.children, file => { + _.each(file.children, child => { + if (child.kindString === KindString.Class) { + classNames.push(child.name); + } + }); + }); + const docAgnosticFormat: DocAgnosticFormat = {}; const typeEntities: TypeDocNode[] = []; _.each(typeDocNameOrder, typeDocName => { @@ -93,6 +102,7 @@ export const typeDocUtils = { entities, docsInfo, sectionName, + classNames, isClassOrObjectLiteral, ); docSection.comment = sectionComment; @@ -106,7 +116,12 @@ export const typeDocUtils = { const entities = [child]; const commentObj = child.comment; const SectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; - const docSection = typeDocUtils._convertEntitiesToDocSection(entities, docsInfo, sectionName); + const docSection = typeDocUtils._convertEntitiesToDocSection( + entities, + docsInfo, + sectionName, + classNames, + ); docSection.comment = SectionComment; docAgnosticFormat[sectionName] = docSection; break; @@ -129,6 +144,7 @@ export const typeDocUtils = { typeEntities, docsInfo, constants.TYPES_SECTION_NAME, + classNames, ); docAgnosticFormat[constants.TYPES_SECTION_NAME] = docSection; } @@ -139,6 +155,7 @@ export const typeDocUtils = { entities: TypeDocNode[], docsInfo: DocsInfo, sectionName: string, + classNames: string[], isClassOrObjectLiteral: boolean = false, ): DocSection { const docSection: DocSection = { @@ -161,6 +178,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + classNames, ); docSection.constructors.push(constructor); break; @@ -176,6 +194,7 @@ export const typeDocUtils = { sectionName, docsInfo.id, isClassOrObjectLiteral, + classNames, ); docSection.functions.push(func); } @@ -191,6 +210,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + classNames, ); docSection.methods.push(method); } @@ -203,6 +223,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + classNames, ); docSection.properties.push(property); } @@ -216,6 +237,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + classNames, ); docSection.properties.push(property); } else { @@ -225,6 +247,7 @@ export const typeDocUtils = { docsInfo.sections, sectionName, docsInfo.id, + classNames, ); const seenTypeNames = _.map(docSection.types, t => t.name); const isUnseen = !_.includes(seenTypeNames, customType.name); @@ -235,14 +258,14 @@ export const typeDocUtils = { break; case KindString.Interface: - case KindString.Variable: case KindString.Enumeration: - case KindString.TypeAlias: + case KindString.TypeAlias: { const customType = typeDocUtils._convertCustomType( entity, docsInfo.sections, sectionName, docsInfo.id, + classNames, ); const seenTypeNames = _.map(docSection.types, t => t.name); const isUnseen = !_.includes(seenTypeNames, customType.name); @@ -250,6 +273,7 @@ export const typeDocUtils = { docSection.types.push(customType); } break; + } case KindString.Class: // We currently do not support more then a single class per file @@ -263,18 +287,24 @@ export const typeDocUtils = { }); return docSection; }, - _convertCustomType(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): CustomType { + _convertCustomType( + entity: TypeDocNode, + sections: SectionsMap, + sectionName: string, + docId: string, + classNames: string[], + ): CustomType { const typeIfExists = !_.isUndefined(entity.type) - ? typeDocUtils._convertType(entity.type, sections, sectionName, docId) + ? typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames) : undefined; const isConstructor = false; const methodIfExists = !_.isUndefined(entity.declaration) - ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) + ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId, classNames) : undefined; const doesIndexSignatureExist = !_.isUndefined(entity.indexSignature); const indexSignature = entity.indexSignature as TypeDocNode; const indexSignatureIfExists = doesIndexSignatureExist - ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId) + ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId, classNames) : undefined; const commentIfExists = !_.isUndefined(entity.comment) && !_.isUndefined(entity.comment.shortText) @@ -284,13 +314,20 @@ export const typeDocUtils = { const childrenIfExist = !_.isUndefined(entity.children) ? _.map(entity.children, (child: TypeDocNode) => { let childTypeIfExists = !_.isUndefined(child.type) - ? typeDocUtils._convertType(child.type, sections, sectionName, docId) + ? typeDocUtils._convertType(child.type, sections, sectionName, docId, classNames) : undefined; if (child.kindString === KindString.Method) { childTypeIfExists = { name: child.name, typeDocType: TypeDocTypes.Reflection, - method: typeDocUtils._convertMethod(child, isConstructor, sections, sectionName, docId), + method: typeDocUtils._convertMethod( + child, + isConstructor, + sections, + sectionName, + docId, + classNames, + ), }; } const c: CustomTypeChild = { @@ -319,16 +356,23 @@ export const typeDocUtils = { sections: SectionsMap, sectionName: string, docId: string, + classNames: string[], ): IndexSignature { const key = entity.parameters[0]; const indexSignature = { keyName: key.name, - keyType: typeDocUtils._convertType(key.type, sections, sectionName, docId), + keyType: typeDocUtils._convertType(key.type, sections, sectionName, docId, classNames), valueName: entity.type.name, }; return indexSignature; }, - _convertProperty(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): Property { + _convertProperty( + entity: TypeDocNode, + sections: SectionsMap, + sectionName: string, + docId: string, + classNames: string[], + ): Property { const source = entity.sources[0]; const commentIfExists = !_.isUndefined(entity.comment) ? entity.comment.shortText : undefined; const isConstructor = false; @@ -336,7 +380,7 @@ export const typeDocUtils = { const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); const property = { name: entity.name, - type: typeDocUtils._convertType(entity.type, sections, sectionName, docId), + type: typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames), source: { fileName: source.fileName, line: source.line, @@ -352,6 +396,7 @@ export const typeDocUtils = { sections: SectionsMap, sectionName: string, docId: string, + classNames: string[], ): TypescriptMethod { const signature = entity.signatures[0]; const source = entity.sources[0]; @@ -359,12 +404,12 @@ export const typeDocUtils = { const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; const parameters = _.map(signature.parameters, param => { - return typeDocUtils._convertParameter(param, sections, sectionName, docId); + return typeDocUtils._convertParameter(param, sections, sectionName, docId, classNames); }); - const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId); + const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId, classNames); const typeParameter = _.isUndefined(signature.typeParameter) ? undefined - : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId); + : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId, classNames); const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); const method = { @@ -384,13 +429,12 @@ export const typeDocUtils = { }; return method; }, - _getCallPath(sectionName: string, isStatic: boolean, isConstructor: boolean, entityName: string) { + _getCallPath(sectionName: string, isStatic: boolean, isConstructor: boolean, entityName: string): string { // HACK: we use the fact that the sectionName is the same as the property name at the top-level // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. let callPath; if (isConstructor || entityName === '__type') { callPath = ''; - // TODO: Get rid of this 0x-specific logic } else { const prefix = isStatic ? sectionName : `${sectionName[0].toLowerCase()}${sectionName.slice(1)}`; callPath = `${prefix}.`; @@ -403,18 +447,19 @@ export const typeDocUtils = { sectionName: string, docId: string, isObjectLiteral: boolean, + classNames: string[], ): TypescriptFunction { const signature = entity.signatures[0]; const source = entity.sources[0]; const hasComment = !_.isUndefined(signature.comment); const parameters = _.map(signature.parameters, param => { - return typeDocUtils._convertParameter(param, sections, sectionName, docId); + return typeDocUtils._convertParameter(param, sections, sectionName, docId, classNames); }); - const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId); + const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId, classNames); const typeParameter = _.isUndefined(signature.typeParameter) ? undefined - : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId); + : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId, classNames); let callPath = ''; if (isObjectLiteral) { @@ -442,15 +487,22 @@ export const typeDocUtils = { sections: SectionsMap, sectionName: string, docId: string, + classNames: string[], ): TypeParameter { - const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId); + const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames); const parameter = { name: entity.name, type, }; return parameter; }, - _convertParameter(entity: TypeDocNode, sections: SectionsMap, sectionName: string, docId: string): Parameter { + _convertParameter( + entity: TypeDocNode, + sections: SectionsMap, + sectionName: string, + docId: string, + classNames: string[], + ): Parameter { let comment = ''; if (entity.comment && entity.comment.shortText) { comment = entity.comment.shortText; @@ -460,7 +512,7 @@ export const typeDocUtils = { const isOptional = !_.isUndefined(entity.flags.isOptional) ? entity.flags.isOptional : false; - const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId); + const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames); const parameter = { name: entity.name, @@ -471,12 +523,18 @@ export const typeDocUtils = { }; return parameter; }, - _convertType(entity: TypeDocType, sections: SectionsMap, sectionName: string, docId: string): Type { + _convertType( + entity: TypeDocType, + sections: SectionsMap, + sectionName: string, + docId: string, + classNames: string[], + ): Type { const typeArguments = _.map(entity.typeArguments, typeArgument => { - return typeDocUtils._convertType(typeArgument, sections, sectionName, docId); + return typeDocUtils._convertType(typeArgument, sections, sectionName, docId, classNames); }); const types = _.map(entity.types, t => { - return typeDocUtils._convertType(t, sections, sectionName, docId); + return typeDocUtils._convertType(t, sections, sectionName, docId, classNames); }); let indexSignatureIfExists; @@ -485,7 +543,13 @@ export const typeDocUtils = { !_.isUndefined(entity.declaration) && !_.isUndefined(entity.declaration.indexSignature); if (doesIndexSignatureExist) { const indexSignature = entity.declaration.indexSignature as TypeDocNode; - indexSignatureIfExists = typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId); + indexSignatureIfExists = typeDocUtils._convertIndexSignature( + indexSignature, + sections, + sectionName, + docId, + classNames, + ); } else if (!_.isUndefined(entity.declaration)) { const isConstructor = false; methodIfExists = typeDocUtils._convertMethod( @@ -494,6 +558,7 @@ export const typeDocUtils = { sections, sectionName, docId, + classNames, ); } @@ -507,6 +572,7 @@ export const typeDocUtils = { const type = { name: entity.name, value: entity.value, + isExportedClassReference: _.includes(classNames, entity.name), typeDocType: entity.type, typeArguments, elementType: elementTypeIfExists, -- cgit From 83e3bb899ed88c8ac32331d2f1b533e52d5ad8cd Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 14 Aug 2018 17:41:03 -0700 Subject: Move purging private underscored items to the doc json generation phase --- packages/0x.js/src/index.ts | 2 -- .../src/utils/doc_generate_and_upload_utils.ts | 31 +++++++++++++--------- .../react-docs/src/components/signature_block.tsx | 3 --- packages/react-docs/src/utils/typedoc_utils.ts | 21 ++++++--------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index a26d827d7..d8ad6a969 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -61,8 +61,6 @@ export { ErrorCallback, } from '@0xproject/subproviders'; -export { Web3Wrapper, NodeType } from '@0xproject/web3-wrapper'; - export { AbiDecoder } from '@0xproject/utils'; export { BigNumber } from '@0xproject/utils'; 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 187358421..2bc5441fc 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 @@ -143,7 +143,10 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: } }); - // For each entry, see if it was exported in index.ts. If not, remove it. + // For each entry, remove it if: + // - it was not exported in index.ts + // - the constructor is to be ignored + // - it begins with an underscore const exportPathToTypedocNames: ExportNameToTypedocNames = {}; _.each(typedocOutput.children, (file, i) => { const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); @@ -155,18 +158,22 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: _.each(file.children, (child, j) => { if (!_.includes(exportItems, child.name)) { delete finalTypeDocOutput.children[i].children[j]; + return; } - if (child.kindString === 'Class' && _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name)) { - const classChildren = typedocOutput.children[i].children[j].children; - _.each(classChildren, (classChild, k) => { - if (classChild.kindString === 'Constructor') { - delete finalTypeDocOutput.children[i].children[j].children[k]; - finalTypeDocOutput.children[i].children[j].children = _.compact( - finalTypeDocOutput.children[i].children[j].children, - ); - } - }); - } + const innerChildren = typedocOutput.children[i].children[j].children; + _.each(innerChildren, (innerChild, k) => { + const isHiddenConstructor = + child.kindString === 'Class' && + _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && + innerChild.kindString === 'Constructor'; + const isPrivate = _.startsWith(innerChild.name, '_'); + if (isHiddenConstructor || isPrivate) { + delete finalTypeDocOutput.children[i].children[j].children[k]; + finalTypeDocOutput.children[i].children[j].children = _.compact( + finalTypeDocOutput.children[i].children[j].children, + ); + } + }); }); finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); }); diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 934232efe..2818d9c5f 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -44,9 +44,6 @@ export class SignatureBlock extends React.Component Date: Tue, 14 Aug 2018 17:55:38 -0700 Subject: Add version to our custom DocJson format --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 2bc5441fc..d791b010f 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 @@ -18,7 +18,8 @@ interface ExportNameToTypedocNames { [exportName: string]: string[]; } -// TODO: Add the EXTERNAL_TYPE_TO_LINK mapping to the Doc JSON +const DOC_JSON_VERSION = '0.0.1'; + const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { BigNumber: 'http://mikemcl.github.io/bignumber.js', Error: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L134', @@ -199,6 +200,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON const docJson = { + version: DOC_JSON_VERSION, metadata: { exportPathToTypedocNames, exportPathOrder, -- cgit From a8d44ccc48a7177e749f534a237afb7b9c0f2f2b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Aug 2018 11:36:45 -0700 Subject: Move external types to link mapping to doc generation util and refactor typedocUtils to be a class to avoid excessive param passing --- .../src/utils/doc_generate_and_upload_utils.ts | 1 + .../react-docs/src/components/signature_block.tsx | 1 - packages/react-docs/src/components/type.tsx | 12 +- packages/react-docs/src/docs_info.ts | 10 +- packages/react-docs/src/types.ts | 12 +- packages/react-docs/src/utils/typedoc_utils.ts | 351 +++++++-------------- .../website/ts/containers/connect_documentation.ts | 8 +- .../containers/contract_wrappers_documentation.ts | 6 - .../ts/containers/ethereum_types_documentation.ts | 7 +- .../ts/containers/json_schemas_documentation.ts | 8 +- .../ts/containers/order_utils_documentation.ts | 5 - .../ts/containers/order_watcher_documentation.ts | 5 - .../ts/containers/sol_compiler_documentation.ts | 6 +- .../website/ts/containers/sol_cov_documentation.ts | 6 +- .../ts/containers/subproviders_documentation.ts | 7 - .../ts/containers/web3_wrapper_documentation.ts | 7 - .../ts/containers/zero_ex_js_documentation.ts | 8 +- 17 files changed, 138 insertions(+), 322 deletions(-) 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 d791b010f..ca3df2c74 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 @@ -27,6 +27,7 @@ const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { 'solc.StandardContractOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', + Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', }; const CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[] = [ diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 2818d9c5f..05145dc23 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -5,7 +5,6 @@ import * as React from 'react'; import { DocsInfo } from '../docs_info'; import { Parameter, SolidityMethod, TypeDefinitionByName, TypescriptFunction, TypescriptMethod } from '../types'; import { constants } from '../utils/constants'; -import { typeDocUtils } from '../utils/typedoc_utils'; import { Comment } from './comment'; import { Signature } from './signature'; diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index eae52e950..145c797a3 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -179,17 +179,8 @@ export const Type: React.SFC = (props: TypeProps): any => { return [prev, ', ', curr]; }); - let typeNameUrlIfExists; - let typePrefixIfExists; - if (!_.isUndefined(props.docsInfo.typeConfigs)) { - typeNameUrlIfExists = !_.isUndefined(props.docsInfo.typeConfigs.typeNameToExternalLink) - ? props.docsInfo.typeConfigs.typeNameToExternalLink[typeName as string] - : undefined; - typePrefixIfExists = !_.isUndefined(props.docsInfo.typeConfigs.typeNameToPrefix) - ? props.docsInfo.typeConfigs.typeNameToPrefix[typeName as string] - : undefined; - } const isExportedClassReference = !!props.type.isExportedClassReference; + const typeNameUrlIfExists = !_.isUndefined(props.type.externalLink) ? props.type.externalLink : undefined; if (!_.isUndefined(typeNameUrlIfExists)) { typeName = ( = (props: TypeProps): any => { className="text-decoration-none" style={{ color: colors.lightBlueA700 }} > - {!_.isUndefined(typePrefixIfExists) ? `${typePrefixIfExists}.` : ''} {typeName} ); diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index 4267d8a98..9e990ffc5 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -6,17 +6,16 @@ import { ContractsByVersionByNetworkId, DocAgnosticFormat, DocsInfoConfig, - DocsInfoTypeConfigs, DocsMenu, DoxityDocObj, + GeneratedDocJson, SectionNameToMarkdownByVersion, SectionsMap, SupportedDocJson, TypeDefinitionByName, - GeneratedDocJson, } from './types'; import { doxityUtils } from './utils/doxity_utils'; -import { typeDocUtils } from './utils/typedoc_utils'; +import { TypeDocUtils } from './utils/typedoc_utils'; export class DocsInfo { public id: string; @@ -27,7 +26,6 @@ export class DocsInfo { public sections: SectionsMap; public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion; public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId; - public typeConfigs: DocsInfoTypeConfigs; constructor(config: DocsInfoConfig) { this.id = config.id; this.type = config.type; @@ -37,7 +35,6 @@ export class DocsInfo { this.sections = config.markdownSections; this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion; this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId; - this.typeConfigs = config.typeConfigs; } public getMenuSubsectionsBySection(docAgnosticFormat?: DocAgnosticFormat): MenuSubsectionsBySection { const menuSubsectionsBySection = {} as MenuSubsectionsBySection; @@ -101,7 +98,8 @@ export class DocsInfo { if (this.type === SupportedDocJson.Doxity) { return doxityUtils.convertToDocAgnosticFormat(docObj as DoxityDocObj); } else { - return typeDocUtils.convertToDocAgnosticFormat(docObj as GeneratedDocJson, this); + const typeDocUtils = new TypeDocUtils(docObj as GeneratedDocJson, this); + return typeDocUtils.convertToDocAgnosticFormat(); } } } diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index c39dfcba8..0155685e0 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -11,12 +11,6 @@ export interface DocsInfoConfig { markdownSections: SectionsMap; sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion; contractsByVersionByNetworkId?: ContractsByVersionByNetworkId; - typeConfigs?: DocsInfoTypeConfigs; -} - -export interface DocsInfoTypeConfigs { - typeNameToExternalLink?: { [typeName: string]: string }; - typeNameToPrefix?: { [typeName: string]: string }; } export interface DocsMenu { @@ -160,6 +154,7 @@ export interface Type { types?: Type[]; method?: TypescriptMethod; indexSignature?: IndexSignature; + externalLink?: string; } export interface ElementType { @@ -297,9 +292,14 @@ export interface ExportNameToTypedocNames { [exportName: string]: string[]; } +export interface ExternalTypeToLink { + [externalTypeName: string]: string; +} + export interface Metadata { exportPathToTypedocNames: ExportNameToTypedocNames; exportPathOrder: string[]; + externalTypeToLink: ExternalTypeToLink; } export interface GeneratedDocJson { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 9843ec9fa..db6063464 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -7,6 +7,7 @@ import { CustomTypeChild, DocAgnosticFormat, DocSection, + ExternalTypeToLink, GeneratedDocJson, IndexSignature, KindString, @@ -24,8 +25,39 @@ import { import { constants } from './constants'; -export const typeDocUtils = { - isType(entity: TypeDocNode): boolean { +export class TypeDocUtils { + private _typeDocNameOrder: string[]; + private _externalTypeToLink: ExternalTypeToLink; + private _docsInfo: DocsInfo; + private _typeDocJson: TypeDocNode; + private _classNames: string[]; + constructor(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo) { + this._docsInfo = docsInfo; + console.log('generatedDocJson.metadata', generatedDocJson.metadata); + const exportPathOrder = generatedDocJson.metadata.exportPathOrder; + const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; + this._externalTypeToLink = generatedDocJson.metadata.externalTypeToLink; + this._typeDocJson = generatedDocJson.typedocJson; + + // TODO: Extract the non typeDoc exports, and render them somehow + this._typeDocNameOrder = _.compact( + _.flatten( + _.map(exportPathOrder, exportPath => { + return exportPathToTypedocNames[exportPath]; + }), + ), + ); + + this._classNames = []; + _.each(this._typeDocJson.children, file => { + _.each(file.children, child => { + if (child.kindString === KindString.Class) { + this._classNames.push(child.name); + } + }); + }); + } + public isType(entity: TypeDocNode): boolean { return ( entity.kindString === KindString.Interface || entity.kindString === KindString.Function || @@ -33,17 +65,17 @@ export const typeDocUtils = { entity.kindString === KindString.Variable || entity.kindString === KindString.Enumeration ); - }, - isMethod(entity: TypeDocNode): boolean { + } + public isMethod(entity: TypeDocNode): boolean { return entity.kindString === KindString.Method; - }, - isConstructor(entity: TypeDocNode): boolean { + } + public isConstructor(entity: TypeDocNode): boolean { return entity.kindString === KindString.Constructor; - }, - isProperty(entity: TypeDocNode): boolean { + } + public isProperty(entity: TypeDocNode): boolean { return entity.kindString === KindString.Property; - }, - getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { + } + public getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { const moduleDefinitions: TypeDocNode[] = []; const jsonModules = versionDocObj.children; _.each(jsonModules, jsonMod => { @@ -54,52 +86,28 @@ export const typeDocUtils = { }); }); return moduleDefinitions; - }, - convertToDocAgnosticFormat(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo): DocAgnosticFormat { - const exportPathOrder = generatedDocJson.metadata.exportPathOrder; - const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; - const typeDocJson = generatedDocJson.typedocJson; - - // TODO: Extract the non typeDoc exports, and render them somehow - const typeDocNameOrder = _.compact( - _.flatten( - _.map(exportPathOrder, exportPath => { - return exportPathToTypedocNames[exportPath]; - }), - ), - ); - - const classNames: string[] = []; - _.each(typeDocJson.children, file => { - _.each(file.children, child => { - if (child.kindString === KindString.Class) { - classNames.push(child.name); - } - }); - }); - + } + public convertToDocAgnosticFormat(): DocAgnosticFormat { const docAgnosticFormat: DocAgnosticFormat = {}; const typeEntities: TypeDocNode[] = []; - _.each(typeDocNameOrder, typeDocName => { - const fileChildIndex = _.findIndex(typeDocJson.children, child => child.name === typeDocName); - const fileChild = typeDocJson.children[fileChildIndex]; + _.each(this._typeDocNameOrder, typeDocName => { + const fileChildIndex = _.findIndex(this._typeDocJson.children, child => child.name === typeDocName); + const fileChild = this._typeDocJson.children[fileChildIndex]; let sectionName: string; _.each(fileChild.children, child => { switch (child.kindString) { case KindString.Class: case KindString.ObjectLiteral: { sectionName = child.name; - docsInfo.sections[sectionName] = sectionName; - docsInfo.menu[sectionName] = [sectionName]; + this._docsInfo.sections[sectionName] = sectionName; + this._docsInfo.menu[sectionName] = [sectionName]; const entities = child.children; const commentObj = child.comment; const sectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; const isClassOrObjectLiteral = true; - const docSection = typeDocUtils._convertEntitiesToDocSection( + const docSection = this._convertEntitiesToDocSection( entities, - docsInfo, sectionName, - classNames, isClassOrObjectLiteral, ); docSection.comment = sectionComment; @@ -108,17 +116,12 @@ export const typeDocUtils = { } case KindString.Function: { sectionName = child.name; - docsInfo.sections[sectionName] = sectionName; - docsInfo.menu[sectionName] = [sectionName]; + this._docsInfo.sections[sectionName] = sectionName; + this._docsInfo.menu[sectionName] = [sectionName]; const entities = [child]; const commentObj = child.comment; const SectionComment = !_.isUndefined(commentObj) ? commentObj.shortText : ''; - const docSection = typeDocUtils._convertEntitiesToDocSection( - entities, - docsInfo, - sectionName, - classNames, - ); + const docSection = this._convertEntitiesToDocSection(entities, sectionName); docSection.comment = SectionComment; docAgnosticFormat[sectionName] = docSection; break; @@ -135,24 +138,17 @@ export const typeDocUtils = { }); }); if (!_.isEmpty(typeEntities)) { - docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; - docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; - const docSection = typeDocUtils._convertEntitiesToDocSection( - typeEntities, - docsInfo, - constants.TYPES_SECTION_NAME, - classNames, - ); + this._docsInfo.sections[constants.TYPES_SECTION_NAME] = constants.TYPES_SECTION_NAME; + this._docsInfo.menu[constants.TYPES_SECTION_NAME] = [constants.TYPES_SECTION_NAME]; + const docSection = this._convertEntitiesToDocSection(typeEntities, constants.TYPES_SECTION_NAME); docAgnosticFormat[constants.TYPES_SECTION_NAME] = docSection; } return docAgnosticFormat; - }, - _convertEntitiesToDocSection( + } + private _convertEntitiesToDocSection( entities: TypeDocNode[], - docsInfo: DocsInfo, sectionName: string, - classNames: string[], isClassOrObjectLiteral: boolean = false, ): DocSection { const docSection: DocSection = { @@ -169,14 +165,7 @@ export const typeDocUtils = { switch (entity.kindString) { case KindString.Constructor: isConstructor = true; - const constructor = typeDocUtils._convertMethod( - entity, - isConstructor, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + const constructor = this._convertMethod(entity, isConstructor, sectionName); docSection.constructors.push(constructor); break; @@ -185,14 +174,7 @@ export const typeDocUtils = { const funcName = (entity as TypeDocNode).signatures[0].name; const isPublicFunc = !_.startsWith(funcName, '_'); if (isPublicFunc) { - const func = typeDocUtils._convertFunction( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - isClassOrObjectLiteral, - classNames, - ); + const func = this._convertFunction(entity, sectionName, isClassOrObjectLiteral); docSection.functions.push(func); } } @@ -201,49 +183,25 @@ export const typeDocUtils = { case KindString.Method: if (entity.flags.isPublic) { isConstructor = false; - const method = typeDocUtils._convertMethod( - entity, - isConstructor, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + const method = this._convertMethod(entity, isConstructor, sectionName); docSection.methods.push(method); } break; - case KindString.Property: - const property = typeDocUtils._convertProperty( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + case KindString.Property: { + const property = this._convertProperty(entity, sectionName); docSection.properties.push(property); break; + } case KindString.Variable: if (isClassOrObjectLiteral) { // Render as a property - const property = typeDocUtils._convertProperty( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + const property = this._convertProperty(entity, sectionName); docSection.properties.push(property); } else { // Otherwise, render as a type - const customType = typeDocUtils._convertCustomType( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + const customType = this._convertCustomType(entity, sectionName); const seenTypeNames = _.map(docSection.types, t => t.name); const isUnseen = !_.includes(seenTypeNames, customType.name); if (isUnseen) { @@ -255,13 +213,7 @@ export const typeDocUtils = { case KindString.Interface: case KindString.Enumeration: case KindString.TypeAlias: { - const customType = typeDocUtils._convertCustomType( - entity, - docsInfo.sections, - sectionName, - docsInfo.id, - classNames, - ); + const customType = this._convertCustomType(entity, sectionName); const seenTypeNames = _.map(docSection.types, t => t.name); const isUnseen = !_.includes(seenTypeNames, customType.name); if (isUnseen) { @@ -281,25 +233,17 @@ export const typeDocUtils = { } }); return docSection; - }, - _convertCustomType( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): CustomType { - const typeIfExists = !_.isUndefined(entity.type) - ? typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames) - : undefined; + } + private _convertCustomType(entity: TypeDocNode, sectionName: string): CustomType { + const typeIfExists = !_.isUndefined(entity.type) ? this._convertType(entity.type, sectionName) : undefined; const isConstructor = false; const methodIfExists = !_.isUndefined(entity.declaration) - ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId, classNames) + ? this._convertMethod(entity.declaration, isConstructor, sectionName) : undefined; const doesIndexSignatureExist = !_.isUndefined(entity.indexSignature); const indexSignature = entity.indexSignature as TypeDocNode; const indexSignatureIfExists = doesIndexSignatureExist - ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId, classNames) + ? this._convertIndexSignature(indexSignature, sectionName) : undefined; const commentIfExists = !_.isUndefined(entity.comment) && !_.isUndefined(entity.comment.shortText) @@ -309,20 +253,13 @@ export const typeDocUtils = { const childrenIfExist = !_.isUndefined(entity.children) ? _.map(entity.children, (child: TypeDocNode) => { let childTypeIfExists = !_.isUndefined(child.type) - ? typeDocUtils._convertType(child.type, sections, sectionName, docId, classNames) + ? this._convertType(child.type, sectionName) : undefined; if (child.kindString === KindString.Method) { childTypeIfExists = { name: child.name, typeDocType: TypeDocTypes.Reflection, - method: typeDocUtils._convertMethod( - child, - isConstructor, - sections, - sectionName, - docId, - classNames, - ), + method: this._convertMethod(child, isConstructor, sectionName), }; } const c: CustomTypeChild = { @@ -345,37 +282,25 @@ export const typeDocUtils = { children: childrenIfExist, }; return customType; - }, - _convertIndexSignature( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): IndexSignature { + } + private _convertIndexSignature(entity: TypeDocNode, sectionName: string): IndexSignature { const key = entity.parameters[0]; const indexSignature = { keyName: key.name, - keyType: typeDocUtils._convertType(key.type, sections, sectionName, docId, classNames), + keyType: this._convertType(key.type, sectionName), valueName: entity.type.name, }; return indexSignature; - }, - _convertProperty( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): Property { + } + private _convertProperty(entity: TypeDocNode, sectionName: string): Property { const source = entity.sources[0]; const commentIfExists = !_.isUndefined(entity.comment) ? entity.comment.shortText : undefined; const isConstructor = false; const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; - const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); + const callPath = this._getCallPath(sectionName, isStatic, isConstructor, entity.name); const property = { name: entity.name, - type: typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames), + type: this._convertType(entity.type, sectionName), source: { fileName: source.fileName, line: source.line, @@ -384,29 +309,22 @@ export const typeDocUtils = { callPath, }; return property; - }, - _convertMethod( - entity: TypeDocNode, - isConstructor: boolean, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): TypescriptMethod { + } + private _convertMethod(entity: TypeDocNode, isConstructor: boolean, sectionName: string): TypescriptMethod { const signature = entity.signatures[0]; const source = entity.sources[0]; const hasComment = !_.isUndefined(signature.comment); const isStatic = _.isUndefined(entity.flags.isStatic) ? false : entity.flags.isStatic; const parameters = _.map(signature.parameters, param => { - return typeDocUtils._convertParameter(param, sections, sectionName, docId, classNames); + return this._convertParameter(param, sectionName); }); - const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId, classNames); + const returnType = this._convertType(signature.type, sectionName); const typeParameter = _.isUndefined(signature.typeParameter) ? undefined - : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId, classNames); + : this._convertTypeParameter(signature.typeParameter[0], sectionName); - const callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); + const callPath = this._getCallPath(sectionName, isStatic, isConstructor, entity.name); const method = { isConstructor, isStatic, @@ -416,6 +334,10 @@ export const typeDocUtils = { source: { fileName: source.fileName, line: source.line, + callPath, + parameters, + returnType, + typeParameter, }, callPath, parameters, @@ -423,8 +345,8 @@ export const typeDocUtils = { typeParameter, }; return method; - }, - _getCallPath(sectionName: string, isStatic: boolean, isConstructor: boolean, entityName: string): string { + } + private _getCallPath(sectionName: string, isStatic: boolean, isConstructor: boolean, entityName: string): string { // HACK: we use the fact that the sectionName is the same as the property name at the top-level // of the public interface. In the future, we shouldn't use this hack but rather get it from the JSON. let callPath; @@ -435,32 +357,25 @@ export const typeDocUtils = { callPath = `${prefix}.`; } return callPath; - }, - _convertFunction( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - isObjectLiteral: boolean, - classNames: string[], - ): TypescriptFunction { + } + private _convertFunction(entity: TypeDocNode, sectionName: string, isObjectLiteral: boolean): TypescriptFunction { const signature = entity.signatures[0]; const source = entity.sources[0]; const hasComment = !_.isUndefined(signature.comment); const parameters = _.map(signature.parameters, param => { - return typeDocUtils._convertParameter(param, sections, sectionName, docId, classNames); + return this._convertParameter(param, sectionName); }); - const returnType = typeDocUtils._convertType(signature.type, sections, sectionName, docId, classNames); + const returnType = this._convertType(signature.type, sectionName); const typeParameter = _.isUndefined(signature.typeParameter) ? undefined - : typeDocUtils._convertTypeParameter(signature.typeParameter[0], sections, sectionName, docId, classNames); + : this._convertTypeParameter(signature.typeParameter[0], sectionName); let callPath = ''; if (isObjectLiteral) { const isConstructor = false; const isStatic = false; - callPath = typeDocUtils._getCallPath(sectionName, isStatic, isConstructor, entity.name); + callPath = this._getCallPath(sectionName, isStatic, isConstructor, entity.name); } const func = { name: signature.name, @@ -476,28 +391,16 @@ export const typeDocUtils = { typeParameter, }; return func; - }, - _convertTypeParameter( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): TypeParameter { - const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames); + } + private _convertTypeParameter(entity: TypeDocNode, sectionName: string): TypeParameter { + const type = this._convertType(entity.type, sectionName); const parameter = { name: entity.name, type, }; return parameter; - }, - _convertParameter( - entity: TypeDocNode, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): Parameter { + } + private _convertParameter(entity: TypeDocNode, sectionName: string): Parameter { let comment = ''; if (entity.comment && entity.comment.shortText) { comment = entity.comment.shortText; @@ -507,7 +410,7 @@ export const typeDocUtils = { const isOptional = !_.isUndefined(entity.flags.isOptional) ? entity.flags.isOptional : false; - const type = typeDocUtils._convertType(entity.type, sections, sectionName, docId, classNames); + const type = this._convertType(entity.type, sectionName); const parameter = { name: entity.name, @@ -517,19 +420,13 @@ export const typeDocUtils = { type, }; return parameter; - }, - _convertType( - entity: TypeDocType, - sections: SectionsMap, - sectionName: string, - docId: string, - classNames: string[], - ): Type { + } + private _convertType(entity: TypeDocType, sectionName: string): Type { const typeArguments = _.map(entity.typeArguments, typeArgument => { - return typeDocUtils._convertType(typeArgument, sections, sectionName, docId, classNames); + return this._convertType(typeArgument, sectionName); }); const types = _.map(entity.types, t => { - return typeDocUtils._convertType(t, sections, sectionName, docId, classNames); + return this._convertType(t, sectionName); }); let indexSignatureIfExists; @@ -538,23 +435,10 @@ export const typeDocUtils = { !_.isUndefined(entity.declaration) && !_.isUndefined(entity.declaration.indexSignature); if (doesIndexSignatureExist) { const indexSignature = entity.declaration.indexSignature as TypeDocNode; - indexSignatureIfExists = typeDocUtils._convertIndexSignature( - indexSignature, - sections, - sectionName, - docId, - classNames, - ); + indexSignatureIfExists = this._convertIndexSignature(indexSignature, sectionName); } else if (!_.isUndefined(entity.declaration)) { const isConstructor = false; - methodIfExists = typeDocUtils._convertMethod( - entity.declaration, - isConstructor, - sections, - sectionName, - docId, - classNames, - ); + methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName); } const elementTypeIfExists = !_.isUndefined(entity.elementType) @@ -564,10 +448,10 @@ export const typeDocUtils = { } : undefined; - const type = { + const type: Type = { name: entity.name, value: entity.value, - isExportedClassReference: _.includes(classNames, entity.name), + isExportedClassReference: _.includes(this._classNames, entity.name), typeDocType: entity.type, typeArguments, elementType: elementTypeIfExists, @@ -575,6 +459,11 @@ export const typeDocUtils = { method: methodIfExists, indexSignature: indexSignatureIfExists, }; + console.log('this._externalTypeToLink', this._externalTypeToLink); + const externalLinkIfExists = this._externalTypeToLink[entity.name]; + if (!_.isUndefined(externalLinkIfExists)) { + type.externalLink = externalLinkIfExists; + } return type; - }, -}; + } +} diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index cecfefdef..fffc60435 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -34,13 +34,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.installation]: InstallationMarkdownV1, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToExternalLink: { - Provider: constants.URL_WEB3_PROVIDER_DOCS, - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/contract_wrappers_documentation.ts b/packages/website/ts/containers/contract_wrappers_documentation.ts index 67d19bb2a..68bb4b1f0 100644 --- a/packages/website/ts/containers/contract_wrappers_documentation.ts +++ b/packages/website/ts/containers/contract_wrappers_documentation.ts @@ -35,12 +35,6 @@ const docsInfoConfig: DocsInfoConfig = { }, }, markdownSections, - typeConfigs: { - typeNameToPrefix: {}, - typeNameToExternalLink: { - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts index 5f08e0236..3e23899af 100644 --- a/packages/website/ts/containers/ethereum_types_documentation.ts +++ b/packages/website/ts/containers/ethereum_types_documentation.ts @@ -36,12 +36,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.installation]: InstallationMarkdown, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToExternalLink: { - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts index f88cec6ec..6b0089213 100644 --- a/packages/website/ts/containers/json_schemas_documentation.ts +++ b/packages/website/ts/containers/json_schemas_documentation.ts @@ -43,13 +43,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.usage]: UsageMarkdownV1, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToExternalLink: { - Schema: - 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', - }, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/order_utils_documentation.ts b/packages/website/ts/containers/order_utils_documentation.ts index 2b9465d92..444ca5f2d 100644 --- a/packages/website/ts/containers/order_utils_documentation.ts +++ b/packages/website/ts/containers/order_utils_documentation.ts @@ -35,11 +35,6 @@ const docsInfoConfig: DocsInfoConfig = { }, }, markdownSections, - typeConfigs: { - typeNameToExternalLink: { - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts index 29f1adf7c..8a32fe595 100644 --- a/packages/website/ts/containers/order_watcher_documentation.ts +++ b/packages/website/ts/containers/order_watcher_documentation.ts @@ -35,11 +35,6 @@ const docsInfoConfig: DocsInfoConfig = { }, }, markdownSections, - typeConfigs: { - typeNameToExternalLink: { - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index dda3840c7..48e5b1e1c 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -37,11 +37,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.usage]: UsageMarkdown, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToExternalLink: {}, - typeNameToPrefix: {}, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index 0ad7bbfd4..9e3c7489b 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -37,11 +37,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.usage]: UsageMarkdown, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToExternalLink: {}, - typeNameToPrefix: {}, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 4aaffd908..cbbc89a2b 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -39,13 +39,6 @@ const docsInfoConfig: DocsInfoConfig = { }, }, markdownSections: docSections, - typeConfigs: { - typeNameToExternalLink: { - Web3: constants.URL_WEB3_DOCS, - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - typeNameToPrefix: {}, - }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index b015fd0d9..0398e0493 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -35,13 +35,6 @@ const docsInfoConfig: DocsInfoConfig = { }, }, markdownSections: docSections, - typeConfigs: { - typeNameToExternalLink: { - Web3: constants.URL_WEB3_DOCS, - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - typeNameToPrefix: {}, - }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 79e342e01..90b70b8ed 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -56,13 +56,7 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.errors]: ErrorsMarkdownV1, }, }, - markdownSections: markdownSections, - typeConfigs: { - typeNameToPrefix: {}, - typeNameToExternalLink: { - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - }, - }, + markdownSections, }; const docsInfo = new DocsInfo(docsInfoConfig); -- cgit From 6e74d1519b2071b8c8c19639b0e9726a278d8a84 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Aug 2018 11:37:06 -0700 Subject: Add externalTypeToLink to docJson --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 1 + 1 file changed, 1 insertion(+) 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 ca3df2c74..be2d9f7e5 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 @@ -205,6 +205,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: metadata: { exportPathToTypedocNames, exportPathOrder, + externalTypeToLink: EXTERNAL_TYPE_TO_LINK, }, typedocJson: finalTypeDocOutput, }; -- cgit From 237bac920acf8ade0bba2e7ccc1c46eb272c36d0 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Aug 2018 16:38:07 -0700 Subject: Remove unused types from 0x.js index.ts discovered --- packages/0x.js/src/index.ts | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index d8ad6a969..5ac3da00d 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -9,19 +9,13 @@ export { ERC20ProxyWrapper, ERC721ProxyWrapper, ForwarderWrapper, - ContractWrappersError, - EventCallback, - ContractEvent, IndexedFilterValues, BlockRange, - OrderFillRequest, ContractEventArgs, ContractWrappersConfig, MethodOpts, OrderTransactionOpts, TransactionOpts, - LogEvent, - DecodedLogEvent, OrderStatus, OrderInfo, WETH9Events, @@ -75,7 +69,6 @@ export { OrderState, AssetProxyId, SignerType, - Token, ERC20AssetData, ERC721AssetData, SignatureType, @@ -86,7 +79,6 @@ export { ContractArtifact, GeneratedCompilerOptions, ContractNetworks, - ContractVersionData, ContractNetworkData, Source, } from '@0xproject/sol-compiler'; @@ -94,18 +86,13 @@ export { export { BlockParamLiteral, ContractAbi, - FilterObject, BlockParam, LogWithDecodedArgs, ContractEventArg, Provider, - TransactionReceipt, - TransactionReceiptWithDecodedLogs, - LogTopic, JSONRPCRequestPayload, JSONRPCResponsePayload, JSONRPCErrorCallback, - TransactionReceiptStatus, LogEntry, DecodedLogArgs, LogEntryEvent, @@ -113,26 +100,13 @@ export { DecodedLogEntryEvent, RawLog, AbiDefinition, - TxData, - CallData, - BlockWithoutTransactionData, - BlockWithTransactionData, - Transaction, - TraceParams, - TransactionTrace, - AbstractBlock, - CallTxDataBase, - StructLog, - TxDataPayable, FunctionAbi, EventAbi, EventParameter, - OpCode, MethodAbi, ConstructorAbi, FallbackAbi, DataItem, ConstructorStateMutability, StateMutability, - AbiType, } from 'ethereum-types'; -- cgit From 9e7657ac5db596ff8dacf1c37784be2e9e7f87a6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Aug 2018 16:38:30 -0700 Subject: Improve Error external link --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 be2d9f7e5..b51b17db1 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 @@ -22,7 +22,7 @@ const DOC_JSON_VERSION = '0.0.1'; const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { BigNumber: 'http://mikemcl.github.io/bignumber.js', - Error: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L134', + Error: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error', Buffer: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L262', 'solc.StandardContractOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', -- cgit From baab0f27b543f8f17bad0e3a40b803763236edb9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Aug 2018 16:50:23 -0700 Subject: Check for superfluous types in a packages index.ts and throw if they exist --- .../src/utils/doc_generate_and_upload_utils.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 b51b17db1..b236c299f 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 @@ -185,6 +185,16 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const referenceNamesWithDuplicates = getAllReferenceNames(propertyName, finalTypeDocOutput, []); const referenceNames = _.uniq(referenceNamesWithDuplicates); + const exportedTypes = getAllTypeNames(finalTypeDocOutput, []); + const excessiveReferences = _.difference(exportedTypes, referenceNames); + if (!_.isEmpty(excessiveReferences)) { + throw new Error( + `${packageName} package exports BUT does not need: \n${excessiveReferences.join( + '\n', + )} \nin it\'s index.ts. Remove them then try again.`, + ); + } + const missingReferences: string[] = []; _.each(referenceNames, referenceName => { if (!_.includes(allExportedItems, referenceName) && _.isUndefined(EXTERNAL_TYPE_TO_LINK[referenceName])) { @@ -230,6 +240,27 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: }); } +function getAllTypeNames(node: any, typeNames: string[]): string[] { + if (!_.isObject(node)) { + return typeNames; + } + const typeKindStrings = ['Interface', 'Enumeration', 'Type alias']; + if (_.includes(typeKindStrings, node.kindString)) { + return [...typeNames, node.name]; + } + let updatedTypeNames = typeNames; + _.each(node, nodeValue => { + if (_.isArray(nodeValue)) { + _.each(nodeValue, aNode => { + updatedTypeNames = getAllTypeNames(aNode, updatedTypeNames); + }); + } else if (_.isObject(nodeValue)) { + updatedTypeNames = getAllTypeNames(nodeValue, updatedTypeNames); + } + }); + return updatedTypeNames; +} + function getAllReferenceNames(propertyName: string, node: any, referenceNames: string[]): string[] { let updatedReferenceNames = referenceNames; if (!_.isObject(node)) { -- cgit From 60f026e6fdac855daef3ab8b2e8e2ade9d3d26af Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 08:45:43 -0700 Subject: Export Web3ProviderEngine directly instead of indirectly via subproviders --- packages/0x.js/package.json | 5 ++-- packages/0x.js/src/index.ts | 10 ++----- yarn.lock | 68 +++++++++++++++++++++++++-------------------- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 49dca2923..006c1ed27 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -78,8 +78,8 @@ "@0xproject/base-contract": "^2.0.0-rc.1", "@0xproject/contract-wrappers": "^1.0.1-rc.3", "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/order-watcher": "1.0.1-rc.3", + "@0xproject/sol-compiler": "^1.0.5", "@0xproject/subproviders": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", @@ -87,7 +87,8 @@ "@0xproject/web3-wrapper": "^1.2.0", "ethereum-types": "^1.0.4", "ethers": "3.0.22", - "lodash": "^4.17.5" + "lodash": "^4.17.5", + "web3-provider-engine": "14.0.6" }, "publishConfig": { "access": "public" diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 5ac3da00d..aa59d81cc 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -47,13 +47,9 @@ export { ContractWrapper } from '@0xproject/contract-wrappers/lib/src/contract_w export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; -export { - Web3ProviderEngine, - RPCSubprovider, - Callback, - JSONRPCRequestPayloadWithMethod, - ErrorCallback, -} from '@0xproject/subproviders'; +export import Web3ProviderEngine = require('web3-provider-engine'); + +export { RPCSubprovider, Callback, JSONRPCRequestPayloadWithMethod, ErrorCallback } from '@0xproject/subproviders'; export { AbiDecoder } from '@0xproject/utils'; diff --git a/yarn.lock b/yarn.lock index a6bfae4c0..08a76d627 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1354,9 +1354,9 @@ aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" -aes-js@^0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d" +aes-js@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" ajv-keywords@^2.1.0: version "2.1.1" @@ -2414,10 +2414,6 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" -base-x@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" - base-x@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" @@ -2821,7 +2817,7 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -bs58@=4.0.1: +bs58@=4.0.1, bs58@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: @@ -2831,18 +2827,13 @@ bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" -bs58@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e" - dependencies: - base-x "^1.1.0" - -bs58check@^1.0.8: - version "1.3.4" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8" +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" dependencies: - bs58 "^3.1.0" + bs58 "^4.0.0" create-hash "^1.1.0" + safe-buffer "^5.1.2" btoa@1.1.2: version "1.1.2" @@ -5175,7 +5166,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: +ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -5229,17 +5220,18 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" +ethereumjs-wallet@~0.6.0: + version "0.6.2" + resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" dependencies: - aes-js "^0.2.3" - bs58check "^1.0.8" - ethereumjs-util "^4.4.0" - hdkey "^0.7.0" + aes-js "^3.1.1" + bs58check "^2.1.2" + ethereumjs-util "^5.2.0" + hdkey "^1.0.0" + safe-buffer "^5.1.2" scrypt.js "^0.2.0" - utf8 "^2.1.1" - uuid "^2.0.1" + utf8 "^3.0.0" + uuid "^3.3.2" ethers@3.0.22: version "3.0.22" @@ -5986,7 +5978,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "~0.6.0" + ethereumjs-wallet "0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" @@ -6651,13 +6643,21 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -hdkey@^0.7.0, hdkey@^0.7.1: +hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" dependencies: coinstring "^2.0.0" secp256k1 "^3.0.1" +hdkey@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" + dependencies: + coinstring "^2.0.0" + safe-buffer "^5.1.1" + secp256k1 "^3.0.1" + he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -13947,6 +13947,10 @@ utf8@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" +utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -13992,6 +13996,10 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" +uuid@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + uvm@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/uvm/-/uvm-1.7.0.tgz#685d3a149ec7118fb73a73dfdc158ab46b0f0634" -- cgit From 7d09a94428e2e4b477946a7eb94fce3d47a2960f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 13:50:03 -0700 Subject: Remove unused ContractWrapper export --- packages/0x.js/src/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index aa59d81cc..efcb4344a 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -43,8 +43,6 @@ export { ContractEvents, } from '@0xproject/contract-wrappers'; -export { ContractWrapper } from '@0xproject/contract-wrappers/lib/src/contract_wrappers/contract_wrapper'; - export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; export import Web3ProviderEngine = require('web3-provider-engine'); -- cgit From ae7bce767442f127961180f7d101265dcbc8ed80 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 13:56:29 -0700 Subject: Add links for external dep exports to docJson --- .../src/utils/doc_generate_and_upload_utils.ts | 45 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) 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 b236c299f..e866d5bbc 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 @@ -30,6 +30,16 @@ const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', }; +/** + * If a 0x package re-exports an external package, we should add a link to it's exported items here + */ +const EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string } = { + Web3ProviderEngine: 'https://www.npmjs.com/package/web3-provider-engine', + BigNumber: 'https://www.npmjs.com/package/bignumber.js', + Schema: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/index.d.ts#L49', + ValidatorResult: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/helpers.js#L31', +}; + const CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[] = [ 'ERC20ProxyWrapper', 'ERC20TokenWrapper', @@ -67,10 +77,9 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: } const pkgNameToPath: { [name: string]: string } = {}; - _.each(monorepoPackages, pkg => { - pkgNameToPath[pkg.packageJson.name] = pkg.location; - }); + _.each(monorepoPackages, p => (pkgNameToPath[p.packageJson.name] = p.location)); + const externalExports: string[] = []; // For each dep that is another one of our monorepo packages, we fetch it's index.ts // and see which specific files we must pass to TypeDoc. let typeDocExtraFileIncludes: string[] = []; @@ -84,6 +93,9 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const pathIfExists = pkgNameToPath[exportPath]; if (_.isUndefined(pathIfExists)) { + _.each(exportedItems, exportedItem => { + externalExports.push(exportedItem); + }); return; // It's an external package } @@ -209,6 +221,24 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: ); } + const externalExportsToLink: { [externalExport: string]: string } = {}; + const externalExportsWithoutLinks: string[] = []; + _.each(externalExports, externalExport => { + const linkIfExists = EXTERNAL_EXPORT_TO_LINK[externalExport]; + if (_.isUndefined(linkIfExists)) { + externalExportsWithoutLinks.push(externalExport); + return; + } + externalExportsToLink[externalExport] = linkIfExists; + }); + if (!_.isEmpty(externalExportsWithoutLinks)) { + throw new Error( + `Found the following external exports in ${packageName}'s index.ts:\n ${externalExportsWithoutLinks.join( + '\n', + )}\nThey are missing from the EXTERNAL_EXPORT_TO_LINK mapping. Add them and try again.`, + ); + } + // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON const docJson = { version: DOC_JSON_VERSION, @@ -216,6 +246,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: exportPathToTypedocNames, exportPathOrder, externalTypeToLink: EXTERNAL_TYPE_TO_LINK, + externalExportsToLink, }, typedocJson: finalTypeDocOutput, }; @@ -367,9 +398,15 @@ function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[] case ts.SyntaxKind.ExportKeyword: { const foundNode: any = node; - const exportPath = './index'; + let exportPath = './index'; if (foundNode.parent && foundNode.parent.name) { const exportItem = foundNode.parent.name.escapedText; + const isExportImportRequireStatement = !_.isUndefined( + _.get(foundNode, 'parent.moduleReference.expression.text'), + ); + if (isExportImportRequireStatement) { + exportPath = foundNode.parent.moduleReference.expression.text; + } if (!_.includes(exportsToOmit, exportItem)) { exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) ? [exportItem] -- cgit From bf9ee82d9f4a2fec392f0ee58342fc6b3be94dff Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 13:59:50 -0700 Subject: Remove stray console log --- packages/react-docs/src/utils/typedoc_utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index db6063464..e10493673 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -33,7 +33,6 @@ export class TypeDocUtils { private _classNames: string[]; constructor(generatedDocJson: GeneratedDocJson, docsInfo: DocsInfo) { this._docsInfo = docsInfo; - console.log('generatedDocJson.metadata', generatedDocJson.metadata); const exportPathOrder = generatedDocJson.metadata.exportPathOrder; const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; this._externalTypeToLink = generatedDocJson.metadata.externalTypeToLink; -- cgit From 8e3df2b5aeac9d6776640be1248863055c75cf4a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 14:57:45 -0700 Subject: Render external dep exports --- .../src/utils/doc_generate_and_upload_utils.ts | 6 +++--- .../react-docs/src/components/documentation.tsx | 20 ++++++++++++++++++++ packages/react-docs/src/types.ts | 8 +++++++- packages/react-docs/src/utils/constants.ts | 1 + packages/react-docs/src/utils/typedoc_utils.ts | 21 +++++++++++++++++++-- 5 files changed, 50 insertions(+), 6 deletions(-) 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 e866d5bbc..b4911c84b 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 @@ -221,7 +221,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: ); } - const externalExportsToLink: { [externalExport: string]: string } = {}; + const externalExportToLink: { [externalExport: string]: string } = {}; const externalExportsWithoutLinks: string[] = []; _.each(externalExports, externalExport => { const linkIfExists = EXTERNAL_EXPORT_TO_LINK[externalExport]; @@ -229,7 +229,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: externalExportsWithoutLinks.push(externalExport); return; } - externalExportsToLink[externalExport] = linkIfExists; + externalExportToLink[externalExport] = linkIfExists; }); if (!_.isEmpty(externalExportsWithoutLinks)) { throw new Error( @@ -246,7 +246,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: exportPathToTypedocNames, exportPathOrder, externalTypeToLink: EXTERNAL_TYPE_TO_LINK, - externalExportsToLink, + externalExportToLink, }, typedocJson: finalTypeDocOutput, }; diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 82e444018..43a1f746e 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -19,6 +19,7 @@ import { AddressByContractName, DocAgnosticFormat, Event, + ExternalExportToLink, Property, SolidityMethod, SupportedDocJson, @@ -26,6 +27,7 @@ import { TypescriptFunction, TypescriptMethod, } from '../types'; +import { constants } from '../utils/constants'; import { Badge } from './badge'; import { Comment } from './comment'; @@ -300,6 +302,8 @@ export class Documentation extends React.Component{eventDefs} )} + {!_.isUndefined(docSection.externalExportToLink) && + this._renderExternalExports(docSection.externalExportToLink)} {!_.isUndefined(typeDefs) && typeDefs.length > 0 && (
@@ -309,6 +313,22 @@ export class Documentation extends React.Component ); } + private _renderExternalExports(externalExportToLink: ExternalExportToLink): React.ReactNode { + const externalExports = _.map(externalExportToLink, (link: string, exportName: string) => { + return ( +
+ + {`import { `} + + {exportName} + + {` } from '${this.props.docsInfo.displayName}'`} + +
+ ); + }); + return
{externalExports}
; + } private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode { if (this.props.docsInfo.type !== SupportedDocJson.Doxity) { return null; diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 0155685e0..8352af876 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -105,8 +105,9 @@ export interface DocSection { methods: Array; properties: Property[]; types: CustomType[]; - functions?: TypescriptFunction[]; + functions: TypescriptFunction[]; events?: Event[]; + externalExportToLink?: ExternalExportToLink; } export interface TypescriptMethod extends BaseMethod { @@ -296,10 +297,15 @@ export interface ExternalTypeToLink { [externalTypeName: string]: string; } +export interface ExternalExportToLink { + [externalExport: string]: string; +} + export interface Metadata { exportPathToTypedocNames: ExportNameToTypedocNames; exportPathOrder: string[]; externalTypeToLink: ExternalTypeToLink; + externalExportToLink: ExternalExportToLink; } export interface GeneratedDocJson { diff --git a/packages/react-docs/src/utils/constants.ts b/packages/react-docs/src/utils/constants.ts index c3c74fd11..97bedf2db 100644 --- a/packages/react-docs/src/utils/constants.ts +++ b/packages/react-docs/src/utils/constants.ts @@ -2,6 +2,7 @@ import { SupportedDocJson } from '../types'; export const constants = { TYPES_SECTION_NAME: 'types', + EXTERNAL_EXPORTS_SECTION_NAME: 'externalExports', TYPE_TO_SYNTAX: { [SupportedDocJson.Doxity]: 'solidity', [SupportedDocJson.TypeDoc]: 'typescript', diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index e10493673..989485dfc 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -7,13 +7,13 @@ import { CustomTypeChild, DocAgnosticFormat, DocSection, + ExternalExportToLink, ExternalTypeToLink, GeneratedDocJson, IndexSignature, KindString, Parameter, Property, - SectionsMap, Type, TypeDocNode, TypeDocType, @@ -28,6 +28,7 @@ import { constants } from './constants'; export class TypeDocUtils { private _typeDocNameOrder: string[]; private _externalTypeToLink: ExternalTypeToLink; + private _externalExportToLink: ExternalExportToLink; private _docsInfo: DocsInfo; private _typeDocJson: TypeDocNode; private _classNames: string[]; @@ -36,6 +37,7 @@ export class TypeDocUtils { const exportPathOrder = generatedDocJson.metadata.exportPathOrder; const exportPathToTypedocNames = generatedDocJson.metadata.exportPathToTypedocNames; this._externalTypeToLink = generatedDocJson.metadata.externalTypeToLink; + this._externalExportToLink = generatedDocJson.metadata.externalExportToLink; this._typeDocJson = generatedDocJson.typedocJson; // TODO: Extract the non typeDoc exports, and render them somehow @@ -88,6 +90,22 @@ export class TypeDocUtils { } public convertToDocAgnosticFormat(): DocAgnosticFormat { const docAgnosticFormat: DocAgnosticFormat = {}; + + if (!_.isEmpty(this._externalExportToLink)) { + this._docsInfo.sections[constants.EXTERNAL_EXPORTS_SECTION_NAME] = constants.EXTERNAL_EXPORTS_SECTION_NAME; + this._docsInfo.menu[constants.EXTERNAL_EXPORTS_SECTION_NAME] = [constants.EXTERNAL_EXPORTS_SECTION_NAME]; + const docSection: DocSection = { + comment: 'This package also re-exports some third-party libraries for your convenience.', + constructors: [], + methods: [], + functions: [], + properties: [], + types: [], + externalExportToLink: this._externalExportToLink, + }; + docAgnosticFormat[constants.EXTERNAL_EXPORTS_SECTION_NAME] = docSection; + } + const typeEntities: TypeDocNode[] = []; _.each(this._typeDocNameOrder, typeDocName => { const fileChildIndex = _.findIndex(this._typeDocJson.children, child => child.name === typeDocName); @@ -458,7 +476,6 @@ export class TypeDocUtils { method: methodIfExists, indexSignature: indexSignatureIfExists, }; - console.log('this._externalTypeToLink', this._externalTypeToLink); const externalLinkIfExists = this._externalTypeToLink[entity.name]; if (!_.isUndefined(externalLinkIfExists)) { type.externalLink = externalLinkIfExists; -- cgit From e47e9c5b34a2c189b6913c4c7082cb7ec256617f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 15:01:52 -0700 Subject: Fix external exports section name --- packages/react-docs/src/utils/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/utils/constants.ts b/packages/react-docs/src/utils/constants.ts index 97bedf2db..0b08f2c3e 100644 --- a/packages/react-docs/src/utils/constants.ts +++ b/packages/react-docs/src/utils/constants.ts @@ -2,7 +2,7 @@ import { SupportedDocJson } from '../types'; export const constants = { TYPES_SECTION_NAME: 'types', - EXTERNAL_EXPORTS_SECTION_NAME: 'externalExports', + EXTERNAL_EXPORTS_SECTION_NAME: 'external exports', TYPE_TO_SYNTAX: { [SupportedDocJson.Doxity]: 'solidity', [SupportedDocJson.TypeDoc]: 'typescript', -- cgit From 7c08f6d30aea9cde0a7fce4b3ca41e1e9a0450c3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 15:13:28 -0700 Subject: Update yarn.lock --- yarn.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index dd0ec1684..ec002cab7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3742,7 +3742,7 @@ copy-webpack-plugin@^4.0.1: p-limit "^1.0.0" serialize-javascript "^1.4.0" -copyfiles@2.0.0: +copyfiles@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.0.0.tgz#bbd78bb78e8fd6db5c67adf54249317b24560f2a" dependencies: @@ -5224,7 +5224,6 @@ ethereumjs-wallet@~0.6.0: ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: version "3.0.18" - uid b91342bd200d142af0165d6befddf783c8ae8447 resolved "https://codeload.github.com/0xproject/ethers.js/tar.gz/b91342bd200d142af0165d6befddf783c8ae8447" dependencies: aes-js "3.0.0" @@ -5968,7 +5967,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "~0.6.0" + ethereumjs-wallet "0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" -- cgit From a4c3a0d39fb42647f5c84d4e39b8f38df83a1902 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 15:15:30 -0700 Subject: Undo prettier --- .circleci/config.yml | 474 +++++++++++++++++++++++++-------------------------- 1 file changed, 237 insertions(+), 237 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4082f511..ae8519a56 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,242 +1,242 @@ version: 2 jobs: - build: - docker: - - image: circleci/node:9 - environment: - CONTRACTS_COMMIT_HASH: '9ed05f5' - working_directory: ~/repo - steps: - - checkout - - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV - - restore_cache: - name: Restore Yarn Package Cache - keys: - - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-{{ .Branch }} - - yarn-packages-master - - yarn-packages- - - run: - name: yarn - command: yarn --frozen-lockfile install - - save_cache: - name: Save Yarn Package Cache - key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} - paths: - - node_modules/ - - run: > - if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then - yarn build --exclude website - else - yarn build - fi - - save_cache: - key: repo-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo - test-contracts-ganache: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci contracts - test-contracts-geth: - docker: - - image: circleci/node:9 - - image: albrow/0x-devnet - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is - # initialized - - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts - test-publish: - docker: - - image: circleci/node:9 - - image: verdaccio/verdaccio - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn test:publish:circleci - test-rest: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0xproject/abi-gen - - run: yarn wsrun test:circleci @0xproject/assert - - run: yarn wsrun test:circleci @0xproject/base-contract - - run: yarn wsrun test:circleci @0xproject/connect - - run: yarn wsrun test:circleci @0xproject/contract-wrappers - - run: yarn wsrun test:circleci @0xproject/dev-utils - - run: yarn wsrun test:circleci @0xproject/json-schemas - - run: yarn wsrun test:circleci @0xproject/metacoin - - run: yarn wsrun test:circleci @0xproject/order-utils - - run: yarn wsrun test:circleci @0xproject/order-watcher - - run: yarn wsrun test:circleci @0xproject/sol-compiler - - run: yarn wsrun test:circleci @0xproject/sol-cov - - run: yarn wsrun test:circleci @0xproject/sra-report - - run: yarn wsrun test:circleci @0xproject/subproviders - - run: yarn wsrun test:circleci @0xproject/web3-wrapper - - run: yarn wsrun test:circleci @0xproject/utils - - save_cache: - key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/abi-gen/coverage/lcov.info - - save_cache: - key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/assert/coverage/lcov.info - - save_cache: - key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/base-contract/coverage/lcov.info - - save_cache: - key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/connect/coverage/lcov.info - - save_cache: - key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/contract-wrappers/coverage/lcov.info - - save_cache: - key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/dev-utils/coverage/lcov.info - - save_cache: - key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/json-schemas/coverage/lcov.info - - save_cache: - key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/metacoin/coverage/lcov.info - - save_cache: - key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/order-utils/coverage/lcov.info - - save_cache: - key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/order-watcher/coverage/lcov.info - - save_cache: - key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sol-compiler/coverage/lcov.info - - save_cache: - key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sol-cov/coverage/lcov.info - - save_cache: - key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/sra-report/coverage/lcov.info - - save_cache: - key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/subproviders/coverage/lcov.info - - save_cache: - key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo/packages/web3-wrapper/coverage/lcov.info - static-tests: - working_directory: ~/repo - docker: - - image: circleci/node:9 - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn prettier:ci - - run: yarn lerna run lint - submit-coverage: - docker: - - image: circleci/node:9 - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-assert-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-connect-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} - - restore_cache: - keys: - - coverage-contracts-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn report_coverage + build: + docker: + - image: circleci/node:9 + environment: + CONTRACTS_COMMIT_HASH: '9ed05f5' + working_directory: ~/repo + steps: + - checkout + - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-packages-{{ .Branch }} + - yarn-packages-master + - yarn-packages- + - run: + name: yarn + command: yarn --frozen-lockfile install + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} + paths: + - node_modules/ + - run: > + if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then + yarn build --exclude website + else + yarn build + fi + - save_cache: + key: repo-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo + test-contracts-ganache: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn wsrun test:circleci contracts + test-contracts-geth: + docker: + - image: circleci/node:9 + - image: albrow/0x-devnet + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is + # initialized + - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts + test-publish: + docker: + - image: circleci/node:9 + - image: verdaccio/verdaccio + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn test:publish:circleci + test-rest: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn wsrun test:circleci @0xproject/abi-gen + - run: yarn wsrun test:circleci @0xproject/assert + - run: yarn wsrun test:circleci @0xproject/base-contract + - run: yarn wsrun test:circleci @0xproject/connect + - run: yarn wsrun test:circleci @0xproject/contract-wrappers + - run: yarn wsrun test:circleci @0xproject/dev-utils + - run: yarn wsrun test:circleci @0xproject/json-schemas + - run: yarn wsrun test:circleci @0xproject/metacoin + - run: yarn wsrun test:circleci @0xproject/order-utils + - run: yarn wsrun test:circleci @0xproject/order-watcher + - run: yarn wsrun test:circleci @0xproject/sol-compiler + - run: yarn wsrun test:circleci @0xproject/sol-cov + - run: yarn wsrun test:circleci @0xproject/sra-report + - run: yarn wsrun test:circleci @0xproject/subproviders + - run: yarn wsrun test:circleci @0xproject/web3-wrapper + - run: yarn wsrun test:circleci @0xproject/utils + - save_cache: + key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/abi-gen/coverage/lcov.info + - save_cache: + key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/assert/coverage/lcov.info + - save_cache: + key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/base-contract/coverage/lcov.info + - save_cache: + key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/connect/coverage/lcov.info + - save_cache: + key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/contract-wrappers/coverage/lcov.info + - save_cache: + key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/dev-utils/coverage/lcov.info + - save_cache: + key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/json-schemas/coverage/lcov.info + - save_cache: + key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/metacoin/coverage/lcov.info + - save_cache: + key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/order-utils/coverage/lcov.info + - save_cache: + key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/order-watcher/coverage/lcov.info + - save_cache: + key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sol-compiler/coverage/lcov.info + - save_cache: + key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sol-cov/coverage/lcov.info + - save_cache: + key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sra-report/coverage/lcov.info + - save_cache: + key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/subproviders/coverage/lcov.info + - save_cache: + key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/web3-wrapper/coverage/lcov.info + static-tests: + working_directory: ~/repo + docker: + - image: circleci/node:9 + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn prettier:ci + - run: yarn lerna run lint + submit-coverage: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-assert-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-connect-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-contracts-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn report_coverage workflows: - version: 2 - main: - jobs: + version: 2 + main: + jobs: + - build + - test-contracts-ganache: + requires: - build - - test-contracts-ganache: - requires: - - build - - test-contracts-geth: - requires: - - build - - test-rest: - requires: - - build - - static-tests: - requires: - - build - - test-publish: - requires: - - build - - submit-coverage: - requires: - - test-rest + - test-contracts-geth: + requires: + - build + - test-rest: + requires: + - build + - static-tests: + requires: + - build + - test-publish: + requires: + - build + - submit-coverage: + requires: + - test-rest \ No newline at end of file -- cgit From def575b9952908e8eebb1881a5dc0fe2e663a7c8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 15:31:43 -0700 Subject: Remove outdating comment --- .../contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts | 3 +-- .../contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts | 3 +-- .../contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts | 3 +-- .../contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts | 3 +-- .../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts | 3 +-- packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts index d60d4339b..ff027d78a 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts @@ -17,8 +17,7 @@ export class ERC20ProxyWrapper extends ContractWrapper { private _erc20ProxyContractIfExists?: ERC20ProxyContract; private _contractAddressIfExists?: string; /** - * Instantiate ERC20ProxyWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.erc20Proxy). + * Instantiate ERC20ProxyWrapper * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param contractAddressIfExists The contract address to use. This is usually pulled from diff --git a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts index 7ff0ee72e..4625cef6a 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts @@ -35,8 +35,7 @@ export class ERC20TokenWrapper extends ContractWrapper { private _tokenContractsByAddress: { [address: string]: ERC20TokenContract }; private _erc20ProxyWrapper: ERC20ProxyWrapper; /** - * Instantiate ERC20TokenWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.erc20Token). + * Instantiate ERC20TokenWrapper * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param erc20ProxyWrapper The ERC20ProxyWrapper instance to use diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts index c17905cb7..933c1dc27 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts @@ -17,8 +17,7 @@ export class ERC721ProxyWrapper extends ContractWrapper { private _erc721ProxyContractIfExists?: ERC721ProxyContract; private _contractAddressIfExists?: string; /** - * Instantiate ERC721ProxyWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.erc721Proxy). + * Instantiate ERC721ProxyWrapper * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param contractAddressIfExists The contract address to use. This is usually pulled from diff --git a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts index 6e0eede70..590dbbf74 100644 --- a/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts @@ -34,8 +34,7 @@ export class ERC721TokenWrapper extends ContractWrapper { private _tokenContractsByAddress: { [address: string]: ERC721TokenContract }; private _erc721ProxyWrapper: ERC721ProxyWrapper; /** - * Instantiate ERC721TokenWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.erc721Token). + * Instantiate ERC721TokenWrapper * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param erc721ProxyWrapper The ERC721ProxyWrapper instance to use diff --git a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts index d7b6effd8..1ac01812e 100644 --- a/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts @@ -25,8 +25,7 @@ export class EtherTokenWrapper extends ContractWrapper { } = {}; private _erc20TokenWrapper: ERC20TokenWrapper; /** - * Instantiate EtherTokenWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.etherToken). + * Instantiate EtherTokenWrapper. * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param erc20TokenWrapper The ERC20TokenWrapper instance to use diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts index 0febd154f..0eaae358e 100644 --- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts @@ -35,8 +35,7 @@ export class ExchangeWrapper extends ContractWrapper { private _contractAddressIfExists?: string; private _zrxContractAddressIfExists?: string; /** - * Instantiate ExchangeWrapper. We recommend you don't instantiate this yourself, rather - * use it through the ContractWrappers class property (contractWrappers.exchange). + * Instantiate ExchangeWrapper * @param web3Wrapper Web3Wrapper instance to use * @param networkId Desired networkId * @param contractAddressIfExists The exchange contract address to use. This is usually pulled from -- cgit From f7375fca98c01093f34f916f93f9bfe76278b6af Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 17:02:37 -0700 Subject: Move doc configs to a separate file --- packages/monorepo-scripts/src/doc_gen_configs.ts | 33 +++++++++++++ packages/monorepo-scripts/src/types.ts | 16 ++++++ .../src/utils/doc_generate_and_upload_utils.ts | 57 ++++------------------ 3 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 packages/monorepo-scripts/src/doc_gen_configs.ts diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts new file mode 100644 index 000000000..fd95863c3 --- /dev/null +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -0,0 +1,33 @@ +import { DocGenConfigs } from './types'; + +export const docGenConfigs: DocGenConfigs = { + DOC_JSON_VERSION: '0.0.1', + EXTERNAL_TYPE_TO_LINK: { + BigNumber: 'http://mikemcl.github.io/bignumber.js', + Error: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error', + Buffer: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L262', + 'solc.StandardContractOutput': + 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', + 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', + Schema: + 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', + }, + /** + * If a 0x package re-exports an external package, we should add a link to it's exported items here + */ + EXTERNAL_EXPORT_TO_LINK: { + Web3ProviderEngine: 'https://www.npmjs.com/package/web3-provider-engine', + BigNumber: 'https://www.npmjs.com/package/bignumber.js', + Schema: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/index.d.ts#L49', + ValidatorResult: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/helpers.js#L31', + }, + CLASSES_WITH_HIDDEN_CONSTRUCTORS: [ + 'ERC20ProxyWrapper', + 'ERC20TokenWrapper', + 'ERC721ProxyWrapper', + 'ERC721TokenWrapper', + 'EtherTokenWrapper', + 'ExchangeWrapper', + 'ForwarderWrapper', + ], +}; diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index 4d4600abf..5f6a6c707 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -50,6 +50,22 @@ export interface Package { packageJson: PackageJSON; } +export interface DocGenConfigs { + DOC_JSON_VERSION: string; + EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string }; + EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string }; + CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[]; +} + export interface ExportPathToExportedItems { [pkgName: string]: string[]; } + +export interface ExportInfo { + exportPathToExportedItems: ExportPathToExportedItems; + exportPathOrder: string[]; +} + +export interface ExportNameToTypedocNames { + [exportName: string]: string[]; +} 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 b4911c84b..0d9c47932 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 @@ -5,51 +5,11 @@ import { exec as execAsync } from 'promisify-child-process'; import * as ts from 'typescript'; import { constants } from '../constants'; -import { ExportPathToExportedItems } from '../types'; +import { docGenConfigs } from '../doc_gen_configs'; +import { ExportInfo, ExportNameToTypedocNames, ExportPathToExportedItems } from '../types'; import { utils } from './utils'; -interface ExportInfo { - exportPathToExportedItems: ExportPathToExportedItems; - exportPathOrder: string[]; -} - -interface ExportNameToTypedocNames { - [exportName: string]: string[]; -} - -const DOC_JSON_VERSION = '0.0.1'; - -const EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string } = { - BigNumber: 'http://mikemcl.github.io/bignumber.js', - Error: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error', - Buffer: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L262', - 'solc.StandardContractOutput': - 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', - 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', - Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', -}; - -/** - * If a 0x package re-exports an external package, we should add a link to it's exported items here - */ -const EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string } = { - Web3ProviderEngine: 'https://www.npmjs.com/package/web3-provider-engine', - BigNumber: 'https://www.npmjs.com/package/bignumber.js', - Schema: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/index.d.ts#L49', - ValidatorResult: 'https://github.com/tdegrunt/jsonschema/blob/v1.2.4/lib/helpers.js#L31', -}; - -const CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[] = [ - 'ERC20ProxyWrapper', - 'ERC20TokenWrapper', - 'ERC721ProxyWrapper', - 'ERC721TokenWrapper', - 'EtherTokenWrapper', - 'ExchangeWrapper', - 'ForwarderWrapper', -]; - export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { const monorepoPackages = utils.getPackages(constants.monorepoRootPath); const pkg = _.find(monorepoPackages, monorepoPackage => { @@ -178,7 +138,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: _.each(innerChildren, (innerChild, k) => { const isHiddenConstructor = child.kindString === 'Class' && - _.includes(CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && + _.includes(docGenConfigs.CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && innerChild.kindString === 'Constructor'; const isPrivate = _.startsWith(innerChild.name, '_'); if (isHiddenConstructor || isPrivate) { @@ -209,7 +169,10 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const missingReferences: string[] = []; _.each(referenceNames, referenceName => { - if (!_.includes(allExportedItems, referenceName) && _.isUndefined(EXTERNAL_TYPE_TO_LINK[referenceName])) { + if ( + !_.includes(allExportedItems, referenceName) && + _.isUndefined(docGenConfigs.EXTERNAL_TYPE_TO_LINK[referenceName]) + ) { missingReferences.push(referenceName); } }); @@ -224,7 +187,7 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: const externalExportToLink: { [externalExport: string]: string } = {}; const externalExportsWithoutLinks: string[] = []; _.each(externalExports, externalExport => { - const linkIfExists = EXTERNAL_EXPORT_TO_LINK[externalExport]; + const linkIfExists = docGenConfigs.EXTERNAL_EXPORT_TO_LINK[externalExport]; if (_.isUndefined(linkIfExists)) { externalExportsWithoutLinks.push(externalExport); return; @@ -241,11 +204,11 @@ export async function generateAndUploadDocsAsync(packageName: string, isStaging: // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON const docJson = { - version: DOC_JSON_VERSION, + version: docGenConfigs.DOC_JSON_VERSION, metadata: { exportPathToTypedocNames, exportPathOrder, - externalTypeToLink: EXTERNAL_TYPE_TO_LINK, + externalTypeToLink: docGenConfigs.EXTERNAL_TYPE_TO_LINK, externalExportToLink, }, typedocJson: finalTypeDocOutput, -- cgit From 68d7eb5712750fae2bdc680c45bc5927e1837afe Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 16 Aug 2018 17:02:47 -0700 Subject: Fix comment --- packages/contracts/test/utils/erc20_wrapper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts index 95b31dfa6..ec9e20a9b 100644 --- a/packages/contracts/test/utils/erc20_wrapper.ts +++ b/packages/contracts/test/utils/erc20_wrapper.ts @@ -21,10 +21,11 @@ export class ERC20Wrapper { private _proxyContract?: ERC20ProxyContract; private _proxyIdIfExists?: string; /** - * + * Instanitates an ERC20Wrapper * @param provider Web3 provider to use for all JSON RPC requests * @param tokenOwnerAddresses * @param contractOwnerAddress + * Instance of ERC20Wrapper */ constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) { this._dummyTokenContracts = []; -- cgit From 05ce0024352f2198a3744d62d9532a7e729ef5fa Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Aug 2018 12:53:27 -0700 Subject: Refactor DocGenerateAndUploadUtils to be a class, and decompose large methods for readability --- .../src/doc_generate_and_upload.ts | 5 +- packages/monorepo-scripts/src/publish.ts | 9 +- .../src/utils/doc_generate_and_upload_utils.ts | 761 ++++++++++++--------- 3 files changed, 427 insertions(+), 348 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index e0e7e1bb5..602247972 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -1,6 +1,6 @@ import * as yargs from 'yargs'; -import { generateAndUploadDocsAsync } from './utils/doc_generate_and_upload_utils'; +import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils'; const args = yargs .option('package', { @@ -19,5 +19,6 @@ const args = yargs const packageName = args.package; const isStaging = args.isStaging; - await generateAndUploadDocsAsync(packageName, isStaging); + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging); + await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); })(); diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index bb2dd60c1..6691fd3c1 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -13,9 +13,9 @@ import { constants } from './constants'; import { Package, PackageToNextVersion, VersionChangelog } from './types'; import { changelogUtils } from './utils/changelog_utils'; import { configs } from './utils/configs'; -import { utils } from './utils/utils'; +import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils'; import { publishReleaseNotesAsync } from './utils/github_release_utils'; -import { generateAndUploadDocsAsync } from './utils/doc_generate_and_upload_utils'; +import { utils } from './utils/utils'; const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; @@ -81,11 +81,12 @@ async function confirmAsync(message: string): Promise { process.exit(1); }); -async function generateAndUploadDocJsonsAsync(updatedPublicPackages: Package[], isStaging: boolean) { +async function generateAndUploadDocJsonsAsync(updatedPublicPackages: Package[], isStaging: boolean): Promise { for (const pkg of updatedPublicPackages) { const packageName = pkg.packageJson.name; const nameWithoutPrefix = packageName.replace('@0xproject/', ''); - await generateAndUploadDocsAsync(nameWithoutPrefix, isStaging); + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(nameWithoutPrefix, isStaging); + await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); } } 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 0d9c47932..a2902d1e4 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 @@ -6,391 +6,468 @@ import * as ts from 'typescript'; import { constants } from '../constants'; import { docGenConfigs } from '../doc_gen_configs'; -import { ExportInfo, ExportNameToTypedocNames, ExportPathToExportedItems } from '../types'; +import { ExportInfo, ExportNameToTypedocNames, ExportPathToExportedItems, PackageJSON } from '../types'; import { utils } from './utils'; -export async function generateAndUploadDocsAsync(packageName: string, isStaging: boolean): Promise { - const monorepoPackages = utils.getPackages(constants.monorepoRootPath); - const pkg = _.find(monorepoPackages, monorepoPackage => { - return _.includes(monorepoPackage.packageJson.name, packageName); - }); - if (_.isUndefined(pkg)) { - throw new Error(`Couldn't find a package.json for ${packageName}`); +export class DocGenerateAndUploadUtils { + private _isStaging: boolean; + private _packageName: string; + private _omitExports: string[]; + private _packagePath: string; + private _exportPathToExportedItems: ExportPathToExportedItems; + private _exportPathOrder: string[]; + private _monoRepoPkgNameToPath: { [name: string]: string }; + private _packageJson: PackageJSON; + /** + * Recursively iterate over the TypeDoc JSON object and find all type names + */ + private static _getAllTypeNames(node: any, typeNames: string[]): string[] { + if (!_.isObject(node)) { + return typeNames; + } + const typeKindStrings = ['Interface', 'Enumeration', 'Type alias']; + if (_.includes(typeKindStrings, node.kindString)) { + return [...typeNames, node.name]; + } + let updatedTypeNames = typeNames; + _.each(node, nodeValue => { + if (_.isArray(nodeValue)) { + _.each(nodeValue, aNode => { + updatedTypeNames = DocGenerateAndUploadUtils._getAllTypeNames(aNode, updatedTypeNames); + }); + } else if (_.isObject(nodeValue)) { + updatedTypeNames = DocGenerateAndUploadUtils._getAllTypeNames(nodeValue, updatedTypeNames); + } + }); + return updatedTypeNames; } + /** + * Recursively iterate over the TypeDoc JSON object and find all reference names (i.e types, classNames, + * objectLiteral names, etc...) + */ + private static _getAllReferenceNames(propertyName: string, node: any, referenceNames: string[]): string[] { + if (!_.isObject(node)) { + return referenceNames; + } - const packageJson = pkg.packageJson; - const omitExports = _.get(packageJson, 'config.postpublish.omitExports', []); + let updatedReferenceNames = referenceNames; + // Some nodes of type reference are for subtypes, which we don't want to return. + // We therefore filter them out. + const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites', 'extendedTypes']; + if ( + !_.isUndefined(node.type) && + _.isString(node.type) && + node.type === 'reference' && + _.isUndefined(node.typeArguments) && + !_.includes(SUB_TYPE_PROPERTY_NAMES, propertyName) + ) { + updatedReferenceNames = _.uniq([...referenceNames, node.name]); + return updatedReferenceNames; + } + _.each(node, (nodeValue, innerPropertyName) => { + if (_.isArray(nodeValue)) { + _.each(nodeValue, aNode => { + updatedReferenceNames = DocGenerateAndUploadUtils._getAllReferenceNames( + innerPropertyName, + aNode, + updatedReferenceNames, + ); + }); + } else if (_.isObject(nodeValue)) { + updatedReferenceNames = updatedReferenceNames = DocGenerateAndUploadUtils._getAllReferenceNames( + innerPropertyName, + nodeValue, + updatedReferenceNames, + ); + } + }); + return _.uniq(updatedReferenceNames); + } + private static _getExportPathToExportedItems(filePath: string, omitExports?: string[]): ExportInfo { + const sourceFile = ts.createSourceFile( + 'indexFile', + readFileSync(filePath).toString(), + ts.ScriptTarget.ES2017, + /*setParentNodes */ true, + ); + const exportPathToExportedItems: ExportPathToExportedItems = {}; + const exportPathOrder: string[] = []; + const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; - const pathToPackage = `${constants.monorepoRootPath}/packages/${packageName}`; - const indexPath = `${pathToPackage}/src/index.ts`; - const { exportPathToExportedItems, exportPathOrder } = getExportPathToExportedItems(indexPath, omitExports); + processNode(sourceFile); - const shouldPublishDocs = !!_.get(packageJson, 'config.postpublish.shouldPublishDocs'); - if (!shouldPublishDocs) { - utils.log( - `GENERATE_UPLOAD_DOCS: ${ - packageJson.name - } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, - ); - return; - } + function processNode(node: ts.Node): void { + switch (node.kind) { + case ts.SyntaxKind.ExportDeclaration: { + const exportClause = (node as any).exportClause; + const exportPath = exportClause.parent.moduleSpecifier.text; + _.each(exportClause.elements, element => { + const exportItem = element.name.escapedText; + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } + }); + if (!_.isUndefined(exportPathToExportedItems[exportPath])) { + exportPathOrder.push(exportPath); + } + break; + } - const pkgNameToPath: { [name: string]: string } = {}; - _.each(monorepoPackages, p => (pkgNameToPath[p.packageJson.name] = p.location)); + case ts.SyntaxKind.ExportKeyword: { + const foundNode: any = node; + let exportPath = './index'; + if (foundNode.parent && foundNode.parent.name) { + const exportItem = foundNode.parent.name.escapedText; + const isExportImportRequireStatement = !_.isUndefined( + _.get(foundNode, 'parent.moduleReference.expression.text'), + ); + if (isExportImportRequireStatement) { + exportPath = foundNode.parent.moduleReference.expression.text; + } + if (!_.includes(exportsToOmit, exportItem)) { + exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) + ? [exportItem] + : [...exportPathToExportedItems[exportPath], exportItem]; + } + } + if ( + !_.includes(exportPathOrder, exportPath) && + !_.isUndefined(exportPathToExportedItems[exportPath]) + ) { + exportPathOrder.push(exportPath); + } + break; + } + default: + // noop + break; + } - const externalExports: string[] = []; - // For each dep that is another one of our monorepo packages, we fetch it's index.ts - // and see which specific files we must pass to TypeDoc. - let typeDocExtraFileIncludes: string[] = []; - _.each(exportPathToExportedItems, (exportedItems, exportPath) => { - const isInternalToPkg = _.startsWith(exportPath, '.'); - if (isInternalToPkg) { - const pathToInternalPkg = path.join(pathToPackage, 'src', `${exportPath}.ts`); - typeDocExtraFileIncludes.push(pathToInternalPkg); - return; + ts.forEachChild(node, processNode); } + const exportInfo = { + exportPathToExportedItems, + exportPathOrder, + }; + return exportInfo; + } + constructor(packageName: string, isStaging: boolean) { + this._isStaging = isStaging; + this._packageName = packageName; + this._packagePath = `${constants.monorepoRootPath}/packages/${packageName}`; - const pathIfExists = pkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { - _.each(exportedItems, exportedItem => { - externalExports.push(exportedItem); - }); - return; // It's an external package - } + this._monoRepoPkgNameToPath = {}; + const monorepoPackages = utils.getPackages(constants.monorepoRootPath); + _.each(monorepoPackages, p => (this._monoRepoPkgNameToPath[p.packageJson.name] = p.location)); - const typeDocSourceIncludes = new Set(); - const pathToIndex = `${pathIfExists}/src/index.ts`; - const exportInfo = getExportPathToExportedItems(pathToIndex); - const innerExportPathToExportedItems = exportInfo.exportPathToExportedItems; - _.each(exportedItems, exportName => { - _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { - if (!_.includes(innerExportItems, exportName)) { - return; - } - if (!_.startsWith(innerExportPath, './')) { - throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is - itself exported from an external package. To fix this, export the external dependency directly, - not indirectly through ${innerExportPath}.`, - ); - } else { - const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); - typeDocSourceIncludes.add(absoluteSrcPath); - } - }); + const pkg = _.find(monorepoPackages, monorepoPackage => { + return _.includes(monorepoPackage.packageJson.name, packageName); }); - // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types - // directly, meaning no internal paths will exist to follow. Other packages also have direct exports - // in their index.ts, so we always add it to the source files passed to TypeDoc - if (typeDocSourceIncludes.size === 0) { - typeDocSourceIncludes.add(pathToIndex); + if (_.isUndefined(pkg)) { + throw new Error(`Couldn't find a package.json for ${packageName}`); } + this._packageJson = pkg.packageJson; + this._omitExports = _.get(this._packageJson, 'config.postpublish.omitExports', []); - typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; - }); - - // Generate Typedoc JSON file - typeDocExtraFileIncludes.push(path.join(pathToPackage, 'src', 'globals.d.ts')); - const jsonFilePath = path.join(pathToPackage, 'generated_docs', 'index.json'); - const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); - // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the - // packages root dir, does not work. It only works when called via a `package.json` script located - // in the package's root. - await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); + const indexPath = `${this._packagePath}/src/index.ts`; + const exportInfo = DocGenerateAndUploadUtils._getExportPathToExportedItems(indexPath, this._omitExports); + this._exportPathToExportedItems = exportInfo.exportPathToExportedItems; + this._exportPathOrder = exportInfo.exportPathOrder; - // Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed - // TypeDoc files outside of the packages root path (i.e this package exports another package found in our - // monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add - // it here when necessary. - const typedocOutputString = readFileSync(jsonFilePath).toString(); - const typedocOutput = JSON.parse(typedocOutputString); - const finalTypeDocOutput = _.clone(typedocOutput); - _.each(typedocOutput.children, (child, i) => { - if (!_.includes(child.name, '/src/')) { - const nameWithoutQuotes = child.name.replace(/"/g, ''); - const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; - finalTypeDocOutput.children[i].name = standardizedName; + const shouldPublishDocs = !!_.get(this._packageJson, 'config.postpublish.shouldPublishDocs'); + if (!shouldPublishDocs) { + utils.log( + `GENERATE_UPLOAD_DOCS: ${ + this._packageJson.name + } packageJson.config.postpublish.shouldPublishDocs is false. Skipping doc JSON generation.`, + ); + return; } - }); + } + public async generateAndUploadDocsAsync(): Promise { + // For each dep that is another one of our monorepo packages, we fetch it's index.ts + // and see which specific files we must pass to TypeDoc, in order to generate a Doc JSON + // the includes everything exported by the public interface. + const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(); - // For each entry, remove it if: - // - it was not exported in index.ts - // - the constructor is to be ignored - // - it begins with an underscore - const exportPathToTypedocNames: ExportNameToTypedocNames = {}; - _.each(typedocOutput.children, (file, i) => { - const exportPath = findExportPathGivenTypedocName(exportPathToExportedItems, packageName, file.name); - exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) - ? [file.name] - : [...exportPathToTypedocNames[exportPath], file.name]; + // In order to avoid TS errors, we need to pass TypeDoc the package's global.d.ts file + typeDocExtraFileIncludes.push(path.join(this._packagePath, 'src', 'globals.d.ts')); - const exportItems = exportPathToExportedItems[exportPath]; - _.each(file.children, (child, j) => { - if (!_.includes(exportItems, child.name)) { - delete finalTypeDocOutput.children[i].children[j]; - return; - } - const innerChildren = typedocOutput.children[i].children[j].children; - _.each(innerChildren, (innerChild, k) => { - const isHiddenConstructor = - child.kindString === 'Class' && - _.includes(docGenConfigs.CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && - innerChild.kindString === 'Constructor'; - const isPrivate = _.startsWith(innerChild.name, '_'); - if (isHiddenConstructor || isPrivate) { - delete finalTypeDocOutput.children[i].children[j].children[k]; - finalTypeDocOutput.children[i].children[j].children = _.compact( - finalTypeDocOutput.children[i].children[j].children, - ); - } - }); + const jsonFilePath = path.join(this._packagePath, 'generated_docs', 'index.json'); + const projectFiles = typeDocExtraFileIncludes.join(' '); + const cwd = path.join(constants.monorepoRootPath, 'packages', this._packageName); + // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the + // packages root dir, does not work. It only works when called via a `package.json` script located + // in the package's root. + await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, }); - finalTypeDocOutput.children[i].children = _.compact(finalTypeDocOutput.children[i].children); - }); - const allExportedItems = _.flatten(_.values(exportPathToExportedItems)); - const propertyName = ''; // Root has no property name - const referenceNamesWithDuplicates = getAllReferenceNames(propertyName, finalTypeDocOutput, []); - const referenceNames = _.uniq(referenceNamesWithDuplicates); + const typedocOutputString = readFileSync(jsonFilePath).toString(); + const typedocOutput = JSON.parse(typedocOutputString); + let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); + modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); - const exportedTypes = getAllTypeNames(finalTypeDocOutput, []); - const excessiveReferences = _.difference(exportedTypes, referenceNames); - if (!_.isEmpty(excessiveReferences)) { - throw new Error( - `${packageName} package exports BUT does not need: \n${excessiveReferences.join( - '\n', - )} \nin it\'s index.ts. Remove them then try again.`, - ); - } + const propertyName = ''; // Root has no property name + const referenceNames = DocGenerateAndUploadUtils._getAllReferenceNames(propertyName, modifiedTypedocOutput, []); + this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput); + this._lookForMissingReferenceExportsThrowIfExists(referenceNames); - const missingReferences: string[] = []; - _.each(referenceNames, referenceName => { - if ( - !_.includes(allExportedItems, referenceName) && - _.isUndefined(docGenConfigs.EXTERNAL_TYPE_TO_LINK[referenceName]) - ) { - missingReferences.push(referenceName); + // Some of our packages re-export external package exports in their index.ts + // Typedoc is incapable of rendering these packages, so we need to special-case them + const externalExportToLink: { [externalExport: string]: string } = {}; + const externalExportsWithoutLinks: string[] = []; + const externalExports: string[] = this._getAllExternalExports(); + _.each(externalExports, externalExport => { + const linkIfExists = docGenConfigs.EXTERNAL_EXPORT_TO_LINK[externalExport]; + if (_.isUndefined(linkIfExists)) { + externalExportsWithoutLinks.push(externalExport); + return; + } + externalExportToLink[externalExport] = linkIfExists; + }); + if (!_.isEmpty(externalExportsWithoutLinks)) { + throw new Error( + `Found the following external exports in ${ + this._packageName + }'s index.ts:\n ${externalExportsWithoutLinks.join( + '\n', + )}\nThey are missing from the EXTERNAL_EXPORT_TO_LINK mapping. Add them and try again.`, + ); } - }); - if (!_.isEmpty(missingReferences)) { - throw new Error( - `${packageName} package needs to export: \n${missingReferences.join( - '\n', - )} \nFrom it\'s index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, - ); - } - const externalExportToLink: { [externalExport: string]: string } = {}; - const externalExportsWithoutLinks: string[] = []; - _.each(externalExports, externalExport => { - const linkIfExists = docGenConfigs.EXTERNAL_EXPORT_TO_LINK[externalExport]; - if (_.isUndefined(linkIfExists)) { - externalExportsWithoutLinks.push(externalExport); - return; - } - externalExportToLink[externalExport] = linkIfExists; - }); - if (!_.isEmpty(externalExportsWithoutLinks)) { - throw new Error( - `Found the following external exports in ${packageName}'s index.ts:\n ${externalExportsWithoutLinks.join( - '\n', - )}\nThey are missing from the EXTERNAL_EXPORT_TO_LINK mapping. Add them and try again.`, - ); - } + const exportPathToTypedocNames: ExportNameToTypedocNames = {}; + _.each(modifiedTypedocOutput.children, file => { + const exportPath = this._findExportPathGivenTypedocName(file.name); + exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) + ? [file.name] + : [...exportPathToTypedocNames[exportPath], file.name]; + }); - // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON - const docJson = { - version: docGenConfigs.DOC_JSON_VERSION, - metadata: { - exportPathToTypedocNames, - exportPathOrder, - externalTypeToLink: docGenConfigs.EXTERNAL_TYPE_TO_LINK, - externalExportToLink, - }, - typedocJson: finalTypeDocOutput, - }; + // Since we need additional metadata included in the doc JSON, we nest the TypeDoc JSON + // within our own custom, versioned docsJson format. + const docJson = { + version: docGenConfigs.DOC_JSON_VERSION, + metadata: { + exportPathToTypedocNames, + exportPathOrder: this._exportPathOrder, + externalTypeToLink: docGenConfigs.EXTERNAL_TYPE_TO_LINK, + externalExportToLink, + }, + typedocJson: modifiedTypedocOutput, + }; + writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); - // Write modified TypeDoc JSON, without all the unexported stuff - writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); + const fileName = `v${this._packageJson.version}.json`; + utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); - const fileName = `v${packageJson.version}.json`; - utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); - const S3BucketPath = isStaging ? `s3://staging-doc-jsons/${packageName}/` : `s3://doc-jsons/${packageName}/`; - const s3Url = `${S3BucketPath}${fileName}`; - await execAsync( - `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, - { + const S3BucketPath = this._isStaging + ? `s3://staging-doc-jsons/${this._packageName}/` + : `s3://doc-jsons/${this._packageName}/`; + const s3Url = `${S3BucketPath}${fileName}`; + await execAsync( + `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, + { + cwd, + }, + ); + utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); + // Remove the generated docs directory + await execAsync(`rm -rf ${jsonFilePath}`, { cwd, - }, - ); - utils.log(`GENERATE_UPLOAD_DOCS: Docs uploaded to S3 bucket: ${S3BucketPath}`); - // Remove the generated docs directory - await execAsync(`rm -rf ${jsonFilePath}`, { - cwd, - }); -} - -function getAllTypeNames(node: any, typeNames: string[]): string[] { - if (!_.isObject(node)) { - return typeNames; + }); } - const typeKindStrings = ['Interface', 'Enumeration', 'Type alias']; - if (_.includes(typeKindStrings, node.kindString)) { - return [...typeNames, node.name]; + /** + * Look for types that are used by the public interface but are missing from a package's index.ts + */ + private _lookForMissingReferenceExportsThrowIfExists(referenceNames: string[]): void { + const allExportedItems = _.flatten(_.values(this._exportPathToExportedItems)); + const missingReferences: string[] = []; + _.each(referenceNames, referenceName => { + if ( + !_.includes(allExportedItems, referenceName) && + _.isUndefined(docGenConfigs.EXTERNAL_TYPE_TO_LINK[referenceName]) + ) { + missingReferences.push(referenceName); + } + }); + if (!_.isEmpty(missingReferences)) { + throw new Error( + `${this._packageName} package needs to export: \n${missingReferences.join( + '\n', + )} \nFrom it\'s index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, + ); + } } - let updatedTypeNames = typeNames; - _.each(node, nodeValue => { - if (_.isArray(nodeValue)) { - _.each(nodeValue, aNode => { - updatedTypeNames = getAllTypeNames(aNode, updatedTypeNames); - }); - } else if (_.isObject(nodeValue)) { - updatedTypeNames = getAllTypeNames(nodeValue, updatedTypeNames); + /** + * Look for exported types that are not used by the package's public interface + */ + private _lookForUnusedExportedTypesThrowIfExists(referenceNames: string[], typedocOutput: any): void { + const exportedTypes = DocGenerateAndUploadUtils._getAllTypeNames(typedocOutput, []); + const excessiveReferences = _.difference(exportedTypes, referenceNames); + if (!_.isEmpty(excessiveReferences)) { + throw new Error( + `${this._packageName} package exports BUT does not need: \n${excessiveReferences.join( + '\n', + )} \nin it\'s index.ts. Remove them then try again.`, + ); } - }); - return updatedTypeNames; -} + } + /** + * For each entry in the TypeDoc JSON, remove it if: + * - it was not exported in index.ts + * - the constructor is to be ignored + * - it begins with an underscore (i.e is private) + */ + private _pruneTypedocOutput(typedocOutput: any): any { + const modifiedTypedocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (file, i) => { + const exportPath = this._findExportPathGivenTypedocName(file.name); + const exportItems = this._exportPathToExportedItems[exportPath]; + _.each(file.children, (child, j) => { + const isNotExported = !_.includes(exportItems, child.name); + if (isNotExported) { + delete modifiedTypedocOutput.children[i].children[j]; + return; + } -function getAllReferenceNames(propertyName: string, node: any, referenceNames: string[]): string[] { - let updatedReferenceNames = referenceNames; - if (!_.isObject(node)) { - return updatedReferenceNames; + const innerChildren = typedocOutput.children[i].children[j].children; + _.each(innerChildren, (innerChild, k) => { + const isHiddenConstructor = + child.kindString === 'Class' && + _.includes(docGenConfigs.CLASSES_WITH_HIDDEN_CONSTRUCTORS, child.name) && + innerChild.kindString === 'Constructor'; + const isPrivate = _.startsWith(innerChild.name, '_'); + if (isHiddenConstructor || isPrivate) { + delete modifiedTypedocOutput.children[i].children[j].children[k]; + modifiedTypedocOutput.children[i].children[j].children = _.compact( + modifiedTypedocOutput.children[i].children[j].children, + ); + } + }); + }); + modifiedTypedocOutput.children[i].children = _.compact(modifiedTypedocOutput.children[i].children); + }); + return modifiedTypedocOutput; } - // Some nodes of type reference are for subtypes, which we don't want to return. - // We therefore filter them out. - const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites', 'extendedTypes']; - if ( - !_.isUndefined(node.type) && - _.isString(node.type) && - node.type === 'reference' && - _.isUndefined(node.typeArguments) && - !_.includes(SUB_TYPE_PROPERTY_NAMES, propertyName) - ) { - return [...referenceNames, node.name]; + /** + * Unfortunately TypeDoc children names will only be prefixed with the name of the package _if_ we passed + * TypeDoc files outside of the packages root path (i.e this package exports another package from our + * monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add + * them here when necessary. + */ + private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any): any { + const modifiedTypedocOutput = _.clone(typedocOutput); + _.each(typedocOutput.children, (child, i) => { + if (!_.includes(child.name, '/src/')) { + const nameWithoutQuotes = child.name.replace(/"/g, ''); + const standardizedName = `"${this._packageName}/src/${nameWithoutQuotes}"`; + modifiedTypedocOutput.children[i].name = standardizedName; + } + }); + return modifiedTypedocOutput; } - _.each(node, (nodeValue, innerPropertyName) => { - if (_.isArray(nodeValue)) { - _.each(nodeValue, aNode => { - updatedReferenceNames = getAllReferenceNames(innerPropertyName, aNode, updatedReferenceNames); - }); - } else if (_.isObject(nodeValue)) { - updatedReferenceNames = getAllReferenceNames(innerPropertyName, nodeValue, updatedReferenceNames); - } - }); - return updatedReferenceNames; -} - -function findExportPathGivenTypedocName( - exportPathToExportedItems: ExportPathToExportedItems, - packageName: string, - typedocName: string, -): string { - const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); - const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; - const exportPaths = _.keys(exportPathToExportedItems); - const sanitizedExportPaths = _.map(exportPaths, exportPath => { - if (_.startsWith(exportPath, './')) { - const sanitizedExportPath = path.join(packageName, 'src', exportPath); - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; - } - const monorepoPrefix = '@0xproject/'; - if (_.startsWith(exportPath, monorepoPrefix)) { - const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; - sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; - return sanitizedExportPath; + /** + * Maps back each top-level TypeDoc JSON object name to the exportPath from which it was generated. + */ + private _findExportPathGivenTypedocName(typedocName: string): string { + const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); + const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; + const exportPaths = _.keys(this._exportPathToExportedItems); + const sanitizedExportPaths = _.map(exportPaths, exportPath => { + if (_.startsWith(exportPath, './')) { + const sanitizedExportPath = path.join(this._packageName, 'src', exportPath); + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + const monorepoPrefix = '@0xproject/'; + if (_.startsWith(exportPath, monorepoPrefix)) { + const sanitizedExportPath = exportPath.split(monorepoPrefix)[1]; + sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; + return sanitizedExportPath; + } + sanitizedExportPathToExportPath[exportPath] = exportPath; + return exportPath; + }); + // We need to sort the exportPaths by length (longest first), so that the match finding will pick + // longer matches before shorter matches, since it might match both, but the longer match is more + // precisely what we are looking for. + const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => { + return b.length - a.length; + }); + const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => { + return _.startsWith(typeDocNameWithoutQuotes, p); + }); + if (_.isUndefined(matchingSanitizedExportPathIfExists)) { + throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); } - sanitizedExportPathToExportPath[exportPath] = exportPath; - return exportPath; - }); - // We need to sort the exportPaths by length (longest first), so that the match finding will pick - // longer matches before shorter matches, since it might match both, but the longer match is more - // precisely what we are looking for. - const sanitizedExportPathsSortedByLength = sanitizedExportPaths.sort((a: string, b: string) => { - return b.length - a.length; - }); - const matchingSanitizedExportPathIfExists = _.find(sanitizedExportPathsSortedByLength, p => { - return _.startsWith(typeDocNameWithoutQuotes, p); - }); - if (_.isUndefined(matchingSanitizedExportPathIfExists)) { - throw new Error(`Didn't find an exportPath for ${typeDocNameWithoutQuotes}`); + const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; + return matchingExportPath; } - const matchingExportPath = sanitizedExportPathToExportPath[matchingSanitizedExportPathIfExists]; - return matchingExportPath; -} - -function getExportPathToExportedItems(filePath: string, omitExports?: string[]): ExportInfo { - const sourceFile = ts.createSourceFile( - 'indexFile', - readFileSync(filePath).toString(), - ts.ScriptTarget.ES2017, - /*setParentNodes */ true, - ); - const exportInfo = _getExportPathToExportedItems(sourceFile, omitExports); - return exportInfo; -} - -function _getExportPathToExportedItems(sf: ts.SourceFile, omitExports?: string[]): ExportInfo { - const exportPathToExportedItems: ExportPathToExportedItems = {}; - const exportPathOrder: string[] = []; - const exportsToOmit = _.isUndefined(omitExports) ? [] : omitExports; - processNode(sf); - - function processNode(node: ts.Node): void { - switch (node.kind) { - case ts.SyntaxKind.ExportDeclaration: { - const exportClause = (node as any).exportClause; - const exportPath = exportClause.parent.moduleSpecifier.text; - _.each(exportClause.elements, element => { - const exportItem = element.name.escapedText; - if (!_.includes(exportsToOmit, exportItem)) { - exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) - ? [exportItem] - : [...exportPathToExportedItems[exportPath], exportItem]; - } + private _getAllExternalExports(): string[] { + const externalExports: string[] = []; + _.each(this._exportPathToExportedItems, (exportedItems, exportPath) => { + const pathIfExists = this._monoRepoPkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + _.each(exportedItems, exportedItem => { + externalExports.push(exportedItem); }); - if (!_.isUndefined(exportPathToExportedItems[exportPath])) { - exportPathOrder.push(exportPath); - } - break; + return; // It's an external package + } + }); + return externalExports; + } + private _getTypeDocFileIncludesForPackage(): string[] { + let typeDocExtraFileIncludes: string[] = []; + _.each(this._exportPathToExportedItems, (exportedItems, exportPath) => { + const isInternalToPkg = _.startsWith(exportPath, '.'); + if (isInternalToPkg) { + const pathToInternalPkg = path.join(this._packagePath, 'src', `${exportPath}.ts`); + typeDocExtraFileIncludes.push(pathToInternalPkg); + return; } - case ts.SyntaxKind.ExportKeyword: { - const foundNode: any = node; - let exportPath = './index'; - if (foundNode.parent && foundNode.parent.name) { - const exportItem = foundNode.parent.name.escapedText; - const isExportImportRequireStatement = !_.isUndefined( - _.get(foundNode, 'parent.moduleReference.expression.text'), - ); - if (isExportImportRequireStatement) { - exportPath = foundNode.parent.moduleReference.expression.text; + const pathIfExists = this._monoRepoPkgNameToPath[exportPath]; + if (_.isUndefined(pathIfExists)) { + return; // It's an external package + } + + const typeDocSourceIncludes = new Set(); + const pathToIndex = `${pathIfExists}/src/index.ts`; + const exportInfo = DocGenerateAndUploadUtils._getExportPathToExportedItems(pathToIndex); + const innerExportPathToExportedItems = exportInfo.exportPathToExportedItems; + _.each(exportedItems, exportName => { + _.each(innerExportPathToExportedItems, (innerExportItems, innerExportPath) => { + if (!_.includes(innerExportItems, exportName)) { + return; } - if (!_.includes(exportsToOmit, exportItem)) { - exportPathToExportedItems[exportPath] = _.isUndefined(exportPathToExportedItems[exportPath]) - ? [exportItem] - : [...exportPathToExportedItems[exportPath], exportItem]; + if (!_.startsWith(innerExportPath, './')) { + throw new Error( + `GENERATE_UPLOAD_DOCS: WARNING - ${ + this._packageName + } is exporting one of ${innerExportItems} which is + itself exported from an external package. To fix this, export the external dependency directly, + not indirectly through ${innerExportPath}.`, + ); + } else { + const absoluteSrcPath = path.join(pathIfExists, 'src', `${innerExportPath}.ts`); + typeDocSourceIncludes.add(absoluteSrcPath); } - } - if (!_.includes(exportPathOrder, exportPath) && !_.isUndefined(exportPathToExportedItems[exportPath])) { - exportPathOrder.push(exportPath); - } - break; + }); + }); + + // @0xproject/types & ethereum-types are examples of packages where their index.ts exports types + // directly, meaning no internal paths will exist to follow. Other packages also have direct exports + // in their index.ts, so we always add it to the source files passed to TypeDoc + if (typeDocSourceIncludes.size === 0) { + typeDocSourceIncludes.add(pathToIndex); } - default: - // noop - break; - } - ts.forEachChild(node, processNode); + typeDocExtraFileIncludes = [...typeDocExtraFileIncludes, ...Array.from(typeDocSourceIncludes)]; + }); + return typeDocExtraFileIncludes; } - const exportInfo = { - exportPathToExportedItems, - exportPathOrder, - }; - return exportInfo; } -- cgit From ea4d7f153aed24ca8ea136b6d0671c65462c915b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Aug 2018 14:12:04 -0700 Subject: Also ignore implementationOf --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a2902d1e4..ac4000461 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 @@ -54,7 +54,7 @@ export class DocGenerateAndUploadUtils { let updatedReferenceNames = referenceNames; // Some nodes of type reference are for subtypes, which we don't want to return. // We therefore filter them out. - const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites', 'extendedTypes']; + const SUB_TYPE_PROPERTY_NAMES = ['inheritedFrom', 'overwrites', 'extendedTypes', 'implementationOf']; if ( !_.isUndefined(node.type) && _.isString(node.type) && -- cgit From 0f7ced3625417f0de14d3158551971d1b558fa2e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Aug 2018 14:12:23 -0700 Subject: Make sure export isn't internal to the package --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ac4000461..c321aa823 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 @@ -411,7 +411,7 @@ export class DocGenerateAndUploadUtils { const externalExports: string[] = []; _.each(this._exportPathToExportedItems, (exportedItems, exportPath) => { const pathIfExists = this._monoRepoPkgNameToPath[exportPath]; - if (_.isUndefined(pathIfExists)) { + if (_.isUndefined(pathIfExists) && !_.startsWith(exportPath, './')) { _.each(exportedItems, exportedItem => { externalExports.push(exportedItem); }); -- cgit From fb637d92347917528e0955e291da5d07006f28e2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Aug 2018 16:09:04 -0700 Subject: Make sure we don't render protected properties --- packages/react-docs/src/utils/typedoc_utils.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 989485dfc..8ee76c98c 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -76,6 +76,9 @@ export class TypeDocUtils { public isProperty(entity: TypeDocNode): boolean { return entity.kindString === KindString.Property; } + public isUnderscorePrefixed(name: string): boolean { + return _.startsWith(name, '_'); + } public getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { const moduleDefinitions: TypeDocNode[] = []; const jsonModules = versionDocObj.children; @@ -189,8 +192,7 @@ export class TypeDocUtils { case KindString.Function: if (entity.flags.isExported) { const funcName = (entity as TypeDocNode).signatures[0].name; - const isPublicFunc = !_.startsWith(funcName, '_'); - if (isPublicFunc) { + if (!this.isUnderscorePrefixed(funcName)) { const func = this._convertFunction(entity, sectionName, isClassOrObjectLiteral); docSection.functions.push(func); } @@ -198,7 +200,7 @@ export class TypeDocUtils { break; case KindString.Method: - if (entity.flags.isPublic) { + if (entity.flags.isPublic && !this.isUnderscorePrefixed(entity.name)) { isConstructor = false; const method = this._convertMethod(entity, isConstructor, sectionName); docSection.methods.push(method); @@ -206,8 +208,10 @@ export class TypeDocUtils { break; case KindString.Property: { - const property = this._convertProperty(entity, sectionName); - docSection.properties.push(property); + if (!this.isUnderscorePrefixed(entity.name)) { + const property = this._convertProperty(entity, sectionName); + docSection.properties.push(property); + } break; } -- cgit From f29263c477dac0fb9f5dcbbafe1a053d0a3b1a0d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 20 Aug 2018 13:49:29 +0100 Subject: Cleanup contract-wrappers index.ts --- packages/contract-wrappers/src/index.ts | 50 +++++++++++++--------- .../contract-wrappers/test/erc20_wrapper_test.ts | 3 +- .../contract-wrappers/test/erc721_wrapper_test.ts | 2 +- .../test/ether_token_wrapper_test.ts | 3 +- .../test/exchange_wrapper_test.ts | 10 +---- .../test/forwarder_wrapper_test.ts | 10 +---- .../contract-wrappers/test/subscription_test.ts | 3 +- 7 files changed, 41 insertions(+), 40 deletions(-) diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 647636cb0..723df42fc 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -9,46 +9,56 @@ export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper'; export { ContractWrappersError, - EventCallback, - ContractEvent, - Token, IndexedFilterValues, BlockRange, - OrderFillRequest, ContractEventArgs, ContractWrappersConfig, MethodOpts, OrderTransactionOpts, TransactionOpts, - LogEvent, - DecodedLogEvent, - OnOrderStateChangeCallback, OrderStatus, OrderInfo, ContractEvents, } from './types'; -export { - Order, - SignedOrder, - ECSignature, - OrderStateValid, - OrderStateInvalid, - OrderState, - AssetProxyId, -} from '@0xproject/types'; +export { Order, SignedOrder, AssetProxyId } from '@0xproject/types'; export { BlockParamLiteral, - FilterObject, BlockParam, ContractEventArg, - LogWithDecodedArgs, Provider, - TransactionReceipt, - TransactionReceiptWithDecodedLogs, + ContractAbi, + LogEntry, + RawLog, + JSONRPCRequestPayload, + JSONRPCResponsePayload, + JSONRPCErrorCallback, + DecodedLogEntry, + LogEntryEvent, + AbiDefinition, + DecodedLogEntryEvent, + LogWithDecodedArgs, + FunctionAbi, + EventAbi, + EventParameter, + DecodedLogArgs, + MethodAbi, + ConstructorAbi, + FallbackAbi, + DataItem, + ConstructorStateMutability, + StateMutability, } from 'ethereum-types'; +export { + ContractArtifact, + GeneratedCompilerOptions, + ContractNetworks, + Source, + ContractNetworkData, +} from '@0xproject/sol-compiler'; + export { WETH9Events, WETH9WithdrawalEventArgs, diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts index cf7ac527e..fde587dec 100644 --- a/packages/contract-wrappers/test/erc20_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts @@ -11,12 +11,13 @@ import { BlockRange, ContractWrappers, ContractWrappersError, - DecodedLogEvent, ERC20TokenApprovalEventArgs, ERC20TokenEvents, ERC20TokenTransferEventArgs, } from '../src'; +import { DecodedLogEvent } from '../src/types'; + import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; import { tokenUtils } from './utils/token_utils'; diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts index f005ac2e0..ab6ff0984 100644 --- a/packages/contract-wrappers/test/erc721_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts @@ -11,12 +11,12 @@ import { BlockRange, ContractWrappers, ContractWrappersError, - DecodedLogEvent, ERC721TokenApprovalEventArgs, ERC721TokenApprovalForAllEventArgs, ERC721TokenEvents, ERC721TokenTransferEventArgs, } from '../src'; +import { DecodedLogEvent } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index 48bd6d3f6..c15b8c016 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -10,7 +10,6 @@ import { BlockRange, ContractWrappers, ContractWrappersError, - DecodedLogEvent, WETH9ApprovalEventArgs, WETH9DepositEventArgs, WETH9Events, @@ -18,6 +17,8 @@ import { WETH9WithdrawalEventArgs, } from '../src'; +import { DecodedLogEvent } from '../src/types'; + import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; import { tokenUtils } from './utils/token_utils'; diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts index fa3b49eb9..6762c1d43 100644 --- a/packages/contract-wrappers/test/exchange_wrapper_test.ts +++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts @@ -7,14 +7,8 @@ import * as chai from 'chai'; import { BlockParamLiteral } from 'ethereum-types'; import 'mocha'; -import { - ContractWrappers, - DecodedLogEvent, - ExchangeCancelEventArgs, - ExchangeEvents, - ExchangeFillEventArgs, - OrderStatus, -} from '../src'; +import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src'; +import { DecodedLogEvent } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; diff --git a/packages/contract-wrappers/test/forwarder_wrapper_test.ts b/packages/contract-wrappers/test/forwarder_wrapper_test.ts index 3f3b40e0b..d0b21225c 100644 --- a/packages/contract-wrappers/test/forwarder_wrapper_test.ts +++ b/packages/contract-wrappers/test/forwarder_wrapper_test.ts @@ -7,14 +7,8 @@ import * as chai from 'chai'; import { BlockParamLiteral } from 'ethereum-types'; import 'mocha'; -import { - ContractWrappers, - DecodedLogEvent, - ExchangeCancelEventArgs, - ExchangeEvents, - ExchangeFillEventArgs, - OrderStatus, -} from '../src'; +import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src'; +import { DecodedLogEvent } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts index 80d17576f..81b9012bd 100644 --- a/packages/contract-wrappers/test/subscription_test.ts +++ b/packages/contract-wrappers/test/subscription_test.ts @@ -5,7 +5,8 @@ import * as _ from 'lodash'; import 'mocha'; import * as Sinon from 'sinon'; -import { ContractWrappers, DecodedLogEvent, ERC20TokenApprovalEventArgs, ERC20TokenEvents, Token } from '../src'; +import { ContractWrappers, ERC20TokenApprovalEventArgs, ERC20TokenEvents } from '../src'; +import { DecodedLogEvent } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; -- cgit From d149b6cdecd1744af2671ff561d5b4b136334a24 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 20 Aug 2018 13:49:50 +0100 Subject: Cleanup connect index.ts --- packages/connect/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index 7f5eb8ed3..2ca5312fe 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -16,4 +16,4 @@ export { TokenTradeInfo, } from './types'; -export { Order, SignedOrder } from '@0xproject/types'; +export { SignedOrder } from '@0xproject/types'; -- cgit From b4cf69b02113a51af82b596f3931cb081edde7f4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 20 Aug 2018 13:50:28 +0100 Subject: Cleanup web3-wrapper and subproviders index.ts --- packages/subproviders/src/index.ts | 7 ++++--- packages/web3-wrapper/src/index.ts | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index eb9347bdb..b5f9b3f90 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -1,9 +1,9 @@ import Eth from '@ledgerhq/hw-app-eth'; import TransportU2F from '@ledgerhq/hw-transport-u2f'; -import { LedgerEthereumClient } from './types'; - export import Web3ProviderEngine = require('web3-provider-engine'); +import { LedgerEthereumClient } from './types'; + /** * A factory method for creating a LedgerEthereumClient usable in a browser context. * @return LedgerEthereumClient A browser client for the LedgerSubprovider @@ -38,12 +38,13 @@ export { NonceSubproviderErrors, LedgerSubproviderConfigs, PartialTxParams, - DerivedHDKeyInfo, JSONRPCRequestPayloadWithMethod, ECSignatureString, AccountFetchingConfigs, LedgerEthereumClientFactoryAsync, OnNextCompleted, + MnemonicWalletSubproviderConfigs, + LedgerGetAddressResult, } from './types'; export { ECSignature } from '@0xproject/types'; diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index dc708eb8c..7cdd25e55 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -1,6 +1,8 @@ export { Web3Wrapper } from './web3_wrapper'; export { marshaller } from './marshaller'; +export { AbiDecoder } from '@0xproject/utils'; + export { BlockParam, TxData, @@ -18,18 +20,35 @@ export { LogTopic, JSONRPCRequestPayload, TransactionReceiptStatus, - LogWithDecodedArgs, DecodedLogArgs, StructLog, JSONRPCErrorCallback, BlockParamLiteral, + ContractEventArg, + DecodedLogEntry, + LogEntryEvent, + OpCode, + TxDataPayable, + JSONRPCResponsePayload, + RawLogEntry, + DecodedLogEntryEvent, + LogWithDecodedArgs, + AbiDefinition, + RawLog, + FunctionAbi, + EventAbi, + EventParameter, + MethodAbi, + ConstructorAbi, + FallbackAbi, + DataItem, + ConstructorStateMutability, + StateMutability, } from 'ethereum-types'; export { Web3WrapperErrors, NodeType, CallDataRPC, - CallTxDataBaseRPC, - AbstractBlockRPC, BlockWithoutTransactionDataRPC, BlockWithTransactionDataRPC, TransactionRPC, -- cgit From b67677f47695b2e24887d0e23ca74432f063bd4f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 20 Aug 2018 13:51:23 +0100 Subject: Fix website given that it still depends on an old version of @0xproject/Types --- packages/website/ts/utils/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 32b07473c..39bbd404c 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -247,9 +247,12 @@ export const utils = { } = { [ExchangeContractErrs.OrderFillExpired]: 'This order has expired', [ExchangeContractErrs.OrderCancelExpired]: 'This order has expired', - [ExchangeContractErrs.OrderCancelled]: 'This order has been cancelled', + [ExchangeContractErrs.OrderCancelAmountZero]: "Order cancel amount can't be 0", + [ExchangeContractErrs.OrderAlreadyCancelledOrFilled]: + 'This order has already been completely filled or cancelled', [ExchangeContractErrs.OrderFillAmountZero]: "Order fill amount can't be 0", - [ExchangeContractErrs.OrderRemainingFillAmountZero]: 'This order has already been completely filled', + [ExchangeContractErrs.OrderRemainingFillAmountZero]: + 'This order has already been completely filled or cancelled', [ExchangeContractErrs.OrderFillRoundingError]: 'Rounding error will occur when filling this order. Please try filling a different amount.', [ExchangeContractErrs.InsufficientTakerBalance]: -- cgit From e7c7af8ef4ffb5dc3f1cbe468d272f4b9424fdc7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 11:15:59 +0100 Subject: Add more types and ignores to docGenConfigs --- packages/monorepo-scripts/src/doc_gen_configs.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index fd95863c3..41142d9c8 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -11,10 +11,13 @@ export const docGenConfigs: DocGenConfigs = { 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', 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', + 'Ganache.GanacheOpts': + 'https://github.com/0xProject/0x-monorepo/blob/ddf85112d7e4eb1581e0d82ce6eedad429641106/packages/typescript-typings/types/ganache-core/index.d.ts#L3', + 'lightwallet.keystore': + 'https://github.com/0xProject/0x-monorepo/blob/ddf85112d7e4eb1581e0d82ce6eedad429641106/packages/typescript-typings/types/eth-lightwallet/index.d.ts#L32', }, - /** - * If a 0x package re-exports an external package, we should add a link to it's exported items here - */ + // If a 0x package re-exports an external package, we should add a link to it's exported items here EXTERNAL_EXPORT_TO_LINK: { Web3ProviderEngine: 'https://www.npmjs.com/package/web3-provider-engine', BigNumber: 'https://www.npmjs.com/package/bignumber.js', @@ -30,4 +33,8 @@ export const docGenConfigs: DocGenConfigs = { 'ExchangeWrapper', 'ForwarderWrapper', ], + // 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'], }; -- cgit From 635373febb6e6d24a08549b2eb0db29a3d7619e6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 11:17:12 +0100 Subject: Implement ignoring config types --- packages/monorepo-scripts/src/types.ts | 1 + .../monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index 5f6a6c707..9b6846f02 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -55,6 +55,7 @@ export interface DocGenConfigs { EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string }; EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string }; CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[]; + IGNORED_EXCESSIVE_TYPES: string[]; } export interface ExportPathToExportedItems { 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 c321aa823..e9586e68b 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 @@ -308,9 +308,13 @@ export class DocGenerateAndUploadUtils { private _lookForUnusedExportedTypesThrowIfExists(referenceNames: string[], typedocOutput: any): void { const exportedTypes = DocGenerateAndUploadUtils._getAllTypeNames(typedocOutput, []); const excessiveReferences = _.difference(exportedTypes, referenceNames); - if (!_.isEmpty(excessiveReferences)) { + const excessiveReferencesExceptIgnored = _.difference( + excessiveReferences, + docGenConfigs.IGNORED_EXCESSIVE_TYPES, + ); + if (!_.isEmpty(excessiveReferencesExceptIgnored)) { throw new Error( - `${this._packageName} package exports BUT does not need: \n${excessiveReferences.join( + `${this._packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join( '\n', )} \nin it\'s index.ts. Remove them then try again.`, ); -- cgit From 1f65de60b4790a4602cddd74036a39e0dc87c314 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 11:18:12 +0100 Subject: Move sol-compiler dep to `dependencies` now that types from it are exported in index.ts --- packages/contract-wrappers/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 401157dff..ffd4345f4 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -48,7 +48,6 @@ "@0xproject/abi-gen": "^1.0.5", "@0xproject/dev-utils": "^1.0.4", "@0xproject/migrations": "^1.0.4", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/subproviders": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", "@types/lodash": "4.14.104", @@ -81,6 +80,7 @@ "@0xproject/fill-scenarios": "^1.0.1-rc.3", "@0xproject/json-schemas": "^1.0.1-rc.4", "@0xproject/order-utils": "^1.0.1-rc.3", + "@0xproject/sol-compiler": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", -- cgit From ab7d083aa53f69d98c59529cb708815bf013aa6c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 15:39:39 +0100 Subject: Add missing key --- packages/react-docs/src/components/documentation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 43a1f746e..0adadb30b 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -316,7 +316,7 @@ export class Documentation extends React.Component { return ( -
+
{`import { `} -- cgit From 141c51eaf5cbfdb3a177d257b5f72634cc5f7759 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 16:35:13 +0100 Subject: Add missing exports to 0x.js and contract-wrappers index.ts --- packages/0x.js/src/index.ts | 2 ++ packages/contract-wrappers/src/index.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index efcb4344a..748662c39 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -41,6 +41,8 @@ export { ExchangeEventArgs, ExchangeEvents, ContractEvents, + EventCallback, + DecodedLogEvent, } from '@0xproject/contract-wrappers'; export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 723df42fc..f7c10dcce 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -19,6 +19,8 @@ export { OrderStatus, OrderInfo, ContractEvents, + EventCallback, + DecodedLogEvent, } from './types'; export { Order, SignedOrder, AssetProxyId } from '@0xproject/types'; -- cgit From 151cf03f5b697ee757ca3c2a44c5e59e3c2fe09c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 16:35:39 +0100 Subject: Add link to Array type --- packages/monorepo-scripts/src/doc_gen_configs.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 41142d9c8..83fae1e7c 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -3,6 +3,7 @@ import { DocGenConfigs } from './types'; export const docGenConfigs: DocGenConfigs = { DOC_JSON_VERSION: '0.0.1', EXTERNAL_TYPE_TO_LINK: { + Array: 'https://developer.mozilla.org/pt-PT/docs/Web/JavaScript/Reference/Global_Objects/Array', BigNumber: 'http://mikemcl.github.io/bignumber.js', Error: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error', Buffer: 'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v9/index.d.ts#L262', -- cgit From c52c94214f9eb9ba25edc5e4599048663cd9cfa1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 16:36:48 +0100 Subject: Rather then look for typeArguments, we want to ignore Partial & Promise references, but still continue to search below them, as they might surround a type --- packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 e9586e68b..adb898628 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 @@ -59,7 +59,8 @@ export class DocGenerateAndUploadUtils { !_.isUndefined(node.type) && _.isString(node.type) && node.type === 'reference' && - _.isUndefined(node.typeArguments) && + node.name !== 'Partial' && + node.name !== 'Promise' && !_.includes(SUB_TYPE_PROPERTY_NAMES, propertyName) ) { updatedReferenceNames = _.uniq([...referenceNames, node.name]); -- cgit From 7553411fb2c0483e08046a85cc3b694e2063cbfd Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 16:37:03 +0100 Subject: Fix up order-utils --- packages/order-utils/src/index.ts | 14 ++++++++++++-- packages/order-utils/src/market_utils.ts | 11 ++++++++--- packages/order-utils/src/types.ts | 10 ++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 1f393b0c4..354299304 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -9,14 +9,16 @@ export { sortingUtils } from './sorting_utils'; export { OrderStateUtils } from './order_state_utils'; export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher'; +export { AbstractBalanceAndProxyAllowanceLazyStore } from './abstract/abstract_balance_and_proxy_allowance_lazy_store'; export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher'; +export { AbstractOrderFilledCancelledLazyStore } from './abstract/abstract_order_filled_cancelled_lazy_store'; export { OrderValidationUtils } from './order_validation_utils'; 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 { Provider } from 'ethereum-types'; +export { Provider, JSONRPCRequestPayload, JSONRPCErrorCallback, JSONRPCResponsePayload } from 'ethereum-types'; export { SignedOrder, Order, @@ -26,13 +28,21 @@ export { ERC20AssetData, ERC721AssetData, AssetProxyId, + SignerType, + SignatureType, + OrderStateValid, + OrderStateInvalid, + ExchangeContractErrs, } from '@0xproject/types'; export { - CreateOrderOpts, OrderError, EIP712Parameter, EIP712Schema, EIP712Types, TradeSide, TransferType, + FindFeeOrdersThatCoverFeesForTargetOrdersOpts, + FindOrdersThatCoverMakerAssetFillAmountOpts, + FeeOrdersAndRemainingFeeAmount, + OrdersAndRemainingFillAmount, } from './types'; diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts index a0a827546..b3f302dd2 100644 --- a/packages/order-utils/src/market_utils.ts +++ b/packages/order-utils/src/market_utils.ts @@ -5,7 +5,12 @@ import * as _ from 'lodash'; import { assert } from './assert'; import { constants } from './constants'; -import { FindFeeOrdersThatCoverFeesForTargetOrdersOpts, FindOrdersThatCoverMakerAssetFillAmountOpts } from './types'; +import { + FindFeeOrdersThatCoverFeesForTargetOrdersOpts, + FindOrdersThatCoverMakerAssetFillAmountOpts, + FeeOrdersAndRemainingFeeAmount, + OrdersAndRemainingFillAmount, +} from './types'; export const marketUtils = { /** @@ -22,7 +27,7 @@ export const marketUtils = { orders: T[], makerAssetFillAmount: BigNumber, opts?: FindOrdersThatCoverMakerAssetFillAmountOpts, - ): { resultOrders: T[]; remainingFillAmount: BigNumber } { + ): OrdersAndRemainingFillAmount { assert.doesConformToSchema('orders', orders, schemas.ordersSchema); assert.isValidBaseUnitAmount('makerAssetFillAmount', makerAssetFillAmount); // try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders @@ -84,7 +89,7 @@ export const marketUtils = { orders: T[], feeOrders: T[], opts?: FindFeeOrdersThatCoverFeesForTargetOrdersOpts, - ): { resultOrders: T[]; remainingFeeAmount: BigNumber } { + ): FeeOrdersAndRemainingFeeAmount { assert.doesConformToSchema('orders', orders, schemas.ordersSchema); assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema); // try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders diff --git a/packages/order-utils/src/types.ts b/packages/order-utils/src/types.ts index 2e9c79d80..4088805dc 100644 --- a/packages/order-utils/src/types.ts +++ b/packages/order-utils/src/types.ts @@ -69,3 +69,13 @@ export interface FindFeeOrdersThatCoverFeesForTargetOrdersOpts { remainingFillableFeeAmounts?: BigNumber[]; slippageBufferAmount?: BigNumber; } + +export interface FeeOrdersAndRemainingFeeAmount { + resultOrders: T[]; + remainingFeeAmount: BigNumber; +} + +export interface OrdersAndRemainingFillAmount { + resultOrders: T[]; + remainingFillAmount: BigNumber; +} -- cgit From a7468eb858bc730d4b7ca92260314cfa0c51416b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:16:00 +0100 Subject: Don't check if types are used for libraries only include types --- packages/monorepo-scripts/src/doc_gen_configs.ts | 3 +++ .../monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 83fae1e7c..52cbc4f59 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -38,4 +38,7 @@ export const docGenConfigs: DocGenConfigs = { // 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'], + // 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/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts index adb898628..cc4d70d63 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 @@ -212,10 +212,16 @@ export class DocGenerateAndUploadUtils { let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); + if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, this._packageName)) { const propertyName = ''; // Root has no property name - const referenceNames = DocGenerateAndUploadUtils._getAllReferenceNames(propertyName, modifiedTypedocOutput, []); + const referenceNames = DocGenerateAndUploadUtils._getAllReferenceNames( + propertyName, + modifiedTypedocOutput, + [], + ); this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput); this._lookForMissingReferenceExportsThrowIfExists(referenceNames); + } // Some of our packages re-export external package exports in their index.ts // Typedoc is incapable of rendering these packages, so we need to special-case them -- cgit From 1ddac0bc7b21971698a7b70f47fdfabde2335505 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:16:16 +0100 Subject: Fix type --- packages/monorepo-scripts/src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index 9b6846f02..3c2ec5069 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -56,6 +56,7 @@ export interface DocGenConfigs { EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string }; CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[]; IGNORED_EXCESSIVE_TYPES: string[]; + TYPES_ONLY_LIBRARIES: string[]; } export interface ExportPathToExportedItems { -- cgit From ad9bb3ea59bcedb420830e23f5a9874475c86016 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:16:24 +0100 Subject: Fix order-watcher index.ts --- packages/order-watcher/src/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/order-watcher/src/index.ts b/packages/order-watcher/src/index.ts index 5f84554c8..8efca6217 100644 --- a/packages/order-watcher/src/index.ts +++ b/packages/order-watcher/src/index.ts @@ -1,8 +1,14 @@ export { OrderWatcher } from './order_watcher/order_watcher'; -export { OrderStateValid, OrderStateInvalid, OrderState } from '@0xproject/types'; +export { + OrderStateValid, + OrderStateInvalid, + OrderState, + ExchangeContractErrs, + OrderRelevantState, +} from '@0xproject/types'; export { OnOrderStateChangeCallback, OrderWatcherConfig } from './types'; -export { Order, SignedOrder } from '@0xproject/types'; -export { BlockParamLiteral, BlockParam, Provider } from 'ethereum-types'; +export { SignedOrder } from '@0xproject/types'; +export { JSONRPCRequestPayload, JSONRPCErrorCallback, Provider, JSONRPCResponsePayload } from 'ethereum-types'; -- cgit From 04bbd60c119b44b03eee3f6ab4459c3bfb7f283c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:16:34 +0100 Subject: Fix sol-compiler index.ts --- packages/sol-compiler/src/index.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index fe72a37d6..570de931b 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,11 +1,3 @@ export { Compiler } from './compiler'; -export { - CompilerOptions, - ContractArtifact, - ContractNetworks, - GeneratedCompilerOptions, - ContractNetworkData, - ContractVersionData, - Source, -} from './utils/types'; +export { CompilerOptions } from './utils/types'; -- cgit From cc90c806b09a83330c20816d1e7756f5c74e33d0 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:16:42 +0100 Subject: Fix sol-cov index.ts --- packages/sol-cov/src/index.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index dd102a13b..cb9e108fb 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -7,15 +7,14 @@ export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_a export { ProfilerSubprovider } from './profiler_subprovider'; export { RevertTraceSubprovider } from './revert_trace_subprovider'; +export { ContractData, TraceInfo, Subtrace, TraceInfoNewContract, TraceInfoExistingContract } from './types'; export { - ContractData, - TraceInfo, - Subtrace, - SourceRange, - Coverage, - TraceInfoNewContract, - TraceInfoExistingContract, - SingleFileSourceRange, -} from './types'; -export { StructLog, JSONRPCRequestPayload, Provider } from 'ethereum-types'; -export { ErrorCallback, NextCallback } from '@0xproject/subproviders'; + StructLog, + JSONRPCRequestPayload, + Provider, + JSONRPCErrorCallback, + OpCode, + JSONRPCResponsePayload, +} from 'ethereum-types'; + +export { JSONRPCRequestPayloadWithMethod } from '@0xproject/subproviders'; -- cgit From c00c477307e305e2d380779bb74fa29b31072c4c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:39:35 +0100 Subject: Add doc comments to AbiDecoder --- packages/utils/src/abi_decoder.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 7f93e746e..58a58dea2 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -15,12 +15,25 @@ import * as _ from 'lodash'; import { addressUtils } from './address_utils'; import { BigNumber } from './configured_bignumber'; +/** + * AbiDecoder allows you to decode event logs given a set of supplied contract ABI's. It takes the contract's event + * signature from the ABI and attempts to decode the logs using it. + */ export class AbiDecoder { private readonly _methodIds: { [signatureHash: string]: EventAbi } = {}; + /** + * Instantiate an AbiDecoder + * @param abiArrays An array of contract ABI's + * @return AbiDecoder instance + */ constructor(abiArrays: AbiDefinition[][]) { _.forEach(abiArrays, this.addABI.bind(this)); } - // This method can only decode logs from the 0x & ERC20 smart contracts + /** + * Attempt to decode a log given the ABI's the AbiDecoder knows about. + * @param log The log to attempt to decode + * @return The decoded log if the requisite ABI was available. Otherwise the log unaltered. + */ public tryToDecodeLogOrNoop(log: LogEntry): LogWithDecodedArgs | RawLog { const methodId = log.topics[0]; const event = this._methodIds[methodId]; @@ -75,6 +88,10 @@ export class AbiDecoder { }; } } + /** + * Add additional ABI definitions to the AbiDecoder + * @param abiArray An array of ABI definitions to add to the AbiDecoder + */ public addABI(abiArray: AbiDefinition[]): void { if (_.isUndefined(abiArray)) { return; -- cgit From 809d301d582a01ff70958f380a7f8c4afe898366 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 17:48:24 +0100 Subject: Fix lowercase names involving ERC acronym --- packages/react-docs/src/utils/typedoc_utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 8ee76c98c..0eaf5fd6e 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -374,11 +374,17 @@ export class TypeDocUtils { if (isConstructor || entityName === '__type') { callPath = ''; } else { - const prefix = isStatic ? sectionName : `${sectionName[0].toLowerCase()}${sectionName.slice(1)}`; + const prefix = isStatic ? sectionName : this._getLowercaseSectionName(sectionName); callPath = `${prefix}.`; } return callPath; } + private _getLowercaseSectionName(sectionName: string) { + if (_.startsWith(sectionName, 'ERC')) { + return `${sectionName.slice(0, 3).toLowerCase()}${sectionName.slice(3)}`; + } + return `${sectionName[0].toLowerCase()}${sectionName.slice(1)}`; + } private _convertFunction(entity: TypeDocNode, sectionName: string, isObjectLiteral: boolean): TypescriptFunction { const signature = entity.signatures[0]; const source = entity.sources[0]; -- cgit From 8bb7b5b543c4d914067b6bbb269be9cc2ac7f647 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 18:49:56 +0100 Subject: Add shouldUpload flag to docGenAndUpload command --- packages/monorepo-scripts/src/doc_generate_and_upload.ts | 9 ++++++++- .../monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index 602247972..77dc2f323 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -13,12 +13,19 @@ const args = yargs type: 'boolean', demandOption: true, }) + .option('shouldUpload', { + describe: 'Whether we wish to upload the docs to S3 or not', + type: 'boolean', + demandOption: false, + default: true, + }) .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; (async () => { const packageName = args.package; const isStaging = args.isStaging; + const shouldUploadDocs = args.shouldUpload; - const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging); + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging, shouldUploadDocs); await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); })(); 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 cc4d70d63..7e8bd07da 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 @@ -12,6 +12,7 @@ import { utils } from './utils'; export class DocGenerateAndUploadUtils { private _isStaging: boolean; + private _shouldUploadDocs: boolean; private _packageName: string; private _omitExports: string[]; private _packagePath: string; @@ -155,9 +156,10 @@ export class DocGenerateAndUploadUtils { }; return exportInfo; } - constructor(packageName: string, isStaging: boolean) { + constructor(packageName: string, isStaging: boolean, shouldUploadDocs: boolean) { this._isStaging = isStaging; this._packageName = packageName; + this._shouldUploadDocs = shouldUploadDocs; this._packagePath = `${constants.monorepoRootPath}/packages/${packageName}`; this._monoRepoPkgNameToPath = {}; @@ -268,6 +270,11 @@ export class DocGenerateAndUploadUtils { }; writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); + if (this._shouldUploadDocs) { + await this._uploadDocsAsync(jsonFilePath, cwd); + } + } + private async _uploadDocsAsync(jsonFilePath: string, cwd: string) { const fileName = `v${this._packageJson.version}.json`; utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); -- cgit From 6b838c034a3a489ae0b962af820270eafc52c377 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 19:07:20 +0100 Subject: Modify script so it can generate docs for a specific package or all packages with doc pages, add doc gen test to CircleCi runs --- packages/monorepo-scripts/src/doc_gen_configs.ts | 14 ++++ .../src/doc_generate_and_upload.ts | 9 +-- packages/monorepo-scripts/src/types.ts | 1 + .../src/utils/doc_generate_and_upload_utils.ts | 81 ++++++++++++---------- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 52cbc4f59..a7314776e 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -2,6 +2,20 @@ import { DocGenConfigs } from './types'; export const docGenConfigs: DocGenConfigs = { DOC_JSON_VERSION: '0.0.1', + // Packages for which doc pages exist + PACKAGES_WITH_DOC_PAGES: [ + '0x.js', + 'connect', + 'json-schemas', + 'subproviders', + 'web3-wrapper', + 'contract-wrappers', + 'order-utils', + 'order-watcher', + 'sol-compiler', + 'sol-cov', + 'ethereum-types', + ]; EXTERNAL_TYPE_TO_LINK: { Array: 'https://developer.mozilla.org/pt-PT/docs/Web/JavaScript/Reference/Global_Objects/Array', BigNumber: 'http://mikemcl.github.io/bignumber.js', diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index 77dc2f323..7b6f2d9f0 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -4,9 +4,10 @@ import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils const args = yargs .option('package', { - describe: 'Monorepo sub-package for which to generate DocJSON', + describe: + 'Monorepo sub-package for which to generate DocJSON. If not supplied, it will do all defined in docGenConfigs.', type: 'string', - demandOption: true, + demandOption: false, }) .option('isStaging', { describe: 'Whether we wish to publish docs to staging or production', @@ -22,10 +23,10 @@ const args = yargs .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; (async () => { - const packageName = args.package; + const packageNameIfExists = args.package; const isStaging = args.isStaging; const shouldUploadDocs = args.shouldUpload; - const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging, shouldUploadDocs); + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageNameIfExists, isStaging, shouldUploadDocs); await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); })(); diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index 3c2ec5069..b87cc47eb 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -52,6 +52,7 @@ export interface Package { export interface DocGenConfigs { DOC_JSON_VERSION: string; + PACKAGES_WITH_DOC_PAGES: string[]; EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string }; EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string }; CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[]; 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 7e8bd07da..c84413e64 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 @@ -13,7 +13,7 @@ import { utils } from './utils'; export class DocGenerateAndUploadUtils { private _isStaging: boolean; private _shouldUploadDocs: boolean; - private _packageName: string; + private _packageNameIfExists: string; private _omitExports: string[]; private _packagePath: string; private _exportPathToExportedItems: ExportPathToExportedItems; @@ -156,21 +156,21 @@ export class DocGenerateAndUploadUtils { }; return exportInfo; } - constructor(packageName: string, isStaging: boolean, shouldUploadDocs: boolean) { + constructor(packageNameIfExists: string, isStaging: boolean, shouldUploadDocs: boolean) { this._isStaging = isStaging; - this._packageName = packageName; + this._packageNameIfExists = packageNameIfExists; this._shouldUploadDocs = shouldUploadDocs; - this._packagePath = `${constants.monorepoRootPath}/packages/${packageName}`; + this._packagePath = `${constants.monorepoRootPath}/packages/${packageNameIfExists}`; this._monoRepoPkgNameToPath = {}; const monorepoPackages = utils.getPackages(constants.monorepoRootPath); _.each(monorepoPackages, p => (this._monoRepoPkgNameToPath[p.packageJson.name] = p.location)); const pkg = _.find(monorepoPackages, monorepoPackage => { - return _.includes(monorepoPackage.packageJson.name, packageName); + return _.includes(monorepoPackage.packageJson.name, packageNameIfExists); }); if (_.isUndefined(pkg)) { - throw new Error(`Couldn't find a package.json for ${packageName}`); + throw new Error(`Couldn't find a package.json for ${packageNameIfExists}`); } this._packageJson = pkg.packageJson; this._omitExports = _.get(this._packageJson, 'config.postpublish.omitExports', []); @@ -191,17 +191,26 @@ export class DocGenerateAndUploadUtils { } } public async generateAndUploadDocsAsync(): Promise { + if (!_.isUndefined(this._packageNameIfExists)) { + await this.generateAndUploadDocsForPackageAsync(this._packageNameIfExists); + } else { + for (const packageName of docGenConfigs.PACKAGES_WITH_DOC_PAGES) { + await this.generateAndUploadDocsForPackageAsync(packageName); + } + } + } + private async generateAndUploadDocsForPackageAsync(packageName: string): Promise { // For each dep that is another one of our monorepo packages, we fetch it's index.ts // and see which specific files we must pass to TypeDoc, in order to generate a Doc JSON // the includes everything exported by the public interface. - const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(); + const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(packageName); // In order to avoid TS errors, we need to pass TypeDoc the package's global.d.ts file typeDocExtraFileIncludes.push(path.join(this._packagePath, 'src', 'globals.d.ts')); const jsonFilePath = path.join(this._packagePath, 'generated_docs', 'index.json'); const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages', this._packageName); + const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the // packages root dir, does not work. It only works when called via a `package.json` script located // in the package's root. @@ -211,18 +220,18 @@ export class DocGenerateAndUploadUtils { const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); - let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); - modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); + let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput, packageName); + modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput, packageName); - if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, this._packageName)) { - const propertyName = ''; // Root has no property name + if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, packageName)) { + const propertyName = ''; // Root has no property name const referenceNames = DocGenerateAndUploadUtils._getAllReferenceNames( propertyName, modifiedTypedocOutput, [], ); - this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput); - this._lookForMissingReferenceExportsThrowIfExists(referenceNames); + this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput, packageName); + this._lookForMissingReferenceExportsThrowIfExists(referenceNames, packageName); } // Some of our packages re-export external package exports in their index.ts @@ -240,9 +249,7 @@ export class DocGenerateAndUploadUtils { }); if (!_.isEmpty(externalExportsWithoutLinks)) { throw new Error( - `Found the following external exports in ${ - this._packageName - }'s index.ts:\n ${externalExportsWithoutLinks.join( + `Found the following external exports in ${packageName}'s index.ts:\n ${externalExportsWithoutLinks.join( '\n', )}\nThey are missing from the EXTERNAL_EXPORT_TO_LINK mapping. Add them and try again.`, ); @@ -250,7 +257,7 @@ export class DocGenerateAndUploadUtils { const exportPathToTypedocNames: ExportNameToTypedocNames = {}; _.each(modifiedTypedocOutput.children, file => { - const exportPath = this._findExportPathGivenTypedocName(file.name); + const exportPath = this._findExportPathGivenTypedocName(file.name, packageName); exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) ? [file.name] : [...exportPathToTypedocNames[exportPath], file.name]; @@ -271,16 +278,16 @@ export class DocGenerateAndUploadUtils { writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); if (this._shouldUploadDocs) { - await this._uploadDocsAsync(jsonFilePath, cwd); + await this._uploadDocsAsync(jsonFilePath, cwd, packageName); } } - private async _uploadDocsAsync(jsonFilePath: string, cwd: string) { + private async _uploadDocsAsync(jsonFilePath: string, cwd: string, packageName: string) { const fileName = `v${this._packageJson.version}.json`; utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); const S3BucketPath = this._isStaging - ? `s3://staging-doc-jsons/${this._packageName}/` - : `s3://doc-jsons/${this._packageName}/`; + ? `s3://staging-doc-jsons/${packageName}/` + : `s3://doc-jsons/${packageName}/`; const s3Url = `${S3BucketPath}${fileName}`; await execAsync( `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, @@ -297,7 +304,7 @@ export class DocGenerateAndUploadUtils { /** * Look for types that are used by the public interface but are missing from a package's index.ts */ - private _lookForMissingReferenceExportsThrowIfExists(referenceNames: string[]): void { + private _lookForMissingReferenceExportsThrowIfExists(referenceNames: string[], packageName: string): void { const allExportedItems = _.flatten(_.values(this._exportPathToExportedItems)); const missingReferences: string[] = []; _.each(referenceNames, referenceName => { @@ -310,7 +317,7 @@ export class DocGenerateAndUploadUtils { }); if (!_.isEmpty(missingReferences)) { throw new Error( - `${this._packageName} package needs to export: \n${missingReferences.join( + `${packageName} package needs to export: \n${missingReferences.join( '\n', )} \nFrom it\'s index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, ); @@ -319,7 +326,11 @@ export class DocGenerateAndUploadUtils { /** * Look for exported types that are not used by the package's public interface */ - private _lookForUnusedExportedTypesThrowIfExists(referenceNames: string[], typedocOutput: any): void { + private _lookForUnusedExportedTypesThrowIfExists( + referenceNames: string[], + typedocOutput: any, + packageName: string, + ): void { const exportedTypes = DocGenerateAndUploadUtils._getAllTypeNames(typedocOutput, []); const excessiveReferences = _.difference(exportedTypes, referenceNames); const excessiveReferencesExceptIgnored = _.difference( @@ -328,7 +339,7 @@ export class DocGenerateAndUploadUtils { ); if (!_.isEmpty(excessiveReferencesExceptIgnored)) { throw new Error( - `${this._packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join( + `${packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join( '\n', )} \nin it\'s index.ts. Remove them then try again.`, ); @@ -340,10 +351,10 @@ export class DocGenerateAndUploadUtils { * - the constructor is to be ignored * - it begins with an underscore (i.e is private) */ - private _pruneTypedocOutput(typedocOutput: any): any { + private _pruneTypedocOutput(typedocOutput: any, packageName: string): any { const modifiedTypedocOutput = _.clone(typedocOutput); _.each(typedocOutput.children, (file, i) => { - const exportPath = this._findExportPathGivenTypedocName(file.name); + const exportPath = this._findExportPathGivenTypedocName(file.name, packageName); const exportItems = this._exportPathToExportedItems[exportPath]; _.each(file.children, (child, j) => { const isNotExported = !_.includes(exportItems, child.name); @@ -377,12 +388,12 @@ export class DocGenerateAndUploadUtils { * monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add * them here when necessary. */ - private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any): any { + private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any, packageName: string): any { const modifiedTypedocOutput = _.clone(typedocOutput); _.each(typedocOutput.children, (child, i) => { if (!_.includes(child.name, '/src/')) { const nameWithoutQuotes = child.name.replace(/"/g, ''); - const standardizedName = `"${this._packageName}/src/${nameWithoutQuotes}"`; + const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; modifiedTypedocOutput.children[i].name = standardizedName; } }); @@ -391,13 +402,13 @@ export class DocGenerateAndUploadUtils { /** * Maps back each top-level TypeDoc JSON object name to the exportPath from which it was generated. */ - private _findExportPathGivenTypedocName(typedocName: string): string { + private _findExportPathGivenTypedocName(typedocName: string, packageName: string): string { const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; const exportPaths = _.keys(this._exportPathToExportedItems); const sanitizedExportPaths = _.map(exportPaths, exportPath => { if (_.startsWith(exportPath, './')) { - const sanitizedExportPath = path.join(this._packageName, 'src', exportPath); + const sanitizedExportPath = path.join(packageName, 'src', exportPath); sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; return sanitizedExportPath; } @@ -438,7 +449,7 @@ export class DocGenerateAndUploadUtils { }); return externalExports; } - private _getTypeDocFileIncludesForPackage(): string[] { + private _getTypeDocFileIncludesForPackage(packageName: string): string[] { let typeDocExtraFileIncludes: string[] = []; _.each(this._exportPathToExportedItems, (exportedItems, exportPath) => { const isInternalToPkg = _.startsWith(exportPath, '.'); @@ -464,9 +475,7 @@ export class DocGenerateAndUploadUtils { } if (!_.startsWith(innerExportPath, './')) { throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${ - this._packageName - } is exporting one of ${innerExportItems} which is + `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is itself exported from an external package. To fix this, export the external dependency directly, not indirectly through ${innerExportPath}.`, ); -- cgit From fe43f84abdeb2ed6805d3879f531fbc4f46c4fec Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 23:06:21 +0100 Subject: Use bash for loop for generating docs for each package, revert changes to script --- .circleci/config.yml | 12 ++++ package.json | 6 +- packages/monorepo-scripts/src/doc_gen_configs.ts | 14 ---- .../src/doc_generate_and_upload.ts | 15 ++-- packages/monorepo-scripts/src/publish.ts | 3 +- packages/monorepo-scripts/src/types.ts | 1 - .../src/utils/doc_generate_and_upload_utils.ts | 83 ++++++++++------------ 7 files changed, 67 insertions(+), 67 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ae8519a56..844eb3b98 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,15 @@ jobs: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn test:publish:circleci + test-doc-generation: + docker: + - image: circleci/node:9 + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn test:generate_docs:circleci test-rest: docker: - image: circleci/node:9 @@ -237,6 +246,9 @@ workflows: - test-publish: requires: - build + - test-doc-generation: + requires: + - build - submit-coverage: requires: - test-rest \ No newline at end of file diff --git a/package.json b/package.json index a86bbd42a..eca1fbe60 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,14 @@ "rebuild": "run-s clean build", "rebuild:no_website": "run-s clean build:no_website", "test": "wsrun test $PKG --fast-exit --serial --exclude-missing", - "generate_docs": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js", + "generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js", + "test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i --shouldUpload false --isStaging true || break; done;", "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete." }, "config": { - "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic" + "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" }, "devDependencies": { "@0x-lerna-fork/lerna": "3.0.0-beta.23", diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index a7314776e..52cbc4f59 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -2,20 +2,6 @@ import { DocGenConfigs } from './types'; export const docGenConfigs: DocGenConfigs = { DOC_JSON_VERSION: '0.0.1', - // Packages for which doc pages exist - PACKAGES_WITH_DOC_PAGES: [ - '0x.js', - 'connect', - 'json-schemas', - 'subproviders', - 'web3-wrapper', - 'contract-wrappers', - 'order-utils', - 'order-watcher', - 'sol-compiler', - 'sol-cov', - 'ethereum-types', - ]; EXTERNAL_TYPE_TO_LINK: { Array: 'https://developer.mozilla.org/pt-PT/docs/Web/JavaScript/Reference/Global_Objects/Array', BigNumber: 'http://mikemcl.github.io/bignumber.js', diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index 7b6f2d9f0..2a53628b5 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -5,9 +5,9 @@ import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils const args = yargs .option('package', { describe: - 'Monorepo sub-package for which to generate DocJSON. If not supplied, it will do all defined in docGenConfigs.', + 'Monorepo sub-package for which to generate DocJSON', type: 'string', - demandOption: false, + demandOption: true, }) .option('isStaging', { describe: 'Whether we wish to publish docs to staging or production', @@ -23,10 +23,15 @@ const args = yargs .example("$0 --package '0x.js' --isStaging true", 'Full usage example').argv; (async () => { - const packageNameIfExists = args.package; + const packageName = args.package; const isStaging = args.isStaging; const shouldUploadDocs = args.shouldUpload; - const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageNameIfExists, isStaging, shouldUploadDocs); + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(packageName, isStaging, shouldUploadDocs); await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); -})(); + + process.exit(0); +})().catch(err => { + console.log(err); + process.exit(1); +}); diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 6691fd3c1..7e91b9281 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -85,7 +85,8 @@ async function generateAndUploadDocJsonsAsync(updatedPublicPackages: Package[], for (const pkg of updatedPublicPackages) { const packageName = pkg.packageJson.name; const nameWithoutPrefix = packageName.replace('@0xproject/', ''); - const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(nameWithoutPrefix, isStaging); + const shouldUploadDocs = true; + const docGenerateAndUploadUtils = new DocGenerateAndUploadUtils(nameWithoutPrefix, isStaging, shouldUploadDocs); await docGenerateAndUploadUtils.generateAndUploadDocsAsync(); } } diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts index b87cc47eb..3c2ec5069 100644 --- a/packages/monorepo-scripts/src/types.ts +++ b/packages/monorepo-scripts/src/types.ts @@ -52,7 +52,6 @@ export interface Package { export interface DocGenConfigs { DOC_JSON_VERSION: string; - PACKAGES_WITH_DOC_PAGES: string[]; EXTERNAL_TYPE_TO_LINK: { [externalType: string]: string }; EXTERNAL_EXPORT_TO_LINK: { [externalExport: string]: string }; CLASSES_WITH_HIDDEN_CONSTRUCTORS: string[]; 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 c84413e64..9e5f437fa 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 @@ -13,7 +13,7 @@ import { utils } from './utils'; export class DocGenerateAndUploadUtils { private _isStaging: boolean; private _shouldUploadDocs: boolean; - private _packageNameIfExists: string; + private _packageName: string; private _omitExports: string[]; private _packagePath: string; private _exportPathToExportedItems: ExportPathToExportedItems; @@ -156,21 +156,21 @@ export class DocGenerateAndUploadUtils { }; return exportInfo; } - constructor(packageNameIfExists: string, isStaging: boolean, shouldUploadDocs: boolean) { + constructor(packageName: string, isStaging: boolean, shouldUploadDocs: boolean) { this._isStaging = isStaging; - this._packageNameIfExists = packageNameIfExists; + this._packageName = packageName; this._shouldUploadDocs = shouldUploadDocs; - this._packagePath = `${constants.monorepoRootPath}/packages/${packageNameIfExists}`; + this._packagePath = `${constants.monorepoRootPath}/packages/${packageName}`; this._monoRepoPkgNameToPath = {}; const monorepoPackages = utils.getPackages(constants.monorepoRootPath); _.each(monorepoPackages, p => (this._monoRepoPkgNameToPath[p.packageJson.name] = p.location)); const pkg = _.find(monorepoPackages, monorepoPackage => { - return _.includes(monorepoPackage.packageJson.name, packageNameIfExists); + return _.includes(monorepoPackage.packageJson.name, packageName); }); if (_.isUndefined(pkg)) { - throw new Error(`Couldn't find a package.json for ${packageNameIfExists}`); + throw new Error(`Couldn't find a package.json for ${packageName}`); } this._packageJson = pkg.packageJson; this._omitExports = _.get(this._packageJson, 'config.postpublish.omitExports', []); @@ -191,26 +191,18 @@ export class DocGenerateAndUploadUtils { } } public async generateAndUploadDocsAsync(): Promise { - if (!_.isUndefined(this._packageNameIfExists)) { - await this.generateAndUploadDocsForPackageAsync(this._packageNameIfExists); - } else { - for (const packageName of docGenConfigs.PACKAGES_WITH_DOC_PAGES) { - await this.generateAndUploadDocsForPackageAsync(packageName); - } - } - } - private async generateAndUploadDocsForPackageAsync(packageName: string): Promise { // For each dep that is another one of our monorepo packages, we fetch it's index.ts // and see which specific files we must pass to TypeDoc, in order to generate a Doc JSON // the includes everything exported by the public interface. - const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(packageName); + const typeDocExtraFileIncludes: string[] = this._getTypeDocFileIncludesForPackage(); // In order to avoid TS errors, we need to pass TypeDoc the package's global.d.ts file typeDocExtraFileIncludes.push(path.join(this._packagePath, 'src', 'globals.d.ts')); + utils.log(`GENERATE_UPLOAD_DOCS: Generating Typedoc JSON for ${this._packageName}...`); const jsonFilePath = path.join(this._packagePath, 'generated_docs', 'index.json'); const projectFiles = typeDocExtraFileIncludes.join(' '); - const cwd = path.join(constants.monorepoRootPath, 'packages', packageName); + const cwd = path.join(constants.monorepoRootPath, 'packages', this._packageName); // HACK: For some reason calling `typedoc` command directly from here, even with `cwd` set to the // packages root dir, does not work. It only works when called via a `package.json` script located // in the package's root. @@ -218,20 +210,21 @@ export class DocGenerateAndUploadUtils { cwd, }); + utils.log('GENERATE_UPLOAD_DOCS: Modifying Typedoc JSON to our custom format...'); const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); - let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput, packageName); - modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput, packageName); + let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); + modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); - if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, packageName)) { + if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, this._packageName)) { const propertyName = ''; // Root has no property name const referenceNames = DocGenerateAndUploadUtils._getAllReferenceNames( propertyName, modifiedTypedocOutput, [], ); - this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput, packageName); - this._lookForMissingReferenceExportsThrowIfExists(referenceNames, packageName); + this._lookForUnusedExportedTypesThrowIfExists(referenceNames, modifiedTypedocOutput); + this._lookForMissingReferenceExportsThrowIfExists(referenceNames); } // Some of our packages re-export external package exports in their index.ts @@ -249,7 +242,9 @@ export class DocGenerateAndUploadUtils { }); if (!_.isEmpty(externalExportsWithoutLinks)) { throw new Error( - `Found the following external exports in ${packageName}'s index.ts:\n ${externalExportsWithoutLinks.join( + `Found the following external exports in ${ + this._packageName + }'s index.ts:\n ${externalExportsWithoutLinks.join( '\n', )}\nThey are missing from the EXTERNAL_EXPORT_TO_LINK mapping. Add them and try again.`, ); @@ -257,7 +252,7 @@ export class DocGenerateAndUploadUtils { const exportPathToTypedocNames: ExportNameToTypedocNames = {}; _.each(modifiedTypedocOutput.children, file => { - const exportPath = this._findExportPathGivenTypedocName(file.name, packageName); + const exportPath = this._findExportPathGivenTypedocName(file.name); exportPathToTypedocNames[exportPath] = _.isUndefined(exportPathToTypedocNames[exportPath]) ? [file.name] : [...exportPathToTypedocNames[exportPath], file.name]; @@ -275,19 +270,21 @@ export class DocGenerateAndUploadUtils { }, typedocJson: modifiedTypedocOutput, }; + utils.log(`GENERATE_UPLOAD_DOCS: Saving Doc JSON to: ${jsonFilePath}`); writeFileSync(jsonFilePath, JSON.stringify(docJson, null, 2)); if (this._shouldUploadDocs) { - await this._uploadDocsAsync(jsonFilePath, cwd, packageName); + await this._uploadDocsAsync(jsonFilePath, cwd); } + utils.log(`GENERATE_UPLOAD_DOCS: Doc generation done for ${this._packageName}`); } - private async _uploadDocsAsync(jsonFilePath: string, cwd: string, packageName: string) { + private async _uploadDocsAsync(jsonFilePath: string, cwd: string) { const fileName = `v${this._packageJson.version}.json`; utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); const S3BucketPath = this._isStaging - ? `s3://staging-doc-jsons/${packageName}/` - : `s3://doc-jsons/${packageName}/`; + ? `s3://staging-doc-jsons/${this._packageName}/` + : `s3://doc-jsons/${this._packageName}/`; const s3Url = `${S3BucketPath}${fileName}`; await execAsync( `aws s3 cp ${jsonFilePath} ${s3Url} --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json`, @@ -304,7 +301,7 @@ export class DocGenerateAndUploadUtils { /** * Look for types that are used by the public interface but are missing from a package's index.ts */ - private _lookForMissingReferenceExportsThrowIfExists(referenceNames: string[], packageName: string): void { + private _lookForMissingReferenceExportsThrowIfExists(referenceNames: string[]): void { const allExportedItems = _.flatten(_.values(this._exportPathToExportedItems)); const missingReferences: string[] = []; _.each(referenceNames, referenceName => { @@ -317,7 +314,7 @@ export class DocGenerateAndUploadUtils { }); if (!_.isEmpty(missingReferences)) { throw new Error( - `${packageName} package needs to export: \n${missingReferences.join( + `${this._packageName} package needs to export: \n${missingReferences.join( '\n', )} \nFrom it\'s index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_TO_LINK mapping.`, ); @@ -326,11 +323,7 @@ export class DocGenerateAndUploadUtils { /** * Look for exported types that are not used by the package's public interface */ - private _lookForUnusedExportedTypesThrowIfExists( - referenceNames: string[], - typedocOutput: any, - packageName: string, - ): void { + private _lookForUnusedExportedTypesThrowIfExists(referenceNames: string[], typedocOutput: any): void { const exportedTypes = DocGenerateAndUploadUtils._getAllTypeNames(typedocOutput, []); const excessiveReferences = _.difference(exportedTypes, referenceNames); const excessiveReferencesExceptIgnored = _.difference( @@ -339,7 +332,7 @@ export class DocGenerateAndUploadUtils { ); if (!_.isEmpty(excessiveReferencesExceptIgnored)) { throw new Error( - `${packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join( + `${this._packageName} package exports BUT does not need: \n${excessiveReferencesExceptIgnored.join( '\n', )} \nin it\'s index.ts. Remove them then try again.`, ); @@ -351,10 +344,10 @@ export class DocGenerateAndUploadUtils { * - the constructor is to be ignored * - it begins with an underscore (i.e is private) */ - private _pruneTypedocOutput(typedocOutput: any, packageName: string): any { + private _pruneTypedocOutput(typedocOutput: any): any { const modifiedTypedocOutput = _.clone(typedocOutput); _.each(typedocOutput.children, (file, i) => { - const exportPath = this._findExportPathGivenTypedocName(file.name, packageName); + const exportPath = this._findExportPathGivenTypedocName(file.name); const exportItems = this._exportPathToExportedItems[exportPath]; _.each(file.children, (child, j) => { const isNotExported = !_.includes(exportItems, child.name); @@ -388,12 +381,12 @@ export class DocGenerateAndUploadUtils { * monorepo). In order to enforce that the names are always prefixed with the package's name, we check and add * them here when necessary. */ - private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any, packageName: string): any { + private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any): any { const modifiedTypedocOutput = _.clone(typedocOutput); _.each(typedocOutput.children, (child, i) => { if (!_.includes(child.name, '/src/')) { const nameWithoutQuotes = child.name.replace(/"/g, ''); - const standardizedName = `"${packageName}/src/${nameWithoutQuotes}"`; + const standardizedName = `"${this._packageName}/src/${nameWithoutQuotes}"`; modifiedTypedocOutput.children[i].name = standardizedName; } }); @@ -402,13 +395,13 @@ export class DocGenerateAndUploadUtils { /** * Maps back each top-level TypeDoc JSON object name to the exportPath from which it was generated. */ - private _findExportPathGivenTypedocName(typedocName: string, packageName: string): string { + private _findExportPathGivenTypedocName(typedocName: string): string { const typeDocNameWithoutQuotes = _.replace(typedocName, /"/g, ''); const sanitizedExportPathToExportPath: { [sanitizedName: string]: string } = {}; const exportPaths = _.keys(this._exportPathToExportedItems); const sanitizedExportPaths = _.map(exportPaths, exportPath => { if (_.startsWith(exportPath, './')) { - const sanitizedExportPath = path.join(packageName, 'src', exportPath); + const sanitizedExportPath = path.join(this._packageName, 'src', exportPath); sanitizedExportPathToExportPath[sanitizedExportPath] = exportPath; return sanitizedExportPath; } @@ -449,7 +442,7 @@ export class DocGenerateAndUploadUtils { }); return externalExports; } - private _getTypeDocFileIncludesForPackage(packageName: string): string[] { + private _getTypeDocFileIncludesForPackage(): string[] { let typeDocExtraFileIncludes: string[] = []; _.each(this._exportPathToExportedItems, (exportedItems, exportPath) => { const isInternalToPkg = _.startsWith(exportPath, '.'); @@ -475,7 +468,9 @@ export class DocGenerateAndUploadUtils { } if (!_.startsWith(innerExportPath, './')) { throw new Error( - `GENERATE_UPLOAD_DOCS: WARNING - ${packageName} is exporting one of ${innerExportItems} which is + `GENERATE_UPLOAD_DOCS: WARNING - ${ + this._packageName + } is exporting one of ${innerExportItems} which is itself exported from an external package. To fix this, export the external dependency directly, not indirectly through ${innerExportPath}.`, ); -- cgit From da15df2c2dd6de236f4ce4021e7be376547bef13 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 23:07:12 +0100 Subject: Stop logging to console for each packages without a package.json --- packages/monorepo-scripts/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 26ac801bd..2ce36942c 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -48,7 +48,7 @@ export const utils = { }; packages.push(pkg); } catch (err) { - utils.log(`Couldn't find a 'package.json' for ${subpackageName}. Skipping.`); + // Couldn't find a 'package.json' for package. Skipping. } } } -- cgit From 1bbd7bf870730dfe2146819e3740522990eb83ca Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 23:20:01 +0100 Subject: Add generated_docs dir to clean command --- packages/0x.js/package.json | 2 +- packages/connect/package.json | 2 +- packages/contract-wrappers/package.json | 2 +- packages/ethereum-types/package.json | 2 +- packages/json-schemas/package.json | 2 +- packages/order-utils/package.json | 2 +- packages/order-watcher/package.json | 2 +- packages/sol-compiler/package.json | 2 +- packages/sol-cov/package.json | 2 +- packages/subproviders/package.json | 2 +- packages/web3-wrapper/package.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index f1170ae5e..5b1b49510 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -24,7 +24,7 @@ "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 src/generated_contract_wrappers", + "clean": "shx rm -rf _bundles lib test_temp src/generated_contract_wrappers generated_docs", "build:umd:prod": "NODE_ENV=production webpack", "build:commonjs": "tsc", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" diff --git a/packages/connect/package.json b/packages/connect/package.json index 4e61ed361..e627f3aee 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -17,7 +17,7 @@ "scripts": { "watch_without_deps": "tsc -w", "build": "tsc", - "clean": "shx rm -rf lib test_temp", + "clean": "shx rm -rf lib test_temp generated_docs", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project .", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index ffd4345f4..86ffa1114 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -24,7 +24,7 @@ "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", "update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", - "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts", + "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts generated_docs", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 98596929f..8ced7c1b6 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -10,7 +10,7 @@ "scripts": { "watch_without_deps": "tsc -w", "build": "tsc", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index ec79d40cb..5ee46d371 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -16,7 +16,7 @@ "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 generated_docs", "build": "tsc", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 576f4dbc1..fd55f3486 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -22,7 +22,7 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib lib/src/artifacts src/generated_contract_wrappers", + "clean": "shx rm -rf lib lib/src/artifacts src/generated_contract_wrappers generated_docs", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 4d719e575..073c25615 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -24,7 +24,7 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", - "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers", + "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers generated_docs", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 498c171e0..af32b9c23 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -17,7 +17,7 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib generated_docs", "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index f63f6fb93..dfeee4a81 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -18,7 +18,7 @@ "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/fixtures/artifacts src/artifacts", + "clean": "shx rm -rf lib test/fixtures/artifacts src/artifacts generated_docs", "copy_test_fixtures": "copyfiles 'test/fixtures/**/*' ./lib", "compile_test": "sol-compiler compile", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 3eb3d381f..8b8c06c25 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -10,7 +10,7 @@ "scripts": { "watch_without_deps": "tsc -w", "build": "tsc", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "run_mocha_unit": "mocha --require source-map-support/register --require make-promises-safe lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", "run_mocha_integration": "mocha --require source-map-support/register --require make-promises-safe lib/test/integration/**/*_test.js --timeout 10000 --bail --exit", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 06450cda1..f7278004d 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -10,7 +10,7 @@ "scripts": { "watch_without_deps": "tsc -w", "build": "tsc", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", -- cgit From 301cb296ec77e8af5c1722679e04cb983c848153 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 23:58:06 +0100 Subject: Move types from sol-compiler to types so they can be used in other places without requiring sol-compiler as a dep --- packages/0x.js/package.json | 1 - packages/0x.js/src/index.ts | 13 +- packages/contract-wrappers/package.json | 1 - packages/contract-wrappers/src/artifacts.ts | 2 +- .../src/contract_wrappers/contract_wrapper.ts | 2 +- packages/contract-wrappers/src/index.ts | 5 +- packages/contract_templates/contract.handlebars | 2 +- packages/contracts/package.json | 2 +- packages/contracts/test/utils/artifacts.ts | 2 +- packages/contracts/test/utils/log_decoder.ts | 2 +- packages/ethereum-types/CHANGELOG.json | 3 + packages/ethereum-types/src/index.ts | 161 +++++++++++++++++++++ packages/fill-scenarios/package.json | 1 - packages/fill-scenarios/src/artifacts.ts | 2 +- packages/metacoin/package.json | 2 +- packages/metacoin/test/metacoin_test.ts | 2 +- packages/migrations/package.json | 1 + packages/migrations/src/1.0.0/artifacts.ts | 2 +- .../migrations/src/2.0.0-beta-testnet/artifacts.ts | 2 +- packages/migrations/src/2.0.0/artifacts.ts | 2 +- packages/migrations/src/utils/artifact_writer.ts | 2 +- packages/order-utils/package.json | 1 - packages/order-utils/src/artifacts.ts | 2 +- packages/order-watcher/package.json | 1 - packages/sol-compiler/src/compiler.ts | 2 +- packages/sol-compiler/src/index.ts | 3 +- packages/sol-compiler/src/utils/compiler.ts | 2 +- packages/sol-compiler/src/utils/types.ts | 74 ---------- packages/sol-compiler/test/compiler_test.ts | 2 +- .../sol_compiler_artifact_adapter.ts | 2 +- 30 files changed, 190 insertions(+), 111 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 5b1b49510..5911125ed 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -79,7 +79,6 @@ "@0xproject/contract-wrappers": "^1.0.1-rc.3", "@0xproject/order-utils": "^1.0.1-rc.3", "@0xproject/order-watcher": "1.0.1-rc.3", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/subproviders": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 748662c39..ec5581a5c 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -71,14 +71,6 @@ export { OrderRelevantState, } from '@0xproject/types'; -export { - ContractArtifact, - GeneratedCompilerOptions, - ContractNetworks, - ContractNetworkData, - Source, -} from '@0xproject/sol-compiler'; - export { BlockParamLiteral, ContractAbi, @@ -105,4 +97,9 @@ export { DataItem, ConstructorStateMutability, StateMutability, + ContractArtifact, + GeneratedCompilerOptions, + ContractNetworks, + ContractNetworkData, + Source, } from 'ethereum-types'; diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 86ffa1114..6ce7a775b 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -80,7 +80,6 @@ "@0xproject/fill-scenarios": "^1.0.1-rc.3", "@0xproject/json-schemas": "^1.0.1-rc.4", "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", diff --git a/packages/contract-wrappers/src/artifacts.ts b/packages/contract-wrappers/src/artifacts.ts index 2481b311a..7e67544d2 100644 --- a/packages/contract-wrappers/src/artifacts.ts +++ b/packages/contract-wrappers/src/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as DummyERC20Token from './artifacts/DummyERC20Token.json'; import * as DummyERC721Token from './artifacts/DummyERC721Token.json'; diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index daf70253a..490a6c50a 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -1,6 +1,6 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { ContractArtifact } from 'ethereum-types'; import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index f7c10dcce..7b9f3cd12 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -51,15 +51,12 @@ export { DataItem, ConstructorStateMutability, StateMutability, -} from 'ethereum-types'; - -export { ContractArtifact, GeneratedCompilerOptions, ContractNetworks, Source, ContractNetworkData, -} from '@0xproject/sol-compiler'; +} from 'ethereum-types'; export { WETH9Events, diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 0810c4d90..7fd96f4e0 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -1,7 +1,7 @@ // tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name // tslint:disable:no-unused-variable import { BaseContract } from '@0xproject/base-contract'; -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 8bd808a27..3c3ce6792 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -51,6 +51,7 @@ "@0xproject/sol-cov": "^2.0.0", "@0xproject/subproviders": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", + "@0xproject/sol-compiler": "^1.0.5", "@types/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", "@types/lodash": "4.14.104", @@ -74,7 +75,6 @@ "dependencies": { "@0xproject/base-contract": "^2.0.0-rc.1", "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts index e608ee174..1d5728cba 100644 --- a/packages/contracts/test/utils/artifacts.ts +++ b/packages/contracts/test/utils/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json'; import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json'; diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts index 5a4801319..92e9185d8 100644 --- a/packages/contracts/test/utils/log_decoder.ts +++ b/packages/contracts/test/utils/log_decoder.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json index e67d68648..b001f6af3 100644 --- a/packages/ethereum-types/CHANGELOG.json +++ b/packages/ethereum-types/CHANGELOG.json @@ -46,6 +46,9 @@ { "note": "Add `TransactionReceiptStatus` type", "pr": 812 + }, + { + "note": "Add Artifact types: `CompilerSettings`, `CompilerOptions`, `OutputField`" } ] }, diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index b2af028fb..5ace18452 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -287,3 +287,164 @@ export interface TraceParams { disableStack?: boolean; disableStorage?: boolean; } + +export type OutputField = + | '*' + | 'ast' + | 'legacyAST' + | 'abi' + | 'devdoc' + | 'userdoc' + | 'metadata' + | 'ir' + | 'evm.assembly' + | 'evm.legacyAssembly' + | 'evm.bytecode.object' + | 'evm.bytecode.opcodes' + | 'evm.bytecode.sourceMap' + | 'evm.bytecode.linkReferences' + | 'evm.deployedBytecode.object' + | 'evm.deployedBytecode.opcodes' + | 'evm.deployedBytecode.sourceMap' + | 'evm.deployedBytecode.linkReferences' + | 'evm.methodIdentifiers' + | 'evm.gasEstimates' + | 'ewasm.wast' + | 'ewasm.wasm'; + +export interface CompilerSettings { + remappings?: string[]; + optimizer?: { + enabled: boolean; + runs?: number; + }; + evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople'; + metadata?: { + useLiteralContent: true; + }; + libraries?: { + [fileName: string]: { + [libName: string]: string; + }; + }; + outputSelection: { + [fileName: string]: { + [contractName: string]: OutputField[]; + }; + }; +} + +export interface ContractNetworks { + [networkId: number]: ContractNetworkData; +} + +export interface ContractNetworkData { + address: string; + links: { + [linkName: string]: string; + }; + constructorArgs: string; +} + +export interface StandardContractOutput { + abi: ContractAbi; + evm: { + bytecode: { + object: string; + sourceMap: string; + }; + deployedBytecode: { + object: string; + sourceMap: string; + }; + }; +} + +export interface ContractVersionData { + compiler: { + name: 'solc'; + version: string; + settings: CompilerSettings; + }; + sources: { + [sourceName: string]: { + id: number; + }; + }; + sourceCodes: { + [sourceName: string]: string; + }; + sourceTreeHashHex: string; + compilerOutput: StandardContractOutput; +} + +/** + * This type defines the schema of the artifact.json file generated by Sol-compiler + * schemaVersion: The version of the artifact schema + * contractName: The contract name it represents + * networks: Network specific information by network (address, id, constructor args, etc...) + * compilerOutput: The Solidity compiler output generated from the specified compiler input + * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) + * compiler: The compiler settings used + * sourceCodes: The source code of the contract and all it's dependencies + * sources: A mapping from source filePath to sourceMap id + * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies. + * If any of the sources change, the hash would change notifying us that a re-compilation is necessary + */ +export interface ContractArtifact extends ContractVersionData { + schemaVersion: string; + contractName: string; + networks: ContractNetworks; +} + +export interface GeneratedCompilerOptions { + name: 'solc'; + version: string; + settings: CompilerSettings; +} + +// Copied from the solc.js library types +export interface CompilerSettings { + remappings?: string[]; + optimizer?: { + enabled: boolean; + runs?: number; + }; + evmVersion?: 'homestead' | 'tangerineWhistle' | 'spuriousDragon' | 'byzantium' | 'constantinople'; + metadata?: { + useLiteralContent: true; + }; + libraries?: { + [fileName: string]: { + [libName: string]: string; + }; + }; + outputSelection: { + [fileName: string]: { + [contractName: string]: OutputField[]; + }; + }; +} + +export interface Source { + id: number; +} + +/** + * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler + * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories. + * artifactsDir: Directory where you want the generated artifacts.json written to + * compilerSettings: Desired settings to pass to the Solidity compiler during compilation. + * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) + * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the + * specified directory. + * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all + * contracts to compile with the the version specified here. + */ +export interface CompilerOptions { + contractsDir?: string; + artifactsDir?: string; + compilerSettings?: CompilerSettings; + contracts?: string[] | '*'; + solcVersion?: string; +} diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 122499db6..767032e41 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -28,7 +28,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { "@0xproject/abi-gen": "^1.0.5", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", "@types/lodash": "4.14.104", "copyfiles": "^2.0.0", diff --git a/packages/fill-scenarios/src/artifacts.ts b/packages/fill-scenarios/src/artifacts.ts index 7f68ae26a..b78ca0cc2 100644 --- a/packages/fill-scenarios/src/artifacts.ts +++ b/packages/fill-scenarios/src/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as DummyERC20Token from './artifacts/DummyERC20Token.json'; import * as DummyERC721Token from './artifacts/DummyERC721Token.json'; diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 322708b50..3337570b6 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -31,7 +31,6 @@ "dependencies": { "@0xproject/abi-gen": "^1.0.5", "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/sol-cov": "^2.0.0", "@0xproject/subproviders": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", @@ -48,6 +47,7 @@ }, "devDependencies": { "@0xproject/dev-utils": "^1.0.4", + "@0xproject/sol-compiler": "^1.0.5", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index 803e5f786..f112ac060 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; diff --git a/packages/migrations/package.json b/packages/migrations/package.json index f196ffad6..ae29cce4e 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -41,6 +41,7 @@ "@0xproject/dev-utils": "^1.0.4", "@0xproject/tslint-config": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", + "@0xproject/sol-compiler": "^1.0.5", "@types/yargs": "^10.0.0", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", diff --git a/packages/migrations/src/1.0.0/artifacts.ts b/packages/migrations/src/1.0.0/artifacts.ts index d0a9f735a..f5226e174 100644 --- a/packages/migrations/src/1.0.0/artifacts.ts +++ b/packages/migrations/src/1.0.0/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as DummyERC20Token from '../../artifacts/1.0.0/DummyERC20Token.json'; import * as Exchange from '../../artifacts/1.0.0/Exchange_v1.json'; diff --git a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts index c9a341eb3..1c9ffd2d6 100644 --- a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts +++ b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as AssetProxyOwner from '../../artifacts/2.0.0-beta-testnet/AssetProxyOwner.json'; import * as ERC20Proxy from '../../artifacts/2.0.0-beta-testnet/ERC20Proxy.json'; diff --git a/packages/migrations/src/2.0.0/artifacts.ts b/packages/migrations/src/2.0.0/artifacts.ts index 8bbd1fcd9..8d66e3b63 100644 --- a/packages/migrations/src/2.0.0/artifacts.ts +++ b/packages/migrations/src/2.0.0/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as AssetProxyOwner from '../../artifacts/2.0.0/AssetProxyOwner.json'; import * as DummyERC20Token from '../../artifacts/2.0.0/DummyERC20Token.json'; diff --git a/packages/migrations/src/utils/artifact_writer.ts b/packages/migrations/src/utils/artifact_writer.ts index b7522df05..ea9c7952d 100644 --- a/packages/migrations/src/utils/artifact_writer.ts +++ b/packages/migrations/src/utils/artifact_writer.ts @@ -1,5 +1,5 @@ import { BaseContract } from '@0xproject/base-contract'; -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as fs from 'fs'; import * as path from 'path'; diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index fd55f3486..6e5007343 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -66,7 +66,6 @@ "@0xproject/assert": "^1.0.5", "@0xproject/base-contract": "^2.0.0-rc.1", "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", diff --git a/packages/order-utils/src/artifacts.ts b/packages/order-utils/src/artifacts.ts index 3d2d1e953..735cc2403 100644 --- a/packages/order-utils/src/artifacts.ts +++ b/packages/order-utils/src/artifacts.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { ContractArtifact } from 'ethereum-types'; import * as DummyERC20Token from './artifacts/DummyERC20Token.json'; import * as ERC20Proxy from './artifacts/ERC20Proxy.json'; diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 073c25615..1765d7cad 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -47,7 +47,6 @@ "@0xproject/abi-gen": "^1.0.5", "@0xproject/dev-utils": "^1.0.4", "@0xproject/migrations": "^1.0.4", - "@0xproject/sol-compiler": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 2503f7315..eb4ff3be6 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -10,6 +10,7 @@ import { } from '@0xproject/sol-resolver'; import { fetchAsync, logUtils } from '@0xproject/utils'; import chalk from 'chalk'; +import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -29,7 +30,6 @@ import { } from './utils/compiler'; import { constants } from './utils/constants'; import { fsWrapper } from './utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact, ContractVersionData } from './utils/types'; import { utils } from './utils/utils'; type TYPE_ALL_FILES_IDENTIFIER = '*'; diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 570de931b..74c2b80d5 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,3 +1,2 @@ export { Compiler } from './compiler'; - -export { CompilerOptions } from './utils/types'; +export { ContractArtifact, CompilerOptions, ContractNetworks } from 'ethereum-types'; diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts index 968fcc5b2..c918ed1f3 100644 --- a/packages/sol-compiler/src/utils/compiler.ts +++ b/packages/sol-compiler/src/utils/compiler.ts @@ -1,10 +1,10 @@ import { ContractSource } from '@0xproject/sol-resolver'; import { logUtils } from '@0xproject/utils'; +import { ContractArtifact } from 'ethereum-types'; import * as _ from 'lodash'; import * as path from 'path'; import { fsWrapper } from './fs_wrapper'; -import { ContractArtifact } from './types'; /** * Gets contract data on network or returns if an artifact does not exist. diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts index e2e7a4e53..b211cfcbc 100644 --- a/packages/sol-compiler/src/utils/types.ts +++ b/packages/sol-compiler/src/utils/types.ts @@ -1,5 +1,3 @@ -import * as solc from 'solc'; - export enum AbiType { Function = 'function', Constructor = 'constructor', @@ -7,82 +5,10 @@ export enum AbiType { Fallback = 'fallback', } -/** - * This type defines the schema of the artifact.json file generated by Sol-compiler - * schemaVersion: The version of the artifact schema - * contractName: The contract name it represents - * networks: Network specific information by network (address, id, constructor args, etc...) - * compilerOutput: The Solidity compiler output generated from the specified compiler input - * description (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) - * compiler: The compiler settings used - * sourceCodes: The source code of the contract and all it's dependencies - * sources: A mapping from source filePath to sourceMap id - * sourceTreeHashHex: A unique hash generated from the contract source and that of it's dependencies. - * If any of the sources change, the hash would change notifying us that a re-compilation is necessary - */ -export interface ContractArtifact extends ContractVersionData { - schemaVersion: string; - contractName: string; - networks: ContractNetworks; -} - -export interface GeneratedCompilerOptions { - name: 'solc'; - version: string; - settings: solc.CompilerSettings; -} - -export interface Source { - id: number; -} - -export interface ContractVersionData { - compiler: GeneratedCompilerOptions; - sources: { - [sourceName: string]: Source; - }; - sourceCodes: { - [sourceName: string]: string; - }; - sourceTreeHashHex: string; - compilerOutput: solc.StandardContractOutput; -} - -export interface ContractNetworks { - [networkId: number]: ContractNetworkData; -} - -export interface ContractNetworkData { - address: string; - links: { - [linkName: string]: string; - }; - constructorArgs: string; -} - export interface SolcErrors { [key: string]: boolean; } -/** - * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler - * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories. - * artifactsDir: Directory where you want the generated artifacts.json written to - * compilerSettings: Desired settings to pass to the Solidity compiler during compilation. - * (http://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#compiler-input-and-output-json-description) - * contracts: List of contract names you wish to compile, or alternatively ['*'] to compile all contracts in the - * specified directory. - * solcVersion: If you don't want to compile each contract with the Solidity version specified in-file, you can force all - * contracts to compile with the the version specified here. - */ -export interface CompilerOptions { - contractsDir?: string; - artifactsDir?: string; - compilerSettings?: solc.CompilerSettings; - contracts?: string[] | '*'; - solcVersion?: string; -} - export interface ContractSourceData { [contractName: string]: ContractSpecificSourceData; } diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts index c9e141ee9..46853e882 100644 --- a/packages/sol-compiler/test/compiler_test.ts +++ b/packages/sol-compiler/test/compiler_test.ts @@ -1,10 +1,10 @@ import { DoneCallback } from '@0xproject/types'; import * as chai from 'chai'; +import { CompilerOptions, ContractArtifact } from 'ethereum-types'; import 'mocha'; import { Compiler } from '../src/compiler'; import { fsWrapper } from '../src/utils/fs_wrapper'; -import { CompilerOptions, ContractArtifact } from '../src/utils/types'; import { exchange_binary } from './fixtures/exchange_bin'; import { constants } from './util/constants'; diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index 0601c5729..8a74022bf 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -1,5 +1,5 @@ -import { CompilerOptions, ContractArtifact } from '@0xproject/sol-compiler'; import { logUtils } from '@0xproject/utils'; +import { CompilerOptions, ContractArtifact } from 'ethereum-types'; import * as fs from 'fs'; import * as glob from 'glob'; import * as _ from 'lodash'; -- cgit From 22de88035c35731f0a93fc0acb87c185c1e2730c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 11:28:31 +0100 Subject: Fix index.ts given fix in doc generation --- packages/0x.js/src/index.ts | 9 +-------- packages/contract-wrappers/src/index.ts | 12 ------------ packages/sol-compiler/src/index.ts | 2 +- packages/sol-cov/src/index.ts | 19 +++++++++---------- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index ec5581a5c..a37333bad 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -11,7 +11,6 @@ export { ForwarderWrapper, IndexedFilterValues, BlockRange, - ContractEventArgs, ContractWrappersConfig, MethodOpts, OrderTransactionOpts, @@ -38,11 +37,10 @@ export { ExchangeSignatureValidatorApprovalEventArgs, ExchangeFillEventArgs, ExchangeCancelEventArgs, - ExchangeEventArgs, ExchangeEvents, - ContractEvents, EventCallback, DecodedLogEvent, + ExchangeEventArgs, } from '@0xproject/contract-wrappers'; export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; @@ -97,9 +95,4 @@ export { DataItem, ConstructorStateMutability, StateMutability, - ContractArtifact, - GeneratedCompilerOptions, - ContractNetworks, - ContractNetworkData, - Source, } from 'ethereum-types'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 7b9f3cd12..941aa1e40 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -11,14 +11,12 @@ export { ContractWrappersError, IndexedFilterValues, BlockRange, - ContractEventArgs, ContractWrappersConfig, MethodOpts, OrderTransactionOpts, TransactionOpts, OrderStatus, OrderInfo, - ContractEvents, EventCallback, DecodedLogEvent, } from './types'; @@ -31,15 +29,10 @@ export { ContractEventArg, Provider, ContractAbi, - LogEntry, - RawLog, JSONRPCRequestPayload, JSONRPCResponsePayload, JSONRPCErrorCallback, - DecodedLogEntry, - LogEntryEvent, AbiDefinition, - DecodedLogEntryEvent, LogWithDecodedArgs, FunctionAbi, EventAbi, @@ -51,11 +44,6 @@ export { DataItem, ConstructorStateMutability, StateMutability, - ContractArtifact, - GeneratedCompilerOptions, - ContractNetworks, - Source, - ContractNetworkData, } from 'ethereum-types'; export { diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 74c2b80d5..b6b170508 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,2 +1,2 @@ export { Compiler } from './compiler'; -export { ContractArtifact, CompilerOptions, ContractNetworks } from 'ethereum-types'; +export { CompilerOptions, CompilerSettings, OutputField } from 'ethereum-types'; diff --git a/packages/sol-cov/src/index.ts b/packages/sol-cov/src/index.ts index cb9e108fb..15be86a9d 100644 --- a/packages/sol-cov/src/index.ts +++ b/packages/sol-cov/src/index.ts @@ -7,14 +7,13 @@ export { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_a export { ProfilerSubprovider } from './profiler_subprovider'; export { RevertTraceSubprovider } from './revert_trace_subprovider'; -export { ContractData, TraceInfo, Subtrace, TraceInfoNewContract, TraceInfoExistingContract } from './types'; -export { - StructLog, - JSONRPCRequestPayload, - Provider, - JSONRPCErrorCallback, - OpCode, - JSONRPCResponsePayload, -} from 'ethereum-types'; +export { ContractData } from './types'; +export { JSONRPCRequestPayload, Provider, JSONRPCErrorCallback, JSONRPCResponsePayload } from 'ethereum-types'; -export { JSONRPCRequestPayloadWithMethod } from '@0xproject/subproviders'; +export { + JSONRPCRequestPayloadWithMethod, + NextCallback, + ErrorCallback, + OnNextCompleted, + Callback, +} from '@0xproject/subproviders'; -- cgit From c12f0d04bb2f0d5ad73943d02a592a110423a423 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 11:30:24 +0100 Subject: Fix bugs in doc gen due to clone vs cloneDeep and pre-maturely removing placeholder undefined's in array iteration --- .../src/utils/doc_generate_and_upload_utils.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 9e5f437fa..bbc763a6b 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 @@ -213,8 +213,8 @@ export class DocGenerateAndUploadUtils { utils.log('GENERATE_UPLOAD_DOCS: Modifying Typedoc JSON to our custom format...'); const typedocOutputString = readFileSync(jsonFilePath).toString(); const typedocOutput = JSON.parse(typedocOutputString); - let modifiedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); - modifiedTypedocOutput = this._pruneTypedocOutput(modifiedTypedocOutput); + const standardizedTypedocOutput = this._standardizeTypedocOutputTopLevelChildNames(typedocOutput); + const modifiedTypedocOutput = this._pruneTypedocOutput(standardizedTypedocOutput); if (!_.includes(docGenConfigs.TYPES_ONLY_LIBRARIES, this._packageName)) { const propertyName = ''; // Root has no property name @@ -345,7 +345,7 @@ export class DocGenerateAndUploadUtils { * - it begins with an underscore (i.e is private) */ private _pruneTypedocOutput(typedocOutput: any): any { - const modifiedTypedocOutput = _.clone(typedocOutput); + const modifiedTypedocOutput = _.cloneDeep(typedocOutput); _.each(typedocOutput.children, (file, i) => { const exportPath = this._findExportPathGivenTypedocName(file.name); const exportItems = this._exportPathToExportedItems[exportPath]; @@ -365,11 +365,11 @@ export class DocGenerateAndUploadUtils { const isPrivate = _.startsWith(innerChild.name, '_'); if (isHiddenConstructor || isPrivate) { delete modifiedTypedocOutput.children[i].children[j].children[k]; - modifiedTypedocOutput.children[i].children[j].children = _.compact( - modifiedTypedocOutput.children[i].children[j].children, - ); } }); + modifiedTypedocOutput.children[i].children[j].children = _.compact( + modifiedTypedocOutput.children[i].children[j].children, + ); }); modifiedTypedocOutput.children[i].children = _.compact(modifiedTypedocOutput.children[i].children); }); @@ -382,7 +382,7 @@ export class DocGenerateAndUploadUtils { * them here when necessary. */ private _standardizeTypedocOutputTopLevelChildNames(typedocOutput: any): any { - const modifiedTypedocOutput = _.clone(typedocOutput); + const modifiedTypedocOutput = _.cloneDeep(typedocOutput); _.each(typedocOutput.children, (child, i) => { if (!_.includes(child.name, '/src/')) { const nameWithoutQuotes = child.name.replace(/"/g, ''); -- cgit From d907b403788576c7d4fe51090a561f1e951126e2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 13:12:42 +0100 Subject: Fix remaining merge issues --- packages/0x.js/src/index.ts | 1 + packages/contract-wrappers/src/index.ts | 2 + .../src/utils/transaction_encoder.ts | 6 +- .../test/transaction_encoder_test.ts | 4 +- packages/monorepo-scripts/src/doc_gen_configs.ts | 1 + packages/order-watcher/src/artifacts.ts | 2 +- yarn.lock | 66 ++++++++++------------ 7 files changed, 39 insertions(+), 43 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index a37333bad..7058a898f 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -41,6 +41,7 @@ export { EventCallback, DecodedLogEvent, ExchangeEventArgs, + TransactionEncoder, } from '@0xproject/contract-wrappers'; export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 941aa1e40..5e691fc21 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -7,6 +7,8 @@ export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper'; export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper'; export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper'; +export { TransactionEncoder } from './utils/transaction_encoder'; + export { ContractWrappersError, IndexedFilterValues, diff --git a/packages/contract-wrappers/src/utils/transaction_encoder.ts b/packages/contract-wrappers/src/utils/transaction_encoder.ts index 5c2a94b74..8821079dc 100644 --- a/packages/contract-wrappers/src/utils/transaction_encoder.ts +++ b/packages/contract-wrappers/src/utils/transaction_encoder.ts @@ -1,5 +1,5 @@ import { schemas } from '@0xproject/json-schemas'; -import { EIP712Schema, EIP712Types, EIP712Utils } from '@0xproject/order-utils'; +import { EIP712Schema, EIP712Types, eip712Utils } from '@0xproject/order-utils'; import { Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import _ = require('lodash'); @@ -41,11 +41,11 @@ export class TransactionEncoder { signerAddress, data, }; - const executeTransactionHashBuff = EIP712Utils.structHash( + const executeTransactionHashBuff = eip712Utils.structHash( EIP712_ZEROEX_TRANSACTION_SCHEMA, executeTransactionData, ); - const eip721MessageBuffer = EIP712Utils.createEIP712Message(executeTransactionHashBuff, exchangeAddress); + const eip721MessageBuffer = eip712Utils.createEIP712Message(executeTransactionHashBuff, exchangeAddress); const messageHex = `0x${eip721MessageBuffer.toString('hex')}`; return messageHex; } diff --git a/packages/contract-wrappers/test/transaction_encoder_test.ts b/packages/contract-wrappers/test/transaction_encoder_test.ts index 10222dbc1..e76c5b12d 100644 --- a/packages/contract-wrappers/test/transaction_encoder_test.ts +++ b/packages/contract-wrappers/test/transaction_encoder_test.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; -import { assetDataUtils, ecSignOrderHashAsync, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils'; +import { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils'; import { SignedOrder, SignerType } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import 'mocha'; @@ -80,7 +80,7 @@ describe('TransactionEncoder', () => { ): Promise => { const salt = generatePseudoRandomSalt(); const encodedTransaction = encoder.getTransactionHex(data, salt, signerAddress); - const signature = await ecSignOrderHashAsync( + const signature = await signatureUtils.ecSignOrderHashAsync( provider, encodedTransaction, signerAddress, diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 52cbc4f59..fb6cc0886 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -33,6 +33,7 @@ export const docGenConfigs: DocGenConfigs = { 'EtherTokenWrapper', 'ExchangeWrapper', 'ForwarderWrapper', + 'TransactionEncoder', ], // 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 th