aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2017-11-30 04:14:37 +0800
committerBrandon Millman <brandon.millman@gmail.com>2017-11-30 04:19:16 +0800
commit04fc16587b74f4c0b3d5eeaae42db6409f515754 (patch)
treecd056302423f5ae9291d1cd01fc99f3d9f558494 /packages/connect
parentf1d5a7d31f96636e4a3508f6f385ba7eaf49f28d (diff)
downloaddexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.gz
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.bz2
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.lz
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.xz
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.zst
dexon-0x-contracts-04fc16587b74f4c0b3d5eeaae42db6409f515754.zip
Redeclare Order, SignedOrder, and ECSignature types in connect, remove 0x.js dependency
Diffstat (limited to 'packages/connect')
-rw-r--r--packages/connect/CHANGELOG.md2
-rw-r--r--packages/connect/package.json1
-rw-r--r--packages/connect/src/http_client.ts2
-rw-r--r--packages/connect/src/index.ts2
-rw-r--r--packages/connect/src/types.ts30
-rw-r--r--packages/connect/src/utils/orderbook_channel_message_parsers.ts2
-rw-r--r--packages/connect/src/ws_orderbook_channel.ts2
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';