aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-15 05:00:16 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-15 05:00:16 +0800
commitc1cc92a46f9ebfa4408a5dc515f1e100fe3a7054 (patch)
tree816b1412ee9deada82c487033b67052b58c9d1d7 /packages/connect/src
parent7eff195d61072007e64ef934e1411f8100656be8 (diff)
downloaddexon-0x-contracts-c1cc92a46f9ebfa4408a5dc515f1e100fe3a7054.tar.gz
dexon-0x-contracts-c1cc92a46f9ebfa4408a5dc515f1e100fe3a7054.tar.zst
dexon-0x-contracts-c1cc92a46f9ebfa4408a5dc515f1e100fe3a7054.zip
Change names of basic types in Client interface
Diffstat (limited to 'packages/connect/src')
-rw-r--r--packages/connect/src/http_client.ts8
-rw-r--r--packages/connect/src/index.ts2
-rw-r--r--packages/connect/src/schemas/schemas.ts4
-rw-r--r--packages/connect/src/schemas/token_pairs_request_opts_schema.ts4
-rw-r--r--packages/connect/src/types.ts13
5 files changed, 19 insertions, 12 deletions
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index 03cc590e4..1b51ee429 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -7,6 +7,7 @@ import * as queryString from 'query-string';
import { schemas as clientSchemas } from './schemas/schemas';
import {
+ AssetPairsRequestOpts,
Client,
FeesRequest,
FeesResponse,
@@ -17,7 +18,6 @@ import {
OrdersRequestOpts,
PagedRequestOpts,
TokenPairsItem,
- TokenPairsRequestOpts,
} from './types';
import { relayerResponseJsonParsers } from './utils/relayer_response_json_parsers';
@@ -69,9 +69,9 @@ export class HttpClient implements Client {
* @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 1, perPage: 100 }
* @return The resulting TokenPairsItems that match the request
*/
- public async getTokenPairsAsync(requestOpts?: TokenPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> {
+ public async getAssetPairsAsync(requestOpts?: AssetPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> {
if (!_.isUndefined(requestOpts)) {
- assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.tokenPairsRequestOptsSchema);
+ assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.AssetPairsRequestOptsSchema);
assert.doesConformToSchema('requestOpts', requestOpts, clientSchemas.pagedRequestOptsSchema);
}
const httpRequestOpts = {
@@ -135,7 +135,7 @@ export class HttpClient implements Client {
* @param request A FeesRequest instance describing the specific fees to retrieve
* @return The resulting FeesResponse that matches the request
*/
- public async getFeesAsync(request: FeesRequest): Promise<FeesResponse> {
+ public async getOrderConfigAsync(request: FeesRequest): Promise<FeesResponse> {
assert.doesConformToSchema('request', request, clientSchemas.feesRequestSchema);
const httpRequestOpts = {
payload: request,
diff --git a/packages/connect/src/index.ts b/packages/connect/src/index.ts
index 7f5eb8ed3..a4fc39425 100644
--- a/packages/connect/src/index.ts
+++ b/packages/connect/src/index.ts
@@ -12,7 +12,7 @@ export {
OrdersRequestOpts,
PagedRequestOpts,
TokenPairsItem,
- TokenPairsRequestOpts,
+ AssetPairsRequestOpts,
TokenTradeInfo,
} from './types';
diff --git a/packages/connect/src/schemas/schemas.ts b/packages/connect/src/schemas/schemas.ts
index 0b8b798a9..e6ca010ae 100644
--- a/packages/connect/src/schemas/schemas.ts
+++ b/packages/connect/src/schemas/schemas.ts
@@ -2,12 +2,12 @@ import { feesRequestSchema } from './fees_request_schema';
import { orderBookRequestSchema } from './orderbook_request_schema';
import { ordersRequestOptsSchema } from './orders_request_opts_schema';
import { pagedRequestOptsSchema } from './paged_request_opts_schema';
-import { tokenPairsRequestOptsSchema } from './token_pairs_request_opts_schema';
+import { AssetPairsRequestOptsSchema } from './token_pairs_request_opts_schema';
export const schemas = {
feesRequestSchema,
orderBookRequestSchema,
ordersRequestOptsSchema,
pagedRequestOptsSchema,
- tokenPairsRequestOptsSchema,
+ AssetPairsRequestOptsSchema,
};
diff --git a/packages/connect/src/schemas/token_pairs_request_opts_schema.ts b/packages/connect/src/schemas/token_pairs_request_opts_schema.ts
index 9b73a917b..dffd063d0 100644
--- a/packages/connect/src/schemas/token_pairs_request_opts_schema.ts
+++ b/packages/connect/src/schemas/token_pairs_request_opts_schema.ts
@@ -1,5 +1,5 @@
-export const tokenPairsRequestOptsSchema = {
- id: '/TokenPairsRequestOpts',
+export const AssetPairsRequestOptsSchema = {
+ id: '/AssetPairsRequestOpts',
type: 'object',
properties: {
tokenA: { $ref: '/Address' },
diff --git a/packages/connect/src/types.ts b/packages/connect/src/types.ts
index fc7a4b24d..ca56d251b 100644
--- a/packages/connect/src/types.ts
+++ b/packages/connect/src/types.ts
@@ -2,11 +2,11 @@ import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export interface Client {
- getTokenPairsAsync: (requestOpts?: TokenPairsRequestOpts & PagedRequestOpts) => Promise<TokenPairsItem[]>;
+ getAssetPairsAsync: (requestOpts?: AssetPairsRequestOpts & PagedRequestOpts) => Promise<TokenPairsItem[]>;
getOrdersAsync: (requestOpts?: OrdersRequestOpts & PagedRequestOpts) => Promise<SignedOrder[]>;
getOrderAsync: (orderHash: string) => Promise<SignedOrder>;
getOrderbookAsync: (request: OrderbookRequest, requestOpts?: PagedRequestOpts) => Promise<OrderbookResponse>;
- getFeesAsync: (request: FeesRequest) => Promise<FeesResponse>;
+ getOrderConfigAsync: (request: FeesRequest) => Promise<FeesResponse>;
submitOrderAsync: (signedOrder: SignedOrder) => Promise<void>;
}
@@ -83,7 +83,7 @@ export enum WebsocketClientEventType {
ConnectFailed = 'connectFailed',
}
-export interface TokenPairsRequestOpts {
+export interface AssetPairsRequestOpts {
tokenA?: string;
tokenB?: string;
}
@@ -121,6 +121,13 @@ export interface OrderbookResponse {
asks: SignedOrder[];
}
+export interface PaginatedCollectionResponse<T> {
+ total: number;
+ page: number;
+ perPage: number;
+ records: T[];
+}
+
export interface FeesRequest {
exchangeContractAddress: string;
maker: string;