aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-15 06:02:58 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-15 07:33:10 +0800
commitffe7363776077e2363afc23a8e4c5e2ea420aefe (patch)
tree6eb19a3944d07c1ff5ce5903b8ed496b07546894 /packages/connect/src
parent4a27a7dc581fc6c8a3d4e212ca3712c249a5b417 (diff)
downloaddexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar.gz
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar.bz2
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar.lz
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar.xz
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.tar.zst
dexon-sol-tools-ffe7363776077e2363afc23a8e4c5e2ea420aefe.zip
Add SignedOrder, Order, and ECSignature types to the types package
Diffstat (limited to 'packages/connect/src')
-rw-r--r--packages/connect/src/http_client.ts2
-rw-r--r--packages/connect/src/index.ts5
-rw-r--r--packages/connect/src/types.ts30
-rw-r--r--packages/connect/src/utils/relayer_response_json_parsers.ts3
4 files changed, 6 insertions, 34 deletions
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<TokenPairsItem[]>;
getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<SignedOrder[]>;
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';