From 4779ebfd20d9c4b197d525453ac1ec47cc15e2bc Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 22 Aug 2018 17:32:01 -0400 Subject: split method --- packages/sol-compiler/src/compiler.ts | 51 ++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 7c76f3e52..c44585a36 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -110,6 +110,21 @@ export class Compiler { const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename)); return { solcInstance, fullSolcVersion }; } + private static _addHexPrefixes(compiledData: solc.StandardContractOutput): void { + if (!_.isUndefined(compiledData.evm)) { + if (!_.isUndefined(compiledData.evm.bytecode) && !_.isUndefined(compiledData.evm.bytecode.object)) { + compiledData.evm.bytecode.object = ethUtil.addHexPrefix(compiledData.evm.bytecode.object); + } + if ( + !_.isUndefined(compiledData.evm.deployedBytecode) && + !_.isUndefined(compiledData.evm.deployedBytecode.object) + ) { + compiledData.evm.deployedBytecode.object = ethUtil.addHexPrefix( + compiledData.evm.deployedBytecode.object, + ); + } + } + } /** * Instantiates a new instance of the Compiler class. * @param opts Optional compiler options @@ -214,11 +229,22 @@ export class Compiler { const compilerOutput = this._compile(solcInstance, input.standardInput); for (const contractPath of input.contractsToCompile) { - await this._verifyAndPersistCompiledContractAsync( + const contractName = contractPathToData[contractPath].contractName; + + const compiledData = compilerOutput.contracts[contractPath][contractName]; + if (_.isUndefined(compiledData)) { + throw new Error( + `Contract ${contractName} not found in ${contractPath}. Please make sure your contract has the same name as it's file name`, + ); + } + + Compiler._addHexPrefixes(compiledData); + + await this._persistCompiledContractAsync( contractPath, contractPathToData[contractPath].currentArtifactIfExists, contractPathToData[contractPath].sourceTreeHashHex, - contractPathToData[contractPath].contractName, + contractName, fullSolcVersion, compilerOutput, ); @@ -236,7 +262,7 @@ export class Compiler { return !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange; } } - private async _verifyAndPersistCompiledContractAsync( + private async _persistCompiledContractAsync( contractPath: string, currentArtifactIfExists: ContractArtifact | void, sourceTreeHashHex: string, @@ -245,25 +271,6 @@ export class Compiler { compilerOutput: solc.StandardOutput, ): Promise { const compiledData = compilerOutput.contracts[contractPath][contractName]; - if (_.isUndefined(compiledData)) { - throw new Error( - `Contract ${contractName} not found in ${contractPath}. Please make sure your contract has the same name as it's file name`, - ); - } - if (!_.isUndefined(compiledData.evm)) { - if (!_.isUndefined(compiledData.evm.bytecode) && !_.isUndefined(compiledData.evm.bytecode.object)) { - compiledData.evm.bytecode.object = ethUtil.addHexPrefix(compiledData.evm.bytecode.object); - } - if ( - !_.isUndefined(compiledData.evm.deployedBytecode) && - !_.isUndefined(compiledData.evm.deployedBytecode.object) - ) { - compiledData.evm.deployedBytecode.object = ethUtil.addHexPrefix( - compiledData.evm.deployedBytecode.object, - ); - } - } - const sourceCodes = _.mapValues( compilerOutput.sources, (_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source, -- cgit v1.2.3 From 5c056b57b7c16c2c7a27143dcfd1e7a340a191a9 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 22 Aug 2018 17:47:40 -0400 Subject: extract method _getContractNamesToCompile() --- packages/sol-compiler/src/compiler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index c44585a36..bc6243a8f 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -159,16 +159,17 @@ export class Compiler { public async compileAsync(): Promise { await createDirIfDoesNotExistAsync(this._artifactsDir); await createDirIfDoesNotExistAsync(SOLC_BIN_DIR); - let contractNamesToCompile: string[] = []; + await this._compileContractsAsync(this._getContractNamesToCompile()); + } + private _getContractNamesToCompile(): string[] { if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) { const allContracts = this._nameResolver.getAll(); - contractNamesToCompile = _.map(allContracts, contractSource => + return _.map(allContracts, contractSource => path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION), ); } else { - contractNamesToCompile = this._specifiedContracts; + return this._specifiedContracts; } - await this._compileContractsAsync(contractNamesToCompile); } /** * Compiles contract and saves artifact to artifactsDir. -- cgit v1.2.3 From 80ed724f3abd019dc1bcaa9e2a0f02d69c8f6649 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 23 Aug 2018 12:07:23 -0400 Subject: rename var `compiledData` to `compiledContract` --- packages/sol-compiler/src/compiler.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index bc6243a8f..cf406b583 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -110,17 +110,17 @@ export class Compiler { const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename)); return { solcInstance, fullSolcVersion }; } - private static _addHexPrefixes(compiledData: solc.StandardContractOutput): void { - if (!_.isUndefined(compiledData.evm)) { - if (!_.isUndefined(compiledData.evm.bytecode) && !_.isUndefined(compiledData.evm.bytecode.object)) { - compiledData.evm.bytecode.object = ethUtil.addHexPrefix(compiledData.evm.bytecode.object); + private static _addHexPrefixes(compiledContract: solc.StandardContractOutput): void { + if (!_.isUndefined(compiledContract.evm)) { + if (!_.isUndefined(compiledContract.evm.bytecode) && !_.isUndefined(compiledContract.evm.bytecode.object)) { + compiledContract.evm.bytecode.object = ethUtil.addHexPrefix(compiledContract.evm.bytecode.object); } if ( - !_.isUndefined(compiledData.evm.deployedBytecode) && - !_.isUndefined(compiledData.evm.deployedBytecode.object) + !_.isUndefined(compiledContract.evm.deployedBytecode) && + !_.isUndefined(compiledContract.evm.deployedBytecode.object) ) { - compiledData.evm.deployedBytecode.object = ethUtil.addHexPrefix( - compiledData.evm.deployedBytecode.object, + compiledContract.evm.deployedBytecode.object = ethUtil.addHexPrefix( + compiledContract.evm.deployedBytecode.object, ); } } @@ -232,14 +232,14 @@ export class Compiler { for (const contractPath of input.contractsToCompile) { const contractName = contractPathToData[contractPath].contractName; - const compiledData = compilerOutput.contracts[contractPath][contractName]; - if (_.isUndefined(compiledData)) { + const compiledContract = compilerOutput.contracts[contractPath][contractName]; + if (_.isUndefined(compiledContract)) { throw new Error( `Contract ${contractName} not found in ${contractPath}. Please make sure your contract has the same name as it's file name`, ); } - Compiler._addHexPrefixes(compiledData); + Compiler._addHexPrefixes(compiledContract); await this._persistCompiledContractAsync( contractPath, @@ -271,13 +271,13 @@ export class Compiler { fullSolcVersion: string, compilerOutput: solc.StandardOutput, ): Promise { - const compiledData = compilerOutput.contracts[contractPath][contractName]; + const compiledContract = compilerOutput.contracts[contractPath][contractName]; const sourceCodes = _.mapValues( compilerOutput.sources, (_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source, ); const contractVersion: ContractVersionData = { - compilerOutput: compiledData, + compilerOutput: compiledContract, sources: compilerOutput.sources, sourceCodes, sourceTreeHashHex, -- cgit v1.2.3 From 849e203812aacff453228a372143600b05155a2c Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 22 Aug 2018 17:52:28 -0400 Subject: add interface to return compiler output... ...rather than persisting it to the filesystem. --- packages/sol-compiler/src/compiler.ts | 44 ++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index cf406b583..91b17c4f2 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -159,7 +159,18 @@ export class Compiler { public async compileAsync(): Promise { await createDirIfDoesNotExistAsync(this._artifactsDir); await createDirIfDoesNotExistAsync(SOLC_BIN_DIR); - await this._compileContractsAsync(this._getContractNamesToCompile()); + await this._compileContractsAsync(this._getContractNamesToCompile(), true); + } + /** + * Compiles Solidity files specified during construction, and returns the + * compiler output given by solc. Return value is an array of outputs: + * Solidity modules are batched together by version required, and each + * element of the returned array corresponds to a compiler version, and + * each element contains the output for all of the modules compiled with + * that version. + */ + public async getCompilerOutputsAsync(): Promise { + return this._compileContractsAsync(this._getContractNamesToCompile(), false); } private _getContractNamesToCompile(): string[] { if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) { @@ -172,10 +183,14 @@ export class Compiler { } } /** - * Compiles contract and saves artifact to artifactsDir. + * Compiles contracts, and, if `shouldPersist` is true, saves artifacts to artifactsDir. * @param fileName Name of contract with '.sol' extension. + * @return an array of compiler outputs, where each element corresponds to a different version of solc-js. */ - private async _compileContractsAsync(contractNames: string[]): Promise { + private async _compileContractsAsync( + contractNames: string[], + shouldPersist: boolean, + ): Promise { // batch input contracts together based on the version of the compiler that they require. const versionToInputs: VersionToInputs = {}; @@ -216,6 +231,8 @@ export class Compiler { versionToInputs[solcVersion].contractsToCompile.push(contractSource.path); } + const compilerOutputs: solc.StandardOutput[] = []; + const solcVersions = _.keys(versionToInputs); for (const solcVersion of solcVersions) { const input = versionToInputs[solcVersion]; @@ -228,6 +245,7 @@ export class Compiler { const { solcInstance, fullSolcVersion } = await Compiler._getSolcAsync(solcVersion); const compilerOutput = this._compile(solcInstance, input.standardInput); + compilerOutputs.push(compilerOutput); for (const contractPath of input.contractsToCompile) { const contractName = contractPathToData[contractPath].contractName; @@ -241,16 +259,20 @@ export class Compiler { Compiler._addHexPrefixes(compiledContract); - await this._persistCompiledContractAsync( - contractPath, - contractPathToData[contractPath].currentArtifactIfExists, - contractPathToData[contractPath].sourceTreeHashHex, - contractName, - fullSolcVersion, - compilerOutput, - ); + if (shouldPersist) { + await this._persistCompiledContractAsync( + contractPath, + contractPathToData[contractPath].currentArtifactIfExists, + contractPathToData[contractPath].sourceTreeHashHex, + contractName, + fullSolcVersion, + compilerOutput, + ); + } } } + + return compilerOutputs; } private _shouldCompile(contractData: ContractData): boolean { if (_.isUndefined(contractData.currentArtifactIfExists)) { -- cgit v1.2.3 From 775d1efd4607a4097704fe3c4f7ae1156b2c1a6f Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 23 Aug 2018 14:00:34 -0400 Subject: add package sol-doc --- packages/react-docs/src/index.ts | 1 + packages/sol-compiler/src/index.ts | 1 + packages/sol-doc/package.json | 35 +++++++ packages/sol-doc/src/index.ts | 2 + packages/sol-doc/src/solidity_doc_format.ts | 5 + packages/sol-doc/src/solidity_doc_generator.ts | 60 +++++++++++ .../test/fixtures/contracts/TokenTransferProxy.sol | 115 +++++++++++++++++++++ .../sol-doc/test/solidity_doc_generator_test.ts | 22 ++++ packages/sol-doc/test/util/chai_setup.ts | 13 +++ packages/sol-doc/tsconfig.json | 7 ++ packages/sol-doc/tslint.json | 3 + 11 files changed, 264 insertions(+) create mode 100644 packages/sol-doc/package.json create mode 100644 packages/sol-doc/src/index.ts create mode 100644 packages/sol-doc/src/solidity_doc_format.ts create mode 100644 packages/sol-doc/src/solidity_doc_generator.ts create mode 100644 packages/sol-doc/test/fixtures/contracts/TokenTransferProxy.sol create mode 100644 packages/sol-doc/test/solidity_doc_generator_test.ts create mode 100644 packages/sol-doc/test/util/chai_setup.ts create mode 100644 packages/sol-doc/tsconfig.json create mode 100644 packages/sol-doc/tslint.json diff --git a/packages/react-docs/src/index.ts b/packages/react-docs/src/index.ts index e4424f679..8b3a146db 100644 --- a/packages/react-docs/src/index.ts +++ b/packages/react-docs/src/index.ts @@ -18,6 +18,7 @@ export { DocsInfo } from './docs_info'; export { DocsInfoConfig, DocAgnosticFormat, + DocSection, DoxityDocObj, DocsMenu, SupportedDocJson, diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index f8c2b577a..1ad07a9ff 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -6,3 +6,4 @@ export { CompilerSettingsMetadata, OptimizerSettings, } from 'ethereum-types'; +export { StandardOutput } from 'solc'; diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json new file mode 100644 index 000000000..91b69b968 --- /dev/null +++ b/packages/sol-doc/package.json @@ -0,0 +1,35 @@ +{ + "name": "@0xproject/sol-doc", + "version": "1.0.0", + "description": "Solidity documentation generator", + "main": "lib/src/index.js", + "types": "lib/src/index.d.js", + "scripts": { + "build": "tsc", + "test": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 5000 --exit", + "lint": "tslint --project . --format stylish", + "clean": "shx rm -rf lib" + }, + "repository": "https://github.com/0xProject/0x-monorepo.git", + "author": "F. Eugene Aumson", + "license": "Apache-2.0", + "private": false, + "dependencies": { + "@0xproject/react-docs": "^1.0.5", + "@0xproject/sol-compiler": "^1.0.5", + "@0xproject/utils": "^1.0.5", + "ethereum-types": "^1.0.4", + "lodash": "^4.17.10" + }, + "devDependencies": { + "chai": "^4.1.2", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.2", + "dirty-chai": "^2.0.1", + "make-promises-safe": "^1.1.0", + "mocha": "^5.2.0", + "shx": "^0.2.2", + "source-map-support": "^0.5.0", + "tslint": "5.11.0" + } +} diff --git a/packages/sol-doc/src/index.ts b/packages/sol-doc/src/index.ts new file mode 100644 index 000000000..f8f55c569 --- /dev/null +++ b/packages/sol-doc/src/index.ts @@ -0,0 +1,2 @@ +export { SolidityDocGenerator } from './solidity_doc_generator'; +export { SolidityDocFormat } from './solidity_doc_format'; diff --git a/packages/sol-doc/src/solidity_doc_format.ts b/packages/sol-doc/src/solidity_doc_format.ts new file mode 100644 index 000000000..edfd5c5b7 --- /dev/null +++ b/packages/sol-doc/src/solidity_doc_format.ts @@ -0,0 +1,5 @@ +import { DocAgnosticFormat, DocSection } from '@0xproject/react-docs'; + +export class SolidityDocFormat implements DocAgnosticFormat { + [sectionName: string]: DocSection; +} diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts new file mode 100644 index 000000000..c57a4779c --- /dev/null +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -0,0 +1,60 @@ +import * as _ from 'lodash'; + +import { MethodAbi } from 'ethereum-types'; + +import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; +import { logUtils } from '@0xproject/utils'; + +import { SolidityDocFormat } from './solidity_doc_format'; + +export class SolidityDocGenerator { + private readonly _compilerOptions: CompilerOptions; + constructor(contractsDir: string, artifactsDir: string) { + // instantiate sol-compiler, passing in options to say we want abi and devdoc + this._compilerOptions = { + contractsDir, + artifactsDir, + contracts: '*', + compilerSettings: { + outputSelection: { + ['*']: { + ['*']: ['abi', 'devdoc'], + }, + }, + }, + }; + } + /// run `contractsToCompile` through compiler, gathering output + public async generateAsync(contractsToCompile: string[]): Promise { + if (!_.isUndefined(contractsToCompile)) { + this._compilerOptions.contracts = contractsToCompile; + } + + const compiler = new Compiler(this._compilerOptions); + + const doc = new SolidityDocFormat(); + + const compilerOutputs = await compiler.getCompilerOutputsAsync(); + for (const compilerOutput of compilerOutputs) { + const solidityModules = _.keys(compilerOutput.contracts); + for (const solidityModule of solidityModules) { + const compiledSolidityModule = compilerOutput.contracts[solidityModule]; + + const contracts = _.keys(compiledSolidityModule); + for (const contract of contracts) { + const compiledContract = compiledSolidityModule[contract]; + + // TODO: modify typescript-typings/types/solc/index.d.ts... it doesn't currently support devdoc! + // tslint:disable-next-line:no-unnecessary-type-assertion tsc says abi[0] has no property `name` and won't compile without the `as`, but tslint says the `as` is unnecssary. + logUtils.log( + `TODO: extract data from ${contract}'s abi (eg ${ + (compiledContract.abi[0] as MethodAbi).name + }, etc) and devdoc outputs, and insert it into \`doc\``, + ); + } + } + } + + return doc; + } +} diff --git a/packages/sol-doc/test/fixtures/contracts/TokenTransferProxy.sol b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxy.sol new file mode 100644 index 000000000..44570d459 --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxy.sol @@ -0,0 +1,115 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.14; + +import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol"; +import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; + +/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance. +/// @author Amir Bandeali - , Will Warren - +contract TokenTransferProxy is Ownable { + + /// @dev Only authorized addresses can invoke functions with this modifier. + modifier onlyAuthorized { + require(authorized[msg.sender]); + _; + } + + modifier targetAuthorized(address target) { + require(authorized[target]); + _; + } + + modifier targetNotAuthorized(address target) { + require(!authorized[target]); + _; + } + + mapping (address => bool) public authorized; + address[] public authorities; + + event LogAuthorizedAddressAdded(address indexed target, address indexed caller); + event LogAuthorizedAddressRemoved(address indexed target, address indexed caller); + + /* + * Public functions + */ + + /// @dev Authorizes an address. + /// @param target Address to authorize. + function addAuthorizedAddress(address target) + public + onlyOwner + targetNotAuthorized(target) + { + authorized[target] = true; + authorities.push(target); + LogAuthorizedAddressAdded(target, msg.sender); + } + + /// @dev Removes authorizion of an address. + /// @param target Address to remove authorization from. + function removeAuthorizedAddress(address target) + public + onlyOwner + targetAuthorized(target) + { + delete authorized[target]; + for (uint i = 0; i < authorities.length; i++) { + if (authorities[i] == target) { + authorities[i] = authorities[authorities.length - 1]; + authorities.length -= 1; + break; + } + } + LogAuthorizedAddressRemoved(target, msg.sender); + } + + /// @dev Calls into ERC20 Token contract, invoking transferFrom. + /// @param token Address of token to transfer. + /// @param from Address to transfer token from. + /// @param to Address to transfer token to. + /// @param value Amount of token to transfer. + /// @return Success of transfer. + function transferFrom( + address token, + address from, + address to, + uint value) + public + onlyAuthorized + returns (bool) + { + return Token(token).transferFrom(from, to, value); + } + + /* + * Public constant functions + */ + + /// @dev Gets all authorized addresses. + /// @return Array of authorized addresses. + function getAuthorizedAddresses() + public + constant + returns (address[]) + { + return authorities; + } +} diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts new file mode 100644 index 000000000..697974c6e --- /dev/null +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -0,0 +1,22 @@ +import * as chai from 'chai'; +import 'mocha'; + +import { SolidityDocGenerator } from '../src/solidity_doc_generator'; + +import { chaiSetup } from './util/chai_setup'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('#SolidityDocGenerator', () => { + it('should generate', async () => { + const generator = new SolidityDocGenerator( + `${__dirname}/../../test/fixtures/contracts`, + `${__dirname}/../../test/fixtures/artifacts`, + ); + + const doc = await generator.generateAsync(['TokenTransferProxy']); + + expect(doc).to.not.be.undefined(); + }); +}); diff --git a/packages/sol-doc/test/util/chai_setup.ts b/packages/sol-doc/test/util/chai_setup.ts new file mode 100644 index 000000000..1a8733093 --- /dev/null +++ b/packages/sol-doc/test/util/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import chaiAsPromised = require('chai-as-promised'); +import ChaiBigNumber = require('chai-bignumber'); +import * as dirtyChai from 'dirty-chai'; + +export const chaiSetup = { + configure(): void { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; diff --git a/packages/sol-doc/tsconfig.json b/packages/sol-doc/tsconfig.json new file mode 100644 index 000000000..e35816553 --- /dev/null +++ b/packages/sol-doc/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/sol-doc/tslint.json b/packages/sol-doc/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/sol-doc/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} -- cgit v1.2.3 From a1959df911741d0424a952fa4a63c5dcc1135524 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 24 Aug 2018 09:18:33 -0400 Subject: add devdoc support to solc typings, and use it --- packages/ethereum-types/src/index.ts | 62 ++++++++++++++++++++++ packages/monorepo-scripts/src/doc_gen_configs.ts | 2 + packages/sol-compiler/src/compiler.ts | 11 ++-- packages/sol-compiler/src/index.ts | 21 +++++++- packages/sol-doc/src/solidity_doc_generator.ts | 14 +++-- packages/typescript-typings/types/solc/index.d.ts | 63 +++-------------------- 6 files changed, 104 insertions(+), 69 deletions(-) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index 3b6fdc77b..993306a43 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -324,9 +324,56 @@ export interface ContractNetworkData { constructorArgs: string; } +export type ParamDescription = string; + export interface StandardContractOutput { abi: ContractAbi; evm: EvmOutput; + devdoc?: DevdocOutput; +} + +export interface StandardOutput { + errors: SolcError[]; + sources: { + [fileName: string]: { + id: number; + ast?: object; + legacyAST?: object; + }; + }; + contracts: { + [fileName: string]: { + [contractName: string]: StandardContractOutput; + }; + }; +} + +export type ErrorType = + | 'JSONError' + | 'IOError' + | 'ParserError' + | 'DocstringParsingError' + | 'SyntaxError' + | 'DeclarationError' + | 'TypeError' + | 'UnimplementedFeatureError' + | 'InternalCompilerError' + | 'Exception' + | 'CompilerError' + | 'FatalError' + | 'Warning'; +export type ErrorSeverity = 'error' | 'warning'; +export interface SolcError { + sourceLocation?: { + file: string; + start: number; + end: number; + }; + type: ErrorType; + component: 'general' | 'ewasm'; + severity: ErrorSeverity; + message: string; + formattedMessage?: string; } export interface EvmOutput { @@ -339,6 +386,20 @@ export interface EvmBytecodeOutput { sourceMap: string; } +export interface DevdocOutput { + title: string; + author: string; + methods: { + [signature: string]: { + details: string; + params: { + [name: string]: ParamDescription; + }; + return?: string; + }; + }; +} + export interface ContractVersionData { compiler: CompilerOpts; sources: { @@ -415,6 +476,7 @@ export interface Source { id: number; } +// TODO: move the following into the sol-compiler package. /** * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories. diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 6d7560943..9c0e19cb3 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -13,6 +13,8 @@ export const docGenConfigs: DocGenConfigs = { 'solc.StandardContractOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', + StandardOutput: 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', + 'solc.StandardOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', Uint8Array: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array', diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 91b17c4f2..b5255b361 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -10,7 +10,7 @@ import { } from '@0xproject/sol-resolver'; import { fetchAsync, logUtils } from '@0xproject/utils'; import chalk from 'chalk'; -import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types'; +import { CompilerOptions, ContractArtifact, ContractVersionData, StandardOutput } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -169,7 +169,7 @@ export class Compiler { * each element contains the output for all of the modules compiled with * that version. */ - public async getCompilerOutputsAsync(): Promise { + public async getCompilerOutputsAsync(): Promise { return this._compileContractsAsync(this._getContractNamesToCompile(), false); } private _getContractNamesToCompile(): string[] { @@ -187,10 +187,7 @@ export class Compiler { * @param fileName Name of contract with '.sol' extension. * @return an array of compiler outputs, where each element corresponds to a different version of solc-js. */ - private async _compileContractsAsync( - contractNames: string[], - shouldPersist: boolean, - ): Promise { + private async _compileContractsAsync(contractNames: string[], shouldPersist: boolean): Promise { // batch input contracts together based on the version of the compiler that they require. const versionToInputs: VersionToInputs = {}; @@ -231,7 +228,7 @@ export class Compiler { versionToInputs[solcVersion].contractsToCompile.push(contractSource.path); } - const compilerOutputs: solc.StandardOutput[] = []; + const compilerOutputs: StandardOutput[] = []; const solcVersions = _.keys(versionToInputs); for (const solcVersion of solcVersions) { diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 1ad07a9ff..829e515ff 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -1,9 +1,28 @@ export { Compiler } from './compiler'; export { + AbiDefinition, CompilerOptions, CompilerSettings, + DataItem, + DevdocOutput, + ErrorSeverity, + ErrorType, + EventAbi, + EventParameter, + EvmBytecodeOutput, + EvmOutput, + FallbackAbi, + FunctionAbi, + MethodAbi, + ConstructorAbi, + ConstructorStateMutability, + ContractAbi, OutputField, CompilerSettingsMetadata, OptimizerSettings, + ParamDescription, + SolcError, + StandardContractOutput, + StandardOutput, + StateMutability, } from 'ethereum-types'; -export { StandardOutput } from 'solc'; diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index c57a4779c..fa3c40dcc 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -43,13 +43,19 @@ export class SolidityDocGenerator { const contracts = _.keys(compiledSolidityModule); for (const contract of contracts) { const compiledContract = compiledSolidityModule[contract]; + if (_.isUndefined(compiledContract.abi)) { + throw new Error('compiled contract did not contain ABI output.'); + } + if (_.isUndefined(compiledContract.devdoc)) { + throw new Error('compiled contract did not contain devdoc output.'); + } - // TODO: modify typescript-typings/types/solc/index.d.ts... it doesn't currently support devdoc! - // tslint:disable-next-line:no-unnecessary-type-assertion tsc says abi[0] has no property `name` and won't compile without the `as`, but tslint says the `as` is unnecssary. logUtils.log( - `TODO: extract data from ${contract}'s abi (eg ${ + `TODO: extract data from ${contract}'s abi (eg name, which is "${ (compiledContract.abi[0] as MethodAbi).name - }, etc) and devdoc outputs, and insert it into \`doc\``, + }", etc) and devdoc (eg title, which is "${ + compiledContract.devdoc.title + }") outputs, and insert it into \`doc\``, ); } } diff --git a/packages/typescript-typings/types/solc/index.d.ts b/packages/typescript-typings/types/solc/index.d.ts index 571bae101..2cfd4a030 100644 --- a/packages/typescript-typings/types/solc/index.d.ts +++ b/packages/typescript-typings/types/solc/index.d.ts @@ -1,4 +1,5 @@ declare module 'solc' { + import { SolcError } from 'ethereum-types'; export interface ContractCompilationResult { srcmap: string; srcmapRuntime: string; @@ -87,62 +88,7 @@ declare module 'solc' { }; settings: CompilerSettings; } - export type ErrorType = - | 'JSONError' - | 'IOError' - | 'ParserError' - | 'DocstringParsingError' - | 'SyntaxError' - | 'DeclarationError' - | 'TypeError' - | 'UnimplementedFeatureError' - | 'InternalCompilerError' - | 'Exception' - | 'CompilerError' - | 'FatalError' - | 'Warning'; - export type ErrorSeverity = 'error' | 'warning'; - export interface Error { - sourceLocation?: { - file: string; - start: number; - end: number; - }; - type: ErrorType; - component: 'general' | 'ewasm'; - severity: ErrorSeverity; - message: string; - formattedMessage?: string; - } - import { ContractAbi } from 'ethereum-types'; - export interface StandardContractOutput { - abi: ContractAbi; - evm: { - bytecode: { - object: string; - sourceMap: string; - }; - deployedBytecode: { - object: string; - sourceMap: string; - }; - }; - } - export interface StandardOutput { - errors: Error[]; - sources: { - [fileName: string]: { - id: number; - ast?: object; - legacyAST?: object; - }; - }; - contracts: { - [fileName: string]: { - [contractName: string]: StandardContractOutput; - }; - }; - } + export { ErrorType, ErrorSeverity, SolcError, StandardContractOutput, StandardOutput } from 'ethereum-types'; export interface SolcInstance { compile( sources: InputSources, @@ -151,6 +97,9 @@ declare module 'solc' { ): CompilationResult; compileStandardWrapper(input: string, findImports: (importPath: string) => ImportContents): string; } - export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void; + export function loadRemoteVersion( + versionName: string, + cb: (err: SolcError | null, res?: SolcInstance) => void, + ): void; export function setupMethods(solcBin: any): SolcInstance; } -- cgit v1.2.3 From 28246abec3b974ae0a4fb2e9bdd0b8f337e829ce Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 29 Aug 2018 15:23:32 -0400 Subject: remove unneeded entries from doc gen config --- packages/monorepo-scripts/src/doc_gen_configs.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 9c0e19cb3..6d7560943 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -13,8 +13,6 @@ export const docGenConfigs: DocGenConfigs = { 'solc.StandardContractOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#output-description', 'solc.CompilerSettings': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', - StandardOutput: 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', - 'solc.StandardOutput': 'https://solidity.readthedocs.io/en/v0.4.24/using-the-compiler.html#input-description', Schema: 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49', Uint8Array: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array', -- cgit v1.2.3 From 5088b7f23c087366559259c832b7a390b892e2e5 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 07:31:04 -0400 Subject: hack postinstall to correct types package symlink yarn is not doing this properly :( even on v1.9.4. confirmed with @albrow . --- package.json | 3 ++- packages/testnet-faucets/src/ts/handler.ts | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 8d4aff4ca..871a9f718 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "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;", "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", - "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete." + "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlink properly for types. We temporarily make it manually. Remove this ASAP!", + "postinstall": "mv node_modules/@0xproject/types node_modules/@0xproject/types-0.8.1; for i in website sra-report; do cp -R node_modules/@0xproject/types-0.8.1 packages/$i/node_modules/@0xproject/types; done; ln -s ../../packages/types node_modules/@0xproject/types" }, "config": { "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic", diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index 3749bc70b..9abfcc4f0 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -143,21 +143,22 @@ export class Handler { if (_.isUndefined(takerToken)) { throw new Error(`Unsupported asset type: ${requestedAssetType}`); } - const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals); - const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals); + const makerAssetAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals); + const takerAssetAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals); const order: Order = { - maker: configs.DISPENSER_ADDRESS, - taker: req.params.recipient, + senderAddress: configs.DISPENSER_ADDRESS, + makerAddress: configs.DISPENSER_ADDRESS, + takerAddress: req.params.recipient, makerFee: new BigNumber(0), takerFee: new BigNumber(0), - makerTokenAmount, - takerTokenAmount, - makerTokenAddress: makerToken.address, - takerTokenAddress: takerToken.address, + makerAssetAmount, + takerAssetAmount, + makerAssetData: makerToken.address, + takerAssetData: takerToken.address, salt: ZeroEx.generatePseudoRandomSalt(), - exchangeContractAddress: zeroEx.exchange.getContractAddress(), - feeRecipient: ZeroEx.NULL_ADDRESS, - expirationUnixTimestampSec: new BigNumber(Date.now() + FIVE_DAYS_IN_MS), + exchangeAddress: zeroEx.exchange.getContractAddress(), + feeRecipientAddress: ZeroEx.NULL_ADDRESS, + expirationTimeSeconds: new BigNumber(Date.now() + FIVE_DAYS_IN_MS), }; const orderHash = ZeroEx.getOrderHashHex(order); const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false); -- cgit v1.2.3 From f429032eef007bafaed108171631f4b3d3233f6b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 08:22:44 -0400 Subject: move shared doc types from react-docs to @0x/types --- packages/react-docs/package.json | 1 + packages/react-docs/src/components/custom_enum.tsx | 2 +- .../react-docs/src/components/documentation.tsx | 17 +- .../react-docs/src/components/event_definition.tsx | 2 +- packages/react-docs/src/components/interface.tsx | 3 +- .../react-docs/src/components/property_block.tsx | 2 +- packages/react-docs/src/components/signature.tsx | 3 +- .../react-docs/src/components/signature_block.tsx | 8 +- packages/react-docs/src/components/source_link.tsx | 3 +- packages/react-docs/src/components/type.tsx | 2 +- .../react-docs/src/components/type_definition.tsx | 3 +- packages/react-docs/src/docs_info.ts | 4 +- packages/react-docs/src/index.ts | 13 +- packages/react-docs/src/types.ts | 224 --------------------- packages/react-docs/src/utils/doxity_utils.ts | 9 +- packages/react-docs/src/utils/typedoc_utils.ts | 12 +- packages/sol-doc/package.json | 2 +- packages/sol-doc/src/solidity_doc_format.ts | 2 +- packages/types/src/index.ts | 223 ++++++++++++++++++++ 19 files changed, 265 insertions(+), 270 deletions(-) diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 9e95e69d0..adc06a501 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -35,6 +35,7 @@ }, "dependencies": { "@0xproject/react-shared": "^1.0.8", + "@0xproject/types": "^1.0.1-rc.6", "@0xproject/utils": "^1.0.7", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", diff --git a/packages/react-docs/src/components/custom_enum.tsx b/packages/react-docs/src/components/custom_enum.tsx index c4252d9e2..fa7c43146 100644 --- a/packages/react-docs/src/components/custom_enum.tsx +++ b/packages/react-docs/src/components/custom_enum.tsx @@ -2,7 +2,7 @@ import { logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; -import { CustomType } from '../types'; +import { CustomType } from '@0xproject/types'; const STRING_ENUM_CODE_PREFIX = ' strEnum('; diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 9d9b5141a..16a99713c 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -9,24 +9,23 @@ import { Styles, utils as sharedUtils, } from '@0xproject/react-shared'; -import * as _ from 'lodash'; -import CircularProgress from 'material-ui/CircularProgress'; -import * as React from 'react'; -import * as semver from 'semver'; - -import { DocsInfo } from '../docs_info'; import { - AddressByContractName, DocAgnosticFormat, Event, ExternalExportToLink, Property, SolidityMethod, - SupportedDocJson, TypeDefinitionByName, TypescriptFunction, TypescriptMethod, -} from '../types'; +} from '@0xproject/types'; +import * as _ from 'lodash'; +import CircularProgress from 'material-ui/CircularProgress'; +import * as React from 'react'; +import * as semver from 'semver'; + +import { DocsInfo } from '../docs_info'; +import { AddressByContractName, SupportedDocJson } from '../types'; import { constants } from '../utils/constants'; import { Badge } from './badge'; diff --git a/packages/react-docs/src/components/event_definition.tsx b/packages/react-docs/src/components/event_definition.tsx index 6cb80c6b0..37236275b 100644 --- a/packages/react-docs/src/components/event_definition.tsx +++ b/packages/react-docs/src/components/event_definition.tsx @@ -1,9 +1,9 @@ import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared'; +import { Event, EventArg } from '@0xproject/types'; import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { Event, EventArg } from '../types'; import { Type } from './type'; diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index 93b10e96d..9f0800d71 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -1,8 +1,9 @@ import * as _ from 'lodash'; import * as React from 'react'; +import { CustomType, TypeDefinitionByName } from '@0xproject/types'; + import { DocsInfo } from '../docs_info'; -import { CustomType, TypeDefinitionByName } from '../types'; import { Signature } from './signature'; import { Type } from './type'; diff --git a/packages/react-docs/src/components/property_block.tsx b/packages/react-docs/src/components/property_block.tsx index f181e21d2..8434e8682 100644 --- a/packages/react-docs/src/components/property_block.tsx +++ b/packages/react-docs/src/components/property_block.tsx @@ -1,8 +1,8 @@ import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared'; +import { Property, TypeDefinitionByName } from '@0xproject/types'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { Property, TypeDefinitionByName } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index bf9c8be24..9eb8a7d86 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -1,8 +1,9 @@ import * as _ from 'lodash'; import * as React from 'react'; +import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '@0xproject/types'; + import { DocsInfo } from '../docs_info'; -import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '../types'; import { Type } from './type'; diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 05145dc23..1ea0ea28c 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -1,9 +1,15 @@ import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared'; +import { + Parameter, + SolidityMethod, + TypeDefinitionByName, + TypescriptFunction, + TypescriptMethod, +} from '@0xproject/types'; import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { Parameter, SolidityMethod, TypeDefinitionByName, TypescriptFunction, TypescriptMethod } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; diff --git a/packages/react-docs/src/components/source_link.tsx b/packages/react-docs/src/components/source_link.tsx index c60435ea6..3096ad8d5 100644 --- a/packages/react-docs/src/components/source_link.tsx +++ b/packages/react-docs/src/components/source_link.tsx @@ -1,8 +1,7 @@ import { colors } from '@0xproject/react-shared'; +import { Source } from '@0xproject/types'; import * as React from 'react'; -import { Source } from '../types'; - export interface SourceLinkProps { source: Source; sourceUrl: string; diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 5f7601ce1..156a3496d 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -1,4 +1,5 @@ import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared'; +import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types'; import { errorUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; @@ -6,7 +7,6 @@ import { Link as ScrollLink } from 'react-scroll'; import * as ReactTooltip from 'react-tooltip'; import { DocsInfo } from '../docs_info'; -import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types'; import { constants } from '../utils/constants'; import { Signature } from './signature'; diff --git a/packages/react-docs/src/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx index 8d1f88490..09cb3ff74 100644 --- a/packages/react-docs/src/components/type_definition.tsx +++ b/packages/react-docs/src/components/type_definition.tsx @@ -1,10 +1,11 @@ import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared'; +import { CustomType, CustomTypeChild, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types'; import { errorUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType, CustomTypeChild, KindString, TypeDefinitionByName, TypeDocTypes } from '../types'; +import { KindString } from '../types'; import { constants } from '../utils/constants'; import { Comment } from './comment'; diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index f429a34cb..f9137d69d 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -1,18 +1,16 @@ import { MenuSubsectionsBySection } from '@0xproject/react-shared'; +import { DocAgnosticFormat, GeneratedDocJson, TypeDefinitionByName } from '@0xproject/types'; import compareVersions = require('compare-versions'); import * as _ from 'lodash'; import { ContractsByVersionByNetworkId, - DocAgnosticFormat, DocsInfoConfig, DocsMenu, DoxityDocObj, - GeneratedDocJson, SectionNameToMarkdownByVersion, SectionsMap, SupportedDocJson, - TypeDefinitionByName, } from './types'; import { doxityUtils } from './utils/doxity_utils'; import { TypeDocUtils } from './utils/typedoc_utils'; diff --git a/packages/react-docs/src/index.ts b/packages/react-docs/src/index.ts index 8b3a146db..8a2c215b8 100644 --- a/packages/react-docs/src/index.ts +++ b/packages/react-docs/src/index.ts @@ -1,3 +1,5 @@ +export { DocAgnosticFormat, GeneratedDocJson } from '@0xproject/types'; + // Exported to give users of this library added flexibility if they want to build // a docs page from scratch using the individual components. export { Badge } from './components/badge'; @@ -15,15 +17,6 @@ export { Type } from './components/type'; export { DocsInfo } from './docs_info'; -export { - DocsInfoConfig, - DocAgnosticFormat, - DocSection, - DoxityDocObj, - DocsMenu, - SupportedDocJson, - TypeDocNode, - GeneratedDocJson, -} from './types'; +export { DocsInfoConfig, DoxityDocObj, DocsMenu, SupportedDocJson } from './types'; export { constants } from './utils/constants'; diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index f9cb5e26a..454190342 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -22,72 +22,6 @@ export interface SectionsMap { [sectionName: string]: string; } -export interface TypeDocType { - type: TypeDocTypes; - value: string; - name: string; - types: TypeDocType[]; - typeArguments?: TypeDocType[]; - declaration: TypeDocNode; - elementType?: TypeDocType; - indexSignature?: TypeDocNode; - elements?: TupleElement[]; -} - -export interface TupleElement { - type: string; - name: string; -} - -export interface TypeDocFlags { - isStatic?: boolean; - isOptional?: boolean; - isPublic?: boolean; - isExported?: boolean; -} - -export interface TypeDocGroup { - title: string; - children: number[]; -} - -export interface TypeDocNode { - id?: number; - name?: string; - kind?: string; - defaultValue?: string; - kindString?: string; - type?: TypeDocType; - fileName?: string; - line?: number; - comment?: TypeDocNode; - text?: string; - shortText?: string; - returns?: string; - declaration: TypeDocNode; - flags?: TypeDocFlags; - indexSignature?: TypeDocNode; - signatures?: TypeDocNode[]; - parameters?: TypeDocNode[]; - typeParameter?: TypeDocNode[]; - sources?: TypeDocNode[]; - children?: TypeDocNode[]; - groups?: TypeDocGroup[]; -} - -export enum TypeDocTypes { - Intrinsic = 'intrinsic', - Reference = 'reference', - Array = 'array', - StringLiteral = 'stringLiteral', - Reflection = 'reflection', - Union = 'union', - TypeParameter = 'typeParameter', - Intersection = 'intersection', - Tuple = 'tuple', - Unknown = 'unknown', -} - // Exception: We don't make the values uppercase because these KindString's need to // match up those returned by TypeDoc export enum KindString { @@ -103,139 +37,6 @@ export enum KindString { Class = 'Class', } -export interface DocAgnosticFormat { - [sectionName: string]: DocSection; -} - -export interface DocSection { - comment: string; - constructors: Array; - methods: Array; - properties: Property[]; - types: CustomType[]; - functions: TypescriptFunction[]; - events?: Event[]; - externalExportToLink?: ExternalExportToLink; -} - -export interface TypescriptMethod extends BaseMethod { - source?: Source; - isStatic?: boolean; - typeParameter?: TypeParameter; -} - -export interface TypescriptFunction extends BaseFunction { - source?: Source; - typeParameter?: TypeParameter; - callPath: string; -} - -export interface SolidityMethod extends BaseMethod { - isConstant?: boolean; - isPayable?: boolean; -} - -export interface Source { - fileName: string; - line: number; -} - -export interface Parameter { - name: string; - comment: string; - isOptional: boolean; - type: Type; - defaultValue?: string; -} - -export interface TypeParameter { - name: string; - type: Type; -} - -export interface Type { - name: string; - typeDocType: TypeDocTypes; - value?: string; - isExportedClassReference?: boolean; - typeArguments?: Type[]; - elementType?: ElementType; - types?: Type[]; - method?: TypescriptMethod; - indexSignature?: IndexSignature; - externalLink?: string; - tupleElements?: Type[]; -} - -export interface ElementType { - name: string; - typeDocType: TypeDocTypes; -} - -export interface IndexSignature { - keyName: string; - keyType: Type; - valueName: string; -} - -export interface CustomType { - name: string; - kindString: string; - type?: Type; - method?: TypescriptMethod; - indexSignature?: IndexSignature; - defaultValue?: string; - comment?: string; - children?: CustomTypeChild[]; -} - -export interface CustomTypeChild { - name: string; - type?: Type; - defaultValue?: string; -} - -export interface Event { - name: string; - eventArgs: EventArg[]; -} - -export interface EventArg { - isIndexed: boolean; - name: string; - type: Type; -} - -export interface Property { - name: string; - type: Type; - source?: Source; - comment?: string; - callPath?: string; -} - -export interface BaseMethod { - isConstructor: boolean; - name: string; - returnComment?: string | undefined; - callPath: string; - parameters: Parameter[]; - returnType: Type; - comment?: string; -} - -export interface BaseFunction { - name: string; - returnComment?: string | undefined; - parameters: Parameter[]; - returnType: Type; - comment?: string; -} - -export interface TypeDefinitionByName { - [typeName: string]: CustomType; -} - export enum SupportedDocJson { Doxity = 'DOXITY', TypeDoc = 'TYPEDOC', @@ -297,28 +98,3 @@ export enum AbiTypes { Function = 'function', Event = 'event', } - -export interface ExportNameToTypedocNames { - [exportName: string]: string[]; -} - -export interface ExternalTypeToLink { - [externalTypeName: string]: string; -} - -export interface ExternalExportToLink { - [externalExport: string]: string; -} - -export interface Metadata { - exportPathToTypedocNames: ExportNameToTypedocNames; - exportPathOrder: string[]; - externalTypeToLink: ExternalTypeToLink; - externalExportToLink: ExternalExportToLink; -} - -export interface GeneratedDocJson { - version: string; - metadata: Metadata; - typedocJson: TypeDocNode; -} diff --git a/packages/react-docs/src/utils/doxity_utils.ts b/packages/react-docs/src/utils/doxity_utils.ts index 6815daa0c..85794d4ba 100644 --- a/packages/react-docs/src/utils/doxity_utils.ts +++ b/packages/react-docs/src/utils/doxity_utils.ts @@ -1,20 +1,17 @@ import * as _ from 'lodash'; import { - AbiTypes, DocAgnosticFormat, DocSection, - DoxityAbiDoc, - DoxityContractObj, - DoxityDocObj, - DoxityInput, EventArg, Parameter, Property, SolidityMethod, Type, TypeDocTypes, -} from '../types'; +} from '@0xproject/types'; + +import { AbiTypes, DoxityAbiDoc, DoxityContractObj, DoxityDocObj, DoxityInput } from '../types'; export const doxityUtils = { convertToDocAgnosticFormat(doxityDocObj: DoxityDocObj): DocAgnosticFormat { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index f44945369..a24e63045 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -1,7 +1,3 @@ -import { errorUtils } from '@0xproject/utils'; -import * as _ from 'lodash'; - -import { DocsInfo } from '../docs_info'; import { CustomType, CustomTypeChild, @@ -11,7 +7,6 @@ import { ExternalTypeToLink, GeneratedDocJson, IndexSignature, - KindString, Parameter, Property, Type, @@ -21,7 +16,12 @@ import { TypeParameter, TypescriptFunction, TypescriptMethod, -} from '../types'; +} from '@0xproject/types'; +import { errorUtils } from '@0xproject/utils'; +import * as _ from 'lodash'; + +import { DocsInfo } from '../docs_info'; +import { KindString } from '../types'; import { constants } from './constants'; diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 91b69b968..c1ff0c2f5 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -15,8 +15,8 @@ "license": "Apache-2.0", "private": false, "dependencies": { - "@0xproject/react-docs": "^1.0.5", "@0xproject/sol-compiler": "^1.0.5", + "@0xproject/types": "^1.0.1-rc.6", "@0xproject/utils": "^1.0.5", "ethereum-types": "^1.0.4", "lodash": "^4.17.10" diff --git a/packages/sol-doc/src/solidity_doc_format.ts b/packages/sol-doc/src/solidity_doc_format.ts index edfd5c5b7..e980f59f6 100644 --- a/packages/sol-doc/src/solidity_doc_format.ts +++ b/packages/sol-doc/src/solidity_doc_format.ts @@ -1,4 +1,4 @@ -import { DocAgnosticFormat, DocSection } from '@0xproject/react-docs'; +import { DocAgnosticFormat, DocSection } from '@0xproject/types'; export class SolidityDocFormat implements DocAgnosticFormat { [sectionName: string]: DocSection; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index d8bffccf9..16405dca6 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -233,3 +233,226 @@ export enum StatusCodes { MethodNotAllowed = 405, GatewayTimeout = 504, } + +export interface TypeDocType { + type: TypeDocTypes; + value: string; + name: string; + types: TypeDocType[]; + typeArguments?: TypeDocType[]; + declaration: TypeDocNode; + elementType?: TypeDocType; + indexSignature?: TypeDocNode; + elements?: TupleElement[]; +} + +export interface TupleElement { + type: string; + name: string; +} + +export interface TypeDocNode { + id?: number; + name?: string; + kind?: string; + defaultValue?: string; + kindString?: string; + type?: TypeDocType; + fileName?: string; + line?: number; + comment?: TypeDocNode; + text?: string; + shortText?: string; + returns?: string; + declaration: TypeDocNode; + flags?: TypeDocFlags; + indexSignature?: TypeDocNode; + signatures?: TypeDocNode[]; + parameters?: TypeDocNode[]; + typeParameter?: TypeDocNode[]; + sources?: TypeDocNode[]; + children?: TypeDocNode[]; + groups?: TypeDocGroup[]; +} + +export interface TypeDocFlags { + isStatic?: boolean; + isOptional?: boolean; + isPublic?: boolean; + isExported?: boolean; +} + +export interface TypeDocGroup { + title: string; + children: number[]; +} + +export enum TypeDocTypes { + Intrinsic = 'intrinsic', + Reference = 'reference', + Array = 'array', + StringLiteral = 'stringLiteral', + Reflection = 'reflection', + Union = 'union', + TypeParameter = 'typeParameter', + Intersection = 'intersection', + Tuple = 'tuple', + Unknown = 'unknown', +} + +export interface CustomTypeChild { + name: string; + type?: Type; + defaultValue?: string; +} + +export interface Event { + name: string; + eventArgs: EventArg[]; +} + +export interface EventArg { + isIndexed: boolean; + name: string; + type: Type; +} + +export interface Property { + name: string; + type: Type; + source?: Source; + comment?: string; + callPath?: string; +} + +export interface BaseMethod { + isConstructor: boolean; + name: string; + returnComment?: string | undefined; + callPath: string; + parameters: Parameter[]; + returnType: Type; + comment?: string; +} + +export interface BaseFunction { + name: string; + returnComment?: string | undefined; + parameters: Parameter[]; + returnType: Type; + comment?: string; +} + +export interface TypeDefinitionByName { + [typeName: string]: CustomType; +} + +export interface DocAgnosticFormat { + [sectionName: string]: DocSection; +} + +export interface DocSection { + comment: string; + constructors: Array; + methods: Array; + properties: Property[]; + types: CustomType[]; + functions: TypescriptFunction[]; + events?: Event[]; + externalExportToLink?: ExternalExportToLink; +} + +export interface TypescriptMethod extends BaseMethod { + source?: Source; + isStatic?: boolean; + typeParameter?: TypeParameter; +} + +export interface TypescriptFunction extends BaseFunction { + source?: Source; + typeParameter?: TypeParameter; + callPath: string; +} + +export interface SolidityMethod extends BaseMethod { + isConstant?: boolean; + isPayable?: boolean; +} + +export interface Source { + fileName: string; + line: number; +} + +export interface Parameter { + name: string; + comment: string; + isOptional: boolean; + type: Type; + defaultValue?: string; +} + +export interface TypeParameter { + name: string; + type: Type; +} + +export interface Type { + name: string; + typeDocType: TypeDocTypes; + value?: string; + isExportedClassReference?: boolean; + typeArguments?: Type[]; + elementType?: ElementType; + types?: Type[]; + method?: TypescriptMethod; + indexSignature?: IndexSignature; + externalLink?: string; + tupleElements?: Type[]; +} + +export interface ElementType { + name: string; + typeDocType: TypeDocTypes; +} + +export interface IndexSignature { + keyName: string; + keyType: Type; + valueName: string; +} + +export interface CustomType { + name: string; + kindString: string; + type?: Type; + method?: TypescriptMethod; + indexSignature?: IndexSignature; + defaultValue?: string; + comment?: string; + children?: CustomTypeChild[]; +} +export interface GeneratedDocJson { + version: string; + metadata: Metadata; + typedocJson: TypeDocNode; +} + +export interface ExportNameToTypedocNames { + [exportName: string]: string[]; +} + +export interface ExternalTypeToLink { + [externalTypeName: string]: string; +} + +export interface ExternalExportToLink { + [externalExport: string]: string; +} + +export interface Metadata { + exportPathToTypedocNames: ExportNameToTypedocNames; + exportPathOrder: string[]; + externalTypeToLink: ExternalTypeToLink; + externalExportToLink: ExternalExportToLink; +} -- cgit v1.2.3 From 9834395a48a20314bd59538a2f72b40c02280844 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 08:44:10 -0400 Subject: remove mistaken TODO --- packages/ethereum-types/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index 993306a43..b4c9b73ca 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -476,7 +476,6 @@ export interface Source { id: number; } -// TODO: move the following into the sol-compiler package. /** * Options you can specify (as flags or in a compiler.json file) when invoking sol-compiler * contractsDir: Directory containing your project's Solidity contracts. Can contain nested directories. -- cgit v1.2.3 From 6450844d7fc39561671dd72f036a436f8bc2f664 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 08:59:30 -0400 Subject: rename method _addHexPrefixes --- packages/sol-compiler/src/compiler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index b5255b361..ced139909 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -110,7 +110,7 @@ export class Compiler { const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename)); return { solcInstance, fullSolcVersion }; } - private static _addHexPrefixes(compiledContract: solc.StandardContractOutput): void { + private static _addHexPrefixToContractBytecode(compiledContract: solc.StandardContractOutput): void { if (!_.isUndefined(compiledContract.evm)) { if (!_.isUndefined(compiledContract.evm.bytecode) && !_.isUndefined(compiledContract.evm.bytecode.object)) { compiledContract.evm.bytecode.object = ethUtil.addHexPrefix(compiledContract.evm.bytecode.object); @@ -254,7 +254,7 @@ export class Compiler { ); } - Compiler._addHexPrefixes(compiledContract); + Compiler._addHexPrefixToContractBytecode(compiledContract); if (shouldPersist) { await this._persistCompiledContractAsync( -- cgit v1.2.3 From 29f2ae605edadedbd150cc6df7aafffdef6a48a3 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 09:02:00 -0400 Subject: re-word comment: 'construction' -> 'instantiation' --- packages/sol-compiler/src/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index ced139909..d2977c691 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -162,7 +162,7 @@ export class Compiler { await this._compileContractsAsync(this._getContractNamesToCompile(), true); } /** - * Compiles Solidity files specified during construction, and returns the + * Compiles Solidity files specified during instantiation, and returns the * compiler output given by solc. Return value is an array of outputs: * Solidity modules are batched together by version required, and each * element of the returned array corresponds to a compiler version, and -- cgit v1.2.3 From 6273339f7c588f31f6c664a6aa3b58e2b94b9051 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 09:54:10 -0400 Subject: add named references for returned objects --- packages/sol-compiler/src/compiler.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index d2977c691..3b0bd90f9 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -170,17 +170,20 @@ export class Compiler { * that version. */ public async getCompilerOutputsAsync(): Promise { - return this._compileContractsAsync(this._getContractNamesToCompile(), false); + const promisedOutputs = this._compileContractsAsync(this._getContractNamesToCompile(), false); + return promisedOutputs; } private _getContractNamesToCompile(): string[] { + let contractNamesToCompile; if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) { const allContracts = this._nameResolver.getAll(); - return _.map(allContracts, contractSource => + contractNamesToCompile = _.map(allContracts, contractSource => path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION), ); } else { - return this._specifiedContracts; + contractNamesToCompile = this._specifiedContracts; } + return contractNamesToCompile; } /** * Compiles contracts, and, if `shouldPersist` is true, saves artifacts to artifactsDir. -- cgit v1.2.3 From 7ed31d2fba79e314eea8c190809781be24a699c7 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 10:04:08 -0400 Subject: correct package.json's privacy specification --- packages/sol-doc/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index c1ff0c2f5..62cf0a9e1 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -13,7 +13,6 @@ "repository": "https://github.com/0xProject/0x-monorepo.git", "author": "F. Eugene Aumson", "license": "Apache-2.0", - "private": false, "dependencies": { "@0xproject/sol-compiler": "^1.0.5", "@0xproject/types": "^1.0.1-rc.6", @@ -31,5 +30,8 @@ "shx": "^0.2.2", "source-map-support": "^0.5.0", "tslint": "5.11.0" + }, + "publishConfig": { + "access": "public" } } -- cgit v1.2.3 From 863966787f65fe61057ac45f34827ba70fee844a Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 10:06:40 -0400 Subject: dev-depend on @0xproject/tslint-config --- packages/sol-doc/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 62cf0a9e1..9979fff05 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -21,6 +21,7 @@ "lodash": "^4.17.10" }, "devDependencies": { + "@0xproject/tslint-config": "^1.0.6", "chai": "^4.1.2", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.2", -- cgit v1.2.3 From f76c88c5491a9ec3a6b902b291dcfaf8ac64ecd5 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 11:24:41 -0400 Subject: remove unused constructor parameter --- packages/sol-doc/src/solidity_doc_generator.ts | 3 +-- packages/sol-doc/test/solidity_doc_generator_test.ts | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index fa3c40dcc..a4eb403a8 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -9,11 +9,10 @@ import { SolidityDocFormat } from './solidity_doc_format'; export class SolidityDocGenerator { private readonly _compilerOptions: CompilerOptions; - constructor(contractsDir: string, artifactsDir: string) { + constructor(contractsDir: string) { // instantiate sol-compiler, passing in options to say we want abi and devdoc this._compilerOptions = { contractsDir, - artifactsDir, contracts: '*', compilerSettings: { outputSelection: { diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 697974c6e..1df3e5b44 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -10,10 +10,7 @@ const expect = chai.expect; describe('#SolidityDocGenerator', () => { it('should generate', async () => { - const generator = new SolidityDocGenerator( - `${__dirname}/../../test/fixtures/contracts`, - `${__dirname}/../../test/fixtures/artifacts`, - ); + const generator = new SolidityDocGenerator(`${__dirname}/../../test/fixtures/contracts`); const doc = await generator.generateAsync(['TokenTransferProxy']); -- cgit v1.2.3 From f55234b4a04a3a26e6eda05a5c77a6bd984571ba Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 11:30:43 -0400 Subject: comment public interface --- packages/sol-doc/src/solidity_doc_generator.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index a4eb403a8..f6bbf52ba 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -7,8 +7,16 @@ import { logUtils } from '@0xproject/utils'; import { SolidityDocFormat } from './solidity_doc_format'; +/** + * Compiles solidity files to both their ABI and devdoc outputs, and transforms + * those outputs into the types that feed into documentation generation tools. + */ export class SolidityDocGenerator { private readonly _compilerOptions: CompilerOptions; + /** + * Instantiate the generator. + * @param contractsDir the directory in which to find the contracts to be compiled + */ constructor(contractsDir: string) { // instantiate sol-compiler, passing in options to say we want abi and devdoc this._compilerOptions = { @@ -23,7 +31,11 @@ export class SolidityDocGenerator { }, }; } - /// run `contractsToCompile` through compiler, gathering output + /** + * Invoke the compiler and transform its outputs. + * @param contractsToCompile list of contracts for which to generate doc objects + * @return doc objects for use with documentation generation tools. + */ public async generateAsync(contractsToCompile: string[]): Promise { if (!_.isUndefined(contractsToCompile)) { this._compilerOptions.contracts = contractsToCompile; -- cgit v1.2.3 From 297cbd996d7da0cb3232f47734290d0377693faf Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 11:49:54 -0400 Subject: remove unnecessary class SolidityDocFormat --- packages/sol-doc/src/index.ts | 1 - packages/sol-doc/src/solidity_doc_format.ts | 5 ----- packages/sol-doc/src/solidity_doc_generator.ts | 7 +++---- 3 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 packages/sol-doc/src/solidity_doc_format.ts diff --git a/packages/sol-doc/src/index.ts b/packages/sol-doc/src/index.ts index f8f55c569..dc88fae90 100644 --- a/packages/sol-doc/src/index.ts +++ b/packages/sol-doc/src/index.ts @@ -1,2 +1 @@ export { SolidityDocGenerator } from './solidity_doc_generator'; -export { SolidityDocFormat } from './solidity_doc_format'; diff --git a/packages/sol-doc/src/solidity_doc_format.ts b/packages/sol-doc/src/solidity_doc_format.ts deleted file mode 100644 index e980f59f6..000000000 --- a/packages/sol-doc/src/solidity_doc_format.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { DocAgnosticFormat, DocSection } from '@0xproject/types'; - -export class SolidityDocFormat implements DocAgnosticFormat { - [sectionName: string]: DocSection; -} diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index f6bbf52ba..aba7b5475 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -3,10 +3,9 @@ import * as _ from 'lodash'; import { MethodAbi } from 'ethereum-types'; import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; +import { DocAgnosticFormat } from '@0xproject/types'; import { logUtils } from '@0xproject/utils'; -import { SolidityDocFormat } from './solidity_doc_format'; - /** * Compiles solidity files to both their ABI and devdoc outputs, and transforms * those outputs into the types that feed into documentation generation tools. @@ -36,14 +35,14 @@ export class SolidityDocGenerator { * @param contractsToCompile list of contracts for which to generate doc objects * @return doc objects for use with documentation generation tools. */ - public async generateAsync(contractsToCompile: string[]): Promise { + public async generateAsync(contractsToCompile: string[]): Promise { if (!_.isUndefined(contractsToCompile)) { this._compilerOptions.contracts = contractsToCompile; } const compiler = new Compiler(this._compilerOptions); - const doc = new SolidityDocFormat(); + const doc: DocAgnosticFormat = {}; const compilerOutputs = await compiler.getCompilerOutputsAsync(); for (const compilerOutput of compilerOutputs) { -- cgit v1.2.3 From b88a56e6b723016cf830511b2da503747e086f54 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 11:51:17 -0400 Subject: reduce proximity b/w instantiation and use of var --- packages/sol-doc/src/solidity_doc_generator.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index aba7b5475..856787e5f 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -40,10 +40,9 @@ export class SolidityDocGenerator { this._compilerOptions.contracts = contractsToCompile; } - const compiler = new Compiler(this._compilerOptions); - const doc: DocAgnosticFormat = {}; + const compiler = new Compiler(this._compilerOptions); const compilerOutputs = await compiler.getCompilerOutputsAsync(); for (const compilerOutput of compilerOutputs) { const solidityModules = _.keys(compilerOutput.contracts); -- cgit v1.2.3 From fe7a62ba9a0d1647ea94683a0369b98e2a675f94 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 11:52:21 -0400 Subject: add named var to make `if` condition more readable --- packages/sol-doc/src/solidity_doc_generator.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 856787e5f..bb2f4cea6 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -36,7 +36,8 @@ export class SolidityDocGenerator { * @return doc objects for use with documentation generation tools. */ public async generateAsync(contractsToCompile: string[]): Promise { - if (!_.isUndefined(contractsToCompile)) { + const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile); + if (shouldOverrideCatchAllContractsConfig) { this._compilerOptions.contracts = contractsToCompile; } -- cgit v1.2.3 From 0e45497acbb0ad572e549ad81bb72b3b31d7860d Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 12:02:02 -0400 Subject: rename variables --- packages/sol-doc/src/solidity_doc_generator.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index bb2f4cea6..95c89b2e5 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -46,13 +46,13 @@ export class SolidityDocGenerator { const compiler = new Compiler(this._compilerOptions); const compilerOutputs = await compiler.getCompilerOutputsAsync(); for (const compilerOutput of compilerOutputs) { - const solidityModules = _.keys(compilerOutput.contracts); - for (const solidityModule of solidityModules) { - const compiledSolidityModule = compilerOutput.contracts[solidityModule]; + const contractFileNames = _.keys(compilerOutput.contracts); + for (const contractFileName of contractFileNames) { + const contractNameToOutput = compilerOutput.contracts[contractFileName]; - const contracts = _.keys(compiledSolidityModule); - for (const contract of contracts) { - const compiledContract = compiledSolidityModule[contract]; + 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.'); } @@ -61,7 +61,7 @@ export class SolidityDocGenerator { } logUtils.log( - `TODO: extract data from ${contract}'s abi (eg name, which is "${ + `TODO: extract data from ${contractName}'s abi (eg name, which is "${ (compiledContract.abi[0] as MethodAbi).name }", etc) and devdoc (eg title, which is "${ compiledContract.devdoc.title -- cgit v1.2.3 From 8d122006baa7efdf8bd7a7df7b140a66c7d988af Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 30 Aug 2018 12:34:27 -0400 Subject: move export to top of file --- packages/typescript-typings/types/solc/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-typings/types/solc/index.d.ts b/packages/typescript-typings/types/solc/index.d.ts index 2cfd4a030..f4c05cd7c 100644 --- a/packages/typescript-typings/types/solc/index.d.ts +++ b/packages/typescript-typings/types/solc/index.d.ts @@ -1,4 +1,5 @@ declare module 'solc' { + export { ErrorType, ErrorSeverity, SolcError, StandardContractOutput, StandardOutput } from 'ethereum-types'; import { SolcError } from 'ethereum-types'; export interface ContractCompilationResult { srcmap: string; @@ -88,7 +89,6 @@ declare module 'solc' { }; settings: CompilerSettings; } - export { ErrorType, ErrorSeverity, SolcError, StandardContractOutput, StandardOutput } from 'ethereum-types'; export interface SolcInstance { compile( sources: InputSources, -- cgit v1.2.3 From 823b6c4d7df56e6bc517b72878fb1ff5823a5b6f Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 29 Aug 2018 11:01:04 -0400 Subject: transform solc's ABI output into doc types --- packages/sol-doc/src/index.ts | 2 +- packages/sol-doc/src/solidity_doc_generator.ts | 296 ++++++++++++++++----- .../sol-doc/test/solidity_doc_generator_test.ts | 52 +++- 3 files changed, 284 insertions(+), 66 deletions(-) diff --git a/packages/sol-doc/src/index.ts b/packages/sol-doc/src/index.ts index dc88fae90..03f3c9de6 100644 --- a/packages/sol-doc/src/index.ts +++ b/packages/sol-doc/src/index.ts @@ -1 +1 @@ -export { SolidityDocGenerator } from './solidity_doc_generator'; +export { generateSolDocAsync } from './solidity_doc_generator'; diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 95c89b2e5..312124ca1 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -1,76 +1,252 @@ import * as _ from 'lodash'; -import { MethodAbi } from 'ethereum-types'; +import { + AbiDefinition, + ConstructorAbi, + DataItem, + DevdocOutput, + EventAbi, + FallbackAbi, + MethodAbi, + StandardContractOutput, +} from 'ethereum-types'; import { Compiler, CompilerOptions } from '@0xproject/sol-compiler'; -import { DocAgnosticFormat } from '@0xproject/types'; +import { + DocAgnosticFormat, + DocSection, + Event, + EventArg, + Parameter, + SolidityMethod, + Type, + TypeDocTypes, +} from '@0xproject/types'; import { logUtils } from '@0xproject/utils'; /** - * Compiles solidity files to both their ABI and devdoc outputs, and transforms - * those outputs into the types that feed into documentation generation tools. + * Invoke the Solidity compiler and transform its ABI and devdoc outputs into + * the types that are used as input to documentation generation tools. + * @param contractsToCompile 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 class SolidityDocGenerator { - private readonly _compilerOptions: CompilerOptions; - /** - * Instantiate the generator. - * @param contractsDir the directory in which to find the contracts to be compiled - */ - constructor(contractsDir: string) { - // instantiate sol-compiler, passing in options to say we want abi and devdoc - this._compilerOptions = { - contractsDir, - contracts: '*', - compilerSettings: { - outputSelection: { - ['*']: { - ['*']: ['abi', 'devdoc'], - }, +export async function generateSolDocAsync( + contractsToCompile: string[], + contractsDir: string, +): Promise { + const doc: DocAgnosticFormat = {}; + + const compilerOptions = _makeCompilerOptions(contractsToCompile, contractsDir); + 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'); + } + doc[contractName] = _genDocSection(compiledContract); + } + } + } + + return doc; +} + +function _makeCompilerOptions(contractsToCompile: string[], contractsDir: string): CompilerOptions { + const compilerOptions: CompilerOptions = { + contractsDir, + contracts: '*', + compilerSettings: { + outputSelection: { + ['*']: { + ['*']: ['abi', 'devdoc'], }, }, - }; + }, + }; + + const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile); + if (shouldOverrideCatchAllContractsConfig) { + compilerOptions.contracts = contractsToCompile; } - /** - * Invoke the compiler and transform its outputs. - * @param contractsToCompile list of contracts for which to generate doc objects - * @return doc objects for use with documentation generation tools. - */ - public async generateAsync(contractsToCompile: string[]): Promise { - const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile); - if (shouldOverrideCatchAllContractsConfig) { - this._compilerOptions.contracts = contractsToCompile; - } - const doc: DocAgnosticFormat = {}; - - const compiler = new Compiler(this._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.'); - } - if (_.isUndefined(compiledContract.devdoc)) { - throw new Error('compiled contract did not contain devdoc output.'); - } - - logUtils.log( - `TODO: extract data from ${contractName}'s abi (eg name, which is "${ - (compiledContract.abi[0] as MethodAbi).name - }", etc) and devdoc (eg title, which is "${ - compiledContract.devdoc.title - }") outputs, and insert it into \`doc\``, - ); - } - } + return compilerOptions; +} + +function _genDocSection(compiledContract: StandardContractOutput): 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(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': + docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc)); + break; + default: + throw new Error(`unknown and unsupported AbiDefinition type '${abiDefinition.type}'`); } + } + + return docSection; +} + +function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { + const { parameters, methodSignature } = _genMethodParamsDoc( + '', // TODO: update depending on how constructors are keyed in devdoc + abiDefinition.inputs, + devdocIfExists, + ); + + let comment; + // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and + // from that object extract the "details" (comment) property + comment = 'something from devdoc'; + + return { + isConstructor: true, + name: '', // sad we have to specify this + callPath: '', // TODO: wtf is this? + parameters, + returnType: { name: '', typeDocType: TypeDocTypes.Intrinsic }, // sad we have to specify this + isConstant: false, // constructors are non-const by their nature, right? + isPayable: abiDefinition.payable, + comment, + }; +} + +function _genMethodDoc( + abiDefinition: MethodAbi | FallbackAbi, + devdocIfExists: DevdocOutput | undefined, +): SolidityMethod { + const name = abiDefinition.type === 'fallback' ? '' : abiDefinition.name; - return doc; + const { parameters, methodSignature } = + abiDefinition.type === 'fallback' + ? { parameters: [], methodSignature: `${name}()` } + : _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists); + + let comment; + // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and + // from that object extract the "details" (comment) property + comment = 'something from devdoc'; + + const returnType = + abiDefinition.type === 'fallback' + ? { name: '', typeDocType: TypeDocTypes.Intrinsic } + : _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists); + + const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant; + // TODO: determine whether fallback functions are always constant, as coded just above + + return { + isConstructor: false, + name, + callPath: '', // TODO: wtf is this? + parameters, + returnType, + isConstant, + isPayable: abiDefinition.payable, + comment, + }; +} + +function _genEventDoc(abiDefinition: EventAbi): Event { + const eventDoc: Event = { + name: abiDefinition.name, + eventArgs: _genEventArgsDoc(abiDefinition.inputs, undefined), + }; + return eventDoc; +} + +function _genEventArgsDoc(args: DataItem[], 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: false, // TODO: wtf is this? + name, + type, + }; + + eventArgsDoc.push(eventArgDoc); + } + return eventArgsDoc; +} + +/** + * Extract documentation for each method paramater from @param params. + * TODO: Then, use @param name, along with the types of the method + * parameters, to form a method signature. That signature is the key to + * the method documentation held in @param devdocIfExists. + */ +function _genMethodParamsDoc( + name: string, + params: DataItem[], + devdocIfExists: DevdocOutput | undefined, +): { parameters: Parameter[]; methodSignature: string } { + const parameters: Parameter[] = []; + for (const input of params) { + const parameter: Parameter = { + name: input.name, + comment: '', // TODO: get from devdoc. see comment below. + isOptional: false, // Unsupported in Solidity, until resolution of https://github.com/ethereum/solidity/issues/232 + type: { name: input.type, typeDocType: TypeDocTypes.Intrinsic }, + }; + parameters.push(parameter); + } + // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and + // from that object extract the "details" (comment) property + 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.name, typeDocType: TypeDocTypes.Intrinsic }); + } + } else if (outputs.length === 1) { + methodReturnTypeDoc.typeDocType = TypeDocTypes.Intrinsic; + methodReturnTypeDoc.name = outputs[0].name; } + return methodReturnTypeDoc; } diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 1df3e5b44..df6ad8e54 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -1,7 +1,11 @@ +import * as _ from 'lodash'; + import * as chai from 'chai'; import 'mocha'; -import { SolidityDocGenerator } from '../src/solidity_doc_generator'; +import { DocSection } from '@0xproject/types'; + +import { generateSolDocAsync } from '../src/solidity_doc_generator'; import { chaiSetup } from './util/chai_setup'; @@ -9,11 +13,49 @@ chaiSetup.configure(); const expect = chai.expect; describe('#SolidityDocGenerator', () => { - it('should generate', async () => { - const generator = new SolidityDocGenerator(`${__dirname}/../../test/fixtures/contracts`); - - const doc = await generator.generateAsync(['TokenTransferProxy']); + it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { + const doc = await generateSolDocAsync(['TokenTransferProxy'], `${__dirname}/../../test/fixtures/contracts`); expect(doc).to.not.be.undefined(); + + const tokenTransferProxyConstructorCount = 0; + const tokenTransferProxyMethodCount = 8; + const tokenTransferProxyEventCount = 3; + expect(doc.TokenTransferProxy.constructors.length).to.equal(tokenTransferProxyConstructorCount); + expect(doc.TokenTransferProxy.methods.length).to.equal(tokenTransferProxyMethodCount); + if (_.isUndefined(doc.TokenTransferProxy.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.TokenTransferProxy.events.length).to.equal(tokenTransferProxyEventCount); + + const ownableConstructorCount = 1; + const ownableMethodCount = 2; + const ownableEventCount = 1; + expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); + expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); + if (_.isUndefined(doc.Ownable.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.Ownable.events.length).to.equal(ownableEventCount); + + const erc20ConstructorCount = 0; + const erc20MethodCount = 6; + const erc20EventCount = 2; + expect(doc.ERC20.constructors.length).to.equal(erc20ConstructorCount); + expect(doc.ERC20.methods.length).to.equal(erc20MethodCount); + if (_.isUndefined(doc.ERC20.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20.events.length).to.equal(erc20EventCount); + + const erc20BasicConstructorCount = 0; + const erc20BasicMethodCount = 3; + const erc20BasicEventCount = 1; + expect(doc.ERC20Basic.constructors.length).to.equal(erc20BasicConstructorCount); + expect(doc.ERC20Basic.methods.length).to.equal(erc20BasicMethodCount); + if (_.isUndefined(doc.ERC20Basic.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); }); }); -- cgit v1.2.3 From 9a4e6da02f606e97b470a6545b2ce5baf14b03e6 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 29 Aug 2018 11:05:30 -0400 Subject: enable sol-doc tests in circleci --- .circleci/config.yml | 8 ++++++++ packages/sol-doc/coverage/.gitkeep | 0 packages/sol-doc/package.json | 3 +++ 3 files changed, 11 insertions(+) create mode 100644 packages/sol-doc/coverage/.gitkeep diff --git a/.circleci/config.yml b/.circleci/config.yml index 373745a9f..80be13081 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,6 +98,7 @@ jobs: - run: yarn wsrun test:circleci @0xproject/order-watcher - run: yarn wsrun test:circleci @0xproject/sol-compiler - run: yarn wsrun test:circleci @0xproject/sol-cov + - run: yarn wsrun test:circleci @0xproject/sol-doc - run: yarn wsrun test:circleci @0xproject/sra-report - run: yarn wsrun test:circleci @0xproject/subproviders - run: yarn wsrun test:circleci @0xproject/web3-wrapper @@ -150,6 +151,10 @@ jobs: key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/repo/packages/sol-cov/coverage/lcov.info + - save_cache: + key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo/packages/sol-doc/coverage/lcov.info - save_cache: key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} paths: @@ -216,6 +221,9 @@ jobs: - restore_cache: keys: - coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }} + - restore_cache: + keys: + - coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }} diff --git a/packages/sol-doc/coverage/.gitkeep b/packages/sol-doc/coverage/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 9979fff05..e3bc8753c 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -7,6 +7,9 @@ "scripts": { "build": "tsc", "test": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 5000 --exit", + "test:circleci": "yarn test:coverage", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "lint": "tslint --project . --format stylish", "clean": "shx rm -rf lib" }, -- cgit v1.2.3 From 50b725c687c3968b0a495924700296ce6ce5bbec Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 31 Aug 2018 09:33:26 -0400 Subject: introduce named vars to clarify return statements --- packages/sol-doc/src/solidity_doc_generator.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 312124ca1..457c86c91 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -124,7 +124,7 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo // from that object extract the "details" (comment) property comment = 'something from devdoc'; - return { + const constructorDoc: SolidityMethod = { isConstructor: true, name: '', // sad we have to specify this callPath: '', // TODO: wtf is this? @@ -134,6 +134,8 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo isPayable: abiDefinition.payable, comment, }; + + return constructorDoc; } function _genMethodDoc( @@ -160,7 +162,7 @@ function _genMethodDoc( const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant; // TODO: determine whether fallback functions are always constant, as coded just above - return { + const methodDoc: SolidityMethod = { isConstructor: false, name, callPath: '', // TODO: wtf is this? @@ -170,6 +172,7 @@ function _genMethodDoc( isPayable: abiDefinition.payable, comment, }; + return methodDoc; } function _genEventDoc(abiDefinition: EventAbi): Event { -- cgit v1.2.3 From 327b4ba5546907f3c2b6fddd2a4d3d767d1f6767 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 31 Aug 2018 10:04:03 -0400 Subject: satisfy linter --- packages/react-docs/src/utils/typedoc_utils.ts | 1 + packages/sol-doc/src/solidity_doc_generator.ts | 4 +--- packages/sol-doc/test/solidity_doc_generator_test.ts | 2 -- packages/sol-doc/tsconfig.json | 3 ++- packages/website/ts/components/ui/typed_text.tsx | 1 - packages/website/ts/pages/landing/landing.tsx | 5 ----- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index a24e63045..d235b4406 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -468,6 +468,7 @@ export class TypeDocUtils { methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName); } else if (entity.type === TypeDocTypes.Tuple) { tupleElementsIfExists = _.map(entity.elements, el => { + // tslint:disable-next-line:no-unnecessary-type-assertion return { name: el.name, typeDocType: el.type as TypeDocTypes }; }); } diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 457c86c91..debee5b87 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -1,7 +1,6 @@ import * as _ from 'lodash'; import { - AbiDefinition, ConstructorAbi, DataItem, DevdocOutput, @@ -22,7 +21,6 @@ import { Type, TypeDocTypes, } from '@0xproject/types'; -import { logUtils } from '@0xproject/utils'; /** * Invoke the Solidity compiler and transform its ABI and devdoc outputs into @@ -122,7 +120,7 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo let comment; // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and // from that object extract the "details" (comment) property - comment = 'something from devdoc'; + comment = `something from devdoc, using ${methodSignature} to find it`; const constructorDoc: SolidityMethod = { isConstructor: true, diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index df6ad8e54..989f29320 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -3,8 +3,6 @@ import * as _ from 'lodash'; import * as chai from 'chai'; import 'mocha'; -import { DocSection } from '@0xproject/types'; - import { generateSolDocAsync } from '../src/solidity_doc_generator'; import { chaiSetup } from './util/chai_setup'; diff --git a/packages/sol-doc/tsconfig.json b/packages/sol-doc/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/sol-doc/tsconfig.json +++ b/packages/sol-doc/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/website/ts/components/ui/typed_text.tsx b/packages/website/ts/components/ui/typed_text.tsx index 2bb2d40b0..6d38580b9 100644 --- a/packages/website/ts/components/ui/typed_text.tsx +++ b/packages/website/ts/components/ui/typed_text.tsx @@ -1,5 +1,4 @@ import * as _ from 'lodash'; -import { darken } from 'polished'; import * as React from 'react'; import Typist from 'react-typist'; diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 7dfd9c9df..211be7bf2 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -24,11 +24,6 @@ interface BoxContent { classNames: string; maxWidth: number; } -interface AssetType { - title: string; - imageUrl: string; - style?: React.CSSProperties; -} interface UseCase { imageUrl: string; type: string; -- cgit v1.2.3 From 75664b66512fb32539626a42973d293ecad17584 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 31 Aug 2018 11:49:14 -0400 Subject: make postinstall symlink hack cross platform --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a166dd2ab..e8a56401a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i --shouldUpload false --isStaging true || break -1; done;", "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlink properly for types. We temporarily make it manually. Remove this ASAP!", - "postinstall": "mv node_modules/@0xproject/types node_modules/@0xproject/types-0.8.1; for i in website sra-report; do cp -R node_modules/@0xproject/types-0.8.1 packages/$i/node_modules/@0xproject/types; done; ln -s ../../packages/types node_modules/@0xproject/types" + "postinstall": "shx cp -R node_modules/@0xproject/types packages/website/node_modules/@0xproject; shx cp -R node_modules/@0xproject/types packages/sra-report/node_modules/@0xproject; rimraf node_modules/@0xproject/types; shx ln -s ../../packages/types node_modules/@0xproject/types" }, "config": { "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic", -- cgit v1.2.3 From 3dc4eb4421d4f0b1294fcaaa4602245005f36e82 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 31 Aug 2018 15:28:12 -0400 Subject: rename 2 variables --- packages/sol-doc/src/solidity_doc_generator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index debee5b87..240fbbd75 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -211,16 +211,16 @@ function _genEventArgsDoc(args: DataItem[], devdocIfExists: DevdocOutput | undef */ function _genMethodParamsDoc( name: string, - params: DataItem[], + abiParams: DataItem[], devdocIfExists: DevdocOutput | undefined, ): { parameters: Parameter[]; methodSignature: string } { const parameters: Parameter[] = []; - for (const input of params) { + for (const abiParam of abiParams) { const parameter: Parameter = { - name: input.name, + name: abiParam.name, comment: '', // TODO: get from devdoc. see comment below. isOptional: false, // Unsupported in Solidity, until resolution of https://github.com/ethereum/solidity/issues/232 - type: { name: input.type, typeDocType: TypeDocTypes.Intrinsic }, + type: { name: abiParam.type, typeDocType: TypeDocTypes.Intrinsic }, }; parameters.push(parameter); } -- cgit v1.2.3 From 800dd5fb4f0ab21388440a46aef21cd0cf0801c3 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 31 Aug 2018 15:34:13 -0400 Subject: ammend generated docs with solc's devdoc output --- packages/sol-doc/src/solidity_doc_generator.ts | 61 ++++++++++++++++------ .../sol-doc/test/solidity_doc_generator_test.ts | 17 ++++++ 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 240fbbd75..a1ef32e79 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -117,10 +117,8 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo devdocIfExists, ); - let comment; - // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and - // from that object extract the "details" (comment) property - comment = `something from devdoc, using ${methodSignature} to find it`; + const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); + // TODO: figure out why devdoc'd constructors don't get output by solc const constructorDoc: SolidityMethod = { isConstructor: true, @@ -136,6 +134,26 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo 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, @@ -147,10 +165,7 @@ function _genMethodDoc( ? { parameters: [], methodSignature: `${name}()` } : _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists); - let comment; - // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and - // from that object extract the "details" (comment) property - comment = 'something from devdoc'; + const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); const returnType = abiDefinition.type === 'fallback' @@ -205,9 +220,6 @@ function _genEventArgsDoc(args: DataItem[], devdocIfExists: DevdocOutput | undef /** * Extract documentation for each method paramater from @param params. - * TODO: Then, use @param name, along with the types of the method - * parameters, to form a method signature. That signature is the key to - * the method documentation held in @param devdocIfExists. */ function _genMethodParamsDoc( name: string, @@ -215,18 +227,37 @@ function _genMethodParamsDoc( devdocIfExists: DevdocOutput | undefined, ): { parameters: Parameter[]; methodSignature: string } { const parameters: Parameter[] = []; + let methodSignature = `${name}(`; + for (const abiParam of abiParams) { const parameter: Parameter = { name: abiParam.name, - comment: '', // TODO: get from devdoc. see comment below. + 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); + methodSignature = `${methodSignature}${abiParam.type},`; } - // TODO: use methodSignature as the key to abiEntry.devdoc.methods, and - // from that object extract the "details" (comment) property - return { parameters, methodSignature: '' }; + + if (methodSignature.slice(-1) === ',') { + methodSignature = methodSignature.slice(0, -1); + } + methodSignature += ')'; + + 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( diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 989f29320..7f11fcdfd 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -3,6 +3,8 @@ import * as _ from 'lodash'; import * as chai from 'chai'; import 'mocha'; +import { SolidityMethod } from '@0xproject/types'; + import { generateSolDocAsync } from '../src/solidity_doc_generator'; import { chaiSetup } from './util/chai_setup'; @@ -55,5 +57,20 @@ describe('#SolidityDocGenerator', () => { throw new Error('events should never be undefined'); } expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); + + let addAuthorizedAddressMethod: SolidityMethod | undefined; + for (const method of doc.TokenTransferProxy.methods) { + if (method.name === 'addAuthorizedAddress') { + addAuthorizedAddressMethod = method; + } + } + expect( + addAuthorizedAddressMethod, + `method addAuthorizedAddress not found in ${JSON.stringify(doc.TokenTransferProxy.methods)}`, + ).to.not.be.undefined(); + const tokenTransferProxyAddAuthorizedAddressComment = 'Authorizes an address.'; + expect((addAuthorizedAddressMethod as SolidityMethod).comment).to.equal( + tokenTransferProxyAddAuthorizedAddressComment, + ); }); }); -- cgit v1.2.3 From d5f964b58e755ccf1e63a61a97da1c161cf22b22 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 13 Sep 2018 13:05:01 -0400 Subject: test w/&w/out passing in `contractsToCompile` --- packages/sol-doc/src/solidity_doc_generator.ts | 8 +- .../sol-doc/test/solidity_doc_generator_test.ts | 127 ++++++++++++--------- 2 files changed, 76 insertions(+), 59 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index a1ef32e79..513468803 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -30,12 +30,12 @@ import { * @return doc object for use with documentation generation tools. */ export async function generateSolDocAsync( - contractsToCompile: string[], contractsDir: string, + contractsToCompile?: string[], ): Promise { const doc: DocAgnosticFormat = {}; - const compilerOptions = _makeCompilerOptions(contractsToCompile, contractsDir); + const compilerOptions = _makeCompilerOptions(contractsDir, contractsToCompile); const compiler = new Compiler(compilerOptions); const compilerOutputs = await compiler.getCompilerOutputsAsync(); for (const compilerOutput of compilerOutputs) { @@ -57,7 +57,7 @@ export async function generateSolDocAsync( return doc; } -function _makeCompilerOptions(contractsToCompile: string[], contractsDir: string): CompilerOptions { +function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[]): CompilerOptions { const compilerOptions: CompilerOptions = { contractsDir, contracts: '*', @@ -70,7 +70,7 @@ function _makeCompilerOptions(contractsToCompile: string[], contractsDir: string }, }; - const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile); + const shouldOverrideCatchAllContractsConfig = !_.isUndefined(contractsToCompile) && contractsToCompile.length > 0; if (shouldOverrideCatchAllContractsConfig) { compilerOptions.contracts = contractsToCompile; } diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 7f11fcdfd..b71cce6e7 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -3,7 +3,7 @@ import * as _ from 'lodash'; import * as chai from 'chai'; import 'mocha'; -import { SolidityMethod } from '@0xproject/types'; +import { DocAgnosticFormat, SolidityMethod } from '@0xproject/types'; import { generateSolDocAsync } from '../src/solidity_doc_generator'; @@ -12,65 +12,82 @@ import { chaiSetup } from './util/chai_setup'; chaiSetup.configure(); const expect = chai.expect; -describe('#SolidityDocGenerator', () => { - it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { - const doc = await generateSolDocAsync(['TokenTransferProxy'], `${__dirname}/../../test/fixtures/contracts`); +describe('#SolidityDocGenerator', async () => { + const docPromises: Array> = [ + generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`), + generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []), + generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['TokenTransferProxy']), + ]; + docPromises.forEach(docPromise => { + it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { + const doc = await docPromise; + expect(doc).to.not.be.undefined(); - expect(doc).to.not.be.undefined(); - - const tokenTransferProxyConstructorCount = 0; - const tokenTransferProxyMethodCount = 8; - const tokenTransferProxyEventCount = 3; - expect(doc.TokenTransferProxy.constructors.length).to.equal(tokenTransferProxyConstructorCount); - expect(doc.TokenTransferProxy.methods.length).to.equal(tokenTransferProxyMethodCount); - if (_.isUndefined(doc.TokenTransferProxy.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.TokenTransferProxy.events.length).to.equal(tokenTransferProxyEventCount); + expect(doc.TokenTransferProxy).to.not.be.undefined(); + expect(doc.TokenTransferProxy.constructors).to.not.be.undefined(); + const tokenTransferProxyConstructorCount = 0; + const tokenTransferProxyMethodCount = 8; + const tokenTransferProxyEventCount = 3; + expect(doc.TokenTransferProxy.constructors.length).to.equal(tokenTransferProxyConstructorCount); + expect(doc.TokenTransferProxy.methods.length).to.equal(tokenTransferProxyMethodCount); + if (_.isUndefined(doc.TokenTransferProxy.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.TokenTransferProxy.events.length).to.equal(tokenTransferProxyEventCount); - const ownableConstructorCount = 1; - const ownableMethodCount = 2; - const ownableEventCount = 1; - expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); - expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); - if (_.isUndefined(doc.Ownable.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.Ownable.events.length).to.equal(ownableEventCount); + expect(doc.Ownable).to.not.be.undefined(); + expect(doc.Ownable.constructors).to.not.be.undefined(); + expect(doc.Ownable.methods).to.not.be.undefined(); + const ownableConstructorCount = 1; + const ownableMethodCount = 2; + const ownableEventCount = 1; + expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); + expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); + if (_.isUndefined(doc.Ownable.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.Ownable.events.length).to.equal(ownableEventCount); - const erc20ConstructorCount = 0; - const erc20MethodCount = 6; - const erc20EventCount = 2; - expect(doc.ERC20.constructors.length).to.equal(erc20ConstructorCount); - expect(doc.ERC20.methods.length).to.equal(erc20MethodCount); - if (_.isUndefined(doc.ERC20.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.ERC20.events.length).to.equal(erc20EventCount); + expect(doc.ERC20).to.not.be.undefined(); + expect(doc.ERC20.constructors).to.not.be.undefined(); + expect(doc.ERC20.methods).to.not.be.undefined(); + const erc20ConstructorCount = 0; + const erc20MethodCount = 6; + const erc20EventCount = 2; + expect(doc.ERC20.constructors.length).to.equal(erc20ConstructorCount); + expect(doc.ERC20.methods.length).to.equal(erc20MethodCount); + if (_.isUndefined(doc.ERC20.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20.events.length).to.equal(erc20EventCount); - const erc20BasicConstructorCount = 0; - const erc20BasicMethodCount = 3; - const erc20BasicEventCount = 1; - expect(doc.ERC20Basic.constructors.length).to.equal(erc20BasicConstructorCount); - expect(doc.ERC20Basic.methods.length).to.equal(erc20BasicMethodCount); - if (_.isUndefined(doc.ERC20Basic.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); + expect(doc.ERC20Basic).to.not.be.undefined(); + expect(doc.ERC20Basic.constructors).to.not.be.undefined(); + expect(doc.ERC20Basic.methods).to.not.be.undefined(); + const erc20BasicConstructorCount = 0; + const erc20BasicMethodCount = 3; + const erc20BasicEventCount = 1; + expect(doc.ERC20Basic.constructors.length).to.equal(erc20BasicConstructorCount); + expect(doc.ERC20Basic.methods.length).to.equal(erc20BasicMethodCount); + if (_.isUndefined(doc.ERC20Basic.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); - let addAuthorizedAddressMethod: SolidityMethod | undefined; - for (const method of doc.TokenTransferProxy.methods) { - if (method.name === 'addAuthorizedAddress') { - addAuthorizedAddressMethod = method; + let addAuthorizedAddressMethod: SolidityMethod | undefined; + for (const method of doc.TokenTransferProxy.methods) { + if (method.name === 'addAuthorizedAddress') { + addAuthorizedAddressMethod = method; + } } - } - expect( - addAuthorizedAddressMethod, - `method addAuthorizedAddress not found in ${JSON.stringify(doc.TokenTransferProxy.methods)}`, - ).to.not.be.undefined(); - const tokenTransferProxyAddAuthorizedAddressComment = 'Authorizes an address.'; - expect((addAuthorizedAddressMethod as SolidityMethod).comment).to.equal( - tokenTransferProxyAddAuthorizedAddressComment, - ); + expect( + addAuthorizedAddressMethod, + `method addAuthorizedAddress not found in ${JSON.stringify(doc.TokenTransferProxy.methods)}`, + ).to.not.be.undefined(); + const tokenTransferProxyAddAuthorizedAddressComment = 'Authorizes an address.'; + expect((addAuthorizedAddressMethod as SolidityMethod).comment).to.equal( + tokenTransferProxyAddAuthorizedAddressComment, + ); + }); }); }); -- cgit v1.2.3 From a75981da148c8a300544a559bc01be1770d443cf Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 13 Sep 2018 13:56:10 -0400 Subject: test w/&w/out devdoc content in contract --- .../contracts/TokenTransferProxyNoDevdoc.sol | 100 ++++++++++++++++ .../sol-doc/test/solidity_doc_generator_test.ts | 132 ++++++++++++--------- 2 files changed, 176 insertions(+), 56 deletions(-) create mode 100644 packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol diff --git a/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol new file mode 100644 index 000000000..cc45a79e9 --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol @@ -0,0 +1,100 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.4.14; + +import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol"; +import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; + +contract TokenTransferProxyNoDevdoc is Ownable { + + modifier onlyAuthorized { + require(authorized[msg.sender]); + _; + } + + modifier targetAuthorized(address target) { + require(authorized[target]); + _; + } + + modifier targetNotAuthorized(address target) { + require(!authorized[target]); + _; + } + + mapping (address => bool) public authorized; + address[] public authorities; + + event LogAuthorizedAddressAdded(address indexed target, address indexed caller); + event LogAuthorizedAddressRemoved(address indexed target, address indexed caller); + + /* + * Public functions + */ + + function addAuthorizedAddress(address target) + public + onlyOwner + targetNotAuthorized(target) + { + authorized[target] = true; + authorities.push(target); + LogAuthorizedAddressAdded(target, msg.sender); + } + + function removeAuthorizedAddress(address target) + public + onlyOwner + targetAuthorized(target) + { + delete authorized[target]; + for (uint i = 0; i < authorities.length; i++) { + if (authorities[i] == target) { + authorities[i] = authorities[authorities.length - 1]; + authorities.length -= 1; + break; + } + } + LogAuthorizedAddressRemoved(target, msg.sender); + } + + function transferFrom( + address token, + address from, + address to, + uint value) + public + onlyAuthorized + returns (bool) + { + return Token(token).transferFrom(from, to, value); + } + + /* + * Public constant functions + */ + + function getAuthorizedAddresses() + public + constant + returns (address[]) + { + return authorities; + } +} diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index b71cce6e7..47289c7c6 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -12,67 +12,26 @@ import { chaiSetup } from './util/chai_setup'; chaiSetup.configure(); const expect = chai.expect; -describe('#SolidityDocGenerator', async () => { +describe('#SolidityDocGenerator', () => { + it('should generate a doc object that matches the devdoc-free fixture', async () => { + const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [ + 'TokenTransferProxyNoDevdoc', + ]); + expect(doc).to.not.be.undefined(); + + verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxyNoDevdoc'); + }); const docPromises: Array> = [ generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`), generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []), generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['TokenTransferProxy']), ]; docPromises.forEach(docPromise => { - it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { + it('should generate a doc object that matches the fixture', async () => { const doc = await docPromise; expect(doc).to.not.be.undefined(); - expect(doc.TokenTransferProxy).to.not.be.undefined(); - expect(doc.TokenTransferProxy.constructors).to.not.be.undefined(); - const tokenTransferProxyConstructorCount = 0; - const tokenTransferProxyMethodCount = 8; - const tokenTransferProxyEventCount = 3; - expect(doc.TokenTransferProxy.constructors.length).to.equal(tokenTransferProxyConstructorCount); - expect(doc.TokenTransferProxy.methods.length).to.equal(tokenTransferProxyMethodCount); - if (_.isUndefined(doc.TokenTransferProxy.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.TokenTransferProxy.events.length).to.equal(tokenTransferProxyEventCount); - - expect(doc.Ownable).to.not.be.undefined(); - expect(doc.Ownable.constructors).to.not.be.undefined(); - expect(doc.Ownable.methods).to.not.be.undefined(); - const ownableConstructorCount = 1; - const ownableMethodCount = 2; - const ownableEventCount = 1; - expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); - expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); - if (_.isUndefined(doc.Ownable.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.Ownable.events.length).to.equal(ownableEventCount); - - expect(doc.ERC20).to.not.be.undefined(); - expect(doc.ERC20.constructors).to.not.be.undefined(); - expect(doc.ERC20.methods).to.not.be.undefined(); - const erc20ConstructorCount = 0; - const erc20MethodCount = 6; - const erc20EventCount = 2; - expect(doc.ERC20.constructors.length).to.equal(erc20ConstructorCount); - expect(doc.ERC20.methods.length).to.equal(erc20MethodCount); - if (_.isUndefined(doc.ERC20.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.ERC20.events.length).to.equal(erc20EventCount); - - expect(doc.ERC20Basic).to.not.be.undefined(); - expect(doc.ERC20Basic.constructors).to.not.be.undefined(); - expect(doc.ERC20Basic.methods).to.not.be.undefined(); - const erc20BasicConstructorCount = 0; - const erc20BasicMethodCount = 3; - const erc20BasicEventCount = 1; - expect(doc.ERC20Basic.constructors.length).to.equal(erc20BasicConstructorCount); - expect(doc.ERC20Basic.methods.length).to.equal(erc20BasicMethodCount); - if (_.isUndefined(doc.ERC20Basic.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); + verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxy'); let addAuthorizedAddressMethod: SolidityMethod | undefined; for (const method of doc.TokenTransferProxy.methods) { @@ -80,10 +39,6 @@ describe('#SolidityDocGenerator', async () => { addAuthorizedAddressMethod = method; } } - expect( - addAuthorizedAddressMethod, - `method addAuthorizedAddress not found in ${JSON.stringify(doc.TokenTransferProxy.methods)}`, - ).to.not.be.undefined(); const tokenTransferProxyAddAuthorizedAddressComment = 'Authorizes an address.'; expect((addAuthorizedAddressMethod as SolidityMethod).comment).to.equal( tokenTransferProxyAddAuthorizedAddressComment, @@ -91,3 +46,68 @@ describe('#SolidityDocGenerator', async () => { }); }); }); + +function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contractName: string): void { + expect(doc[contractName]).to.not.be.undefined(); + expect(doc[contractName].constructors).to.not.be.undefined(); + const tokenTransferProxyConstructorCount = 0; + const tokenTransferProxyMethodCount = 8; + const tokenTransferProxyEventCount = 3; + expect(doc[contractName].constructors.length).to.equal(tokenTransferProxyConstructorCount); + expect(doc[contractName].methods.length).to.equal(tokenTransferProxyMethodCount); + const events = doc[contractName].events; + if (_.isUndefined(events)) { + throw new Error('events should never be undefined'); + } + expect(events.length).to.equal(tokenTransferProxyEventCount); + + expect(doc.Ownable).to.not.be.undefined(); + expect(doc.Ownable.constructors).to.not.be.undefined(); + expect(doc.Ownable.methods).to.not.be.undefined(); + const ownableConstructorCount = 1; + const ownableMethodCount = 2; + const ownableEventCount = 1; + expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); + expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); + if (_.isUndefined(doc.Ownable.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.Ownable.events.length).to.equal(ownableEventCount); + + expect(doc.ERC20).to.not.be.undefined(); + expect(doc.ERC20.constructors).to.not.be.undefined(); + expect(doc.ERC20.methods).to.not.be.undefined(); + const erc20ConstructorCount = 0; + const erc20MethodCount = 6; + const erc20EventCount = 2; + expect(doc.ERC20.constructors.length).to.equal(erc20ConstructorCount); + expect(doc.ERC20.methods.length).to.equal(erc20MethodCount); + if (_.isUndefined(doc.ERC20.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20.events.length).to.equal(erc20EventCount); + + expect(doc.ERC20Basic).to.not.be.undefined(); + expect(doc.ERC20Basic.constructors).to.not.be.undefined(); + expect(doc.ERC20Basic.methods).to.not.be.undefined(); + const erc20BasicConstructorCount = 0; + const erc20BasicMethodCount = 3; + const erc20BasicEventCount = 1; + expect(doc.ERC20Basic.constructors.length).to.equal(erc20BasicConstructorCount); + expect(doc.ERC20Basic.methods.length).to.equal(erc20BasicMethodCount); + if (_.isUndefined(doc.ERC20Basic.events)) { + throw new Error('events should never be undefined'); + } + expect(doc.ERC20Basic.events.length).to.equal(erc20BasicEventCount); + + let addAuthorizedAddressMethod: SolidityMethod | undefined; + for (const method of doc[contractName].methods) { + if (method.name === 'addAuthorizedAddress') { + addAuthorizedAddressMethod = method; + } + } + expect( + addAuthorizedAddressMethod, + `method addAuthorizedAddress not found in ${JSON.stringify(doc[contractName].methods)}`, + ).to.not.be.undefined(); +} -- cgit v1.2.3 From 3c7155afb07f17c62d7203c43bddeb4a3c5b7b01 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 17:14:23 -0400 Subject: test all the natspec stuff we use in our contracts --- .../test/fixtures/contracts/NatspecEverything.sol | 37 ++++++++ .../sol-doc/test/solidity_doc_generator_test.ts | 104 ++++++++++++++++++++- 2 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol diff --git a/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol b/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol new file mode 100644 index 000000000..3dea03c9a --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol @@ -0,0 +1,37 @@ +pragma solidity ^0.4.24; + +/// @title Contract Title +/// @dev This is a very long documentation comment at the contract level. +/// It actually spans multiple lines, too. +contract NatspecEverything { + int d; + + /// @dev Constructor @dev + /// @param p Constructor @param + constructor(int p) public { d = p; } + + /// @notice publicMethod @notice + /// @dev publicMethod @dev + /// @param p publicMethod @param + /// @return publicMethod @return + function publicMethod(int p) public pure returns(int r) { return p; } + + /// @notice externalMethod @notice + /// @dev externalMethod @dev + /// @param p externalMethod @param + /// @return externalMethod @return + function externalMethod(int p) external pure returns(int r) { return p; } + + /// @dev Here is a really long developer documentation comment, which spans + /// multiple lines, for the purposes of making sure that broken lines are + /// consolidated into one devdoc comment. + function methodWithLongDevdoc(int p) public pure returns(int) { return p; } + + /// @dev AnEvent @dev + /// @param p on this event is an integer. + event AnEvent(int p); + + /// @dev methodWithSolhintDirective @dev + // solhint-disable no-empty-blocks + function methodWithSolhintDirective() public pure {} +} diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 47289c7c6..bae67001b 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -3,7 +3,7 @@ import * as _ from 'lodash'; import * as chai from 'chai'; import 'mocha'; -import { DocAgnosticFormat, SolidityMethod } from '@0xproject/types'; +import { DocAgnosticFormat, Event, SolidityMethod } from '@0xproject/types'; import { generateSolDocAsync } from '../src/solidity_doc_generator'; @@ -43,6 +43,108 @@ describe('#SolidityDocGenerator', () => { expect((addAuthorizedAddressMethod as SolidityMethod).comment).to.equal( tokenTransferProxyAddAuthorizedAddressComment, ); + + const expectedParamComment = 'Address to authorize.'; + expect((addAuthorizedAddressMethod as SolidityMethod).parameters[0].comment).to.equal(expectedParamComment); + }); + }); + 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']); + expect(doc).to.not.be.undefined(); + expect(doc.NatspecEverything).to.not.be.undefined(); + }); + it('should emit the contract @title as its comment', () => { + expect(doc.NatspecEverything.comment).to.equal('Contract Title'); + }); + describe('should emit public method documentation for', () => { + let methodDoc: SolidityMethod; + before(() => { + // tslint:disable-next-line:no-unnecessary-type-assertion + methodDoc = doc.NatspecEverything.methods.find(method => { + return method.name === 'publicMethod'; + }) as SolidityMethod; + if (_.isUndefined(methodDoc)) { + throw new Error('publicMethod not found'); + } + }); + it('method name', () => { + expect(methodDoc.name).to.equal('publicMethod'); + }); + it('method comment', () => { + expect(methodDoc.comment).to.equal('publicMethod @dev'); + }); + it('parameter name', () => { + expect(methodDoc.parameters[0].name).to.equal('p'); + }); + it('parameter comment', () => { + expect(methodDoc.parameters[0].comment).to.equal('publicMethod @param'); + }); + it('return type name', () => { + expect(methodDoc.returnType.name).to.equal('r'); + }); + }); + describe('should emit external method documentation for', () => { + let methodDoc: SolidityMethod; + before(() => { + // tslint:disable-next-line:no-unnecessary-type-assertion + methodDoc = doc.NatspecEverything.methods.find(method => { + return method.name === 'externalMethod'; + }) as SolidityMethod; + if (_.isUndefined(methodDoc)) { + throw new Error('externalMethod not found'); + } + }); + it('method name', () => { + expect(methodDoc.name).to.equal('externalMethod'); + }); + it('method comment', () => { + expect(methodDoc.comment).to.equal('externalMethod @dev'); + }); + it('parameter name', () => { + expect(methodDoc.parameters[0].name).to.equal('p'); + }); + it('parameter comment', () => { + expect(methodDoc.parameters[0].comment).to.equal('externalMethod @param'); + }); + it('return type name', () => { + expect(methodDoc.returnType.name).to.equal('r'); + }); + }); + it('should not truncate a multi-line devdoc comment', () => { + // tslint:disable-next-line:no-unnecessary-type-assertion + const methodDoc: SolidityMethod = doc.NatspecEverything.methods.find(method => { + return method.name === 'methodWithLongDevdoc'; + }) as SolidityMethod; + if (_.isUndefined(methodDoc)) { + throw new Error('methodWithLongDevdoc not found'); + } + expect(methodDoc.comment).to.equal( + 'Here is a really long developer documentation comment, which spans multiple lines, for the purposes of making sure that broken lines are consolidated into one devdoc comment.', + ); + }); + describe('should emit event documentation for', () => { + let eventDoc: Event; + before(() => { + eventDoc = (doc.NatspecEverything.events as Event[])[0]; + }); + it('event name', () => { + expect(eventDoc.name).to.equal('AnEvent'); + }); + it('parameter name', () => { + expect(eventDoc.eventArgs[0].name).to.equal('p'); + }); + }); + it('should not let solhint directives obscure natspec content', () => { + // tslint:disable-next-line:no-unnecessary-type-assertion + const methodDoc: SolidityMethod = doc.NatspecEverything.methods.find(method => { + return method.name === 'methodWithSolhintDirective'; + }) as SolidityMethod; + if (_.isUndefined(methodDoc)) { + throw new Error('methodWithSolhintDirective not found'); + } + expect(methodDoc.comment).to.equal('methodWithSolhintDirective @dev'); }); }); }); -- cgit v1.2.3 From 5b07669bd0e128a92c8a71d797ac95d77337209b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 17:23:55 -0400 Subject: add and test support for fallback functions --- packages/sol-doc/src/solidity_doc_generator.ts | 6 +++++- packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 513468803..3501e9a52 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -1,6 +1,7 @@ import * as _ from 'lodash'; import { + AbiDefinition, ConstructorAbi, DataItem, DevdocOutput, @@ -100,10 +101,13 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection { // 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.type}'`); + throw new Error( + `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, + ); } } diff --git a/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol b/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol index 3dea03c9a..c6ad3db81 100644 --- a/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol +++ b/packages/sol-doc/test/fixtures/contracts/NatspecEverything.sol @@ -16,6 +16,9 @@ contract NatspecEverything { /// @return publicMethod @return function publicMethod(int p) public pure returns(int r) { return p; } + /// @dev Fallback @dev + function () public {} + /// @notice externalMethod @notice /// @dev externalMethod @dev /// @param p externalMethod @param -- cgit v1.2.3 From 9201273939598a13ed00084acdb384403c36fcc4 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 17:27:33 -0400 Subject: add and test support for return comment --- packages/sol-doc/src/solidity_doc_generator.ts | 6 ++++++ packages/sol-doc/test/solidity_doc_generator_test.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 3501e9a52..e0dcb692a 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -176,6 +176,11 @@ function _genMethodDoc( ? { 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; // TODO: determine whether fallback functions are always constant, as coded just above @@ -185,6 +190,7 @@ function _genMethodDoc( callPath: '', // TODO: wtf is this? parameters, returnType, + returnComment, isConstant, isPayable: abiDefinition.payable, comment, diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index bae67001b..23ffe7b9e 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -84,6 +84,9 @@ describe('#SolidityDocGenerator', () => { it('return type name', () => { expect(methodDoc.returnType.name).to.equal('r'); }); + it('return comment', () => { + expect(methodDoc.returnComment).to.equal('publicMethod @return'); + }); }); describe('should emit external method documentation for', () => { let methodDoc: SolidityMethod; @@ -111,6 +114,9 @@ describe('#SolidityDocGenerator', () => { it('return type name', () => { expect(methodDoc.returnType.name).to.equal('r'); }); + it('return comment', () => { + expect(methodDoc.returnComment).to.equal('externalMethod @return'); + }); }); it('should not truncate a multi-line devdoc comment', () => { // tslint:disable-next-line:no-unnecessary-type-assertion -- cgit v1.2.3 From 401ef2edef50a73ec387d95ac9998f9badb4b34a Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 17:35:11 -0400 Subject: minorly tweak comments --- packages/sol-doc/src/solidity_doc_generator.ts | 1 - packages/sol-doc/test/solidity_doc_generator_test.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index e0dcb692a..6b561d8a6 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -122,7 +122,6 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo ); const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); - // TODO: figure out why devdoc'd constructors don't get output by solc const constructorDoc: SolidityMethod = { isConstructor: true, diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 23ffe7b9e..896690ce6 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -13,7 +13,7 @@ chaiSetup.configure(); const expect = chai.expect; describe('#SolidityDocGenerator', () => { - it('should generate a doc object that matches the devdoc-free fixture', async () => { + it('should generate a doc object that matches the devdoc-free TokenTransferProxy fixture', async () => { const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [ 'TokenTransferProxyNoDevdoc', ]); @@ -27,7 +27,7 @@ describe('#SolidityDocGenerator', () => { generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['TokenTransferProxy']), ]; docPromises.forEach(docPromise => { - it('should generate a doc object that matches the fixture', async () => { + it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { const doc = await docPromise; expect(doc).to.not.be.undefined(); -- cgit v1.2.3 From 4ade674ada7596f1a7c5d0113815c5964e82db0f Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 13 Sep 2018 14:25:54 -0400 Subject: test multiple return values from a solidity method --- .../test/fixtures/contracts/MultipleReturnValues.sol | 7 +++++++ packages/sol-doc/test/solidity_doc_generator_test.ts | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 packages/sol-doc/test/fixtures/contracts/MultipleReturnValues.sol diff --git a/packages/sol-doc/test/fixtures/contracts/MultipleReturnValues.sol b/packages/sol-doc/test/fixtures/contracts/MultipleReturnValues.sol new file mode 100644 index 000000000..1e898622c --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/MultipleReturnValues.sol @@ -0,0 +1,7 @@ +pragma solidity ^0.4.24; + +contract MultipleReturnValues { + function methodWithMultipleReturnValues() public pure returns(int, int) { + return (0, 0); + } +} diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 896690ce6..5004b1a90 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -153,6 +153,26 @@ describe('#SolidityDocGenerator', () => { expect(methodDoc.comment).to.equal('methodWithSolhintDirective @dev'); }); }); + it('should document a method that returns multiple values', async () => { + const doc = await 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; + for (const method of doc.MultipleReturnValues.methods) { + if (method.name === 'methodWithMultipleReturnValues') { + methodWithMultipleReturnValues = method; + } + } + if (_.isUndefined(methodWithMultipleReturnValues)) { + throw new Error('method should not be undefined'); + } + const returnType = methodWithMultipleReturnValues.returnType; + expect(returnType.typeDocType).to.equal('tuple'); + if (_.isUndefined(returnType.tupleElements)) { + throw new Error('returnType.tupleElements should not be undefined'); + } + expect(returnType.tupleElements.length).to.equal(2); + }); }); function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contractName: string): void { -- cgit v1.2.3 From d40a670d0be4db73dc15dc33094663f9c617312c Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 18:31:55 -0400 Subject: add newline to delimit interface declaration --- packages/ethereum-types/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index b4c9b73ca..7bf1721a7 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -363,6 +363,7 @@ export type ErrorType = | 'FatalError' | 'Warning'; export type ErrorSeverity = 'error' | 'warning'; + export interface SolcError { sourceLocation?: { file: string; -- cgit v1.2.3 From 91de15d50e77db615da900ffa7aba6d32f40a28e Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 18:46:11 -0400 Subject: remove stale comments --- packages/sol-doc/src/solidity_doc_generator.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 6b561d8a6..8093020b9 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -115,21 +115,17 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection { } function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { - const { parameters, methodSignature } = _genMethodParamsDoc( - '', // TODO: update depending on how constructors are keyed in devdoc - abiDefinition.inputs, - devdocIfExists, - ); + const { parameters, methodSignature } = _genMethodParamsDoc('', abiDefinition.inputs, devdocIfExists); const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); const constructorDoc: SolidityMethod = { isConstructor: true, name: '', // sad we have to specify this - callPath: '', // TODO: wtf is this? + callPath: '', parameters, returnType: { name: '', typeDocType: TypeDocTypes.Intrinsic }, // sad we have to specify this - isConstant: false, // constructors are non-const by their nature, right? + isConstant: false, isPayable: abiDefinition.payable, comment, }; @@ -181,12 +177,11 @@ function _genMethodDoc( : devdocIfExists.methods[methodSignature].return; const isConstant = abiDefinition.type === 'fallback' ? true : abiDefinition.constant; - // TODO: determine whether fallback functions are always constant, as coded just above const methodDoc: SolidityMethod = { isConstructor: false, name, - callPath: '', // TODO: wtf is this? + callPath: '', parameters, returnType, returnComment, -- cgit v1.2.3 From 4bab402e95fd2242ad3a472e2b5076c5026da50a Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 19:02:48 -0400 Subject: doc constructors as returning a Reference... ...not an Intrinsic --- packages/sol-doc/src/solidity_doc_generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 8093020b9..6c67f921d 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -124,7 +124,7 @@ function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: Devdo name: '', // sad we have to specify this callPath: '', parameters, - returnType: { name: '', typeDocType: TypeDocTypes.Intrinsic }, // sad we have to specify this + returnType: { name: '', typeDocType: TypeDocTypes.Reference }, // sad we have to specify this isConstant: false, isPayable: abiDefinition.payable, comment, -- cgit v1.2.3 From 30622631ff588b4b87a05e4ce3ca2906ed1edf9f Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 17 Sep 2018 19:03:44 -0400 Subject: use Array.join rather than string concatenation --- packages/sol-doc/src/solidity_doc_generator.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 6c67f921d..78c56e7fa 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -231,8 +231,6 @@ function _genMethodParamsDoc( devdocIfExists: DevdocOutput | undefined, ): { parameters: Parameter[]; methodSignature: string } { const parameters: Parameter[] = []; - let methodSignature = `${name}(`; - for (const abiParam of abiParams) { const parameter: Parameter = { name: abiParam.name, @@ -241,13 +239,13 @@ function _genMethodParamsDoc( type: { name: abiParam.type, typeDocType: TypeDocTypes.Intrinsic }, }; parameters.push(parameter); - methodSignature = `${methodSignature}${abiParam.type},`; } - if (methodSignature.slice(-1) === ',') { - methodSignature = methodSignature.slice(0, -1); - } - methodSignature += ')'; + const methodSignature = `${name}(${abiParams + .map(abiParam => { + return abiParam.type; + }) + .join(',')})`; if (!_.isUndefined(devdocIfExists)) { const devdocMethodIfExists = devdocIfExists.methods[methodSignature]; -- cgit v1.2.3 From ecbdf5f12bc9a1e654241f2051f152a1d5fea5bc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 12 Sep 2018 11:02:14 +0200 Subject: Upgrade to TS version of ethers --- package.json | 3 --- packages/0x.js/package.json | 2 +- packages/base-contract/package.json | 2 +- packages/contract-wrappers/package.json | 2 +- packages/contracts/package.json | 2 +- packages/fill-scenarios/package.json | 2 +- packages/metacoin/package.json | 2 +- packages/migrations/package.json | 2 +- packages/order-utils/package.json | 2 +- packages/order-watcher/package.json | 2 +- packages/utils/package.json | 2 +- packages/web3-wrapper/package.json | 2 +- yarn.lock | 27 +++++++++++++++++++++++---- 13 files changed, 34 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 04ca89fd1..61223aa78 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,5 @@ "source-map-support": "^0.5.6", "typescript": "3.0.1", "wsrun": "^2.2.0" - }, - "resolutions": { - "ethers": "0xproject/ethers.js#eip-838-reasons" } } diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index bf929a835..6de57f210 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -84,7 +84,7 @@ "@0xproject/utils": "^1.0.8", "@0xproject/web3-wrapper": "^2.0.2", "ethereum-types": "^1.0.6", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5", "web3-provider-engine": "14.0.6" }, diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 6542f48df..4f7f571cc 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -44,7 +44,7 @@ "@0xproject/utils": "^1.0.8", "@0xproject/web3-wrapper": "^2.0.2", "ethereum-types": "^1.0.6", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index ece5c9649..0d830f6c2 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -84,7 +84,7 @@ "ethereum-types": "^1.0.6", "ethereumjs-blockstream": "5.0.0", "ethereumjs-util": "^5.1.1", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "js-sha3": "^0.7.0", "lodash": "^4.17.5", "uuid": "^3.1.0" diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 1c912d3a7..628e74a78 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -83,7 +83,7 @@ "ethereum-types": "^1.0.6", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "js-combinatorics": "^0.5.3", "lodash": "^4.17.5" } diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 4592ca091..5598b2b5f 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -44,7 +44,7 @@ "@0xproject/utils": "^1.0.8", "@0xproject/web3-wrapper": "^2.0.2", "ethereum-types": "^1.0.6", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 9246c1961..433995686 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -40,7 +40,7 @@ "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", "ethereum-types": "^1.0.6", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5", "run-s": "^0.0.0" }, diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 5938ac224..a669b3fef 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -53,7 +53,7 @@ "@0xproject/web3-wrapper": "^2.0.2", "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^1.0.6", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "optionalDependencies": { diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index b3f93ff2e..a114c1751 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -69,7 +69,7 @@ "ethereum-types": "^1.0.6", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index a07e0f795..07040a421 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -83,7 +83,7 @@ "bintrees": "^1.0.2", "ethereum-types": "^1.0.6", "ethereumjs-blockstream": "5.0.0", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 831b6c819..c9e8fba83 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -49,7 +49,7 @@ "detect-node": "2.0.3", "ethereum-types": "^1.0.6", "ethereumjs-util": "^5.1.1", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "isomorphic-fetch": "^2.2.1", "js-sha3": "^0.7.0", "lodash": "^4.17.5" diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 05ea4da17..cad814d8d 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -59,7 +59,7 @@ "@0xproject/utils": "^1.0.8", "ethereum-types": "^1.0.6", "ethereumjs-util": "^5.1.1", - "ethers": "3.0.22", + "ethers": "^4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/yarn.lock b/yarn.lock index aa30946a8..16648eb79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1071,6 +1071,10 @@ version "9.6.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.0.tgz#d3480ee666df9784b1001a1872a2f6ccefb6c2d7" +"@types/node@^10.3.2": + version "10.9.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.4.tgz#0f4cb2dc7c1de6096055357f70179043c33e9897" + "@types/node@^10.5.3": version "10.5.7" resolved "https://registry.npmjs.org/@types/node/-/node-10.5.7.tgz#960d9feb3ade2233bcc9843c918d740b4f78a7cf" @@ -5296,9 +5300,9 @@ ethereumjs-wallet@~0.6.0: utf8 "^3.0.0" uuid "^3.3.2" -ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: - version "3.0.18" - resolved "https://codeload.github.com/0xproject/ethers.js/tar.gz/b91342bd200d142af0165d6befddf783c8ae8447" +ethers@3.0.22: + version "3.0.22" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-3.0.22.tgz#7fab1ea16521705837aa43c15831877b2716b436" dependencies: aes-js "3.0.0" bn.js "^4.4.0" @@ -5311,6 +5315,21 @@ ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: uuid "2.0.1" xmlhttprequest "1.8.0" +ethers@^4.0.0-beta.14: + version "4.0.0-beta.14" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.0-beta.14.tgz#76aa9257b9c93a7604ff4dc11f2a445d07f6459d" + dependencies: + "@types/node" "^10.3.2" + aes-js "3.0.0" + bn.js "^4.4.0" + elliptic "6.3.3" + hash.js "1.1.3" + js-sha3 "0.5.7" + scrypt-js "2.0.3" + setimmediate "1.0.4" + uuid "2.0.1" + xmlhttprequest "1.8.0" + ethjs-abi@0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/ethjs-abi/-/ethjs-abi-0.1.8.tgz#cd288583ed628cdfadaf8adefa3ba1dbcbca6c18" @@ -6710,7 +6729,7 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" -hash.js@^1.0.0, hash.js@^1.0.3: +hash.js@1.1.3, hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.3" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" dependencies: -- cgit v1.2.3 From 7b259c3f4c09ea2d8bfe688238f046fa8c62ec03 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Sep 2018 13:40:37 +0200 Subject: Remove types for ethers.js --- packages/typescript-typings/CHANGELOG.json | 9 ++++ .../typescript-typings/types/ethers/index.d.ts | 55 ---------------------- 2 files changed, 9 insertions(+), 55 deletions(-) delete mode 100644 packages/typescript-typings/types/ethers/index.d.ts diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index cef518859..c5aa11d77 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.0.0", + "changes": [ + { + "note": "Remove types for ethers.js", + "pr": "1069" + } + ] + }, { "version": "2.0.0", "changes": [ diff --git a/packages/typescript-typings/types/ethers/index.d.ts b/packages/typescript-typings/types/ethers/index.d.ts deleted file mode 100644 index 875563ba2..000000000 --- a/packages/typescript-typings/types/ethers/index.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -declare module 'ethers' { - import { TxData } from 'ethereum-types'; - - export interface TransactionDescription { - name: string; - signature: string; - sighash: string; - data: string; - } - export interface CallDescription extends TransactionDescription { - parse: (...args: any[]) => any; - } - export interface FunctionDescription { - (...params: any[]): TransactionDescription | CallDescription; - inputs: { names: string[]; types: string[] }; - outputs: { names: string[]; types: string[] }; - type: string; - } - export interface EventDescription { - parse: (...args: any[]) => any; - inputs: { names: string[]; types: string[] }; - signature: string; - topics: string[]; - } - export class Interface { - public functions: { [functionName: string]: FunctionDescription }; - public events: { [eventName: string]: EventDescription }; - constructor(abi: any); - } - export class Contract { - public static getDeployTransaction(bytecode: string, abi: any, ...args: any[]): Partial; - constructor(address: string, abi: any, provider: any); - } - const enum errors { - INVALID_ARGUMENT = 'INVALID_ARGUMENT', - } - - export type ParamName = null | string | NestedParamName; - - export interface NestedParamName { - name: string | null; - names: ParamName[]; - } - - export const utils: { - AbiCoder: { - defaultCoder: AbiCoder; - }; - }; - - export interface AbiCoder { - encode: (names: ParamName[] | string[], types: string[] | any[], args: any[] | undefined) => string; - decode: (names: ParamName[] | string[], types: string[] | string, data: string | undefined) => any; - } -} -- cgit v1.2.3 From 6701ec68bdbda91e63ab199510469e3e6a421b57 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Sep 2018 13:45:27 +0200 Subject: Upgrade contract_templates to work with ethers 4.0 --- packages/contract_templates/contract.handlebars | 6 ++++-- packages/contract_templates/partials/callAsync.handlebars | 8 +++----- packages/contract_templates/partials/tx.handlebars | 12 +++--------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 466893aa7..5c5f8c808 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -65,10 +65,12 @@ export class {{contractName}}Contract extends BaseContract { [{{> params inputs=ctor.inputs}}], BaseContract._bigNumberToString, ); - const txData = ethers.Contract.getDeployTransaction(bytecode, abi, {{> params inputs=ctor.inputs}}); + const iface = new ethers.Interface(abi); + let deployInfo = iface.deployFunction; + const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - txData, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 94752691d..dd1b90212 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -8,10 +8,8 @@ async callAsync( const inputAbi = self._lookupAbi(functionSignature).inputs; [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}( - {{> params inputs=inputs}} - ) as ethers.CallDescription; - const encodedData = ethersFunction.data; + const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}; + const encodedData = ethersFunction.encode([{{> params inputs=inputs}}]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -21,7 +19,7 @@ async callAsync( self._web3Wrapper.getContractDefaults(), ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - let resultArray = ethersFunction.parse(rawCallResult); + let resultArray = ethersFunction.decode(rawCallResult); const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars index 4340d662e..b39156583 100644 --- a/packages/contract_templates/partials/tx.handlebars +++ b/packages/contract_templates/partials/tx.handlebars @@ -12,9 +12,7 @@ public {{this.tsName}} = { const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( - {{> params inputs=inputs}} - ).data; + const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -37,9 +35,7 @@ public {{this.tsName}} = { const self = this as any as {{contractName}}Contract; const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( - {{> params inputs=inputs}} - ).data; + const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -57,9 +53,7 @@ public {{this.tsName}} = { const self = this as any as {{contractName}}Contract; const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( - {{> params inputs=inputs}} - ).data; + const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); return abiEncodedTransactionData; }, {{> callAsync}} -- cgit v1.2.3 From 5b6c91bb3f0b5a1d0586b7e772ad96f3eab1f911 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Sep 2018 14:04:13 +0200 Subject: Fixes for the breaking changes in ethers --- packages/base-contract/src/index.ts | 6 +++--- packages/utils/src/abi_decoder.ts | 4 ++-- packages/utils/src/abi_utils.ts | 14 ++++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 12f974445..35c830a46 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -87,10 +87,10 @@ export class BaseContract { // if it overflows the corresponding Solidity type, there is a bug in the // encoder, or the encoder performs unsafe type coercion. public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void { - const coder = ethers.utils.AbiCoder.defaultCoder; + const coder = new ethers.AbiCoder(); const params = abiUtils.parseEthersParams(inputAbi); - const rawEncoded = coder.encode(params.names, params.types, args); - const rawDecoded = coder.decode(params.names, params.types, rawEncoded); + const rawEncoded = coder.encode(inputAbi, args); + const rawDecoded = coder.decode(inputAbi, rawEncoded); for (let i = 0; i < rawDecoded.length; i++) { const original = args[i]; const decoded = rawDecoded[i]; diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 265eb105e..ea8c91d10 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -47,7 +47,7 @@ export class AbiDecoder { let decodedData: any[]; try { - decodedData = ethersInterface.events[event.name].parse(log.data); + decodedData = ethersInterface.events[event.name].decode(log.data); } catch (error) { if (error.code === ethers.errors.INVALID_ARGUMENT) { // Because we index events by Method ID, and Method IDs are derived from the method @@ -99,7 +99,7 @@ export class AbiDecoder { const ethersInterface = new ethers.Interface(abiArray); _.map(abiArray, (abi: AbiDefinition) => { if (abi.type === AbiType.Event) { - const topic = ethersInterface.events[abi.name].topics[0]; + const topic = ethersInterface.events[abi.name].topic; const numIndexedArgs = _.reduce(abi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0); this._methodIds[topic] = { ...this._methodIds[topic], diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts index c9b70966c..b5ab28ba2 100644 --- a/packages/utils/src/abi_utils.ts +++ b/packages/utils/src/abi_utils.ts @@ -4,11 +4,17 @@ import * as _ from 'lodash'; import { BigNumber } from './configured_bignumber'; +type ParamName = null | string | NestedParamName; +interface NestedParamName { + name: string | null; + names: ParamName[]; +} + // Note(albrow): This function is unexported in ethers.js. Copying it here for // now. // Source: https://github.com/ethers-io/ethers.js/blob/884593ab76004a808bf8097e9753fb5f8dcc3067/contracts/interface.js#L30 -function parseEthersParams(params: DataItem[]): { names: ethers.ParamName[]; types: string[] } { - const names: ethers.ParamName[] = []; +function parseEthersParams(params: DataItem[]): { names: ParamName[]; types: string[] } { + const names: ParamName[] = []; const types: string[] = []; params.forEach((param: DataItem) => { @@ -37,7 +43,7 @@ function parseEthersParams(params: DataItem[]): { names: ethers.ParamName[]; typ // returns true if x is equal to y and false otherwise. Performs some minimal // type conversion and data massaging for x and y, depending on type. name and // type should typically be derived from parseEthersParams. -function isAbiDataEqual(name: ethers.ParamName, type: string, x: any, y: any): boolean { +function isAbiDataEqual(name: ParamName, type: string, x: any, y: any): boolean { if (_.isUndefined(x) && _.isUndefined(y)) { return true; } else if (_.isUndefined(x) && !_.isUndefined(y)) { @@ -89,7 +95,7 @@ function isAbiDataEqual(name: ethers.ParamName, type: string, x: any, y: any): b // const nestedName = _.isString(name.names[i]) ? (name.names[i] as string) - : ((name.names[i] as ethers.NestedParamName).name as string); + : ((name.names[i] as NestedParamName).name as string); if (!isAbiDataEqual(name.names[i], types[i], x[nestedName], y[nestedName])) { return false; } -- cgit v1.2.3 From 3167bfde1a426e567de1b2f9809062217bb19b6b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 11:47:30 +0200 Subject: Remove unused import --- packages/utils/src/abi_utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts index b5ab28ba2..598ea5fcc 100644 --- a/packages/utils/src/abi_utils.ts +++ b/packages/utils/src/abi_utils.ts @@ -1,5 +1,4 @@ import { AbiDefinition, AbiType, ContractAbi, DataItem, MethodAbi } from 'ethereum-types'; -import * as ethers from 'ethers'; import * as _ from 'lodash'; import { BigNumber } from './configured_bignumber'; -- cgit v1.2.3 From 79cf6969f9fb4eedb48d790449663780d1516a43 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 11:48:06 +0200 Subject: Fix linter issue --- packages/contract_templates/contract.handlebars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 5c5f8c808..9ae39f44f 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -66,7 +66,7 @@ export class {{contractName}}Contract extends BaseContract { BaseContract._bigNumberToString, ); const iface = new ethers.Interface(abi); - let deployInfo = iface.deployFunction; + const deployInfo = iface.deployFunction; const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( -- cgit v1.2.3 From 393f9e5a293511ede662907861cf72e4f8add098 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 12:05:13 +0200 Subject: Fix the way we detect BN's --- packages/base-contract/CHANGELOG.json | 8 ++++++++ packages/base-contract/src/index.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 89580ca90..296a4a06c 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "3.0.0", + "changes": [ + { + "note": "Change the way we detect BN to work with the newest ethers.js" + } + ] + }, { "timestamp": 1536142250, "version": "2.0.2", diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 35c830a46..90e576c24 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -61,7 +61,7 @@ export class BaseContract { } } protected static _bnToBigNumber(_type: string, value: any): any { - return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value; + return _.isObject(value) && value._hex ? new BigNumber(value.toString()) : value; } protected static async _applyDefaultsToTxDataAsync>( txData: T, -- cgit v1.2.3 From f3deabccf4e6caec57351a09f82b3f786122b5ea Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 21 Sep 2018 12:10:25 +0200 Subject: Add CHANGELOG entries --- packages/base-contract/CHANGELOG.json | 3 ++- packages/utils/CHANGELOG.json | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 296a4a06c..a15b02061 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -3,7 +3,8 @@ "version": "3.0.0", "changes": [ { - "note": "Change the way we detect BN to work with the newest ethers.js" + "note": "Change the way we detect BN to work with the newest ethers.js", + "pr": 1069 } ] }, diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index c1b7db100..1a868d676 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.0.0", + "changes": [ + { + "note": "Make abi_decoder compatible with ethers ^4.0.0", + "pr": 1069 + } + ] + }, { "timestamp": 1536142250, "version": "1.0.8", -- cgit v1.2.3 From e6840c60c7a1528accb3aeb9c3aa4e94ff652dc3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 21 Sep 2018 13:43:06 +0100 Subject: Add assertion that one cannot specify both blockHash & fromBlock/toBlock to getLogsAsync --- packages/web3-wrapper/src/web3_wrapper.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index af0fe3a72..e6944d4bb 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -438,6 +438,10 @@ export class Web3Wrapper { * @returns The corresponding log entries */ public async getLogsAsync(filter: FilterObject): Promise { + if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) { + throw new Error(`Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`); + } + let fromBlock = filter.fromBlock; if (_.isNumber(fromBlock)) { fromBlock = utils.numberToHex(fromBlock); -- cgit v1.2.3 From 1b799e98e8505ff0195944b9987a938b9645b665 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 21 Sep 2018 13:45:06 +0100 Subject: Add blockHash to FilterObject now that EIP234 is supported --- packages/ethereum-types/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index 8f8f4b7e6..a3ff2fddb 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -181,6 +181,7 @@ export interface CallData extends CallTxDataBase { export interface FilterObject { fromBlock?: number | string; toBlock?: number | string; + blockHash?: string; address?: string; topics?: LogTopic[]; } -- cgit v1.2.3 From b0484eafe3ca6c66f3c5109721ced7b199f11823 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 21 Sep 2018 13:46:10 +0100 Subject: Upgrade blockstream to version that supports fetching logs by blockHash, fixing reliability issues --- packages/contract-wrappers/package.json | 2 +- packages/order-watcher/package.json | 2 +- yarn.lock | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index ece5c9649..4ec93928c 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -82,7 +82,7 @@ "@0xproject/utils": "^1.0.8", "@0xproject/web3-wrapper": "^2.0.2", "ethereum-types": "^1.0.6", - "ethereumjs-blockstream": "5.0.0", + "ethereumjs-blockstream": "6.0.0", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "js-sha3": "^0.7.0", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index a07e0f795..bc86a651f 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -82,7 +82,7 @@ "@0xproject/web3-wrapper": "^2.0.2", "bintrees": "^1.0.2", "ethereum-types": "^1.0.6", - "ethereumjs-blockstream": "5.0.0", + "ethereumjs-blockstream": "6.0.0", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/yarn.lock b/yarn.lock index aa30946a8..950b39fd8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5203,6 +5203,14 @@ ethereumjs-blockstream@5.0.0: source-map-support "0.5.6" uuid "3.2.1" +ethereumjs-blockstream@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-6.0.0.tgz#79d726d1f358935eb65195e91d40344c31e87eff" + dependencies: + immutable "3.8.2" + source-map-support "0.5.6" + uuid "3.2.1" + ethereumjs-tx@0xProject/ethereumjs-tx#fake-tx-include-signature-by-default: version "1.3.4" resolved "https://codeload.github.com/0xProject/ethereumjs-tx/tar.gz/29d1153889c389591f74b2401da8a0c6ad40f9a7" @@ -6053,7 +6061,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "~0.6.0" + ethereumjs-wallet "0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" -- cgit v1.2.3 From 31f6fc065f743efd0c6961ed2d71ae1ad04e3289 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 21 Sep 2018 14:24:50 +0100 Subject: Add changelog entries --- packages/contract-wrappers/CHANGELOG.json | 8 ++++++++ packages/order-watcher/CHANGELOG.json | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index a9e631157..0d941d756 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "2.0.0", + "changes": [ + { + "note": "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." + } + ] + }, { "version": "1.0.3", "changes": [ diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 8d8aaf702..a85fddf7d 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "2.0.0", + "changes": [ + { + "note": "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." + } + ] + }, { "version": "1.0.3", "changes": [ -- cgit v1.2.3 From 45dc2be0832eefbf6f009b07abb7b7a435b19279 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 21 Sep 2018 14:53:25 +0100 Subject: Fix prettier --- packages/contract-wrappers/CHANGELOG.json | 3 ++- packages/order-watcher/CHANGELOG.json | 3 ++- packages/web3-wrapper/src/web3_wrapper.ts | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 0d941d756..a8572e968 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -3,7 +3,8 @@ "version": "2.0.0", "changes": [ { - "note": "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." + "note": + "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." } ] }, diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index a85fddf7d..d6be772e2 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -3,7 +3,8 @@ "version": "2.0.0", "changes": [ { - "note": "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." + "note": + "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." } ] }, diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index e6944d4bb..3764b4593 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -439,7 +439,9 @@ export class Web3Wrapper { */ public async getLogsAsync(filter: FilterObject): Promise { if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) { - throw new Error(`Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`); + throw new Error( + `Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`, + ); } let fromBlock = filter.fromBlock; -- cgit v1.2.3 From 3e5d427d4e873080f2a369db7f844cbadd610fcb Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Fri, 21 Sep 2018 10:56:17 -0400 Subject: feat: add sol-doc command-line interface modified sol-compiler to output progress/warning/error/etc messages to stderr rather than stdout, so that sol-doc can put its output (and nothing else) to stdout. for posterity, added sol-doc cli usage as npm scripts to package.json. --- packages/sol-compiler/src/compiler.ts | 14 ++++++++------ packages/sol-compiler/src/utils/compiler.ts | 4 ++-- packages/sol-doc/package.json | 10 ++++++++-- packages/sol-doc/src/cli.ts | 26 ++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 packages/sol-doc/src/cli.ts diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts index 3b0bd90f9..a29367485 100644 --- a/packages/sol-compiler/src/compiler.ts +++ b/packages/sol-compiler/src/compiler.ts @@ -94,7 +94,7 @@ export class Compiler { if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) { solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString(); } else { - logUtils.log(`Downloading ${fullSolcVersion}...`); + logUtils.warn(`Downloading ${fullSolcVersion}...`); const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`; const response = await fetchAsync(url); const SUCCESS_STATUS = 200; @@ -181,7 +181,9 @@ export class Compiler { path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION), ); } else { - contractNamesToCompile = this._specifiedContracts; + contractNamesToCompile = this._specifiedContracts.map(specifiedContract => + path.basename(specifiedContract, constants.SOLIDITY_FILE_EXTENSION), + ); } return contractNamesToCompile; } @@ -236,7 +238,7 @@ export class Compiler { const solcVersions = _.keys(versionToInputs); for (const solcVersion of solcVersions) { const input = versionToInputs[solcVersion]; - logUtils.log( + logUtils.warn( `Compiling ${input.contractsToCompile.length} contracts (${ input.contractsToCompile }) with Solidity v${solcVersion}...`, @@ -329,7 +331,7 @@ export class Compiler { const artifactString = utils.stringifyWithFormatting(newArtifact); const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`; await fsWrapper.writeFileAsync(currentArtifactPath, artifactString); - logUtils.log(`${contractName} artifact saved!`); + logUtils.warn(`${contractName} artifact saved!`); } private _compile(solcInstance: solc.SolcInstance, standardInput: solc.StandardInput): solc.StandardOutput { const compiled: solc.StandardOutput = JSON.parse( @@ -345,13 +347,13 @@ export class Compiler { if (!_.isEmpty(errors)) { errors.forEach(error => { const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message); - logUtils.log(chalk.red(normalizedErrMsg)); + logUtils.warn(chalk.red(normalizedErrMsg)); }); throw new Error('Compilation errors encountered'); } else { warnings.forEach(warning => { const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message); - logUtils.log(chalk.yellow(normalizedWarningMsg)); + logUtils.warn(chalk.yellow(normalizedWarningMsg)); }); } } diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts index c918ed1f3..c153beb0f 100644 --- a/packages/sol-compiler/src/utils/compiler.ts +++ b/packages/sol-compiler/src/utils/compiler.ts @@ -26,7 +26,7 @@ export async function getContractArtifactIfExistsAsync( contractArtifact = JSON.parse(contractArtifactString); return contractArtifact; } catch (err) { - logUtils.log(`Artifact for ${contractName} does not exist`); + logUtils.warn(`Artifact for ${contractName} does not exist`); return undefined; } } @@ -37,7 +37,7 @@ export async function getContractArtifactIfExistsAsync( */ export async function createDirIfDoesNotExistAsync(dirPath: string): Promise { if (!fsWrapper.doesPathExistSync(dirPath)) { - logUtils.log(`Creating directory at ${dirPath}...`); + logUtils.warn(`Creating directory at ${dirPath}...`); await fsWrapper.mkdirpAsync(dirPath); } } diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index e3bc8753c..500b1cbde 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -11,7 +11,12 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "lint": "tslint --project . --format stylish", - "clean": "shx rm -rf lib" + "clean": "shx rm -rf lib", + "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", + "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/" + }, + "bin": { + "sol-doc": "bin/sol-doc.js" }, "repository": "https://github.com/0xProject/0x-monorepo.git", "author": "F. Eugene Aumson", @@ -21,7 +26,8 @@ "@0xproject/types": "^1.0.1-rc.6", "@0xproject/utils": "^1.0.5", "ethereum-types": "^1.0.4", - "lodash": "^4.17.10" + "lodash": "^4.17.10", + "yargs": "^12.0.2" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.6", diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts new file mode 100644 index 000000000..59fc185de --- /dev/null +++ b/packages/sol-doc/src/cli.ts @@ -0,0 +1,26 @@ +import 'source-map-support/register'; +import * as yargs from 'yargs'; + +import { generateSolDocAsync } from './solidity_doc_generator'; + +const JSON_TABWIDTH = 4; + +(async () => { + const argv = yargs + .option('contracts-dir', { + type: 'string', + description: 'path of contracts directory to compile', + }) + .option('contracts', { + type: 'string', + description: 'comma separated list of contracts to compile', + }) + .demandOption('contracts-dir') + .array('contracts') + .help().argv; + process.stdout.write( + JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TABWIDTH), + ); +})().catch(err => { + throw err; +}); -- cgit v1.2.3 From 37cb18e1daa8bf33b92b94b93851e91d50383c1e Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Sat, 22 Sep 2018 10:21:27 -0400 Subject: fix: rename variable --- packages/sol-doc/src/solidity_doc_generator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 78c56e7fa..2586cf91c 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -26,17 +26,17 @@ import { /** * Invoke the Solidity compiler and transform its ABI and devdoc outputs into * the types that are used as input to documentation generation tools. - * @param contractsToCompile list of contracts for which to generate doc objects + * @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, - contractsToCompile?: string[], + contractsToDocument?: string[], ): Promise { const doc: DocAgnosticFormat = {}; - const compilerOptions = _makeCompilerOptions(contractsDir, contractsToCompile); + const compilerOptions = _makeCompilerOptions(contractsDir, contractsToDocument); const compiler = new Compiler(compilerOptions); const compilerOutputs = await compiler.getCompilerOutputsAsync(); for (const compilerOutput of compilerOutputs) { -- cgit v1.2.3 From 9f0dfb1e1a4c97e462cf298e0452be1d0fcf2216 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Sat, 22 Sep 2018 10:31:47 -0400 Subject: feat: make sol-doc only document what's requested if a list of contracts-to-document is passed into sol-doc, then the output should only contain documentation for the contracts requested. if an empty/undefined list is passed, then it should document all contracts that were found. --- packages/sol-doc/src/solidity_doc_generator.ts | 21 ++++++++++++++--- .../sol-doc/test/solidity_doc_generator_test.ts | 26 +++++++++------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 2586cf91c..074fb1f37 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -1,3 +1,5 @@ +import * as path from 'path'; + import * as _ from 'lodash'; import { @@ -34,8 +36,7 @@ export async function generateSolDocAsync( contractsDir: string, contractsToDocument?: string[], ): Promise { - const doc: DocAgnosticFormat = {}; - + const docWithDependencies: DocAgnosticFormat = {}; const compilerOptions = _makeCompilerOptions(contractsDir, contractsToDocument); const compiler = new Compiler(compilerOptions); const compilerOutputs = await compiler.getCompilerOutputsAsync(); @@ -50,11 +51,25 @@ export async function generateSolDocAsync( if (_.isUndefined(compiledContract.abi)) { throw new Error('compiled contract did not contain ABI output'); } - doc[contractName] = _genDocSection(compiledContract); + docWithDependencies[contractName] = _genDocSection(compiledContract); } } } + 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; } diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 5004b1a90..0cbb786af 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -24,14 +24,13 @@ describe('#SolidityDocGenerator', () => { const docPromises: Array> = [ generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`), generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, []), - generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['TokenTransferProxy']), ]; docPromises.forEach(docPromise => { - it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { + it('should generate a doc object that matches the TokenTransferProxy fixture with its dependencies', async () => { const doc = await docPromise; expect(doc).to.not.be.undefined(); - verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxy'); + verifyTokenTransferProxyAndDepsABIsAreDocumented(doc, 'TokenTransferProxy'); let addAuthorizedAddressMethod: SolidityMethod | undefined; for (const method of doc.TokenTransferProxy.methods) { @@ -48,6 +47,12 @@ describe('#SolidityDocGenerator', () => { expect((addAuthorizedAddressMethod as SolidityMethod).parameters[0].comment).to.equal(expectedParamComment); }); }); + it('should generate a doc object that matches the TokenTransferProxy fixture', async () => { + const doc: DocAgnosticFormat = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [ + 'TokenTransferProxy', + ]); + verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxy'); + }); describe('when processing all the permutations of devdoc stuff that we use in our contracts', () => { let doc: DocAgnosticFormat; before(async () => { @@ -188,19 +193,10 @@ function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contrac throw new Error('events should never be undefined'); } expect(events.length).to.equal(tokenTransferProxyEventCount); +} - expect(doc.Ownable).to.not.be.undefined(); - expect(doc.Ownable.constructors).to.not.be.undefined(); - expect(doc.Ownable.methods).to.not.be.undefined(); - const ownableConstructorCount = 1; - const ownableMethodCount = 2; - const ownableEventCount = 1; - expect(doc.Ownable.constructors.length).to.equal(ownableConstructorCount); - expect(doc.Ownable.methods.length).to.equal(ownableMethodCount); - if (_.isUndefined(doc.Ownable.events)) { - throw new Error('events should never be undefined'); - } - expect(doc.Ownable.events.length).to.equal(ownableEventCount); +function verifyTokenTransferProxyAndDepsABIsAreDocumented(doc: DocAgnosticFormat, contractName: string): void { + verifyTokenTransferProxyABIIsDocumented(doc, contractName); expect(doc.ERC20).to.not.be.undefined(); expect(doc.ERC20.constructors).to.not.be.undefined(); -- cgit v1.2.3 From 98d06d6d252ed379d60bcef915caf38a5ec7a5af Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Sat, 22 Sep 2018 11:06:48 -0400 Subject: BREAKING CHANGE: document contracts from sol-doc Change website to accept smart contract documentation in the format generated by sol-doc rather than that generated by Doxity. --- packages/react-docs/README.md | 4 +- packages/react-docs/package.json | 2 +- .../react-docs/src/components/documentation.tsx | 2 +- packages/react-docs/src/docs_info.ts | 13 +- packages/react-docs/src/index.ts | 3 +- packages/react-docs/src/types.ts | 36 +---- packages/react-docs/src/utils/constants.ts | 2 +- packages/react-docs/src/utils/doxity_utils.ts | 173 --------------------- .../md/docs/smart_contracts/2.0.0/introduction.md | 8 + .../ts/containers/smart_contracts_documentation.ts | 11 +- .../website/ts/pages/documentation/doc_page.tsx | 26 +++- packages/website/ts/utils/doc_utils.ts | 4 +- 12 files changed, 48 insertions(+), 236 deletions(-) delete mode 100644 packages/react-docs/src/utils/doxity_utils.ts create mode 100644 packages/website/md/docs/smart_contracts/2.0.0/introduction.md diff --git a/packages/react-docs/README.md b/packages/react-docs/README.md index 5d56207de..51e949967 100644 --- a/packages/react-docs/README.md +++ b/packages/react-docs/README.md @@ -2,7 +2,7 @@ #### WARNING: Alpha software. Expect things to break when trying to use. -A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [Doxity](https://github.com/0xproject/doxity). +A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [sol-doc](https://github.com/0xProject/0x-monorepo/tree/development/packages/sol-doc).
@@ -47,7 +47,7 @@ Feel free to contribute to these improvements! * Allow user to pass in styling for all major elements similar to [Material-UI](http://www.material-ui.com/). * Allow user to define an alternative font and have it change everywhere. -* Add source links to Solidity docs (currently unsupported by Doxity). +* Add source links to Solidity docs (currently unsupported by solc, which underlies sol-doc). ## Contributing diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 53c5fbb3f..a3e368355 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -4,7 +4,7 @@ "engines": { "node": ">=6.12" }, - "description": "React documentation component for rendering TypeDoc & Doxity generated JSON", + "description": "React documentation component for rendering TypeDoc & sol-doc generated JSON", "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 16a99713c..0974297bc 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -329,7 +329,7 @@ export class Documentation extends React.Component{externalExports}
; } private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode { - if (this.props.docsInfo.type !== SupportedDocJson.Doxity) { + if (this.props.docsInfo.type !== SupportedDocJson.Solidity) { return null; } diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index fa5aa0da3..6355a2f88 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -1,18 +1,15 @@ import { MenuSubsectionsBySection } from '@0xproject/react-shared'; -import { DocAgnosticFormat, GeneratedDocJson, TypeDefinitionByName } from '@0xproject/types'; +import { DocAgnosticFormat, TypeDefinitionByName } from '@0xproject/types'; import * as _ from 'lodash'; import { ContractsByVersionByNetworkId, DocsInfoConfig, DocsMenu, - DoxityDocObj, SectionNameToMarkdownByVersion, SectionsMap, SupportedDocJson, } from './types'; -import { doxityUtils } from './utils/doxity_utils'; -import { TypeDocUtils } from './utils/typedoc_utils'; export class DocsInfo { public id: string; @@ -93,12 +90,4 @@ export class DocsInfo { const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any; return typeDefinitionByName; } - public convertToDocAgnosticFormat(docObj: DoxityDocObj | GeneratedDocJson): DocAgnosticFormat { - if (this.type === SupportedDocJson.Doxity) { - return doxityUtils.convertToDocAgnosticFormat(docObj as DoxityDocObj); - } else { - const typeDocUtils = new TypeDocUtils(docObj as GeneratedDocJson, this); - return typeDocUtils.convertToDocAgnosticFormat(); - } - } } diff --git a/packages/react-docs/src/index.ts b/packages/react-docs/src/index.ts index 8a2c215b8..f9382940c 100644 --- a/packages/react-docs/src/index.ts +++ b/packages/react-docs/src/index.ts @@ -14,9 +14,10 @@ export { Signature } from './components/signature'; export { SourceLink } from './components/source_link'; export { TypeDefinition } from './components/type_definition'; export { Type } from './components/type'; +export { TypeDocUtils } from './utils/typedoc_utils'; export { DocsInfo } from './docs_info'; -export { DocsInfoConfig, DoxityDocObj, DocsMenu, SupportedDocJson } from './types'; +export { DocsInfoConfig, DocsMenu, SupportedDocJson } from './types'; export { constants } from './utils/constants'; diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 454190342..f475c2756 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -38,7 +38,7 @@ export enum KindString { } export enum SupportedDocJson { - Doxity = 'DOXITY', + Solidity = 'SOLIDITY', TypeDoc = 'TYPEDOC', } @@ -50,40 +50,6 @@ export interface ContractsByVersionByNetworkId { }; } -export interface DoxityDocObj { - [contractName: string]: DoxityContractObj; -} - -export interface DoxityContractObj { - title: string; - fileName: string; - name: string; - abiDocs: DoxityAbiDoc[]; -} - -export interface DoxityAbiDoc { - constant: boolean; - inputs: DoxityInput[]; - name: string; - outputs: DoxityOutput[]; - payable: boolean; - type: string; - details?: string; - return?: string; -} - -export interface DoxityOutput { - name: string; - type: string; -} - -export interface DoxityInput { - name: string; - type: string; - description: string; - indexed?: boolean; -} - export interface AddressByContractName { [contractName: string]: string; } diff --git a/packages/react-docs/src/utils/constants.ts b/packages/react-docs/src/utils/constants.ts index 0b08f2c3e..35a939c51 100644 --- a/packages/react-docs/src/utils/constants.ts +++ b/packages/react-docs/src/utils/constants.ts @@ -4,7 +4,7 @@ export const constants = { TYPES_SECTION_NAME: 'types', EXTERNAL_EXPORTS_SECTION_NAME: 'external exports', TYPE_TO_SYNTAX: { - [SupportedDocJson.Doxity]: 'solidity', + [SupportedDocJson.Solidity]: 'solidity', [SupportedDocJson.TypeDoc]: 'typescript', } as { [supportedDocType: string]: string }, }; diff --git a/packages/react-docs/src/utils/doxity_utils.ts b/packages/react-docs/src/utils/doxity_utils.ts deleted file mode 100644 index 85794d4ba..000000000 --- a/packages/react-docs/src/utils/doxity_utils.ts +++ /dev/null @@ -1,173 +0,0 @@ -import * as _ from 'lodash'; - -import { - DocAgnosticFormat, - DocSection, - EventArg, - Parameter, - Property, - SolidityMethod, - Type, - TypeDocTypes, -} from '@0xproject/types'; - -import { AbiTypes, DoxityAbiDoc, DoxityContractObj, DoxityDocObj, DoxityInput } from '../types'; - -export const doxityUtils = { - convertToDocAgnosticFormat(doxityDocObj: DoxityDocObj): DocAgnosticFormat { - const docAgnosticFormat: DocAgnosticFormat = {}; - _.each(doxityDocObj, (doxityContractObj: DoxityContractObj, contractName: string) => { - const doxityConstructor = _.find(doxityContractObj.abiDocs, (abiDoc: DoxityAbiDoc) => { - return abiDoc.type === AbiTypes.Constructor; - }); - const constructors = []; - if (!_.isUndefined(doxityConstructor)) { - const constructor = { - isConstructor: true, - name: doxityContractObj.name, - comment: doxityConstructor.details, - returnComment: doxityConstructor.return, - callPath: '', - parameters: doxityUtils._convertParameters(doxityConstructor.inputs), - returnType: doxityUtils._convertType(doxityContractObj.name), - }; - constructors.push(constructor); - } - - const doxityMethods: DoxityAbiDoc[] = _.filter( - doxityContractObj.abiDocs, - (abiDoc: DoxityAbiDoc) => { - return doxityUtils._isMethod(abiDoc); - }, - ); - const methods: SolidityMethod[] = _.map( - doxityMethods, - (doxityMethod: DoxityAbiDoc) => { - const outputs = !_.isUndefined(doxityMethod.outputs) ? doxityMethod.outputs : []; - let returnTypeIfExists: Type; - if (outputs.length === 0) { - // no-op. It's already undefined - } else if (outputs.length === 1) { - const outputsType = outputs[0].type; - returnTypeIfExists = doxityUtils._convertType(outputsType); - } else { - const outputsType = `[${_.map(outputs, output => output.type).join(', ')}]`; - returnTypeIfExists = doxityUtils._convertType(outputsType); - } - // For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken - const callPath = - contractName !== 'ZRXToken' - ? `${contractName[0].toLowerCase()}${contractName.slice(1)}.` - : `${contractName.slice(0, 3).toLowerCase()}${contractName.slice(3)}.`; - const method = { - isConstructor: false, - isConstant: doxityMethod.constant, - isPayable: doxityMethod.payable, - name: doxityMethod.name, - comment: doxityMethod.details, - returnComment: doxityMethod.return, - callPath, - parameters: doxityUtils._convertParameters(doxityMethod.inputs), - returnType: returnTypeIfExists, - }; - return method; - }, - ); - - const doxityProperties: DoxityAbiDoc[] = _.filter( - doxityContractObj.abiDocs, - (abiDoc: DoxityAbiDoc) => { - return doxityUtils._isProperty(abiDoc); - }, - ); - const properties = _.map(doxityProperties, (doxityProperty: DoxityAbiDoc) => { - // We assume that none of our functions return more then a single return value - let typeName = doxityProperty.outputs[0].type; - if (!_.isEmpty(doxityProperty.inputs)) { - // Properties never have more then a single input - typeName = `(${doxityProperty.inputs[0].type} => ${typeName})`; - } - const property = { - name: doxityProperty.name, - type: doxityUtils._convertType(typeName), - comment: doxityProperty.details, - }; - return property; - }); - - const doxityEvents = _.filter( - doxityContractObj.abiDocs, - (abiDoc: DoxityAbiDoc) => abiDoc.type === AbiTypes.Event, - ); - const events = _.map(doxityEvents, doxityEvent => { - const event = { - name: doxityEvent.name, - eventArgs: doxityUtils._convertEventArgs(doxityEvent.inputs), - }; - return event; - }); - - const docSection: DocSection = { - comment: doxityContractObj.title, - constructors, - methods, - properties, - types: [], - functions: [], - events, - }; - docAgnosticFormat[contractName] = docSection; - }); - return docAgnosticFormat; - }, - _convertParameters(inputs: DoxityInput[]): Parameter[] { - const parameters = _.map(inputs, input => { - const parameter = { - name: input.name, - comment: input.description, - isOptional: false, - type: doxityUtils._convertType(input.type), - }; - return parameter; - }); - return parameters; - }, - _convertType(typeName: string): Type { - const type = { - name: typeName, - typeDocType: TypeDocTypes.Intrinsic, - }; - return type; - }, - _isMethod(abiDoc: DoxityAbiDoc): boolean { - if (abiDoc.type !== AbiTypes.Function) { - return false; - } - const hasInputs = !_.isEmpty(abiDoc.inputs); - const hasNamedOutputIfExists = !hasInputs || !_.isEmpty(abiDoc.inputs[0].name); - const isNameAllCaps = abiDoc.name === abiDoc.name.toUpperCase(); - const isMethod = hasNamedOutputIfExists && !isNameAllCaps; - return isMethod; - }, - _isProperty(abiDoc: DoxityAbiDoc): boolean { - if (abiDoc.type !== AbiTypes.Function) { - return false; - } - const hasInputs = !_.isEmpty(abiDoc.inputs); - const hasNamedOutputIfExists = !hasInputs || !_.isEmpty(abiDoc.inputs[0].name); - const isNameAllCaps = abiDoc.name === abiDoc.name.toUpperCase(); - const isProperty = !hasNamedOutputIfExists || isNameAllCaps; - return isProperty; - }, - _convertEventArgs(inputs: DoxityInput[]): EventArg[] { - const eventArgs = _.map(inputs, input => { - const eventArg = { - isIndexed: input.indexed, - name: input.name, - type: doxityUtils._convertType(input.type), - }; - return eventArg; - }); - return eventArgs; - }, -}; diff --git a/packages/website/md/docs/smart_contracts/2.0.0/introduction.md b/packages/website/md/docs/smart_contracts/2.0.0/introduction.md new file mode 100644 index 000000000..566a573b6 --- /dev/null +++ b/packages/website/md/docs/smart_contracts/2.0.0/introduction.md @@ -0,0 +1,8 @@ +Welcome to the [0x smart contracts](https://github.com/0xProject/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts. + +### Helpful wiki articles: + +* [Overview of 0x protocol architecture](https://0xproject.com/wiki#Architecture) +* [0x smart contract interactions](https://0xproject.com/wiki#Contract-Interactions) +* [Deployed smart contract addresses](https://0xproject.com/wiki#Deployed-Addresses) +* [0x protocol message format](https://0xproject.com/wiki#Message-Format) diff --git a/packages/website/ts/containers/smart_contracts_documentation.ts b/packages/website/ts/containers/smart_contracts_documentation.ts index 4f4479c83..1f333beac 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.ts +++ b/packages/website/ts/containers/smart_contracts_documentation.ts @@ -11,29 +11,28 @@ import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ const IntroMarkdownV1 = require('md/docs/smart_contracts/1.0.0/introduction'); +const IntroMarkdownV2 = require('md/docs/smart_contracts/2.0.0/introduction'); /* tslint:enable:no-var-requires */ const docsInfoConfig: DocsInfoConfig = { id: DocPackages.SmartContracts, packageName: 'contracts', - type: SupportedDocJson.Doxity, + type: SupportedDocJson.Solidity, displayName: '0x Smart Contracts', packageUrl: 'https://github.com/0xProject/contracts', markdownMenu: { introduction: [Sections.Introduction], - contracts: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy], }, sectionNameToMarkdownByVersion: { '0.0.1': { [Sections.Introduction]: IntroMarkdownV1, }, + '2.0.0': { + [Sections.Introduction]: IntroMarkdownV2, + }, }, markdownSections: { Introduction: Sections.Introduction, - Exchange: Sections.Exchange, - TokenTransferProxy: Sections.TokenTransferProxy, - TokenRegistry: Sections.TokenRegistry, - ZRXToken: Sections.ZRXToken, }, contractsByVersionByNetworkId: { '1.0.0': { diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 9c144b93f..7bf3addc0 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -1,4 +1,11 @@ -import { DocAgnosticFormat, DocsInfo, Documentation } from '@0xproject/react-docs'; +import { + DocAgnosticFormat, + DocsInfo, + Documentation, + GeneratedDocJson, + SupportedDocJson, + TypeDocUtils, +} from '@0xproject/react-docs'; import findVersions = require('find-versions'); import * as _ from 'lodash'; import * as React from 'react'; @@ -128,7 +135,22 @@ export class DocPage extends React.Component { const versionFilePathToFetch = versionToFilePath[versionToFetch]; const versionDocObj = await docUtils.getJSONDocFileAsync(versionFilePathToFetch, docBucketRoot); - const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj); + let docAgnosticFormat; + if (this.props.docsInfo.type === SupportedDocJson.TypeDoc) { + docAgnosticFormat = new TypeDocUtils( + versionDocObj as GeneratedDocJson, + this.props.docsInfo, + ).convertToDocAgnosticFormat(); + } else if (this.props.docsInfo.type === SupportedDocJson.Solidity) { + // documenting solidity. + docAgnosticFormat = versionDocObj as DocAgnosticFormat; + // need to modify docsInfo like convertToDocAgnosticFormat() would do + this.props.docsInfo.menu.Contracts = []; + _.each(docAgnosticFormat, (docObj, contractName) => { + this.props.docsInfo.sections[contractName] = contractName; + this.props.docsInfo.menu.Contracts.push(contractName); + }); + } if (!this._isUnmounted) { this.setState({ diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts index e313648bd..0e1d9ea6e 100644 --- a/packages/website/ts/utils/doc_utils.ts +++ b/packages/website/ts/utils/doc_utils.ts @@ -1,4 +1,4 @@ -import { DoxityDocObj, GeneratedDocJson } from '@0xproject/react-docs'; +import { DocAgnosticFormat, GeneratedDocJson } from '@0xproject/react-docs'; import { fetchAsync, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import { S3FileObject, VersionToFilePath } from 'ts/types'; @@ -70,7 +70,7 @@ export const docUtils = { }); return versionFilePaths; }, - async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise { + async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise { const endpoint = `${s3DocJsonRoot}/${filePath}`; const response = await fetchAsync(endpoint); if (response.status !== 200) { -- cgit v1.2.3 From 880cd6e440c76d819cdb04d2971375cf9e0ea97b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 10:21:12 -0400 Subject: fix: document return value's type, not its name --- packages/sol-doc/src/solidity_doc_generator.ts | 4 ++-- packages/sol-doc/test/solidity_doc_generator_test.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 074fb1f37..b2b5daff3 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -291,11 +291,11 @@ function _genMethodReturnTypeDoc( methodReturnTypeDoc.typeDocType = TypeDocTypes.Tuple; methodReturnTypeDoc.tupleElements = []; for (const output of outputs) { - methodReturnTypeDoc.tupleElements.push({ name: output.name, typeDocType: TypeDocTypes.Intrinsic }); + methodReturnTypeDoc.tupleElements.push({ name: output.type, typeDocType: TypeDocTypes.Intrinsic }); } } else if (outputs.length === 1) { methodReturnTypeDoc.typeDocType = TypeDocTypes.Intrinsic; - methodReturnTypeDoc.name = outputs[0].name; + methodReturnTypeDoc.name = outputs[0].type; } return methodReturnTypeDoc; } diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 0cbb786af..c780d3d31 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -86,8 +86,8 @@ describe('#SolidityDocGenerator', () => { it('parameter comment', () => { expect(methodDoc.parameters[0].comment).to.equal('publicMethod @param'); }); - it('return type name', () => { - expect(methodDoc.returnType.name).to.equal('r'); + it('return type', () => { + expect(methodDoc.returnType.name).to.equal('int256'); }); it('return comment', () => { expect(methodDoc.returnComment).to.equal('publicMethod @return'); @@ -116,8 +116,8 @@ describe('#SolidityDocGenerator', () => { it('parameter comment', () => { expect(methodDoc.parameters[0].comment).to.equal('externalMethod @param'); }); - it('return type name', () => { - expect(methodDoc.returnType.name).to.equal('r'); + it('return type', () => { + expect(methodDoc.returnType.name).to.equal('int256'); }); it('return comment', () => { expect(methodDoc.returnComment).to.equal('externalMethod @return'); -- cgit v1.2.3 From bd7565ceda1c54b51b601c0f6adf56161d7b6511 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 12:36:26 -0400 Subject: fix: save v1 contract doc/deploy commands For posterity, save commands needed to use sol-doc to generate and deploy documentation objects for v1 contracts. --- packages/sol-doc/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 500b1cbde..a3ded23f8 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -12,8 +12,10 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "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", - "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-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/" }, "bin": { "sol-doc": "bin/sol-doc.js" -- cgit v1.2.3 From a9002558207883f66e3bb180415985d823f03772 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 13:05:35 -0400 Subject: fix: document indexed event arguments --- packages/sol-doc/src/solidity_doc_generator.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index b2b5daff3..0df4a4af1 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -8,6 +8,7 @@ import { DataItem, DevdocOutput, EventAbi, + EventParameter, FallbackAbi, MethodAbi, StandardContractOutput, @@ -215,7 +216,7 @@ function _genEventDoc(abiDefinition: EventAbi): Event { return eventDoc; } -function _genEventArgsDoc(args: DataItem[], devdocIfExists: DevdocOutput | undefined): EventArg[] { +function _genEventArgsDoc(args: EventParameter[], devdocIfExists: DevdocOutput | undefined): EventArg[] { const eventArgsDoc: EventArg[] = []; for (const arg of args) { @@ -227,7 +228,7 @@ function _genEventArgsDoc(args: DataItem[], devdocIfExists: DevdocOutput | undef }; const eventArgDoc: EventArg = { - isIndexed: false, // TODO: wtf is this? + isIndexed: arg.indexed, name, type, }; -- cgit v1.2.3 From 57fca16d7b1dc61c060c90fa440b1dc947aefb93 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 13:18:10 -0400 Subject: fix: use contract name for constructor method name and for its return value --- packages/sol-doc/src/solidity_doc_generator.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 0df4a4af1..b0c9ff314 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -52,7 +52,7 @@ export async function generateSolDocAsync( if (_.isUndefined(compiledContract.abi)) { throw new Error('compiled contract did not contain ABI output'); } - docWithDependencies[contractName] = _genDocSection(compiledContract); + docWithDependencies[contractName] = _genDocSection(compiledContract, contractName); } } } @@ -95,7 +95,7 @@ function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[ return compilerOptions; } -function _genDocSection(compiledContract: StandardContractOutput): DocSection { +function _genDocSection(compiledContract: StandardContractOutput, contractName: string): DocSection { const docSection: DocSection = { comment: _.isUndefined(compiledContract.devdoc) ? '' : compiledContract.devdoc.title, constructors: [], @@ -109,7 +109,7 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection { for (const abiDefinition of compiledContract.abi) { switch (abiDefinition.type) { case 'constructor': - docSection.constructors.push(_genConstructorDoc(abiDefinition, compiledContract.devdoc)); + docSection.constructors.push(_genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc)); break; case 'event': (docSection.events as Event[]).push(_genEventDoc(abiDefinition)); @@ -130,17 +130,21 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection { return docSection; } -function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { +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: '', // sad we have to specify this + name: contractName, callPath: '', parameters, - returnType: { name: '', typeDocType: TypeDocTypes.Reference }, // sad we have to specify this + returnType: { name: contractName, typeDocType: TypeDocTypes.Reference }, // sad we have to specify this isConstant: false, isPayable: abiDefinition.payable, comment, -- cgit v1.2.3 From 9af5e3ba8e2e5547dcc5e9d9ae194be09847f8ac Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 13:36:55 -0400 Subject: fix: add CHANGELOG.json --- packages/sol-doc/CHANGELOG.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 packages/sol-doc/CHANGELOG.json diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json new file mode 100644 index 000000000..c5bd78356 --- /dev/null +++ b/packages/sol-doc/CHANGELOG.json @@ -0,0 +1,12 @@ +[ + { + "version": "1.0.0", + "changes": [ + { + "note": + "Utility to generate documentation for Solidity smart contracts, outputting a format compliant with @0xproject/types.DocAgnosticFormat", + "pr": 1004 + } + ] + } +] -- cgit v1.2.3 From 574270d061f664176df012c5ef0b649e6d581e6d Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Mon, 24 Sep 2018 15:45:19 -0400 Subject: fix: increase mocha timeout value prior CI runs were failing because of this. --- packages/sol-doc/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index a3ded23f8..b6162c963 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -6,7 +6,7 @@ "types": "lib/src/index.d.js", "scripts": { "build": "tsc", - "test": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 5000 --exit", + "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", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", -- cgit v1.2.3 From 9c89d1e99b5a285eee74b53fa6f2595789fafb11 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 10:45:11 +0100 Subject: Expose method to send raw JSON RPC payloads --- packages/web3-wrapper/src/web3_wrapper.ts | 73 +++++++++++++++++-------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 2f574b76a..d52c1cb6e 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -193,7 +193,7 @@ export class Web3Wrapper { * @returns Ethereum node's version string */ public async getNodeVersionAsync(): Promise { - const nodeVersion = await this._sendRawPayloadAsync({ method: 'web3_clientVersion' }); + const nodeVersion = await this.sendRawPayloadAsync({ method: 'web3_clientVersion' }); return nodeVersion; } /** @@ -201,7 +201,7 @@ export class Web3Wrapper { * @returns The network id */ public async getNetworkIdAsync(): Promise { - const networkIdStr = await this._sendRawPayloadAsync({ method: 'net_version' }); + const networkIdStr = await this.sendRawPayloadAsync({ method: 'net_version' }); const networkId = _.parseInt(networkIdStr); return networkId; } @@ -212,7 +212,7 @@ export class Web3Wrapper { */ public async getTransactionReceiptAsync(txHash: string): Promise { assert.isHexString('txHash', txHash); - const transactionReceipt = await this._sendRawPayloadAsync({ + const transactionReceipt = await this.sendRawPayloadAsync({ method: 'eth_getTransactionReceipt', params: [txHash], }); @@ -228,7 +228,7 @@ export class Web3Wrapper { */ public async getTransactionByHashAsync(txHash: string): Promise { assert.isHexString('txHash', txHash); - const transaction = await this._sendRawPayloadAsync({ + const transaction = await this.sendRawPayloadAsync({ method: 'eth_getTransactionByHash', params: [txHash], }); @@ -247,7 +247,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const encodedOwner = marshaller.marshalAddress(owner); - const balanceInWei = await this._sendRawPayloadAsync({ + const balanceInWei = await this.sendRawPayloadAsync({ method: 'eth_getBalance', params: [encodedOwner, marshalledDefaultBlock], }); @@ -279,7 +279,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const encodedAddress = marshaller.marshalAddress(address); - const code = await this._sendRawPayloadAsync({ + const code = await this.sendRawPayloadAsync({ method: 'eth_getCode', params: [encodedAddress, marshalledDefaultBlock], }); @@ -293,7 +293,7 @@ export class Web3Wrapper { */ public async getTransactionTraceAsync(txHash: string, traceParams: TraceParams): Promise { assert.isHexString('txHash', txHash); - const trace = await this._sendRawPayloadAsync({ + const trace = await this.sendRawPayloadAsync({ method: 'debug_traceTransaction', params: [txHash, traceParams], }); @@ -308,7 +308,7 @@ export class Web3Wrapper { public async signMessageAsync(address: string, message: string): Promise { assert.isETHAddressHex('address', address); assert.isString('message', message); // TODO: Should this be stricter? Hex string? - const signData = await this._sendRawPayloadAsync({ + const signData = await this.sendRawPayloadAsync({ method: 'eth_sign', params: [address, message], }); @@ -319,7 +319,7 @@ export class Web3Wrapper { * @returns Block number */ public async getBlockNumberAsync(): Promise { - const blockNumberHex = await this._sendRawPayloadAsync({ + const blockNumberHex = await this.sendRawPayloadAsync({ method: 'eth_blockNumber', params: [], }); @@ -339,7 +339,7 @@ export class Web3Wrapper { const encodedBlockParam = marshaller.marshalBlockParam(blockParam); const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const shouldIncludeTransactionData = false; - const blockWithoutTransactionDataWithHexValuesOrNull = await this._sendRawPayloadAsync< + const blockWithoutTransactionDataWithHexValuesOrNull = await this.sendRawPayloadAsync< BlockWithoutTransactionDataRPC >({ method, @@ -366,7 +366,7 @@ export class Web3Wrapper { } const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const shouldIncludeTransactionData = true; - const blockWithTransactionDataWithHexValues = await this._sendRawPayloadAsync({ + const blockWithTransactionDataWithHexValues = await this.sendRawPayloadAsync({ method, params: [encodedBlockParam, shouldIncludeTransactionData], }); @@ -393,7 +393,7 @@ export class Web3Wrapper { * @returns Available user addresses */ public async getAvailableAddressesAsync(): Promise { - const addresses = await this._sendRawPayloadAsync({ + const addresses = await this.sendRawPayloadAsync({ method: 'eth_accounts', params: [], }); @@ -405,7 +405,7 @@ export class Web3Wrapper { * @returns The snapshot id. This can be used to revert to this snapshot */ public async takeSnapshotAsync(): Promise { - const snapshotId = Number(await this._sendRawPayloadAsync({ method: 'evm_snapshot', params: [] })); + const snapshotId = Number(await this.sendRawPayloadAsync({ method: 'evm_snapshot', params: [] })); return snapshotId; } /** @@ -415,14 +415,14 @@ export class Web3Wrapper { */ public async revertSnapshotAsync(snapshotId: number): Promise { assert.isNumber('snapshotId', snapshotId); - const didRevert = await this._sendRawPayloadAsync({ method: 'evm_revert', params: [snapshotId] }); + const didRevert = await this.sendRawPayloadAsync({ method: 'evm_revert', params: [snapshotId] }); return didRevert; } /** * Mine a block on a TestRPC/Ganache local node */ public async mineBlockAsync(): Promise { - await this._sendRawPayloadAsync({ method: 'evm_mine', params: [] }); + await this.sendRawPayloadAsync({ method: 'evm_mine', params: [] }); } /** * Increase the next blocks timestamp on TestRPC/Ganache or Geth local node. @@ -434,9 +434,9 @@ export class Web3Wrapper { // Detect Geth vs. Ganache and use appropriate endpoint. const version = await this.getNodeVersionAsync(); if (_.includes(version, uniqueVersionIds.geth)) { - return this._sendRawPayloadAsync({ method: 'debug_increaseTime', params: [timeDelta] }); + return this.sendRawPayloadAsync({ method: 'debug_increaseTime', params: [timeDelta] }); } else if (_.includes(version, uniqueVersionIds.ganache)) { - return this._sendRawPayloadAsync({ method: 'evm_increaseTime', params: [timeDelta] }); + return this.sendRawPayloadAsync({ method: 'evm_increaseTime', params: [timeDelta] }); } else { throw new Error(`Unknown client version: ${version}`); } @@ -470,7 +470,7 @@ export class Web3Wrapper { method: 'eth_getLogs', params: [serializedFilter], }; - const rawLogs = await this._sendRawPayloadAsync(payload); + const rawLogs = await this.sendRawPayloadAsync(payload); const formattedLogs = _.map(rawLogs, marshaller.unmarshalLog.bind(marshaller)); return formattedLogs; } @@ -486,7 +486,7 @@ export class Web3Wrapper { schemas.jsNumber, ]); const txDataHex = marshaller.marshalTxData(txData); - const gasHex = await this._sendRawPayloadAsync({ method: 'eth_estimateGas', params: [txDataHex] }); + const gasHex = await this.sendRawPayloadAsync({ method: 'eth_estimateGas', params: [txDataHex] }); const gas = utils.convertHexToNumber(gasHex); return gas; } @@ -507,7 +507,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const callDataHex = marshaller.marshalCallData(callData); - const rawCallResult = await this._sendRawPayloadAsync({ + const rawCallResult = await this.sendRawPayloadAsync({ method: 'eth_call', params: [callDataHex, marshalledDefaultBlock], }); @@ -528,7 +528,7 @@ export class Web3Wrapper { schemas.jsNumber, ]); const txDataHex = marshaller.marshalTxData(txData); - const txHash = await this._sendRawPayloadAsync({ method: 'eth_sendTransaction', params: [txDataHex] }); + const txHash = await this.sendRawPayloadAsync({ method: 'eth_sendTransaction', params: [txDataHex] }); return txHash; } /** @@ -638,7 +638,24 @@ export class Web3Wrapper { */ public async setHeadAsync(blockNumber: number): Promise { assert.isNumber('blockNumber', blockNumber); - await this._sendRawPayloadAsync({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] }); + await this.sendRawPayloadAsync({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] }); + } + /** + * Sends a raw Ethereum JSON RPC payload and returns the response's `result` key + * @param payload A partial JSON RPC payload. No need to include version, id, params (if none needed) + * @return The contents nested under the result key of the response body + */ + public async sendRawPayloadAsync(payload: Partial): Promise { + const sendAsync = this._provider.sendAsync.bind(this._provider); + const payloadWithDefaults = { + id: this._jsonRpcRequestId++, + params: [], + jsonrpc: '2.0', + ...payload, + }; + const response = await promisify(sendAsync)(payloadWithDefaults); + const result = response.result; + return result; } /** * Returns either NodeType.Geth or NodeType.Ganache depending on the type of @@ -654,16 +671,4 @@ export class Web3Wrapper { throw new Error(`Unknown client version: ${version}`); } } - private async _sendRawPayloadAsync(payload: Partial): Promise { - const sendAsync = this._provider.sendAsync.bind(this._provider); - const payloadWithDefaults = { - id: this._jsonRpcRequestId++, - params: [], - jsonrpc: '2.0', - ...payload, - }; - const response = await promisify(sendAsync)(payloadWithDefaults); - const result = response.result; - return result; - } } // tslint:disable-line:max-file-line-count -- cgit v1.2.3 From 21910a712965e5f992f540d94620be2b45384d8f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 11:02:49 +0100 Subject: Add entry about newly exposed method --- packages/web3-wrapper/CHANGELOG.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index ce3f5e3be..8ef544d26 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -6,6 +6,10 @@ "note": "Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined.", "pr": 1082 + }, + { + "note": "Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls", + "pr": 1080 } ] }, -- cgit v1.2.3 From 0afe55f2ff028d03e3a9f110819806f68446dee9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 11:20:09 +0100 Subject: Refactor blockstream integration to use the proper callback method interface --- .../src/contract_wrappers/contract_wrapper.ts | 40 ++++++++++++++++------ .../src/order_watcher/event_watcher.ts | 40 ++++++++++++++++------ 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index 19a882712..660f2d122 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -175,8 +175,8 @@ export abstract class ContractWrapper { throw new Error(ContractWrappersError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( - this._getBlockOrNullAsync.bind(this), - this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), + this._blockstreamGetBlockOrNullAsync.bind(this), + this._blockstreamGetLogsAsync.bind(this), ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose), ); const catchAllLogFilter = {}; @@ -196,12 +196,30 @@ export abstract class ContractWrapper { ); } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _getBlockOrNullAsync(): Promise { - const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); - if (_.isUndefined(blockIfExists)) { - return null; - } - return blockIfExists; + private async _blockstreamGetBlockOrNullAsync(hash: string): Promise { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getBlockByHash', + params: [hash, shouldIncludeTransactionData], + }); + return blockOrNull as Block; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLatestBlockOrNullAsync(): Promise { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getBlockByNumber', + params: ['latest', shouldIncludeTransactionData], + }); + return blockOrNull as Block; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { + const logs = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getLogs', + params: [filterOptions], + }); + return logs as Log[]; } // HACK: This should be a package-scoped method (which doesn't exist in TS) // We don't want this method available in the public interface for all classes @@ -221,14 +239,14 @@ export abstract class ContractWrapper { delete this._blockAndLogStreamerIfExists; } private async _reconcileBlockAsync(): Promise { - const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(BlockParamLiteral.Latest); - if (_.isUndefined(latestBlockIfExists)) { + const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync(); + if (_.isNull(latestBlockOrNull)) { return; // noop } // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockOrNull as any) as Block); } } } diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index eca235e26..c3de86f4e 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -62,8 +62,8 @@ export class EventWatcher { throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( - this._getBlockOrNullAsync.bind(this), - this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), + this._blockstreamGetBlockOrNullAsync.bind(this), + this._blockstreamGetLogsAsync.bind(this), this._onBlockAndLogStreamerError.bind(this), ); const catchAllLogFilter = {}; @@ -82,13 +82,31 @@ export class EventWatcher { this._onLogStateChangedAsync.bind(this, callback, isRemoved), ); } + /// This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetBlockOrNullAsync(hash: string): Promise { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getBlockByHash', + params: [hash, shouldIncludeTransactionData], + }); + return blockOrNull as Block; + } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _getBlockOrNullAsync(): Promise { - const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); - if (_.isUndefined(blockIfExists)) { - return null; - } - return blockIfExists; + private async _blockstreamGetLatestBlockOrNullAsync(): Promise { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getBlockByNumber', + params: ['latest', shouldIncludeTransactionData], + }); + return blockOrNull as Block; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { + const logs = await this._web3Wrapper.sendRawPayloadAsync({ + method: 'eth_getLogs', + params: [filterOptions], + }); + return logs as Log[]; } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { @@ -108,14 +126,14 @@ export class EventWatcher { await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback); } private async _reconcileBlockAsync(): Promise { - const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(this._stateLayer); - if (_.isUndefined(latestBlockIfExists)) { + const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync(); + if (_.isNull(latestBlockOrNull)) { return; // noop } // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockOrNull as any) as Block); } } private async _emitDifferencesAsync( -- cgit v1.2.3 From 902691e289ab6e7daae18f42ec8601807f3a7c0a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 11:29:36 +0100 Subject: Update changelogs --- packages/contract-wrappers/CHANGELOG.json | 7 ++++++- packages/order-watcher/CHANGELOG.json | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 1c9af4971..468ddc3bc 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -4,7 +4,12 @@ "changes": [ { "note": - "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." + "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.", + "pr": 1080 + }, + { + "note": "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "pr": 1080 } ] }, diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 1b19a4cdd..a70d91654 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -4,7 +4,12 @@ "changes": [ { "note": - "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." + "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.", + "pr": 1080 + }, + { + "note": "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "pr": 1080 } ] }, -- cgit v1.2.3 From 284930eb58c95c03f1a73b7c1f127701068e41e9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 11:30:27 +0100 Subject: Add missing type --- packages/order-watcher/src/order_watcher/event_watcher.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index c3de86f4e..d23052613 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -1,6 +1,6 @@ import { intervalUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BlockParamLiteral, BlockWithoutTransactionData, LogEntry, Provider } from 'ethereum-types'; +import { BlockParamLiteral, FilterObject, LogEntry, Provider } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; -- cgit v1.2.3 From 55ca971186fd9318c1be9cc9e8c125f55c653cd9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 12:05:44 +0100 Subject: Decode logs received from blockstream --- .../contract-wrappers/src/contract_wrappers/contract_wrapper.ts | 9 +++++---- packages/order-watcher/src/order_watcher/event_watcher.ts | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index 660f2d122..58c5bce6d 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -1,14 +1,14 @@ import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; import { BlockParamLiteral, - BlockWithoutTransactionData, ContractAbi, ContractArtifact, FilterObject, LogEntry, LogWithDecodedArgs, RawLog, + RawLogEntry, } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -158,7 +158,8 @@ export abstract class ContractWrapper { return addressIfExists; } } - private _onLogStateChanged(isRemoved: boolean, log: LogEntry): void { + private _onLogStateChanged(isRemoved: boolean, rawLog: RawLogEntry): void { + const log: LogEntry = marshaller.unmarshalLog(rawLog); _.forEach(this._filters, (filter: FilterObject, filterToken: string) => { if (filterUtils.matchesFilter(log, filter)) { const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs; @@ -209,7 +210,7 @@ export abstract class ContractWrapper { const shouldIncludeTransactionData = false; const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByNumber', - params: ['latest', shouldIncludeTransactionData], + params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], }); return blockOrNull as Block; } diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index d23052613..e73e1f9f9 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -1,6 +1,6 @@ import { intervalUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BlockParamLiteral, FilterObject, LogEntry, Provider } from 'ethereum-types'; +import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; +import { BlockParamLiteral, FilterObject, LogEntry, Provider, RawLogEntry } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -96,7 +96,7 @@ export class EventWatcher { const shouldIncludeTransactionData = false; const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByNumber', - params: ['latest', shouldIncludeTransactionData], + params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], }); return blockOrNull as Block; } @@ -121,8 +121,9 @@ export class EventWatcher { private async _onLogStateChangedAsync( callback: EventWatcherCallback, isRemoved: boolean, - log: LogEntry, + rawLog: RawLogEntry, ): Promise { + const log: LogEntry = marshaller.unmarshalLog(rawLog); await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback); } private async _reconcileBlockAsync(): Promise { -- cgit v1.2.3 From 173b36c54cc51c9b42c3f96f5a313d9e271b087c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 12:06:28 +0100 Subject: Fix prettier --- packages/contract-wrappers/CHANGELOG.json | 5 +++-- packages/order-watcher/CHANGELOG.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 468ddc3bc..9ee812426 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -4,11 +4,12 @@ "changes": [ { "note": - "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.", + "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.", "pr": 1080 }, { - "note": "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "note": + "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", "pr": 1080 } ] diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index a70d91654..eded891d6 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -5,10 +5,11 @@ { "note": "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.", - "pr": 1080 + "pr": 1080 }, { - "note": "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "note": + "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", "pr": 1080 } ] -- cgit v1.2.3 From a05530f821b2550ff14a0e359c27650d4ba03130 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 12:06:37 +0100 Subject: Fix prettier --- packages/web3-wrapper/CHANGELOG.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 8ef544d26..18ce5acd5 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -8,7 +8,8 @@ "pr": 1082 }, { - "note": "Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls", + "note": + "Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls", "pr": 1080 } ] -- cgit v1.2.3 From fc3acec669f21b8c5bcb5e3d4f712c2adaf2cf64 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 12:32:20 +0100 Subject: Fix lint issues --- .../src/contract_wrappers/contract_wrapper.ts | 16 ++++++++-------- .../order-watcher/src/order_watcher/event_watcher.ts | 20 +++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index 58c5bce6d..f7a89e3be 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -199,28 +199,28 @@ export abstract class ContractWrapper { // This method only exists in order to comply with the expected interface of Blockstream's constructor private async _blockstreamGetBlockOrNullAsync(hash: string): Promise { const shouldIncludeTransactionData = false; - const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByHash', params: [hash, shouldIncludeTransactionData], }); - return blockOrNull as Block; + return blockOrNull; } // This method only exists in order to comply with the expected interface of Blockstream's constructor private async _blockstreamGetLatestBlockOrNullAsync(): Promise { const shouldIncludeTransactionData = false; - const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByNumber', params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], }); - return blockOrNull as Block; + return blockOrNull; } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { - const logs = await this._web3Wrapper.sendRawPayloadAsync({ + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { + const logs = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getLogs', params: [filterOptions], }); - return logs as Log[]; + return logs as RawLogEntry[]; } // HACK: This should be a package-scoped method (which doesn't exist in TS) // We don't want this method available in the public interface for all classes @@ -247,7 +247,7 @@ export abstract class ContractWrapper { // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockOrNull as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull); } } } diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index e73e1f9f9..9ea301815 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -20,7 +20,6 @@ enum LogEventState { */ export class EventWatcher { private readonly _web3Wrapper: Web3Wrapper; - private readonly _stateLayer: BlockParamLiteral; private readonly _isVerbose: boolean; private _blockAndLogStreamerIfExists: BlockAndLogStreamer | undefined; private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; @@ -35,7 +34,6 @@ export class EventWatcher { ) { this._isVerbose = isVerbose; this._web3Wrapper = new Web3Wrapper(provider); - this._stateLayer = stateLayer; this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs) ? DEFAULT_EVENT_POLLING_INTERVAL_MS : pollingIntervalIfExistsMs; @@ -82,31 +80,31 @@ export class EventWatcher { this._onLogStateChangedAsync.bind(this, callback, isRemoved), ); } - /// This method only exists in order to comply with the expected interface of Blockstream's constructor + // This method only exists in order to comply with the expected interface of Blockstream's constructor private async _blockstreamGetBlockOrNullAsync(hash: string): Promise { const shouldIncludeTransactionData = false; - const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByHash', params: [hash, shouldIncludeTransactionData], }); - return blockOrNull as Block; + return blockOrNull; } // This method only exists in order to comply with the expected interface of Blockstream's constructor private async _blockstreamGetLatestBlockOrNullAsync(): Promise { const shouldIncludeTransactionData = false; - const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getBlockByNumber', params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], }); - return blockOrNull as Block; + return blockOrNull; } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { - const logs = await this._web3Wrapper.sendRawPayloadAsync({ + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise { + const logs = await this._web3Wrapper.sendRawPayloadAsync({ method: 'eth_getLogs', params: [filterOptions], }); - return logs as Log[]; + return logs as RawLogEntry[]; } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { @@ -134,7 +132,7 @@ export class EventWatcher { // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockOrNull as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull); } } private async _emitDifferencesAsync( -- cgit v1.2.3 From 9eecf3683b674f0753e508476c4c21eb32625f18 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 16:10:13 +0100 Subject: Add transactionHash to OrderState and emit it from OrderWatcher subscription --- packages/order-utils/src/order_state_utils.ts | 4 +++- .../order-utils/test/order_state_utils_test.ts | 20 +++++++++++++++++ .../src/order_watcher/order_watcher.ts | 25 +++++++++++---------- packages/order-watcher/test/order_watcher_test.ts | 26 ++++++++++++++++++++++ packages/types/src/index.ts | 2 ++ 5 files changed, 64 insertions(+), 13 deletions(-) diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index 8398776aa..9b21ef6e9 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -114,7 +114,7 @@ export class OrderStateUtils { * @return State relevant to the signedOrder, as well as whether the signedOrder is "valid". * Validity is defined as a non-zero amount of the order can still be filled. */ - public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise { + public async getOpenOrderStateAsync(signedOrder: SignedOrder, transactionHash?: string): Promise { const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder); const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); @@ -134,6 +134,7 @@ export class OrderStateUtils { isValid: true, orderHash, orderRelevantState, + transactionHash, }; return orderState; } else { @@ -141,6 +142,7 @@ export class OrderStateUtils { isValid: false, orderHash, error: orderValidationResult.error, + transactionHash, }; return orderState; } diff --git a/packages/order-utils/test/order_state_utils_test.ts b/packages/order-utils/test/order_state_utils_test.ts index 91ef23b69..ea88027ae 100644 --- a/packages/order-utils/test/order_state_utils_test.ts +++ b/packages/order-utils/test/order_state_utils_test.ts @@ -120,5 +120,25 @@ describe('OrderStateUtils', () => { const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder); expect(orderState.isValid).to.eq(false); }); + it('should include the transactionHash in orderState if supplied in method invocation', async () => { + const makerAssetAmount = new BigNumber(10); + const takerAssetAmount = new BigNumber(10000000000000000); + const takerBalance = takerAssetAmount; + const orderFilledAmount = new BigNumber(0); + const mockBalanceFetcher = buildMockBalanceFetcher(takerBalance); + const mockOrderFilledFetcher = buildMockOrderFilledFetcher(orderFilledAmount); + const [signedOrder] = testOrderFactory.generateTestSignedOrders( + { + makerAssetAmount, + takerAssetAmount, + }, + 1, + ); + + const orderStateUtils = new OrderStateUtils(mockBalanceFetcher, mockOrderFilledFetcher); + const transactionHash = '0xdeadbeef'; + const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash); + expect(orderState.transactionHash).to.eq(transactionHash); + }); }); }); diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index cab2efa4b..f9a63efe3 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -275,6 +275,7 @@ export class OrderWatcher { return; // noop } const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs; + const transactionHash = decodedLog.transactionHash; switch (decodedLog.event) { case ERC20TokenEvents.Approval: case ERC721TokenEvents.Approval: { @@ -290,7 +291,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } else { // ERC721 @@ -303,7 +304,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } } @@ -322,7 +323,7 @@ export class OrderWatcher { args._from, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } else { // ERC721 @@ -336,7 +337,7 @@ export class OrderWatcher { args._from, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } } @@ -350,7 +351,7 @@ export class OrderWatcher { args._owner, tokenAddress, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case WETH9Events.Deposit: { @@ -363,7 +364,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case WETH9Events.Withdrawal: { @@ -376,7 +377,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case ExchangeEvents.Fill: { @@ -387,7 +388,7 @@ export class OrderWatcher { const orderHash = args.orderHash; const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); if (isOrderWatched) { - await this._emitRevalidateOrdersAsync([orderHash]); + await this._emitRevalidateOrdersAsync([orderHash], transactionHash); } break; } @@ -399,7 +400,7 @@ export class OrderWatcher { const orderHash = args.orderHash; const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); if (isOrderWatched) { - await this._emitRevalidateOrdersAsync([orderHash]); + await this._emitRevalidateOrdersAsync([orderHash], transactionHash); } break; } @@ -410,7 +411,7 @@ export class OrderWatcher { this._orderFilledCancelledLazyStore.deleteAllIsCancelled(); // Revalidate orders const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByMaker(args.makerAddress); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } @@ -418,12 +419,12 @@ export class OrderWatcher { throw errorUtils.spawnSwitchErr('decodedLog.event', decodedLog.event); } } - private async _emitRevalidateOrdersAsync(orderHashes: string[]): Promise { + private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise { for (const orderHash of orderHashes) { const signedOrder = this._orderByOrderHash[orderHash]; // Most of these calls will never reach the network because the data is fetched from stores // and only updated when cache is invalidated - const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder); + const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash); if (_.isUndefined(this._callbackIfExists)) { break; // Unsubscribe was called } diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 38bfde7ef..60d9069e8 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -250,6 +250,32 @@ describe('OrderWatcher', () => { await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress); })().catch(done); }); + it('should include transactionHash in emitted orderStateInvalid when watched order fully filled', (done: DoneCallback) => { + (async () => { + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + takerAddress, + fillableAmount, + ); + await orderWatcher.addOrderAsync(signedOrder); + + let transactionHash: string; + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { + expect(orderState.isValid).to.be.false(); + const invalidOrderState = orderState as OrderStateInvalid; + expect(invalidOrderState.transactionHash).to.be.equal(transactionHash); + }); + orderWatcher.subscribe(callback); + + transactionHash = await contractWrappers.exchange.fillOrderAsync( + signedOrder, + fillableAmount, + takerAddress, + ); + })().catch(done); + }); it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => { (async () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index d27060ee5..5223bf299 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -111,12 +111,14 @@ export interface OrderStateValid { isValid: true; orderHash: string; orderRelevantState: OrderRelevantState; + transactionHash?: string; } export interface OrderStateInvalid { isValid: false; orderHash: string; error: ExchangeContractErrs; + transactionHash?: string; } export type OrderState = OrderStateValid | OrderStateInvalid; -- cgit v1.2.3 From 5afc73939785a9b5c6c73773b8f8eac4429762ef Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 16:37:08 +0100 Subject: Add changelog entry --- packages/order-watcher/CHANGELOG.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 9ab0905fe..46dc4c0df 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -11,6 +11,11 @@ "note": "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", "pr": 1080 + }, + { + "note": + "Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction.", + "pr": 1087 } ] }, -- cgit v1.2.3 From b40861747b73bb9a0826853751b7caa5cbf085ae Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 17:34:22 +0100 Subject: Properly render function generic types that don't extend another type --- packages/react-docs/src/components/signature.tsx | 21 +++++++++++++-------- packages/react-docs/src/types.ts | 2 +- packages/react-docs/src/utils/typedoc_utils.ts | 5 ++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index bf9c8be24..4f10f4665 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -134,14 +134,19 @@ function renderTypeParameter( ): React.ReactNode { const typeParam = ( - {`<${typeParameter.name} extends `} - + {`<${typeParameter.name}`} + {!_.isUndefined(typeParameter.type) && ( + + {' extends '} + + + )} {`>`} ); diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index f9cb5e26a..29f5664f5 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -150,7 +150,7 @@ export interface Parameter { export interface TypeParameter { name: string; - type: Type; + type?: Type; } export interface Type { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index f44945369..e3e9c11fb 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -419,7 +419,10 @@ export class TypeDocUtils { return func; } private _convertTypeParameter(entity: TypeDocNode, sectionName: string): TypeParameter { - const type = this._convertType(entity.type, sectionName); + let type; + if (!_.isUndefined(entity.type)) { + type = this._convertType(entity.type, sectionName); + } const parameter = { name: entity.name, type, -- cgit v1.2.3 From d20f713fade2d23e847dfb349938730ca95cbf15 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 25 Sep 2018 21:08:32 +0200 Subject: When number of relayers is less than number of columns, reduce column number to number of relayers --- packages/website/ts/components/relayer_index/relayer_index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/website/ts/components/relayer_index/relayer_index.tsx b/packages/website/ts/components/relayer_index/relayer_index.tsx index 4aea1bbbb..91dbeb27a 100644 --- a/packages/website/ts/components/relayer_index/relayer_index.tsx +++ b/packages/website/ts/components/relayer_index/relayer_index.tsx @@ -56,7 +56,11 @@ export class RelayerIndex extends React.Component ); } else { - const numberOfColumns = this._numberOfColumnsForScreenWidth(this.props.screenWidth); + const numberOfRelayers = this.state.relayerInfos.length; + const numberOfColumns = Math.min( + numberOfRelayers, + this._numberOfColumnsForScreenWidth(this.props.screenWidth), + ); return ( Date: Tue, 25 Sep 2018 14:35:18 -0400 Subject: fix: rename SupportedDocJson field to SolDoc from Solidity https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219976199 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/react-docs/src/components/documentation.tsx | 2 +- packages/react-docs/src/types.ts | 2 +- packages/react-docs/src/utils/constants.ts | 2 +- packages/website/ts/containers/smart_contracts_documentation.ts | 2 +- packages/website/ts/pages/documentation/doc_page.tsx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 0974297bc..3cd14923c 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -329,7 +329,7 @@ export class Documentation extends React.Component{externalExports}; } private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode { - if (this.props.docsInfo.type !== SupportedDocJson.Solidity) { + if (this.props.docsInfo.type !== SupportedDocJson.SolDoc) { return null; } diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index f475c2756..153448513 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -38,7 +38,7 @@ export enum KindString { } export enum SupportedDocJson { - Solidity = 'SOLIDITY', + SolDoc = 'SOL_DOC', TypeDoc = 'TYPEDOC', } diff --git a/packages/react-docs/src/utils/constants.ts b/packages/react-docs/src/utils/constants.ts index 35a939c51..b5b6cc00d 100644 --- a/packages/react-docs/src/utils/constants.ts +++ b/packages/react-docs/src/utils/constants.ts @@ -4,7 +4,7 @@ export const constants = { TYPES_SECTION_NAME: 'types', EXTERNAL_EXPORTS_SECTION_NAME: 'external exports', TYPE_TO_SYNTAX: { - [SupportedDocJson.Solidity]: 'solidity', + [SupportedDocJson.SolDoc]: 'solidity', [SupportedDocJson.TypeDoc]: 'typescript', } as { [supportedDocType: string]: string }, }; diff --git a/packages/website/ts/containers/smart_contracts_documentation.ts b/packages/website/ts/containers/smart_contracts_documentation.ts index 1f333beac..8d69afe71 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.ts +++ b/packages/website/ts/containers/smart_contracts_documentation.ts @@ -17,7 +17,7 @@ const IntroMarkdownV2 = require('md/docs/smart_contracts/2.0.0/introduction'); const docsInfoConfig: DocsInfoConfig = { id: DocPackages.SmartContracts, packageName: 'contracts', - type: SupportedDocJson.Solidity, + type: SupportedDocJson.SolDoc, displayName: '0x Smart Contracts', packageUrl: 'https://github.com/0xProject/contracts', markdownMenu: { diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 7bf3addc0..a06d29035 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -141,7 +141,7 @@ export class DocPage extends React.Component { versionDocObj as GeneratedDocJson, this.props.docsInfo, ).convertToDocAgnosticFormat(); - } else if (this.props.docsInfo.type === SupportedDocJson.Solidity) { + } else if (this.props.docsInfo.type === SupportedDocJson.SolDoc) { // documenting solidity. docAgnosticFormat = versionDocObj as DocAgnosticFormat; // need to modify docsInfo like convertToDocAgnosticFormat() would do -- cgit v1.2.3 From 6174267f6940dce57fde8933c6282814d070b892 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:22:40 -0400 Subject: fix: explain why tslint rule is disabled https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219976511 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/react-docs/src/utils/typedoc_utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index d235b4406..09f995672 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -468,6 +468,7 @@ export class TypeDocUtils { methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName); } else if (entity.type === TypeDocTypes.Tuple) { tupleElementsIfExists = _.map(entity.elements, el => { + // the following line is required due to an open tslint issue, https://github.com/palantir/tslint/issues/3540 // tslint:disable-next-line:no-unnecessary-type-assertion return { name: el.name, typeDocType: el.type as TypeDocTypes }; }); -- cgit v1.2.3 From 055bcb52f8dc4432a2d9f60d20b240adaa9c3cf8 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 25 Sep 2018 22:04:12 +0200 Subject: Change news link --- packages/website/ts/pages/landing/landing.tsx | 4 +- yarn.lock | 64 +++++++++++++-------------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 211be7bf2..388e83d51 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -37,8 +37,8 @@ interface Project { } const THROTTLE_TIMEOUT = 100; -const WHATS_NEW_TITLE = '18 ideas for 0x relayers in 2018'; -const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; +const WHATS_NEW_TITLE = '0x Protocol v2 is Live!'; +const WHATS_NEW_URL = 'https://blog.0xproject.com/0x-protocol-v2-0-is-live-183aac180149'; const TITLE_STYLE: React.CSSProperties = { fontFamily: 'Roboto Mono', color: colors.grey, diff --git a/yarn.lock b/yarn.lock index 950b39fd8..ff572cae8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1356,9 +1356,9 @@ aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" -aes-js@^3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" +aes-js@^0.2.3: + version "0.2.4" + resolved "https://registry.npmjs.org/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d" ajv-keywords@^2.1.0: version "2.1.1" @@ -2424,6 +2424,10 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +base-x@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" + base-x@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" @@ -2835,7 +2839,7 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -bs58@=4.0.1, bs58@^4.0.0: +bs58@=4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: @@ -2845,13 +2849,18 @@ bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" +bs58@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e" dependencies: - bs58 "^4.0.0" + base-x "^1.1.0" + +bs58check@^1.0.8: + version "1.3.4" + resolved "https://registry.npmjs.org/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8" + dependencies: + bs58 "^3.1.0" create-hash "^1.1.0" - safe-buffer "^5.1.2" btoa@1.1.2: version "1.1.2" @@ -5237,7 +5246,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: +ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -5291,18 +5300,17 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@~0.6.0: - version "0.6.2" - resolved "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" +ethereumjs-wallet@0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" dependencies: - aes-js "^3.1.1" - bs58check "^2.1.2" - ethereumjs-util "^5.2.0" - hdkey "^1.0.0" - safe-buffer "^5.1.2" + aes-js "^0.2.3" + bs58check "^1.0.8" + ethereumjs-util "^4.4.0" + hdkey "^0.7.0" scrypt.js "^0.2.0" - utf8 "^3.0.0" - uuid "^3.3.2" + utf8 "^2.1.1" + uuid "^2.0.1" ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: version "3.0.18" @@ -6061,7 +6069,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "0.6.0" + ethereumjs-wallet "~0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" @@ -6743,21 +6751,13 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -hdkey@^0.7.1: +hdkey@^0.7.0, hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" dependencies: coinstring "^2.0.0" secp256k1 "^3.0.1" -hdkey@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" - dependencies: - coinstring "^2.0.0" - safe-buffer "^5.1.1" - secp256k1 "^3.0.1" - he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -14250,10 +14250,6 @@ utf8@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" -utf8@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -- cgit v1.2.3 From adf5acd5c43a9710bc5a3074ce684c2cd8849e63 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 21:23:06 +0100 Subject: Update yarn.lock --- yarn.lock | 62 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/yarn.lock b/yarn.lock index 950b39fd8..ab6f6aaf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1356,9 +1356,9 @@ aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" -aes-js@^3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" +aes-js@^0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d" ajv-keywords@^2.1.0: version "2.1.1" @@ -2424,6 +2424,10 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +base-x@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" + base-x@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" @@ -2835,7 +2839,7 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -bs58@=4.0.1, bs58@^4.0.0: +bs58@=4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: @@ -2845,13 +2849,18 @@ bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" -bs58check@^2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" +bs58@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e" dependencies: - bs58 "^4.0.0" + base-x "^1.1.0" + +bs58check@^1.0.8: + version "1.3.4" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8" + dependencies: + bs58 "^3.1.0" create-hash "^1.1.0" - safe-buffer "^5.1.2" btoa@1.1.2: version "1.1.2" @@ -5237,7 +5246,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: +ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -5291,18 +5300,17 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@~0.6.0: - version "0.6.2" - resolved "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" +ethereumjs-wallet@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" dependencies: - aes-js "^3.1.1" - bs58check "^2.1.2" - ethereumjs-util "^5.2.0" - hdkey "^1.0.0" - safe-buffer "^5.1.2" + aes-js "^0.2.3" + bs58check "^1.0.8" + ethereumjs-util "^4.4.0" + hdkey "^0.7.0" scrypt.js "^0.2.0" - utf8 "^3.0.0" - uuid "^3.3.2" + utf8 "^2.1.1" + uuid "^2.0.1" ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: version "3.0.18" @@ -6743,21 +6751,13 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -hdkey@^0.7.1: +hdkey@^0.7.0, hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" dependencies: coinstring "^2.0.0" secp256k1 "^3.0.1" -hdkey@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" - dependencies: - coinstring "^2.0.0" - safe-buffer "^5.1.1" - secp256k1 "^3.0.1" - he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -14250,10 +14250,6 @@ utf8@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" -utf8@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -- cgit v1.2.3 From 22597674d23284668500efacf551558606401038 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 25 Sep 2018 22:29:16 +0200 Subject: Add weijie and rahul --- packages/website/public/images/team/rahul.png | Bin 0 -> 29636 bytes packages/website/public/images/team/weijie.png | Bin 0 -> 38401 bytes packages/website/ts/pages/about/about.tsx | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 packages/website/public/images/team/rahul.png create mode 100644 packages/website/public/images/team/weijie.png diff --git a/packages/website/public/images/team/rahul.png b/packages/website/public/images/team/rahul.png new file mode 100644 index 000000000..b63cc12b1 Binary files /dev/null and b/packages/website/public/images/team/rahul.png differ diff --git a/packages/website/public/images/team/weijie.png b/packages/website/public/images/team/weijie.png new file mode 100644 index 000000000..69fd51794 Binary files /dev/null and b/packages/website/public/images/team/weijie.png differ diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index 42237bec3..75295349d 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -216,6 +216,23 @@ const teamRow7: ProfileInfo[] = [ }, ]; +const teamRow8: ProfileInfo[] = [ + { + name: 'Weijie Wu', + title: 'Research Fellow', + description: `Researching decentralized governance. Previously Researcher at Huawei and Assistant Professor at Shanghai Jiao Tong University. PhD in Computer Science at The Chinese University of Hong Kong.`, + image: 'images/team/weijie.png', + linkedIn: 'https://www.linkedin.com/in/weijiewu/', + }, + { + name: 'Rahul Singireddy', + title: 'Relayer Success Manager', + description: `Previously community at Zeppelin, growth at Dharma, and cryptocurrency contributor at Forbes. Symbolic Systems at Stanford.`, + image: 'images/team/rahul.png', + linkedIn: 'https://www.linkedin.com/in/rahul-singireddy-3037908a/', + }, +]; + const advisors1: ProfileInfo[] = [ { name: 'Fred Ehrsam', @@ -323,6 +340,7 @@ export class About extends React.Component {
{this._renderProfiles(teamRow5)}
{this._renderProfiles(teamRow6)}
{this._renderProfiles(teamRow7)}
+
{this._renderProfiles(teamRow8)}
Date: Tue, 25 Sep 2018 15:25:10 -0400 Subject: fix: use latest versions of @0xproject packages https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219977747 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/sol-doc/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index b6162c963..cd0e5bbf0 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -24,15 +24,15 @@ "author": "F. Eugene Aumson", "license": "Apache-2.0", "dependencies": { - "@0xproject/sol-compiler": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.6", - "@0xproject/utils": "^1.0.5", + "@0xproject/sol-compiler": "^1.1.4", + "@0xproject/types": "^1.1.0", + "@0xproject/utils": "^1.0.10", "ethereum-types": "^1.0.4", "lodash": "^4.17.10", "yargs": "^12.0.2" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.6", + "@0xproject/tslint-config": "^1.0.7", "chai": "^4.1.2", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.2", -- cgit v1.2.3 From ac5376a1ca29f8cba3c94f759654ea50d4947f84 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:26:42 -0400 Subject: fix: rename JSON_TABWIDTH to JSON_TAB_WIDTH https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219977842 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/sol-doc/src/cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index 59fc185de..1cdc35b64 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -3,7 +3,7 @@ import * as yargs from 'yargs'; import { generateSolDocAsync } from './solidity_doc_generator'; -const JSON_TABWIDTH = 4; +const JSON_TAB_WIDTH = 4; (async () => { const argv = yargs @@ -19,7 +19,7 @@ const JSON_TABWIDTH = 4; .array('contracts') .help().argv; process.stdout.write( - JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TABWIDTH), + JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TAB_WIDTH), ); })().catch(err => { throw err; -- cgit v1.2.3 From 1db5ff617fe772d885e1cfd9ba67f645d8d4ee35 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:29:09 -0400 Subject: fix: split line for readability https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219978696 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/sol-doc/src/cli.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index 1cdc35b64..b29a89147 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -18,9 +18,8 @@ const JSON_TAB_WIDTH = 4; .demandOption('contracts-dir') .array('contracts') .help().argv; - process.stdout.write( - JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TAB_WIDTH), - ); + const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts); + process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH)); })().catch(err => { throw err; }); -- cgit v1.2.3 From 7fbfd9ccd935812796ce297bb81fd8a4b72aa734 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:31:13 -0400 Subject: fix: print error and exit process; don't re-throw https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219979003 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/sol-doc/src/cli.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index b29a89147..eb0f00bf6 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -1,6 +1,8 @@ import 'source-map-support/register'; import * as yargs from 'yargs'; +import { logUtils } from '@0xproject/utils'; + import { generateSolDocAsync } from './solidity_doc_generator'; const JSON_TAB_WIDTH = 4; @@ -21,5 +23,6 @@ const JSON_TAB_WIDTH = 4; const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts); process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH)); })().catch(err => { - throw err; + logUtils.warn(err); + process.exit(1); }); -- cgit v1.2.3 From 2e7b218f4032cb213b947322e3e07ccb8709ca2b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:32:52 -0400 Subject: fix: comments https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219990314 https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220007992 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/sol-doc/src/solidity_doc_generator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index b0c9ff314..5ddf001a6 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -27,8 +27,8 @@ import { } from '@0xproject/types'; /** - * Invoke the Solidity compiler and transform its ABI and devdoc outputs into - * the types that are used as input to documentation generation tools. + * 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. @@ -243,7 +243,7 @@ function _genEventArgsDoc(args: EventParameter[], devdocIfExists: DevdocOutput | } /** - * Extract documentation for each method paramater from @param params. + * Extract documentation for each method parameter from @param params. */ function _genMethodParamsDoc( name: string, -- cgit v1.2.3 From e45f0b0eafd317c27c3a742e8b5aec93230e5910 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:47:20 -0400 Subject: fix: update smart contract doc intros https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220009790 https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220009909 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/website/md/docs/smart_contracts/1.0.0/introduction.md | 9 +-------- packages/website/md/docs/smart_contracts/2.0.0/introduction.md | 6 ++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/website/md/docs/smart_contracts/1.0.0/introduction.md b/packages/website/md/docs/smart_contracts/1.0.0/introduction.md index 566a573b6..79a8f00fd 100644 --- a/packages/website/md/docs/smart_contracts/1.0.0/introduction.md +++ b/packages/website/md/docs/smart_contracts/1.0.0/introduction.md @@ -1,8 +1 @@ -Welcome to the [0x smart contracts](https://github.com/0xProject/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts. - -### Helpful wiki articles: - -* [Overview of 0x protocol architecture](https://0xproject.com/wiki#Architecture) -* [0x smart contract interactions](https://0xproject.com/wiki#Contract-Interactions) -* [Deployed smart contract addresses](https://0xproject.com/wiki#Deployed-Addresses) -* [0x protocol message format](https://0xproject.com/wiki#Message-Format) +Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts. diff --git a/packages/website/md/docs/smart_contracts/2.0.0/introduction.md b/packages/website/md/docs/smart_contracts/2.0.0/introduction.md index 566a573b6..4aa31db3d 100644 --- a/packages/website/md/docs/smart_contracts/2.0.0/introduction.md +++ b/packages/website/md/docs/smart_contracts/2.0.0/introduction.md @@ -1,8 +1,6 @@ -Welcome to the [0x smart contracts](https://github.com/0xProject/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts. +Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts. ### Helpful wiki articles: -* [Overview of 0x protocol architecture](https://0xproject.com/wiki#Architecture) -* [0x smart contract interactions](https://0xproject.com/wiki#Contract-Interactions) * [Deployed smart contract addresses](https://0xproject.com/wiki#Deployed-Addresses) -* [0x protocol message format](https://0xproject.com/wiki#Message-Format) +* [0x Protocol Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md) -- cgit v1.2.3 From de9f5d350f008f1eeb6e42a3dcf611262f6210b4 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:49:43 -0400 Subject: fix: call out a HACK in comments https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220010054 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/website/ts/pages/documentation/doc_page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index a06d29035..6f029b6a2 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -144,7 +144,7 @@ export class DocPage extends React.Component { } else if (this.props.docsInfo.type === SupportedDocJson.SolDoc) { // documenting solidity. docAgnosticFormat = versionDocObj as DocAgnosticFormat; - // need to modify docsInfo like convertToDocAgnosticFormat() would do + // HACK: need to modify docsInfo like convertToDocAgnosticFormat() would do this.props.docsInfo.menu.Contracts = []; _.each(docAgnosticFormat, (docObj, contractName) => { this.props.docsInfo.sections[contractName] = contractName; -- cgit v1.2.3 From 900a8aee76237778398a5940e723ce30c4af1860 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 21:33:55 +0100 Subject: Updated CHANGELOGS --- packages/0x.js/CHANGELOG.json | 9 +++++++++ packages/0x.js/CHANGELOG.md | 4 ++++ packages/abi-gen/CHANGELOG.json | 9 +++++++++ packages/abi-gen/CHANGELOG.md | 4 ++++ packages/assert/CHANGELOG.json | 9 +++++++++ packages/assert/CHANGELOG.md | 4 ++++ packages/asset-buyer/CHANGELOG.json | 9 +++++++++ packages/asset-buyer/CHANGELOG.md | 4 ++++ packages/base-contract/CHANGELOG.json | 9 +++++++++ packages/base-contract/CHANGELOG.md | 4 ++++ packages/connect/CHANGELOG.json | 9 +++++++++ packages/connect/CHANGELOG.md | 4 ++++ packages/contract-wrappers/CHANGELOG.json | 3 ++- packages/contract-wrappers/CHANGELOG.md | 5 +++++ packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/CHANGELOG.md | 4 ++++ packages/ethereum-types/CHANGELOG.json | 9 +++++++++ packages/ethereum-types/CHANGELOG.md | 4 ++++ packages/fill-scenarios/CHANGELOG.json | 9 +++++++++ packages/fill-scenarios/CHANGELOG.md | 4 ++++ packages/json-schemas/CHANGELOG.json | 9 +++++++++ packages/json-schemas/CHANGELOG.md | 4 ++++ packages/migrations/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.md | 4 ++++ packages/order-utils/CHANGELOG.json | 9 +++++++++ packages/order-utils/CHANGELOG.md | 4 ++++ packages/order-watcher/CHANGELOG.json | 3 ++- packages/order-watcher/CHANGELOG.md | 6 ++++++ packages/react-docs/CHANGELOG.json | 9 +++++++++ packages/react-docs/CHANGELOG.md | 4 ++++ packages/react-shared/CHANGELOG.json | 9 +++++++++ packages/react-shared/CHANGELOG.md | 4 ++++ packages/sol-compiler/CHANGELOG.json | 9 +++++++++ packages/sol-compiler/CHANGELOG.md | 4 ++++ packages/sol-cov/CHANGELOG.json | 9 +++++++++ packages/sol-cov/CHANGELOG.md | 4 ++++ packages/sol-resolver/CHANGELOG.json | 9 +++++++++ packages/sol-resolver/CHANGELOG.md | 4 ++++ packages/sra-report/CHANGELOG.json | 9 +++++++++ packages/sra-report/CHANGELOG.md | 4 ++++ packages/sra-spec/CHANGELOG.json | 9 +++++++++ packages/sra-spec/CHANGELOG.md | 4 ++++ packages/subproviders/CHANGELOG.json | 9 +++++++++ packages/subproviders/CHANGELOG.md | 4 ++++ packages/types/CHANGELOG.json | 9 +++++++++ packages/types/CHANGELOG.md | 4 ++++ packages/typescript-typings/CHANGELOG.json | 9 +++++++++ packages/typescript-typings/CHANGELOG.md | 4 ++++ packages/utils/CHANGELOG.json | 9 +++++++++ packages/utils/CHANGELOG.md | 4 ++++ packages/web3-wrapper/CHANGELOG.json | 9 +++++++++ packages/web3-wrapper/CHANGELOG.md | 5 +++++ 52 files changed, 328 insertions(+), 2 deletions(-) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 38966a0b7..391335390 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.5", diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index d881cd825..b9b329085 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.6 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 18aed8716..578557165 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 99fc44f0c..ee46ca2a9 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index 851ba6c04..0aa9038d8 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index 26760306e..dab9f933b 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index 50b965f2d..d673f0a45 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.0", diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md index b27795d18..bea4a551b 100644 --- a/packages/asset-buyer/CHANGELOG.md +++ b/packages/asset-buyer/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.1 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.0 - _September 25, 2018_ * Dependencies updated diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 5f94afa43..8403d824b 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "2.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "2.0.4", diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index b3f3b5619..7a3e0f661 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index d4c501eb1..9de956d4d 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.3", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 2c2483cb6..75906ff4e 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.3 - _September 25, 2018_ * Import SRA-related types from @0xproject/types (#1085) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index d3e0ad5d1..8863f61f4 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -12,7 +12,8 @@ "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", "pr": 1080 } - ] + ], + "timestamp": 1537907159 }, { "version": "1.0.5", diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 98de9c7f2..41e5645a3 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## 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) + * Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it (#1080) + ## v1.0.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index bd4f280ba..b0b703b34 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.9", diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index a362330c2..220d499d3 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 25, 2018_ * Dependencies updated diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json index 20d33ea38..ab3018e4b 100644 --- a/packages/ethereum-types/CHANGELOG.json +++ b/packages/ethereum-types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.8", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537541580, "version": "1.0.7", diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md index 0de27c2fb..d286fbbfd 100644 --- a/packages/ethereum-types/CHANGELOG.md +++ b/packages/ethereum-types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.8 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.7 - _September 21, 2018_ * Dependencies updated diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 3023a43c5..8e6ff9b33 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.4", diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index 4fb3f3c54..4cc8cd855 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index afe8c6f55..facd90878 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.3", diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index dc9a69a3c..763e9dd05 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.3 - _September 25, 2018_ * Dependencies updated diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 1c8418818..25b523e8f 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.11", diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index 80038bebb..a637f30ef 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index d6742df2e..1162bbc83 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.4", diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 67e5a54a6..8372ddf16 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 46dc4c0df..fc7037bfb 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -17,7 +17,8 @@ "Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction.", "pr": 1087 } - ] + ], + "timestamp": 1537907159 }, { "version": "1.0.5", diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index d179b2e1a..32837337a 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## 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) + * Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it (#1080) + * Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction. (#1087) + ## v1.0.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 4e3dfed99..82aaf4e32 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index ca96d479d..8f5cc0cfd 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 96e2a92f9..32cf66691 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.11", diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index 09f6066cd..fb2bac27e 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index af6897b40..69cc7fa0f 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.1.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.1.4", diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 02058b378..0fc0ff7b1 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.1.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index ef009b586..5fde6d5ee 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "2.1.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "2.1.4", diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index 5dddb1c4d..bf48a74a4 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.1.5 - _September 25, 2018_ + + * Dependencies updated + ## v2.1.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index ee439c2d0..72928bbed 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 53354f4ef..e2959bbaa 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index 006965b01..8f7048243 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 298ea66ec..9a83159ba 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json index a4a1fe8ff..b50b98127 100644 --- a/packages/sra-spec/CHANGELOG.json +++ b/packages/sra-spec/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.3", diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md index e279d517f..501a4cf89 100644 --- a/packages/sra-spec/CHANGELOG.md +++ b/packages/sra-spec/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.3 - _September 25, 2018_ * Dependencies updated diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 8b6b87d2a..3cd7c2052 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "2.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "2.0.4", diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 708a94b21..fac8d619d 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index f9479f789..e07699131 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.1.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.1.0", "changes": [ diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 9841aa301..353420081 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.1 - _September 25, 2018_ + + * Dependencies updated + ## v1.1.0 - _September 25, 2018_ * Add ObjectMap type (#1037) diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index f0b1a6c40..91e6a1e47 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "2.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537541580, "version": "2.0.1", diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index 67e86bb82..1be65ddec 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.2 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.1 - _September 21, 2018_ * Dependencies updated diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index 1536c1960..d395a7dec 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537875740, "version": "1.0.10", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index ff26a0900..60b6d1b7e 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 8895951bc..1ab2acafc 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1537907159, + "version": "3.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.0", "changes": [ diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index cafbe1340..1c592d22e 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,9 +5,14 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.1 - _September 25, 2018_ + + * Dependencies updated + ## v3.0.0 - _September 25, 2018_ * Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined. (#1082) + * Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls (#1080) ## v2.0.3 - _September 21, 2018_ -- cgit v1.2.3 From 1b35a6e3b5d050fa33097b35e1d739ca13c6806e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 25 Sep 2018 21:34:14 +0100 Subject: Publish - 0x.js@1.0.6 - @0xproject/abi-gen@1.0.11 - @0xproject/assert@1.0.11 - @0xproject/asset-buyer@1.0.1 - @0xproject/base-contract@2.0.5 - @0xproject/connect@2.0.4 - @0xproject/contract-wrappers@2.0.0 - contracts@2.1.47 - @0xproject/dev-utils@1.0.10 - ethereum-types@1.0.8 - @0xproject/fill-scenarios@1.0.5 - @0xproject/json-schemas@1.0.4 - @0xproject/metacoin@0.0.21 - @0xproject/migrations@1.0.12 - @0xproject/order-utils@1.0.5 - @0xproject/order-watcher@2.0.0 - @0xproject/react-docs@1.0.11 - @0xproject/react-shared@1.0.12 - @0xproject/sol-compiler@1.1.5 - @0xproject/sol-cov@2.1.5 - @0xproject/sol-resolver@1.0.11 - @0xproject/sra-report@1.0.11 - @0xproject/sra-spec@1.0.4 - @0xproject/subproviders@2.0.5 - @0xproject/testnet-faucets@1.0.49 - @0xproject/types@1.1.1 - @0xproject/typescript-typings@2.0.2 - @0xproject/utils@1.0.11 - @0xproject/web3-wrapper@3.0.1 - @0xproject/website@0.0.52 --- packages/0x.js/package.json | 30 +++++++++++++++--------------- packages/abi-gen/package.json | 8 ++++---- packages/assert/package.json | 8 ++++---- packages/asset-buyer/package.json | 24 ++++++++++++------------ packages/base-contract/package.json | 10 +++++----- packages/connect/package.json | 14 +++++++------- packages/contract-wrappers/package.json | 30 +++++++++++++++--------------- packages/contracts/package.json | 26 +++++++++++++------------- packages/dev-utils/package.json | 14 +++++++------- packages/ethereum-types/package.json | 2 +- packages/fill-scenarios/package.json | 18 +++++++++--------- packages/json-schemas/package.json | 6 +++--- packages/metacoin/package.json | 24 ++++++++++++------------ packages/migrations/package.json | 24 ++++++++++++------------ packages/order-utils/package.json | 20 ++++++++++---------- packages/order-watcher/package.json | 30 +++++++++++++++--------------- packages/react-docs/package.json | 8 ++++---- packages/react-shared/package.json | 4 ++-- packages/sol-compiler/package.json | 20 ++++++++++---------- packages/sol-cov/package.json | 16 ++++++++-------- packages/sol-resolver/package.json | 6 +++--- packages/sra-report/package.json | 8 ++++---- packages/sra-spec/package.json | 4 ++-- packages/subproviders/package.json | 14 +++++++------- packages/testnet-faucets/package.json | 14 +++++++------- packages/types/package.json | 4 ++-- packages/typescript-typings/package.json | 4 ++-- packages/utils/package.json | 8 ++++---- packages/web3-wrapper/package.json | 12 ++++++------ packages/website/package.json | 24 ++++++++++++------------ 30 files changed, 217 insertions(+), 217 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index d53571dbf..3b8b0f913 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -41,9 +41,9 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/migrations": "^1.0.11", + "@0xproject/abi-gen": "^1.0.11", + "@0xproject/dev-utils": "^1.0.10", + "@0xproject/migrations": "^1.0.12", "@0xproject/monorepo-scripts": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", @@ -73,17 +73,17 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/base-contract": "^2.0.4", - "@0xproject/contract-wrappers": "^1.0.5", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/order-watcher": "^1.0.5", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@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", "ethers": "3.0.22", "lodash": "^4.17.5", "web3-provider-engine": "14.0.6" diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 1fb697299..314addf52 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -30,10 +30,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", "chalk": "^2.3.0", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "glob": "^7.1.2", "handlebars": "^4.0.11", "lodash": "^4.17.5", diff --git a/packages/assert/package.json b/packages/assert/package.json index ee510d14f..3726f4136 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -44,9 +44,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", + "@0xproject/json-schemas": "^1.0.4", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", "lodash": "^4.17.5", "valid-url": "^1.0.9" }, diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index d15213e0b..ff0afb782 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/asset-buyer", - "version": "1.0.0", + "version": "1.0.1", "engines": { "node": ">=6.12" }, @@ -36,17 +36,17 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md", "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/connect": "^2.0.3", - "@0xproject/contract-wrappers": "^1.0.5", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.6", + "@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", "lodash": "^4.17.10" }, "devDependencies": { diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index cd7f29114..3bba0e81b 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "2.0.4", + "version": "2.0.5", "engines": { "node": ">=6.12" }, @@ -40,10 +40,10 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", + "@0xproject/web3-wrapper": "^3.0.1", + "ethereum-types": "^1.0.8", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/connect/package.json b/packages/connect/package.json index 075089fd2..5e1fa81d4 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -43,12 +43,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", + "@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", "lodash": "^4.17.5", "query-string": "^5.0.1", "sinon": "^4.0.0", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 57f994ff1..c2b1ecdc9 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/contract-wrappers", - "version": "1.0.5", + "version": "2.0.0", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -41,10 +41,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/migrations": "^1.0.11", - "@0xproject/subproviders": "^2.0.4", + "@0xproject/abi-gen": "^1.0.11", + "@0xproject/dev-utils": "^1.0.10", + "@0xproject/migrations": "^1.0.12", + "@0xproject/subproviders": "^2.0.5", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -72,16 +72,16 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/base-contract": "^2.0.4", - "@0xproject/fill-scenarios": "^1.0.4", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@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", "ethereumjs-blockstream": "6.0.0", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 6a7a7c208..536506435 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.46", + "version": "2.1.47", "engines": { "node": ">=6.12" }, @@ -45,11 +45,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/sol-compiler": "^1.1.4", - "@0xproject/sol-cov": "^2.1.4", - "@0xproject/subproviders": "^2.0.4", + "@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/tslint-config": "^1.0.7", "@types/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", @@ -72,15 +72,15 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.4", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@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", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index c45581e45..876bb60d7 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -42,12 +42,12 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/subproviders": "^2.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@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", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index c1abfb79b..32fad87cb 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-types", - "version": "1.0.7", + "version": "1.0.8", "engines": { "node": ">=6.12" }, diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 857ec496f..164a85ebf 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/fill-scenarios", - "version": "1.0.4", + "version": "1.0.5", "description": "0x order fill scenario generator", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", + "@0xproject/abi-gen": "^1.0.11", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", "copyfiles": "^2.0.0", @@ -37,13 +37,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/base-contract": "^2.0.4", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@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", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 7dfdb1066..02f00ccc3 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "1.0.3", + "version": "1.0.4", "engines": { "node": ">=6.12" }, @@ -38,14 +38,14 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", "dependencies": { - "@0xproject/typescript-typings": "^2.0.1", + "@0xproject/typescript-typings": "^2.0.2", "@types/node": "*", "jsonschema": "^1.2.0", "lodash.values": "^4.3.0" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", - "@0xproject/utils": "^1.0.10", + "@0xproject/utils": "^1.0.11", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 924408d53..3b32b4099 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.20", + "version": "0.0.21", "engines": { "node": ">=6.12" }, @@ -28,25 +28,25 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/base-contract": "^2.0.4", - "@0xproject/sol-cov": "^2.1.4", - "@0xproject/subproviders": "^2.0.4", + "@0xproject/abi-gen": "^1.0.11", + "@0xproject/base-contract": "^2.0.5", + "@0xproject/sol-cov": "^2.1.5", + "@0xproject/subproviders": "^2.0.5", "@0xproject/tslint-config": "^1.0.7", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@0xproject/types": "^1.1.1", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", + "@0xproject/web3-wrapper": "^3.0.1", "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethers": "3.0.22", "lodash": "^4.17.5", "run-s": "^0.0.0" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/sol-compiler": "^1.1.4", + "@0xproject/dev-utils": "^1.0.10", + "@0xproject/sol-compiler": "^1.1.5", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index f44a254ed..81632e9d8 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -30,10 +30,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/dev-utils": "^1.0.9", + "@0xproject/abi-gen": "^1.0.11", + "@0xproject/dev-utils": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", - "@0xproject/types": "^1.1.0", + "@0xproject/types": "^1.1.1", "@types/yargs": "^10.0.0", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", @@ -44,15 +44,15 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.4", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/sol-compiler": "^1.1.4", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@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", "@ledgerhq/hw-app-eth": "^4.3.0", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 167d32608..f83b9cc14 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-utils", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.9", + "@0xproject/dev-utils": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -57,16 +57,16 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/base-contract": "^2.0.4", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@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", "@types/node": "*", "bn.js": "^4.11.8", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index b00a76e55..61218b632 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "1.0.5", + "version": "2.0.0", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -42,9 +42,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.10", - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/migrations": "^1.0.11", + "@0xproject/abi-gen": "^1.0.11", + "@0xproject/dev-utils": "^1.0.10", + "@0xproject/migrations": "^1.0.12", "@0xproject/tslint-config": "^1.0.7", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", @@ -70,18 +70,18 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/base-contract": "^2.0.4", - "@0xproject/contract-wrappers": "^1.0.5", - "@0xproject/fill-scenarios": "^1.0.4", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@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", "bintrees": "^1.0.2", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-blockstream": "6.0.0", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index d933489b7..be80f8028 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -23,7 +23,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.9", + "@0xproject/dev-utils": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "@types/compare-versions": "^3.0.0", "copyfiles": "^2.0.0", @@ -33,8 +33,8 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/react-shared": "^1.0.11", - "@0xproject/utils": "^1.0.10", + "@0xproject/react-shared": "^1.0.12", + "@0xproject/utils": "^1.0.11", "@types/lodash": "4.14.104", "@types/material-ui": "^0.20.0", "@types/node": "*", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 9154c2bb6..9ffafc4ee 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -24,7 +24,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.9", + "@0xproject/dev-utils": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 841e2960c..9d1610180 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "1.1.4", + "version": "1.1.5", "engines": { "node": ">=6.12" }, @@ -41,7 +41,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.9", + "@0xproject/dev-utils": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", @@ -64,16 +64,16 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/sol-resolver": "^1.0.10", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@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", "@types/yargs": "^11.0.0", "chalk": "^2.3.0", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.5", "mkdirp": "^0.5.1", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 63b8f06d5..dff24181c 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "2.1.4", + "version": "2.1.5", "engines": { "node": ">=6.12" }, @@ -41,13 +41,13 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/dev-utils": "^1.0.9", - "@0xproject/sol-compiler": "^1.1.4", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", - "ethereum-types": "^1.0.7", + "@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", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", "istanbul": "^0.4.5", diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index caf7df3aa..535749bc6 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -30,8 +30,8 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", + "@0xproject/types": "^1.1.1", + "@0xproject/typescript-typings": "^2.0.2", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index c916765e2..6b73fb6e0 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -33,13 +33,13 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { - "@0xproject/assert": "^1.0.10", + "@0xproject/assert": "^1.0.11", "@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.1", - "@0xproject/utils": "^1.0.10", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", "chalk": "^2.3.0", "lodash": "^4.17.5", "newman": "^3.9.3", diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 0c5131848..f16711ea0 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-spec", - "version": "1.0.3", + "version": "1.0.4", "engines": { "node": ">=6.12" }, @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md", "dependencies": { - "@0xproject/json-schemas": "^1.0.3" + "@0xproject/json-schemas": "^1.0.4" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 6740a0743..d513c868b 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "2.0.4", + "version": "2.0.5", "engines": { "node": ">=6.12" }, @@ -28,11 +28,11 @@ } }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@0xproject/assert": "^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", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "@types/eth-lightwallet": "^3.0.0", @@ -41,7 +41,7 @@ "bip39": "^2.5.0", "bn.js": "^4.11.8", "eth-lightwallet": "^3.0.1", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "ganache-core": "0xProject/ganache-core#monorepo-dep", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index cfac1b018..a25924de5 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.48", + "version": "1.0.49", "engines": { "node": ">=6.12" }, @@ -17,13 +17,13 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^1.0.5", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "0x.js": "^1.0.6", + "@0xproject/subproviders": "^2.0.5", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", + "@0xproject/web3-wrapper": "^3.0.1", "body-parser": "^1.17.1", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "express": "^4.15.2", diff --git a/packages/types/package.json b/packages/types/package.json index f78368198..f5d57635d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "1.1.0", + "version": "1.1.1", "engines": { "node": ">=6.12" }, @@ -32,7 +32,7 @@ "dependencies": { "@types/node": "*", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.7" + "ethereum-types": "^1.0.8" }, "publishConfig": { "access": "public" diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 6f8b7e256..6db9b3160 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "2.0.1", + "version": "2.0.2", "engines": { "node": ">=6.12" }, @@ -26,7 +26,7 @@ "@types/bn.js": "^4.11.0", "@types/react": "*", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "popper.js": "1.14.3" }, "devDependencies": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 77d11c41c..1fd2f57fa 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -41,13 +41,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", + "@0xproject/types": "^1.1.1", + "@0xproject/typescript-typings": "^2.0.2", "@types/node": "*", "abortcontroller-polyfill": "^1.1.9", "bignumber.js": "~4.1.0", "detect-node": "2.0.3", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "isomorphic-fetch": "^2.2.1", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index f895296e9..cf0b186f2 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "3.0.0", + "version": "3.0.1", "engines": { "node": ">=6.12" }, @@ -53,11 +53,11 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.10", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "ethereum-types": "^1.0.7", + "@0xproject/assert": "^1.0.11", + "@0xproject/json-schemas": "^1.0.4", + "@0xproject/typescript-typings": "^2.0.2", + "@0xproject/utils": "^1.0.11", + "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/website/package.json b/packages/website/package.json index 67b2fb4ec..6adbbede0 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.51", + "version": "0.0.52", "engines": { "node": ">=6.12" }, @@ -19,22 +19,22 @@ "license": "Apache-2.0", "dependencies": { "0x.js": "^0.38.6", - "@0xproject/contract-wrappers": "^1.0.5", - "@0xproject/json-schemas": "^1.0.3", - "@0xproject/order-utils": "^1.0.4", - "@0xproject/react-docs": "^1.0.10", - "@0xproject/react-shared": "^1.0.11", - "@0xproject/subproviders": "^2.0.4", - "@0xproject/types": "^1.1.0", - "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.10", - "@0xproject/web3-wrapper": "^3.0.0", + "@0xproject/contract-wrappers": "^2.0.0", + "@0xproject/json-schemas": "^1.0.4", + "@0xproject/order-utils": "^1.0.5", + "@0xproject/react-docs": "^1.0.11", + "@0xproject/react-shared": "^1.0.12", + "@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", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", "bowser": "^1.9.3", "deep-equal": "^1.0.1", - "ethereum-types": "^1.0.7", + "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", "find-versions": "^2.0.0", "jsonschema": "^1.2.0", -- cgit v1.2.3 From 4ed932380455d63227f61a2a757aacb494faf656 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 13:19:01 +0200 Subject: Fix development flow --- packages/sra-spec/package.json | 4 ++-- packages/sra-spec/src/api.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 0c5131848..9f96a04fe 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -9,7 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "serve": "redoc-cli serve lib/api.json --watch", - "watch_without_deps": "run-p build-json:watch serve", + "watch_without_deps": "run-p build:watch serve", "lint": "tslint --project .", "test": "swagger-cli validate lib/api.json", "rebuild_and_test": "run-s clean build test", @@ -19,7 +19,7 @@ "clean": "shx rm -rf lib", "build": "tsc -b && yarn copy_md_files && yarn build-json", "build-json": "node ./lib/build_scripts/buildJson", - "build-json:watch": "chokidar 'src/**/*' -c 'yarn build-json' ", + "build:watch": "chokidar 'src/**/*' -c 'yarn build' ", "copy_md_files": "copyfiles -u 2 './src/md/**/*.md' ./lib/src/md", "deploy-site": "discharge deploy" }, diff --git a/packages/sra-spec/src/api.ts b/packages/sra-spec/src/api.ts index f80d343d8..7cecb0369 100644 --- a/packages/sra-spec/src/api.ts +++ b/packages/sra-spec/src/api.ts @@ -249,7 +249,7 @@ export const api: OpenApiSpec = { }, }, '/v2/order_config': { - get: { + post: { description: `Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: \`senderAddress\`, \`feeRecipientAddress\`, \`makerFee\`, \`takerFee\`. `, operationId: 'getOrderConfig', parameters: generateParameters([], false), -- cgit v1.2.3 From 5905fdb73ba87a9da7670a8f55fbf532ac5ec397 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 13:22:39 +0200 Subject: Fix erroneous ERC721 proxy id --- packages/sra-spec/src/md/introduction.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sra-spec/src/md/introduction.md b/packages/sra-spec/src/md/introduction.md index 6f733c9ab..f27186f41 100644 --- a/packages/sra-spec/src/md/introduction.md +++ b/packages/sra-spec/src/md/introduction.md @@ -180,7 +180,7 @@ The identifier for the Proxy uses a similar scheme to [ABI function selectors](h ```js // ERC20 Proxy ID 0xf47261b0 bytes4(keccak256('ERC20Token(address)')); -// ERC721 Proxy ID 0x08e937fa +// ERC721 Proxy ID 0x02571792 bytes4(keccak256('ERC721Token(address,uint256)')); ``` @@ -192,10 +192,10 @@ For example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15a 0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48 ``` -Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be: +Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x02571792) would be: ```bash -0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063 +0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063 ``` For more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html). -- cgit v1.2.3 From 2d8f423ceeabb535a2c333a5c6a593736959b68d Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 13:57:41 +0200 Subject: Update examples --- .../src/examples/relayerApiAssetDataPairsResponse.ts | 7 ++++--- packages/sra-spec/src/examples/relayerApiOrder.ts | 7 ++++--- .../sra-spec/src/examples/relayerApiOrderConfigPayload.ts | 7 ++++--- .../sra-spec/src/examples/relayerApiOrderbookResponse.ts | 14 ++++++++------ packages/sra-spec/src/examples/relayerApiOrdersResponse.ts | 7 ++++--- packages/sra-spec/src/examples/signedOrder.ts | 5 +++-- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts b/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts index 9eead5239..3ab7b29c0 100644 --- a/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts +++ b/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts @@ -8,13 +8,14 @@ export const relayerApiAssetDataPairsResponse = { minAmount: '0', maxAmount: '10000000000000000000', precision: 5, - assetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + assetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', }, assetDataB: { minAmount: '0', - maxAmount: '50000000000000000000', + maxAmount: '1', precision: 5, - assetData: '0x0257179264389b814a946f3e92105513705ca6b990', + assetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', }, }, ], diff --git a/packages/sra-spec/src/examples/relayerApiOrder.ts b/packages/sra-spec/src/examples/relayerApiOrder.ts index 31181d677..e3ae66dc3 100644 --- a/packages/sra-spec/src/examples/relayerApiOrder.ts +++ b/packages/sra-spec/src/examples/relayerApiOrder.ts @@ -5,13 +5,14 @@ export const relayerApiOrder = { feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', + takerAssetAmount: '1', makerFee: '100000000000000', takerFee: '200000000000000', expirationTimeSeconds: '1532560590', salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + makerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + takerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', }, diff --git a/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts b/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts index 5251d5b4d..cca68b84d 100644 --- a/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts +++ b/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts @@ -2,9 +2,10 @@ export const relayerApiOrderConfigPayload = { makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + takerAssetAmount: '1', + makerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + takerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', expirationTimeSeconds: '1532560590', }; diff --git a/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts b/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts index 40c09eff9..7f0772649 100644 --- a/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts +++ b/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts @@ -11,13 +11,14 @@ export const relayerApiOrderbookResponse = { feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', + takerAssetAmount: '1', makerFee: '100000000000000', takerFee: '200000000000000', expirationTimeSeconds: '1532560590', salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + makerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + takerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', }, @@ -37,13 +38,14 @@ export const relayerApiOrderbookResponse = { feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', makerAssetAmount: '20000000000000000', - takerAssetAmount: '10000000000000000', + takerAssetAmount: '1', makerFee: '200000000000000', takerFee: '100000000000000', expirationTimeSeconds: '1532560590', salt: '1532559225', - makerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - takerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + makerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', + takerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', signature: '0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891', }, diff --git a/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts b/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts index ac16e7e34..eb66b8e81 100644 --- a/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts +++ b/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts @@ -10,13 +10,14 @@ export const relayerApiOrdersResponse = { feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', + takerAssetAmount: '1', makerFee: '100000000000000', takerFee: '200000000000000', expirationTimeSeconds: '1532560590', salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + makerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + takerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', }, diff --git a/packages/sra-spec/src/examples/signedOrder.ts b/packages/sra-spec/src/examples/signedOrder.ts index 440566027..8513c398f 100644 --- a/packages/sra-spec/src/examples/signedOrder.ts +++ b/packages/sra-spec/src/examples/signedOrder.ts @@ -9,8 +9,9 @@ export const signedOrder = { takerFee: '200000000000000', expirationTimeSeconds: '1532560590', salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + makerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + takerAssetData: + '0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063', exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', }; -- cgit v1.2.3 From e5e439adb9d1ff4395c0ff42ac3a310783b3bd22 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 14:01:51 +0200 Subject: Change /order_config endpoint to POST --- packages/connect/src/http_client.ts | 2 +- packages/connect/test/http_client_test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index 8a68d6c23..bbd0d2042 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -149,7 +149,7 @@ export class HttpClient implements Client { params: requestOpts, payload: request, }; - const responseJson = await this._requestAsync('/order_config', HttpRequestType.Get, httpRequestOpts); + const responseJson = await this._requestAsync('/order_config', HttpRequestType.Post, httpRequestOpts); const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson); return fees; } diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 83b77021a..e9fc9372e 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -148,12 +148,12 @@ describe('HttpClient', () => { }; const url = `${relayUrl}/order_config`; it('gets order config', async () => { - fetchMock.get(url, orderConfigResponseJSON); + fetchMock.post(url, orderConfigResponseJSON); const fees = await relayerClient.getOrderConfigAsync(request); expect(fees).to.be.deep.equal(orderConfigResponse); }); it('does not mutate input', async () => { - fetchMock.get(url, orderConfigResponseJSON); + fetchMock.post(url, orderConfigResponseJSON); const makerAssetAmountBefore = request.makerAssetAmount; const takerAssetAmountBefore = request.takerAssetAmount; const expirationTimeSecondsBefore = request.expirationTimeSeconds; @@ -163,7 +163,7 @@ describe('HttpClient', () => { expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds); }); it('throws an error for invalid JSON response', async () => { - fetchMock.get(url, { test: 'dummy' }); + fetchMock.post(url, { test: 'dummy' }); expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected(); }); }); -- cgit v1.2.3 From f15751d800d813e97b72a861547a9caa1d0d5e56 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 14:06:53 +0200 Subject: Add to changelog --- packages/connect/CHANGELOG.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 9de956d4d..4106be881 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "3.0.0", + "changes": [ + { + "note": "Change /order_config request to a POST instead of GET", + "pr": 1091 + } + ] + }, { "timestamp": 1537907159, "version": "2.0.4", -- cgit v1.2.3 From f33ecfd2fcff106c673c5f96350e12f831b3295f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 26 Sep 2018 13:11:12 +0100 Subject: Support passing in package names into publish_release_notes command-line for when publishing must be done manually --- .../monorepo-scripts/src/publish_release_notes.ts | 20 ++++++++++++++++---- packages/monorepo-scripts/src/utils/utils.ts | 7 +++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts index a9bc8fe75..101ac87b4 100644 --- a/packages/monorepo-scripts/src/publish_release_notes.ts +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -1,3 +1,4 @@ +import * as _ from 'lodash'; import * as yargs from 'yargs'; import { publishReleaseNotesAsync } from './utils/github_release_utils'; @@ -9,14 +10,25 @@ const args = yargs type: 'boolean', demandOption: true, }) - .example('$0 --isDryRun true', 'Full usage example').argv; + .option('packages', { + describe: + 'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages', + type: 'string', + }) + .example('$0 --isDryRun true --packages "0x.js @0xproject/web3-wrapper"', 'Full usage example').argv; (async () => { const isDryRun = args.isDryRun; - const shouldIncludePrivate = false; - const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); + let packages; + if (_.isUndefined(args.packages)) { + const shouldIncludePrivate = false; + packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); + } else { + const packageNames = args.packages.split(' '); + packages = await utils.getPackagesByNameAsync(packageNames); + } - await publishReleaseNotesAsync(allUpdatedPackages, isDryRun); + await publishReleaseNotesAsync(packages, isDryRun); process.exit(0); })().catch(err => { utils.log(err); diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 2ce36942c..5e2e877c7 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -54,6 +54,13 @@ export const utils = { } return packages; }, + async getPackagesByNameAsync(packageNames: string[]): Promise { + const allPackages = utils.getPackages(constants.monorepoRootPath); + const updatedPackages = _.filter(allPackages, pkg => { + return _.includes(packageNames, pkg.packageJson.name); + }); + return updatedPackages; + }, async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise { const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate); const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name); -- cgit v1.2.3 From f8532b3f51a5bb4f4294606c495321a82d71c69d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 26 Sep 2018 13:15:42 +0100 Subject: Typo --- packages/monorepo-scripts/src/publish_release_notes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts index 101ac87b4..6090498e0 100644 --- a/packages/monorepo-scripts/src/publish_release_notes.ts +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -12,7 +12,7 @@ const args = yargs }) .option('packages', { describe: - 'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages', + 'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages.', type: 'string', }) .example('$0 --isDryRun true --packages "0x.js @0xproject/web3-wrapper"', 'Full usage example').argv; -- cgit v1.2.3 From 0ce6f03ed50820022d7534ae257306bbf2f17fc1 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 26 Sep 2018 09:14:28 -0400 Subject: fix: disable tslint max-file-line-count... before, tslint was saying "ERROR: /home/gene/0x-monorepo/packages/types/src/index.ts[598, 2]: This file has 599 lines, which exceeds the maximum of 500 lines allowed. Consider breaking this file up into smaller parts." https://github.com/0xProject/0x-monorepo/pull/1004#issuecomment-424704651 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/types/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index dddc785b7..5ef8b54a4 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,3 +1,5 @@ +// tslint:disable:max-file-line-count + import { BigNumber } from 'bignumber.js'; import { ContractAbi } from 'ethereum-types'; -- cgit v1.2.3 From 2bdaa58d71fb1e62fd07e6bf1be56d841446090b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 26 Sep 2018 09:22:06 -0400 Subject: fix: use latest versions of @0xproject packages --- packages/sol-doc/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index cd0e5bbf0..618cb7ef7 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -24,9 +24,9 @@ "author": "F. Eugene Aumson", "license": "Apache-2.0", "dependencies": { - "@0xproject/sol-compiler": "^1.1.4", - "@0xproject/types": "^1.1.0", - "@0xproject/utils": "^1.0.10", + "@0xproject/sol-compiler": "^1.1.5", + "@0xproject/types": "^1.1.1", + "@0xproject/utils": "^1.0.11", "ethereum-types": "^1.0.4", "lodash": "^4.17.10", "yargs": "^12.0.2" -- cgit v1.2.3 From 3f61d27656cdeee0baa6bd730ee33c2dcf36ce7e Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 26 Sep 2018 11:28:53 -0400 Subject: fix: add bin file for sol-doc cli --- packages/sol-doc/bin/sol-doc.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 packages/sol-doc/bin/sol-doc.js diff --git a/packages/sol-doc/bin/sol-doc.js b/packages/sol-doc/bin/sol-doc.js new file mode 100755 index 000000000..35c9ae735 --- /dev/null +++ b/packages/sol-doc/bin/sol-doc.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../lib/src/cli.js'); -- cgit v1.2.3 From d6090921a89ffbb5fc0ed8f51bc0d51dd901234b Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 17:55:40 +0200 Subject: Update everything to Coinbase Wallet instead of Toshi --- .../website/public/images/coinbase_wallet_logo.png | Bin 0 -> 103648 bytes packages/website/ts/blockchain.ts | 2 +- .../onboarding/install_wallet_onboarding_step.tsx | 4 +- .../website/ts/components/wallet/body_overlay.tsx | 6 +-- packages/website/ts/types.ts | 2 +- packages/website/ts/utils/constants.ts | 6 +-- packages/website/ts/utils/utils.ts | 10 ++-- yarn.lock | 55 ++++++++++++++++++++- 8 files changed, 69 insertions(+), 16 deletions(-) create mode 100644 packages/website/public/images/coinbase_wallet_logo.png diff --git a/packages/website/public/images/coinbase_wallet_logo.png b/packages/website/public/images/coinbase_wallet_logo.png new file mode 100644 index 000000000..04c1b7290 Binary files /dev/null and b/packages/website/public/images/coinbase_wallet_logo.png differ diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 632a63016..c420bbf3a 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -66,7 +66,7 @@ const providerToName: { [provider: string]: string } = { [Providers.Metamask]: constants.PROVIDER_NAME_METAMASK, [Providers.Parity]: constants.PROVIDER_NAME_PARITY_SIGNER, [Providers.Mist]: constants.PROVIDER_NAME_MIST, - [Providers.Toshi]: constants.PROVIDER_NAME_TOSHI, + [Providers.CoinbaseWallet]: constants.PROVIDER_NAME_COINBASE_WALLET, [Providers.Cipher]: constants.PROVIDER_NAME_CIPHER, }; diff --git a/packages/website/ts/components/onboarding/install_wallet_onboarding_step.tsx b/packages/website/ts/components/onboarding/install_wallet_onboarding_step.tsx index d618c8318..1035d4ad9 100644 --- a/packages/website/ts/components/onboarding/install_wallet_onboarding_step.tsx +++ b/packages/website/ts/components/onboarding/install_wallet_onboarding_step.tsx @@ -12,7 +12,7 @@ export const InstallWalletOnboardingStep: React.StatelessComponent First, you need to connect to a wallet. This will be used across all 0x relayers and dApps. @@ -21,7 +21,7 @@ export const InstallWalletOnboardingStep: React.StatelessComponent diff --git a/packages/website/ts/components/wallet/body_overlay.tsx b/packages/website/ts/components/wallet/body_overlay.tsx index 26359d0d2..3795f0eaa 100644 --- a/packages/website/ts/components/wallet/body_overlay.tsx +++ b/packages/website/ts/components/wallet/body_overlay.tsx @@ -13,7 +13,7 @@ import { AccountState, ProviderType } from 'ts/types'; import { utils } from 'ts/utils/utils'; const METAMASK_IMG_SRC = '/images/metamask_icon.png'; -const TOSHI_IMG_SRC = '/images/toshi_logo.jpg'; +const COINBASE_WALLET_IMG_SRC = '/images/coinbase_wallet_logo.png'; export interface BodyOverlayProps { dispatcher: Dispatcher; @@ -116,8 +116,8 @@ const UseDifferentWallet = (props: UseDifferentWallet) => { const GetWalletCallToAction = () => { const [downloadLink, isOnMobile] = utils.getBestWalletDownloadLinkAndIsMobile(); - const imageUrl = isOnMobile ? TOSHI_IMG_SRC : METAMASK_IMG_SRC; - const text = isOnMobile ? 'Get Toshi Wallet' : 'Get MetaMask Wallet'; + const imageUrl = isOnMobile ? COINBASE_WALLET_IMG_SRC : METAMASK_IMG_SRC; + const text = isOnMobile ? 'Get Coinbase Wallet' : 'Get MetaMask Wallet'; return ( Date: Wed, 26 Sep 2018 17:56:09 +0200 Subject: Change clay to Ecosystem Development Lead --- packages/website/ts/pages/about/about.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index 75295349d..e097578bc 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -194,7 +194,7 @@ const teamRow6: ProfileInfo[] = [ const teamRow7: ProfileInfo[] = [ { name: 'Clay Robbins', - title: 'Business Development Lead', + title: 'Ecosystem Development Lead', description: `Growth & Business Development. Previously product and partnerships at Square. Economics at Dartmouth College.`, image: 'images/team/clay.png', linkedIn: 'https://www.linkedin.com/in/robbinsclay/', -- cgit v1.2.3 From 48f6452c3b3540e2655868d854c200a12460e188 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 26 Sep 2018 17:58:48 +0200 Subject: remove items-center classname --- packages/website/ts/components/portal/portal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index b8d7ceea9..b42954f60 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -545,7 +545,7 @@ export class Portal extends React.Component {
} body={ - + {isMobile && ( {this._renderStartOnboarding()} -- cgit v1.2.3 From 1402119c840dcb634efd99c02e76007ed013b54a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 26 Sep 2018 22:48:08 +0100 Subject: Remove RC version warnings --- packages/website/md/docs/connect/2.0.0/introduction.md | 2 -- packages/website/md/docs/contract_wrappers/introduction.md | 2 -- packages/website/md/docs/json_schemas/1.0.0/introduction.md | 2 -- 3 files changed, 6 deletions(-) diff --git a/packages/website/md/docs/connect/2.0.0/introduction.md b/packages/website/md/docs/connect/2.0.0/introduction.md index de7ece7ae..8e251b327 100644 --- a/packages/website/md/docs/connect/2.0.0/introduction.md +++ b/packages/website/md/docs/connect/2.0.0/introduction.md @@ -1,3 +1 @@ -**NOTE:** Release candidate versions are meant to work with V2 of the Standard Relayer API. To interact with V1, select a 1.X version of connect. - Welcome to the [0x Connect](https://github.com/0xProject/0x-monorepo/tree/development/packages/connect) documentation! 0x Connect is a Javascript library that makes it easy to interact with relayers that conform to the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api). Functionality includes getting supported asset pairs from a relayer, getting orders filtered by different attributes, getting individual orders specified by order hash, getting orderbooks for specific asset pairs, getting fee information, and submitting orders. diff --git a/packages/website/md/docs/contract_wrappers/introduction.md b/packages/website/md/docs/contract_wrappers/introduction.md index 74254bdad..ccc81b373 100644 --- a/packages/website/md/docs/contract_wrappers/introduction.md +++ b/packages/website/md/docs/contract_wrappers/introduction.md @@ -1,3 +1 @@ -**NOTE:** Release candidate versions are meant to work with V2 of 0x protocol. To interact with V1, select a 0.X version. - Welcome to the [Contract-wrappers](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract-wrappers) documentation! Contract-wrappers is a library for interacting with the Ethereum smart contracts that make up the 0x protocol. With it, you can easily send transactions and make calls to the 0x smart contracts as well as any token adhering to the token standards supported by the protocol (currently ERC20 & ERC721). diff --git a/packages/website/md/docs/json_schemas/1.0.0/introduction.md b/packages/website/md/docs/json_schemas/1.0.0/introduction.md index cc777b1a8..a27f4b521 100644 --- a/packages/website/md/docs/json_schemas/1.0.0/introduction.md +++ b/packages/website/md/docs/json_schemas/1.0.0/introduction.md @@ -1,5 +1,3 @@ -**NOTE:** Release candidate versions are meant to work with V2 of 0x protocol. To interact with V1, select a 0.X version. - Welcome to the [@0xproject/json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas) documentation! This package provides JSON schemas for validating 0x Protocol & Standard Relayer API data structures. It provides both the raw JSON schemas and a schema validator class to interact with them from a JS project. If you are not using a Javascript-based language for your project, you can copy-paste the JSON schemas within this package and use them together with a [JSON Schema](http://json-schema.org/) implementation in your [language of choice](http://json-schema.org/implementations.html) (e.g Python, Haskell, Go, C, C++, Rust, Ruby, Scala, etc...). -- cgit v1.2.3 From 0591f1d32a4696924d9b063b09ec8a373e6757c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 10:03:54 +0100 Subject: Add address normalization to isValidECSignature method --- packages/order-utils/CHANGELOG.json | 10 ++++++++++ packages/order-utils/src/signature_utils.ts | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 1162bbc83..2927373d6 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,14 @@ [ + { + "version": "1.0.6", + "changes": [ + { + "note": + "Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address", + "pr": 1094 + } + ] + }, { "timestamp": 1537907159, "version": "1.0.5", diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index c0c9e71a7..3b656d3fc 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -174,6 +174,7 @@ export const signatureUtils = { assert.isHexString('data', data); assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema); assert.isETHAddressHex('signerAddress', signerAddress); + const normalizedSignerAddress = signerAddress.toLowerCase(); const msgHashBuff = ethUtil.toBuffer(data); try { @@ -184,7 +185,8 @@ export const signatureUtils = { ethUtil.toBuffer(signature.s), ); const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey)); - return retrievedAddress === signerAddress; + const normalizedRetrievedAddress = retrievedAddress.toLowerCase(); + return normalizedRetrievedAddress === normalizedSignerAddress; } catch (err) { return false; } -- cgit v1.2.3 From 6f02a3f40dde86c6968bf40e7eeda2d206f606f8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 10:05:04 +0100 Subject: Fix PR nr --- packages/order-utils/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 2927373d6..31ba68e23 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -5,7 +5,7 @@ { "note": "Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address", - "pr": 1094 + "pr": 1096 } ] }, -- cgit v1.2.3 From cb99ebf78aad869e61ec2ca7c48bb25178274ec5 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 11:21:39 +0200 Subject: Throw revert reasons from contract wrappers --- packages/base-contract/CHANGELOG.json | 4 ++++ packages/base-contract/src/index.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index fba072011..b97bc00e0 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Change the way we detect BN to work with the newest ethers.js", "pr": 1069 + }, + { + "note": "Add baseContract._throwIfRevertWithReasonCallResult", + "pr": 1069 } ] }, diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 90e576c24..538c87431 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -20,6 +20,10 @@ export interface EthersInterfaceByFunctionSignature { [key: string]: ethers.Interface; } +const REVERT_ERROR_SELECTOR = '08c379a0'; +const REVERT_ERROR_SELECTOR_OFFSET = 2; +const REVERT_ERROR_SELECTOR_END = 10; + export class BaseContract { protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature; protected _web3Wrapper: Web3Wrapper; @@ -82,6 +86,15 @@ export class BaseContract { } return txDataWithDefaults; } + protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void { + if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) { + const revertReason = ethers.utils.defaultAbiCoder.decode( + ['string'], + ethers.utils.hexDataSlice(rawCallResult, 4), + ); + throw new Error(revertReason); + } + } // Throws if the given arguments cannot be safely/correctly encoded based on // the given inputAbi. An argument may not be considered safely encodeable // if it overflows the corresponding Solidity type, there is a bug in the -- cgit v1.2.3 From 60971be35af8c64e70589c0ae3bdd5739c2ceb46 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 11:21:47 +0200 Subject: Throw revert reasons from contract wrappers --- packages/contract_templates/partials/callAsync.handlebars | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index dd1b90212..ddbbe7508 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -19,6 +19,7 @@ async callAsync( self._web3Wrapper.getContractDefaults(), ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); let resultArray = ethersFunction.decode(rawCallResult); const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); -- cgit v1.2.3 From a51919db0e2414dc345f55ce7ad4fc50286dfd19 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 11:24:03 +0200 Subject: Remove ethers.js carret as it's a beta version --- packages/0x.js/package.json | 2 +- packages/base-contract/package.json | 2 +- packages/contract-wrappers/package.json | 2 +- packages/contracts/package.json | 2 +- packages/fill-scenarios/package.json | 2 +- packages/metacoin/package.json | 2 +- packages/migrations/package.json | 2 +- packages/order-utils/package.json | 2 +- packages/order-watcher/package.json | 2 +- packages/utils/package.json | 2 +- packages/web3-wrapper/package.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 67cb0d5af..16650be3f 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -84,7 +84,7 @@ "@0xproject/utils": "^1.0.11", "@0xproject/web3-wrapper": "^3.0.1", "ethereum-types": "^1.0.8", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5", "web3-provider-engine": "14.0.6" }, diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index b4047691c..b87092e49 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -44,7 +44,7 @@ "@0xproject/utils": "^1.0.11", "@0xproject/web3-wrapper": "^3.0.1", "ethereum-types": "^1.0.8", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index e30bf079c..1deb6a425 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -84,7 +84,7 @@ "ethereum-types": "^1.0.8", "ethereumjs-blockstream": "6.0.0", "ethereumjs-util": "^5.1.1", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "js-sha3": "^0.7.0", "lodash": "^4.17.5", "uuid": "^3.1.0" diff --git a/packages/contracts/package.json b/packages/contracts/package.json index a6e7af0ac..5cc239ae7 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -83,7 +83,7 @@ "ethereum-types": "^1.0.8", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "js-combinatorics": "^0.5.3", "lodash": "^4.17.5" } diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 60b99e8fe..7b551f790 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -44,7 +44,7 @@ "@0xproject/utils": "^1.0.11", "@0xproject/web3-wrapper": "^3.0.1", "ethereum-types": "^1.0.8", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 0940ddfe3..2c05be45e 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -40,7 +40,7 @@ "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", "ethereum-types": "^1.0.8", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5", "run-s": "^0.0.0" }, diff --git a/packages/migrations/package.json b/packages/migrations/package.json index e7e08d132..50cd1a2d0 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -53,7 +53,7 @@ "@0xproject/web3-wrapper": "^3.0.1", "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^1.0.8", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "optionalDependencies": { diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 64f1c9d66..7307f161d 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -69,7 +69,7 @@ "ethereum-types": "^1.0.8", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 8c0ec87e0..001f6c048 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -83,7 +83,7 @@ "bintrees": "^1.0.2", "ethereum-types": "^1.0.8", "ethereumjs-blockstream": "6.0.0", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 8b9161ce7..db265dd8f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -49,7 +49,7 @@ "detect-node": "2.0.3", "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "isomorphic-fetch": "^2.2.1", "js-sha3": "^0.7.0", "lodash": "^4.17.5" diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 319360409..4c6e545a9 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -59,7 +59,7 @@ "@0xproject/utils": "^1.0.11", "ethereum-types": "^1.0.8", "ethereumjs-util": "^5.1.1", - "ethers": "^4.0.0-beta.14", + "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" }, "publishConfig": { -- cgit v1.2.3 From 63d79faa85df1cc090837fc49befb5076b50203b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 11:51:11 +0200 Subject: Fix linter errors --- packages/base-contract/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 538c87431..981e6fca6 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -22,7 +22,8 @@ export interface EthersInterfaceByFunctionSignature { const REVERT_ERROR_SELECTOR = '08c379a0'; const REVERT_ERROR_SELECTOR_OFFSET = 2; -const REVERT_ERROR_SELECTOR_END = 10; +const REVERT_ERROR_SELECTOR_BYTES_LENGTH = 4; +const REVERT_ERROR_SELECTOR_END = REVERT_ERROR_SELECTOR_OFFSET + REVERT_ERROR_SELECTOR_BYTES_LENGTH * 2; export class BaseContract { protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature; @@ -90,7 +91,7 @@ export class BaseContract { if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) { const revertReason = ethers.utils.defaultAbiCoder.decode( ['string'], - ethers.utils.hexDataSlice(rawCallResult, 4), + ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH), ); throw new Error(revertReason); } -- cgit v1.2.3 From c55a41917851e66e3803883cf10b1e336e2dfc21 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 10:57:42 +0100 Subject: Split _genMethodDoc into it and _genFallbackDoc for clarity. Add isFallback boolean --- packages/sol-doc/src/solidity_doc_generator.ts | 54 +++++++++++++++----------- packages/types/src/index.ts | 1 + 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 5ddf001a6..d2fb5b083 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -117,8 +117,10 @@ function _genDocSection(compiledContract: StandardContractOutput, contractName: // that's because the type of the events array doesn't have any fields for documentation! break; case 'function': + docSection.methods.push(_genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); + break; case 'fallback': - docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc)); + docSection.methods.push(_genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc)); break; default: throw new Error( @@ -173,39 +175,47 @@ function _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); - +function _genFallbackDoc(abiDefinition: FallbackAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { + const methodSignature = `${name}()`; 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: { name: 'void', typeDocType: TypeDocTypes.Intrinsic }, + returnComment, + isConstant: true, + isPayable: abiDefinition.payable, + isFallback: true, + comment, + }; + return methodDoc; +} + +function _genMethodDoc(abiDefinition: MethodAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { + const { parameters, methodSignature } = _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists); + const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); + const returnType = _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists); + const returnComment = + _.isUndefined(devdocIfExists) || _.isUndefined(devdocIfExists.methods[methodSignature]) + ? undefined + : devdocIfExists.methods[methodSignature].return; const methodDoc: SolidityMethod = { isConstructor: false, - name, + name: abiDefinition.name, callPath: '', parameters, returnType, returnComment, - isConstant, + isConstant: abiDefinition.constant, isPayable: abiDefinition.payable, comment, }; @@ -254,7 +264,7 @@ function _genMethodParamsDoc( for (const abiParam of abiParams) { const parameter: Parameter = { name: abiParam.name, - comment: '', + comment: '', isOptional: false, // Unsupported in Solidity, until resolution of https://github.com/ethereum/solidity/issues/232 type: { name: abiParam.type, typeDocType: TypeDocTypes.Intrinsic }, }; @@ -288,7 +298,7 @@ function _genMethodReturnTypeDoc( devdocIfExists: DevdocOutput | undefined, ): Type { const methodReturnTypeDoc: Type = { - name: '', + name: 'void', typeDocType: TypeDocTypes.Intrinsic, tupleElements: undefined, }; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 5ef8b54a4..3ae0536d5 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -519,6 +519,7 @@ export interface TypescriptFunction extends BaseFunction { export interface SolidityMethod extends BaseMethod { isConstant?: boolean; isPayable?: boolean; + isFallback?: boolean; } export interface Source { -- cgit v1.2.3 From 51bfd1ca5e481f7d89d5b5fc805d46ab681b5366 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 12:48:48 +0200 Subject: Export ExpirationWatcher from OrderWatcher --- packages/order-watcher/CHANGELOG.json | 8 ++++++++ packages/order-watcher/src/index.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index fc7037bfb..ea7555ee4 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "2.1.0", + "changes": [ + { + "note": "Export ExpirationWatcher" + } + ] + }, { "version": "2.0.0", "changes": [ diff --git a/packages/order-watcher/src/index.ts b/packages/order-watcher/src/index.ts index 8efca6217..d7ad4fba7 100644 --- a/packages/order-watcher/src/index.ts +++ b/packages/order-watcher/src/index.ts @@ -1,4 +1,5 @@ export { OrderWatcher } from './order_watcher/order_watcher'; +export { ExpirationWatcher } from './order_watcher/expiration_watcher'; export { OrderStateValid, -- cgit v1.2.3 From bc48bc99c37d7f7cb5188a7f6a777db1a6a2e504 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 27 Sep 2018 12:53:05 +0200 Subject: Add PR number --- packages/order-watcher/CHANGELOG.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index ea7555ee4..3abd67fda 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -3,7 +3,8 @@ "version": "2.1.0", "changes": [ { - "note": "Export ExpirationWatcher" + "note": "Export ExpirationWatcher", + "pr": 1097 } ] }, -- cgit v1.2.3 From 5cc11912a70f33112983736197d20de941f18137 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 18:39:27 +0100 Subject: Pull in only contracts we want rendered on the doc page --- packages/sol-doc/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 618cb7ef7..873540215 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -13,7 +13,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/" }, -- cgit v1.2.3 From c0498944c38e827dc69f369dd1427df43b23c9a9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 18:40:38 +0100 Subject: Add more robust key --- packages/react-docs/src/components/documentation.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 3cd14923c..55aa1587e 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -10,6 +10,7 @@ import { utils as sharedUtils, } from '@0xproject/react-shared'; import { + CustomType, DocAgnosticFormat, Event, ExternalExportToLink, @@ -218,11 +219,11 @@ export class Documentation extends React.Component { + const typeDefs = _.map(sortedTypes, (customType: CustomType, i: number) => { return ( Date: Thu, 27 Sep 2018 18:51:30 +0100 Subject: Add typeSectionName to docsInfo so we don't use hard-coded "Types" --- packages/react-docs/src/components/documentation.tsx | 2 +- packages/react-docs/src/docs_info.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 55aa1587e..f1cb32b68 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -266,7 +266,7 @@ export class Documentation extends React.Component
- +
{this._renderNetworkBadgesIfExists(sectionName)}
diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index 6355a2f88..bf6aa07a7 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -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; @@ -86,8 +88,8 @@ export class DocsInfo { return {}; } - const typeDocSection = docAgnosticFormat[this.sections.types]; - const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any; + const section = docAgnosticFormat[this.sections.types]; + const typeDefinitionByName = _.keyBy(section.types, 'name') as any; return typeDefinitionByName; } } -- cgit v1.2.3 From ceff5c9c2b0af9506ac281febf7fd487c05650d7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 18:52:14 +0100 Subject: Rename for clarity --- packages/website/ts/pages/documentation/doc_page.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 6f029b6a2..87a806b2b 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -146,9 +146,9 @@ export class DocPage extends React.Component { docAgnosticFormat = versionDocObj as DocAgnosticFormat; // HACK: need to modify docsInfo like convertToDocAgnosticFormat() would do this.props.docsInfo.menu.Contracts = []; - _.each(docAgnosticFormat, (docObj, contractName) => { - this.props.docsInfo.sections[contractName] = contractName; - this.props.docsInfo.menu.Contracts.push(contractName); + _.each(docAgnosticFormat, (_docObj, sectionName) => { + this.props.docsInfo.sections[sectionName] = sectionName; + this.props.docsInfo.menu.Contracts.push(sectionName); }); } -- cgit v1.2.3 From e7b1374f23bfe098457b94ae51fac920aab6167b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 18:52:37 +0100 Subject: Fix dropdown menu item so it says "0x smart contracts" not "smart contract" --- packages/website/ts/components/top_bar/top_bar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index bb61e4fb9..7cf3c6ecb 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -136,7 +136,7 @@ export class TopBar extends React.Component { , -- cgit v1.2.3 From 63ffdb3895caa641881eecf21563a667f6d8b605 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 18:52:51 +0100 Subject: Improve key --- packages/react-docs/src/components/interface.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index 9f0800d71..cad7d6c46 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -20,9 +20,9 @@ export interface InterfaceProps { export const Interface: React.SFC = (props: InterfaceProps): any => { const type = props.type; - const properties = _.map(type.children, property => { + const properties = _.map(type.children, (property, i) => { return ( - + {property.name}:{' '} {property.type && !_.isUndefined(property.type.method) ? ( Date: Thu, 27 Sep 2018 18:55:01 +0100 Subject: Render fallback functions better --- packages/react-docs/src/components/signature.tsx | 4 +++- packages/react-docs/src/components/signature_block.tsx | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index a690a1f03..aa174042c 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -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 = (props: SignatureProps) => { @@ -75,7 +77,7 @@ export const Signature: React.SFC = (props: SignatureProps) => { return ( {props.callPath} - {methodName} + {props.isFallback ? '' : methodName} {typeParameterIfExists}({hasMoreThenTwoParams &&
} {paramStringArray}) {props.returnType && ( diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 1ea0ea28c..fc4db10ad 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -50,6 +50,7 @@ export class SignatureBlock extends React.Component @@ -84,6 +86,7 @@ export class SignatureBlock extends React.Component {(method as TypescriptMethod).source && ( @@ -114,9 +117,9 @@ export class SignatureBlock extends React.Component ); } - private _renderChip(text: string): React.ReactNode { + private _renderChip(text: string, backgroundColor: string = colors.lightBlueA700): React.ReactNode { return ( -
+
{text}
); -- cgit v1.2.3 From a6672e0190573c65f2c36e303d49f0389f5a9a26 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 19:43:10 +0100 Subject: Don't render colon for auto-generated getters --- packages/react-docs/src/components/signature.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index aa174042c..266bfe3dd 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -118,9 +118,14 @@ function renderParameters( /> ); return ( - + + {!_.isEmpty(p.name) && ( + {p.name} - {isOptional && '?'}: {type} + {isOptional && '?'}:{' '} + + )} + {type} {hasDefaultValue && ` = ${p.defaultValue}`} ); -- cgit v1.2.3 From cfddea931dedb77a88507517957e19350e9348b8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 19:49:07 +0100 Subject: Make sure basic solidity types are colored orange --- packages/react-docs/src/components/type.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 156a3496d..b7a94483e 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -13,6 +13,7 @@ import { Signature } from './signature'; import { TypeDefinition } from './type_definition'; const basicJsTypes = ['string', 'number', 'undefined', 'null', 'boolean']; +const basicSolidityTypes = ['bytes', 'bytes4', 'uint256', 'address']; const defaultProps = {}; @@ -80,7 +81,7 @@ export const Type: React.SFC = (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; -- cgit v1.2.3 From ac04dbf7e4f04ae4e0a6e9cce5232339597493ed Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 19:50:02 +0100 Subject: Re-use interface component for rendering structs but label it differently --- packages/react-docs/src/components/type_definition.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx index 09cb3ff74..9a3e50a1b 100644 --- a/packages/react-docs/src/components/type_definition.tsx +++ b/packages/react-docs/src/components/type_definition.tsx @@ -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 Date: Thu, 27 Sep 2018 23:00:01 +0100 Subject: Improve keys --- packages/react-docs/src/components/signature.tsx | 6 ++++-- packages/react-docs/src/components/signature_block.tsx | 6 +++--- packages/react-docs/src/components/type.tsx | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 266bfe3dd..1f3dd0ee8 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -36,6 +36,7 @@ export const Signature: React.SFC = (props: SignatureProps) => { props.docsInfo, sectionName, props.isInPopover, + props.name, props.typeDefinitionByName, ); const paramStringArray: any[] = []; @@ -103,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 = ( @@ -121,7 +123,7 @@ function renderParameters( {!_.isEmpty(p.name) && ( - {p.name} + {p.name} {isOptional && '?'}:{' '} )} diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index fc4db10ad..1e3de3e58 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -124,12 +124,12 @@ export class SignatureBlock extends React.Component ); } - 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 (
diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index b7a94483e..8ff2fa3cc 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -169,10 +169,10 @@ export const Type: React.SFC = (props: TypeProps): any => { break; case TypeDocTypes.Tuple: - const tupleTypes = _.map(type.tupleElements, t => { + const tupleTypes = _.map(type.tupleElements, (t, i) => { return ( = (props: TypeProps): any => { const id = Math.random().toString(); const typeDefinitionAnchorId = isExportedClassReference ? props.type.name - : `${constants.TYPES_SECTION_NAME}-${typeName}`; + : `${props.docsInfo.typeSectionName}-${typeName}`; typeName = ( Date: Thu, 27 Sep 2018 23:00:25 +0100 Subject: Only show arguments if the params are named (i.e not generated getters) --- packages/react-docs/src/components/signature_block.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 1e3de3e58..cad72daf4 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -32,7 +32,6 @@ export interface SignatureBlockState { const styles: Styles = { chip: { fontSize: 13, - backgroundColor: colors.lightBlueA700, color: colors.white, height: 11, borderRadius: 14, @@ -51,6 +50,7 @@ export class SignatureBlock extends React.Component !_.isEmpty(p.name))); return (
} {method.parameters && - !_.isEmpty(method.parameters) && ( + !_.isEmpty(method.parameters) && + onlyHasNamedParameters && (

ARGUMENTS

- {this._renderParameterDescriptions(method.parameters)} + {this._renderParameterDescriptions(method.parameters, method.name)}
)} {method.returnComment && ( -- cgit v1.2.3 From d4077ae970205f0e41519f95ec5a7ba29cdd105b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:01:12 +0100 Subject: Fix linter --- packages/sol-doc/src/solidity_doc_generator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index d2fb5b083..b7b428259 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -117,10 +117,10 @@ function _genDocSection(compiledContract: StandardContractOutput, contractName: // that's because the type of the events array doesn't have any fields for documentation! break; case 'function': - docSection.methods.push(_genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); + docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc)); break; case 'fallback': - docSection.methods.push(_genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc)); + docSection.methods.push(_genFallbackDoc(abiDefinition, compiledContract.devdoc)); break; default: throw new Error( -- cgit v1.2.3 From 957af23a6422d4010bfa6e3e60e1a8e161a50216 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:02:12 +0100 Subject: Include structs section so that we can render struct params/return values properly with a popover --- packages/sol-doc/package.json | 3 +- packages/sol-doc/src/solidity_doc_generator.ts | 235 ++++++++++++++++++++++--- yarn.lock | 2 +- 3 files changed, 213 insertions(+), 27 deletions(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 873540215..3b7362b3f 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -29,7 +29,8 @@ "@0xproject/utils": "^1.0.11", "ethereum-types": "^1.0.4", "lodash": "^4.17.10", - "yargs": "^12.0.2" + "yargs": "^12.0.2", + "ethereumjs-util": "^5.1.1" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index b7b428259..c70f54d5f 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -1,7 +1,5 @@ import * as path from 'path'; -import * as _ from 'lodash'; - import { AbiDefinition, ConstructorAbi, @@ -13,9 +11,13 @@ import { 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, @@ -26,6 +28,19 @@ import { TypeDocTypes, } from '@0xproject/types'; +// Unforunately, the only way to currently retrieve the declared structs with Solidity contracts +// is to tease it out of the params/return values included in it's ABI. These structures do +// not include the structs actual name, so we needed 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. +const customTypeHashToName: { [hash: string]: string } = { + '52d4a768701076c7bac06e386e430883975eb398732eccba797fd09dd064a60e': 'Order', + '46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResult', + c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo', + c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo', + '07c2bddc165e0b5005e6244dd4a9771fa61c78c4f42abd687d57567b0768136c': 'MatchedFillResult', +}; + /** * Invoke the Solidity compiler and transform its ABI and devdoc outputs into a * JSON format easily consumed by documentation rendering tools. @@ -41,6 +56,7 @@ export async function generateSolDocAsync( const compilerOptions = _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) { @@ -53,9 +69,12 @@ export async function generateSolDocAsync( throw new Error('compiled contract did not contain ABI output'); } docWithDependencies[contractName] = _genDocSection(compiledContract, contractName); + structs = [...structs, ..._extractStructs(compiledContract)]; } } } + structs = _dedupStructs(structs); + structs = _overwriteStructNames(structs); let doc: DocAgnosticFormat = {}; if (_.isUndefined(contractsToDocument) || contractsToDocument.length === 0) { @@ -71,6 +90,16 @@ export async function generateSolDocAsync( } } + doc.structs = { + comment: '', + constructors: [], + methods: [], + properties: [], + types: structs, + functions: [], + events: [], + }; + return doc; } @@ -95,6 +124,33 @@ function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[ return compilerOptions; } +function _extractStructs(compiledContract: StandardContractOutput): CustomType[] { + let customTypes: CustomType[] = []; + for (const abiDefinition of compiledContract.abi) { + switch (abiDefinition.type) { + case 'constructor': { + const types = _getStructsAsCustomTypes(abiDefinition); + customTypes = [...customTypes, ...types]; + break; + } + case 'function': { + const types = _getStructsAsCustomTypes(abiDefinition); + customTypes = [...customTypes, ...types]; + break; + } + case 'event': + case 'fallback': + // No types exist + break; + default: + throw new Error( + `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, + ); + } + } + return customTypes; +} + function _genDocSection(compiledContract: StandardContractOutput, contractName: string): DocSection { const docSection: DocSection = { comment: _.isUndefined(compiledContract.devdoc) ? '' : compiledContract.devdoc.title, @@ -176,7 +232,7 @@ function _devdocMethodDetailsIfExist( } function _genFallbackDoc(abiDefinition: FallbackAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { - const methodSignature = `${name}()`; + const methodSignature = `()`; const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); const returnComment = @@ -186,7 +242,7 @@ function _genFallbackDoc(abiDefinition: FallbackAbi, devdocIfExists: DevdocOutpu const methodDoc: SolidityMethod = { isConstructor: false, - name: '', + name: 'fallback', callPath: '', parameters: [], returnType: { name: 'void', typeDocType: TypeDocTypes.Intrinsic }, @@ -194,23 +250,32 @@ function _genFallbackDoc(abiDefinition: FallbackAbi, devdocIfExists: DevdocOutpu isConstant: true, isPayable: abiDefinition.payable, isFallback: true, - comment, + comment: _.isEmpty(comment) + ? 'The default fallback function. It is executed on a call to the contract if none of the other functions match the given function identifier (or if no data was supplied at all).' + : comment, }; return methodDoc; } function _genMethodDoc(abiDefinition: MethodAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { + const name = abiDefinition.name; const { parameters, methodSignature } = _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists); - const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); - const returnType = _genMethodReturnTypeDoc(abiDefinition.outputs, methodSignature, devdocIfExists); + const devDocComment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); + const returnType = _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: abiDefinition.name, + name, callPath: '', parameters, returnType, @@ -262,11 +327,13 @@ function _genMethodParamsDoc( ): { parameters: Parameter[]; methodSignature: string } { const parameters: Parameter[] = []; for (const abiParam of abiParams) { + const type = _getTypeFromDataItem(abiParam); + 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 }, + type, }; parameters.push(parameter); } @@ -292,25 +359,143 @@ function _genMethodParamsDoc( return { parameters, methodSignature }; } -function _genMethodReturnTypeDoc( - outputs: DataItem[], - methodSignature: string, - devdocIfExists: DevdocOutput | undefined, -): Type { - const methodReturnTypeDoc: Type = { - name: 'void', - typeDocType: TypeDocTypes.Intrinsic, - tupleElements: undefined, - }; +function _genMethodReturnTypeDoc(outputs: DataItem[]): Type { if (outputs.length > 1) { - methodReturnTypeDoc.typeDocType = TypeDocTypes.Tuple; - methodReturnTypeDoc.tupleElements = []; + const type: Type = { + name: '', + typeDocType: TypeDocTypes.Tuple, + tupleElements: [], + }; for (const output of outputs) { - methodReturnTypeDoc.tupleElements.push({ name: output.type, typeDocType: TypeDocTypes.Intrinsic }); + const tupleType = _getTypeFromDataItem(output); + (type.tupleElements as Type[]).push(tupleType); } + return type; } else if (outputs.length === 1) { - methodReturnTypeDoc.typeDocType = TypeDocTypes.Intrinsic; - methodReturnTypeDoc.name = outputs[0].type; + const output = outputs[0]; + const type = _getTypeFromDataItem(output); + return type; + } else { + const type: Type = { + name: 'void', + typeDocType: TypeDocTypes.Intrinsic, + }; + return type; + } +} + +function _capitalize(text: string): string { + return `${text.charAt(0).toUpperCase()}${text.slice(1)}`; +} + +function _dedupStructs(customTypes: CustomType[]): CustomType[] { + const uniqueCustomTypes: CustomType[] = []; + const seenTypes: { [hash: string]: boolean } = {}; + _.each(customTypes, customType => { + const hash = _generateCustomTypeHash(customType); + if (!seenTypes[hash]) { + uniqueCustomTypes.push(customType); + seenTypes[hash] = true; + } + }); + return uniqueCustomTypes; +} + +function _overwriteStructNames(customTypes: CustomType[]): CustomType[] { + const localCustomTypes = _.cloneDeep(customTypes); + _.each(localCustomTypes, customType => { + const hash = _generateCustomTypeHash(customType); + if (!_.isUndefined(customTypeHashToName[hash])) { + customType.name = customTypeHashToName[hash]; + } + }); + return localCustomTypes; +} + +function _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; +} + +function _getStructsAsCustomTypes(abiDefinition: AbiDefinition): CustomType[] { + const customTypes: CustomType[] = []; + if (!_.isUndefined((abiDefinition as any).inputs)) { + const methodOrConstructorAbi = abiDefinition as MethodAbi | ConstructorAbi; + _.each(methodOrConstructorAbi.inputs, input => { + if (!_.isUndefined(input.components)) { + const customType = _getCustomTypeFromDataItem(input); + customTypes.push(customType); + } + }); + } + if (!_.isUndefined((abiDefinition as any).outputs)) { + const methodAbi = abiDefinition as MethodAbi; + _.each(methodAbi.outputs, output => { + if (!_.isUndefined(output.components)) { + const customType = _getCustomTypeFromDataItem(output); + customTypes.push(customType); + } + }); + } + return customTypes; +} + +function _getCustomTypeFromDataItem(inputOrOutput: DataItem): CustomType { + const customType: CustomType = { + name: _.capitalize(inputOrOutput.name), + kindString: 'Interface', + children: [], + }; + _.each(inputOrOutput.components, (component: DataItem) => { + const childType = _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; +} + +function _getNameFromDataItemIfExists(dataItem: DataItem): string | undefined { + if (_.isUndefined(dataItem.components)) { + return undefined; + } + const customType = _getCustomTypeFromDataItem(dataItem); + const hash = _generateCustomTypeHash(customType); + if (_.isUndefined(customTypeHashToName[hash])) { + return undefined; + } + return customTypeHashToName[hash]; +} + +function _getTypeFromDataItem(dataItem: DataItem): Type { + const typeDocType = !_.isUndefined(dataItem.components) ? TypeDocTypes.Reference : TypeDocTypes.Intrinsic; + let typeName: string; + if (typeDocType === TypeDocTypes.Reference) { + const nameIfExists = _getNameFromDataItemIfExists(dataItem); + typeName = _.isUndefined(nameIfExists) ? _capitalize(dataItem.name) : nameIfExists; + } else { + typeName = dataItem.type; + } + + const isArrayType = _.endsWith(dataItem.type, '[]'); + let type: Type; + if (isArrayType) { + typeName = typeDocType === TypeDocTypes.Intrinsic ? typeName.slice(0, -2) : typeName; + type = { + elementType: { name: typeName, typeDocType }, + typeDocType: TypeDocTypes.Array, + name: '', + }; + } else { + type = { name: typeName, typeDocType }; } - return methodReturnTypeDoc; + return type; } diff --git a/yarn.lock b/yarn.lock index e364c835b..bfc98dabd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6069,7 +6069,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "~0.6.0" + ethereumjs-wallet "0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" -- cgit v1.2.3 From 37ab789e841013a556c88418ddd1d5ae38f2b521 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:14:34 +0100 Subject: Remove excessive type --- packages/react-docs/src/components/documentation.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index f1cb32b68..f7feb7717 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -10,7 +10,6 @@ import { utils as sharedUtils, } from '@0xproject/react-shared'; import { - CustomType, DocAgnosticFormat, Event, ExternalExportToLink, @@ -219,7 +218,7 @@ export class Documentation extends React.Component { + const typeDefs = _.map(sortedTypes, (customType, i) => { return ( Date: Thu, 27 Sep 2018 23:16:55 +0100 Subject: Alphabetize --- packages/sol-doc/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 3b7362b3f..8c9590bf3 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -28,9 +28,9 @@ "@0xproject/types": "^1.1.1", "@0xproject/utils": "^1.0.11", "ethereum-types": "^1.0.4", + "ethereumjs-util": "^5.1.1", "lodash": "^4.17.10", - "yargs": "^12.0.2", - "ethereumjs-util": "^5.1.1" + "yargs": "^12.0.2" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", -- cgit v1.2.3 From 95e84aae49d86ed8edf286bc8c95214f5b2456c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:18:32 +0100 Subject: Improve comment --- packages/sol-doc/src/solidity_doc_generator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index c70f54d5f..1e9c7d5d7 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -28,11 +28,11 @@ import { TypeDocTypes, } from '@0xproject/types'; -// Unforunately, the only way to currently retrieve the declared structs with Solidity contracts -// is to tease it out of the params/return values included in it's ABI. These structures do -// not include the structs actual name, so we needed a mapping to assign the proper name to a +// Unforunately, 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. +// name (which mostly coincide). const customTypeHashToName: { [hash: string]: string } = { '52d4a768701076c7bac06e386e430883975eb398732eccba797fd09dd064a60e': 'Order', '46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResult', -- cgit v1.2.3 From e0ff3484cf169162f3a339b6cb779fa2b562ad73 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:20:21 +0100 Subject: Improve switch case --- packages/sol-doc/src/solidity_doc_generator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 1e9c7d5d7..09e78aef2 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -127,15 +127,14 @@ function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[ function _extractStructs(compiledContract: StandardContractOutput): CustomType[] { let customTypes: CustomType[] = []; for (const abiDefinition of compiledContract.abi) { + let types: CustomType[] = []; switch (abiDefinition.type) { case 'constructor': { - const types = _getStructsAsCustomTypes(abiDefinition); - customTypes = [...customTypes, ...types]; + types = _getStructsAsCustomTypes(abiDefinition); break; } case 'function': { - const types = _getStructsAsCustomTypes(abiDefinition); - customTypes = [...customTypes, ...types]; + types = _getStructsAsCustomTypes(abiDefinition); break; } case 'event': @@ -147,6 +146,7 @@ function _extractStructs(compiledContract: StandardContractOutput): CustomType[] `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, ); } + customTypes = [...customTypes, ...types]; } return customTypes; } -- cgit v1.2.3 From b2ff7bda02c02a950eb2cc656eaa5780d7b71b5b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:24:05 +0100 Subject: Explain cast to any --- packages/sol-doc/src/solidity_doc_generator.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 09e78aef2..d441b9a23 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -422,6 +422,8 @@ function _generateCustomTypeHash(customType: CustomType): string { function _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 => { -- cgit v1.2.3 From 092b184f4534a42d36d30d2d10b34b47255d2ee3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:30:11 +0100 Subject: Fix linter --- packages/react-docs/src/components/signature_block.tsx | 4 ++-- packages/react-docs/src/components/type.tsx | 1 - packages/sol-doc/src/solidity_doc_generator.ts | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index cad72daf4..5ec82983a 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -50,7 +50,7 @@ export class SignatureBlock extends React.Component !_.isEmpty(p.name))); + const hasExclusivelyNamedParams = !_.isUndefined(_.find(method.parameters, p => !_.isEmpty(p.name))); return (
} {method.parameters && !_.isEmpty(method.parameters) && - onlyHasNamedParameters && ( + hasExclusivelyNamedParams && (

ARGUMENTS diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 8ff2fa3cc..028376ba9 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -7,7 +7,6 @@ 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'; diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index d441b9a23..362fe12c3 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -490,6 +490,7 @@ function _getTypeFromDataItem(dataItem: 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 }, @@ -501,3 +502,4 @@ function _getTypeFromDataItem(dataItem: DataItem): Type { } return type; } +// tslint:disable:max-file-line-count -- cgit v1.2.3 From 8531f52456169d6b2103757e8e511710c58a54d0 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 27 Sep 2018 23:32:29 +0100 Subject: Switch over remaining usage of `sections.types` for `typeSectionName` --- packages/react-docs/src/docs_info.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index bf6aa07a7..092a8c266 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -84,11 +84,11 @@ export class DocsInfo { return menuSubsectionsBySection; } public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } { - if (_.isUndefined(this.sections.types)) { + if (_.isUndefined(docAgnosticFormat[this.typeSectionName])) { return {}; } - const section = docAgnosticFormat[this.sections.types]; + const section = docAgnosticFormat[this.typeSectionName]; const typeDefinitionByName = _.keyBy(section.types, 'name') as any; return typeDefinitionByName; } -- cgit v1.2.3 From 94badedad434f5345dc041e72a3240ab760c993e Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 27 Sep 2018 15:34:01 -0700 Subject: Remove yarn postinstall hack (#1098) --- package.json | 4 +--- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cf5f247d6..681721bb9 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,7 @@ "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;", - "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", - "comment:postinstall": "HACK: For some reason `yarn` is not setting up symlink properly for types. We temporarily make it manually. Remove this ASAP!", - "postinstall": "shx cp -R node_modules/@0xproject/types packages/website/node_modules/@0xproject; shx cp -R node_modules/@0xproject/types packages/sra-report/node_modules/@0xproject; rimraf node_modules/@0xproject/types; shx ln -s ../../packages/types node_modules/@0xproject/types" + "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing" }, "config": { "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic", diff --git a/yarn.lock b/yarn.lock index 6967c0425..8ba879315 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5331,7 +5331,7 @@ ethers@3.0.22: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@^4.0.0-beta.14: +ethers@4.0.0-beta.14: version "4.0.0-beta.14" resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.0-beta.14.tgz#76aa9257b9c93a7604ff4dc11f2a445d07f6459d" dependencies: @@ -6088,7 +6088,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "~0.6.0" + ethereumjs-wallet "0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" -- cgit v1.2.3 From 21f60721863c974e0565009100891db53b7fb42c Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Wed, 26 Sep 2018 15:41:49 +1000 Subject: Handle revert with reason when decoding call result We use in-process ganache which throws on an RPC error. This means all of our tests get a nice revert error thrown when testing against ganache. This is not possible with RPC providers and a revert with reason result is returned. Our callAsync doesn't handle this and attempts to decode the revert with reason error log as a successful log, which results in an error while decoding. This only works with our fork of ethers https://github.com/ethers-io/ethers.js/pull/188 and will need to be re-worked when updating to Ethers.js 4 --- .../test/revert_validation_test.ts | 122 +++++++++++++++++++++ .../test/transaction_encoder_test.ts | 2 +- packages/dev-utils/src/web3_factory.ts | 7 +- 3 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 packages/contract-wrappers/test/revert_validation_test.ts diff --git a/packages/contract-wrappers/test/revert_validation_test.ts b/packages/contract-wrappers/test/revert_validation_test.ts new file mode 100644 index 000000000..da011c1d7 --- /dev/null +++ b/packages/contract-wrappers/test/revert_validation_test.ts @@ -0,0 +1,122 @@ +import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; +import { runV2MigrationsAsync } from '@0xproject/migrations'; +import { assetDataUtils } from '@0xproject/order-utils'; +import { SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as chai from 'chai'; +import 'mocha'; + +import { ContractWrappers } from '../src'; + +import { chaiSetup } from './utils/chai_setup'; +import { constants } from './utils/constants'; +import { tokenUtils } from './utils/token_utils'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('Revert Validation ExchangeWrapper', () => { + let contractWrappers: ContractWrappers; + let userAddresses: string[]; + let zrxTokenAddress: string; + let fillScenarios: FillScenarios; + let exchangeContractAddress: string; + let makerTokenAddress: string; + let takerTokenAddress: string; + let coinbase: string; + let makerAddress: string; + let anotherMakerAddress: string; + let takerAddress: string; + let makerAssetData: string; + let takerAssetData: string; + let feeRecipient: string; + let txHash: string; + let blockchainLifecycle: BlockchainLifecycle; + let web3Wrapper: Web3Wrapper; + const fillableAmount = new BigNumber(5); + const takerTokenFillAmount = new BigNumber(5); + let signedOrder: SignedOrder; + const config = { + networkId: constants.TESTRPC_NETWORK_ID, + blockPollingIntervalMs: 0, + }; + before(async () => { + // vmErrorsOnRPCResponse is useful for quick feedback and testing during development + // but is not the default behaviour in production. Here we ensure our failure cases + // are handled in an environment which behaves similar to production + const provider = web3Factory.getRpcProvider({ + shouldUseInProcessGanache: true, + shouldThrowErrorsOnGanacheRPCResponse: false, + }); + web3Wrapper = new Web3Wrapper(provider); + blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + const txDefaults = { + gas: devConstants.GAS_LIMIT, + from: devConstants.TESTRPC_FIRST_ADDRESS, + }; + const artifactsDir = `src/artifacts`; + // Re-deploy the artifacts in this provider, rather than in the default provider exposed in + // the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse + // and we are explicity testing with vmErrorsOnRPCResponse disabled. + await runV2MigrationsAsync(provider, artifactsDir, txDefaults); + await blockchainLifecycle.startAsync(); + contractWrappers = new ContractWrappers(provider, config); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + zrxTokenAddress = tokenUtils.getProtocolTokenAddress(); + fillScenarios = new FillScenarios( + provider, + userAddresses, + zrxTokenAddress, + exchangeContractAddress, + contractWrappers.erc20Proxy.getContractAddress(), + contractWrappers.erc721Proxy.getContractAddress(), + ); + [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses; + [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses(); + [makerAssetData, takerAssetData] = [ + assetDataUtils.encodeERC20AssetData(makerTokenAddress), + assetDataUtils.encodeERC20AssetData(takerTokenAddress), + ]; + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + takerAddress, + fillableAmount, + ); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + describe('#fillOrderAsync', () => { + it('should throw the revert reason when shouldValidate is true and a fill would revert', async () => { + // Create a scenario where the fill will revert + const makerTokenBalance = await contractWrappers.erc20Token.getBalanceAsync( + makerTokenAddress, + makerAddress, + ); + // Transfer all of the tokens from maker to create a failure scenario + txHash = await contractWrappers.erc20Token.transferAsync( + makerTokenAddress, + makerAddress, + takerAddress, + makerTokenBalance, + ); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + expect( + contractWrappers.exchange.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress, { + shouldValidate: true, + }), + ).to.be.rejectedWith('TRANSFER_FAILED'); + }); + }); +}); diff --git a/packages/contract-wrappers/test/transaction_encoder_test.ts b/packages/contract-wrappers/test/transaction_encoder_test.ts index e76c5b12d..a397e43a8 100644 --- a/packages/contract-wrappers/test/transaction_encoder_test.ts +++ b/packages/contract-wrappers/test/transaction_encoder_test.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; -import { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils'; +import { assetDataUtils, generatePseudoRandomSalt, orderHashUtils, signatureUtils } from '@0xproject/order-utils'; import { SignedOrder, SignerType } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import 'mocha'; diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 8e713fa68..7c86d3df4 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -14,6 +14,7 @@ import { env, EnvVars } from './env'; export interface Web3Config { hasAddresses?: boolean; // default: true shouldUseInProcessGanache?: boolean; // default: false + shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true rpcUrl?: string; // default: localhost:8545 shouldUseFakeGasEstimate?: boolean; // default: true } @@ -41,15 +42,19 @@ export const web3Factory = { if (!_.isUndefined(config.rpcUrl)) { throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider'); } + const shouldThrowErrorsOnGanacheRPCResponse = + _.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) || + config.shouldThrowErrorsOnGanacheRPCResponse; provider.addProvider( new GanacheSubprovider({ + vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse, gasLimit: constants.GAS_LIMIT, logger, verbose: env.parseBoolean(EnvVars.VerboseGanache), port: 8545, network_id: 50, mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic', - }), + } as any), // TODO remove any once types are merged in DefinitelyTyped ); } else { provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL)); -- cgit v1.2.3 From 144561c53be3df1e03cd46de23cec4710056907a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 10:28:57 +0100 Subject: Fix missing devdoc comments in output by fixing improper encoding of methodSignatures --- packages/sol-doc/src/solidity_doc_generator.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 362fe12c3..09137c4cf 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -340,7 +340,16 @@ function _genMethodParamsDoc( const methodSignature = `${name}(${abiParams .map(abiParam => { - return abiParam.type; + 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(',')})`; -- cgit v1.2.3 From 28f5cd06418e52a80fb784dbed75120d76b4204b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 10:30:24 +0100 Subject: Only add Stucts section if there are any --- packages/sol-doc/src/solidity_doc_generator.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts index 09137c4cf..424577411 100644 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ b/packages/sol-doc/src/solidity_doc_generator.ts @@ -90,15 +90,17 @@ export async function generateSolDocAsync( } } - doc.structs = { - comment: '', - constructors: [], - methods: [], - properties: [], - types: structs, - functions: [], - events: [], - }; + if (structs.length > 0) { + doc.structs = { + comment: '', + constructors: [], + methods: [], + properties: [], + types: structs, + functions: [], + events: [], + }; + } return doc; } -- cgit v1.2.3 From 545472a38fabfd8a18cb03a23ae02f99917f0f4c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 10:50:55 +0100 Subject: Fix section headers --- packages/react-docs/src/components/documentation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index f7feb7717..df727ad9c 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -265,7 +265,7 @@ export class Documentation extends React.Component
- +
{this._renderNetworkBadgesIfExists(sectionName)}
-- cgit v1.2.3 From 398b2926366bfabc4decca48dd24c85c466c48ed Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 11:04:51 +0100 Subject: Add more basic types --- packages/react-docs/src/components/type.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index 028376ba9..5c018f5dd 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -12,7 +12,7 @@ import { Signature } from './signature'; import { TypeDefinition } from './type_definition'; const basicJsTypes = ['string', 'number', 'undefined', 'null', 'boolean']; -const basicSolidityTypes = ['bytes', 'bytes4', 'uint256', 'address']; +const basicSolidityTypes = ['bytes', 'bytes4', 'bytes32', 'uint8', 'uint256', 'address']; const defaultProps = {}; -- cgit v1.2.3 From 6dff24906edad6d603bddcb8359349b20f5e3009 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 11:05:13 +0100 Subject: Fix network badges for V1 and add them for V2 --- .../ts/containers/smart_contracts_documentation.ts | 60 ++++++++++++++++------ 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/packages/website/ts/containers/smart_contracts_documentation.ts b/packages/website/ts/containers/smart_contracts_documentation.ts index 8d69afe71..05b2a50c3 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.ts +++ b/packages/website/ts/containers/smart_contracts_documentation.ts @@ -37,28 +37,56 @@ const docsInfoConfig: DocsInfoConfig = { contractsByVersionByNetworkId: { '1.0.0': { [Networks.Mainnet]: { - [Sections.Exchange]: '0x12459c951127e0c374ff9105dda097662a027093', - [Sections.TokenTransferProxy]: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4', - [Sections.ZRXToken]: '0xe41d2489571d322189246dafa5ebde1f4699f498', - [Sections.TokenRegistry]: '0x926a74c5c36adf004c87399e65f75628b0f98d2c', + Exchange_v1: '0x12459c951127e0c374ff9105dda097662a027093', + TokenTransferProxy_v1: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4', + TokenRegistry: '0x926a74c5c36adf004c87399e65f75628b0f98d2c', }, [Networks.Ropsten]: { - [Sections.Exchange]: '0x479cc461fecd078f766ecc58533d6f69580cf3ac', - [Sections.TokenTransferProxy]: '0x4e9aad8184de8833365fea970cd9149372fdf1e6', - [Sections.ZRXToken]: '0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d', - [Sections.TokenRegistry]: '0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed', + Exchange_v1: '0x479cc461fecd078f766ecc58533d6f69580cf3ac', + TokenTransferProxy_v1: '0x4e9aad8184de8833365fea970cd9149372fdf1e6', + TokenRegistry: '0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed', }, [Networks.Kovan]: { - [Sections.Exchange]: '0x90fe2af704b34e0224bf2299c838e04d4dcf1364', - [Sections.TokenTransferProxy]: '0x087Eed4Bc1ee3DE49BeFbd66C662B434B15d49d4', - [Sections.ZRXToken]: '0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570', - [Sections.TokenRegistry]: '0xf18e504561f4347bea557f3d4558f559dddbae7f', + Exchange_v1: '0x90fe2af704b34e0224bf2299c838e04d4dcf1364', + TokenTransferProxy_v1: '0x087Eed4Bc1ee3DE49BeFbd66C662B434B15d49d4', + TokenRegistry: '0xf18e504561f4347bea557f3d4558f559dddbae7f', }, [Networks.Rinkeby]: { - [Sections.Exchange]: '0x1d16ef40fac01cec8adac2ac49427b9384192c05', - [Sections.TokenTransferProxy]: '0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d', - [Sections.ZRXToken]: '0x00f58d6d585f84b2d7267940cede30ce2fe6eae8', - [Sections.TokenRegistry]: '0x4e9aad8184de8833365fea970cd9149372fdf1e6', + Exchange_v1: '0x1d16ef40fac01cec8adac2ac49427b9384192c05', + TokenTransferProxy_v1: '0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d', + TokenRegistry: '0x4e9aad8184de8833365fea970cd9149372fdf1e6', + }, + }, + '2.0.0': { + [Networks.Mainnet]: { + AssetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6', + ERC20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e', + ERC721Proxy: '0x208e41fb445f1bb1b6780d58356e81405f3e6127', + Exchange: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b', + Forwarder: '0x7afc2d5107af94c462a194d2c21b5bdd238709d6', + OrderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138', + WETH9: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + ZRXToken: '0xe41d2489571d322189246dafa5ebde1f4699f498', + }, + [Networks.Ropsten]: { + AssetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b', + ERC20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa', + ERC721Proxy: '0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4', + Exchange: '0x4530c0483a1633c7a1c97d2c53721caff2caaaaf', + Forwarder: '0x3983e204b12b3c02fb0638caf2cd406a62e0ead3', + OrderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f', + WETH9: '0xc778417e063141139fce010982780140aa0cd5ab', + ZRXToken: '0xff67881f8d12f372d91baae9752eb3631ff0ed00', + }, + [Networks.Kovan]: { + AssetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8', + ERC20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e', + ERC721Proxy: '0x2a9127c745688a165106c11cd4d647d2220af821', + Exchange: '0x35dd2932454449b14cee11a94d3674a936d5d7b2', + Forwarder: '0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8', + OrderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d', + WETH9: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', + ZRXToken: '0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa', }, }, }, -- cgit v1.2.3 From 005a2e12bac3e0ca8762f627ec5e9df6d2991d6e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 11:33:30 +0100 Subject: Fix badge alignment --- packages/react-docs/src/components/documentation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index df727ad9c..a23111297 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -353,7 +353,7 @@ export class Documentation extends React.Component
-- cgit v1.2.3 From 9ae60d0abe0ea32eb9dbfc48a9168d1996c674a0 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 17:20:24 +0100 Subject: Export class instead of function --- packages/sol-doc/src/cli.ts | 17 +- packages/sol-doc/src/index.ts | 2 +- packages/sol-doc/src/sol_doc.ts | 500 ++++++++++++++++++++ packages/sol-doc/src/solidity_doc_generator.ts | 516 --------------------- .../sol-doc/test/solidity_doc_generator_test.ts | 20 +- 5 files changed, 529 insertions(+), 526 deletions(-) create mode 100644 packages/sol-doc/src/sol_doc.ts delete mode 100644 packages/sol-doc/src/solidity_doc_generator.ts diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index eb0f00bf6..04956510e 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -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); + // Unforunately, 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': 'FillResult', + c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo', + c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo', + '07c2bddc165e0b5005e6244dd4a9771fa61c78c4f42abd687d57567b0768136c': '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); diff --git a/packages/sol-doc/src/index.ts b/packages/sol-doc/src/index.ts index 03f3c9de6..521668cc8 100644 --- a/packages/sol-doc/src/index.ts +++ b/packages/sol-doc/src/index.ts @@ -1 +1 @@ -export { generateSolDocAsync } from './solidity_doc_generator'; +export { SolDoc } from './sol_doc'; diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts new file mode 100644 index 000000000..4b7cbe77c --- /dev/null +++ b/packages/sol-doc/src/sol_doc.ts @@ -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 | 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, + ): Promise { + 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[], customTypeHashToName?: ObjectMap): CustomType[] { + if (_.isUndefined(customTypeHashToName)) { + return customTypes; + } + const localCustomTypes = _.cloneDeep(customTypes); + _.each(localCustomTypes, customType => { + const hash = SolDoc._generateCustomTypeHash(customType); + if (!_.isUndefined(this._customTypeHashToName) && !_.isUndefined(this._customTypeHashToName[hash])) { + customType.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}'`, + ); + } + 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}'`, + ); + } + } + + 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: '', + 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; + _.each(methodAbi.outputs, output => { + if (!_.isUndefined(output.components)) { + const customType = this._getCustomTypeFromDataItem(output); + customTypes.push(customType); + } + }); + } + return customTypes; + } +} +// tslint:disable:max-file-line-count diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts deleted file mode 100644 index 424577411..000000000 --- a/packages/sol-doc/src/solidity_doc_generator.ts +++ /dev/null @@ -1,516 +0,0 @@ -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, - Parameter, - SolidityMethod, - Type, - TypeDocTypes, -} from '@0xproject/types'; - -// Unforunately, 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': 'FillResult', - c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo', - c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo', - '07c2bddc165e0b5005e6244dd4a9771fa61c78c4f42abd687d57567b0768136c': 'MatchedFillResult', -}; - -/** - * 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 { - const docWithDependencies: DocAgnosticFormat = {}; - const compilerOptions = _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] = _genDocSection(compiledContract, contractName); - structs = [...structs, ..._extractStructs(compiledContract)]; - } - } - } - structs = _dedupStructs(structs); - structs = _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: [], - }; - } - - 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 _extractStructs(compiledContract: StandardContractOutput): CustomType[] { - let customTypes: CustomType[] = []; - for (const abiDefinition of compiledContract.abi) { - let types: CustomType[] = []; - switch (abiDefinition.type) { - case 'constructor': { - types = _getStructsAsCustomTypes(abiDefinition); - break; - } - case 'function': { - types = _getStructsAsCustomTypes(abiDefinition); - break; - } - case 'event': - case 'fallback': - // No types exist - break; - default: - throw new Error( - `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, - ); - } - customTypes = [...customTypes, ...types]; - } - return customTypes; -} - -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': - docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc)); - break; - case 'fallback': - docSection.methods.push(_genFallbackDoc(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 _genFallbackDoc(abiDefinition: FallbackAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { - const methodSignature = `()`; - const comment = _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 default fallback function. It is executed on a call to the contract if none of the other functions match the given function identifier (or if no data was supplied at all).' - : comment, - }; - return methodDoc; -} - -function _genMethodDoc(abiDefinition: MethodAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod { - const name = abiDefinition.name; - const { parameters, methodSignature } = _genMethodParamsDoc(name, abiDefinition.inputs, devdocIfExists); - const devDocComment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists); - const returnType = _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; -} - -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 type = _getTypeFromDataItem(abiParam); - - const parameter: Parameter = { - name: abiParam.name, - 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 }; -} - -function _genMethodReturnTypeDoc(outputs: DataItem[]): Type { - if (outputs.length > 1) { - const type: Type = { - name: '', - typeDocType: TypeDocTypes.Tuple, - tupleElements: [], - }; - for (const output of outputs) { - const tupleType = _getTypeFromDataItem(output); - (type.tupleElements as Type[]).push(tupleType); - } - return type; - } else if (outputs.length === 1) { - const output = outputs[0]; - const type = _getTypeFromDataItem(output); - return type; - } else { - const type: Type = { - name: 'void', - typeDocType: TypeDocTypes.Intrinsic, - }; - return type; - } -} - -function _capitalize(text: string): string { - return `${text.charAt(0).toUpperCase()}${text.slice(1)}`; -} - -function _dedupStructs(customTypes: CustomType[]): CustomType[] { - const uniqueCustomTypes: CustomType[] = []; - const seenTypes: { [hash: string]: boolean } = {}; - _.each(customTypes, customType => { - const hash = _generateCustomTypeHash(customType); - if (!seenTypes[hash]) { - uniqueCustomTypes.push(customType); - seenTypes[hash] = true; - } - }); - return uniqueCustomTypes; -} - -function _overwriteStructNames(customTypes: CustomType[]): CustomType[] { - const localCustomTypes = _.cloneDeep(customTypes); - _.each(localCustomTypes, customType => { - const hash = _generateCustomTypeHash(customType); - if (!_.isUndefined(customTypeHashToName[hash])) { - customType.name = customTypeHashToName[hash]; - } - }); - return localCustomTypes; -} - -function _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; -} - -function _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 = _getCustomTypeFromDataItem(input); - customTypes.push(customType); - } - }); - } - if (!_.isUndefined((abiDefinition as any).outputs)) { - const methodAbi = abiDefinition as MethodAbi; - _.each(methodAbi.outputs, output => { - if (!_.isUndefined(output.components)) { - const customType = _getCustomTypeFromDataItem(output); - customTypes.push(customType); - } - }); - } - return customTypes; -} - -function _getCustomTypeFromDataItem(inputOrOutput: DataItem): CustomType { - const customType: CustomType = { - name: _.capitalize(inputOrOutput.name), - kindString: 'Interface', - children: [], - }; - _.each(inputOrOutput.components, (component: DataItem) => { - const childType = _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; -} - -function _getNameFromDataItemIfExists(dataItem: DataItem): string | undefined { - if (_.isUndefined(dataItem.components)) { - return undefined; - } - const customType = _getCustomTypeFromDataItem(dataItem); - const hash = _generateCustomTypeHash(customType); - if (_.isUndefined(customTypeHashToName[hash])) { - return undefined; - } - return customTypeHashToName[hash]; -} - -function _getTypeFromDataItem(dataItem: DataItem): Type { - const typeDocType = !_.isUndefined(dataItem.components) ? TypeDocTypes.Reference : TypeDocTypes.Intrinsic; - let typeName: string; - if (typeDocType === TypeDocTypes.Reference) { - const nameIfExists = _getNameFromDataItemIfExists(dataItem); - typeName = _.isUndefined(nameIfExists) ? _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; -} -// tslint:disable:max-file-line-count diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index c780d3d31..ba08ebd00 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -5,16 +5,20 @@ 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; +let solDoc: SolDoc; describe('#SolidityDocGenerator', () => { + before(() => { + solDoc = new SolDoc(); + }); 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 +26,8 @@ describe('#SolidityDocGenerator', () => { verifyTokenTransferProxyABIIsDocumented(doc, 'TokenTransferProxyNoDevdoc'); }); const docPromises: Array> = [ - 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 +52,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 +60,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 +163,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; -- cgit v1.2.3 From 033340e304a92e4022cd3bce06f612e904a73faf Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 18:38:10 +0100 Subject: Fix typo --- packages/sol-doc/src/cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index 04956510e..11e638785 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -20,14 +20,14 @@ const JSON_TAB_WIDTH = 4; .demandOption('contracts-dir') .array('contracts') .help().argv; - // Unforunately, the only way to currently retrieve the declared structs within Solidity 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': 'FillResult', + '46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResults', c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo', c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo', '07c2bddc165e0b5005e6244dd4a9771fa61c78c4f42abd687d57567b0768136c': 'MatchedFillResults', -- cgit v1.2.3 From c7e26cd4480e7345fccad693fa5bc15180eeac7d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 18:59:28 +0100 Subject: Un-nest the interface to fix the doc rendering --- packages/ethereum-types/src/index.ts | 12 +++++++----- packages/sol-compiler/src/index.ts | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index a92dbdd1b..916661638 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -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; diff --git a/packages/sol-compiler/src/index.ts b/packages/sol-compiler/src/index.ts index 829e515ff..d8a60666f 100644 --- a/packages/sol-compiler/src/index.ts +++ b/packages/sol-compiler/src/index.ts @@ -25,4 +25,5 @@ export { StandardContractOutput, StandardOutput, StateMutability, + SourceLocation, } from 'ethereum-types'; -- cgit v1.2.3 From c354129b6f4a8b9373655ecb29ffb4ae87f19c56 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 19:15:38 +0100 Subject: Updated CHANGELOGS --- packages/0x.js/CHANGELOG.json | 9 +++++++++ packages/0x.js/CHANGELOG.md | 4 ++++ packages/abi-gen/CHANGELOG.json | 9 +++++++++ packages/abi-gen/CHANGELOG.md | 4 ++++ packages/assert/CHANGELOG.json | 9 +++++++++ packages/assert/CHANGELOG.md | 4 ++++ packages/asset-buyer/CHANGELOG.json | 9 +++++++++ packages/asset-buyer/CHANGELOG.md | 4 ++++ packages/base-contract/CHANGELOG.json | 3 ++- packages/base-contract/CHANGELOG.md | 5 +++++ packages/connect/CHANGELOG.json | 3 ++- packages/connect/CHANGELOG.md | 4 ++++ packages/contract-wrappers/CHANGELOG.json | 9 +++++++++ packages/contract-wrappers/CHANGELOG.md | 4 ++++ packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/CHANGELOG.md | 4 ++++ packages/ethereum-types/CHANGELOG.json | 9 +++++++++ packages/ethereum-types/CHANGELOG.md | 4 ++++ packages/fill-scenarios/CHANGELOG.json | 9 +++++++++ packages/fill-scenarios/CHANGELOG.md | 4 ++++ packages/json-schemas/CHANGELOG.json | 9 +++++++++ packages/json-schemas/CHANGELOG.md | 4 ++++ packages/migrations/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.md | 4 ++++ packages/order-utils/CHANGELOG.json | 3 ++- packages/order-utils/CHANGELOG.md | 4 ++++ packages/order-watcher/CHANGELOG.json | 3 ++- packages/order-watcher/CHANGELOG.md | 4 ++++ packages/react-docs/CHANGELOG.json | 9 +++++++++ packages/react-docs/CHANGELOG.md | 4 ++++ packages/react-shared/CHANGELOG.json | 9 +++++++++ packages/react-shared/CHANGELOG.md | 4 ++++ packages/sol-compiler/CHANGELOG.json | 9 +++++++++ packages/sol-compiler/CHANGELOG.md | 4 ++++ packages/sol-cov/CHANGELOG.json | 9 +++++++++ packages/sol-cov/CHANGELOG.md | 4 ++++ packages/sol-doc/CHANGELOG.json | 9 +++++++++ packages/sol-doc/CHANGELOG.md | 14 ++++++++++++++ packages/sol-resolver/CHANGELOG.json | 9 +++++++++ packages/sol-resolver/CHANGELOG.md | 4 ++++ packages/sra-report/CHANGELOG.json | 9 +++++++++ packages/sra-report/CHANGELOG.md | 4 ++++ packages/sra-spec/CHANGELOG.json | 9 +++++++++ packages/sra-spec/CHANGELOG.md | 4 ++++ packages/subproviders/CHANGELOG.json | 9 +++++++++ packages/subproviders/CHANGELOG.md | 4 ++++ packages/types/CHANGELOG.json | 9 +++++++++ packages/types/CHANGELOG.md | 4 ++++ packages/typescript-typings/CHANGELOG.json | 3 ++- packages/typescript-typings/CHANGELOG.md | 4 ++++ packages/utils/CHANGELOG.json | 3 ++- packages/utils/CHANGELOG.md | 4 ++++ packages/web3-wrapper/CHANGELOG.json | 9 +++++++++ packages/web3-wrapper/CHANGELOG.md | 4 ++++ 54 files changed, 320 insertions(+), 6 deletions(-) create mode 100644 packages/sol-doc/CHANGELOG.md diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 391335390..8a0fca264 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.6", diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index b9b329085..5bd6dee1d 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.7 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.6 - _September 25, 2018_ * Dependencies updated diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 578557165..6d6d3fa0b 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.11", diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index ee46ca2a9..7d8958893 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index 0aa9038d8..dc510533e 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.11", diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index dab9f933b..55b2b1c73 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index d673f0a45..aa196c265 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.1", diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md index bea4a551b..9d6d973a4 100644 --- a/packages/asset-buyer/CHANGELOG.md +++ b/packages/asset-buyer/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.2 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.1 - _September 25, 2018_ * Dependencies updated diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index b97bc00e0..9408ffc86 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Add baseContract._throwIfRevertWithReasonCallResult", "pr": 1069 } - ] + ], + "timestamp": 1538157789 }, { "timestamp": 1537907159, diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index 7a3e0f661..30ef4507e 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## 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 diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 4106be881..31df1e808 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Change /order_config request to a POST instead of GET", "pr": 1091 } - ] + ], + "timestamp": 1538157789 }, { "timestamp": 1537907159, diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 75906ff4e..3f0a22ced 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.0 - _September 28, 2018_ + + * Change /order_config request to a POST instead of GET (#1091) + ## v2.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 8863f61f4..6a9a1d110 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "2.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.0", "changes": [ diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 41e5645a3..8a9612be5 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## 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) diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index b0b703b34..8d3f613b8 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.10", diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 220d499d3..f978fcbb5 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 25, 2018_ * Dependencies updated diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json index ab3018e4b..50f46fc02 100644 --- a/packages/ethereum-types/CHANGELOG.json +++ b/packages/ethereum-types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.9", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.8", diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md index d286fbbfd..3370531b0 100644 --- a/packages/ethereum-types/CHANGELOG.md +++ b/packages/ethereum-types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.9 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.8 - _September 25, 2018_ * Dependencies updated diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 8e6ff9b33..ac03ccba5 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.5", diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index 4cc8cd855..3abf688ed 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.6 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index facd90878..1b6bb61bb 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.4", diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 763e9dd05..b0547dccf 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 25b523e8f..34c0d44a3 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.12", diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index a637f30ef..685aa07c5 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.13 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.12 - _September 25, 2018_ * Dependencies updated diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 31ba68e23..b486d6503 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -7,7 +7,8 @@ "Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address", "pr": 1096 } - ] + ], + "timestamp": 1538157789 }, { "timestamp": 1537907159, diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 8372ddf16..5109b9040 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## 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 diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 3abd67fda..3a5462727 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Export ExpirationWatcher", "pr": 1097 } - ] + ], + "timestamp": 1538157789 }, { "version": "2.0.0", diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index 32837337a..ef4398cab 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.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) diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 82aaf4e32..7f0b25c2c 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.11", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index 8f5cc0cfd..ccf6ccc41 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 32cf66691..c4ccc6013 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.12", diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index fb2bac27e..aa2f27266 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.13 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.12 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index 69cc7fa0f..4d22fe827 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.1.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.1.5", diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 0fc0ff7b1..1882f9a8f 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.6 - _September 28, 2018_ + + * Dependencies updated + ## v1.1.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 5fde6d5ee..4daf3de41 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "2.1.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "2.1.5", diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index bf48a74a4..35b7bbc33 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.1.6 - _September 28, 2018_ + + * Dependencies updated + ## v2.1.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json index c5bd78356..77f90ff7a 100644 --- a/packages/sol-doc/CHANGELOG.json +++ b/packages/sol-doc/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.0", "changes": [ diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md new file mode 100644 index 000000000..9ff92821e --- /dev/null +++ b/packages/sol-doc/CHANGELOG.md @@ -0,0 +1,14 @@ + + +CHANGELOG + +## 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) diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 72928bbed..f14dcc5e0 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.11", diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index e2959bbaa..449089e5d 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index 8f7048243..c1e0a3790 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.11", diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 9a83159ba..ab16dea43 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json index b50b98127..848401163 100644 --- a/packages/sra-spec/CHANGELOG.json +++ b/packages/sra-spec/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.0.4", diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md index 501a4cf89..f4d76fb06 100644 --- a/packages/sra-spec/CHANGELOG.md +++ b/packages/sra-spec/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 28, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 25, 2018_ * Dependencies updated diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 3cd7c2052..55614ba66 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "2.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "2.0.5", diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index fac8d619d..6039a2983 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.6 - _September 28, 2018_ + + * Dependencies updated + ## v2.0.5 - _September 25, 2018_ * Dependencies updated diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index e07699131..9d2010b9a 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "1.1.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "1.1.1", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 353420081..33c5d5e9c 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.2 - _September 28, 2018_ + + * Dependencies updated + ## v1.1.1 - _September 25, 2018_ * Dependencies updated diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index 7ee78a480..df6fe16e7 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Remove types for ethers.js", "pr": "1069" } - ] + ], + "timestamp": 1538157789 }, { "timestamp": 1537907159, diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index 1be65ddec..1240dbcf7 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.0 - _September 28, 2018_ + + * Remove types for ethers.js (#1069) + ## v2.0.2 - _September 25, 2018_ * Dependencies updated diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index b4f438966..a24d58b30 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Make abi_decoder compatible with ethers ^4.0.0", "pr": 1069 } - ] + ], + "timestamp": 1538157789 }, { "timestamp": 1537907159, diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 60b6d1b7e..80b3bfd2d 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.0 - _September 28, 2018_ + + * Make abi_decoder compatible with ethers ^4.0.0 (#1069) + ## v1.0.11 - _September 25, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 1ab2acafc..444b9e175 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538157789, + "version": "3.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1537907159, "version": "3.0.1", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 1c592d22e..5d10a3549 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.2 - _September 28, 2018_ + + * Dependencies updated + ## v3.0.1 - _September 25, 2018_ * Dependencies updated -- cgit v1.2.3 From ac14dd2b29b42ef4d2a46db9b70d4d30cf9bd40f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 28 Sep 2018 19:16:07 +0100 Subject: Publish - 0x.js@1.0.7 - @0xproject/abi-gen@1.0.12 - @0xproject/assert@1.0.12 - @0xproject/asset-buyer@1.0.2 - @0xproject/base-contract@3.0.0 - @0xproject/connect@3.0.0 - @0xproject/contract-wrappers@2.0.1 - contracts@2.1.48 - @0xproject/dev-utils@1.0.11 - ethereum-types@1.0.9 - @0xproject/fill-scenarios@1.0.6 - @0xproject/json-schemas@1.0.5 - @0xproject/metacoin@0.0.22 - @0xproject/migrations@1.0.13 - @0xproject/monorepo-scripts@1.0.10 - @0xproject/order-utils@1.0.6 - @0xproject/order-watcher@2.1.0 - @0xproject/react-docs@1.0.12 - @0xproject/react-shared@1.0.13 - @0xproject/sol-compiler@1.1.6 - @0xproject/sol-cov@2.1.6 - @0xproject/sol-doc@1.0.1 - @0xproject/sol-resolver@1.0.12 - @0xproject/sra-report@1.0.12 - @0xproject/sra-spec@1.0.5 - @0xproject/subproviders@2.0.6 - @0xproject/testnet-faucets@1.0.50 - @0xproject/types@1.1.2 - @0xproject/typescript-typings@3.0.0 - @0xproject/utils@2.0.0 - @0xproject/web3-wrapper@3.0.2 - @0xproject/website@0.0.53 --- packages/0x.js/package.json | 32 ++++++++++++++++---------------- packages/abi-gen/package.json | 8 ++++---- packages/assert/package.json | 8 ++++---- packages/asset-buyer/package.json | 24 ++++++++++++------------ packages/base-contract/package.json | 10 +++++----- packages/connect/package.json | 14 +++++++------- packages/contract-wrappers/package.json | 30 +++++++++++++++--------------- packages/contracts/package.json | 26 +++++++++++++------------- packages/dev-utils/package.json | 14 +++++++------- packages/ethereum-types/package.json | 2 +- packages/fill-scenarios/package.json | 18 +++++++++--------- packages/json-schemas/package.json | 6 +++--- packages/metacoin/package.json | 24 ++++++++++++------------ packages/migrations/package.json | 24 ++++++++++++------------ packages/monorepo-scripts/package.json | 2 +- packages/order-utils/package.json | 20 ++++++++++---------- packages/order-watcher/package.json | 30 +++++++++++++++--------------- packages/react-docs/package.json | 10 +++++----- packages/react-shared/package.json | 4 ++-- packages/sol-compiler/package.json | 20 ++++++++++---------- packages/sol-cov/package.json | 16 ++++++++-------- packages/sol-doc/package.json | 10 +++++----- packages/sol-resolver/package.json | 6 +++--- packages/sra-report/package.json | 8 ++++---- packages/sra-spec/package.json | 4 ++-- packages/subproviders/package.json | 14 +++++++------- packages/testnet-faucets/package.json | 14 +++++++------- packages/types/package.json | 4 ++-- packages/typescript-typings/package.json | 4 ++-- packages/utils/package.json | 8 ++++---- packages/web3-wrapper/package.json | 12 ++++++------ packages/website/package.json | 24 ++++++++++++------------ 32 files changed, 225 insertions(+), 225 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 16650be3f..99ae39c37 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "1.0.6", + "version": "1.0.7", "engines": { "node": ">=6.12" }, @@ -41,10 +41,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 +73,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" diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 314addf52..94cc05728 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -30,10 +30,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", diff --git a/packages/assert/package.json b/packages/assert/package.json index 3726f4136..5392bf38a 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -44,9 +44,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" }, diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index ff0afb782..6db75ab17 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/asset-buyer", - "version": "1.0.1", + "version": "1.0.2", "engines": { "node": ">=6.12" }, @@ -36,17 +36,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": { diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index b87092e49..d86dfa6c7 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "2.0.5", + "version": "3.0.0", "engines": { "node": ">=6.12" }, @@ -40,10 +40,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" }, diff --git a/packages/connect/package.json b/packages/connect/package.json index 5e1fa81d4..c4961ac55 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "2.0.4", + "version": "3.0.0", "engines": { "node": ">=6.12" }, @@ -43,12 +43,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", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 1deb6a425..b561fff75 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -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", @@ -41,10 +41,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 +72,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", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 5cc239ae7..edd2f96b5 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.47", + "version": "2.1.48", "engines": { "node": ">=6.12" }, @@ -45,11 +45,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 +72,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", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 876bb60d7..bd8f50d3c 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -42,12 +42,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": { diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 32fad87cb..b65e5b25b 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-types", - "version": "1.0.8", + "version": "1.0.9", "engines": { "node": ">=6.12" }, diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 7b551f790..12e591dac 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "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", @@ -26,7 +26,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 +37,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" }, diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 02f00ccc3..495f9ba78 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -38,14 +38,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", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 2c05be45e..accfa00a6 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.21", + "version": "0.0.22", "engines": { "node": ">=6.12" }, @@ -28,25 +28,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", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 50cd1a2d0..7374c5210 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "1.0.12", + "version": "1.0.13", "engines": { "node": ">=6.12" }, @@ -30,10 +30,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 +44,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" }, diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index e776569b1..748b88f6a 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/monorepo-scripts", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 7307f161d..832a112dc 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-utils", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -38,7 +38,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 +57,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", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 001f6c048..f2469f172 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -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", @@ -42,9 +42,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 +70,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" diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index aea186f6a..48df0b3cc 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -23,7 +23,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 +33,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": "*", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 9ffafc4ee..67c644bf3 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "1.0.12", + "version": "1.0.13", "engines": { "node": ">=6.12" }, @@ -24,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", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 9d1610180..8aed81e23 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "1.1.5", + "version": "1.1.6", "engines": { "node": ">=6.12" }, @@ -41,7 +41,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 +64,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", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index dff24181c..9b284c6d3 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "2.1.5", + "version": "2.1.6", "engines": { "node": ">=6.12" }, @@ -41,13 +41,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", diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 618cb7ef7..2f8525ff4 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -1,6 +1,6 @@ { "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", @@ -24,10 +24,10 @@ "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", "lodash": "^4.17.10", "yargs": "^12.0.2" }, diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index 535749bc6..e8bf1721b 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -30,8 +30,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": { diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 6b73fb6e0..976a74aa0 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "1.0.11", + "version": "1.0.12", "engines": { "node": ">=6.12" }, @@ -33,13 +33,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", diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index d4e89db53..5e39eb54a 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-spec", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -34,7 +34,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", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index d513c868b..3351dc6a1 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "2.0.5", + "version": "2.0.6", "engines": { "node": ">=6.12" }, @@ -28,11 +28,11 @@ } }, "dependencies": { - "@0xproject/assert": "^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/types": "^1.1.2", + "@0xproject/typescript-typings": "^3.0.0", + "@0xproject/utils": "^2.0.0", + "@0xproject/web3-wrapper": "^3.0.2", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "@types/eth-lightwallet": "^3.0.0", @@ -41,7 +41,7 @@ "bip39": "^2.5.0", "bn.js": "^4.11.8", "eth-lightwallet": "^3.0.1", - "ethereum-types": "^1.0.8", + "ethereum-types": "^1.0.9", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "ganache-core": "0xProject/ganache-core#monorepo-dep", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index a25924de5..9f1196464 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.49", + "version": "1.0.50", "engines": { "node": ">=6.12" }, @@ -17,13 +17,13 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^1.0.6", - "@0xproject/subproviders": "^2.0.5", - "@0xproject/typescript-typings": "^2.0.2", - "@0xproject/utils": "^1.0.11", - "@0xproject/web3-wrapper": "^3.0.1", + "0x.js": "^1.0.7", + "@0xproject/subproviders": "^2.0.6", + "@0xproject/typescript-typings": "^3.0.0", + "@0xproject/utils": "^2.0.0", + "@0xproject/web3-wrapper": "^3.0.2", "body-parser": "^1.17.1", - "ethereum-types": "^1.0.8", + "ethereum-types": "^1.0.9", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "express": "^4.15.2", diff --git a/packages/types/package.json b/packages/types/package.json index f5d57635d..15f07c6f5 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "1.1.1", + "version": "1.1.2", "engines": { "node": ">=6.12" }, @@ -32,7 +32,7 @@ "dependencies": { "@types/node": "*", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.8" + "ethereum-types": "^1.0.9" }, "publishConfig": { "access": "public" diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 6db9b3160..17098efc5 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "2.0.2", + "version": "3.0.0", "engines": { "node": ">=6.12" }, @@ -26,7 +26,7 @@ "@types/bn.js": "^4.11.0", "@types/react": "*", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.8", + "ethereum-types": "^1.0.9", "popper.js": "1.14.3" }, "devDependencies": { diff --git a/packages/utils/package.json b/packages/utils/package.json index db265dd8f..a68a05d52 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "1.0.11", + "version": "2.0.0", "engines": { "node": ">=6.12" }, @@ -41,13 +41,13 @@ "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", "@types/node": "*", "abortcontroller-polyfill": "^1.1.9", "bignumber.js": "~4.1.0", "detect-node": "2.0.3", - "ethereum-types": "^1.0.8", + "ethereum-types": "^1.0.9", "ethereumjs-util": "^5.1.1", "ethers": "4.0.0-beta.14", "isomorphic-fetch": "^2.2.1", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 4c6e545a9..32e2b64cc 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "3.0.1", + "version": "3.0.2", "engines": { "node": ">=6.12" }, @@ -53,11 +53,11 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.11", - "@0xproject/json-schemas": "^1.0.4", - "@0xproject/typescript-typings": "^2.0.2", - "@0xproject/utils": "^1.0.11", - "ethereum-types": "^1.0.8", + "@0xproject/assert": "^1.0.12", + "@0xproject/json-schemas": "^1.0.5", + "@0xproject/typescript-typings": "^3.0.0", + "@0xproject/utils": "^2.0.0", + "ethereum-types": "^1.0.9", "ethereumjs-util": "^5.1.1", "ethers": "4.0.0-beta.14", "lodash": "^4.17.5" diff --git a/packages/website/package.json b/packages/website/package.json index 6adbbede0..ab8835248 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.52", + "version": "0.0.53", "engines": { "node": ">=6.12" }, @@ -19,22 +19,22 @@ "license": "Apache-2.0", "dependencies": { "0x.js": "^0.38.6", - "@0xproject/contract-wrappers": "^2.0.0", - "@0xproject/json-schemas": "^1.0.4", - "@0xproject/order-utils": "^1.0.5", - "@0xproject/react-docs": "^1.0.11", - "@0xproject/react-shared": "^1.0.12", - "@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", + "@0xproject/contract-wrappers": "^2.0.1", + "@0xproject/json-schemas": "^1.0.5", + "@0xproject/order-utils": "^1.0.6", + "@0xproject/react-docs": "^1.0.12", + "@0xproject/react-shared": "^1.0.13", + "@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", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", "bowser": "^1.9.3", "deep-equal": "^1.0.1", - "ethereum-types": "^1.0.8", + "ethereum-types": "^1.0.9", "ethereumjs-util": "^5.1.1", "find-versions": "^2.0.0", "jsonschema": "^1.2.0", -- cgit v1.2.3 From 005b7a55e866a735e86dc58ff62b0cf3301f59cd Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 29 Sep 2018 14:22:05 +0100 Subject: Fix tests --- packages/sol-doc/test/solidity_doc_generator_test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index ba08ebd00..91e0af789 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -11,12 +11,9 @@ import { chaiSetup } from './util/chai_setup'; chaiSetup.configure(); const expect = chai.expect; -let solDoc: SolDoc; +const solDoc = new SolDoc(); describe('#SolidityDocGenerator', () => { - before(() => { - solDoc = new SolDoc(); - }); it('should generate a doc object that matches the devdoc-free TokenTransferProxy fixture', async () => { const doc = await solDoc.generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, [ 'TokenTransferProxyNoDevdoc', -- cgit v1.2.3 From 2b6a9911f5f821114a65474e75f5ed52e8bad980 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 29 Sep 2018 14:22:33 +0100 Subject: Add test for methodSignature gen for methods with param/return structs --- .../fixtures/contracts/StructParamAndReturn.sol | 18 +++++++++++++++ .../sol-doc/test/solidity_doc_generator_test.ts | 26 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 packages/sol-doc/test/fixtures/contracts/StructParamAndReturn.sol diff --git a/packages/sol-doc/test/fixtures/contracts/StructParamAndReturn.sol b/packages/sol-doc/test/fixtures/contracts/StructParamAndReturn.sol new file mode 100644 index 000000000..b9a7ccdbc --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/StructParamAndReturn.sol @@ -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; + } +} diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 91e0af789..081fd4188 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -181,6 +181,32 @@ 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'); + }); }); function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contractName: string): void { -- cgit v1.2.3 From b9eb2b3918b4b1a891c07a4ccb5eb40847ae90fc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 29 Sep 2018 14:22:49 +0100 Subject: Add test that structs are documented in separate section --- packages/sol-doc/test/solidity_doc_generator_test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 081fd4188..f166fb143 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -207,6 +207,13 @@ describe('#SolidityDocGenerator', () => { 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 { -- cgit v1.2.3 From 6ffdc318e7b15cc43f4b3e0ffc39786cdf4c5c05 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 1 Oct 2018 16:10:22 +0100 Subject: Disable max file line count tslint rule for types file --- packages/ethereum-types/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index 916661638..2f3140a58 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -497,4 +497,4 @@ export interface CompilerOptions { compilerSettings?: CompilerSettings; contracts?: string[] | '*'; solcVersion?: string; -} +} // tslint:disable:max-file-line-count -- cgit v1.2.3 From dbbf04bc7d6072055911572b41afd2bf95e65c70 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 1 Oct 2018 17:53:19 +0100 Subject: Fix bug in sol-doc --- packages/sol-doc/src/cli.ts | 2 +- packages/sol-doc/src/sol_doc.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts index 11e638785..a1847e868 100644 --- a/packages/sol-doc/src/cli.ts +++ b/packages/sol-doc/src/cli.ts @@ -30,7 +30,7 @@ const JSON_TAB_WIDTH = 4; '46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResults', c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo', c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo', - '07c2bddc165e0b5005e6244dd4a9771fa61c78c4f42abd687d57567b0768136c': 'MatchedFillResults', + '6de3264a1040e027d4bdd29c71e963028238ac4ef060541078a7aced44a4d46f': 'MatchedFillResults', }; const solDoc = new SolDoc(); const doc = await solDoc.generateSolDocAsync(argv.contractsDir, argv.contracts, customTypeHashToName); diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts index 4b7cbe77c..eda767054 100644 --- a/packages/sol-doc/src/sol_doc.ts +++ b/packages/sol-doc/src/sol_doc.ts @@ -270,15 +270,15 @@ export class SolDoc { } return type; } - private _overwriteStructNames(customTypes: CustomType[], customTypeHashToName?: ObjectMap): CustomType[] { - if (_.isUndefined(customTypeHashToName)) { + private _overwriteStructNames(customTypes: CustomType[]): CustomType[] { + if (_.isUndefined(this._customTypeHashToName)) { return customTypes; } const localCustomTypes = _.cloneDeep(customTypes); - _.each(localCustomTypes, customType => { + _.each(localCustomTypes, (customType, i) => { const hash = SolDoc._generateCustomTypeHash(customType); if (!_.isUndefined(this._customTypeHashToName) && !_.isUndefined(this._customTypeHashToName[hash])) { - customType.name = this._customTypeHashToName[hash]; + localCustomTypes[i].name = this._customTypeHashToName[hash]; } }); return localCustomTypes; -- cgit v1.2.3 From 67e689158f63dfd34948bac653e37199e5c07193 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 1 Oct 2018 17:53:30 +0100 Subject: Add missing yarn.lock changes --- yarn.lock | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/yarn.lock b/yarn.lock index 8ba879315..24da3e745 100644 --- a/yarn.lock +++ b/yarn.lock @@ -676,6 +676,16 @@ ethereum-types "^1.0.5" popper.js "1.14.3" +"@0xproject/typescript-typings@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-2.0.2.tgz#1812f64e341f1d24c09b8b5a951cbde0e5fff9c2" + dependencies: + "@types/bn.js" "^4.11.0" + "@types/react" "*" + bignumber.js "~4.1.0" + ethereum-types "^1.0.8" + popper.js "1.14.3" + "@0xproject/utils@^0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@0xproject/utils/-/utils-0.7.3.tgz#ffa7c6da9bf0dd3e13694f185dcfc48a8981ff05" @@ -690,6 +700,23 @@ lodash "4.17.10" web3 "0.20.6" +"@0xproject/utils@^1.0.4": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@0xproject/utils/-/utils-1.0.11.tgz#5b53e7d9d4dbe68e219049218c9db04e97c37429" + dependencies: + "@0xproject/types" "^1.1.1" + "@0xproject/typescript-typings" "^2.0.2" + "@types/node" "*" + abortcontroller-polyfill "^1.1.9" + bignumber.js "~4.1.0" + detect-node "2.0.3" + ethereum-types "^1.0.8" + ethereumjs-util "^5.1.1" + ethers "3.0.22" + isomorphic-fetch "^2.2.1" + js-sha3 "^0.7.0" + lodash "^4.17.5" + "@0xproject/web3-wrapper@^0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@0xproject/web3-wrapper/-/web3-wrapper-0.7.3.tgz#9bd50b034b92fd505b6766b6e225f014b6d08b08" -- cgit v1.2.3 From c1fb0d7fdf73b9b457e8a7147f1c00637af81229 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 1 Oct 2018 11:52:49 -0700 Subject: Add Jason to website --- packages/website/public/images/team/jason.png | Bin 0 -> 45572 bytes packages/website/ts/pages/about/about.tsx | 7 +++++++ 2 files changed, 7 insertions(+) create mode 100644 packages/website/public/images/team/jason.png diff --git a/packages/website/public/images/team/jason.png b/packages/website/public/images/team/jason.png new file mode 100644 index 000000000..a39522252 Binary files /dev/null and b/packages/website/public/images/team/jason.png differ diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index e097578bc..037647161 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -231,6 +231,13 @@ const teamRow8: ProfileInfo[] = [ image: 'images/team/rahul.png', linkedIn: 'https://www.linkedin.com/in/rahul-singireddy-3037908a/', }, + { + name: 'Jason Somensatto', + title: 'Strategic Legal Counsel', + description: `Legal. Previously head of blockchain and crypto practice at Orrick. JD from George Washington University and undergrad at UVA.`, + image: 'images/team/jason.png', + linkedIn: 'https://www.linkedin.com/in/jasonsomensatto/', + }, ]; const advisors1: ProfileInfo[] = [ -- cgit v1.2.3 From a9ec51ac10b151de3a510ba0b4f0462232aa6e23 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 12:13:38 +0200 Subject: Remove 0x.js bundles from .npmignore --- packages/0x.js/.npmignore | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/0x.js/.npmignore b/packages/0x.js/.npmignore index 6a3eb57bd..d7ee80c97 100644 --- a/packages/0x.js/.npmignore +++ b/packages/0x.js/.npmignore @@ -4,7 +4,6 @@ webpack.config.js yarn-error.log test/ /src/ -/_bundles/ /contract_templates/ /generated_docs/ /scripts/ -- cgit v1.2.3 From 8b7888b736b9a18f03166c9095a2dec65eca4d66 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 12:37:34 +0200 Subject: Updated CHANGELOGS --- packages/0x.js/CHANGELOG.json | 9 +++++++++ packages/0x.js/CHANGELOG.md | 4 ++++ packages/abi-gen/CHANGELOG.json | 9 +++++++++ packages/abi-gen/CHANGELOG.md | 4 ++++ packages/assert/CHANGELOG.json | 9 +++++++++ packages/assert/CHANGELOG.md | 4 ++++ packages/asset-buyer/CHANGELOG.json | 9 +++++++++ packages/asset-buyer/CHANGELOG.md | 4 ++++ packages/base-contract/CHANGELOG.json | 9 +++++++++ packages/base-contract/CHANGELOG.md | 4 ++++ packages/connect/CHANGELOG.json | 9 +++++++++ packages/connect/CHANGELOG.md | 4 ++++ packages/contract-wrappers/CHANGELOG.json | 9 +++++++++ packages/contract-wrappers/CHANGELOG.md | 4 ++++ packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/CHANGELOG.md | 4 ++++ packages/ethereum-types/CHANGELOG.json | 9 +++++++++ packages/ethereum-types/CHANGELOG.md | 4 ++++ packages/fill-scenarios/CHANGELOG.json | 9 +++++++++ packages/fill-scenarios/CHANGELOG.md | 4 ++++ packages/json-schemas/CHANGELOG.json | 9 +++++++++ packages/json-schemas/CHANGELOG.md | 4 ++++ packages/migrations/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.md | 4 ++++ packages/order-utils/CHANGELOG.json | 9 +++++++++ packages/order-utils/CHANGELOG.md | 4 ++++ packages/order-watcher/CHANGELOG.json | 9 +++++++++ packages/order-watcher/CHANGELOG.md | 4 ++++ packages/react-docs/CHANGELOG.json | 9 +++++++++ packages/react-docs/CHANGELOG.md | 4 ++++ packages/react-shared/CHANGELOG.json | 9 +++++++++ packages/react-shared/CHANGELOG.md | 4 ++++ packages/sol-compiler/CHANGELOG.json | 9 +++++++++ packages/sol-compiler/CHANGELOG.md | 4 ++++ packages/sol-cov/CHANGELOG.json | 9 +++++++++ packages/sol-cov/CHANGELOG.md | 4 ++++ packages/sol-doc/CHANGELOG.json | 9 +++++++++ packages/sol-doc/CHANGELOG.md | 4 ++++ packages/sol-resolver/CHANGELOG.json | 9 +++++++++ packages/sol-resolver/CHANGELOG.md | 4 ++++ packages/sra-report/CHANGELOG.json | 9 +++++++++ packages/sra-report/CHANGELOG.md | 4 ++++ packages/sra-spec/CHANGELOG.json | 9 +++++++++ packages/sra-spec/CHANGELOG.md | 4 ++++ packages/subproviders/CHANGELOG.json | 9 +++++++++ packages/subproviders/CHANGELOG.md | 4 ++++ packages/types/CHANGELOG.json | 9 +++++++++ packages/types/CHANGELOG.md | 4 ++++ packages/typescript-typings/CHANGELOG.json | 9 +++++++++ packages/typescript-typings/CHANGELOG.md | 4 ++++ packages/utils/CHANGELOG.json | 9 +++++++++ packages/utils/CHANGELOG.md | 4 ++++ packages/web3-wrapper/CHANGELOG.json | 9 +++++++++ packages/web3-wrapper/CHANGELOG.md | 4 ++++ 54 files changed, 351 insertions(+) diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 8a0fca264..81a128c4c 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.8", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.7", diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 5bd6dee1d..eb5813c59 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.8 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.7 - _September 28, 2018_ * Dependencies updated diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 6d6d3fa0b..ab2423e88 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.12", diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 7d8958893..5f72e257d 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index dc510533e..0efcc3ac3 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.12", diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index 55b2b1c73..910904730 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.13 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.12 - _September 28, 2018_ * Dependencies updated diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index aa196c265..63eafb528 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.2", diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md index 9d6d973a4..6f125fa1a 100644 --- a/packages/asset-buyer/CHANGELOG.md +++ b/packages/asset-buyer/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.2 - _September 28, 2018_ * Dependencies updated diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 9408ffc86..92680729f 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "3.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.0", "changes": [ diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index 30ef4507e..90d7f3bc2 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.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) diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 31df1e808..2b42f1654 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "3.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.0", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 3f0a22ced..564a91685 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.1 - _October 2, 2018_ + + * Dependencies updated + ## v3.0.0 - _September 28, 2018_ * Change /order_config request to a POST instead of GET (#1091) diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 6a9a1d110..ffb15c43a 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "2.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "2.0.1", diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 8a9612be5..217347d1f 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 8d3f613b8..e825c012a 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.12", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.11", diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index f978fcbb5..4598c8e5b 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.12 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.11 - _September 28, 2018_ * Dependencies updated diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json index 50f46fc02..0552bb184 100644 --- a/packages/ethereum-types/CHANGELOG.json +++ b/packages/ethereum-types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.9", diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md index 3370531b0..0ce074916 100644 --- a/packages/ethereum-types/CHANGELOG.md +++ b/packages/ethereum-types/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index ac03ccba5..dca21f447 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.6", diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index 3abf688ed..585a31027 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.7 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.6 - _September 28, 2018_ * Dependencies updated diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index 1b6bb61bb..b9f6b08dd 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.5", diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index b0547dccf..7bfd02c9b 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 34c0d44a3..772fc6cac 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.14", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.13", diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index 685aa07c5..78b6ae149 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index b486d6503..b6c284908 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.6", "changes": [ diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 5109b9040..747c988a2 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,6 +5,10 @@ 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) diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 3a5462727..f26bf4ca4 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "2.1.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.1.0", "changes": [ diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index ef4398cab..7bc74cf2a 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.1.1 - _October 2, 2018_ + + * Dependencies updated + ## v2.1.0 - _September 28, 2018_ * Export ExpirationWatcher (#1097) diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 7f0b25c2c..3fa89b0bc 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.12", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index ccf6ccc41..48cd4d654 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.13 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.12 - _September 28, 2018_ * Dependencies updated diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index c4ccc6013..1a01527e3 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.14", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.13", diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index aa2f27266..e26a2916e 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.14 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.13 - _September 28, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index 4d22fe827..836c34e5f 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.1.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.1.6", diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index 1882f9a8f..21cfaa879 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.7 - _October 2, 2018_ + + * Dependencies updated + ## v1.1.6 - _September 28, 2018_ * Dependencies updated diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 4daf3de41..334492760 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "2.1.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "2.1.6", diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index 35b7bbc33..5c1e61c1f 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.1.7 - _October 2, 2018_ + + * Dependencies updated + ## v2.1.6 - _September 28, 2018_ * Dependencies updated diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json index 77f90ff7a..9d3f4bcde 100644 --- a/packages/sol-doc/CHANGELOG.json +++ b/packages/sol-doc/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.1", diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md index 9ff92821e..9f16fb108 100644 --- a/packages/sol-doc/CHANGELOG.md +++ b/packages/sol-doc/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.2 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.1 - _September 28, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index f14dcc5e0..6b0df115b 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.12", diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 449089e5d..22c378c92 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index c1e0a3790..7b23b1889 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.13", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.12", diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index ab16dea43..ca2b884bd 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,6 +5,10 @@ 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 diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json index 848401163..0af03193a 100644 --- a/packages/sra-spec/CHANGELOG.json +++ b/packages/sra-spec/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.0.5", diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md index f4d76fb06..67790563e 100644 --- a/packages/sra-spec/CHANGELOG.md +++ b/packages/sra-spec/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.6 - _October 2, 2018_ + + * Dependencies updated + ## v1.0.5 - _September 28, 2018_ * Dependencies updated diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 55614ba66..8ded2d2d4 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "2.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "2.0.6", diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 6039a2983..ca8f767c7 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.7 - _October 2, 2018_ + + * Dependencies updated + ## v2.0.6 - _September 28, 2018_ * Dependencies updated diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 9d2010b9a..abf62c19d 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "1.1.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "1.1.2", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 33c5d5e9c..a207a2c0c 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.3 - _October 2, 2018_ + + * Dependencies updated + ## v1.1.2 - _September 28, 2018_ * Dependencies updated diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index df6fe16e7..c3ee81bde 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "3.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "3.0.0", "changes": [ diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index 1240dbcf7..ea9e4d441 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.1 - _October 2, 2018_ + + * Dependencies updated + ## v3.0.0 - _September 28, 2018_ * Remove types for ethers.js (#1069) diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index a24d58b30..b666ee829 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "2.0.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.0", "changes": [ diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 80b3bfd2d..c62e414f8 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.1 - _October 2, 2018_ + + * Dependencies updated + ## v2.0.0 - _September 28, 2018_ * Make abi_decoder compatible with ethers ^4.0.0 (#1069) diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index 444b9e175..7261dd474 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1538475601, + "version": "3.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1538157789, "version": "3.0.2", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 5d10a3549..05e6a998b 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.3 - _October 2, 2018_ + + * Dependencies updated + ## v3.0.2 - _September 28, 2018_ * Dependencies updated -- cgit v1.2.3 From f80faf0b4870fcd6be259c4a1a46a64054d2aa31 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 14:45:16 +0200 Subject: Update package.json versions to match the npm ones --- packages/ethereum-types/package.json | 2 +- packages/json-schemas/package.json | 2 +- packages/react-shared/package.json | 2 +- packages/sol-resolver/package.json | 2 +- packages/types/package.json | 2 +- packages/typescript-typings/package.json | 2 +- packages/utils/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index b65e5b25b..c56b22194 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-types", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 495f9ba78..09d0d618f 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 67c644bf3..df7b1a974 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "1.0.13", + "version": "1.0.14", "engines": { "node": ">=6.12" }, diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index e8bf1721b..ed5ea30f0 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "1.0.12", + "version": "1.0.13", "engines": { "node": ">=6.12" }, diff --git a/packages/types/package.json b/packages/types/package.json index 15f07c6f5..bcd2474fd 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "1.1.2", + "version": "1.1.3", "engines": { "node": ">=6.12" }, diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 17098efc5..addb53040 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "3.0.0", + "version": "3.0.1", "engines": { "node": ">=6.12" }, diff --git a/packages/utils/package.json b/packages/utils/package.json index a68a05d52..68869565c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "2.0.0", + "version": "2.0.1", "engines": { "node": ">=6.12" }, -- cgit v1.2.3 From 00051ae5bb0b69e694de79bba86b2cd0ac0db6ae Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 15:17:18 +0200 Subject: Add a command to run bundle size reporter --- package.json | 10 ++++ yarn.lock | 169 ++++++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 144 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 681721bb9..7df0da7b6 100644 --- a/package.json +++ b/package.json @@ -35,15 +35,25 @@ "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" + }, + { + "path": "packages/0x.js/_bundles/index.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", diff --git a/yarn.lock b/yarn.lock index 24da3e745..8904c7564 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1387,9 +1387,9 @@ aes-js@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" -aes-js@^0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d" +aes-js@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" ajv-keywords@^2.1.0: version "2.1.1" @@ -1480,7 +1480,7 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.1.0, ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: @@ -1807,6 +1807,19 @@ aws4@^1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" +axios@0.15.3: + version "0.15.3" + resolved "http://registry.npmjs.org/axios/-/axios-0.15.3.tgz#2c9d638b2e191a08ea1d6cc988eadd6ba5bdc053" + dependencies: + follow-redirects "1.0.0" + +axios@^0.17.0: + version "0.17.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.17.1.tgz#2d8e3e5d0bdbd7327f91bc814f5c57660f81824d" + dependencies: + follow-redirects "^1.2.5" + is-buffer "^1.1.5" + babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -2455,10 +2468,6 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" -base-x@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" - base-x@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" @@ -2790,6 +2799,13 @@ brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" +brotli-size@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/brotli-size/-/brotli-size-0.0.1.tgz#8c1aeea01cd22f359b048951185bd539ff0c829f" + dependencies: + duplexer "^0.1.1" + iltorb "^1.0.9" + browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" @@ -2870,7 +2886,7 @@ browserslist@^2.1.2: caniuse-lite "^1.0.30000792" electron-to-chromium "^1.3.30" -bs58@=4.0.1: +bs58@=4.0.1, bs58@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: @@ -2880,18 +2896,13 @@ bs58@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" -bs58@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e" - dependencies: - base-x "^1.1.0" - -bs58check@^1.0.8: - version "1.3.4" - resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8" +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" dependencies: - bs58 "^3.1.0" + bs58 "^4.0.0" create-hash "^1.1.0" + safe-buffer "^5.1.2" btoa@1.1.2: version "1.1.2" @@ -2968,11 +2979,26 @@ builtins@^1.0.3: version "1.0.3" resolved "http://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" +bundlesize@^0.17.0: + version "0.17.0" + resolved "https://registry.yarnpkg.com/bundlesize/-/bundlesize-0.17.0.tgz#212ae5731ab0554d2acd509d23e1de18640b2008" + dependencies: + axios "^0.17.0" + brotli-size "0.0.1" + bytes "^3.0.0" + ci-env "^1.4.0" + commander "^2.11.0" + github-build "^1.2.0" + glob "^7.1.2" + gzip-size "^4.0.0" + prettycli "^1.4.3" + read-pkg-up "^3.0.0" + byline@^5.0.0: version "5.0.0" resolved "http://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" -bytes@3.0.0: +bytes@3.0.0, bytes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -3165,6 +3191,14 @@ chain-function@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.0.tgz#0d4ab37e7e18ead0bdc47b920764118ce58733dc" +chalk@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + chalk@2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" @@ -3312,6 +3346,10 @@ chownr@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" +ci-env@^1.4.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/ci-env/-/ci-env-1.6.1.tgz#3e3ef4fc528a2825397f912cfa30cde17ec364cc" + ci-info@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.3.tgz#710193264bb05c77b8c90d02f5aaf22216a667b2" @@ -3596,6 +3634,10 @@ commander@2.15.1, commander@^2.12.1, commander@^2.8.1: version "2.15.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" +commander@^2.11.0: + version "2.18.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.18.0.tgz#2bf063ddee7c7891176981a2cc798e5754bc6970" + commander@^2.7.1: version "2.17.1" resolved "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" @@ -4213,7 +4255,7 @@ debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6. dependencies: ms "2.0.0" -debug@3.1.0, debug@^3.1.0: +debug@3.1.0, debug@=3.1.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: @@ -4506,6 +4548,10 @@ detect-indent@^5.0.0: version "5.0.0" resolved "http://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" +detect-libc@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-0.2.0.tgz#47fdf567348a17ec25fcbf0b9e446348a76f9fb5" + detect-libc@^1.0.2, detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" @@ -5277,7 +5323,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0: +ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" dependencies: @@ -5331,17 +5377,18 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: rustbn.js "~0.1.1" safe-buffer "^5.1.1" -ethereumjs-wallet@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb" +ethereumjs-wallet@~0.6.0: + version "0.6.2" + resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" dependencies: - aes-js "^0.2.3" - bs58check "^1.0.8" - ethereumjs-util "^4.4.0" - hdkey "^0.7.0" + aes-js "^3.1.1" + bs58check "^2.1.2" + ethereumjs-util "^5.2.0" + hdkey "^1.0.0" + safe-buffer "^5.1.2" scrypt.js "^0.2.0" - utf8 "^2.1.1" - uuid "^2.0.1" + utf8 "^3.0.0" + uuid "^3.3.2" ethers@3.0.22: version "3.0.22" @@ -5903,6 +5950,18 @@ flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: inherits "^2.0.1" readable-stream "^2.0.4" +follow-redirects@1.0.0: + version "1.0.0" + resolved "http://registry.npmjs.org/follow-redirects/-/follow-redirects-1.0.0.tgz#8e34298cbd2e176f254effec75a1c78cc849fd37" + dependencies: + debug "^2.2.0" + +follow-redirects@^1.2.5: + version "1.5.8" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.8.tgz#1dbfe13e45ad969f813e86c00e5296f525c885a1" + dependencies: + debug "=3.1.0" + for-each@^0.3.2, for-each@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4" @@ -6115,7 +6174,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep: ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-util "^5.2.0" ethereumjs-vm "2.3.5" - ethereumjs-wallet "0.6.0" + ethereumjs-wallet "~0.6.0" fake-merkle-patricia-tree "~1.0.1" heap "~0.2.6" js-scrypt "^0.2.0" @@ -6267,6 +6326,12 @@ gitconfiglocal@^1.0.0: dependencies: ini "^1.3.2" +github-build@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/github-build/-/github-build-1.2.0.tgz#b0bdb705ae4088218577e863c1a301030211051f" + dependencies: + axios "0.15.3" + github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" @@ -6633,6 +6698,13 @@ gulplog@^1.0.0: dependencies: glogg "^1.0.0" +gzip-size@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-4.1.0.tgz#8ae096257eabe7d69c45be2b67c448124ffb517c" + dependencies: + duplexer "^0.1.1" + pify "^3.0.0" + handle-thing@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" @@ -6797,13 +6869,21 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -hdkey@^0.7.0, hdkey@^0.7.1: +hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" dependencies: coinstring "^2.0.0" secp256k1 "^3.0.1" +hdkey@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29" + dependencies: + coinstring "^2.0.0" + safe-buffer "^5.1.1" + secp256k1 "^3.0.1" + he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -7067,6 +7147,15 @@ ignore@^3.3.5: version "3.3.7" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" +iltorb@^1.0.9: + version "1.3.10" + resolved "https://registry.yarnpkg.com/iltorb/-/iltorb-1.3.10.tgz#a0d9e4e7d52bf510741442236cbe0cc4230fc9f8" + dependencies: + detect-libc "^0.2.0" + nan "^2.6.2" + node-gyp "^3.6.2" + prebuild-install "^2.3.0" + image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" @@ -10875,7 +10964,7 @@ postman-url-encoder@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/postman-url-encoder/-/postman-url-encoder-1.0.1.tgz#a094a42e9415ff0bbfdce0eaa8e6011d449ee83c" -prebuild-install@^2.2.2: +prebuild-install@^2.2.2, prebuild-install@^2.3.0: version "2.5.3" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.5.3.tgz#9f65f242782d370296353710e9bc843490c19f69" dependencies: @@ -10947,6 +11036,12 @@ pretty-ms@3.1.0: parse-ms "^1.0.0" plur "^2.1.2" +prettycli@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/prettycli/-/prettycli-1.4.3.tgz#b28ec2aad9de07ae1fd75ef294fb54cbdee07ed5" + dependencies: + chalk "2.1.0" + prismjs@^1.15.0: version "1.15.0" resolved "https://registry.npmjs.org/prismjs/-/prismjs-1.15.0.tgz#8801d332e472091ba8def94976c8877ad60398d9" @@ -13296,7 +13391,7 @@ supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3: dependencies: has-flag "^1.0.0" -supports-color@^4.2.1: +supports-color@^4.0.0, supports-color@^4.2.1: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" dependencies: @@ -14332,6 +14427,10 @@ utf8@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" +utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -- cgit v1.2.3 From c3be851c180480e7d181ab1aa9f09caf0fb4d093 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 15:20:08 +0200 Subject: Check bundle size on CI --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2231ae796..a1f11921a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -179,6 +179,7 @@ jobs: - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn prettier:ci - run: yarn lerna run lint + - run: yarn bundlesize submit-coverage: docker: - image: circleci/node:9 -- cgit v1.2.3 From 1059acf56f3cccc28a7bac5a6c513476c189d403 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 15:23:12 +0200 Subject: Fix no_website CI builds --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1f11921a..6c1525101 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: - node_modules/ - run: > if [ -z "$(git diff --name-only development packages/website)" ]; then - yarn build --exclude website + yarn build:no_website else yarn build fi -- cgit v1.2.3 From f884cc826f7a136b1ba66ae972528feda15d9d63 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 15:44:30 +0200 Subject: Fix linter errors --- packages/ethereum-types/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index 2f3140a58..7e8b9de3e 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -497,4 +497,4 @@ export interface CompilerOptions { compilerSettings?: CompilerSettings; contracts?: string[] | '*'; solcVersion?: string; -} // tslint:disable:max-file-line-count +} // tslint:disable-line:max-file-line-count -- cgit v1.2.3 From 16720d4fc7efeafcb75f00128eb6f380dbbefa83 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 15:58:47 +0200 Subject: Measure only one bundle size as they're the same --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 7df0da7b6..fce0598fa 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,6 @@ "bundlesize": [ { "path": "packages/0x.js/_bundles/index.min.js" - }, - { - "path": "packages/0x.js/_bundles/index.js" } ], "devDependencies": { -- cgit v1.2.3 From f4e4eef48e703afb923ba4f969fc77f32be81745 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 16:37:35 +0200 Subject: Introduce a build:ci command that doesn't build webpack bundles --- package.json | 1 + packages/0x.js/package.json | 1 + packages/abi-gen/package.json | 1 + packages/assert/package.json | 1 + packages/asset-buyer/package.json | 1 + packages/base-contract/package.json | 1 + packages/connect/package.json | 1 + packages/contract-wrappers/package.json | 1 + packages/contracts/package.json | 1 + packages/dev-utils/package.json | 1 + packages/ethereum-types/package.json | 1 + packages/fill-scenarios/package.json | 1 + packages/json-schemas/package.json | 1 + packages/metacoin/package.json | 1 + packages/migrations/package.json | 1 + packages/monorepo-scripts/package.json | 1 + packages/order-utils/package.json | 1 + packages/order-watcher/package.json | 1 + packages/react-docs/package.json | 1 + packages/react-shared/package.json | 1 + packages/sol-compiler/package.json | 1 + packages/sol-cov/package.json | 1 + packages/sol-doc/package.json | 1 + packages/sol-resolver/package.json | 1 + packages/sra-report/package.json | 1 + packages/sra-spec/package.json | 1 + packages/subproviders/package.json | 1 + packages/testnet-faucets/package.json | 1 + packages/tslint-config/package.json | 1 + packages/types/package.json | 1 + packages/typescript-typings/package.json | 1 + packages/utils/package.json | 1 + packages/web3-wrapper/package.json | 1 + packages/website/package.json | 1 + 34 files changed, 34 insertions(+) diff --git a/package.json b/package.json index fce0598fa..0efbc85eb 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "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:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build", "build:ts": "tsc -b", diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 99ae39c37..c89a3e613 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -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", diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 94cc05728..fd239ca21 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -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", diff --git a/packages/assert/package.json b/packages/assert/package.json index 5392bf38a..b536d31f4 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -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", diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index 6db75ab17..4f63f0a40 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -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": { diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index d86dfa6c7..e95a753e6 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -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", diff --git a/packages/connect/package.json b/packages/connect/package.json index c4961ac55..c8f53d526 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -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 .", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index b561fff75..22dd6521c 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -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/**/*", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index edd2f96b5..6d4534eac 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -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", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index bd8f50d3c..c0f6107b3 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -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", diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index c56b22194..d52f39a2d 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -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" diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 12e591dac..54c2f90da 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -6,6 +6,7 @@ "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", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 09d0d618f..dc3e97a86 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -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", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index accfa00a6..d7c5aadec 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -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", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 7374c5210..896570cd4 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -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", diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 748b88f6a..ba4c4fead 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -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", diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 832a112dc..9fefdba5e 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -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;", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index f2469f172..9f57dd6fd 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -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", diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 48df0b3cc..0379e9e2f 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -10,6 +10,7 @@ "scripts": { "lint": "tslint --project .", "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib" }, "author": "Fabio Berger", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index df7b1a974..95bf849ad 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -10,6 +10,7 @@ "scripts": { "lint": "tslint --project .", "build": "tsc", + "build:ci": "yarn build", "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib" }, diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 8aed81e23..d7e9653e0 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -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", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 9b284c6d3..4711c9770 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -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", diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json index 2de4443d6..0b0c7c963 100644 --- a/packages/sol-doc/package.json +++ b/packages/sol-doc/package.json @@ -6,6 +6,7 @@ "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", diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index ed5ea30f0..a91abaf42 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -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 ." }, diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 976a74aa0..0b6f9896b 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -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", diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 5e39eb54a..5b4bc821e 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -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", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 3351dc6a1..f9063228f 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -9,6 +9,7 @@ "license": "Apache-2.0", "scripts": { "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "run_mocha_unit": "mocha --require source-map-support/register --require make-promises-safe lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 9f1196464..33f557538 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -9,6 +9,7 @@ "main": "server.js", "scripts": { "build": "node ../../node_modules/gulp/bin/gulp.js build", + "build:ci": "yarn build", "dev": "node ../../node_modules/gulp/bin/gulp.js run", "start": "node ./server/server.js", "lint": "tslint --project .", diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 4b0694012..91596d32a 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -8,6 +8,7 @@ "main": "tslint.json", "scripts": { "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib", "lint": "tslint --project ." }, diff --git a/packages/types/package.json b/packages/types/package.json index bcd2474fd..2901b067c 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -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 ." }, diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index addb53040..07ac730ff 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -7,6 +7,7 @@ "description": "0x project typescript type definitions", "scripts": { "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib" }, "repository": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 68869565c..d2ed67554 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -9,6 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib", "lint": "tslint --project .", "test": "yarn run_mocha", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 32e2b64cc..5b5c0ec5b 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -9,6 +9,7 @@ "types": "lib/src/index.d.ts", "scripts": { "build": "tsc -b", + "build:ci": "yarn build", "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "test": "yarn run_mocha", diff --git a/packages/website/package.json b/packages/website/package.json index ab8835248..8c115d8a0 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -8,6 +8,7 @@ "description": "Website and 0x portal dapp", "scripts": { "build": "NODE_ENV=production node --max_old_space_size=8192 ../../node_modules/.bin/webpack", + "build:ci": "yarn build", "clean": "shx rm -f public/bundle*", "lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'", "watch_without_deps": "webpack-dev-server --content-base public --https", -- cgit v1.2.3 From 9e3d1cd63d1ed521496118f90b79515c723bd5a0 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 16:43:36 +0200 Subject: Move bundle-size out of static tests and don't wait for a build with static tests --- .circleci/config.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c1525101..f83fdf3f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -173,12 +173,19 @@ jobs: working_directory: ~/repo docker: - image: circleci/node:9 + steps: + - checkout + - run: yarn prettier:ci + - run: yarn lerna run lint + bundle-size: + docker: + - image: circleci/node:9 + working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn prettier:ci - - run: yarn lerna run lint + - run: cd packages/0x.js && yarn build:umd:prod - run: yarn bundlesize submit-coverage: docker: @@ -254,7 +261,8 @@ workflows: - test-rest: requires: - build - - static-tests: + - static-tests + - bundle-size: requires: - build - test-publish: -- cgit v1.2.3 From 97616eb8e4c3a8af81337eda8f5d97de59c6fc1f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 16:52:08 +0200 Subject: Split CI install and build steps --- .circleci/config.yml | 34 ++++++++++++++++++++++++++++------ package.json | 1 + 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f83fdf3f0..dbe3b3fdd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - build: + install-dependencies: resource_class: medium+ docker: - image: circleci/node:9 @@ -29,11 +29,26 @@ jobs: key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - node_modules/ + - save_cache: + key: repo-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/repo + build: + resource_class: medium+ + docker: + - image: circleci/node:9 + environment: + CONTRACTS_COMMIT_HASH: '9ed05f5' + working_directory: ~/repo + steps: + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: > if [ -z "$(git diff --name-only development packages/website)" ]; then - yarn build:no_website + yarn build:ci:no_website else - yarn build + yarn build:ci fi - save_cache: key: repo-{{ .Environment.CIRCLE_SHA1 }} @@ -174,7 +189,9 @@ jobs: docker: - image: circleci/node:9 steps: - - checkout + - restore_cache: + keys: + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn prettier:ci - run: yarn lerna run lint bundle-size: @@ -251,7 +268,10 @@ workflows: version: 2 main: jobs: - - build + - install-dependencies + - build: + requires: + - install-dependencies - test-contracts-ganache: requires: - build @@ -261,7 +281,9 @@ workflows: - test-rest: requires: - build - - static-tests + - static-tests: + requires: + - install-dependencies - bundle-size: requires: - build diff --git a/package.json b/package.json index 0efbc85eb..5b2a7b200 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "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", -- cgit v1.2.3 From 52ac84335cd4516614d32bf7aa97dfc102b49a49 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:03:09 +0200 Subject: Add yarn cache path --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbe3b3fdd..3f07a493d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,6 +29,7 @@ jobs: key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - node_modules/ + - ~/.cache/yarn - save_cache: key: repo-{{ .Environment.CIRCLE_SHA1 }} paths: -- cgit v1.2.3 From a02e6c044161834c58bf009e3cdbfe30fe23bfd9 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:05:35 +0200 Subject: Run linter before prettier as it fails more often --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f07a493d..6d0630bcd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -193,8 +193,8 @@ jobs: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn prettier:ci - run: yarn lerna run lint + - run: yarn prettier:ci bundle-size: docker: - image: circleci/node:9 -- cgit v1.2.3 From ddc0813d90f49035c3104f8da3ebdaf04acf98a8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:07:12 +0200 Subject: Cache yarn cache directory without node modules --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d0630bcd..d4607b99d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,6 @@ jobs: name: Save Yarn Package Cache key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - - node_modules/ - ~/.cache/yarn - save_cache: key: repo-{{ .Environment.CIRCLE_SHA1 }} -- cgit v1.2.3 From 86cc98b24559d05b034c7117e57cfd2ab73ac0e9 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:15:47 +0200 Subject: Build tslint rules before running linter --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4607b99d..72c4a6252 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -192,6 +192,7 @@ jobs: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} + - run: cd packages/tslint-config && yarn build:ci - run: yarn lerna run lint - run: yarn prettier:ci bundle-size: -- cgit v1.2.3 From 3a93c8a6e08666ac6c737e1da363ee04188174a7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:18:55 +0200 Subject: Separate deps and built caches --- .circleci/config.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 72c4a6252..9fe90ee94 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,10 +14,10 @@ jobs: - restore_cache: name: Restore Yarn Package Cache keys: - - yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-{{ .Branch }} - - yarn-packages-master - - yarn-packages- + - yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-packages-v1-{{ .Branch }} + - yarn-packages-v1-master + - yarn-packages-v1- - run: name: install-yarn command: sudo npm install --global yarn@1.9.4 @@ -26,11 +26,11 @@ jobs: command: yarn --frozen-lockfile install || yarn --frozen-lockfile install - save_cache: name: Save Yarn Package Cache - key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }} + key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn - save_cache: - key: repo-{{ .Environment.CIRCLE_SHA1 }} + key: repo-deps-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/repo build: @@ -43,7 +43,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-deps-{{ .Environment.CIRCLE_SHA1 }} - run: > if [ -z "$(git diff --name-only development packages/website)" ]; then yarn build:ci:no_website @@ -51,7 +51,7 @@ jobs: yarn build:ci fi - save_cache: - key: repo-{{ .Environment.CIRCLE_SHA1 }} + key: repo-built-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/repo test-contracts-ganache: @@ -61,7 +61,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - run: yarn wsrun test:circleci contracts test-contracts-geth: docker: @@ -71,7 +71,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is # initialized - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts @@ -84,7 +84,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - run: yarn test:publish:circleci test-doc-generation: docker: @@ -93,7 +93,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - run: yarn test:generate_docs:circleci test-rest: docker: @@ -102,7 +102,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - run: yarn wsrun test:circleci @0xproject/abi-gen - run: yarn wsrun test:circleci @0xproject/assert - run: yarn wsrun test:circleci @0xproject/base-contract @@ -191,7 +191,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-deps-{{ .Environment.CIRCLE_SHA1 }} - run: cd packages/tslint-config && yarn build:ci - run: yarn lerna run lint - run: yarn prettier:ci @@ -202,7 +202,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - run: cd packages/0x.js && yarn build:umd:prod - run: yarn bundlesize submit-coverage: @@ -212,7 +212,7 @@ jobs: steps: - restore_cache: keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} + - repo-built-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} -- cgit v1.2.3 From 8c985eb579803692cb696ee0028bd132345cfd8e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 1 Oct 2018 17:30:23 +0200 Subject: Fix linter issue --- packages/contract-wrappers/src/contract_wrappers.ts | 2 +- .../src/fetchers/order_filled_cancelled_fetcher.ts | 1 - packages/contract-wrappers/src/utils/assert.ts | 2 +- packages/contract-wrappers/src/utils/decorators.ts | 5 ++--- .../src/utils/exchange_transfer_simulator.ts | 2 +- packages/contract-wrappers/src/utils/filter_utils.ts | 2 +- .../src/utils/transaction_encoder.ts | 2 +- .../test/calldata_optimization_utils_test.ts | 1 - .../contract-wrappers/test/erc721_wrapper_test.ts | 19 ++++++++++--------- .../test/ether_token_wrapper_test.ts | 2 +- .../contract-wrappers/test/forwarder_wrapper_test.ts | 10 ++++------ .../test/order_validator_wrapper_test.ts | 12 +++++------- packages/contract-wrappers/test/subscription_test.ts | 12 ++---------- packages/web3-wrapper/src/utils.ts | 4 ++-- 14 files changed, 31 insertions(+), 45 deletions(-) diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 4272cc943..89402029b 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -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 diff --git a/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts index ba6f5fb5e..7a252aed3 100644 --- a/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts +++ b/packages/contract-wrappers/src/fetchers/order_filled_cancelled_fetcher.ts @@ -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 { diff --git a/packages/contract-wrappers/src/utils/assert.ts b/packages/contract-wrappers/src/utils/assert.ts index bed833b8f..30726c546 100644 --- a/packages/contract-wrappers/src/utils/assert.ts +++ b/packages/contract-wrappers/src/utils/assert.ts @@ -1,7 +1,7 @@ import { assert as sharedAssert } from '@0xproject/assert'; // HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here import { Schema } from '@0xproject/json-schemas'; // tslint:disable-line:no-unused-variable -import { 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'; diff --git a/packages/contract-wrappers/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts index d6bf6ec1e..e17246015 100644 --- a/packages/contract-wrappers/src/utils/decorators.ts +++ b/packages/contract-wrappers/src/utils/decorators.ts @@ -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 { 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); diff --git a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts index 279f2a796..a7c4a238f 100644 --- a/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts +++ b/packages/contract-wrappers/src/utils/exchange_transfer_simulator.ts @@ -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, diff --git a/packages/contract-wrappers/src/utils/filter_utils.ts b/packages/contract-wrappers/src/utils/filter_utils.ts index 0e73987f7..c05be062c 100644 --- a/packages/contract-wrappers/src/utils/filter_utils.ts +++ b/packages/contract-wrappers/src/utils/filter_utils.ts @@ -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'; diff --git a/packages/contract-wrappers/src/utils/transaction_encoder.ts b/packages/contract-wrappers/src/utils/transaction_encoder.ts index 8821079dc..87cbb43fd 100644 --- a/packages/contract-wrappers/src/utils/transaction_encoder.ts +++ b/packages/contract-wrappers/src/utils/transaction_encoder.ts @@ -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; } diff --git a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts index a3abb8503..94e55bffa 100644 --- a/packages/contract-wrappers/test/calldata_optimization_utils_test.ts +++ b/packages/contract-wrappers/test/calldata_optimization_utils_test.ts @@ -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'; diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts index ab6ff0984..10bac6086 100644 --- a/packages/contract-wrappers/test/erc721_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts @@ -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( diff --git a/packages/contract-wrappers/test/ether_token_wrapper_test.ts b/packages/contract-wrappers/test/ether_token_wrapper_test.ts index c15b8c016..c48fc224f 100644 --- a/packages/contract-wrappers/test/ether_token_wrapper_test.ts +++ b/packages/contract-wrappers/test/ether_token_wrapper_test.ts @@ -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, diff --git a/packages/contract-wrappers/test/forwarder_wrapper_test.ts b/packages/contract-wrappers/test/forwarder_wrapper_test.ts index a969807b2..f77b47337 100644 --- a/packages/contract-wrappers/test/forwarder_wrapper_test.ts +++ b/packages/contract-wrappers/test/forwarder_wrapper_test.ts @@ -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'; diff --git a/packages/contract-wrappers/test/order_validator_wrapper_test.ts b/packages/contract-wrappers/test/order_validator_wrapper_test.ts index 2fdb00a71..baac3eeee 100644 --- a/packages/contract-wrappers/test/order_validator_wrapper_test.ts +++ b/packages/contract-wrappers/test/order_validator_wrapper_test.ts @@ -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; diff --git a/packages/contract-wrappers/test/subscription_test.ts b/packages/contract-wrappers/test/subscription_test.ts index 68ef7225e..6ec7519fe 100644 --- a/packages/contract-wrappers/test/subscription_test.ts +++ b/packages/contract-wrappers/test/subscription_test.ts @@ -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) => - _.noop; + _.noop.bind(_); contractWrappers.erc20Token.subscribe( tokenAddress, ERC20TokenEvents.Approval, diff --git a/packages/web3-wrapper/src/utils.ts b/packages/web3-wrapper/src/utils.ts index 01605dc9a..0b568aac5 100644 --- a/packages/web3-wrapper/src/utils.ts +++ b/packages/web3-wrapper/src/utils.ts @@ -37,7 +37,7 @@ export const utils = { const hexBase = 16; const valueHex = valueBigNumber.toString(hexBase); - return valueBigNumber.lessThan(0) ? '-0x' + valueHex.substr(1) : '0x' + valueHex; + return valueBigNumber.lessThan(0) ? `-0x${valueHex.substr(1)}` : `0x${valueHex}`; }, numberToHex(value: number): string { if (!isFinite(value) && !utils.isHexStrict(value)) { @@ -48,7 +48,7 @@ export const utils = { const hexBase = 16; const result = valueBigNumber.toString(hexBase); - return valueBigNumber.lt(0) ? '-0x' + result.substr(1) : '0x' + result; + return valueBigNumber.lt(0) ? `-0x${result.substr(1)}` : `0x${result}`; }, isHexStrict(hex: string | number): boolean { return ( -- cgit v1.2.3 From 10f3ee32a4bfd2dbb28e24c35006b3e80e069c96 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 11:07:46 +0200 Subject: Ignore linter issues --- packages/sol-doc/src/sol_doc.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts index eda767054..138882c92 100644 --- a/packages/sol-doc/src/sol_doc.ts +++ b/packages/sol-doc/src/sol_doc.ts @@ -302,7 +302,7 @@ export class SolDoc { break; default: throw new Error( - `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, + `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, // tslint:disable-line:no-unnecessary-type-assertion ); } customTypes = [...customTypes, ...types]; @@ -340,7 +340,7 @@ export class SolDoc { break; default: throw new Error( - `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, + `unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`, // tslint:disable-line:no-unnecessary-type-assertion ); } } @@ -486,7 +486,7 @@ export class SolDoc { }); } if (!_.isUndefined((abiDefinition as any).outputs)) { - const methodAbi = abiDefinition as MethodAbi; + 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); -- cgit v1.2.3 From cc7710abd2dfdfc4ac05d23883c0359561d43f4b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 11:12:14 +0200 Subject: Explicitly specify yarn cache folder --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9fe90ee94..05192c1d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: command: sudo npm install --global yarn@1.9.4 - run: name: yarn - command: yarn --frozen-lockfile install || yarn --frozen-lockfile install + command: yarn --cache-folder ~/.cache/yarn --frozen-lockfile install || yarn --cache-folder ~/.cache/yarn --frozen-lockfile install - save_cache: name: Save Yarn Package Cache key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} -- cgit v1.2.3 From 194a5de5641bdc994fcb653fe28d51ca172db03c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 11:32:38 +0200 Subject: Cache all nested node_modules directories --- .circleci/config.yml | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 05192c1d9..889b292a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,10 +14,10 @@ jobs: - restore_cache: name: Restore Yarn Package Cache keys: - - yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-v1-{{ .Branch }} - - yarn-packages-v1-master - - yarn-packages-v1- + - yarn-packages-v2-{{ .Branch }}-{{ checksum "yarn.lock" }} + - yarn-packages-v2-{{ .Branch }} + - yarn-packages-v2-master + - yarn-packages-v2- - run: name: install-yarn command: sudo npm install --global yarn@1.9.4 @@ -26,9 +26,46 @@ jobs: command: yarn --cache-folder ~/.cache/yarn --frozen-lockfile install || yarn --cache-folder ~/.cache/yarn --frozen-lockfile install - save_cache: name: Save Yarn Package Cache - key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} + key: yarn-packages-v2-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn + - node_modules + - packages/0x.js/node_modules + - packages/abi-gen/node_modules + - packages/assert/node_modules + - packages/asset-buyer/node_modules + - packages/base-contract/node_modules + - packages/connect/node_modules + - packages/contract-wrappers/node_modules + - packages/contract_templates/node_modules + - packages/contracts/node_modules + - packages/dev-utils/node_modules + - packages/devnet/node_modules + - packages/ethereum-types/node_modules + - packages/fill-scenarios/node_modules + - packages/json-schemas/node_modules + - packages/metacoin/node_modules + - packages/migrations/node_modules + - packages/monorepo-scripts/node_modules + - packages/order-utils/node_modules + - packages/order-watcher/node_modules + - packages/react-docs/node_modules + - packages/react-shared/node_modules + - packages/sol-compiler/node_modules + - packages/sol-cov/node_modules + - packages/sol-doc/node_modules + - packages/sol-resolver/node_modules + - packages/sra-report/node_modules + - packages/sra-spec/node_modules + - packages/subproviders/node_modules + - packages/testnet-faucets/node_modules + - packages/tslint-config/node_modules + - packages/types/node_modules + - packages/typescript-typings/node_modules + - packages/utils/node_modules + - packages/verdaccio/node_modules + - packages/web3-wrapper/node_modules + - packages/website/node_modules - save_cache: key: repo-deps-{{ .Environment.CIRCLE_SHA1 }} paths: -- cgit v1.2.3 From 8ee34c49a9c8b29be3440251dcb8746ad6b11a00 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 11:38:51 +0200 Subject: Remove deps cache all together --- .circleci/config.yml | 51 +-------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 889b292a6..8940ad0aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,61 +11,12 @@ 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-v2-{{ .Branch }}-{{ checksum "yarn.lock" }} - - yarn-packages-v2-{{ .Branch }} - - yarn-packages-v2-master - - yarn-packages-v2- - run: name: install-yarn command: sudo npm install --global yarn@1.9.4 - run: name: yarn - command: yarn --cache-folder ~/.cache/yarn --frozen-lockfile install || yarn --cache-folder ~/.cache/yarn --frozen-lockfile install - - save_cache: - name: Save Yarn Package Cache - key: yarn-packages-v2-{{ .Branch }}-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn - - node_modules - - packages/0x.js/node_modules - - packages/abi-gen/node_modules - - packages/assert/node_modules - - packages/asset-buyer/node_modules - - packages/base-contract/node_modules - - packages/connect/node_modules - - packages/contract-wrappers/node_modules - - packages/contract_templates/node_modules - - packages/contracts/node_modules - - packages/dev-utils/node_modules - - packages/devnet/node_modules - - packages/ethereum-types/node_modules - - packages/fill-scenarios/node_modules - - packages/json-schemas/node_modules - - packages/metacoin/node_modules - - packages/migrations/node_modules - - packages/monorepo-scripts/node_modules - - packages/order-utils/node_modules - - packages/order-watcher/node_modules - - packages/react-docs/node_modules - - packages/react-shared/node_modules - - packages/sol-compiler/node_modules - - packages/sol-cov/node_modules - - packages/sol-doc/node_modules - - packages/sol-resolver/node_modules - - packages/sra-report/node_modules - - packages/sra-spec/node_modules - - packages/subproviders/node_modules - - packages/testnet-faucets/node_modules - - packages/tslint-config/node_modules - - packages/types/node_modules - - packages/typescript-typings/node_modules - - packages/utils/node_modules - - packages/verdaccio/node_modules - - packages/web3-wrapper/node_modules - - packages/website/node_modules + command: yarn --frozen-lockfile install || yarn --frozen-lockfile install - save_cache: key: repo-deps-{{ .Environment.CIRCLE_SHA1 }} paths: -- cgit v1.2.3 From fed7e0c8583133a928a7d9d0d811c0c324e90002 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 11:45:22 +0200 Subject: Merge build & install --- .circleci/config.yml | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8940ad0aa..37a10f2f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - install-dependencies: + build: resource_class: medium+ docker: - image: circleci/node:9 @@ -17,21 +17,6 @@ jobs: - run: name: yarn command: yarn --frozen-lockfile install || yarn --frozen-lockfile install - - save_cache: - key: repo-deps-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ~/repo - build: - resource_class: medium+ - docker: - - image: circleci/node:9 - environment: - CONTRACTS_COMMIT_HASH: '9ed05f5' - working_directory: ~/repo - steps: - - restore_cache: - keys: - - repo-deps-{{ .Environment.CIRCLE_SHA1 }} - run: > if [ -z "$(git diff --name-only development packages/website)" ]; then yarn build:ci:no_website @@ -176,21 +161,12 @@ jobs: working_directory: ~/repo docker: - image: circleci/node:9 - steps: - - restore_cache: - keys: - - repo-deps-{{ .Environment.CIRCLE_SHA1 }} - - run: cd packages/tslint-config && yarn build:ci - - run: yarn lerna run lint - - run: yarn prettier:ci - bundle-size: - docker: - - image: circleci/node:9 - working_directory: ~/repo steps: - restore_cache: keys: - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - run: yarn lint + - run: yarn prettier:ci - run: cd packages/0x.js && yarn build:umd:prod - run: yarn bundlesize submit-coverage: @@ -257,10 +233,7 @@ workflows: version: 2 main: jobs: - - install-dependencies - - build: - requires: - - install-dependencies + - build - test-contracts-ganache: requires: - build @@ -271,9 +244,6 @@ workflows: requires: - build - static-tests: - requires: - - install-dependencies - - bundle-size: requires: - build - test-publish: -- cgit v1.2.3 From d6e0dc4bd2ec6629a11b3fb7a70cdd9ea359b46e Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 12:01:03 +0200 Subject: Change the lint command back --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37a10f2f8..0ff947c54 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -165,7 +165,7 @@ jobs: - restore_cache: keys: - repo-built-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn lint + - run: yarn lerna run lint - run: yarn prettier:ci - run: cd packages/0x.js && yarn build:umd:prod - run: yarn bundlesize -- cgit v1.2.3 From a4153144dbd2a46d51069e57ba7c1402e5867154 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 2 Oct 2018 13:40:30 +0200 Subject: Change cache key back to repo from repo-built --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ff947c54..f288a46e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,7 +24,7 @@ jobs: yarn build:ci fi - save_cache: - key: repo-built-{{ .Environment.CIRCLE_SHA1 }} + key: repo-{{ .Environment.CIRCLE_SHA1 }} paths: - ~/repo test-contracts-ganache: @@ -34,7 +34,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn wsrun test:circleci contracts test-contracts-geth: docker: @@ -44,7 +44,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} # HACK(albrow): we need to sleep 10 seconds to ensure the devnet is # initialized - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts @@ -57,7 +57,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn test:publish:circleci test-doc-generation: docker: @@ -66,7 +66,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn test:generate_docs:circleci test-rest: docker: @@ -75,7 +75,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn wsrun test:circleci @0xproject/abi-gen - run: yarn wsrun test:circleci @0xproject/assert - run: yarn wsrun test:circleci @0xproject/base-contract @@ -164,7 +164,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - run: yarn lerna run lint - run: yarn prettier:ci - run: cd packages/0x.js && yarn build:umd:prod @@ -176,7 +176,7 @@ jobs: steps: - restore_cache: keys: - - repo-built-{{ .Environment.CIRCLE_SHA1 }} + - repo-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }} -- cgit v1.2.3