Run linters
This commit is contained in:
parent
3b1dca0e70
commit
1a7e425780
@ -76,7 +76,6 @@ export class AssetBuyer {
|
|||||||
): AssetBuyer {
|
): AssetBuyer {
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isWebUri('sraApiUrl', sraApiUrl);
|
assert.isWebUri('sraApiUrl', sraApiUrl);
|
||||||
const chainId = options.chainId || constants.DEFAULT_ASSET_BUYER_OPTS.chainId;
|
|
||||||
// HACK: asset-buy will be deleted, but do not pass in chainId to allow everything to compile.
|
// HACK: asset-buy will be deleted, but do not pass in chainId to allow everything to compile.
|
||||||
const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl);
|
const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl);
|
||||||
const assetBuyer = new AssetBuyer(provider, orderProvider, options);
|
const assetBuyer = new AssetBuyer(provider, orderProvider, options);
|
||||||
|
@ -109,14 +109,14 @@ export interface ForwarderSmartContractParamsBase {
|
|||||||
|
|
||||||
export interface ForwarderMarketBuySmartContractParams
|
export interface ForwarderMarketBuySmartContractParams
|
||||||
extends ExchangeMarketBuySmartContractParams,
|
extends ExchangeMarketBuySmartContractParams,
|
||||||
ForwarderSmartContractParamsBase { }
|
ForwarderSmartContractParamsBase {}
|
||||||
|
|
||||||
// Temporary fix until typescript is upgraded to ^3.5
|
// Temporary fix until typescript is upgraded to ^3.5
|
||||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
|
||||||
export interface ForwarderMarketSellSmartContractParams
|
export interface ForwarderMarketSellSmartContractParams
|
||||||
extends Omit<ExchangeMarketSellSmartContractParams, 'takerAssetFillAmount'>,
|
extends Omit<ExchangeMarketSellSmartContractParams, 'takerAssetFillAmount'>,
|
||||||
ForwarderSmartContractParamsBase { }
|
ForwarderSmartContractParamsBase {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents all the parameters to interface with 0x forwarder extension contract marketSell and marketBuy functions.
|
* Represents all the parameters to interface with 0x forwarder extension contract marketSell and marketBuy functions.
|
||||||
@ -155,7 +155,7 @@ export interface SwapQuoteConsumerOpts {
|
|||||||
/**
|
/**
|
||||||
* Represents the options provided to a generic SwapQuoteConsumer
|
* Represents the options provided to a generic SwapQuoteConsumer
|
||||||
*/
|
*/
|
||||||
export interface SwapQuoteGetOutputOptsBase { }
|
export interface SwapQuoteGetOutputOptsBase {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
|
* takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
|
||||||
@ -194,12 +194,12 @@ export interface SwapQuoteGetOutputOpts extends ForwarderSwapQuoteGetOutputOpts
|
|||||||
useExtensionContract: ExtensionContractType;
|
useExtensionContract: ExtensionContractType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ForwarderSwapQuoteExecutionOpts extends ForwarderSwapQuoteGetOutputOpts, SwapQuoteExecutionOptsBase { }
|
export interface ForwarderSwapQuoteExecutionOpts extends ForwarderSwapQuoteGetOutputOpts, SwapQuoteExecutionOptsBase {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the options for executing a swap quote with SwapQuoteConsumer
|
* Represents the options for executing a swap quote with SwapQuoteConsumer
|
||||||
*/
|
*/
|
||||||
export interface SwapQuoteExecutionOpts extends SwapQuoteGetOutputOpts, ForwarderSwapQuoteExecutionOpts { }
|
export interface SwapQuoteExecutionOpts extends SwapQuoteGetOutputOpts, ForwarderSwapQuoteExecutionOpts {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* takerAssetData: String that represents a specific taker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
* takerAssetData: String that represents a specific taker asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
||||||
@ -240,9 +240,9 @@ export interface SwapQuoteWithAffiliateFeeBase {
|
|||||||
feePercentage: number;
|
feePercentage: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarketSellSwapQuoteWithAffiliateFee extends SwapQuoteWithAffiliateFeeBase, MarketSellSwapQuote { }
|
export interface MarketSellSwapQuoteWithAffiliateFee extends SwapQuoteWithAffiliateFeeBase, MarketSellSwapQuote {}
|
||||||
|
|
||||||
export interface MarketBuySwapQuoteWithAffiliateFee extends SwapQuoteWithAffiliateFeeBase, MarketBuySwapQuote { }
|
export interface MarketBuySwapQuoteWithAffiliateFee extends SwapQuoteWithAffiliateFeeBase, MarketBuySwapQuote {}
|
||||||
|
|
||||||
export type SwapQuoteWithAffiliateFee = MarketBuySwapQuoteWithAffiliateFee | MarketSellSwapQuoteWithAffiliateFee;
|
export type SwapQuoteWithAffiliateFee = MarketBuySwapQuoteWithAffiliateFee | MarketSellSwapQuoteWithAffiliateFee;
|
||||||
|
|
||||||
|
@ -74,9 +74,7 @@ export class HttpClient {
|
|||||||
* @param requestOpts Options specifying orders to retrieve and page information, page information.
|
* @param requestOpts Options specifying orders to retrieve and page information, page information.
|
||||||
* @return The resulting OrdersResponse that match the request
|
* @return The resulting OrdersResponse that match the request
|
||||||
*/
|
*/
|
||||||
public async getOrdersAsync(
|
public async getOrdersAsync(requestOpts?: OrdersRequestOpts & PagedRequestOpts): Promise<OrdersResponse> {
|
||||||
requestOpts?: OrdersRequestOpts & PagedRequestOpts,
|
|
||||||
): Promise<OrdersResponse> {
|
|
||||||
if (requestOpts !== undefined) {
|
if (requestOpts !== undefined) {
|
||||||
assert.doesConformToSchema('requestOpts', requestOpts, schemas.ordersRequestOptsSchema);
|
assert.doesConformToSchema('requestOpts', requestOpts, schemas.ordersRequestOptsSchema);
|
||||||
assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
|
assert.doesConformToSchema('requestOpts', requestOpts, schemas.pagedRequestOptsSchema);
|
||||||
@ -125,9 +123,7 @@ export class HttpClient {
|
|||||||
* @param request A OrderConfigRequest instance describing the specific fees to retrieve
|
* @param request A OrderConfigRequest instance describing the specific fees to retrieve
|
||||||
* @return The resulting OrderConfigResponse that matches the request
|
* @return The resulting OrderConfigResponse that matches the request
|
||||||
*/
|
*/
|
||||||
public async getOrderConfigAsync(
|
public async getOrderConfigAsync(request: OrderConfigRequest): Promise<OrderConfigResponse> {
|
||||||
request: OrderConfigRequest,
|
|
||||||
): Promise<OrderConfigResponse> {
|
|
||||||
assert.doesConformToSchema('request', request, schemas.orderConfigRequestSchema);
|
assert.doesConformToSchema('request', request, schemas.orderConfigRequestSchema);
|
||||||
const httpRequestOpts = {
|
const httpRequestOpts = {
|
||||||
payload: request,
|
payload: request,
|
||||||
|
@ -110,15 +110,15 @@ describe('HttpClient', () => {
|
|||||||
it('gets orderbook with default page options when none are provided', async () => {
|
it('gets orderbook with default page options when none are provided', async () => {
|
||||||
const urlWithQuery = `${url}?baseAssetData=${request.baseAssetData}"eAssetData=${
|
const urlWithQuery = `${url}?baseAssetData=${request.baseAssetData}"eAssetData=${
|
||||||
request.quoteAssetData
|
request.quoteAssetData
|
||||||
}`;
|
}`;
|
||||||
fetchMock.get(urlWithQuery, orderbookJSON);
|
fetchMock.get(urlWithQuery, orderbookJSON);
|
||||||
const orderbook = await relayerClient.getOrderbookAsync(request);
|
const orderbook = await relayerClient.getOrderbookAsync(request);
|
||||||
expect(orderbook).to.be.deep.equal(orderbookResponse);
|
expect(orderbook).to.be.deep.equal(orderbookResponse);
|
||||||
});
|
});
|
||||||
it('gets orderbook with specified page options', async () => {
|
it('gets orderbook with specified page options', async () => {
|
||||||
const urlWithQuery = `${url}?baseAssetData=${
|
const urlWithQuery = `${url}?baseAssetData=${request.baseAssetData}&page=3&perPage=50"eAssetData=${
|
||||||
request.baseAssetData
|
request.quoteAssetData
|
||||||
}&page=3&perPage=50"eAssetData=${request.quoteAssetData}`;
|
}`;
|
||||||
fetchMock.get(urlWithQuery, orderbookJSON);
|
fetchMock.get(urlWithQuery, orderbookJSON);
|
||||||
const pagedRequestOptions = {
|
const pagedRequestOptions = {
|
||||||
page: 3,
|
page: 3,
|
||||||
|
@ -5,10 +5,7 @@
|
|||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["./src/**/*", "./test/**/*"],
|
||||||
"./src/**/*",
|
|
||||||
"./test/**/*"
|
|
||||||
],
|
|
||||||
"files": [
|
"files": [
|
||||||
"./schemas/address_schema.json",
|
"./schemas/address_schema.json",
|
||||||
"./schemas/number_schema.json",
|
"./schemas/number_schema.json",
|
||||||
|
@ -125,7 +125,7 @@ export class SRAWebsocketOrderProvider extends BaseSRAOrderProvider {
|
|||||||
const ordersChannelHandler: OrdersChannelHandler = {
|
const ordersChannelHandler: OrdersChannelHandler = {
|
||||||
onUpdate: async (_channel, _opts, apiOrders) => this._handleOrderUpdates(apiOrders),
|
onUpdate: async (_channel, _opts, apiOrders) => this._handleOrderUpdates(apiOrders),
|
||||||
// tslint:disable-next-line:no-empty
|
// tslint:disable-next-line:no-empty
|
||||||
onError: (_channel, _err) => { },
|
onError: (_channel, _err) => {},
|
||||||
onClose: async () => {
|
onClose: async () => {
|
||||||
// Do not reconnect if destroyed
|
// Do not reconnect if destroyed
|
||||||
if (this._isDestroyed) {
|
if (this._isDestroyed) {
|
||||||
|
@ -34,7 +34,6 @@ All endpoints that are paginated should return a `total`, `page`, `perPage` and
|
|||||||
|
|
||||||
These requests include the [`/v3/asset_pairs`](#operation/getAssetPairs), [`/v3/orders`](#operation/getOrders), [`/v3/fee_recipients`](#operation/getFeeRecipients) and [`/v3/orderbook`](#operation/getOrderbook) endpoints.
|
These requests include the [`/v3/asset_pairs`](#operation/getAssetPairs), [`/v3/orders`](#operation/getOrders), [`/v3/fee_recipients`](#operation/getFeeRecipients) and [`/v3/orderbook`](#operation/getOrderbook) endpoints.
|
||||||
|
|
||||||
|
|
||||||
# Link Header
|
# Link Header
|
||||||
|
|
||||||
A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging
|
A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging
|
||||||
|
@ -22,7 +22,6 @@ export const paginationParameters: ParameterObject[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
|
export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => {
|
||||||
const optionalParameters = isPaginated ? paginationParameters : [];
|
const optionalParameters = isPaginated ? paginationParameters : [];
|
||||||
return [...parameters, ...optionalParameters];
|
return [...parameters, ...optionalParameters];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user