diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-20 00:56:46 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-20 00:56:46 +0800 |
commit | 11bac66046e10cd152d328f03f97e04c10d9a40c (patch) | |
tree | 926741e9383264f5c121dc8f046adfabde699eec /packages | |
parent | e4ea6e1ec3693b2106b1ba28869277488ebca6d3 (diff) | |
parent | 2a438419ab3bc32dba43918cf2eb480439ef81de (diff) | |
download | dexon-0x-contracts-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.gz dexon-0x-contracts-11bac66046e10cd152d328f03f97e04c10d9a40c.tar.zst dexon-0x-contracts-11bac66046e10cd152d328f03f97e04c10d9a40c.zip |
Merge branch 'development' into feature/sra-report/collection-tests
* development: (26 commits)
Change title
Add Blake and Zach to About page
Re-size Jacob and Tom's images
Manually publish 0x.js back to a working state
Publish
Publish
Fix 0x.js assets
Remove assets from connect and _bundles from packages that don't generate the folder
Publish
Fix packages that aren't working as expected
Make new packages default to public on publish
Add new public packages to top-level README
Update top-level package.json
Fix incorrect new versions
Fix path to assets
Publish
Updated CHANGELOGS
Fix quotation marks
Add a complex test for ast visitor
Move opcodes to constants
...
Diffstat (limited to 'packages')
81 files changed, 1205 insertions, 332 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 78368d89b..b01f3541f 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -1,8 +1,9 @@ # CHANGELOG -## v0.33.2 - _TBD, 2018_ +## v0.33.2 - _March 18, 2018_ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) + * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) ## v0.33.1 - _March 8, 2018_ diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 0cb01d352..9c85fe74d 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "0.33.1", + "version": "0.33.6", "description": "A javascript library for interacting with the 0x protocol", "keywords": [ "0x.js", @@ -33,9 +33,14 @@ "config": { "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken", "postpublish": { - "assets": ["_bundles/index.js", "_bundles/index.min.js"], + "assets": [ + "packages/0x.js/_bundles/index.js", + "packages/0x.js/_bundles/index.min.js" + ], "docPublishConfigs": { - "extraFileIncludes": ["../types/src/index.ts"], + "extraFileIncludes": [ + "../types/src/index.ts" + ], "s3BucketPath": "s3://0xjs-docs-jsons/", "s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/" } @@ -50,10 +55,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.2.5", - "@0xproject/dev-utils": "^0.2.1", - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/abi-gen": "^0.2.7", + "@0xproject/dev-utils": "^0.3.2", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/bintrees": "^1.0.2", "@types/jsonschema": "^1.1.1", "@types/lodash": "^4.14.86", @@ -64,9 +69,9 @@ "awesome-typescript-loader": "^3.1.3", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.10", + "chai-as-promised-typescript-typings": "^0.0.12", "chai-bignumber": "^2.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "json-loader": "^0.5.4", @@ -89,26 +94,26 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.2.0", - "@0xproject/base-contract": "^0.0.3", - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", - "@0xproject/web3-wrapper": "^0.2.1", + "@0xproject/assert": "^0.2.3", + "@0xproject/base-contract": "^0.0.5", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "bintrees": "^1.0.2", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-blockstream": "^2.0.6", "ethereumjs-util": "^5.1.1", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "js-sha3": "^0.7.0", "lodash": "^4.17.4", "uuid": "^3.1.0", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 22a5fee10..09da4b046 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -1,5 +1,5 @@ import { schemas, SchemaValidator } from '@0xproject/json-schemas'; -import { TransactionReceiptWithDecodedLogs } from '@0xproject/types'; +import { ECSignature, Order, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types'; import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as ethUtil from 'ethereumjs-util'; @@ -15,7 +15,7 @@ import { OrderStateWatcher } from './order_watcher/order_state_watcher'; import { zeroExConfigSchema } from './schemas/zero_ex_config_schema'; import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema'; import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema'; -import { ECSignature, Order, SignedOrder, Web3Provider, ZeroExConfig, ZeroExError } from './types'; +import { Web3Provider, ZeroExConfig, ZeroExError } from './types'; import { assert } from './utils/assert'; import { constants } from './utils/constants'; import { decorators } from './utils/decorators'; diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 20b46c6bc..6414985e6 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -1,5 +1,12 @@ import { schemas } from '@0xproject/json-schemas'; -import { BlockParamLiteral, DecodedLogArgs, LogWithDecodedArgs } from '@0xproject/types'; +import { + BlockParamLiteral, + DecodedLogArgs, + ECSignature, + LogWithDecodedArgs, + Order, + SignedOrder, +} from '@0xproject/types'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -8,19 +15,16 @@ import * as Web3 from 'web3'; import { artifacts } from '../artifacts'; import { BlockRange, - ECSignature, EventCallback, ExchangeContractErrCodes, ExchangeContractErrs, IndexedFilterValues, MethodOpts, - Order, OrderAddresses, OrderCancellationRequest, OrderFillRequest, OrderTransactionOpts, OrderValues, - SignedOrder, ValidateOrderFillableOpts, } from '../types'; import { assert } from '../utils/assert'; diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 9879bbb56..7885fb82a 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,9 +1,6 @@ export { ZeroEx } from './0x'; export { - Order, - SignedOrder, - ECSignature, ZeroExError, EventCallback, ExchangeContractErrs, @@ -34,6 +31,9 @@ export { BlockParam, ContractEventArg, LogWithDecodedArgs, + Order, + SignedOrder, + ECSignature, TransactionReceipt, TransactionReceiptWithDecodedLogs, } from '@0xproject/types'; diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts index e489dd5cc..f7515e59e 100644 --- a/packages/0x.js/src/order_watcher/order_state_watcher.ts +++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts @@ -1,5 +1,5 @@ import { schemas } from '@0xproject/json-schemas'; -import { BlockParamLiteral, LogWithDecodedArgs } from '@0xproject/types'; +import { BlockParamLiteral, LogWithDecodedArgs, SignedOrder } from '@0xproject/types'; import { AbiDecoder, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -31,7 +31,6 @@ import { OnOrderStateChangeCallback, OrderState, OrderStateWatcherConfig, - SignedOrder, ZeroExError, } from '../types'; import { assert } from '../utils/assert'; diff --git a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts index 20b09d606..184c13aa4 100644 --- a/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts +++ b/packages/0x.js/src/order_watcher/remaining_fillable_calculator.ts @@ -1,7 +1,6 @@ +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import { SignedOrder } from '../types'; - export class RemainingFillableCalculator { private _signedOrder: SignedOrder; private _isMakerTokenZRX: boolean; diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts index 2f17e30c2..65342b694 100644 --- a/packages/0x.js/src/types.ts +++ b/packages/0x.js/src/types.ts @@ -1,6 +1,13 @@ import { BigNumber } from '@0xproject/utils'; -import { BlockParam, BlockParamLiteral, ContractEventArg, LogWithDecodedArgs } from '@0xproject/types'; +import { + BlockParam, + BlockParamLiteral, + ContractEventArg, + LogWithDecodedArgs, + Order, + SignedOrder, +} from '@0xproject/types'; import * as Web3 from 'web3'; @@ -37,15 +44,6 @@ export enum InternalZeroExError { WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY', } -/** - * Elliptic Curve signature - */ -export interface ECSignature { - v: number; - r: string; - s: string; -} - export type OrderAddresses = [string, string, string, string, string]; export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber]; @@ -107,25 +105,6 @@ export interface ContractEvent { export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs; -export interface Order { - maker: string; - taker: string; - makerFee: BigNumber; - takerFee: BigNumber; - makerTokenAmount: BigNumber; - takerTokenAmount: BigNumber; - makerTokenAddress: string; - takerTokenAddress: string; - salt: BigNumber; - exchangeContractAddress: string; - feeRecipient: string; - expirationUnixTimestampSec: BigNumber; -} - -export interface SignedOrder extends Order { - ecSignature: ECSignature; -} - // [address, name, symbol, decimals, ipfsHash, swarmHash] export type TokenMetadata = [string, string, string, number, string, string]; diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts index c21f2dbca..5e8004cd0 100644 --- a/packages/0x.js/src/utils/assert.ts +++ b/packages/0x.js/src/utils/assert.ts @@ -3,11 +3,11 @@ import { assert as sharedAssert } from '@0xproject/assert'; // tslint:disable-next-line:no-unused-variable import { Schema } from '@0xproject/json-schemas'; // tslint:disable-next-line:no-unused-variable +import { ECSignature } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; -import { ECSignature } from '../types'; import { signatureUtils } from '../utils/signature_utils'; export const assert = { diff --git a/packages/0x.js/src/utils/order_state_utils.ts b/packages/0x.js/src/utils/order_state_utils.ts index b7a55ff42..38189443b 100644 --- a/packages/0x.js/src/utils/order_state_utils.ts +++ b/packages/0x.js/src/utils/order_state_utils.ts @@ -1,3 +1,4 @@ +import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; @@ -6,14 +7,7 @@ import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator'; import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store'; import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store'; -import { - ExchangeContractErrs, - OrderRelevantState, - OrderState, - OrderStateInvalid, - OrderStateValid, - SignedOrder, -} from '../types'; +import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types'; const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001; diff --git a/packages/0x.js/src/utils/order_validation_utils.ts b/packages/0x.js/src/utils/order_validation_utils.ts index 917d414c8..f32bf43d0 100644 --- a/packages/0x.js/src/utils/order_validation_utils.ts +++ b/packages/0x.js/src/utils/order_validation_utils.ts @@ -1,9 +1,10 @@ +import { Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { ZeroEx } from '../0x'; import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper'; -import { ExchangeContractErrs, Order, SignedOrder, TradeSide, TransferType, ZeroExError } from '../types'; +import { ExchangeContractErrs, TradeSide, TransferType, ZeroExError } from '../types'; import { constants } from '../utils/constants'; import { utils } from '../utils/utils'; diff --git a/packages/0x.js/src/utils/signature_utils.ts b/packages/0x.js/src/utils/signature_utils.ts index b0f1d61ef..46f167339 100644 --- a/packages/0x.js/src/utils/signature_utils.ts +++ b/packages/0x.js/src/utils/signature_utils.ts @@ -1,7 +1,6 @@ +import { ECSignature } from '@0xproject/types'; import * as ethUtil from 'ethereumjs-util'; -import { ECSignature } from '../types'; - export const signatureUtils = { isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean { const dataBuff = ethUtil.toBuffer(data); diff --git a/packages/0x.js/src/utils/utils.ts b/packages/0x.js/src/utils/utils.ts index 3e98de84f..c8bcd907e 100644 --- a/packages/0x.js/src/utils/utils.ts +++ b/packages/0x.js/src/utils/utils.ts @@ -1,12 +1,10 @@ -import { SolidityTypes } from '@0xproject/types'; +import { Order, SignedOrder, SolidityTypes } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import BN = require('bn.js'); import * as ethABI from 'ethereumjs-abi'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; -import { Order, SignedOrder } from '../types'; - export const utils = { /** * Converts BigNumber instance to BN diff --git a/packages/0x.js/test/remaining_fillable_calculator_test.ts b/packages/0x.js/test/remaining_fillable_calculator_test.ts index 4c6b8f3ac..d97402ef6 100644 --- a/packages/0x.js/test/remaining_fillable_calculator_test.ts +++ b/packages/0x.js/test/remaining_fillable_calculator_test.ts @@ -1,10 +1,10 @@ +import { ECSignature, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import 'mocha'; import { ZeroEx } from '../src/0x'; import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fillable_calculator'; -import { ECSignature, SignedOrder } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index e7581fb10..d1d01a90d 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## v0.2.5 - _TBD, 2018_ +## v0.2.5 - _March 18, 2018_ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 9e0e53630..fc1adeb06 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "0.2.5", + "version": "0.2.7", "description": "Generate contract wrappers from ABI and handlebars templates", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/utils": "^0.4.1", + "@0xproject/utils": "^0.4.3", "chalk": "^2.3.0", "glob": "^7.1.2", "handlebars": "^4.0.11", @@ -34,8 +34,8 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/glob": "^5.0.33", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", @@ -46,9 +46,9 @@ "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/assert/package.json b/packages/assert/package.json index 0c8c64e16..1d888d987 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,13 +1,13 @@ { "name": "@0xproject/assert", - "version": "0.2.0", + "version": "0.2.3", "description": "Provides a standard way of performing type and schema validation across 0x projects", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf _bundles lib test_temp scripts", + "clean": "shx rm -rf lib test_temp scripts", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha": "mocha lib/test/**/*_test.js", "prepublishOnly": "run-p build", @@ -26,29 +26,29 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", - "nyc": "^11.0.1", "chai": "^4.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/utils": "^0.4.1", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/utils": "^0.4.3", "lodash": "^4.17.4", "valid-url": "^1.0.9" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index cfb336106..87c29c828 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "0.0.3", + "version": "0.0.5", "description": "0x Base TS contract", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,8 +20,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", @@ -30,15 +30,15 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.3.1", - "@0xproject/web3-wrapper": "^0.2.1", + "@0xproject/types": "^0.4.1", + "@0xproject/web3-wrapper": "^0.3.1", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "lodash": "^4.17.4", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/chai-as-promised-typescript-typings/package.json b/packages/chai-as-promised-typescript-typings/package.json index d22f45d28..cbf2630ec 100644 --- a/packages/chai-as-promised-typescript-typings/package.json +++ b/packages/chai-as-promised-typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "chai-as-promised-typescript-typings", - "version": "0.0.10", + "version": "0.0.12", "description": "Typescript type definitions for chai-as-promised", "main": "index.d.ts", "types": "index.d.ts", @@ -22,14 +22,14 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/chai-as-promised-typescript-typings#readme", "dependencies": { - "chai-typescript-typings": "^0.0.4" + "chai-typescript-typings": "^0.0.6" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/monorepo-scripts": "^0.1.14", "copyfiles": "^1.2.0", "shx": "^0.2.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/chai-typescript-typings/package.json b/packages/chai-typescript-typings/package.json index e8981b8cd..96b58cce3 100644 --- a/packages/chai-typescript-typings/package.json +++ b/packages/chai-typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "chai-typescript-typings", - "version": "0.0.4", + "version": "0.0.6", "description": "Typescript type definitions for chai", "main": "index.d.ts", "types": "index.d.ts", @@ -18,11 +18,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/chai-typescript-typings#readme", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/monorepo-scripts": "^0.1.14", "copyfiles": "^1.2.0", "shx": "^0.2.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index e1fb7c795..bd5a8eafc 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.6.4 - _March 18, 2018_ + + * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) + ## v0.6.2 - _February 16, 2018_ * Fix JSON parse empty response (#407) diff --git a/packages/connect/package.json b/packages/connect/package.json index e0478b42a..3861ecb3e 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "0.6.3", + "version": "0.6.6", "description": "A javascript library for interacting with the standard relayer api", "keywords": [ "connect", @@ -14,7 +14,7 @@ "scripts": { "build:watch": "tsc -w", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "clean": "shx rm -rf _bundles lib test_temp scripts", + "clean": "shx rm -rf lib test_temp scripts", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", @@ -27,7 +27,7 @@ }, "config": { "postpublish": { - "assets": ["_bundles/index.js", "_bundles/index.min.js"], + "assets": [], "docPublishConfigs": { "s3BucketPath": "s3://connect-docs-jsons/", "s3StagingBucketPath": "s3://staging-connect-docs-jsons/" @@ -48,40 +48,41 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^0.2.0", - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/utils": "^0.4.1", + "@0xproject/assert": "^0.2.3", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", "query-string": "^5.0.1", "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/fetch-mock": "^5.12.1", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/query-string": "^5.0.1", "@types/websocket": "^0.0.34", - "nyc": "^11.0.1", "async-child-process": "^1.1.1", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.10", - "chai-typescript-typings": "^0.0.4", + "chai-as-promised-typescript-typings": "^0.0.12", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "fetch-mock": "^5.13.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "typedoc": "~0.8.0", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index a221b54e8..5806f1d43 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -1,5 +1,6 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; +import { SignedOrder } from '@0xproject/types'; import 'isomorphic-fetch'; import * as _ from 'lodash'; import * as queryString from 'query-string'; @@ -15,7 +16,6 @@ import { OrderbookResponse, OrdersRequestOpts, PagedRequestOpts, - SignedOrder, TokenPairsItem, TokenPairsRequestOpts, } from './types'; diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index bb42384f9..135b5b5f6 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -2,10 +2,8 @@ export { HttpClient } from './http_client'; export { WebSocketOrderbookChannel } from './ws_orderbook_channel'; export { Client, - ECSignature, FeesRequest, FeesResponse, - Order, OrderbookChannel, OrderbookChannelHandler, OrderbookChannelSubscriptionOpts, @@ -13,9 +11,10 @@ export { OrderbookResponse, OrdersRequestOpts, PagedRequestOpts, - SignedOrder, TokenPairsItem, TokenPairsRequestOpts, TokenTradeInfo, WebSocketOrderbookChannelConfig, } from './types'; + +export { ECSignature, Order, SignedOrder } from '@0xproject/types'; diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts index 5f837b0b3..5c344e328 100644 --- a/packages/connect/src/types.ts +++ b/packages/connect/src/types.ts @@ -1,34 +1,6 @@ +import { ECSignature, Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -// TODO: Consolidate Order, SignedOrder and ECSignature into a shared package instead of duplicating them from 0x.js -export interface Order { - maker: string; - taker: string; - makerFee: BigNumber; - takerFee: BigNumber; - makerTokenAmount: BigNumber; - takerTokenAmount: BigNumber; - makerTokenAddress: string; - takerTokenAddress: string; - salt: BigNumber; - exchangeContractAddress: string; - feeRecipient: string; - expirationUnixTimestampSec: BigNumber; -} - -export interface SignedOrder extends Order { - ecSignature: ECSignature; -} - -/** - * Elliptic Curve signature - */ -export interface ECSignature { - v: number; - r: string; - s: string; -} - export interface Client { getTokenPairsAsync: (requestOpts?: TokenPairsRequestOpts & PagedRequestOpts) => Promise<TokenPairsItem[]>; getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<SignedOrder[]>; diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index 668461bf4..cf1c07bd9 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -1,8 +1,9 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; +import { SignedOrder } from '@0xproject/types'; import * as _ from 'lodash'; -import { FeesResponse, OrderbookResponse, SignedOrder, TokenPairsItem } from '../types'; +import { FeesResponse, OrderbookResponse, TokenPairsItem } from '../types'; import { typeConverters } from './type_converters'; diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 371aba8ab..b7d35e61a 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.15", + "version": "2.1.19", "description": "Smart contract components of 0x protocol", "main": "index.js", "directories": { @@ -40,8 +40,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/dev-utils": "^0.2.1", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/dev-utils": "^0.3.2", + "@0xproject/tslint-config": "^0.4.12", "@types/bluebird": "^3.5.3", "@types/lodash": "^4.14.86", "@types/node": "^8.0.53", @@ -49,12 +49,12 @@ "@types/yargs": "^10.0.0", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.10", + "chai-as-promised-typescript-typings": "^0.0.12", "chai-bignumber": "^2.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -63,16 +63,16 @@ "types-bn": "^0.0.1", "types-ethereumjs-util": "0xProject/types-ethereumjs-util", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0", + "web3-typescript-typings": "^0.10.2", "yargs": "^10.0.3" }, "dependencies": { - "0x.js": "^0.33.1", - "@0xproject/deployer": "^0.2.1", - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", - "@0xproject/web3-wrapper": "^0.2.1", + "0x.js": "^0.33.6", + "@0xproject/deployer": "^0.3.2", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "bluebird": "^3.5.0", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md index 68134b14f..7d2a0f5e8 100644 --- a/packages/deployer/CHANGELOG.md +++ b/packages/deployer/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG -## v0.3.0 - _TBD, 2018_ +## v0.3.1 - _March 18, 2018_ + + * Add TS types for `yargs` + +## v0.3.0 - _March 18, 2018_ * Add support for Solidity 0.4.20 and 0.4.21 * Replace `jsonrpcPort` config with `jsonrpcUrl` (#426) @@ -11,6 +15,7 @@ * Remove 0x-specific `migrate` command (#426) * Allow deployer to accept a provider instead of port and host. This makes it possible to run it with in-process ganache-core (#426) * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) + * Add `#!/usr/bin/env node` pragma above `cli.ts` script to fix command-line error. ## v0.2.0 - _March 4, 2018_ diff --git a/packages/deployer/package.json b/packages/deployer/package.json index 71fe4d9d7..19b696f5a 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/deployer", - "version": "0.2.1", + "version": "0.3.2", "description": "Smart contract deployer of 0x protocol", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -30,25 +30,26 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/deployer/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/require-from-string": "^1.2.0", + "@types/yargs": "^11.0.0", "chai": "^4.0.1", "copyfiles": "^1.2.0", - "nyc": "^11.0.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "mocha": "^4.0.1", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "types-bn": "^0.0.1", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "dependencies": { - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", - "@0xproject/web3-wrapper": "^0.2.1", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "ethereumjs-util": "^5.1.1", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", @@ -59,6 +60,6 @@ "yargs": "^10.0.3" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index 063366d47..7913c6344 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -1,3 +1,6 @@ +#!/usr/bin/env node +// We need the above pragma since this script will be run as a command-line tool. + import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; diff --git a/packages/dev-utils/.npmignore b/packages/dev-utils/.npmignore new file mode 100644 index 000000000..05fa23a59 --- /dev/null +++ b/packages/dev-utils/.npmignore @@ -0,0 +1,6 @@ +.* +yarn-error.log +/src/ +/scripts/ +test/ +tsconfig.json diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 8193b78ac..b8a0209d3 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,6 +1,11 @@ # CHANGELOG -## v0.3.0 - _TBD, 2018_ +## v0.3.1 - _March 18, 2018_ + + * Reduce npm package size by adding an `.npmignore` file. + * Move `@0xproject/web3_wrapper` to dependencies from devDependencies. + +## v0.3.0 - _March 18, 2018_ * Add coverage subprovider if SOLIDITY_COVERAGE env variable is true (#426) * Refactor `BlockchainLifecycle` to work with in-process ganache (#426) diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index bfe752982..a4ed33244 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "0.2.1", + "version": "0.3.2", "description": "0x dev TS utils", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -25,17 +25,16 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", - "@0xproject/web3-wrapper": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", - "nyc": "^11.0.1", "chai": "^4.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "types-bn": "^0.0.1", @@ -43,10 +42,11 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/sol-cov": "^0.0.1", - "@0xproject/subproviders": "^0.7.0", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", + "@0xproject/sol-cov": "^0.0.4", + "@0xproject/subproviders": "^0.8.2", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", "request-promise-native": "^1.0.5", @@ -54,6 +54,6 @@ "web3-provider-engine": "^13.0.1" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/ethers-typescript-typings/package.json b/packages/ethers-typescript-typings/package.json index 1e349fa93..d797033e1 100644 --- a/packages/ethers-typescript-typings/package.json +++ b/packages/ethers-typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "ethers-typescript-typings", - "version": "0.0.2", + "version": "0.0.4", "description": "Typescript type definitions for ethers.js", "main": "index.d.ts", "types": "index.d.ts", @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethers-typescript-typings#readme", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/monorepo-scripts": "^0.1.14", "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", @@ -31,6 +31,6 @@ "typescript": "2.7.1" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 84ed0c209..1df34a4ef 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "0.7.14", + "version": "0.7.17", "description": "0x-related json schemas", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -12,7 +12,7 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", "run_mocha": "mocha lib/test/**/*_test.js", - "clean": "shx rm -rf _bundles lib test_temp scripts", + "clean": "shx rm -rf lib test_temp scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts" }, "repository": { @@ -30,25 +30,25 @@ "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", - "@0xproject/utils": "^0.4.1", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", + "@0xproject/utils": "^0.4.3", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", - "nyc": "^11.0.1", "chai": "^4.0.1", - "chai-typescript-typings": "^0.0.4", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "lodash.foreach": "^4.5.0", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/monorepo-scripts/CHANGELOG.md b/packages/monorepo-scripts/CHANGELOG.md index bb685a436..670eb4db6 100644 --- a/packages/monorepo-scripts/CHANGELOG.md +++ b/packages/monorepo-scripts/CHANGELOG.md @@ -1,5 +1,5 @@ CHANGELOG -## v0.1.13 - _TBD_ +## v0.1.13 - _March 18, 2018_ * Add postpublish utils diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index e0ca3cd1f..a8f4918ca 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/monorepo-scripts", - "version": "0.1.12", + "version": "0.1.14", "description": "Helper scripts for the monorepo", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -30,12 +30,15 @@ "typescript": "2.7.1" }, "dependencies": { - "es6-promisify": "^5.0.0", "async-child-process": "^1.1.1", - "publish-release": "0xproject/publish-release", "chalk": "^2.3.0", + "es6-promisify": "^5.0.0", "glob": "^7.1.2", "lodash": "^4.17.4", + "publish-release": "0xproject/publish-release", "semver-sort": "^0.0.4" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index 605f68a23..51caca505 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -1,9 +1,8 @@ { - "name": "@0xproject/react-docs-example", - "version": "0.0.1", "private": true, - "description": - "An example app using react-docs", + "name": "@0xproject/react-docs-example", + "version": "0.0.4", + "description": "An example app using react-docs", "scripts": { "lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'", "build": "tsc", @@ -11,28 +10,26 @@ "build:watch": "tsc -w", "clean": "shx rm -rf lib; shx rm -f public/bundle*", "dev": "webpack-dev-server --open", - "deploy_example": - "npm run build:example; aws s3 sync ./public/. s3://react-docs-example --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers" + "deploy_example": "npm run build:example; aws s3 sync ./public/. s3://react-docs-example --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers" }, "author": "Fabio Berger", "license": "Apache-2.0", "bugs": { "url": "https://github.com/0xProject/0x-monorepo/issues" }, - "homepage": - "https://github.com/0xProject/0x-monorepo/packages/react-docs-example/README.md", + "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-docs-example/README.md", "repository": { "type": "git", "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/tslint-config": "^0.4.12", + "@types/lodash": "^4.14.86", "@types/material-ui": "0.18.0", + "@types/node": "^8.0.53", "@types/react": "^15.0.15", "@types/react-dom": "^0.14.23", "@types/react-tap-event-plugin": "0.0.30", - "@types/lodash": "^4.14.86", - "@types/node": "^8.0.53", "awesome-typescript-loader": "^3.1.3", "copyfiles": "^1.2.0", "css-loader": "^0.28.9", @@ -40,16 +37,17 @@ "less": "^2.7.2", "less-loader": "^2.2.3", "raw-loader": "^0.5.1", + "shx": "^0.2.2", "source-map-loader": "^0.2.3", "style-loader": "^0.20.2", "shx": "^0.2.2", - "tslint": "5.8.0", + "tslint": "^5.9.1", "typescript": "2.7.1", "webpack": "^3.11.0", "webpack-dev-server": "^2.11.1" }, "dependencies": { - "@0xproject/react-docs": "^0.0.1", + "@0xproject/react-docs": "^0.0.4", "basscss": "^8.0.3", "lodash": "^4.17.4", "material-ui": "^0.17.1", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index a90cf19f0..7c46013b1 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG -## v0.0.2 - _TBD, 2018_ +## v0.0.3 - _March 18, 2018_ + + * Move TS typings from devDependencies to dependencies since they are needed by the package user. + +## v0.0.2 - _March 18, 2018_ * Move example out into a separate sub-package * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 1c489a17b..06480a948 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "0.0.1", + "version": "0.0.4", "description": "React documentation component for rendering TypeDoc & Doxity generated JSON", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -21,9 +21,17 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.2.1", - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/dev-utils": "^0.3.2", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", + "tslint": "^5.9.1", + "typescript": "2.7.1" + }, + "dependencies": { + "@0xproject/react-shared": "^0.0.4", + "@0xproject/utils": "^0.4.3", "@types/lodash": "^4.14.86", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", @@ -31,14 +39,6 @@ "@types/react-dom": "^0.14.23", "@types/react-scroll": "0.0.31", "@types/react-tap-event-plugin": "0.0.30", - "copyfiles": "^1.2.0", - "shx": "^0.2.2", - "tslint": "5.8.0", - "typescript": "2.7.1" - }, - "dependencies": { - "@0xproject/react-shared": "^0.0.1", - "@0xproject/utils": "^0.4.1", "basscss": "^8.0.3", "compare-versions": "^3.0.1", "lodash": "^4.17.4", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index d9a4bf085..2125fffdd 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "0.0.1", + "version": "0.0.4", "description": "0x shared react components", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -21,21 +21,21 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^0.2.1", - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", - "@types/lodash": "^4.14.86", - "@types/material-ui": "0.18.0", - "@types/node": "^8.0.53", - "@types/react": "^15.0.15", - "@types/react-dom": "^0.14.23", - "@types/react-scroll": "0.0.31", + "@0xproject/dev-utils": "^0.3.2", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" }, "dependencies": { + "@types/lodash": "^4.14.86", + "@types/material-ui": "0.18.0", + "@types/node": "^8.0.53", + "@types/react": "^15.0.15", + "@types/react-dom": "^0.14.23", + "@types/react-scroll": "0.0.31", "basscss": "^8.0.3", "is-mobile": "^0.2.2", "lodash": "^4.17.4", diff --git a/packages/sol-cov/coverage/.gitkeep b/packages/sol-cov/coverage/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/sol-cov/coverage/.gitkeep diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 84e58f8d8..3292921fb 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,14 +1,19 @@ { "name": "@0xproject/sol-cov", - "version": "0.0.1", + "version": "0.0.4", "description": "Generate coverage reports for Solidity code", - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", + "test": "run-s clean build run_mocha", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "test:circleci": "yarn test:coverage", + "run_mocha": "mocha lib/test/**/*_test.js", "clean": "shx rm -rf lib scripts", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts" + "build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts" }, "repository": { "type": "git", @@ -20,7 +25,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/subproviders": "^0.7.0", + "@0xproject/subproviders": "^0.8.2", "@0xproject/utils": "^0.3.4", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", @@ -33,15 +38,25 @@ "web3": "^0.20.0" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.9", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/istanbul": "^0.4.29", + "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", + "chai": "^4.0.1", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", + "dirty-chai": "^2.0.1", + "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", + "sinon": "^4.0.0", "tslint": "5.8.0", "typescript": "2.7.1", "web3-typescript-typings": "^0.9.11" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/sol-cov/src/ast_visitor.ts b/packages/sol-cov/src/ast_visitor.ts index 66190afec..88309d3eb 100644 --- a/packages/sol-cov/src/ast_visitor.ts +++ b/packages/sol-cov/src/ast_visitor.ts @@ -113,8 +113,8 @@ export class ASTVisitor { this._statementMap[this._entryId++] = this._getExpressionRange(ast); } private _getExpressionRange(ast: Parser.ASTNode): SingleFileSourceRange { - const start = this._locationByOffset[ast.range[0] - 1]; - const end = this._locationByOffset[ast.range[1]]; + const start = this._locationByOffset[ast.range[0]]; + const end = this._locationByOffset[ast.range[1] + 1]; const range = { start, end, diff --git a/packages/sol-cov/src/collect_coverage_entries.ts b/packages/sol-cov/src/collect_coverage_entries.ts index 6da81fbfc..97218616c 100644 --- a/packages/sol-cov/src/collect_coverage_entries.ts +++ b/packages/sol-cov/src/collect_coverage_entries.ts @@ -10,7 +10,7 @@ import { getLocationByOffset } from './source_maps'; // Parsing source code for each transaction/code is slow and therefore we cache it const coverageEntriesBySourceHash: { [sourceHash: string]: CoverageEntriesDescription } = {}; -export const collectCoverageEntries = (contractSource: string, fileName: string) => { +export const collectCoverageEntries = (contractSource: string) => { const sourceHash = ethUtil.sha3(contractSource).toString('hex'); if (_.isUndefined(coverageEntriesBySourceHash[sourceHash])) { const ast = parser.parse(contractSource, { range: true }); diff --git a/packages/sol-cov/src/constants.ts b/packages/sol-cov/src/constants.ts index 970734f2d..64d2228a3 100644 --- a/packages/sol-cov/src/constants.ts +++ b/packages/sol-cov/src/constants.ts @@ -1,3 +1,8 @@ +// tslint:disable:number-literal-format export const constants = { NEW_CONTRACT: 'NEW_CONTRACT', + PUSH1: 0x60, + PUSH2: 0x61, + PUSH32: 0x7f, + TIMESTAMP: 0x42, }; diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index b1ba8b22b..230ccc3c9 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -39,7 +39,7 @@ export class CoverageManager { fileIndex: number, ): Coverage { const fileName = contractData.sources[fileIndex]; - const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex], fileName); + const coverageEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex]); let sourceRanges = _.map(coveredPcs, coveredPc => pcToSourceRange[coveredPc]); sourceRanges = _.compact(sourceRanges); // Some PC's don't map to a source range and we just ignore them. // By default lodash does a shallow object comparasion. We JSON.stringify them and compare as strings. diff --git a/packages/sol-cov/src/globals.d.ts b/packages/sol-cov/src/globals.d.ts index 3e457f0b5..0ee0f394c 100644 --- a/packages/sol-cov/src/globals.d.ts +++ b/packages/sol-cov/src/globals.d.ts @@ -1,5 +1,6 @@ -// tslint:disable:completed-docs +declare module 'dirty-chai'; +// tslint:disable:completed-docs declare module '*.json' { const json: any; /* tslint:disable */ diff --git a/packages/sol-cov/src/instructions.ts b/packages/sol-cov/src/instructions.ts index c6506e58d..40987dbe5 100644 --- a/packages/sol-cov/src/instructions.ts +++ b/packages/sol-cov/src/instructions.ts @@ -1,9 +1,8 @@ -// tslint:disable:number-literal-format -const PUSH1 = 0x60; -const PUSH32 = 0x7f; -const isPush = (inst: number) => inst >= PUSH1 && inst <= PUSH32; +import { constants } from './constants'; -const pushDataLength = (inst: number) => inst - PUSH1 + 1; +const isPush = (inst: number) => inst >= constants.PUSH1 && inst <= constants.PUSH32; + +const pushDataLength = (inst: number) => inst - constants.PUSH1 + 1; const instructionLength = (inst: number) => (isPush(inst) ? pushDataLength(inst) + 1 : 1); diff --git a/packages/sol-cov/src/source_maps.ts b/packages/sol-cov/src/source_maps.ts index 9b3ea9e24..694171442 100644 --- a/packages/sol-cov/src/source_maps.ts +++ b/packages/sol-cov/src/source_maps.ts @@ -12,12 +12,12 @@ export interface SourceLocation { } export function getLocationByOffset(str: string): LocationByOffset { - const locationByOffset: LocationByOffset = {}; + const locationByOffset: LocationByOffset = { 0: { line: 1, column: 0 } }; let currentOffset = 0; for (const char of str.split('')) { - const location = locationByOffset[currentOffset - 1] || { line: 1, column: 0 }; + const location = locationByOffset[currentOffset]; const isNewline = char === '\n'; - locationByOffset[currentOffset] = { + locationByOffset[currentOffset + 1] = { line: location.line + (isNewline ? 1 : 0), column: isNewline ? 0 : location.column + 1, }; @@ -59,9 +59,8 @@ export function parseSourceMap( if (parsedEntry.fileIndex !== -1) { const sourceRange = { location: { - start: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset - 1], - end: - locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset + parsedEntry.length - 1], + start: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset], + end: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset + parsedEntry.length], }, fileName: sources[parsedEntry.fileIndex], }; diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts new file mode 100644 index 000000000..e793085e3 --- /dev/null +++ b/packages/sol-cov/test/collect_contracts_data_test.ts @@ -0,0 +1,30 @@ +import * as chai from 'chai'; +import * as _ from 'lodash'; +import 'mocha'; +import * as path from 'path'; + +import { collectContractsData } from '../src/collect_contract_data'; + +const expect = chai.expect; + +describe('Collect contracts data', () => { + describe('#collectContractsData', () => { + it('correctly collects contracts data', () => { + const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts'); + const sourcesPath = path.resolve(__dirname, 'fixtures/contracts'); + const networkId = 50; + const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId); + _.forEach(contractsData, contractData => { + expect(contractData).to.have.keys([ + 'baseName', + 'sourceCodes', + 'sources', + 'sourceMap', + 'sourceMapRuntime', + 'bytecode', + 'runtimeBytecode', + ]); + }); + }); + }); +}); diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts new file mode 100644 index 000000000..c7bc45bbf --- /dev/null +++ b/packages/sol-cov/test/collect_coverage_entries_test.ts @@ -0,0 +1,129 @@ +import * as chai from 'chai'; +import * as fs from 'fs'; +import * as _ from 'lodash'; +import 'mocha'; +import * as path from 'path'; + +import { collectCoverageEntries } from '../src/collect_coverage_entries'; +import { SingleFileSourceRange } from '../src/types'; + +const expect = chai.expect; + +const getRange = (sourceCode: string, range: SingleFileSourceRange) => { + const lines = sourceCode.split('\n').slice(range.start.line - 1, range.end.line); + lines[lines.length - 1] = lines[lines.length - 1].slice(0, range.end.column); + lines[0] = lines[0].slice(range.start.column); + return lines.join('\n'); +}; + +describe('Collect coverage entries', () => { + describe('#collectCoverageEntries', () => { + it('correctly collects coverage entries for Simplest contract', () => { + const simplestContractBaseName = 'Simplest.sol'; + const simplestContractFileName = path.resolve(__dirname, 'fixtures/contracts', simplestContractBaseName); + const simplestContract = fs.readFileSync(simplestContractFileName).toString(); + const coverageEntries = collectCoverageEntries(simplestContract); + expect(coverageEntries.fnMap).to.be.deep.equal({}); + expect(coverageEntries.branchMap).to.be.deep.equal({}); + expect(coverageEntries.statementMap).to.be.deep.equal({}); + expect(coverageEntries.modifiersStatementIds).to.be.deep.equal([]); + }); + it('correctly collects coverage entries for SimpleStorage contract', () => { + const simpleStorageContractBaseName = 'SimpleStorage.sol'; + const simpleStorageContractFileName = path.resolve( + __dirname, + 'fixtures/contracts', + simpleStorageContractBaseName, + ); + const simpleStorageContract = fs.readFileSync(simpleStorageContractFileName).toString(); + const coverageEntries = collectCoverageEntries(simpleStorageContract); + const fnIds = _.keys(coverageEntries.fnMap); + expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set'); + expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(3); + const setFunction = `function set(uint x) { + storedData = x; + }`; + expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction); + expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get'); + expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(6); + const getFunction = `function get() constant returns (uint retVal) { + return storedData; + }`; + expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[1]].loc)).to.be.equal(getFunction); + expect(coverageEntries.branchMap).to.be.deep.equal({}); + const statementIds = _.keys(coverageEntries.statementMap); + expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[1]])).to.be.equal( + 'storedData = x', + ); + expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[3]])).to.be.equal( + 'return storedData;', + ); + expect(coverageEntries.modifiersStatementIds).to.be.deep.equal([]); + }); + it('correctly collects coverage entries for AllSolidityFeatures contract', () => { + const simpleStorageContractBaseName = 'AllSolidityFeatures.sol'; + const simpleStorageContractFileName = path.resolve( + __dirname, + 'fixtures/contracts', + simpleStorageContractBaseName, + ); + const simpleStorageContract = fs.readFileSync(simpleStorageContractFileName).toString(); + const coverageEntries = collectCoverageEntries(simpleStorageContract); + const fnDescriptions = _.values(coverageEntries.fnMap); + const fnNames = _.map(fnDescriptions, fnDescription => fnDescription.name); + const expectedFnNames = [ + 'f', + 'c', + 'test', + 'getChoice', + 'Base', + 'Derived', + 'f', + 'f', + '', + 'g', + 'setData', + 'getData', + 'sendHalf', + 'insert', + 'remove', + 'contains', + 'iterate_start', + 'iterate_valid', + 'iterate_advance', + 'iterate_get', + 'insert', + 'sum', + 'restricted', + 'DualIndex', + 'set', + 'transfer_ownership', + 'lookup', + '', + '', + 'sum', + 'someFunction', + 'fun', + 'at', + 'test', + 'get', + 'returnNumber', + 'alloc', + 'ham', + 'getMyTuple', + 'ham', + 'abstain', + 'foobar', + 'foobar', + 'a', + ]; + expect(fnNames).to.be.deep.equal(expectedFnNames); + + const branchDescriptions = _.values(coverageEntries.branchMap); + const branchLines = _.map(branchDescriptions, branchDescription => branchDescription.line); + expect(branchLines).to.be.deep.equal([94, 115, 119, 130, 151, 187]); + const branchTypes = _.map(branchDescriptions, branchDescription => branchDescription.type); + expect(branchTypes).to.be.deep.equal(['if', 'if', 'if', 'if', 'binary-expr', 'if']); + }); + }); +}); diff --git a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json b/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json new file mode 100644 index 000000000..416170ef2 --- /dev/null +++ b/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json @@ -0,0 +1,64 @@ +{ + "contract_name": "SimpleStorage", + "networks": { + "50": { + "solc_version": "0.4.21", + "keccak256": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a", + "source_tree_hash": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a", + "optimizer_enabled": 0, + "abi": [ + { + "constant": true, + "inputs": [], + "name": "storedData", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "x", + "type": "uint256" + } + ], + "name": "set", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "get", + "outputs": [ + { + "name": "retVal", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": + "0x6060604052341561000f57600080fd5b6101098061001e6000396000f3006060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029", + "runtime_bytecode": + "0x6060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029", + "updated_at": 1521118350895, + "source_map": "26:196:0:-;;;;;;;;;;;;;;;;;", + "source_map_runtime": + "26:196:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:52;;;;;;;;;;;;;;;;;;;;;;;;;;140:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;:::o;83:52::-;127:1;114:10;:14;;;;83:52;:::o;140:80::-;173:11;203:10;;196:17;;140:80;:::o", + "sources": ["SimpleStorage.sol"] + } + } +} diff --git a/packages/sol-cov/test/fixtures/artifacts/Simplest.json b/packages/sol-cov/test/fixtures/artifacts/Simplest.json new file mode 100644 index 000000000..8de60e481 --- /dev/null +++ b/packages/sol-cov/test/fixtures/artifacts/Simplest.json @@ -0,0 +1,20 @@ +{ + "contract_name": "Simplest", + "networks": { + "50": { + "solc_version": "0.4.21", + "keccak256": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9", + "source_tree_hash": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9", + "optimizer_enabled": 0, + "abi": [], + "bytecode": + "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029", + "runtime_bytecode": + "0x6060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029", + "updated_at": 1521118525393, + "source_map": "26:21:0:-;;;;;;;;;;;;;;;;;", + "source_map_runtime": "26:21:0:-;;;;;", + "sources": ["Simplest.sol"] + } + } +} diff --git a/packages/sol-cov/test/fixtures/contracts/AllSolidityFeatures.sol b/packages/sol-cov/test/fixtures/contracts/AllSolidityFeatures.sol new file mode 100644 index 000000000..21137347e --- /dev/null +++ b/packages/sol-cov/test/fixtures/contracts/AllSolidityFeatures.sol @@ -0,0 +1,413 @@ +// Examples taken from the Solidity documentation online. + +// for pragma version numbers, see https://docs.npmjs.com/misc/semver#versions +pragma solidity 0.4.0; +pragma solidity ^0.4.0; + +import "SomeFile.sol"; +import "SomeFile.sol" as SomeOtherFile; +import * as SomeSymbol from "AnotherFile.sol"; +import {symbol1 as alias, symbol2} from "File.sol"; + +interface i { + function f(); +} + +contract c { + function c() + { + val1 = 1 wei; // 1 + val2 = 1 szabo; // 1 * 10 ** 12 + val3 = 1 finney; // 1 * 10 ** 15 + val4 = 1 ether; // 1 * 10 ** 18 + } + uint256 val1; + uint256 val2; + uint256 val3; + uint256 val4; +} + +contract test { + enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } + + function test() + { + choices = ActionChoices.GoStraight; + } + function getChoice() returns (uint d) + { + d = uint256(choices); + } + ActionChoices choices; +} + +contract Base { + function Base(uint i) + { + m_i = i; + } + uint public m_i; +} +contract Derived is Base(0) { + function Derived(uint i) Base(i) {} +} + +contract C { + uint248 x; // 31 bytes: slot 0, offset 0 + uint16 y; // 2 bytes: slot 1, offset 0 (does not fit in slot 0) + uint240 z; // 30 bytes: slot 1, offset 2 bytes + uint8 a; // 1 byte: slot 2, offset 0 bytes + struct S { + uint8 a; // 1 byte, slot +0, offset 0 bytes + uint256 b; // 32 bytes, slot +1, offset 0 bytes (does not fit) + } + S structData; // 2 slots, slot 3, offset 0 bytes (does not really apply) + uint8 alpha; // 1 byte, slot 4 (start new slot after struct) + uint16[3] beta; // 3*16 bytes, slots 5+6 (start new slot for array) + uint8 gamma; // 1 byte, slot 7 (start new slot after array) +} + +contract test { + function f(uint x, uint y) returns (uint z) { + var c = x + 3; + var b = 7 + (c * (8 - 7)) - x; + return -(-b | 0); + } +} + +contract test { + function f(uint x, uint y) returns (uint z) { + return 10; + } +} + +contract c { + function () returns (uint) { return g(8); } + function g(uint pos) internal returns (uint) { setData(pos, 8); return getData(pos); } + function setData(uint pos, uint value) internal { data[pos] = value; } + function getData(uint pos) internal { return data[pos]; } + mapping(uint => uint) data; +} + +contract Sharer { + function sendHalf(address addr) returns (uint balance) { + if (!addr.send(msg.value/2)) + throw; // also reverts the transfer to Sharer + return address(this).balance; + } +} + +/// @dev Models a modifiable and iterable set of uint values. +library IntegerSet +{ + struct data + { + /// Mapping item => index (or zero if not present) + mapping(uint => uint) index; + /// Items by index (index 0 is invalid), items with index[item] == 0 are invalid. + uint[] items; + /// Number of stored items. + uint size; + } + function insert(data storage self, uint value) returns (bool alreadyPresent) + { + uint index = self.index[value]; + if (index > 0) + return true; + else + { + if (self.items.length == 0) self.items.length = 1; + index = self.items.length++; + self.items[index] = value; + self.index[value] = index; + self.size++; + return false; + } + } + function remove(data storage self, uint value) returns (bool success) + { + uint index = self.index[value]; + if (index == 0) + return false; + delete self.index[value]; + delete self.items[index]; + self.size --; + } + function contains(data storage self, uint value) returns (bool) + { + return self.index[value] > 0; + } + function iterate_start(data storage self) returns (uint index) + { + return iterate_advance(self, 0); + } + function iterate_valid(data storage self, uint index) returns (bool) + { + return index < self.items.length; + } + function iterate_advance(data storage self, uint index) returns (uint r_index) + { + index++; + while (iterate_valid(self, index) && self.index[self.items[index]] == index) + index++; + return index; + } + function iterate_get(data storage self, uint index) returns (uint value) + { + return self.items[index]; + } +} + +/// How to use it: +contract User +{ + /// Just a struct holding our data. + IntegerSet.data data; + /// Insert something + function insert(uint v) returns (uint size) + { + /// Sends `data` via reference, so IntegerSet can modify it. + IntegerSet.insert(data, v); + /// We can access members of the struct - but we should take care not to mess with them. + return data.size; + } + /// Computes the sum of all stored data. + function sum() returns (uint s) + { + for (var i = IntegerSet.iterate_start(data); IntegerSet.iterate_valid(data, i); i = IntegerSet.iterate_advance(data, i)) + s += IntegerSet.iterate_get(data, i); + } +} + +// This broke it at one point (namely the modifiers). +contract DualIndex { + mapping(uint => mapping(uint => uint)) data; + address public admin; + + modifier restricted { if (msg.sender == admin) _; } + + function DualIndex() { + admin = msg.sender; + } + + function set(uint key1, uint key2, uint value) restricted { + uint[2][4] memory defaults; // "memory" broke things at one time. + data[key1][key2] = value; + } + + function transfer_ownership(address _admin) restricted { + admin = _admin; + } + + function lookup(uint key1, uint key2) returns(uint) { + return data[key1][key2]; + } +} + +contract A { + +} + +contract B { + +} + +contract C is A, B { + +} + +contract TestPrivate +{ + uint private value; +} + +contract TestInternal +{ + uint internal value; +} + +contract FromSolparse is A, B, TestPrivate, TestInternal { + function() { + uint a = 6 ** 9; + var (x) = 100; + uint y = 2 days; + } +} + +contract CommentedOutFunction { + // FYI: This empty function, as well as the commented + // out function below (bad code) is important to this test. + function() { + + } + + // function something() + // uint x = 10; + // } +} + +library VarHasBrackets { + string constant specialRight = "}"; + //string storage specialLeft = "{"; +} + +library UsingExampleLibrary { + function sum(uint[] storage self) returns (uint s) { + for (uint i = 0; i < self.length; i++) + s += self[i]; + } +} + +contract UsingExampleContract { + using UsingExampleLibrary for uint[]; +} + +contract NewStuff { + uint[] b; + + function someFunction() payable { + string storage a = hex"ab1248fe"; + b[2+2]; + } +} + +// modifier with expression +contract MyContract { + function fun() mymodifier(foo.bar()) {} +} + +library GetCode { + function at(address _addr) returns (bytes o_code) { + assembly { + // retrieve the size of the code, this needs assembly + let size := extcodesize(_addr) + // allocate output byte array - this could also be done without assembly + // by using o_code = new bytes(size) + o_code := mload(0x40) + // new "memory end" including padding + mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f)))) + // store length in memory + mstore(o_code, size) + // actually retrieve the code, this needs assembly + extcodecopy(_addr, add(o_code, 0x20), 0, size) + } + } +} + +contract assemblyLocalBinding { + function test(){ + assembly { + let v := 1 + let x := 0x00 + let y := x + let z := "hello" + } + } +} + +contract assemblyReturn { + uint a = 10; + + function get() constant returns(uint) { + assembly { + mstore(0x40, sload(0)) + byte(0) + address(0) + return(0x40,32) + } + } +} + +contract usesConst { + uint const = 0; +} + +contract memoryArrays { + uint seven = 7; + + function returnNumber(uint number) returns (uint){ + return number; + } + + function alloc() { + uint[] memory a = new uint[](7); + uint[] memory b = new uint[](returnNumber(seven)); + } +} + +contract DeclarativeExpressions { + uint a; + uint b = 7; + uint b2=0; + uint public c; + uint constant public d; + uint public constant e; + uint private constant f = 7; + struct S { uint q;} + + function ham(S storage s1, uint[] storage arr) internal { + uint x; + uint y = 7; + S storage s2 = s1; + uint[] memory stor; + uint[] storage stor2 = arr; + } +} + +contract VariableDeclarationTuple { + function getMyTuple() returns (bool, bool){ + return (true, false); + } + + function ham (){ + var (x, y) = (10, 20); + var (a, b) = getMyTuple(); + var (,c) = (10, 20); + var (d,,) = (10, 20, 30); + var (,e,,f,) = (10, 20, 30, 40, 50); + + var ( + num1, num2, + num3, ,num5 + ) = (10, 20, 30, 40, 50); + } +} + +contract TypeIndexSpacing { + uint [ 7 ] x; + uint [] y; +} + +contract Ballot { + + struct Voter { + uint weight; + bool voted; + } + + function abstain() returns (bool) { + return false; + } + + function foobar() payable owner (myPrice) returns (uint[], address myAdd, string[] names) {} + function foobar() payable owner (myPrice) returns (uint[], address myAdd, string[] names); + + Voter you = Voter(1, true); + + Voter me = Voter({ + weight: 2, + voted: abstain() + }); + + Voter airbnb = Voter({ + weight: 2, + voted: true, + }); +} + +contract multilineReturn { + function a() returns (uint x) { + return + 5; + } +} diff --git a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol new file mode 100644 index 000000000..178a52318 --- /dev/null +++ b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol @@ -0,0 +1,9 @@ +contract SimpleStorage { + uint public storedData; + function set(uint x) { + storedData = x; + } + function get() constant returns (uint retVal) { + return storedData; + } +} diff --git a/packages/sol-cov/test/fixtures/contracts/Simplest.sol b/packages/sol-cov/test/fixtures/contracts/Simplest.sol new file mode 100644 index 000000000..d71016e07 --- /dev/null +++ b/packages/sol-cov/test/fixtures/contracts/Simplest.sol @@ -0,0 +1,2 @@ +contract Simplest { +} diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts new file mode 100644 index 000000000..195dfce2f --- /dev/null +++ b/packages/sol-cov/test/instructions_test.ts @@ -0,0 +1,20 @@ +import * as chai from 'chai'; +import * as fs from 'fs'; +import 'mocha'; +import * as path from 'path'; + +import { constants } from '../src/constants'; +import { getPcToInstructionIndexMapping } from '../src/instructions'; + +const expect = chai.expect; + +describe('instructions', () => { + describe('#getPcToInstructionIndexMapping', () => { + it('correctly maps pcs to instruction indexed', () => { + const bytecode = new Uint8Array([constants.PUSH1, 42, constants.PUSH2, 1, 2, constants.TIMESTAMP]); + const pcToInstruction = getPcToInstructionIndexMapping(bytecode); + const expectedPcToInstruction = { '0': 0, '2': 1, '5': 2 }; + expect(pcToInstruction).to.be.deep.equal(expectedPcToInstruction); + }); + }); +}); diff --git a/packages/sol-cov/test/source_maps_test.ts b/packages/sol-cov/test/source_maps_test.ts new file mode 100644 index 000000000..5820bedd7 --- /dev/null +++ b/packages/sol-cov/test/source_maps_test.ts @@ -0,0 +1,71 @@ +import * as chai from 'chai'; +import * as fs from 'fs'; +import * as _ from 'lodash'; +import 'mocha'; +import * as path from 'path'; + +import { getLocationByOffset, parseSourceMap } from '../src/source_maps'; + +const expect = chai.expect; + +const simplestContractBaseName = 'Simplest.sol'; +const simplestContractFileName = path.resolve(__dirname, 'fixtures/contracts', simplestContractBaseName); +const simplestContract = fs.readFileSync(simplestContractFileName).toString(); + +describe('source maps', () => { + describe('#getLocationByOffset', () => { + it('correctly computes location by offset', () => { + const locationByOffset = getLocationByOffset(simplestContract); + const expectedLocationByOffset = { + '0': { line: 1, column: 0 }, + '1': { line: 1, column: 1 }, + '2': { line: 1, column: 2 }, + '3': { line: 1, column: 3 }, + '4': { line: 1, column: 4 }, + '5': { line: 1, column: 5 }, + '6': { line: 1, column: 6 }, + '7': { line: 1, column: 7 }, + '8': { line: 1, column: 8 }, + '9': { line: 1, column: 9 }, + '10': { line: 1, column: 10 }, + '11': { line: 1, column: 11 }, + '12': { line: 1, column: 12 }, + '13': { line: 1, column: 13 }, + '14': { line: 1, column: 14 }, + '15': { line: 1, column: 15 }, + '16': { line: 1, column: 16 }, + '17': { line: 1, column: 17 }, + '18': { line: 1, column: 18 }, + '19': { line: 1, column: 19 }, + '20': { line: 2, column: 0 }, + '21': { line: 2, column: 1 }, + '22': { line: 3, column: 0 }, + }; + expect(locationByOffset).to.be.deep.equal(expectedLocationByOffset); + }); + }); + describe('#parseSourceMap', () => { + it('correctly parses the source map', () => { + // This is the source map and bytecode for an empty contract like Example.sol + const srcMap = '0:21:0:-;;;;;;;;;;;;;;;;;'; + const bytecodeHex = + '60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820377cdef690e46589f40efeef14d8ef73504af059fb3fd46f1da3cd2fc52ef7890029'; + const sources = [simplestContractBaseName]; + const pcToSourceRange = parseSourceMap([simplestContract], srcMap, bytecodeHex, sources); + const expectedSourceRange = { + location: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 1 }, + }, + fileName: simplestContractBaseName, + }; + _.forEach(pcToSourceRange, sourceRange => { + // Solidity source maps are too short and we map some instructions to undefined + // Source: https://github.com/ethereum/solidity/issues/3741 + if (!_.isUndefined(sourceRange)) { + expect(sourceRange).to.be.deep.equal(expectedSourceRange); + } + }); + }); + }); +}); diff --git a/packages/sol-cov/test/utils_test.ts b/packages/sol-cov/test/utils_test.ts new file mode 100644 index 000000000..6fc8fcfe1 --- /dev/null +++ b/packages/sol-cov/test/utils_test.ts @@ -0,0 +1,53 @@ +import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + +import { utils } from '../src/utils'; + +chai.use(dirtyChai); +const expect = chai.expect; + +describe('utils', () => { + describe('#compareLineColumn', () => { + it('correctly compares LineColumns', () => { + expect(utils.compareLineColumn({ line: 1, column: 3 }, { line: 1, column: 4 })).to.be.lessThan(0); + expect(utils.compareLineColumn({ line: 1, column: 4 }, { line: 1, column: 3 })).to.be.greaterThan(0); + expect(utils.compareLineColumn({ line: 1, column: 3 }, { line: 1, column: 3 })).to.be.equal(0); + expect(utils.compareLineColumn({ line: 0, column: 2 }, { line: 1, column: 0 })).to.be.lessThan(0); + expect(utils.compareLineColumn({ line: 1, column: 0 }, { line: 0, column: 2 })).to.be.greaterThan(0); + }); + }); + + describe('#isRangeInside', () => { + it('returns true if inside', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 2 }, end: { line: 1, column: 5 } }, + ), + ).to.be.true(); + }); + it('returns true if the same', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + ), + ).to.be.true(); + }); + it('returns false if not inside', () => { + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 4 }, end: { line: 1, column: 4 } }, + ), + ).to.be.false(); + expect( + utils.isRangeInside( + { start: { line: 1, column: 3 }, end: { line: 1, column: 4 } }, + { start: { line: 1, column: 4 }, end: { line: 1, column: 5 } }, + ), + ).to.be.false(); + }); + }); +}); diff --git a/packages/sol-cov/tsconfig.json b/packages/sol-cov/tsconfig.json index bdf315d59..44e43719b 100644 --- a/packages/sol-cov/tsconfig.json +++ b/packages/sol-cov/tsconfig.json @@ -5,8 +5,10 @@ }, "include": [ "./src/**/*", + "./test/**/*", "../../node_modules/types-bn/index.d.ts", "../../node_modules/web3-typescript-typings/index.d.ts", + "../../node_modules/chai-typescript-typings/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts" ] } diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 458b0d6f7..8c2ec5acc 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## v0.0.2 - _TBD, 2018_ +## v0.0.2 - _March 18, 2018_ * Added postman collection unit tests (#451) * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index d1866a706..d3f676666 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "0.0.1", + "version": "0.0.5", "description": "Generate reports for standard relayer API compliance", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -28,19 +28,19 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { - "0x.js": "^0.33.1", - "@0xproject/assert": "^0.2.0", - "@0xproject/connect": "^0.6.3", - "@0xproject/json-schemas": "^0.7.14", - "@0xproject/utils": "^0.4.1", + "0x.js": "^0.33.6", + "@0xproject/assert": "^0.2.3", + "@0xproject/connect": "^0.6.6", + "@0xproject/json-schemas": "^0.7.17", + "@0xproject/utils": "^0.4.3", "chalk": "^2.3.0", "lodash": "^4.17.4", "newman": "^3.9.3", "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.48", "@types/nock": "^9.1.2", diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 76a757df5..b7c5545ea 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -1,10 +1,11 @@ # CHANGELOG -## v0.8.0 - _TBD, 2018_ +## v0.8.0 - _March 18, 2018_ * Export `GanacheSubprovider` and `Subprovider` (#426) * Make all subproviders to derive from `Subprovider` (#426) * Add types for `NextCallback`, `OnNextCompleted` (#426) + * Ignore `ganache-core` dependency when using package in a browser environment. ## v0.7.0 - _March 8, 2018_ diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 100ed8f87..73c33b2a1 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "0.7.0", + "version": "0.8.2", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "license": "Apache-2.0", @@ -20,9 +20,9 @@ "test:integration": "run-s clean build run_mocha_integration" }, "dependencies": { - "@0xproject/assert": "^0.2.0", - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", + "@0xproject/assert": "^0.2.3", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "bn.js": "^4.11.8", @@ -35,24 +35,24 @@ "semaphore-async-await": "^1.5.1", "web3": "^0.20.0", "web3-provider-engine": "^13.0.1", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", - "@0xproject/utils": "^0.4.1", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", + "@0xproject/utils": "^0.4.3", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", - "nyc": "^11.0.1", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.10", - "chai-typescript-typings": "^0.0.4", + "chai-as-promised-typescript-typings": "^0.0.12", + "chai-typescript-typings": "^0.0.6", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.8.0", "types-bn": "^0.0.1", @@ -64,6 +64,9 @@ "@ledgerhq/hw-transport-node-hid": "^4.3.0" }, "publishConfig": { - "access": "public" + "access": "public" + }, + "browser": { + "ganache-core": false } } diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 631098967..8e12b8c1b 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.16", + "version": "1.0.20", "description": "A faucet micro-service that dispenses test ERC20 tokens or Ether", "main": "server.js", "scripts": { @@ -15,9 +15,9 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.33.1", - "@0xproject/subproviders": "^0.7.0", - "@0xproject/utils": "^0.4.1", + "0x.js": "^0.33.6", + "@0xproject/subproviders": "^0.8.2", + "@0xproject/utils": "^0.4.3", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", @@ -28,7 +28,7 @@ "web3-provider-engine": "^13.0.1" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/tslint-config": "^0.4.12", "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "^4.14.86", @@ -41,7 +41,7 @@ "types-bn": "^0.0.1", "types-ethereumjs-util": "0xProject/types-ethereumjs-util", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0", + "web3-typescript-typings": "^0.10.2", "webpack": "^3.1.0", "webpack-node-externals": "^1.6.0" } diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 13dcce87e..25047085a 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/tslint-config", - "version": "0.4.10", + "version": "0.4.12", "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "scripts": { @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/tslint-config/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/monorepo-scripts": "^0.1.14", "@types/lodash": "^4.14.86", "copyfiles": "^1.2.0", "shx": "^0.2.2", @@ -43,6 +43,6 @@ "tslint-react": "^3.2.0" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 55dc2d560..11d703211 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,8 +1,9 @@ # CHANGELOG -## v0.4.0 - _TBD, 2018_ +## v0.4.0 - _March 18, 2018_ * Remove `JSONRPCPayload` (#426) + * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) ## v0.3.1 - _March 8, 2018_ diff --git a/packages/types/package.json b/packages/types/package.json index 8dc03892e..e664b06ae 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "0.3.1", + "version": "0.4.1", "description": "0x types", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,8 +20,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", @@ -30,9 +30,9 @@ "dependencies": { "bignumber.js": "~4.1.0", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 149aaca8a..2147a3edb 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -73,3 +73,31 @@ export interface RawLogEntry { data: string; topics: string[]; } + +export interface Order { + maker: string; + taker: string; + makerFee: BigNumber; + takerFee: BigNumber; + makerTokenAmount: BigNumber; + takerTokenAmount: BigNumber; + makerTokenAddress: string; + takerTokenAddress: string; + salt: BigNumber; + exchangeContractAddress: string; + feeRecipient: string; + expirationUnixTimestampSec: BigNumber; +} + +export interface SignedOrder extends Order { + ecSignature: ECSignature; +} + +/** + * Elliptic Curve signature + */ +export interface ECSignature { + v: number; + r: string; + s: string; +} diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 5488d4f8c..949dca3f3 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG -## v0.4.1 - _TBD, 2018_ +## v0.4.3 - _March 18, 2018_ + + * Add `@types/node` to dependencies since `intervalUtils` has the `NodeJS` type as part of its public interface. + +## v0.4.2 - _March 18, 2018_ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452) diff --git a/packages/utils/package.json b/packages/utils/package.json index b7c98b78e..ca82d1e75 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "0.4.1", + "version": "0.4.3", "description": "0x TS utils", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,8 +20,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", @@ -30,16 +30,17 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.3.1", + "@0xproject/types": "^0.4.1", + "@types/node": "^8.0.53", "bignumber.js": "~4.1.0", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "js-sha3": "^0.7.0", "lodash": "^4.17.4", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/web3-typescript-typings/package.json b/packages/web3-typescript-typings/package.json index 0825f646d..d56b83421 100644 --- a/packages/web3-typescript-typings/package.json +++ b/packages/web3-typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "web3-typescript-typings", - "version": "0.10.0", + "version": "0.10.2", "description": "Typescript type definitions for web3", "main": "index.d.ts", "types": "index.d.ts", @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-typescript-typings#readme", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/monorepo-scripts": "^0.1.14", "@types/bignumber.js": "^4.0.2", "copyfiles": "^1.2.0", "shx": "^0.2.2", @@ -35,6 +35,6 @@ "bignumber.js": "~4.1.0" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 2b2fc7540..5f6523209 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## v0.3.0 _TBD, 2018_ +## v0.3.0 _March 18, 2018_ * Add `web3Wrapper.takeSnapshotAsync`, `web3Wrapper.revertSnapshotAsync`, `web3Wrapper.mineBlockAsync`, `web3Wrapper.increaseTimeAsync` (#426) * Add `web3Wrapper.isZeroExWeb3Wrapper` for runtime instanceOf checks (#426) diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 6e569b993..3309af739 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "0.2.1", + "version": "0.3.1", "description": "Wraps around web3 and gives a nicer interface", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -20,8 +20,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/monorepo-scripts": "^0.1.12", - "@0xproject/tslint-config": "^0.4.10", + "@0xproject/monorepo-scripts": "^0.1.14", + "@0xproject/tslint-config": "^0.4.12", "@types/lodash": "^4.14.86", "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", @@ -30,15 +30,15 @@ "typescript": "2.7.1" }, "dependencies": { - "@0xproject/types": "^0.3.1", - "@0xproject/utils": "^0.4.1", + "@0xproject/types": "^0.4.1", + "@0xproject/utils": "^0.4.3", "ethers-contracts": "^2.2.1", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "lodash": "^4.17.4", "web3": "^0.20.0", - "web3-typescript-typings": "^0.10.0" + "web3-typescript-typings": "^0.10.2" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/website/package.json b/packages/website/package.json index a7fc1fe26..2c906818a 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.18", + "version": "0.0.22", "private": true, "description": "Website and 0x portal dapp", "scripts": { @@ -18,12 +18,12 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.33.1", - "@0xproject/react-docs": "^0.0.1", - "@0xproject/react-shared": "^0.0.1", - "@0xproject/subproviders": "^0.7.0", - "@0xproject/web3-wrapper": "^0.2.1", - "@0xproject/utils": "^0.4.1", + "0x.js": "^0.33.6", + "@0xproject/react-docs": "^0.0.4", + "@0xproject/react-shared": "^0.0.4", + "@0xproject/subproviders": "^0.8.2", + "@0xproject/utils": "^0.4.3", + "@0xproject/web3-wrapper": "^0.3.1", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", @@ -87,7 +87,7 @@ "copy-webpack-plugin": "^4.0.1", "copyfiles": "^1.2.0", "css-loader": "0.23.x", - "ethers-typescript-typings": "^0.0.2", + "ethers-typescript-typings": "^0.0.4", "exports-loader": "0.6.x", "imports-loader": "0.6.x", "json-loader": "^0.5.4", @@ -99,7 +99,7 @@ "tslint": "5.8.0", "tslint-config-0xproject": "^0.0.2", "typescript": "2.7.1", - "web3-typescript-typings": "^0.10.0", + "web3-typescript-typings": "^0.10.2", "webpack": "^3.1.0", "webpack-dev-middleware": "^1.10.0", "webpack-dev-server": "^2.5.0" diff --git a/packages/website/public/images/team/blake.jpg b/packages/website/public/images/team/blake.jpg Binary files differnew file mode 100644 index 000000000..44ca0a311 --- /dev/null +++ b/packages/website/public/images/team/blake.jpg diff --git a/packages/website/public/images/team/jacob.jpg b/packages/website/public/images/team/jacob.jpg Binary files differindex 62ff412d2..de8b9e4b5 100644 --- a/packages/website/public/images/team/jacob.jpg +++ b/packages/website/public/images/team/jacob.jpg diff --git a/packages/website/public/images/team/tom.jpg b/packages/website/public/images/team/tom.jpg Binary files differindex a6b763816..3623a2b78 100644 --- a/packages/website/public/images/team/tom.jpg +++ b/packages/website/public/images/team/tom.jpg diff --git a/packages/website/public/images/team/zach.png b/packages/website/public/images/team/zach.png Binary files differnew file mode 100644 index 000000000..4565a9af0 --- /dev/null +++ b/packages/website/public/images/team/zach.png diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index 7f1e0bf80..293580913 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -108,6 +108,27 @@ const teamRow3: ProfileInfo[] = [ }, ]; +const teamRow4: ProfileInfo[] = [ + { + name: 'Blake Henderson', + title: 'Operations Associate', + description: `Operations and Analytics. Previously analytics at LinkedIn. Economics at UC San Diego. `, + image: '/images/team/blake.jpg', + linkedIn: 'https://www.linkedin.com/in/blakerhenderson/', + github: '', + medium: '', + }, + { + name: 'Zack Skelly', + title: 'Lead Recruiter', + description: `Talent. Previously first recruiter at Heap, recruiting at Dropbox and Google. English Rhetoric and Composition at Pepperdine.`, + image: '/images/team/zach.png', + linkedIn: 'https://www.linkedin.com/in/zackaryskelly/', + github: '', + medium: '', + }, +]; + const advisors: ProfileInfo[] = [ { name: 'Fred Ehrsam', @@ -200,6 +221,7 @@ export class About extends React.Component<AboutProps, AboutState> { <div className="clearfix pb3">{this._renderProfiles(teamRow1)}</div> <div className="clearfix">{this._renderProfiles(teamRow2)}</div> <div className="clearfix">{this._renderProfiles(teamRow3)}</div> + <div className="clearfix">{this._renderProfiles(teamRow4)}</div> </div> <div className="pt3 pb2"> <div |