diff options
author | F. Eugene Aumson <feuGeneA@users.noreply.github.com> | 2018-09-26 04:34:44 +0800 |
---|---|---|
committer | F. Eugene Aumson <feuGeneA@users.noreply.github.com> | 2018-09-26 04:34:44 +0800 |
commit | d3edb9721c21a00c40f03d5c270f19c0d9954754 (patch) | |
tree | fed69dbc80245c77af28ccc5f7c170ac8e726c7c /packages | |
parent | de9f5d350f008f1eeb6e42a3dcf611262f6210b4 (diff) | |
parent | b40861747b73bb9a0826853751b7caa5cbf085ae (diff) | |
download | dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar.gz dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar.bz2 dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar.lz dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar.xz dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.tar.zst dexon-sol-tools-d3edb9721c21a00c40f03d5c270f19c0d9954754.zip |
Merge remote-tracking branch 'upstream/development' into sol-doc
Diffstat (limited to 'packages')
104 files changed, 990 insertions, 429 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 391c5fa17..38966a0b7 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.4", "changes": [ diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index 7031425ab..d881cd825 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 21, 2018_ * Dependencies updated diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index c92e24c52..d53571dbf 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -41,9 +41,9 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/migrations": "^1.0.10", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/migrations": "^1.0.11", "@0xproject/monorepo-scripts": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", @@ -73,16 +73,16 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/base-contract": "^2.0.3", - "@0xproject/contract-wrappers": "^1.0.4", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/order-watcher": "^1.0.4", - "@0xproject/subproviders": "^2.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/contract-wrappers": "^1.0.5", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/order-watcher": "^1.0.5", + "@0xproject/subproviders": "^2.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", "ethers": "3.0.22", "lodash": "^4.17.5", diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 2ecacb05d..18aed8716 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 88ab42864..99fc44f0c 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 6b8581ef3..1fb697299 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -31,7 +31,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "chalk": "^2.3.0", "ethereum-types": "^1.0.7", "glob": "^7.1.2", diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index 8a9b6afd6..851ba6c04 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index d39441338..26760306e 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/assert/package.json b/packages/assert/package.json index 629cb23e5..ee510d14f 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -44,9 +44,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/json-schemas": "^1.0.2", + "@0xproject/json-schemas": "^1.0.3", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "lodash": "^4.17.5", "valid-url": "^1.0.9" }, diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index 2e4db1f6e..50b965f2d 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.0", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "version": "1.0.0-rc.1", "changes": [ { diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md index 8b1378917..b27795d18 100644 --- a/packages/asset-buyer/CHANGELOG.md +++ b/packages/asset-buyer/CHANGELOG.md @@ -1 +1,14 @@ +<!-- +changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly. +Edit the package's CHANGELOG.json file only. +--> +CHANGELOG + +## v1.0.0 - _September 25, 2018_ + + * Dependencies updated + +## v1.0.0-rc.1 - _Invalid date_ + + * Init diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index 2b5136e31..d15213e0b 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/asset-buyer", - "version": "1.0.0-rc.1", + "version": "1.0.0", "engines": { "node": ">=6.12" }, @@ -36,16 +36,16 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md", "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/connect": "^2.0.2", - "@0xproject/contract-wrappers": "^1.0.4", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/order-utils": "^1.0.1", - "@0xproject/subproviders": "^2.0.2", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/connect": "^2.0.3", + "@0xproject/contract-wrappers": "^1.0.5", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/subproviders": "^2.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.6", "lodash": "^4.17.10" }, diff --git a/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts b/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts index be3e9da50..31942c25b 100644 --- a/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts +++ b/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts @@ -1,4 +1,5 @@ -import { APIOrder, HttpClient, OrderbookResponse } from '@0xproject/connect'; +import { HttpClient } from '@0xproject/connect'; +import { APIOrder, OrderbookResponse } from '@0xproject/types'; import * as _ from 'lodash'; import { diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 723963f87..5f94afa43 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "2.0.3", "changes": [ diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index c4ba59e26..b3f3b5619 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 44b0807ba..cd7f29114 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -41,8 +41,8 @@ }, "dependencies": { "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index f5ca80279..d4c501eb1 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "version": "2.0.3", + "changes": [ + { + "note": "Import SRA-related types from @0xproject/types", + "pr": 1085 + } + ], + "timestamp": 1537875740 + }, + { "timestamp": 1537541580, "version": "2.0.2", "changes": [ diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 1f8116f88..2c2483cb6 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.3 - _September 25, 2018_ + + * Import SRA-related types from @0xproject/types (#1085) + ## v2.0.2 - _September 21, 2018_ * Dependencies updated diff --git a/packages/connect/package.json b/packages/connect/package.json index 1575afe01..075089fd2 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "2.0.2", + "version": "2.0.3", "engines": { "node": ">=6.12" }, @@ -43,12 +43,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "lodash": "^4.17.5", "query-string": "^5.0.1", "sinon": "^4.0.0", diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index bdcfdd8d2..8a68d6c23 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -1,19 +1,10 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; -import { SignedOrder } from '@0xproject/types'; -import { fetchAsync } from '@0xproject/utils'; -import * as _ from 'lodash'; -import * as queryString from 'query-string'; - -import { schemas as clientSchemas } from './schemas/schemas'; import { APIOrder, AssetPairsRequestOpts, AssetPairsResponse, - Client, FeeRecipientsResponse, - HttpRequestOptions, - HttpRequestType, OrderbookRequest, OrderbookResponse, OrderConfigRequest, @@ -22,7 +13,14 @@ import { OrdersResponse, PagedRequestOpts, RequestOpts, -} from './types'; + SignedOrder, +} from '@0xproject/types'; +import { fetchAsync } from '@0xproject/utils'; +import * as _ from 'lodash'; +import * as queryString from 'query-string'; + +import { schemas as clientSchemas } from './schemas/schemas'; +import { Client, HttpRequestOptions, HttpRequestType } from './types'; import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers'; const TRAILING_SLASHES_REGEX = /\/+$/; diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index 0b9cad038..0ec5a0f68 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -1,23 +1,20 @@ export { HttpClient } from './http_client'; export { ordersChannelFactory } from './orders_channel_factory'; +export { Client, OrdersChannel, OrdersChannelHandler } from './types'; export { - Client, + APIOrder, + AssetPairsRequestOpts, + AssetPairsResponse, + FeeRecipientsResponse, + OrderbookRequest, + OrderbookResponse, OrderConfigRequest, OrderConfigResponse, - OrdersChannel, - OrdersChannelHandler, OrdersChannelSubscriptionOpts, - OrderbookRequest, - OrderbookResponse, OrdersRequestOpts, - PagedRequestOpts, - AssetPairsRequestOpts, - RequestOpts, - AssetPairsResponse, - FeeRecipientsResponse, - APIOrder, OrdersResponse, + PagedRequestOpts, PaginatedCollection, -} from './types'; - -export { SignedOrder } from '@0xproject/types'; + RequestOpts, + SignedOrder, +} from '@0xproject/types'; diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts index b76af081c..4bb0ae534 100644 --- a/packages/connect/src/types.ts +++ b/packages/connect/src/types.ts @@ -1,5 +1,18 @@ -import { SignedOrder } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; +import { + APIOrder, + AssetPairsItem, + AssetPairsRequestOpts, + FeeRecipientsResponse, + OrderbookRequest, + OrderbookResponse, + OrderConfigRequest, + OrderConfigResponse, + OrdersChannelSubscriptionOpts, + OrdersRequestOpts, + PagedRequestOpts, + PaginatedCollection, + SignedOrder, +} from '@0xproject/types'; export interface Client { getAssetPairsAsync: ( @@ -18,140 +31,12 @@ export interface OrdersChannel { close: () => void; } -/** - * baseAssetData: The address of assetData designated as the baseToken in the currency pair calculation of price - * quoteAssetData: The address of assetData designated as the quoteToken in the currency pair calculation of price - * limit: Maximum number of bids and asks in orderbook snapshot - */ -export interface OrdersChannelSubscriptionOpts { - baseAssetData: string; - quoteAssetData: string; - limit: number; -} - export interface OrdersChannelHandler { onUpdate: (channel: OrdersChannel, subscriptionOpts: OrdersChannelSubscriptionOpts, orders: APIOrder[]) => void; onError: (channel: OrdersChannel, err: Error, subscriptionOpts?: OrdersChannelSubscriptionOpts) => void; onClose: (channel: OrdersChannel) => void; } -export type OrdersChannelMessage = UpdateOrdersChannelMessage | UnknownOrdersChannelMessage; - -export enum OrdersChannelMessageTypes { - Update = 'update', - Unknown = 'unknown', -} - -export interface UpdateOrdersChannelMessage { - type: OrdersChannelMessageTypes.Update; - requestId: string; - payload: APIOrder[]; -} - -export interface UnknownOrdersChannelMessage { - type: OrdersChannelMessageTypes.Unknown; - requestId: string; - payload: undefined; -} - -export enum WebsocketConnectionEventType { - Close = 'close', - Error = 'error', - Message = 'message', -} - -export enum WebsocketClientEventType { - Connect = 'connect', - ConnectFailed = 'connectFailed', -} - -export type OrdersResponse = PaginatedCollection<APIOrder>; - -export interface APIOrder { - order: SignedOrder; - metaData: object; -} - -export interface AssetPairsRequestOpts { - assetDataA?: string; - assetDataB?: string; -} - -export type AssetPairsResponse = PaginatedCollection<AssetPairsItem>; - -export interface AssetPairsItem { - assetDataA: Asset; - assetDataB: Asset; -} - -export interface Asset { - assetData: string; - minAmount: BigNumber; - maxAmount: BigNumber; - precision: number; -} - -export interface OrdersRequestOpts { - makerAssetProxyId?: string; - takerAssetProxyId?: string; - makerAssetAddress?: string; - takerAssetAddress?: string; - exchangeAddress?: string; - senderAddress?: string; - makerAssetData?: string; - takerAssetData?: string; - makerAddress?: string; - takerAddress?: string; - traderAddress?: string; - feeRecipientAddress?: string; -} - -export interface OrderbookRequest { - baseAssetData: string; - quoteAssetData: string; -} - -export interface OrderbookResponse { - bids: PaginatedCollection<APIOrder>; - asks: PaginatedCollection<APIOrder>; -} - -export interface PaginatedCollection<T> { - total: number; - page: number; - perPage: number; - records: T[]; -} - -export interface OrderConfigRequest { - makerAddress: string; - takerAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerAssetData: string; - takerAssetData: string; - exchangeAddress: string; - expirationTimeSeconds: BigNumber; -} - -export interface OrderConfigResponse { - makerFee: BigNumber; - takerFee: BigNumber; - feeRecipientAddress: string; - senderAddress: string; -} - -export type FeeRecipientsResponse = PaginatedCollection<string>; - -export interface RequestOpts { - networkId?: number; -} - -export interface PagedRequestOpts { - page?: number; - perPage?: number; -} - export interface HttpRequestOptions { params?: object; payload?: object; diff --git a/packages/connect/src/utils/orders_channel_message_parser.ts b/packages/connect/src/utils/orders_channel_message_parser.ts index 1b6cda17b..943d7802e 100644 --- a/packages/connect/src/utils/orders_channel_message_parser.ts +++ b/packages/connect/src/utils/orders_channel_message_parser.ts @@ -2,7 +2,7 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; import * as _ from 'lodash'; -import { OrdersChannelMessage, OrdersChannelMessageTypes } from '../types'; +import { OrdersChannelMessage, OrdersChannelMessageTypes } from '@0xproject/types'; import { relayerResponseJsonParsers } from './relayer_response_json_parsers'; diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index bc31f231d..356e2dde6 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -9,7 +9,7 @@ import { OrderbookResponse, OrderConfigResponse, OrdersResponse, -} from '../types'; +} from '@0xproject/types'; import { typeConverters } from './type_converters'; diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts index d57ea00e5..99760cf74 100644 --- a/packages/connect/src/utils/type_converters.ts +++ b/packages/connect/src/utils/type_converters.ts @@ -1,7 +1,7 @@ import { orderParsingUtils } from '@0xproject/order-utils'; import * as _ from 'lodash'; -import { APIOrder } from '../types'; +import { APIOrder } from '@0xproject/types'; export const typeConverters = { convertOrderbookStringFieldsToBigNumber(orderbook: any): any { diff --git a/packages/connect/src/ws_orders_channel.ts b/packages/connect/src/ws_orders_channel.ts index cde4acbc3..bf5e8508d 100644 --- a/packages/connect/src/ws_orders_channel.ts +++ b/packages/connect/src/ws_orders_channel.ts @@ -1,8 +1,9 @@ +import { OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from '@0xproject/types'; import * as _ from 'lodash'; import { v4 as uuid } from 'uuid'; import * as WebSocket from 'websocket'; -import { OrdersChannel, OrdersChannelHandler, OrdersChannelMessageTypes, OrdersChannelSubscriptionOpts } from './types'; +import { OrdersChannel, OrdersChannelHandler } from './types'; import { assert } from './utils/assert'; import { ordersChannelMessageParser } from './utils/orders_channel_message_parser'; diff --git a/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts index 5ce703317..27216e421 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/asset_pairs.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -import { AssetPairsResponse } from '../../../src/types'; +import { AssetPairsResponse } from '@0xproject/types'; export const assetDataPairsResponse: AssetPairsResponse = { total: 43, diff --git a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts index e17ffe7a8..6f544e9d3 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fee_recipients.ts @@ -1,4 +1,4 @@ -import { FeeRecipientsResponse } from '../../../src/types'; +import { FeeRecipientsResponse } from '@0xproject/types'; export const feeRecipientsResponse: FeeRecipientsResponse = { total: 3, diff --git a/packages/connect/test/fixtures/standard_relayer_api/order_config.ts b/packages/connect/test/fixtures/standard_relayer_api/order_config.ts index 36f01a009..56a4ac550 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/order_config.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/order_config.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -import { OrderConfigResponse } from '../../../src/types'; +import { OrderConfigResponse } from '@0xproject/types'; export const orderConfigResponse: OrderConfigResponse = { senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', diff --git a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts index d5f39a51f..21d51da74 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orderbook.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -import { OrderbookResponse } from '../../../src/types'; +import { OrderbookResponse } from '@0xproject/types'; export const orderbookResponse: OrderbookResponse = { bids: { diff --git a/packages/connect/test/fixtures/standard_relayer_api/orders.ts b/packages/connect/test/fixtures/standard_relayer_api/orders.ts index 01f8974b8..fb85990d0 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/orders.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/orders.ts @@ -1,6 +1,6 @@ import { BigNumber } from '@0xproject/utils'; -import { OrdersResponse } from '../../../src/types'; +import { OrdersResponse } from '@0xproject/types'; export const ordersResponse: OrdersResponse = { total: 984, diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 2f8a02a1a..d3e0ad5d1 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,12 +1,36 @@ [ { - "timestamp": 1537541580, + "version": "2.0.0", + "changes": [ + { + "note": + "Fixes dropped events in subscriptions by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too.", + "pr": 1080 + }, + { + "note": + "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "pr": 1080 + } + ] + }, + { + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ], + "timestamp": 1537875740 + }, + { "version": "1.0.4", "changes": [ { "note": "Dependencies updated" } - ] + ], + "timestamp": 1537541580 }, { "version": "1.0.3", diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index 3757bd6ba..98de9c7f2 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 21, 2018_ * Dependencies updated diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 331ff1701..57f994ff1 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/contract-wrappers", - "version": "1.0.4", + "version": "1.0.5", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -41,10 +41,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/migrations": "^1.0.10", - "@0xproject/subproviders": "^2.0.3", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/migrations": "^1.0.11", + "@0xproject/subproviders": "^2.0.4", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -72,17 +72,17 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/base-contract": "^2.0.3", - "@0xproject/fill-scenarios": "^1.0.3", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/fill-scenarios": "^1.0.4", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", - "ethereumjs-blockstream": "5.0.0", + "ethereumjs-blockstream": "6.0.0", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "js-sha3": "^0.7.0", diff --git a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts index 19a882712..f7a89e3be 100644 --- a/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/contract_wrapper.ts @@ -1,14 +1,14 @@ import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; import { BlockParamLiteral, - BlockWithoutTransactionData, ContractAbi, ContractArtifact, FilterObject, LogEntry, LogWithDecodedArgs, RawLog, + RawLogEntry, } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -158,7 +158,8 @@ export abstract class ContractWrapper { return addressIfExists; } } - private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, log: LogEntry): void { + private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void { + const log: LogEntry = marshaller.unmarshalLog(rawLog); _.forEach(this._filters, (filter: FilterObject, filterToken: string) => { if (filterUtils.matchesFilter(log, filter)) { const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>; @@ -175,8 +176,8 @@ export abstract class ContractWrapper { throw new Error(ContractWrappersError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( - this._getBlockOrNullAsync.bind(this), - this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), + this._blockstreamGetBlockOrNullAsync.bind(this), + this._blockstreamGetLogsAsync.bind(this), ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose), ); const catchAllLogFilter = {}; @@ -196,12 +197,30 @@ export abstract class ContractWrapper { ); } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _getBlockOrNullAsync(): Promise<BlockWithoutTransactionData | null> { - const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); - if (_.isUndefined(blockIfExists)) { - return null; - } - return blockIfExists; + private async _blockstreamGetBlockOrNullAsync(hash: string): Promise<Block | null> { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({ + method: 'eth_getBlockByHash', + params: [hash, shouldIncludeTransactionData], + }); + return blockOrNull; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLatestBlockOrNullAsync(): Promise<Block | null> { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({ + method: 'eth_getBlockByNumber', + params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], + }); + return blockOrNull; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<RawLogEntry[]> { + const logs = await this._web3Wrapper.sendRawPayloadAsync<RawLogEntry[]>({ + method: 'eth_getLogs', + params: [filterOptions], + }); + return logs as RawLogEntry[]; } // HACK: This should be a package-scoped method (which doesn't exist in TS) // We don't want this method available in the public interface for all classes @@ -221,14 +240,14 @@ export abstract class ContractWrapper { delete this._blockAndLogStreamerIfExists; } private async _reconcileBlockAsync(): Promise<void> { - const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(BlockParamLiteral.Latest); - if (_.isUndefined(latestBlockIfExists)) { + const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync(); + if (_.isNull(latestBlockOrNull)) { return; // noop } // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull); } } } diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 63de510b1..6a7a7c208 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.45", + "version": "2.1.46", "engines": { "node": ">=6.12" }, @@ -45,11 +45,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/sol-compiler": "^1.1.3", - "@0xproject/sol-cov": "^2.1.3", - "@0xproject/subproviders": "^2.0.3", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/sol-compiler": "^1.1.4", + "@0xproject/sol-cov": "^2.1.4", + "@0xproject/subproviders": "^2.0.4", "@0xproject/tslint-config": "^1.0.7", "@types/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", @@ -72,12 +72,12 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.3", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", "ethereum-types": "^1.0.7", diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index e834eb1a3..bd4f280ba 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.9", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.8", "changes": [ diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 34f29418b..a362330c2 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.9 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.8 - _September 21, 2018_ * Dependencies updated diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 3ded87c05..c45581e45 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "1.0.8", + "version": "1.0.9", "engines": { "node": ">=6.12" }, @@ -42,11 +42,11 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/subproviders": "^2.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/subproviders": "^2.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", "lodash": "^4.17.5" }, diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts index e75a2311c..a92dbdd1b 100644 --- a/packages/ethereum-types/src/index.ts +++ b/packages/ethereum-types/src/index.ts @@ -181,6 +181,7 @@ export interface CallData extends CallTxDataBase { export interface FilterObject { fromBlock?: number | string; toBlock?: number | string; + blockHash?: string; address?: string; topics?: LogTopic[]; } diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index e378c7cf0..3023a43c5 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.3", "changes": [ diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index 16fbb4f34..4fb3f3c54 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index 474618a14..857ec496f 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/fill-scenarios", - "version": "1.0.3", + "version": "1.0.4", "description": "0x order fill scenario generator", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", + "@0xproject/abi-gen": "^1.0.10", "@0xproject/tslint-config": "^1.0.7", "@types/lodash": "4.14.104", "copyfiles": "^2.0.0", @@ -37,12 +37,12 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/base-contract": "^2.0.3", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index e3308f98b..afe8c6f55 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.2", "changes": [ diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 0817874ba..dc9a69a3c 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.2 - _September 21, 2018_ * Dependencies updated diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 3d5399d2a..7dfdb1066 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -45,7 +45,7 @@ }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 9824da332..924408d53 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.19", + "version": "0.0.20", "engines": { "node": ">=6.12" }, @@ -28,15 +28,15 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/base-contract": "^2.0.3", - "@0xproject/sol-cov": "^2.1.3", - "@0xproject/subproviders": "^2.0.3", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/sol-cov": "^2.1.4", + "@0xproject/subproviders": "^2.0.4", "@0xproject/tslint-config": "^1.0.7", - "@0xproject/types": "^1.0.2", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", "ethereum-types": "^1.0.7", @@ -45,8 +45,8 @@ "run-s": "^0.0.0" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/sol-compiler": "^1.1.3", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/sol-compiler": "^1.1.4", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/migrations/.gitignore b/packages/migrations/.gitignore new file mode 100644 index 000000000..dc4af7ced --- /dev/null +++ b/packages/migrations/.gitignore @@ -0,0 +1 @@ +artifacts/development diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index a25de1a77..1c8418818 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.10", "changes": [ diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index 2a6aeb96d..80038bebb 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 21, 2018_ * Dependencies updated diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 1229c78dc..f44a254ed 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -30,10 +30,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/dev-utils": "^1.0.8", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/dev-utils": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", - "@0xproject/types": "^1.0.2", + "@0xproject/types": "^1.1.0", "@types/yargs": "^10.0.0", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", @@ -44,13 +44,13 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.3", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/sol-compiler": "^1.1.3", - "@0xproject/subproviders": "^2.0.3", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/sol-compiler": "^1.1.4", + "@0xproject/subproviders": "^2.0.4", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^1.0.7", "ethers": "3.0.22", diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 5bf538c1f..d6742df2e 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.3", "changes": [ diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index e35867fa6..67e5a54a6 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index c9620bffa..167d32608 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-utils", - "version": "1.0.3", + "version": "1.0.4", "engines": { "node": ">=6.12" }, @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.8", + "@0xproject/dev-utils": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -57,13 +57,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/base-contract": "^2.0.3", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@types/node": "*", "bn.js": "^4.11.8", "ethereum-types": "^1.0.7", diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts index 8398776aa..9b21ef6e9 100644 --- a/packages/order-utils/src/order_state_utils.ts +++ b/packages/order-utils/src/order_state_utils.ts @@ -114,7 +114,7 @@ export class OrderStateUtils { * @return State relevant to the signedOrder, as well as whether the signedOrder is "valid". * Validity is defined as a non-zero amount of the order can still be filled. */ - public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { + public async getOpenOrderStateAsync(signedOrder: SignedOrder, transactionHash?: string): Promise<OrderState> { const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder); const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); @@ -134,6 +134,7 @@ export class OrderStateUtils { isValid: true, orderHash, orderRelevantState, + transactionHash, }; return orderState; } else { @@ -141,6 +142,7 @@ export class OrderStateUtils { isValid: false, orderHash, error: orderValidationResult.error, + transactionHash, }; return orderState; } diff --git a/packages/order-utils/test/order_state_utils_test.ts b/packages/order-utils/test/order_state_utils_test.ts index 91ef23b69..ea88027ae 100644 --- a/packages/order-utils/test/order_state_utils_test.ts +++ b/packages/order-utils/test/order_state_utils_test.ts @@ -120,5 +120,25 @@ describe('OrderStateUtils', () => { const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder); expect(orderState.isValid).to.eq(false); }); + it('should include the transactionHash in orderState if supplied in method invocation', async () => { + const makerAssetAmount = new BigNumber(10); + const takerAssetAmount = new BigNumber(10000000000000000); + const takerBalance = takerAssetAmount; + const orderFilledAmount = new BigNumber(0); + const mockBalanceFetcher = buildMockBalanceFetcher(takerBalance); + const mockOrderFilledFetcher = buildMockOrderFilledFetcher(orderFilledAmount); + const [signedOrder] = testOrderFactory.generateTestSignedOrders( + { + makerAssetAmount, + takerAssetAmount, + }, + 1, + ); + + const orderStateUtils = new OrderStateUtils(mockBalanceFetcher, mockOrderFilledFetcher); + const transactionHash = '0xdeadbeef'; + const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash); + expect(orderState.transactionHash).to.eq(transactionHash); + }); }); }); diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index dec154f0f..46dc4c0df 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,12 +1,41 @@ [ { - "timestamp": 1537541580, + "version": "2.0.0", + "changes": [ + { + "note": + "Fixes dropped events issue by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too.", + "pr": 1080 + }, + { + "note": + "Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it", + "pr": 1080 + }, + { + "note": + "Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction.", + "pr": 1087 + } + ] + }, + { + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ], + "timestamp": 1537875740 + }, + { "version": "1.0.4", "changes": [ { "note": "Dependencies updated" } - ] + ], + "timestamp": 1537541580 }, { "version": "1.0.3", diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index a4e1cc79f..d179b2e1a 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.5 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.4 - _September 21, 2018_ * Dependencies updated diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 8ce57364f..b00a76e55 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "1.0.4", + "version": "1.0.5", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -42,9 +42,9 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.9", - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/migrations": "^1.0.10", + "@0xproject/abi-gen": "^1.0.10", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/migrations": "^1.0.11", "@0xproject/tslint-config": "^1.0.7", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", @@ -70,19 +70,19 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/base-contract": "^2.0.3", - "@0xproject/contract-wrappers": "^1.0.4", - "@0xproject/fill-scenarios": "^1.0.3", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/base-contract": "^2.0.4", + "@0xproject/contract-wrappers": "^1.0.5", + "@0xproject/fill-scenarios": "^1.0.4", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "bintrees": "^1.0.2", "ethereum-types": "^1.0.7", - "ethereumjs-blockstream": "5.0.0", + "ethereumjs-blockstream": "6.0.0", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index eca235e26..9ea301815 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -1,6 +1,6 @@ import { intervalUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { BlockParamLiteral, BlockWithoutTransactionData, LogEntry, Provider } from 'ethereum-types'; +import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; +import { BlockParamLiteral, FilterObject, LogEntry, Provider, RawLogEntry } from 'ethereum-types'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; @@ -20,7 +20,6 @@ enum LogEventState { */ export class EventWatcher { private readonly _web3Wrapper: Web3Wrapper; - private readonly _stateLayer: BlockParamLiteral; private readonly _isVerbose: boolean; private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined; private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; @@ -35,7 +34,6 @@ export class EventWatcher { ) { this._isVerbose = isVerbose; this._web3Wrapper = new Web3Wrapper(provider); - this._stateLayer = stateLayer; this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs) ? DEFAULT_EVENT_POLLING_INTERVAL_MS : pollingIntervalIfExistsMs; @@ -62,8 +60,8 @@ export class EventWatcher { throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( - this._getBlockOrNullAsync.bind(this), - this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), + this._blockstreamGetBlockOrNullAsync.bind(this), + this._blockstreamGetLogsAsync.bind(this), this._onBlockAndLogStreamerError.bind(this), ); const catchAllLogFilter = {}; @@ -83,12 +81,30 @@ export class EventWatcher { ); } // This method only exists in order to comply with the expected interface of Blockstream's constructor - private async _getBlockOrNullAsync(): Promise<BlockWithoutTransactionData | null> { - const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); - if (_.isUndefined(blockIfExists)) { - return null; - } - return blockIfExists; + private async _blockstreamGetBlockOrNullAsync(hash: string): Promise<Block | null> { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({ + method: 'eth_getBlockByHash', + params: [hash, shouldIncludeTransactionData], + }); + return blockOrNull; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLatestBlockOrNullAsync(): Promise<Block | null> { + const shouldIncludeTransactionData = false; + const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({ + method: 'eth_getBlockByNumber', + params: [BlockParamLiteral.Latest, shouldIncludeTransactionData], + }); + return blockOrNull; + } + // This method only exists in order to comply with the expected interface of Blockstream's constructor + private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<RawLogEntry[]> { + const logs = await this._web3Wrapper.sendRawPayloadAsync<RawLogEntry[]>({ + method: 'eth_getLogs', + params: [filterOptions], + }); + return logs as RawLogEntry[]; } private _stopBlockAndLogStream(): void { if (_.isUndefined(this._blockAndLogStreamerIfExists)) { @@ -103,19 +119,20 @@ export class EventWatcher { private async _onLogStateChangedAsync( callback: EventWatcherCallback, isRemoved: boolean, - log: LogEntry, + rawLog: RawLogEntry, ): Promise<void> { + const log: LogEntry = marshaller.unmarshalLog(rawLog); await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback); } private async _reconcileBlockAsync(): Promise<void> { - const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(this._stateLayer); - if (_.isUndefined(latestBlockIfExists)) { + const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync(); + if (_.isNull(latestBlockOrNull)) { return; // noop } // We need to coerce to Block type cause Web3.Block includes types for mempool blocks if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined - await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); + await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull); } } private async _emitDifferencesAsync( diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index cab2efa4b..f9a63efe3 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -275,6 +275,7 @@ export class OrderWatcher { return; // noop } const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>; + const transactionHash = decodedLog.transactionHash; switch (decodedLog.event) { case ERC20TokenEvents.Approval: case ERC721TokenEvents.Approval: { @@ -290,7 +291,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } else { // ERC721 @@ -303,7 +304,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } } @@ -322,7 +323,7 @@ export class OrderWatcher { args._from, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } else { // ERC721 @@ -336,7 +337,7 @@ export class OrderWatcher { args._from, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } } @@ -350,7 +351,7 @@ export class OrderWatcher { args._owner, tokenAddress, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case WETH9Events.Deposit: { @@ -363,7 +364,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case WETH9Events.Withdrawal: { @@ -376,7 +377,7 @@ export class OrderWatcher { args._owner, tokenAssetData, ); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } case ExchangeEvents.Fill: { @@ -387,7 +388,7 @@ export class OrderWatcher { const orderHash = args.orderHash; const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); if (isOrderWatched) { - await this._emitRevalidateOrdersAsync([orderHash]); + await this._emitRevalidateOrdersAsync([orderHash], transactionHash); } break; } @@ -399,7 +400,7 @@ export class OrderWatcher { const orderHash = args.orderHash; const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); if (isOrderWatched) { - await this._emitRevalidateOrdersAsync([orderHash]); + await this._emitRevalidateOrdersAsync([orderHash], transactionHash); } break; } @@ -410,7 +411,7 @@ export class OrderWatcher { this._orderFilledCancelledLazyStore.deleteAllIsCancelled(); // Revalidate orders const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByMaker(args.makerAddress); - await this._emitRevalidateOrdersAsync(orderHashes); + await this._emitRevalidateOrdersAsync(orderHashes, transactionHash); break; } @@ -418,12 +419,12 @@ export class OrderWatcher { throw errorUtils.spawnSwitchErr('decodedLog.event', decodedLog.event); } } - private async _emitRevalidateOrdersAsync(orderHashes: string[]): Promise<void> { + private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise<void> { for (const orderHash of orderHashes) { const signedOrder = this._orderByOrderHash[orderHash]; // Most of these calls will never reach the network because the data is fetched from stores // and only updated when cache is invalidated - const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder); + const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash); if (_.isUndefined(this._callbackIfExists)) { break; // Unsubscribe was called } diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 38bfde7ef..60d9069e8 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -250,6 +250,32 @@ describe('OrderWatcher', () => { await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress); })().catch(done); }); + it('should include transactionHash in emitted orderStateInvalid when watched order fully filled', (done: DoneCallback) => { + (async () => { + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + takerAddress, + fillableAmount, + ); + await orderWatcher.addOrderAsync(signedOrder); + + let transactionHash: string; + const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { + expect(orderState.isValid).to.be.false(); + const invalidOrderState = orderState as OrderStateInvalid; + expect(invalidOrderState.transactionHash).to.be.equal(transactionHash); + }); + orderWatcher.subscribe(callback); + + transactionHash = await contractWrappers.exchange.fillOrderAsync( + signedOrder, + fillableAmount, + takerAddress, + ); + })().catch(done); + }); it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => { (async () => { signedOrder = await fillScenarios.createFillableSignedOrderAsync( diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index c8a44aa9e..4e3dfed99 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index 595b0cf98..ca96d479d 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 19be6d04f..d4882c22a 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -23,7 +23,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.8", + "@0xproject/dev-utils": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "@types/compare-versions": "^3.0.0", "copyfiles": "^2.0.0", @@ -33,9 +33,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/react-shared": "^1.0.10", - "@0xproject/types": "^1.0.1-rc.6", - "@0xproject/utils": "^1.0.9", + "@0xproject/react-shared": "^1.0.11", + "@0xproject/types": "^1.1.0", + "@0xproject/utils": "^1.0.10", "@types/lodash": "4.14.104", "@types/material-ui": "^0.20.0", "@types/node": "*", diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 9eb8a7d86..a690a1f03 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -135,14 +135,19 @@ function renderTypeParameter( ): React.ReactNode { const typeParam = ( <span> - {`<${typeParameter.name} extends `} - <Type - type={typeParameter.type} - sectionName={sectionName} - typeDefinitionByName={typeDefinitionByName} - docsInfo={docsInfo} - isInPopover={isInPopover} - /> + {`<${typeParameter.name}`} + {!_.isUndefined(typeParameter.type) && ( + <span> + {' extends '} + <Type + type={typeParameter.type} + sectionName={sectionName} + typeDefinitionByName={typeDefinitionByName} + docsInfo={docsInfo} + isInPopover={isInPopover} + /> + </span> + )} {`>`} </span> ); diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 09f995672..19605d497 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -419,7 +419,10 @@ export class TypeDocUtils { return func; } private _convertTypeParameter(entity: TypeDocNode, sectionName: string): TypeParameter { - const type = this._convertType(entity.type, sectionName); + let type; + if (!_.isUndefined(entity.type)) { + type = this._convertType(entity.type, sectionName); + } const parameter = { name: entity.name, type, diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 898ab26aa..96e2a92f9 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.11", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.10", "changes": [ diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index f6878e43f..09f6066cd 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.11 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.10 - _September 21, 2018_ * Dependencies updated diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 458968c39..9154c2bb6 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "1.0.10", + "version": "1.0.11", "engines": { "node": ">=6.12" }, @@ -24,7 +24,7 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.8", + "@0xproject/dev-utils": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index 9a1961b79..af6897b40 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.1.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.1.3", "changes": [ diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index a5d1332f8..02058b378 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.4 - _September 25, 2018_ + + * Dependencies updated + ## v1.1.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 2ad0f9f09..841e2960c 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "1.1.3", + "version": "1.1.4", "engines": { "node": ">=6.12" }, @@ -41,7 +41,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.8", + "@0xproject/dev-utils": "^1.0.9", "@0xproject/tslint-config": "^1.0.7", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", @@ -64,13 +64,13 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/json-schemas": "^1.0.2", - "@0xproject/sol-resolver": "^1.0.9", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/sol-resolver": "^1.0.10", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@types/yargs": "^11.0.0", "chalk": "^2.3.0", "ethereum-types": "^1.0.7", diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 5f49e0443..ef009b586 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "2.1.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "2.1.3", "changes": [ diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index e1b898b19..5dddb1c4d 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.1.4 - _September 25, 2018_ + + * Dependencies updated + ## v2.1.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index f80ae78e0..63b8f06d5 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "2.1.3", + "version": "2.1.4", "engines": { "node": ">=6.12" }, @@ -41,12 +41,12 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/dev-utils": "^1.0.8", - "@0xproject/sol-compiler": "^1.1.3", - "@0xproject/subproviders": "^2.0.3", + "@0xproject/dev-utils": "^1.0.9", + "@0xproject/sol-compiler": "^1.1.4", + "@0xproject/subproviders": "^2.0.4", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "ethereum-types": "^1.0.7", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index bfc7cb93b..ee439c2d0 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 5bed9f43c..53354f4ef 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index da3f18788..caf7df3aa 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -30,7 +30,7 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.0.2", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", "lodash": "^4.17.5" }, diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index ee12caf34..006965b01 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 5e75625df..298ea66ec 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index eebf0cc0b..c916765e2 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -33,13 +33,13 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { - "@0xproject/assert": "^1.0.9", + "@0xproject/assert": "^1.0.10", "@0xproject/connect": "1.0.4", "@0xproject/json-schemas": "^0.8.3", "@0xproject/order-utils": "^0.0.9", "@0xproject/types": "^0.8.2", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "chalk": "^2.3.0", "lodash": "^4.17.5", "newman": "^3.9.3", diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json index e0b373191..a4a1fe8ff 100644 --- a/packages/sra-spec/CHANGELOG.json +++ b/packages/sra-spec/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.2", "changes": [ diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md index 59f397bc6..e279d517f 100644 --- a/packages/sra-spec/CHANGELOG.md +++ b/packages/sra-spec/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.2 - _September 21, 2018_ * Dependencies updated diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 3da886e34..0c5131848 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-spec", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md", "dependencies": { - "@0xproject/json-schemas": "^1.0.2" + "@0xproject/json-schemas": "^1.0.3" }, "devDependencies": { "@0xproject/tslint-config": "^1.0.7", diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 2d3c37615..8b6b87d2a 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "2.0.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "2.0.3", "changes": [ diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 6e268d7ec..708a94b21 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.0.4 - _September 25, 2018_ + + * Dependencies updated + ## v2.0.3 - _September 21, 2018_ * Dependencies updated diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 347c71726..6740a0743 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "2.0.3", + "version": "2.0.4", "engines": { "node": ">=6.12" }, @@ -28,11 +28,11 @@ } }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/types": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "@types/eth-lightwallet": "^3.0.0", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 448186b34..cfac1b018 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.47", + "version": "1.0.48", "engines": { "node": ">=6.12" }, @@ -17,11 +17,11 @@ "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^1.0.4", - "@0xproject/subproviders": "^2.0.3", + "0x.js": "^1.0.5", + "@0xproject/subproviders": "^2.0.4", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "body-parser": "^1.17.1", "ethereum-types": "^1.0.7", "ethereumjs-tx": "^1.3.5", diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index 8b1346347..f9479f789 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -5,8 +5,13 @@ { "note": "Add ObjectMap type", "pr": 1037 + }, + { + "note": "Add SRA types from connect", + "pr": 1085 } - ] + ], + "timestamp": 1537875740 }, { "timestamp": 1537541580, diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index d89416fd6..9841aa301 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.1.0 - _September 25, 2018_ + + * Add ObjectMap type (#1037) + * Add SRA types from connect (#1085) + ## v1.0.2 - _September 21, 2018_ * Dependencies updated diff --git a/packages/types/package.json b/packages/types/package.json index f1c04b39b..f78368198 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "1.0.2", + "version": "1.1.0", "engines": { "node": ">=6.12" }, diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 872a51f87..dddc785b7 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -111,12 +111,14 @@ export interface OrderStateValid { isValid: true; orderHash: string; orderRelevantState: OrderRelevantState; + transactionHash?: string; } export interface OrderStateInvalid { isValid: false; orderHash: string; error: ExchangeContractErrs; + transactionHash?: string; } export type OrderState = OrderStateValid | OrderStateInvalid; @@ -244,6 +246,134 @@ export interface ObjectMap<T> { [key: string]: T; } +/** + * baseAssetData: The address of assetData designated as the baseToken in the currency pair calculation of price + * quoteAssetData: The address of assetData designated as the quoteToken in the currency pair calculation of price + * limit: Maximum number of bids and asks in orderbook snapshot + */ +export interface OrdersChannelSubscriptionOpts { + baseAssetData: string; + quoteAssetData: string; + limit: number; +} + +export type OrdersChannelMessage = UpdateOrdersChannelMessage | UnknownOrdersChannelMessage; + +export enum OrdersChannelMessageTypes { + Update = 'update', + Unknown = 'unknown', +} + +export interface UpdateOrdersChannelMessage { + type: OrdersChannelMessageTypes.Update; + requestId: string; + payload: APIOrder[]; +} + +export interface UnknownOrdersChannelMessage { + type: OrdersChannelMessageTypes.Unknown; + requestId: string; + payload: undefined; +} + +export enum WebsocketConnectionEventType { + Close = 'close', + Error = 'error', + Message = 'message', +} + +export enum WebsocketClientEventType { + Connect = 'connect', + ConnectFailed = 'connectFailed', +} + +export type OrdersResponse = PaginatedCollection<APIOrder>; + +export interface APIOrder { + order: SignedOrder; + metaData: object; +} + +export interface AssetPairsRequestOpts { + assetDataA?: string; + assetDataB?: string; +} + +export type AssetPairsResponse = PaginatedCollection<AssetPairsItem>; + +export interface AssetPairsItem { + assetDataA: Asset; + assetDataB: Asset; +} + +export interface Asset { + assetData: string; + minAmount: BigNumber; + maxAmount: BigNumber; + precision: number; +} + +export interface OrdersRequestOpts { + makerAssetProxyId?: string; + takerAssetProxyId?: string; + makerAssetAddress?: string; + takerAssetAddress?: string; + exchangeAddress?: string; + senderAddress?: string; + makerAssetData?: string; + takerAssetData?: string; + makerAddress?: string; + takerAddress?: string; + traderAddress?: string; + feeRecipientAddress?: string; +} + +export interface OrderbookRequest { + baseAssetData: string; + quoteAssetData: string; +} + +export interface OrderbookResponse { + bids: PaginatedCollection<APIOrder>; + asks: PaginatedCollection<APIOrder>; +} + +export interface PaginatedCollection<T> { + total: number; + page: number; + perPage: number; + records: T[]; +} + +export interface OrderConfigRequest { + makerAddress: string; + takerAddress: string; + makerAssetAmount: BigNumber; + takerAssetAmount: BigNumber; + makerAssetData: string; + takerAssetData: string; + exchangeAddress: string; + expirationTimeSeconds: BigNumber; +} + +export interface OrderConfigResponse { + makerFee: BigNumber; + takerFee: BigNumber; + feeRecipientAddress: string; + senderAddress: string; +} + +export type FeeRecipientsResponse = PaginatedCollection<string>; + +export interface RequestOpts { + networkId?: number; +} + +export interface PagedRequestOpts { + page?: number; + perPage?: number; +} + export interface TypeDocType { type: TypeDocTypes; value: string; diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index 7449355ce..1536c1960 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1537875740, + "version": "1.0.10", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1537541580, "version": "1.0.9", "changes": [ diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index aa2c08940..ff26a0900 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.10 - _September 25, 2018_ + + * Dependencies updated + ## v1.0.9 - _September 21, 2018_ * Dependencies updated diff --git a/packages/utils/package.json b/packages/utils/package.json index a3977cef6..77d11c41c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "1.0.9", + "version": "1.0.10", "engines": { "node": ">=6.12" }, @@ -41,7 +41,7 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.0.2", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", "@types/node": "*", "abortcontroller-polyfill": "^1.1.9", diff --git a/packages/verdaccio/Dockerfile b/packages/verdaccio/Dockerfile new file mode 100644 index 000000000..6a6a64abf --- /dev/null +++ b/packages/verdaccio/Dockerfile @@ -0,0 +1,3 @@ +FROM verdaccio/verdaccio + +ADD conf.yaml /verdaccio/conf/config.yaml diff --git a/packages/verdaccio/README.md b/packages/verdaccio/README.md new file mode 100644 index 000000000..340cd5512 --- /dev/null +++ b/packages/verdaccio/README.md @@ -0,0 +1,18 @@ +## 0x Verdaccio + +This package contains a Dockerfile and conf.yaml file for configuring our own +Docker image for Verdaccio. + +See https://verdaccio.org/docs/en/configuration for more information. + +## Build + +In the root directory for _this package_, run: + +`sudo docker build . -t 0x-verdaccio` + +## Run + +To start Verdaccio run: + +`sudo docker run --rm -i -p 4873:4873 0x-verdaccio` diff --git a/packages/verdaccio/conf.yaml b/packages/verdaccio/conf.yaml new file mode 100644 index 000000000..24e036932 --- /dev/null +++ b/packages/verdaccio/conf.yaml @@ -0,0 +1,71 @@ +# +# Copied from https://github.com/verdaccio/verdaccio/blob/90fc216649ecd8df31d3706b5c17555fa0a35e4a/conf/docker.yaml +# Only the uplinks section has been modified. +# +# This is the config file used for the docker images. +# It allows all users to do anything, so don't use it on production systems. +# +# Do not configure host and port under `listen` in this file +# as it will be ignored when using docker. +# see https://github.com/verdaccio/verdaccio/blob/master/wiki/docker.md#docker-and-custom-port-configuration +# +# Look here for more config file examples: +# https://github.com/verdaccio/verdaccio/tree/master/conf +# + +# path to a directory with all packages +storage: /verdaccio/storage +# path to a directory with plugins to include +plugins: /verdaccio/plugins + +web: + # WebUI is enabled as default, if you want disable it, just uncomment this line + enable: false + +auth: + htpasswd: + file: /verdaccio/conf/htpasswd + # Maximum amount of users allowed to register, defaults to "+infinity". + # You can set this to -1 to disable registration. + #max_users: 1000 + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + cache: true + max_fails: 5 + +packages: + '@*/*': + # scoped packages + access: $all + publish: $authenticated + proxy: npmjs + + '**': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + + # allow all known users to publish packages + # (anyone can register by default, remember?) + publish: $authenticated + + # if package is not available locally, proxy requests to 'npmjs' registry + proxy: npmjs + +# To use `npm audit` uncomment the following section +# middlewares: +# audit: +# enabled: true + +# log settings +logs: + - {type: stdout, format: pretty, level: http} + #- {type: file, path: verdaccio.log, level: info} + +max_body_size: 100mb diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index ce3f5e3be..8895951bc 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -6,8 +6,14 @@ "note": "Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined.", "pr": 1082 + }, + { + "note": + "Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls", + "pr": 1080 } - ] + ], + "timestamp": 1537875740 }, { "version": "2.0.3", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 72aff4a95..cafbe1340 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v3.0.0 - _September 25, 2018_ + + * Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined. (#1082) + ## v2.0.3 - _September 21, 2018_ * Fixes issue #1076 where Parity now returns a placeholder transactionReceipt before the transaction is mined. (#1079) diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index bcd640839..f895296e9 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "2.0.3", + "version": "3.0.0", "engines": { "node": ">=6.12" }, @@ -53,10 +53,10 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.9", - "@0xproject/json-schemas": "^1.0.2", + "@0xproject/assert": "^1.0.10", + "@0xproject/json-schemas": "^1.0.3", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", + "@0xproject/utils": "^1.0.10", "ethereum-types": "^1.0.7", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index dc634a57f..d52c1cb6e 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -193,7 +193,7 @@ export class Web3Wrapper { * @returns Ethereum node's version string */ public async getNodeVersionAsync(): Promise<string> { - const nodeVersion = await this._sendRawPayloadAsync<string>({ method: 'web3_clientVersion' }); + const nodeVersion = await this.sendRawPayloadAsync<string>({ method: 'web3_clientVersion' }); return nodeVersion; } /** @@ -201,7 +201,7 @@ export class Web3Wrapper { * @returns The network id */ public async getNetworkIdAsync(): Promise<number> { - const networkIdStr = await this._sendRawPayloadAsync<string>({ method: 'net_version' }); + const networkIdStr = await this.sendRawPayloadAsync<string>({ method: 'net_version' }); const networkId = _.parseInt(networkIdStr); return networkId; } @@ -212,7 +212,7 @@ export class Web3Wrapper { */ public async getTransactionReceiptAsync(txHash: string): Promise<TransactionReceipt> { assert.isHexString('txHash', txHash); - const transactionReceipt = await this._sendRawPayloadAsync<TransactionReceipt>({ + const transactionReceipt = await this.sendRawPayloadAsync<TransactionReceipt>({ method: 'eth_getTransactionReceipt', params: [txHash], }); @@ -228,7 +228,7 @@ export class Web3Wrapper { */ public async getTransactionByHashAsync(txHash: string): Promise<Transaction> { assert.isHexString('txHash', txHash); - const transaction = await this._sendRawPayloadAsync<Transaction>({ + const transaction = await this.sendRawPayloadAsync<Transaction>({ method: 'eth_getTransactionByHash', params: [txHash], }); @@ -247,7 +247,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const encodedOwner = marshaller.marshalAddress(owner); - const balanceInWei = await this._sendRawPayloadAsync<string>({ + const balanceInWei = await this.sendRawPayloadAsync<string>({ method: 'eth_getBalance', params: [encodedOwner, marshalledDefaultBlock], }); @@ -279,7 +279,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const encodedAddress = marshaller.marshalAddress(address); - const code = await this._sendRawPayloadAsync<string>({ + const code = await this.sendRawPayloadAsync<string>({ method: 'eth_getCode', params: [encodedAddress, marshalledDefaultBlock], }); @@ -293,7 +293,7 @@ export class Web3Wrapper { */ public async getTransactionTraceAsync(txHash: string, traceParams: TraceParams): Promise<TransactionTrace> { assert.isHexString('txHash', txHash); - const trace = await this._sendRawPayloadAsync<TransactionTrace>({ + const trace = await this.sendRawPayloadAsync<TransactionTrace>({ method: 'debug_traceTransaction', params: [txHash, traceParams], }); @@ -308,7 +308,7 @@ export class Web3Wrapper { public async signMessageAsync(address: string, message: string): Promise<string> { assert.isETHAddressHex('address', address); assert.isString('message', message); // TODO: Should this be stricter? Hex string? - const signData = await this._sendRawPayloadAsync<string>({ + const signData = await this.sendRawPayloadAsync<string>({ method: 'eth_sign', params: [address, message], }); @@ -319,7 +319,7 @@ export class Web3Wrapper { * @returns Block number */ public async getBlockNumberAsync(): Promise<number> { - const blockNumberHex = await this._sendRawPayloadAsync<string>({ + const blockNumberHex = await this.sendRawPayloadAsync<string>({ method: 'eth_blockNumber', params: [], }); @@ -339,7 +339,7 @@ export class Web3Wrapper { const encodedBlockParam = marshaller.marshalBlockParam(blockParam); const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const shouldIncludeTransactionData = false; - const blockWithoutTransactionDataWithHexValuesOrNull = await this._sendRawPayloadAsync< + const blockWithoutTransactionDataWithHexValuesOrNull = await this.sendRawPayloadAsync< BlockWithoutTransactionDataRPC >({ method, @@ -366,7 +366,7 @@ export class Web3Wrapper { } const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const shouldIncludeTransactionData = true; - const blockWithTransactionDataWithHexValues = await this._sendRawPayloadAsync<BlockWithTransactionDataRPC>({ + const blockWithTransactionDataWithHexValues = await this.sendRawPayloadAsync<BlockWithTransactionDataRPC>({ method, params: [encodedBlockParam, shouldIncludeTransactionData], }); @@ -393,7 +393,7 @@ export class Web3Wrapper { * @returns Available user addresses */ public async getAvailableAddressesAsync(): Promise<string[]> { - const addresses = await this._sendRawPayloadAsync<string>({ + const addresses = await this.sendRawPayloadAsync<string>({ method: 'eth_accounts', params: [], }); @@ -405,7 +405,7 @@ export class Web3Wrapper { * @returns The snapshot id. This can be used to revert to this snapshot */ public async takeSnapshotAsync(): Promise<number> { - const snapshotId = Number(await this._sendRawPayloadAsync<string>({ method: 'evm_snapshot', params: [] })); + const snapshotId = Number(await this.sendRawPayloadAsync<string>({ method: 'evm_snapshot', params: [] })); return snapshotId; } /** @@ -415,14 +415,14 @@ export class Web3Wrapper { */ public async revertSnapshotAsync(snapshotId: number): Promise<boolean> { assert.isNumber('snapshotId', snapshotId); - const didRevert = await this._sendRawPayloadAsync<boolean>({ method: 'evm_revert', params: [snapshotId] }); + const didRevert = await this.sendRawPayloadAsync<boolean>({ method: 'evm_revert', params: [snapshotId] }); return didRevert; } /** * Mine a block on a TestRPC/Ganache local node */ public async mineBlockAsync(): Promise<void> { - await this._sendRawPayloadAsync<string>({ method: 'evm_mine', params: [] }); + await this.sendRawPayloadAsync<string>({ method: 'evm_mine', params: [] }); } /** * Increase the next blocks timestamp on TestRPC/Ganache or Geth local node. @@ -434,9 +434,9 @@ export class Web3Wrapper { // Detect Geth vs. Ganache and use appropriate endpoint. const version = await this.getNodeVersionAsync(); if (_.includes(version, uniqueVersionIds.geth)) { - return this._sendRawPayloadAsync<number>({ method: 'debug_increaseTime', params: [timeDelta] }); + return this.sendRawPayloadAsync<number>({ method: 'debug_increaseTime', params: [timeDelta] }); } else if (_.includes(version, uniqueVersionIds.ganache)) { - return this._sendRawPayloadAsync<number>({ method: 'evm_increaseTime', params: [timeDelta] }); + return this.sendRawPayloadAsync<number>({ method: 'evm_increaseTime', params: [timeDelta] }); } else { throw new Error(`Unknown client version: ${version}`); } @@ -447,6 +447,12 @@ export class Web3Wrapper { * @returns The corresponding log entries */ public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> { + if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) { + throw new Error( + `Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`, + ); + } + let fromBlock = filter.fromBlock; if (_.isNumber(fromBlock)) { fromBlock = utils.numberToHex(fromBlock); @@ -464,7 +470,7 @@ export class Web3Wrapper { method: 'eth_getLogs', params: [serializedFilter], }; - const rawLogs = await this._sendRawPayloadAsync<RawLogEntry[]>(payload); + const rawLogs = await this.sendRawPayloadAsync<RawLogEntry[]>(payload); const formattedLogs = _.map(rawLogs, marshaller.unmarshalLog.bind(marshaller)); return formattedLogs; } @@ -480,7 +486,7 @@ export class Web3Wrapper { schemas.jsNumber, ]); const txDataHex = marshaller.marshalTxData(txData); - const gasHex = await this._sendRawPayloadAsync<string>({ method: 'eth_estimateGas', params: [txDataHex] }); + const gasHex = await this.sendRawPayloadAsync<string>({ method: 'eth_estimateGas', params: [txDataHex] }); const gas = utils.convertHexToNumber(gasHex); return gas; } @@ -501,7 +507,7 @@ export class Web3Wrapper { } const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const callDataHex = marshaller.marshalCallData(callData); - const rawCallResult = await this._sendRawPayloadAsync<string>({ + const rawCallResult = await this.sendRawPayloadAsync<string>({ method: 'eth_call', params: [callDataHex, marshalledDefaultBlock], }); @@ -522,7 +528,7 @@ export class Web3Wrapper { schemas.jsNumber, ]); const txDataHex = marshaller.marshalTxData(txData); - const txHash = await this._sendRawPayloadAsync<string>({ method: 'eth_sendTransaction', params: [txDataHex] }); + const txHash = await this.sendRawPayloadAsync<string>({ method: 'eth_sendTransaction', params: [txDataHex] }); return txHash; } /** @@ -632,7 +638,24 @@ export class Web3Wrapper { */ public async setHeadAsync(blockNumber: number): Promise<void> { assert.isNumber('blockNumber', blockNumber); - await this._sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] }); + await this.sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] }); + } + /** + * Sends a raw Ethereum JSON RPC payload and returns the response's `result` key + * @param payload A partial JSON RPC payload. No need to include version, id, params (if none needed) + * @return The contents nested under the result key of the response body + */ + public async sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> { + const sendAsync = this._provider.sendAsync.bind(this._provider); + const payloadWithDefaults = { + id: this._jsonRpcRequestId++, + params: [], + jsonrpc: '2.0', + ...payload, + }; + const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payloadWithDefaults); + const result = response.result; + return result; } /** * Returns either NodeType.Geth or NodeType.Ganache depending on the type of @@ -648,16 +671,4 @@ export class Web3Wrapper { throw new Error(`Unknown client version: ${version}`); } } - private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> { - const sendAsync = this._provider.sendAsync.bind(this._provider); - const payloadWithDefaults = { - id: this._jsonRpcRequestId++, - params: [], - jsonrpc: '2.0', - ...payload, - }; - const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payloadWithDefaults); - const result = response.result; - return result; - } } // tslint:disable-line:max-file-line-count diff --git a/packages/website/package.json b/packages/website/package.json index 65a0d4c10..67b2fb4ec 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.50", + "version": "0.0.51", "engines": { "node": ">=6.12" }, @@ -19,16 +19,16 @@ "license": "Apache-2.0", "dependencies": { "0x.js": "^0.38.6", - "@0xproject/contract-wrappers": "^1.0.4", - "@0xproject/json-schemas": "^1.0.1", - "@0xproject/order-utils": "^1.0.3", - "@0xproject/react-docs": "^1.0.9", - "@0xproject/react-shared": "^1.0.10", - "@0xproject/subproviders": "^2.0.3", - "@0xproject/types": "^1.0.2", + "@0xproject/contract-wrappers": "^1.0.5", + "@0xproject/json-schemas": "^1.0.3", + "@0xproject/order-utils": "^1.0.4", + "@0xproject/react-docs": "^1.0.10", + "@0xproject/react-shared": "^1.0.11", + "@0xproject/subproviders": "^2.0.4", + "@0xproject/types": "^1.1.0", "@0xproject/typescript-typings": "^2.0.1", - "@0xproject/utils": "^1.0.9", - "@0xproject/web3-wrapper": "^2.0.3", + "@0xproject/utils": "^1.0.10", + "@0xproject/web3-wrapper": "^3.0.0", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", |