From ffe7363776077e2363afc23a8e4c5e2ea420aefe Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 14 Mar 2018 15:02:58 -0700 Subject: Add SignedOrder, Order, and ECSignature types to the types package --- packages/connect/package.json | 3 ++- packages/connect/src/http_client.ts | 2 +- packages/connect/src/index.ts | 5 ++-- packages/connect/src/types.ts | 30 +--------------------- .../src/utils/relayer_response_json_parsers.ts | 3 ++- 5 files changed, 8 insertions(+), 35 deletions(-) (limited to 'packages/connect') diff --git a/packages/connect/package.json b/packages/connect/package.json index e0478b42a..61b92dc3e 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -50,6 +50,7 @@ "dependencies": { "@0xproject/assert": "^0.2.0", "@0xproject/json-schemas": "^0.7.14", + "@0xproject/types": "^0.3.1", "@0xproject/utils": "^0.4.1", "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", @@ -82,6 +83,6 @@ "web3-typescript-typings": "^0.10.0" }, "publishConfig": { - "access": "public" + "access": "public" } } diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index a221b54e8..5806f1d43 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -1,5 +1,6 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; +import { SignedOrder } from '@0xproject/types'; import 'isomorphic-fetch'; import * as _ from 'lodash'; import * as queryString from 'query-string'; @@ -15,7 +16,6 @@ import { OrderbookResponse, OrdersRequestOpts, PagedRequestOpts, - SignedOrder, TokenPairsItem, TokenPairsRequestOpts, } from './types'; diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts index bb42384f9..135b5b5f6 100644 --- a/packages/connect/src/index.ts +++ b/packages/connect/src/index.ts @@ -2,10 +2,8 @@ export { HttpClient } from './http_client'; export { WebSocketOrderbookChannel } from './ws_orderbook_channel'; export { Client, - ECSignature, FeesRequest, FeesResponse, - Order, OrderbookChannel, OrderbookChannelHandler, OrderbookChannelSubscriptionOpts, @@ -13,9 +11,10 @@ export { OrderbookResponse, OrdersRequestOpts, PagedRequestOpts, - SignedOrder, TokenPairsItem, TokenPairsRequestOpts, TokenTradeInfo, WebSocketOrderbookChannelConfig, } from './types'; + +export { ECSignature, Order, SignedOrder } from '@0xproject/types'; diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts index 5f837b0b3..5c344e328 100644 --- a/packages/connect/src/types.ts +++ b/packages/connect/src/types.ts @@ -1,34 +1,6 @@ +import { ECSignature, Order, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -// TODO: Consolidate Order, SignedOrder and ECSignature into a shared package instead of duplicating them from 0x.js -export interface Order { - maker: string; - taker: string; - makerFee: BigNumber; - takerFee: BigNumber; - makerTokenAmount: BigNumber; - takerTokenAmount: BigNumber; - makerTokenAddress: string; - takerTokenAddress: string; - salt: BigNumber; - exchangeContractAddress: string; - feeRecipient: string; - expirationUnixTimestampSec: BigNumber; -} - -export interface SignedOrder extends Order { - ecSignature: ECSignature; -} - -/** - * Elliptic Curve signature - */ -export interface ECSignature { - v: number; - r: string; - s: string; -} - export interface Client { getTokenPairsAsync: (requestOpts?: TokenPairsRequestOpts & PagedRequestOpts) => Promise; getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise; diff --git a/packages/connect/src/utils/relayer_response_json_parsers.ts b/packages/connect/src/utils/relayer_response_json_parsers.ts index 668461bf4..cf1c07bd9 100644 --- a/packages/connect/src/utils/relayer_response_json_parsers.ts +++ b/packages/connect/src/utils/relayer_response_json_parsers.ts @@ -1,8 +1,9 @@ import { assert } from '@0xproject/assert'; import { schemas } from '@0xproject/json-schemas'; +import { SignedOrder } from '@0xproject/types'; import * as _ from 'lodash'; -import { FeesResponse, OrderbookResponse, SignedOrder, TokenPairsItem } from '../types'; +import { FeesResponse, OrderbookResponse, TokenPairsItem } from '../types'; import { typeConverters } from './type_converters'; -- cgit v1.2.3 From 0fb4de85c4865e2f94acf3c0c8ca2c8e4a2025e9 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 14 Mar 2018 16:36:21 -0700 Subject: Updated CHANGELOGs --- packages/connect/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/connect') diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index e1fb7c795..5b5a59321 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.6.3 - _TBD, 2018_ + + * Consolidate `Order`, `SignedOrder`, and `ECSignature into` the `@0xproject/types` package (#456) + ## v0.6.2 - _February 16, 2018_ * Fix JSON parse empty response (#407) -- cgit v1.2.3 From bbdb07263499760d9bc3de8b83285367b299eb6f Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 16 Mar 2018 11:22:43 -0700 Subject: Fix quotation marks --- packages/connect/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/connect') diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index 5b5a59321..ceb22790d 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -2,7 +2,7 @@ ## v0.6.3 - _TBD, 2018_ - * Consolidate `Order`, `SignedOrder`, and `ECSignature into` the `@0xproject/types` package (#456) + * Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456) ## v0.6.2 - _February 16, 2018_ -- cgit v1.2.3