diff options
Diffstat (limited to 'packages/connect/src')
-rw-r--r-- | packages/connect/src/http_client.ts | 8 | ||||
-rw-r--r-- | packages/connect/src/index.ts | 2 | ||||
-rw-r--r-- | packages/connect/src/schemas/schemas.ts | 4 | ||||
-rw-r--r-- | packages/connect/src/schemas/token_pairs_request_opts_schema.ts | 4 | ||||
-rw-r--r-- | packages/connect/src/types.ts | 13 |
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; |