Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/init

This commit is contained in:
fragosti
2018-10-02 16:10:15 -07:00
126 changed files with 1825 additions and 683 deletions

View File

@@ -11,29 +11,17 @@ jobs:
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: install-yarn
command: sudo npm install --global yarn@1.9.4
- run:
name: yarn
command: yarn --frozen-lockfile install || 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 development packages/website)" ]; then
yarn build --exclude website
yarn build:ci:no_website
else
yarn build
yarn build:ci
fi
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
@@ -177,8 +165,10 @@ jobs:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn prettier:ci
- run: yarn lerna run lint
- run: yarn prettier:ci
- run: cd packages/0x.js && yarn build:umd:prod
- run: yarn bundlesize
submit-coverage:
docker:
- image: circleci/node:9

View File

@@ -24,7 +24,9 @@
"wsrun": "wsrun",
"lerna": "lerna",
"build": "wsrun build $PKG --fast-exit -r --stages",
"build:ci": "wsrun build:ci $PKG --fast-exit -r --stages",
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0xproject/website",
"build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0xproject/website",
"build:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build",
"build:ts": "tsc -b",
"watch:ts": "tsc -b -w",
@@ -35,15 +37,22 @@
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
"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 -1; done;",
"bundlesize": "bundlesize",
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing"
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types"
},
"bundlesize": [
{
"path": "packages/0x.js/_bundles/index.min.js"
}
],
"devDependencies": {
"@0x-lerna-fork/lerna": "3.0.0-beta.25",
"async-child-process": "^1.1.1",
"bundlesize": "^0.17.0",
"coveralls": "^3.0.0",
"ganache-cli": "6.1.3",
"lcov-result-merger": "^3.0.0",

View File

@@ -4,7 +4,6 @@ webpack.config.js
yarn-error.log
test/
/src/
/_bundles/
/contract_templates/
/generated_docs/
/scripts/

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.6",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.8 - _October 2, 2018_
* Dependencies updated
## v1.0.7 - _September 28, 2018_
* Dependencies updated
## v1.0.6 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "1.0.6",
"version": "1.0.7",
"engines": {
"node": ">=6.12"
},
@@ -16,6 +16,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "yarn build:all",
"build:ci": "yarn build:commonjs",
"build:all": "run-p build:umd:prod build:commonjs",
"lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*",
"test:circleci": "run-s test:coverage",
@@ -41,10 +42,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.12",
"@0xproject/monorepo-scripts": "^1.0.9",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/migrations": "^1.0.13",
"@0xproject/monorepo-scripts": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -73,17 +74,17 @@
"webpack": "^3.1.0"
},
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.5",
"@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/order-watcher": "^2.0.0",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/assert": "^1.0.12",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/contract-wrappers": "^2.0.1",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/order-watcher": "^2.1.0",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5",
"web3-provider-engine": "14.0.6"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.11",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _October 2, 2018_
* Dependencies updated
## v1.0.12 - _September 28, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/abi-gen",
"version": "1.0.11",
"version": "1.0.12",
"engines": {
"node": ">=6.12"
},
@@ -11,6 +11,7 @@
"lint": "tslint --project .",
"clean": "shx rm -rf lib",
"build": "tsc -b",
"build:ci": "yarn build",
"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",
@@ -30,10 +31,10 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"chalk": "^2.3.0",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.5",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.11",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _October 2, 2018_
* Dependencies updated
## v1.0.12 - _September 28, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/assert",
"version": "1.0.11",
"version": "1.0.12",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"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",
@@ -44,9 +45,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.1",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _October 2, 2018_
* Dependencies updated
## v1.0.2 - _September 28, 2018_
* Dependencies updated
## v1.0.1 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/asset-buyer",
"version": "1.0.1",
"version": "1.0.2",
"engines": {
"node": ">=6.12"
},
@@ -18,6 +18,7 @@
"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",
"build:ci": "yarn build",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"config": {
@@ -36,17 +37,17 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/connect": "^2.0.4",
"@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/assert": "^1.0.12",
"@0xproject/connect": "^3.0.0",
"@0xproject/contract-wrappers": "^2.0.1",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"lodash": "^4.17.10"
},
"devDependencies": {

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1538475601,
"version": "3.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.0",
"changes": [
@@ -10,7 +19,8 @@
"note": "Add baseContract._throwIfRevertWithReasonCallResult",
"pr": 1069
}
]
],
"timestamp": 1538157789
},
{
"timestamp": 1537907159,

View File

@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.1 - _October 2, 2018_
* Dependencies updated
## v3.0.0 - _September 28, 2018_
* Change the way we detect BN to work with the newest ethers.js (#1069)
* Add baseContract._throwIfRevertWithReasonCallResult (#1069)
## v2.0.5 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/base-contract",
"version": "2.0.5",
"version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"clean": "shx rm -rf lib",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
@@ -40,10 +41,10 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1538475601,
"version": "3.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.0",
"changes": [
@@ -6,7 +15,8 @@
"note": "Change /order_config request to a POST instead of GET",
"pr": 1091
}
]
],
"timestamp": 1538157789
},
{
"timestamp": 1537907159,

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.1 - _October 2, 2018_
* Dependencies updated
## v3.0.0 - _September 28, 2018_
* Change /order_config request to a POST instead of GET (#1091)
## v2.0.4 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/connect",
"version": "2.0.4",
"version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -16,6 +16,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"clean": "shx rm -rf lib test_temp generated_docs",
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
"lint": "tslint --project .",
@@ -43,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/assert": "^1.0.12",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "2.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "2.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.2 - _October 2, 2018_
* Dependencies updated
## v2.0.1 - _September 28, 2018_
* Dependencies updated
## v2.0.0 - _September 25, 2018_
* Fixes dropped events in subscriptions by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too. (#1080)

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/contract-wrappers",
"version": "2.0.0",
"version": "2.0.1",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -12,6 +12,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s update_artifacts generate_contract_wrappers copy_artifacts",
"generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder|OrderValidator).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/**/*",
@@ -41,10 +42,10 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.12",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/migrations": "^1.0.13",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -72,16 +73,16 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.5",
"@0xproject/fill-scenarios": "^1.0.5",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/assert": "^1.0.12",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/fill-scenarios": "^1.0.6",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "4.0.0-beta.14",

View File

@@ -58,7 +58,7 @@ export class ContractWrappers {
*/
public orderValidator: OrderValidatorWrapper;
private _web3Wrapper: Web3Wrapper;
private readonly _web3Wrapper: Web3Wrapper;
/**
* Instantiates a new ContractWrappers instance.
* @param provider The Provider instance you would like the 0x.js library to use for interacting with

View File

@@ -3,7 +3,6 @@ import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
import { BlockParamLiteral } from 'ethereum-types';
import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
export class OrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {

View File

@@ -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 { signatureUtils, assetDataUtils } from '@0xproject/order-utils';
import { assetDataUtils, signatureUtils } from '@0xproject/order-utils';
import { Order } 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';

View File

@@ -1,4 +1,3 @@
import { RevertReason } from '@0xproject/types';
import * as _ from 'lodash';
import { AsyncMethod, ContractWrappersError, SyncMethod } from '../types';
@@ -46,7 +45,7 @@ const asyncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
// tslint:disable-next-line:only-arrow-functions
descriptor.value = async function(...args: any[]): Promise<any> {
try {
const result = await originalMethod.apply(this, args);
const result = await originalMethod.apply(this, args); // tslint:disable-line:no-invalid-this
return result;
} catch (error) {
const transformedError = errorTransformer(error);
@@ -73,7 +72,7 @@ const syncErrorHandlerFactory = (errorTransformer: ErrorTransformer) => {
// tslint:disable-next-line:only-arrow-functions
descriptor.value = function(...args: any[]): any {
try {
const result = originalMethod.apply(this, args);
const result = originalMethod.apply(this, args); // tslint:disable-line:no-invalid-this
return result;
} catch (error) {
const transformedError = errorTransformer(error);

View File

@@ -34,7 +34,7 @@ const ERR_MSG_MAPPING = {
};
export class ExchangeTransferSimulator {
private _store: AbstractBalanceAndProxyAllowanceLazyStore;
private readonly _store: AbstractBalanceAndProxyAllowanceLazyStore;
private static _throwValidationError(
failureReason: FailureReason,
tradeSide: TradeSide,

View File

@@ -1,4 +1,4 @@
import { ConstructorAbi, ContractAbi, EventAbi, FallbackAbi, FilterObject, LogEntry, MethodAbi } from 'ethereum-types';
import { ContractAbi, EventAbi, FilterObject, LogEntry } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as jsSHA3 from 'js-sha3';
import * as _ from 'lodash';

View File

@@ -23,7 +23,7 @@ const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = {
* can submit this to the blockchain. The Exchange context executes as if UserA had directly submitted this transaction.
*/
export class TransactionEncoder {
private _exchangeInstance: ExchangeContract;
private readonly _exchangeInstance: ExchangeContract;
constructor(exchangeInstance: ExchangeContract) {
this._exchangeInstance = exchangeInstance;
}

View File

@@ -3,7 +3,6 @@ import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import { assert } from '../src/utils/assert';
import { calldataOptimizationUtils } from '../src/utils/calldata_optimization_utils';
import { constants } from '../src/utils/constants';

View File

@@ -229,11 +229,17 @@ describe('ERC721Wrapper', () => {
it('should set the proxy approval', async () => {
const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress);
const approvalBeforeSet = await contractWrappers.erc721Token.isProxyApprovedAsync(tokenAddress, tokenId);
expect(approvalBeforeSet).to.be.false();
const isProxyApprovedBeforeSet = await contractWrappers.erc721Token.isProxyApprovedAsync(
tokenAddress,
tokenId,
);
expect(isProxyApprovedBeforeSet).to.be.false();
await contractWrappers.erc721Token.setProxyApprovalAsync(tokenAddress, tokenId);
const approvalAfterSet = await contractWrappers.erc721Token.isProxyApprovedAsync(tokenAddress, tokenId);
expect(approvalAfterSet).to.be.true();
const isProxyApprovedAfterSet = await contractWrappers.erc721Token.isProxyApprovedAsync(
tokenAddress,
tokenId,
);
expect(isProxyApprovedAfterSet).to.be.true();
});
});
describe('#subscribe', () => {
@@ -357,7 +363,6 @@ describe('ERC721Wrapper', () => {
);
contractWrappers.erc721Token.unsubscribe(subscriptionToken);
const tokenId = await tokenUtils.mintDummyERC721Async(tokenAddress, ownerAddress);
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await contractWrappers.erc721Token.setApprovalForAllAsync(
@@ -373,15 +378,11 @@ describe('ERC721Wrapper', () => {
});
});
describe('#getLogsAsync', () => {
let tokenTransferProxyAddress: string;
const blockRange: BlockRange = {
fromBlock: 0,
toBlock: BlockParamLiteral.Latest,
};
let txHash: string;
before(() => {
tokenTransferProxyAddress = contractWrappers.erc721Proxy.getContractAddress();
});
it('should get logs with decoded args emitted by ApprovalForAll', async () => {
const isApprovedForAll = true;
txHash = await contractWrappers.erc721Token.setApprovalForAllAsync(

View File

@@ -344,7 +344,7 @@ describe('EtherTokenWrapper', () => {
etherTokenAddress = tokenUtils.getWethTokenAddress();
erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
// Start the block range after all migrations to avoid unexpected logs
const currentBlock = await web3Wrapper.getBlockNumberAsync();
const currentBlock: number = await web3Wrapper.getBlockNumberAsync();
const fromBlock = currentBlock + 1;
blockRange = {
fromBlock,

View File

@@ -1,14 +1,12 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { DoneCallback, SignedOrder } from '@0xproject/types';
import { assetDataUtils } from '@0xproject/order-utils';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { BlockParamLiteral } from 'ethereum-types';
import 'mocha';
import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src';
import { DecodedLogEvent } from '../src/types';
import { ContractWrappers, OrderStatus } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';

View File

@@ -1,15 +1,14 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { FillScenarios } from '@0xproject/fill-scenarios';
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
import { DoneCallback, SignedOrder } from '@0xproject/types';
import { assetDataUtils } from '@0xproject/order-utils';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { BlockParamLiteral } from 'ethereum-types';
import * as _ from 'lodash';
import 'mocha';
import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src';
import { DecodedLogEvent, OrderInfo, TraderInfo } from '../src/types';
import { ContractWrappers, OrderStatus } from '../src';
import { OrderInfo, TraderInfo } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
@@ -26,7 +25,6 @@ describe('OrderValidator', () => {
blockPollingIntervalMs: 0,
};
const fillableAmount = new BigNumber(5);
const partialFillAmount = new BigNumber(2);
let contractWrappers: ContractWrappers;
let fillScenarios: FillScenarios;
let exchangeContractAddress: string;

View File

@@ -1,6 +1,5 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { DoneCallback } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
@@ -18,17 +17,11 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('SubscriptionTest', () => {
let contractWrappers: ContractWrappers;
let userAddresses: string[];
let coinbase: string;
let addressWithoutFunds: string;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
before(async () => {
contractWrappers = new ContractWrappers(provider, config);
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
coinbase = userAddresses[0];
addressWithoutFunds = userAddresses[1];
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -39,7 +32,6 @@ describe('SubscriptionTest', () => {
describe('#subscribe', () => {
const indexFilterValues = {};
let tokenAddress: string;
const allowanceAmount = new BigNumber(42);
let stubs: Sinon.SinonStub[] = [];
before(() => {
const tokenAddresses = tokenUtils.getDummyERC20TokenAddresses();
@@ -53,7 +45,7 @@ describe('SubscriptionTest', () => {
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => {
const callback = (err: Error | null, _logEvent?: DecodedLogEvent<ERC20TokenApprovalEventArgs>) =>
_.noop;
_.noop.bind(_);
contractWrappers.erc20Token.subscribe(
tokenAddress,
ERC20TokenEvents.Approval,

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "contracts",
"version": "2.1.47",
"version": "2.1.48",
"engines": {
"node": ">=6.12"
},
@@ -12,6 +12,7 @@
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s compile copy_artifacts generate_contract_wrappers",
"copy_artifacts": "copyfiles -u 4 '../migrations/artifacts/development/**/*' ./lib/artifacts;",
"test": "yarn run_mocha",
@@ -45,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/sol-cov": "^2.1.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/sol-cov": "^2.1.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -72,15 +73,15 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "4.0.0-beta.14",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.10",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.12 - _October 2, 2018_
* Dependencies updated
## v1.0.11 - _September 28, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/dev-utils",
"version": "1.0.10",
"version": "1.0.11",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:circleci": "yarn test:coverage",
@@ -42,12 +43,12 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"lodash": "^4.17.5"
},
"publishConfig": {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.10 - _October 2, 2018_
* Dependencies updated
## v1.0.9 - _September 28, 2018_
* Dependencies updated
## v1.0.8 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "ethereum-types",
"version": "1.0.8",
"version": "1.0.10",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"clean": "shx rm -rf lib generated_docs",
"lint": "tslint --project .",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"

View File

@@ -366,11 +366,7 @@ export type ErrorType =
export type ErrorSeverity = 'error' | 'warning';
export interface SolcError {
sourceLocation?: {
file: string;
start: number;
end: number;
};
sourceLocation?: SourceLocation;
type: ErrorType;
component: 'general' | 'ewasm';
severity: ErrorSeverity;
@@ -378,6 +374,12 @@ export interface SolcError {
formattedMessage?: string;
}
export interface SourceLocation {
file: string;
start: number;
end: number;
}
export interface EvmOutput {
bytecode: EvmBytecodeOutput;
deployedBytecode: EvmBytecodeOutput;
@@ -495,4 +497,4 @@ export interface CompilerOptions {
compilerSettings?: CompilerSettings;
contracts?: string[] | '*';
solcVersion?: string;
}
} // tslint:disable-line:max-file-line-count

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.5",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.7 - _October 2, 2018_
* Dependencies updated
## v1.0.6 - _September 28, 2018_
* Dependencies updated
## v1.0.5 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,11 +1,12 @@
{
"name": "@0xproject/fill-scenarios",
"version": "1.0.5",
"version": "1.0.6",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"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-trimmed/$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",
@@ -26,7 +27,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104",
"copyfiles": "^2.0.0",
@@ -37,13 +38,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.4",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.6 - _October 2, 2018_
* Dependencies updated
## v1.0.5 - _September 28, 2018_
* Dependencies updated
## v1.0.4 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/json-schemas",
"version": "1.0.4",
"version": "1.0.6",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"lint": "tslint --project .",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
@@ -38,14 +39,14 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
"dependencies": {
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/typescript-typings": "^3.0.0",
"@types/node": "*",
"jsonschema": "^1.2.0",
"lodash.values": "^4.3.0"
},
"devDependencies": {
"@0xproject/tslint-config": "^1.0.7",
"@0xproject/utils": "^1.0.11",
"@0xproject/utils": "^2.0.0",
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/metacoin",
"version": "0.0.21",
"version": "0.0.22",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"scripts": {
"lint": "tslint --project . --exclude **/src/contract_wrappers/**/*",
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s compile generate_contract_wrappers copy_artifacts",
"clean": "shx rm -rf lib artifacts src/contract_wrappers",
"copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib",
@@ -28,25 +29,25 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/base-contract": "^2.0.5",
"@0xproject/sol-cov": "^2.1.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/sol-cov": "^2.1.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/tslint-config": "^1.0.7",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5",
"run-s": "^0.0.0"
},
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/sol-compiler": "^1.1.6",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.12",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.14 - _October 2, 2018_
* Dependencies updated
## v1.0.13 - _September 28, 2018_
* Dependencies updated
## v1.0.12 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/migrations",
"version": "1.0.12",
"version": "1.0.13",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s copy_artifacts generate_contract_wrappers",
"copy_artifacts": "copyfiles 'artifacts/**/*' ./lib",
"clean": "shx rm -rf lib src/1.0.0/contract_wrappers src/2.0.0-testnet/contract_wrappers src/2.0.0/contract_wrappers artifacts/development",
@@ -30,10 +31,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"@0xproject/types": "^1.1.1",
"@0xproject/types": "^1.1.2",
"@types/yargs": "^10.0.0",
"copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",
@@ -44,15 +45,15 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@ledgerhq/hw-app-eth": "^4.3.0",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5"
},

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0xproject/monorepo-scripts",
"version": "1.0.9",
"version": "1.0.10",
"engines": {
"node": ">=6.12"
},
@@ -10,6 +10,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"lint": "tslint --project .",
"clean": "shx rm -rf lib",
"test:publish": "run-s build script:publish",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1538475601,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.6",
"changes": [
@@ -7,7 +16,8 @@
"Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address",
"pr": 1096
}
]
],
"timestamp": 1538157789
},
{
"timestamp": 1537907159,

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.7 - _October 2, 2018_
* Dependencies updated
## v1.0.6 - _September 28, 2018_
* Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address (#1096)
## v1.0.5 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/order-utils",
"version": "1.0.5",
"version": "1.0.6",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s update_artifacts generate_contract_wrappers",
"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": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-trimmed/$i.json lib/src/artifacts; done;",
@@ -38,7 +39,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -57,16 +58,16 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.5",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/assert": "^1.0.12",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@types/node": "*",
"bn.js": "^4.11.8",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "4.0.0-beta.14",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1538475601,
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.1.0",
"changes": [
@@ -6,7 +15,8 @@
"note": "Export ExpirationWatcher",
"pr": 1097
}
]
],
"timestamp": 1538157789
},
{
"version": "2.0.0",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _October 2, 2018_
* Dependencies updated
## v2.1.0 - _September 28, 2018_
* Export ExpirationWatcher (#1097)
## v2.0.0 - _September 25, 2018_
* Fixes dropped events issue by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too. (#1080)

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/order-watcher",
"version": "2.0.0",
"version": "2.1.0",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -13,6 +13,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"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",
@@ -42,9 +43,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.12",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/migrations": "^1.0.13",
"@0xproject/tslint-config": "^1.0.7",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
@@ -70,18 +71,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.5",
"@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/fill-scenarios": "^1.0.5",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/assert": "^1.0.12",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/contract-wrappers": "^2.0.1",
"@0xproject/fill-scenarios": "^1.0.6",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"bintrees": "^1.0.2",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethereumjs-blockstream": "6.0.0",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.11",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _October 2, 2018_
* Dependencies updated
## v1.0.12 - _September 28, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/react-docs",
"version": "1.0.11",
"version": "1.0.12",
"engines": {
"node": ">=6.12"
},
@@ -10,6 +10,7 @@
"scripts": {
"lint": "tslint --project .",
"build": "tsc -b",
"build:ci": "yarn build",
"clean": "shx rm -rf lib"
},
"author": "Fabio Berger",
@@ -23,7 +24,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"@types/compare-versions": "^3.0.0",
"copyfiles": "^2.0.0",
@@ -33,9 +34,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/react-shared": "^1.0.12",
"@0xproject/types": "^1.1.0",
"@0xproject/utils": "^1.0.11",
"@0xproject/react-shared": "^1.0.13",
"@0xproject/types": "^1.1.2",
"@0xproject/utils": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/material-ui": "^0.20.0",
"@types/node": "*",

View File

@@ -218,11 +218,11 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
_.isEmpty(docSection.events);
const sortedTypes = _.sortBy(docSection.types, 'name');
const typeDefs = _.map(sortedTypes, customType => {
const typeDefs = _.map(sortedTypes, (customType, i) => {
return (
<TypeDefinition
sectionName={sectionName}
key={`type-${customType.name}`}
key={`type-${customType.name}-${i}`}
customType={customType}
docsInfo={this.props.docsInfo}
typeDefinitionByName={typeDefinitionByName}
@@ -353,7 +353,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
key={`badge-${networkName}-${sectionName}`}
href={linkIfExists}
target="_blank"
style={{ color: colors.white, textDecoration: 'none' }}
style={{ color: colors.white, textDecoration: 'none', marginTop: 8 }}
>
<Badge title={networkName} backgroundColor={networkNameToColor[networkName]} />
</a>

View File

@@ -20,9 +20,9 @@ export interface InterfaceProps {
export const Interface: React.SFC<InterfaceProps> = (props: InterfaceProps): any => {
const type = props.type;
const properties = _.map(type.children, property => {
const properties = _.map(type.children, (property, i) => {
return (
<span key={`property-${property.name}-${property.type}-${type.name}`}>
<span key={`property-${property.name}-${property.type}-${type.name}-${i}`}>
{property.name}:{' '}
{property.type && !_.isUndefined(property.type.method) ? (
<Signature

View File

@@ -19,12 +19,14 @@ export interface SignatureProps {
callPath?: string;
docsInfo: DocsInfo;
isInPopover: boolean;
isFallback?: boolean;
}
const defaultProps = {
shouldHideMethodName: false,
shouldUseArrowSyntax: false,
callPath: '',
isFallback: false,
};
export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
@@ -34,6 +36,7 @@ export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
props.docsInfo,
sectionName,
props.isInPopover,
props.name,
props.typeDefinitionByName,
);
const paramStringArray: any[] = [];
@@ -75,7 +78,7 @@ export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
return (
<span style={{ fontSize: 15 }}>
{props.callPath}
{methodName}
{props.isFallback ? '' : methodName}
{typeParameterIfExists}({hasMoreThenTwoParams && <br />}
{paramStringArray})
{props.returnType && (
@@ -101,9 +104,10 @@ function renderParameters(
docsInfo: DocsInfo,
sectionName: string,
isInPopover: boolean,
name: string,
typeDefinitionByName?: TypeDefinitionByName,
): React.ReactNode[] {
const params = _.map(parameters, (p: Parameter) => {
const params = _.map(parameters, (p: Parameter, i: number) => {
const isOptional = p.isOptional;
const hasDefaultValue = !_.isUndefined(p.defaultValue);
const type = (
@@ -116,9 +120,14 @@ function renderParameters(
/>
);
return (
<span key={`param-${p.type}-${p.name}`}>
{p.name}
{isOptional && '?'}: {type}
<span key={`param-${JSON.stringify(p.type)}-${name}-${i}`}>
{!_.isEmpty(p.name) && (
<span>
{p.name}
{isOptional && '?'}:{' '}
</span>
)}
{type}
{hasDefaultValue && ` = ${p.defaultValue}`}
</span>
);

View File

@@ -32,7 +32,6 @@ export interface SignatureBlockState {
const styles: Styles = {
chip: {
fontSize: 13,
backgroundColor: colors.lightBlueA700,
color: colors.white,
height: 11,
borderRadius: 14,
@@ -50,6 +49,8 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
public render(): React.ReactNode {
const method = this.props.method;
const isFallback = (method as SolidityMethod).isFallback;
const hasExclusivelyNamedParams = !_.isUndefined(_.find(method.parameters, p => !_.isEmpty(p.name)));
return (
<div
id={`${this.props.sectionName}-${method.name}`}
@@ -63,10 +64,11 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
{(method as TypescriptMethod).isStatic && this._renderChip('Static')}
{(method as SolidityMethod).isConstant && this._renderChip('Constant')}
{(method as SolidityMethod).isPayable && this._renderChip('Payable')}
{isFallback && this._renderChip('Fallback', colors.lightGreenA700)}
<div style={{ lineHeight: 1.3 }}>
<AnchorTitle
headerSize={HeaderSizes.H3}
title={method.name}
title={isFallback ? '' : method.name}
id={`${this.props.sectionName}-${method.name}`}
shouldShowAnchor={this.state.shouldShowAnchor}
/>
@@ -84,6 +86,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
typeDefinitionByName={this.props.typeDefinitionByName}
docsInfo={this.props.docsInfo}
isInPopover={false}
isFallback={isFallback}
/>
</code>
{(method as TypescriptMethod).source && (
@@ -95,12 +98,13 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
)}
{method.comment && <Comment comment={method.comment} className="py2" />}
{method.parameters &&
!_.isEmpty(method.parameters) && (
!_.isEmpty(method.parameters) &&
hasExclusivelyNamedParams && (
<div>
<h4 className="pb1 thin" style={{ borderBottom: '1px solid #e1e8ed' }}>
ARGUMENTS
</h4>
{this._renderParameterDescriptions(method.parameters)}
{this._renderParameterDescriptions(method.parameters, method.name)}
</div>
)}
{method.returnComment && (
@@ -114,19 +118,19 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
</div>
);
}
private _renderChip(text: string): React.ReactNode {
private _renderChip(text: string, backgroundColor: string = colors.lightBlueA700): React.ReactNode {
return (
<div className="p1 mr1" style={styles.chip}>
<div className="p1 mr1" style={{ ...styles.chip, backgroundColor }}>
{text}
</div>
);
}
private _renderParameterDescriptions(parameters: Parameter[]): React.ReactNode {
const descriptions = _.map(parameters, parameter => {
private _renderParameterDescriptions(parameters: Parameter[], name: string): React.ReactNode {
const descriptions = _.map(parameters, (parameter: Parameter, i: number) => {
const isOptional = parameter.isOptional;
return (
<div
key={`param-description-${parameter.name}`}
key={`param-description-${parameter.name}-${name}-${i}`}
className="flex pb1 mb2"
style={{ borderBottom: '1px solid #f0f4f7' }}
>

View File

@@ -7,12 +7,12 @@ import { Link as ScrollLink } from 'react-scroll';
import * as ReactTooltip from 'react-tooltip';
import { DocsInfo } from '../docs_info';
import { constants } from '../utils/constants';
import { Signature } from './signature';
import { TypeDefinition } from './type_definition';
const basicJsTypes = ['string', 'number', 'undefined', 'null', 'boolean'];
const basicSolidityTypes = ['bytes', 'bytes4', 'bytes32', 'uint8', 'uint256', 'address'];
const defaultProps = {};
@@ -80,7 +80,7 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
case TypeDocTypes.Array:
typeName = type.elementType.name;
if (_.includes(basicJsTypes, typeName)) {
if (_.includes(basicJsTypes, typeName) || _.includes(basicSolidityTypes, typeName)) {
typeNameColor = colors.orange;
}
break;
@@ -168,10 +168,10 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
break;
case TypeDocTypes.Tuple:
const tupleTypes = _.map(type.tupleElements, t => {
const tupleTypes = _.map(type.tupleElements, (t, i) => {
return (
<Type
key={`type-tuple-${t.name}-${t.typeDocType}`}
key={`type-tuple-${t.name}-${t.typeDocType}-${i}`}
type={t}
sectionName={props.sectionName}
typeDefinitionByName={props.typeDefinitionByName}
@@ -221,7 +221,7 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
const id = Math.random().toString();
const typeDefinitionAnchorId = isExportedClassReference
? props.type.name
: `${constants.TYPES_SECTION_NAME}-${typeName}`;
: `${props.docsInfo.typeSectionName}-${typeName}`;
typeName = (
<ScrollLink
to={typeDefinitionAnchorId}

View File

@@ -5,7 +5,7 @@ import * as _ from 'lodash';
import * as React from 'react';
import { DocsInfo } from '../docs_info';
import { KindString } from '../types';
import { KindString, SupportedDocJson } from '../types';
import { constants } from '../utils/constants';
import { Comment } from './comment';
@@ -46,7 +46,7 @@ export class TypeDefinition extends React.Component<TypeDefinitionProps, TypeDef
let codeSnippet: React.ReactNode;
switch (customType.kindString) {
case KindString.Interface:
typePrefix = 'Interface';
typePrefix = this.props.docsInfo.type === SupportedDocJson.SolDoc ? 'Struct' : 'Interface';
codeSnippet = (
<Interface
type={customType}

View File

@@ -18,6 +18,7 @@ export class DocsInfo {
public packageName: string;
public packageUrl: string;
public menu: DocsMenu;
public typeSectionName: string;
public sections: SectionsMap;
public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
@@ -28,6 +29,7 @@ export class DocsInfo {
this.displayName = config.displayName;
this.packageName = config.packageName;
this.packageUrl = config.packageUrl;
this.typeSectionName = config.type === SupportedDocJson.SolDoc ? 'structs' : 'types';
this.sections = config.markdownSections;
this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion;
this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId;
@@ -53,7 +55,7 @@ export class DocsInfo {
_.isEmpty(docSection.properties) &&
_.isEmpty(docSection.events);
if (!_.isUndefined(this.sections.types) && sectionName === this.sections.types) {
if (sectionName === this.typeSectionName) {
const sortedTypesNames = _.sortBy(docSection.types, 'name');
const typeNames = _.map(sortedTypesNames, t => t.name);
menuSubsectionsBySection[sectionName] = typeNames;
@@ -82,12 +84,12 @@ export class DocsInfo {
return menuSubsectionsBySection;
}
public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } {
if (_.isUndefined(this.sections.types)) {
if (_.isUndefined(docAgnosticFormat[this.typeSectionName])) {
return {};
}
const typeDocSection = docAgnosticFormat[this.sections.types];
const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
const section = docAgnosticFormat[this.typeSectionName];
const typeDefinitionByName = _.keyBy(section.types, 'name') as any;
return typeDefinitionByName;
}
}

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.12",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.14 - _October 2, 2018_
* Dependencies updated
## v1.0.13 - _September 28, 2018_
* Dependencies updated
## v1.0.12 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/react-shared",
"version": "1.0.12",
"version": "1.0.14",
"engines": {
"node": ">=6.12"
},
@@ -10,6 +10,7 @@
"scripts": {
"lint": "tslint --project .",
"build": "tsc",
"build:ci": "yarn build",
"watch_without_deps": "tsc -w",
"clean": "shx rm -rf lib"
},
@@ -24,7 +25,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.1.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.1.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.1.5",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.7 - _October 2, 2018_
* Dependencies updated
## v1.1.6 - _September 28, 2018_
* Dependencies updated
## v1.1.5 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/sol-compiler",
"version": "1.1.5",
"version": "1.1.6",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s update_contract_fixtures",
"update_contract_fixtures": "copyfiles 'test/fixtures/contracts/**/*' ./lib",
"test": "yarn run_mocha",
@@ -41,7 +42,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"@types/mkdirp": "^0.5.2",
"@types/require-from-string": "^1.2.0",
@@ -64,16 +65,16 @@
"zeppelin-solidity": "1.8.0"
},
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/json-schemas": "^1.0.4",
"@0xproject/sol-resolver": "^1.0.11",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/assert": "^1.0.12",
"@0xproject/json-schemas": "^1.0.5",
"@0xproject/sol-resolver": "^1.0.12",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@types/yargs": "^11.0.0",
"chalk": "^2.3.0",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",

View File

@@ -25,4 +25,5 @@ export {
StandardContractOutput,
StandardOutput,
StateMutability,
SourceLocation,
} from 'ethereum-types';

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "2.1.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "2.1.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "2.1.5",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.7 - _October 2, 2018_
* Dependencies updated
## v2.1.6 - _September 28, 2018_
* Dependencies updated
## v2.1.5 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/sol-cov",
"version": "2.1.5",
"version": "2.1.6",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s copy_test_fixtures",
"lint": "tslint --project .",
"test": "run-s compile_test run_mocha",
@@ -41,13 +42,13 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethereumjs-util": "^5.1.1",
"glob": "^7.1.2",
"istanbul": "^0.4.5",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.0",
"changes": [

View File

@@ -0,0 +1,18 @@
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
CHANGELOG
## v1.0.2 - _October 2, 2018_
* Dependencies updated
## v1.0.1 - _September 28, 2018_
* Dependencies updated
## v1.0.0 - _Invalid date_
* Utility to generate documentation for Solidity smart contracts, outputting a format compliant with @0xproject/types.DocAgnosticFormat (#1004)

View File

@@ -1,11 +1,12 @@
{
"name": "@0xproject/sol-doc",
"version": "1.0.0",
"version": "1.0.1",
"description": "Solidity documentation generator",
"main": "lib/src/index.js",
"types": "lib/src/index.d.js",
"scripts": {
"build": "tsc",
"build:ci": "yarn build",
"test": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 6000 --exit",
"test:circleci": "yarn test:coverage",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
@@ -13,7 +14,7 @@
"lint": "tslint --project . --format stylish",
"clean": "shx rm -rf lib",
"generate-v1-protocol-docs": "(cd ../contracts/src/1.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts Exchange/Exchange_v1.sol TokenRegistry/TokenRegistry.sol TokenTransferProxy/TokenTransferProxy_v1.sol) > v1.0.0.json",
"generate-v2-protocol-docs": "(cd ../contracts/src/2.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts $(cd protocol; ls -C1 */*.sol */interfaces/*.sol) ) > v2.0.0.json",
"generate-v2-protocol-docs": "(cd ../contracts/src/2.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts Exchange/Exchange.sol AssetProxy/ERC20Proxy.sol AssetProxy/ERC721Proxy.sol OrderValidator/OrderValidator.sol Forwarder/Forwarder.sol AssetProxyOwner/AssetProxyOwner.sol) > v2.0.0.json",
"deploy-v2-protocol-docs": "aws --profile 0xproject s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json v2.0.0.json s3://staging-doc-jsons/contracts/",
"deploy-v1-protocol-docs": "aws --profile 0xproject s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json v1.0.0.json s3://staging-doc-jsons/contracts/"
},
@@ -24,10 +25,11 @@
"author": "F. Eugene Aumson",
"license": "Apache-2.0",
"dependencies": {
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/types": "^1.1.1",
"@0xproject/utils": "^1.0.11",
"ethereum-types": "^1.0.4",
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/types": "^1.1.2",
"@0xproject/utils": "^2.0.0",
"ethereum-types": "^1.0.9",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.10",
"yargs": "^12.0.2"
},

View File

@@ -3,7 +3,7 @@ import * as yargs from 'yargs';
import { logUtils } from '@0xproject/utils';
import { generateSolDocAsync } from './solidity_doc_generator';
import { SolDoc } from './sol_doc';
const JSON_TAB_WIDTH = 4;
@@ -20,7 +20,20 @@ const JSON_TAB_WIDTH = 4;
.demandOption('contracts-dir')
.array('contracts')
.help().argv;
const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts);
// Unfortunately, the only way to currently retrieve the declared structs within Solidity contracts
// is to tease them out of the params/return values included in the ABI. These structures do
// not include the structs actual name, so we need a mapping to assign the proper name to a
// struct. If the name is not in this mapping, the structs name will default to the param/return value
// name (which mostly coincide).
const customTypeHashToName: { [hash: string]: string } = {
'52d4a768701076c7bac06e386e430883975eb398732eccba797fd09dd064a60e': 'Order',
'46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResults',
c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo',
c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo',
'6de3264a1040e027d4bdd29c71e963028238ac4ef060541078a7aced44a4d46f': 'MatchedFillResults',
};
const solDoc = new SolDoc();
const doc = await solDoc.generateSolDocAsync(argv.contractsDir, argv.contracts, customTypeHashToName);
process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH));
})().catch(err => {
logUtils.warn(err);

View File

@@ -1 +1 @@
export { generateSolDocAsync } from './solidity_doc_generator';
export { SolDoc } from './sol_doc';

View File

@@ -0,0 +1,500 @@
import * as path from 'path';
import {
AbiDefinition,
ConstructorAbi,
DataItem,
DevdocOutput,
EventAbi,
EventParameter,
FallbackAbi,
MethodAbi,
StandardContractOutput,
} from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
import { Compiler, CompilerOptions } from '@0xproject/sol-compiler';
import {
CustomType,
CustomTypeChild,
DocAgnosticFormat,
DocSection,
Event,
EventArg,
ObjectMap,
Parameter,
SolidityMethod,
Type,
TypeDocTypes,
} from '@0xproject/types';
export class SolDoc {
private _customTypeHashToName: ObjectMap<string> | undefined;
private static _genEventDoc(abiDefinition: EventAbi): Event {
const eventDoc: Event = {
name: abiDefinition.name,
eventArgs: SolDoc._genEventArgsDoc(abiDefinition.inputs),
};
return eventDoc;
}
private static _devdocMethodDetailsIfExist(
methodSignature: string,
devdocIfExists: DevdocOutput | undefined,
): string | undefined {
let details;
if (!_.isUndefined(devdocIfExists)) {
const devdocMethodsIfExist = devdocIfExists.methods;
if (!_.isUndefined(devdocMethodsIfExist)) {
const devdocMethodIfExists = devdocMethodsIfExist[methodSignature];
if (!_.isUndefined(devdocMethodIfExists)) {
const devdocMethodDetailsIfExist = devdocMethodIfExists.details;
if (!_.isUndefined(devdocMethodDetailsIfExist)) {
details = devdocMethodDetailsIfExist;
}
}
}
}
return details;
}
private static _genFallbackDoc(
abiDefinition: FallbackAbi,
devdocIfExists: DevdocOutput | undefined,
): SolidityMethod {
const methodSignature = `()`;
const comment = SolDoc._devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const returnComment =
_.isUndefined(devdocIfExists) || _.isUndefined(devdocIfExists.methods[methodSignature])
? undefined
: devdocIfExists.methods[methodSignature].return;
const methodDoc: SolidityMethod = {
isConstructor: false,
name: 'fallback',
callPath: '',
parameters: [],
returnType: { name: 'void', typeDocType: TypeDocTypes.Intrinsic },
returnComment,
isConstant: true,
isPayable: abiDefinition.payable,
isFallback: true,
comment: _.isEmpty(comment)
? 'The fallback function. It is executed on a call to the contract if none of the other functions match the given public identifier (or if no data was supplied at all).'
: comment,
};
return methodDoc;
}
private static _genEventArgsDoc(args: EventParameter[]): EventArg[] {
const eventArgsDoc: EventArg[] = [];
for (const arg of args) {
const name = arg.name;
const type: Type = {
name: arg.type,
typeDocType: TypeDocTypes.Intrinsic,
};
const eventArgDoc: EventArg = {
isIndexed: arg.indexed,
name,
type,
};
eventArgsDoc.push(eventArgDoc);
}
return eventArgsDoc;
}
private static _dedupStructs(customTypes: CustomType[]): CustomType[] {
const uniqueCustomTypes: CustomType[] = [];
const seenTypes: { [hash: string]: boolean } = {};
_.each(customTypes, customType => {
const hash = SolDoc._generateCustomTypeHash(customType);
if (!seenTypes[hash]) {
uniqueCustomTypes.push(customType);
seenTypes[hash] = true;
}
});
return uniqueCustomTypes;
}
private static _capitalize(text: string): string {
return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
}
private static _generateCustomTypeHash(customType: CustomType): string {
const customTypeWithoutName = _.cloneDeep(customType);
delete customTypeWithoutName.name;
const customTypeWithoutNameStr = JSON.stringify(customTypeWithoutName);
const hash = ethUtil.sha256(customTypeWithoutNameStr).toString('hex');
return hash;
}
private static _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[]): CompilerOptions {
const compilerOptions: CompilerOptions = {
contractsDir,
contracts: '*',
compilerSettings: {
outputSelection: {
['*']: {
['*']: ['abi', 'devdoc'],
},
},
},
};
const shouldOverrideCatchAllContractsConfig =
!_.isUndefined(contractsToCompile) && contractsToCompile.length > 0;
if (shouldOverrideCatchAllContractsConfig) {
compilerOptions.contracts = contractsToCompile;
}
return compilerOptions;
}
/**
* Invoke the Solidity compiler and transform its ABI and devdoc outputs into a
* JSON format easily consumed by documentation rendering tools.
* @param contractsToDocument list of contracts for which to generate doc objects
* @param contractsDir the directory in which to find the `contractsToCompile` as well as their dependencies.
* @return doc object for use with documentation generation tools.
*/
public async generateSolDocAsync(
contractsDir: string,
contractsToDocument?: string[],
customTypeHashToName?: ObjectMap<string>,
): Promise<DocAgnosticFormat> {
this._customTypeHashToName = customTypeHashToName;
const docWithDependencies: DocAgnosticFormat = {};
const compilerOptions = SolDoc._makeCompilerOptions(contractsDir, contractsToDocument);
const compiler = new Compiler(compilerOptions);
const compilerOutputs = await compiler.getCompilerOutputsAsync();
let structs: CustomType[] = [];
for (const compilerOutput of compilerOutputs) {
const contractFileNames = _.keys(compilerOutput.contracts);
for (const contractFileName of contractFileNames) {
const contractNameToOutput = compilerOutput.contracts[contractFileName];
const contractNames = _.keys(contractNameToOutput);
for (const contractName of contractNames) {
const compiledContract = contractNameToOutput[contractName];
if (_.isUndefined(compiledContract.abi)) {
throw new Error('compiled contract did not contain ABI output');
}
docWithDependencies[contractName] = this._genDocSection(compiledContract, contractName);
structs = [...structs, ...this._extractStructs(compiledContract)];
}
}
}
structs = SolDoc._dedupStructs(structs);
structs = this._overwriteStructNames(structs);
let doc: DocAgnosticFormat = {};
if (_.isUndefined(contractsToDocument) || contractsToDocument.length === 0) {
doc = docWithDependencies;
} else {
for (const contractToDocument of contractsToDocument) {
const contractBasename = path.basename(contractToDocument);
const contractName =
contractBasename.lastIndexOf('.sol') === -1
? contractBasename
: contractBasename.substring(0, contractBasename.lastIndexOf('.sol'));
doc[contractName] = docWithDependencies[contractName];
}
}
if (structs.length > 0) {
doc.structs = {
comment: '',
constructors: [],
methods: [],
properties: [],
types: structs,
functions: [],
events: [],
};
}
delete this._customTypeHashToName; // Clean up instance state
return doc;
}
private _getCustomTypeFromDataItem(inputOrOutput: DataItem): CustomType {
const customType: CustomType = {
name: _.capitalize(inputOrOutput.name),
kindString: 'Interface',
children: [],
};
_.each(inputOrOutput.components, (component: DataItem) => {
const childType = this._getTypeFromDataItem(component);
const customTypeChild = {
name: component.name,
type: childType,
};
// (fabio): Not sure why this type casting is necessary. Seems TS doesn't
// deduce that `customType.children` cannot be undefined anymore after being
// set to `[]` above.
(customType.children as CustomTypeChild[]).push(customTypeChild);
});
return customType;
}
private _getNameFromDataItemIfExists(dataItem: DataItem): string | undefined {
if (_.isUndefined(dataItem.components)) {
return undefined;
}
const customType = this._getCustomTypeFromDataItem(dataItem);
const hash = SolDoc._generateCustomTypeHash(customType);
if (_.isUndefined(this._customTypeHashToName) || _.isUndefined(this._customTypeHashToName[hash])) {
return undefined;
}
return this._customTypeHashToName[hash];
}
private _getTypeFromDataItem(dataItem: DataItem): Type {
const typeDocType = !_.isUndefined(dataItem.components) ? TypeDocTypes.Reference : TypeDocTypes.Intrinsic;
let typeName: string;
if (typeDocType === TypeDocTypes.Reference) {
const nameIfExists = this._getNameFromDataItemIfExists(dataItem);
typeName = _.isUndefined(nameIfExists) ? SolDoc._capitalize(dataItem.name) : nameIfExists;
} else {
typeName = dataItem.type;
}
const isArrayType = _.endsWith(dataItem.type, '[]');
let type: Type;
if (isArrayType) {
// tslint:disable-next-line:custom-no-magic-numbers
typeName = typeDocType === TypeDocTypes.Intrinsic ? typeName.slice(0, -2) : typeName;
type = {
elementType: { name: typeName, typeDocType },
typeDocType: TypeDocTypes.Array,
name: '',
};
} else {
type = { name: typeName, typeDocType };
}
return type;
}
private _overwriteStructNames(customTypes: CustomType[]): CustomType[] {
if (_.isUndefined(this._customTypeHashToName)) {
return customTypes;
}
const localCustomTypes = _.cloneDeep(customTypes);
_.each(localCustomTypes, (customType, i) => {
const hash = SolDoc._generateCustomTypeHash(customType);
if (!_.isUndefined(this._customTypeHashToName) && !_.isUndefined(this._customTypeHashToName[hash])) {
localCustomTypes[i].name = this._customTypeHashToName[hash];
}
});
return localCustomTypes;
}
private _extractStructs(compiledContract: StandardContractOutput): CustomType[] {
let customTypes: CustomType[] = [];
for (const abiDefinition of compiledContract.abi) {
let types: CustomType[] = [];
switch (abiDefinition.type) {
case 'constructor': {
types = this._getStructsAsCustomTypes(abiDefinition);
break;
}
case 'function': {
types = this._getStructsAsCustomTypes(abiDefinition);
break;
}
case 'event':
case 'fallback':
// No types exist
break;
default:
throw new Error(
`unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, // tslint:disable-line:no-unnecessary-type-assertion
);
}
customTypes = [...customTypes, ...types];
}
return customTypes;
}
private _genDocSection(compiledContract: StandardContractOutput, contractName: string): DocSection {
const docSection: DocSection = {
comment: _.isUndefined(compiledContract.devdoc) ? '' : compiledContract.devdoc.title,
constructors: [],
methods: [],
properties: [],
types: [],
functions: [],
events: [],
};
for (const abiDefinition of compiledContract.abi) {
switch (abiDefinition.type) {
case 'constructor':
docSection.constructors.push(
this._genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc),
);
break;
case 'event':
(docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition));
// note that we're not sending devdoc to this._genEventDoc().
// that's because the type of the events array doesn't have any fields for documentation!
break;
case 'function':
docSection.methods.push(this._genMethodDoc(abiDefinition, compiledContract.devdoc));
break;
case 'fallback':
docSection.methods.push(SolDoc._genFallbackDoc(abiDefinition, compiledContract.devdoc));
break;
default:
throw new Error(
`unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, // tslint:disable-line:no-unnecessary-type-assertion
);
}
}
return docSection;
}
private _genConstructorDoc(
contractName: string,
abiDefinition: ConstructorAbi,
devdocIfExists: DevdocOutput | undefined,
): SolidityMethod {
const { parameters, methodSignature } = this._genMethodParamsDoc('', abiDefinition.inputs, devdocIfExists);
const comment = SolDoc._devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const constructorDoc: SolidityMethod = {
isConstructor: true,
name: contractName,
callPath: '',
parameters,
returnType: { name: contractName, typeDocType: TypeDocTypes.Reference }, // sad we have to specify this
isConstant: false,
isPayable: abiDefinition.payable,
comment,
};
return constructorDoc;
}
private _genMethodDoc(abiDefinition: MethodAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod {
const name = abiDefinition.name;
const { parameters, methodSignature } = this._genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists);
const devDocComment = SolDoc._devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const returnType = this._genMethodReturnTypeDoc(abiDefinition.outputs);
const returnComment =
_.isUndefined(devdocIfExists) || _.isUndefined(devdocIfExists.methods[methodSignature])
? undefined
: devdocIfExists.methods[methodSignature].return;
const hasNoNamedParameters = _.isUndefined(_.find(parameters, p => !_.isEmpty(p.name)));
const isGeneratedGetter = hasNoNamedParameters;
const comment =
_.isEmpty(devDocComment) && isGeneratedGetter
? `This is an auto-generated accessor method of the '${name}' contract instance variable.`
: devDocComment;
const methodDoc: SolidityMethod = {
isConstructor: false,
name,
callPath: '',
parameters,
returnType,
returnComment,
isConstant: abiDefinition.constant,
isPayable: abiDefinition.payable,
comment,
};
return methodDoc;
}
/**
* Extract documentation for each method parameter from @param params.
*/
private _genMethodParamsDoc(
name: string,
abiParams: DataItem[],
devdocIfExists: DevdocOutput | undefined,
): { parameters: Parameter[]; methodSignature: string } {
const parameters: Parameter[] = [];
for (const abiParam of abiParams) {
const type = this._getTypeFromDataItem(abiParam);
const parameter: Parameter = {
name: abiParam.name,
comment: '<No comment>',
isOptional: false, // Unsupported in Solidity, until resolution of https://github.com/ethereum/solidity/issues/232
type,
};
parameters.push(parameter);
}
const methodSignature = `${name}(${abiParams
.map(abiParam => {
if (!_.startsWith(abiParam.type, 'tuple')) {
return abiParam.type;
} else {
// Need to expand tuples:
// E.g: fillOrder(tuple,uint256,bytes) -> fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)
const isArray = _.endsWith(abiParam.type, '[]');
const expandedTypes = _.map(abiParam.components, c => c.type);
const type = `(${expandedTypes.join(',')})${isArray ? '[]' : ''}`;
return type;
}
})
.join(',')})`;
if (!_.isUndefined(devdocIfExists)) {
const devdocMethodIfExists = devdocIfExists.methods[methodSignature];
if (!_.isUndefined(devdocMethodIfExists)) {
const devdocParamsIfExist = devdocMethodIfExists.params;
if (!_.isUndefined(devdocParamsIfExist)) {
for (const parameter of parameters) {
parameter.comment = devdocParamsIfExist[parameter.name];
}
}
}
}
return { parameters, methodSignature };
}
private _genMethodReturnTypeDoc(outputs: DataItem[]): Type {
let type: Type;
if (outputs.length > 1) {
type = {
name: '',
typeDocType: TypeDocTypes.Tuple,
tupleElements: [],
};
for (const output of outputs) {
const tupleType = this._getTypeFromDataItem(output);
(type.tupleElements as Type[]).push(tupleType);
}
return type;
} else if (outputs.length === 1) {
const output = outputs[0];
type = this._getTypeFromDataItem(output);
} else {
type = {
name: 'void',
typeDocType: TypeDocTypes.Intrinsic,
};
}
return type;
}
private _getStructsAsCustomTypes(abiDefinition: AbiDefinition): CustomType[] {
const customTypes: CustomType[] = [];
// We cast to `any` here because we do not know yet if this type of abiDefinition contains
// an `input` key
if (!_.isUndefined((abiDefinition as any).inputs)) {
const methodOrConstructorAbi = abiDefinition as MethodAbi | ConstructorAbi;
_.each(methodOrConstructorAbi.inputs, input => {
if (!_.isUndefined(input.components)) {
const customType = this._getCustomTypeFromDataItem(input);
customTypes.push(customType);
}
});
}
if (!_.isUndefined((abiDefinition as any).outputs)) {
const methodAbi = abiDefinition as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion
_.each(methodAbi.outputs, output => {
if (!_.isUndefined(output.components)) {
const customType = this._getCustomTypeFromDataItem(output);
customTypes.push(customType);
}
});
}
return customTypes;
}
}
// tslint:disable:max-file-line-count

View File

@@ -1,306 +0,0 @@
import * as path from 'path';
import * as _ from 'lodash';
import {
AbiDefinition,
ConstructorAbi,
DataItem,
DevdocOutput,
EventAbi,
EventParameter,
FallbackAbi,
MethodAbi,
StandardContractOutput,
} from 'ethereum-types';
import { Compiler, CompilerOptions } from '@0xproject/sol-compiler';
import {
DocAgnosticFormat,
DocSection,
Event,
EventArg,
Parameter,
SolidityMethod,
Type,
TypeDocTypes,
} from '@0xproject/types';
/**
* Invoke the Solidity compiler and transform its ABI and devdoc outputs into a
* JSON format easily consumed by documentation rendering tools.
* @param contractsToDocument list of contracts for which to generate doc objects
* @param contractsDir the directory in which to find the `contractsToCompile` as well as their dependencies.
* @return doc object for use with documentation generation tools.
*/
export async function generateSolDocAsync(
contractsDir: string,
contractsToDocument?: string[],
): Promise<DocAgnosticFormat> {
const docWithDependencies: DocAgnosticFormat = {};
const compilerOptions = _makeCompilerOptions(contractsDir, contractsToDocument);
const compiler = new Compiler(compilerOptions);
const compilerOutputs = await compiler.getCompilerOutputsAsync();
for (const compilerOutput of compilerOutputs) {
const contractFileNames = _.keys(compilerOutput.contracts);
for (const contractFileName of contractFileNames) {
const contractNameToOutput = compilerOutput.contracts[contractFileName];
const contractNames = _.keys(contractNameToOutput);
for (const contractName of contractNames) {
const compiledContract = contractNameToOutput[contractName];
if (_.isUndefined(compiledContract.abi)) {
throw new Error('compiled contract did not contain ABI output');
}
docWithDependencies[contractName] = _genDocSection(compiledContract, contractName);
}
}
}
let doc: DocAgnosticFormat = {};
if (_.isUndefined(contractsToDocument) || contractsToDocument.length === 0) {
doc = docWithDependencies;
} else {
for (const contractToDocument of contractsToDocument) {
const contractBasename = path.basename(contractToDocument);
const contractName =
contractBasename.lastIndexOf('.sol') === -1
? contractBasename
: contractBasename.substring(0, contractBasename.lastIndexOf('.sol'));
doc[contractName] = docWithDependencies[contractName];
}
}
return doc;
}
function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[]): CompilerOptions {
const compilerOptions: CompilerOptions = {
contractsDir,
contracts: '*',
compilerSettings: {
outputSelection: {
['*']: {
['*']: ['abi', 'devdoc'],
},
},
},
};
const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile) && contractsToCompile.length > 0;
if (shouldOverrideCatchAllContractsConfig) {
compilerOptions.contracts = contractsToCompile;
}
return compilerOptions;
}
function _genDocSection(compiledContract: StandardContractOutput, contractName: string): DocSection {
const docSection: DocSection = {
comment: _.isUndefined(compiledContract.devdoc) ? '' : compiledContract.devdoc.title,
constructors: [],
methods: [],
properties: [],
types: [],
functions: [],
events: [],
};
for (const abiDefinition of compiledContract.abi) {
switch (abiDefinition.type) {
case 'constructor':
docSection.constructors.push(_genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc));
break;
case 'event':
(docSection.events as Event[]).push(_genEventDoc(abiDefinition));
// note that we're not sending devdoc to _genEventDoc().
// that's because the type of the events array doesn't have any fields for documentation!
break;
case 'function':
case 'fallback':
docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc));
break;
default:
throw new Error(
`unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`,
);
}
}
return docSection;
}
function _genConstructorDoc(
contractName: string,
abiDefinition: ConstructorAbi,
devdocIfExists: DevdocOutput | undefined,
): SolidityMethod {
const { parameters, methodSignature } = _genMethodParamsDoc('', abiDefinition.inputs, devdocIfExists);
const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const constructorDoc: SolidityMethod = {
isConstructor: true,
name: contractName,
callPath: '',
parameters,
returnType: { name: contractName, typeDocType: TypeDocTypes.Reference }, // sad we have to specify this
isConstant: false,
isPayable: abiDefinition.payable,
comment,
};
return constructorDoc;
}
function _devdocMethodDetailsIfExist(
methodSignature: string,
devdocIfExists: DevdocOutput | undefined,
): string | undefined {
let details;
if (!_.isUndefined(devdocIfExists)) {
const devdocMethodsIfExist = devdocIfExists.methods;
if (!_.isUndefined(devdocMethodsIfExist)) {
const devdocMethodIfExists = devdocMethodsIfExist[methodSignature];
if (!_.isUndefined(devdocMethodIfExists)) {
const devdocMethodDetailsIfExist = devdocMethodIfExists.details;
if (!_.isUndefined(devdocMethodDetailsIfExist)) {
details = devdocMethodDetailsIfExist;
}
}
}
}
return details;
}
function _genMethodDoc(
abiDefinition: MethodAbi | FallbackAbi,
devdocIfExists: DevdocOutput | undefined,
): SolidityMethod {
const name = abiDefinition.type === 'fallback' ? '' : abiDefinition.name;
const { parameters, methodSignature } =
abiDefinition.type === 'fallback'
? { parameters: [], methodSignature: `${name}()` }
: _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists);
const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const returnType =
abiDefinition.type === 'fallback'
? { name: '', typeDocType: TypeDocTypes.Intrinsic }
: _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists);
const returnComment =
_.isUndefined(devdocIfExists) || _.isUndefined(devdocIfExists.methods[methodSignature])
? undefined
: devdocIfExists.methods[methodSignature].return;
const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant;
const methodDoc: SolidityMethod = {
isConstructor: false,
name,
callPath: '',
parameters,
returnType,
returnComment,
isConstant,
isPayable: abiDefinition.payable,
comment,
};
return methodDoc;
}
function _genEventDoc(abiDefinition: EventAbi): Event {
const eventDoc: Event = {
name: abiDefinition.name,
eventArgs: _genEventArgsDoc(abiDefinition.inputs, undefined),
};
return eventDoc;
}
function _genEventArgsDoc(args: EventParameter[], devdocIfExists: DevdocOutput | undefined): EventArg[] {
const eventArgsDoc: EventArg[] = [];
for (const arg of args) {
const name = arg.name;
const type: Type = {
name: arg.type,
typeDocType: TypeDocTypes.Intrinsic,
};
const eventArgDoc: EventArg = {
isIndexed: arg.indexed,
name,
type,
};
eventArgsDoc.push(eventArgDoc);
}
return eventArgsDoc;
}
/**
* Extract documentation for each method parameter from @param params.
*/
function _genMethodParamsDoc(
name: string,
abiParams: DataItem[],
devdocIfExists: DevdocOutput | undefined,
): { parameters: Parameter[]; methodSignature: string } {
const parameters: Parameter[] = [];
for (const abiParam of abiParams) {
const parameter: Parameter = {
name: abiParam.name,
comment: '',
isOptional: false, // Unsupported in Solidity, until resolution of https://github.com/ethereum/solidity/issues/232
type: { name: abiParam.type, typeDocType: TypeDocTypes.Intrinsic },
};
parameters.push(parameter);
}
const methodSignature = `${name}(${abiParams
.map(abiParam => {
return abiParam.type;
})
.join(',')})`;
if (!_.isUndefined(devdocIfExists)) {
const devdocMethodIfExists = devdocIfExists.methods[methodSignature];
if (!_.isUndefined(devdocMethodIfExists)) {
const devdocParamsIfExist = devdocMethodIfExists.params;
if (!_.isUndefined(devdocParamsIfExist)) {
for (const parameter of parameters) {
parameter.comment = devdocParamsIfExist[parameter.name];
}
}
}
}
return { parameters, methodSignature };
}
function _genMethodReturnTypeDoc(
outputs: DataItem[],
methodSignature: string,
devdocIfExists: DevdocOutput | undefined,
): Type {
const methodReturnTypeDoc: Type = {
name: '',
typeDocType: TypeDocTypes.Intrinsic,
tupleElements: undefined,
};
if (outputs.length > 1) {
methodReturnTypeDoc.typeDocType = TypeDocTypes.Tuple;
methodReturnTypeDoc.tupleElements = [];
for (const output of outputs) {
methodReturnTypeDoc.tupleElements.push({ name: output.type, typeDocType: TypeDocTypes.Intrinsic });
}
} else if (outputs.length === 1) {
methodReturnTypeDoc.typeDocType = TypeDocTypes.Intrinsic;
methodReturnTypeDoc.name = outputs[0].type;
}
return methodReturnTypeDoc;
}

View File

@@ -0,0 +1,18 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
contract StructParamAndReturn {
struct Stuff {
address anAddress;
uint256 aNumber;
}
/// @dev DEV_COMMENT
/// @param stuff STUFF_COMMENT
/// @return RETURN_COMMENT
function methodWithStructParamAndReturn(Stuff stuff) public pure returns(Stuff) {
return stuff;
}
}

View File

@@ -5,16 +5,17 @@ import 'mocha';
import { DocAgnosticFormat, Event, SolidityMethod } from '@0xproject/types';
import { generateSolDocAsync } from '../src/solidity_doc_generator';
import { SolDoc } from '../src/sol_doc';
import { chaiSetup } from './util/chai_setup';
chaiSetup.configure();
const expect = chai.expect;
const solDoc = new SolDoc();
describe('#SolidityDocGenerator', () => {
it('should generate a doc object that matches the devdoc-free TokenTransferProxy fixture', async () => {
const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'TokenTransferProxyNoDevdoc',
]);
expect(doc).to.not.be.undefined();
@@ -22,8 +23,8 @@ describe('#SolidityDocGenerator', () => {
verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxyNoDevdoc');
});
const docPromises: Array<Promise<DocAgnosticFormat>> = [
generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`),
generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []),
solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`),
solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []),
];
docPromises.forEach(docPromise => {
it('should generate a doc object that matches the TokenTransferProxy fixture with its dependencies', async () => {
@@ -48,7 +49,7 @@ describe('#SolidityDocGenerator', () => {
});
});
it('should generate a doc object that matches the TokenTransferProxy fixture', async () => {
const doc: DocAgnosticFormat = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
const doc: DocAgnosticFormat = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'TokenTransferProxy',
]);
verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxy');
@@ -56,7 +57,7 @@ describe('#SolidityDocGenerator', () => {
describe('when processing all the permutations of devdoc stuff that we use in our contracts', () => {
let doc: DocAgnosticFormat;
before(async () => {
doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['NatspecEverything']);
doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['NatspecEverything']);
expect(doc).to.not.be.undefined();
expect(doc.NatspecEverything).to.not.be.undefined();
});
@@ -159,7 +160,9 @@ describe('#SolidityDocGenerator', () => {
});
});
it('should document a method that returns multiple values', async () => {
const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['MultipleReturnValues']);
const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'MultipleReturnValues',
]);
expect(doc.MultipleReturnValues).to.not.be.undefined();
expect(doc.MultipleReturnValues.methods).to.not.be.undefined();
let methodWithMultipleReturnValues: SolidityMethod | undefined;
@@ -178,6 +181,39 @@ describe('#SolidityDocGenerator', () => {
}
expect(returnType.tupleElements.length).to.equal(2);
});
it('should document a method that has a struct param and return value', async () => {
const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'StructParamAndReturn',
]);
expect(doc.StructParamAndReturn).to.not.be.undefined();
expect(doc.StructParamAndReturn.methods).to.not.be.undefined();
let methodWithStructParamAndReturn: SolidityMethod | undefined;
for (const method of doc.StructParamAndReturn.methods) {
if (method.name === 'methodWithStructParamAndReturn') {
methodWithStructParamAndReturn = method;
}
}
if (_.isUndefined(methodWithStructParamAndReturn)) {
throw new Error('method should not be undefined');
}
/**
* Solc maps devDoc comments to methods using a method signature. If we incorrectly
* generate the methodSignatures, the devDoc comments won't be correctly associated
* with their methods and they won't show up in the output. By checking that the comments
* are included for a method with structs as params/returns, we are sure that the methodSignature
* generation is correct for this case.
*/
expect(methodWithStructParamAndReturn.comment).to.be.equal('DEV_COMMENT');
expect(methodWithStructParamAndReturn.returnComment).to.be.equal('RETURN_COMMENT');
expect(methodWithStructParamAndReturn.parameters[0].comment).to.be.equal('STUFF_COMMENT');
});
it('should document the structs included in a contract', async () => {
const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [
'StructParamAndReturn',
]);
expect(doc.structs).to.not.be.undefined();
expect(doc.structs.types.length).to.be.equal(1);
});
});
function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contractName: string): void {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.11",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _October 2, 2018_
* Dependencies updated
## v1.0.12 - _September 28, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/sol-resolver",
"version": "1.0.11",
"version": "1.0.13",
"engines": {
"node": ">=6.12"
},
@@ -9,6 +9,7 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
"clean": "shx rm -rf lib",
"lint": "tslint --project ."
},
@@ -30,8 +31,8 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"lodash": "^4.17.5"
},
"publishConfig": {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.11",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.13 - _October 2, 2018_
* Dependencies updated
## v1.0.12 - _September 28, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/sra-report",
"version": "1.0.11",
"version": "1.0.12",
"engines": {
"node": ">=6.12"
},
@@ -10,6 +10,7 @@
"scripts": {
"clean": "shx rm -rf lib",
"build": "tsc -b",
"build:ci": "yarn build",
"lint": "tslint --project .",
"test:circleci": "yarn test:coverage",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
@@ -33,13 +34,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
"dependencies": {
"@0xproject/assert": "^1.0.11",
"@0xproject/assert": "^1.0.12",
"@0xproject/connect": "1.0.4",
"@0xproject/json-schemas": "^0.8.3",
"@0xproject/order-utils": "^0.0.9",
"@0xproject/types": "^0.8.2",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"chalk": "^2.3.0",
"lodash": "^4.17.5",
"newman": "^3.9.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1538475601,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1538157789,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1537907159,
"version": "1.0.4",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.6 - _October 2, 2018_
* Dependencies updated
## v1.0.5 - _September 28, 2018_
* Dependencies updated
## v1.0.4 - _September 25, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/sra-spec",
"version": "1.0.4",
"version": "1.0.5",
"engines": {
"node": ">=6.12"
},
@@ -18,6 +18,7 @@
"test:circleci": "yarn test:coverage",
"clean": "shx rm -rf lib",
"build": "tsc -b && yarn copy_md_files && yarn build-json",
"build:ci": "yarn build",
"build-json": "node ./lib/build_scripts/buildJson",
"build:watch": "chokidar 'src/**/*' -c 'yarn build' ",
"copy_md_files": "copyfiles -u 2 './src/md/**/*.md' ./lib/src/md",
@@ -34,7 +35,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md",
"dependencies": {
"@0xproject/json-schemas": "^1.0.4"
"@0xproject/json-schemas": "^1.0.5"
},
"devDependencies": {
"@0xproject/tslint-config": "^1.0.7",

Some files were not shown because too many files have changed in this diff Show More