aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
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/src
parentf1d5a7d31f96636e4a3508f6f385ba7eaf49f28d (diff)
downloaddexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.gz
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.bz2
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.lz
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.xz
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.tar.zst
dexon-sol-tools-04fc16587b74f4c0b3d5eeaae42db6409f515754.zip
Redeclare Order, SignedOrder, and ECSignature types in connect, remove 0x.js dependency
Diffstat (limited to 'packages/connect/src')
-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
5 files changed, 33 insertions, 5 deletions
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';