linting and remove unused function
This commit is contained in:
parent
615874d2ec
commit
120714ecfc
@ -610,15 +610,6 @@ export class SwapQuoter {
|
|||||||
|
|
||||||
return swapQuote;
|
return swapQuote;
|
||||||
}
|
}
|
||||||
private _shouldEnableIndicativeRfqt(opts: CalculateSwapQuoteOpts['rfqt'], op: MarketOperation): boolean {
|
|
||||||
return (
|
|
||||||
opts !== undefined &&
|
|
||||||
opts.isIndicative !== undefined &&
|
|
||||||
opts.isIndicative &&
|
|
||||||
this._rfqtTakerApiKeyWhitelist().includes(opts.apiKey) &&
|
|
||||||
!(op === MarketOperation.Buy && this._shouldSkipRfqtBuyRequests())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
private _rfqtTakerApiKeyWhitelist(): string[] {
|
private _rfqtTakerApiKeyWhitelist(): string[] {
|
||||||
return this._rfqtOptions ? this._rfqtOptions.takerApiKeyWhitelist : [];
|
return this._rfqtOptions ? this._rfqtOptions.takerApiKeyWhitelist : [];
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ export interface SwapQuoteRequestOpts extends CalculateSwapQuoteOpts {
|
|||||||
/**
|
/**
|
||||||
* Opts required to generate a SwapQuote with SwapQuoteCalculator
|
* Opts required to generate a SwapQuote with SwapQuoteCalculator
|
||||||
*/
|
*/
|
||||||
export interface CalculateSwapQuoteOpts extends GetMarketOrdersOpts { }
|
export interface CalculateSwapQuoteOpts extends GetMarketOrdersOpts {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping from RFQ-T quote provider URLs to the trading pairs they support.
|
* A mapping from RFQ-T quote provider URLs to the trading pairs they support.
|
||||||
|
@ -402,7 +402,14 @@ export class MarketOperationUtils {
|
|||||||
multiBridgeAddress: opts.multiBridgeAddress,
|
multiBridgeAddress: opts.multiBridgeAddress,
|
||||||
shouldBatchBridgeOrders: !!opts.shouldBatchBridgeOrders,
|
shouldBatchBridgeOrders: !!opts.shouldBatchBridgeOrders,
|
||||||
});
|
});
|
||||||
const quoteReport = new QuoteReportGenerator(opts.side, _.flatten(opts.dexQuotes), opts.nativeOrders, opts.orderFillableAmounts, _.flatten(optimizedOrders.map(o => o.fills)), opts.quoteRequestor).generateReport();
|
const quoteReport = new QuoteReportGenerator(
|
||||||
|
opts.side,
|
||||||
|
_.flatten(opts.dexQuotes),
|
||||||
|
opts.nativeOrders,
|
||||||
|
opts.orderFillableAmounts,
|
||||||
|
_.flatten(optimizedOrders.map(o => o.fills)),
|
||||||
|
opts.quoteRequestor,
|
||||||
|
).generateReport();
|
||||||
return { optimizedOrders, quoteReport };
|
return { optimizedOrders, quoteReport };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export enum ERC20BridgeSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Internal `fillData` field for `Fill` objects.
|
// Internal `fillData` field for `Fill` objects.
|
||||||
export interface FillData { }
|
export interface FillData {}
|
||||||
|
|
||||||
// `FillData` for native fills.
|
// `FillData` for native fills.
|
||||||
export interface NativeFillData extends FillData {
|
export interface NativeFillData extends FillData {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { orderHashUtils } from '@0x/order-utils';
|
import { orderHashUtils } from '@0x/order-utils';
|
||||||
import { BigNumber, NULL_ADDRESS } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { ERC20BridgeSource, SignedOrder } from '..';
|
import { ERC20BridgeSource, SignedOrder } from '..';
|
||||||
@ -44,7 +44,14 @@ export class QuoteReportGenerator {
|
|||||||
private readonly _collapsedFills: CollapsedFill[];
|
private readonly _collapsedFills: CollapsedFill[];
|
||||||
private readonly _quoteRequestor?: QuoteRequestor;
|
private readonly _quoteRequestor?: QuoteRequestor;
|
||||||
|
|
||||||
constructor(marketOperation: MarketOperation, dexQuotes: DexSample[], nativeOrders: SignedOrder[], orderFillableAmounts: BigNumber[], collapsedFills: CollapsedFill[], quoteRequestor?: QuoteRequestor) {
|
constructor(
|
||||||
|
marketOperation: MarketOperation,
|
||||||
|
dexQuotes: DexSample[],
|
||||||
|
nativeOrders: SignedOrder[],
|
||||||
|
orderFillableAmounts: BigNumber[],
|
||||||
|
collapsedFills: CollapsedFill[],
|
||||||
|
quoteRequestor?: QuoteRequestor,
|
||||||
|
) {
|
||||||
this._dexQuotes = dexQuotes;
|
this._dexQuotes = dexQuotes;
|
||||||
this._nativeOrders = nativeOrders;
|
this._nativeOrders = nativeOrders;
|
||||||
this._marketOperation = marketOperation;
|
this._marketOperation = marketOperation;
|
||||||
@ -68,10 +75,7 @@ export class QuoteReportGenerator {
|
|||||||
const dexReportSourcesConsidered = this._dexQuotes.map(ds => this._dexSampleToReportSource(ds));
|
const dexReportSourcesConsidered = this._dexQuotes.map(ds => this._dexSampleToReportSource(ds));
|
||||||
const nativeOrderSourcesConsidered = this._nativeOrders.map(no => this._nativeOrderToReportSource(no));
|
const nativeOrderSourcesConsidered = this._nativeOrders.map(no => this._nativeOrderToReportSource(no));
|
||||||
|
|
||||||
const sourcesConsidered = [
|
const sourcesConsidered = [...dexReportSourcesConsidered, ...nativeOrderSourcesConsidered];
|
||||||
...dexReportSourcesConsidered,
|
|
||||||
...nativeOrderSourcesConsidered,
|
|
||||||
];
|
|
||||||
const sourcesDelivered = this._collapsedFills.map(collapsedFill => {
|
const sourcesDelivered = this._collapsedFills.map(collapsedFill => {
|
||||||
const foundNativeOrder = (collapsedFill as NativeCollapsedFill).nativeOrder;
|
const foundNativeOrder = (collapsedFill as NativeCollapsedFill).nativeOrder;
|
||||||
if (foundNativeOrder) {
|
if (foundNativeOrder) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { schemas, SchemaValidator } from '@0x/json-schemas';
|
import { schemas, SchemaValidator } from '@0x/json-schemas';
|
||||||
import { assetDataUtils, orderCalculationUtils, SignedOrder, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderCalculationUtils, orderHashUtils, SignedOrder } from '@0x/order-utils';
|
||||||
import { RFQTFirmQuote, RFQTIndicativeQuote, TakerRequest } from '@0x/quote-server';
|
import { RFQTFirmQuote, RFQTIndicativeQuote, TakerRequest } from '@0x/quote-server';
|
||||||
import { ERC20AssetData } from '@0x/types';
|
import { ERC20AssetData } from '@0x/types';
|
||||||
import { BigNumber, logUtils } from '@0x/utils';
|
import { BigNumber, logUtils } from '@0x/utils';
|
||||||
import Axios, { AxiosResponse } from 'axios';
|
import Axios from 'axios';
|
||||||
|
|
||||||
import { constants } from '../constants';
|
import { constants } from '../constants';
|
||||||
import { MarketOperation, RfqtMakerAssetOfferings, RfqtRequestOpts } from '../types';
|
import { MarketOperation, RfqtMakerAssetOfferings, RfqtRequestOpts } from '../types';
|
||||||
@ -94,7 +94,7 @@ export class QuoteRequestor {
|
|||||||
private readonly _infoLogger: LogFunction = (obj, msg) =>
|
private readonly _infoLogger: LogFunction = (obj, msg) =>
|
||||||
logUtils.log(`${msg ? `${msg}: ` : ''}${JSON.stringify(obj)}`),
|
logUtils.log(`${msg ? `${msg}: ` : ''}${JSON.stringify(obj)}`),
|
||||||
private readonly _expiryBufferMs: number = constants.DEFAULT_SWAP_QUOTER_OPTS.expiryBufferMs,
|
private readonly _expiryBufferMs: number = constants.DEFAULT_SWAP_QUOTER_OPTS.expiryBufferMs,
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
public async requestRfqtFirmQuotesAsync(
|
public async requestRfqtFirmQuotesAsync(
|
||||||
makerAssetData: string,
|
makerAssetData: string,
|
||||||
@ -156,7 +156,12 @@ export class QuoteRequestor {
|
|||||||
salt: new BigNumber(orderWithStringInts.salt),
|
salt: new BigNumber(orderWithStringInts.salt),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (orderCalculationUtils.willOrderExpire(orderWithBigNumberInts, this._expiryBufferMs / constants.ONE_SECOND_MS)) {
|
if (
|
||||||
|
orderCalculationUtils.willOrderExpire(
|
||||||
|
orderWithBigNumberInts,
|
||||||
|
this._expiryBufferMs / constants.ONE_SECOND_MS,
|
||||||
|
)
|
||||||
|
) {
|
||||||
this._warningLogger(orderWithBigNumberInts, 'Expiry too soon in RFQ-T order, filtering out');
|
this._warningLogger(orderWithBigNumberInts, 'Expiry too soon in RFQ-T order, filtering out');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import {
|
|||||||
MarketOperation,
|
MarketOperation,
|
||||||
MarketSellSwapQuote,
|
MarketSellSwapQuote,
|
||||||
SwapQuote,
|
SwapQuote,
|
||||||
SwapQuoteBase,
|
|
||||||
SwapQuoteInfo,
|
SwapQuoteInfo,
|
||||||
SwapQuoteOrdersBreakdown,
|
SwapQuoteOrdersBreakdown,
|
||||||
SwapQuoterError,
|
SwapQuoterError,
|
||||||
@ -17,7 +16,11 @@ import {
|
|||||||
|
|
||||||
import { MarketOperationUtils } from './market_operation_utils';
|
import { MarketOperationUtils } from './market_operation_utils';
|
||||||
import { convertNativeOrderToFullyFillableOptimizedOrders } from './market_operation_utils/orders';
|
import { convertNativeOrderToFullyFillableOptimizedOrders } from './market_operation_utils/orders';
|
||||||
import { GetMarketOrdersOpts, OptimizedMarketOrder, OptimizedOrdersAndQuoteReport } from './market_operation_utils/types';
|
import {
|
||||||
|
GetMarketOrdersOpts,
|
||||||
|
OptimizedMarketOrder,
|
||||||
|
OptimizedOrdersAndQuoteReport,
|
||||||
|
} from './market_operation_utils/types';
|
||||||
import { isSupportedAssetDataInOrders } from './utils';
|
import { isSupportedAssetDataInOrders } from './utils';
|
||||||
|
|
||||||
import { QuoteReport } from './quote_report_generator';
|
import { QuoteReport } from './quote_report_generator';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user