From 04fc16587b74f4c0b3d5eeaae42db6409f515754 Mon Sep 17 00:00:00 2001
From: Brandon Millman <brandon.millman@gmail.com>
Date: Wed, 29 Nov 2017 12:14:37 -0800
Subject: Redeclare Order, SignedOrder, and ECSignature types in connect,
 remove 0x.js dependency

---
 packages/connect/CHANGELOG.md                      |  2 ++
 packages/connect/package.json                      |  1 -
 packages/connect/src/http_client.ts                |  2 +-
 packages/connect/src/index.ts                      |  2 ++
 packages/connect/src/types.ts                      | 30 ++++++++++++++++++++--
 .../src/utils/orderbook_channel_message_parsers.ts |  2 +-
 packages/connect/src/ws_orderbook_channel.ts       |  2 +-
 7 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md
index c3435a0b8..226463124 100644
--- a/packages/connect/CHANGELOG.md
+++ b/packages/connect/CHANGELOG.md
@@ -3,6 +3,8 @@
 vx.x.x
 ------------------------
     * Add SignedOrder and TokenTradeInfo to the public interface
+    * Add ECSignature and Order to the public interface
+    * Remove dependency on 0x.js
 
 v0.1.0 - _November 22, 2017_
 ------------------------
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 4048ab186..d8c598218 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -36,7 +36,6 @@
   },
   "homepage": "https://github.com/0xProject/0x.js/packages/connect/README.md",
   "dependencies": {
-    "0x.js": "^0.27.1",
     "@0xproject/assert": "^0.0.6",
     "@0xproject/json-schemas": "^0.6.9",
     "bignumber.js": "~4.1.0",
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index e30e03815..252c9e9dd 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -1,4 +1,3 @@
-import {SignedOrder} from '0x.js';
 import {assert} from '@0xproject/assert';
 import {schemas} from '@0xproject/json-schemas';
 import {BigNumber} from 'bignumber.js';
@@ -16,6 +15,7 @@ import {
     OrderbookRequest,
     OrderbookResponse,
     OrdersRequest,
+    SignedOrder,
     TokenPairsItem,
     TokenPairsRequest,
 } from './types';
diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts
index 8a63c41a5..aabf233fe 100644
--- a/packages/connect/src/index.ts
+++ b/packages/connect/src/index.ts
@@ -1,8 +1,10 @@
 export {HttpClient} from './http_client';
 export {
     Client,
+    ECSignature,
     FeesRequest,
     FeesResponse,
+    Order,
     OrderbookRequest,
     OrderbookResponse,
     OrdersRequest,
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index bdbbab7c0..71dd8dac2 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -1,7 +1,33 @@
-import {SignedOrder} from '0x.js';
 import {BigNumber} from 'bignumber.js';
 
-export type SignedOrder = SignedOrder;
+// 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: (request?: TokenPairsRequest) => Promise<TokenPairsItem[]>;
diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts
index f3497db34..9cd160428 100644
--- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts
+++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts
@@ -1,4 +1,3 @@
-import {SignedOrder} from '0x.js';
 import {assert} from '@0xproject/assert';
 import {schemas} from '@0xproject/json-schemas';
 import * as _ from 'lodash';
@@ -6,6 +5,7 @@ import * as _ from 'lodash';
 import {
     OrderbookChannelMessage,
     OrderbookChannelMessageTypes,
+    SignedOrder,
 } from '../types';
 
 import {typeConverters} from './type_converters';
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts
index f5badf624..d9cc1b4c5 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orderbook_channel.ts
@@ -1,4 +1,3 @@
-import {SignedOrder} from '0x.js';
 import {assert} from '@0xproject/assert';
 import {schemas} from '@0xproject/json-schemas';
 import * as _ from 'lodash';
@@ -9,6 +8,7 @@ import {
     OrderbookChannelHandler,
     OrderbookChannelMessageTypes,
     OrderbookChannelSubscriptionOpts,
+    SignedOrder,
     WebsocketClientEventType,
     WebsocketConnectionEventType,
 } from './types';
-- 
cgit v1.2.3