Pass QuoteRequestor via SwapQuoteOpts not ctor arg

Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2541#discussion_r405900525
This commit is contained in:
F. Eugene Aumson
2020-04-09 00:07:25 -04:00
parent aadcf8fed0
commit 63bfd23310
2 changed files with 4 additions and 7 deletions

View File

@@ -148,12 +148,7 @@ export class SwapQuoter {
*
* @return An instance of SwapQuoter
*/
constructor(
supportedProvider: SupportedProvider,
orderbook: Orderbook,
options: Partial<SwapQuoterOpts> = {},
quoteRequestor?: QuoteRequestor,
) {
constructor(supportedProvider: SupportedProvider, orderbook: Orderbook, options: Partial<SwapQuoterOpts> = {}) {
const {
chainId,
expiryBufferMs,
@@ -176,7 +171,7 @@ export class SwapQuoter {
this._devUtilsContract = new DevUtilsContract(this._contractAddresses.devUtils, provider);
this._protocolFeeUtils = new ProtocolFeeUtils(constants.PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS);
this._orderStateUtils = new OrderStateUtils(this._devUtilsContract);
this._quoteRequestor = quoteRequestor || new QuoteRequestor(this.rfqtMakerEndpoints);
this._quoteRequestor = options.quoteRequestor || new QuoteRequestor(this.rfqtMakerEndpoints);
const sampler = new DexOrderSampler(
new IERC20BridgeSamplerContract(this._contractAddresses.erc20BridgeSampler, this.provider, {
gas: samplerGasLimit,

View File

@@ -3,6 +3,7 @@ import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { GetMarketOrdersOpts } from './utils/market_operation_utils/types';
import { QuoteRequestor } from './utils/quote_requestor';
/**
* expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
@@ -219,6 +220,7 @@ export interface SwapQuoterOpts extends OrderPrunerOpts {
liquidityProviderRegistryAddress?: string;
rfqtTakerApiKeyWhitelist?: string[];
rfqtMakerEndpoints?: string[];
quoteRequestor?: QuoteRequestor;
}
/**