aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/connect/src')
-rw-r--r--packages/connect/src/http_client.ts4
-rw-r--r--packages/connect/src/index.ts4
-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, 37 insertions, 5 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 3a9e11a7d..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';
@@ -34,7 +34,7 @@ export class HttpClient implements Client {
private apiEndpointUrl: string;
/**
* Instantiates a new HttpClient instance
- * @param url The base url for making API calls
+ * @param url The relayer API base HTTP url you would like to interact with
* @return An instance of HttpClient
*/
constructor(url: string) {
diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts
index c9ebde510..aabf233fe 100644
--- a/packages/connect/src/index.ts
+++ b/packages/connect/src/index.ts
@@ -1,11 +1,15 @@
export {HttpClient} from './http_client';
export {
Client,
+ ECSignature,
FeesRequest,
FeesResponse,
+ Order,
OrderbookRequest,
OrderbookResponse,
OrdersRequest,
+ SignedOrder,
TokenPairsItem,
TokenPairsRequest,
+ TokenTradeInfo,
} from './types';
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index eb6df3ba9..71dd8dac2 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -1,6 +1,34 @@
-import {SignedOrder} from '0x.js';
import {BigNumber} from 'bignumber.js';
+// 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[]>;
getOrdersAsync: (request?: OrdersRequest) => Promise<SignedOrder[]>;
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';