Rename {Rfqt=>Rfq} for types in Asset Swapper (#179)
* Rename {Rfqt=>Rfq} for types in Asset Swapper * PR edit 1 - fix build errors * PR edit 2 - rename mocked types used in tests * PR edit 3 - fix broken test build * PR edit 4 - rename SwapQuoterRfqOpts and add changelog entry
This commit is contained in:
parent
bbaa90bd9a
commit
06b3464756
@ -9,6 +9,10 @@
|
||||
{
|
||||
"note": "Add a cancel token to ensure timeouts are respected",
|
||||
"pr": 176
|
||||
},
|
||||
{
|
||||
"note": "Rename {Rfqt=>Rfq} for many types in Asset Swapper",
|
||||
"pr": 179
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
LogFunction,
|
||||
OrderPrunerOpts,
|
||||
OrderPrunerPermittedFeeTypes,
|
||||
RfqtRequestOpts,
|
||||
RfqRequestOpts,
|
||||
SwapQuoteGetOutputOpts,
|
||||
SwapQuoteRequestOpts,
|
||||
SwapQuoterOpts,
|
||||
@ -79,7 +79,7 @@ const DEFAULT_SWAP_QUOTE_REQUEST_OPTS: SwapQuoteRequestOpts = {
|
||||
...DEFAULT_GET_MARKET_ORDERS_OPTS,
|
||||
};
|
||||
|
||||
const DEFAULT_RFQT_REQUEST_OPTS: Partial<RfqtRequestOpts> = {
|
||||
const DEFAULT_RFQT_REQUEST_OPTS: Partial<RfqRequestOpts> = {
|
||||
makerEndpointMaxResponseTimeMs: 1000,
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ export { SwapQuoteConsumer } from './quote_consumers/swap_quote_consumer';
|
||||
export { SwapQuoter, Orderbook } from './swap_quoter';
|
||||
export {
|
||||
AltOffering,
|
||||
AltRfqtMakerAssetOfferings,
|
||||
AltRfqMakerAssetOfferings,
|
||||
AffiliateFeeType,
|
||||
AffiliateFeeAmount,
|
||||
AssetSwapperContractAddresses,
|
||||
@ -87,11 +87,11 @@ export {
|
||||
MarketBuySwapQuote,
|
||||
MarketOperation,
|
||||
MarketSellSwapQuote,
|
||||
MockedRfqtQuoteResponse,
|
||||
MockedRfqQuoteResponse,
|
||||
OrderPrunerPermittedFeeTypes,
|
||||
RfqtMakerAssetOfferings,
|
||||
RfqtFirmQuoteValidator,
|
||||
RfqtRequestOpts,
|
||||
RfqMakerAssetOfferings,
|
||||
RfqFirmQuoteValidator,
|
||||
RfqRequestOpts,
|
||||
SamplerOverrides,
|
||||
SignedNativeOrder,
|
||||
SignedOrder,
|
||||
@ -106,7 +106,7 @@ export {
|
||||
SwapQuoteRequestOpts,
|
||||
SwapQuoterError,
|
||||
SwapQuoterOpts,
|
||||
SwapQuoterRfqtOpts,
|
||||
SwapQuoterRfqOpts,
|
||||
} from './types';
|
||||
export { affiliateFeeUtils } from './utils/affiliate_fee_utils';
|
||||
export {
|
||||
@ -133,7 +133,7 @@ export {
|
||||
FeeSchedule,
|
||||
Fill,
|
||||
FillData,
|
||||
GetMarketOrdersRfqtOpts,
|
||||
GetMarketOrdersRfqOpts,
|
||||
KyberFillData,
|
||||
LiquidityProviderFillData,
|
||||
LiquidityProviderRegistry,
|
||||
|
@ -14,14 +14,14 @@ import {
|
||||
MarketBuySwapQuote,
|
||||
MarketOperation,
|
||||
OrderPrunerPermittedFeeTypes,
|
||||
RfqtRequestOpts,
|
||||
RfqRequestOpts,
|
||||
SignedNativeOrder,
|
||||
SwapQuote,
|
||||
SwapQuoteInfo,
|
||||
SwapQuoteOrdersBreakdown,
|
||||
SwapQuoteRequestOpts,
|
||||
SwapQuoterOpts,
|
||||
SwapQuoterRfqtOpts,
|
||||
SwapQuoterRfqOpts,
|
||||
} from './types';
|
||||
import { assert } from './utils/assert';
|
||||
import { MarketOperationUtils } from './utils/market_operation_utils';
|
||||
@ -72,7 +72,7 @@ export class SwapQuoter {
|
||||
private readonly _contractAddresses: AssetSwapperContractAddresses;
|
||||
private readonly _protocolFeeUtils: ProtocolFeeUtils;
|
||||
private readonly _marketOperationUtils: MarketOperationUtils;
|
||||
private readonly _rfqtOptions?: SwapQuoterRfqtOpts;
|
||||
private readonly _rfqtOptions?: SwapQuoterRfqOpts;
|
||||
private readonly _quoteRequestorHttpClient: AxiosInstance;
|
||||
|
||||
/**
|
||||
@ -334,7 +334,7 @@ export class SwapQuoter {
|
||||
// Get SRA orders (limit orders)
|
||||
const shouldSkipOpenOrderbook =
|
||||
!sourceFilters.isAllowed(ERC20BridgeSource.Native) ||
|
||||
(opts.rfqt && opts.rfqt.nativeExclusivelyRFQT === true);
|
||||
(opts.rfqt && opts.rfqt.nativeExclusivelyRFQ === true);
|
||||
const nativeOrders = shouldSkipOpenOrderbook
|
||||
? await Promise.resolve([])
|
||||
: await this.orderbook.getOrdersAsync(makerToken, takerToken, this._limitOrderPruningFn);
|
||||
@ -420,17 +420,17 @@ export class SwapQuoter {
|
||||
|
||||
private _validateRfqtOpts(
|
||||
sourceFilters: SourceFilters,
|
||||
rfqt: RfqtRequestOpts | undefined,
|
||||
): RfqtRequestOpts | undefined {
|
||||
rfqt: RfqRequestOpts | undefined,
|
||||
): RfqRequestOpts | undefined {
|
||||
if (!rfqt) {
|
||||
return rfqt;
|
||||
}
|
||||
// tslint:disable-next-line: boolean-naming
|
||||
const { apiKey, nativeExclusivelyRFQT, intentOnFilling, txOrigin } = rfqt;
|
||||
// If RFQT is enabled and `nativeExclusivelyRFQT` is set, then `ERC20BridgeSource.Native` should
|
||||
const { apiKey, nativeExclusivelyRFQ, intentOnFilling, txOrigin } = rfqt;
|
||||
// If RFQ-T is enabled and `nativeExclusivelyRFQ` is set, then `ERC20BridgeSource.Native` should
|
||||
// never be excluded.
|
||||
if (nativeExclusivelyRFQT === true && !sourceFilters.isAllowed(ERC20BridgeSource.Native)) {
|
||||
throw new Error('Native liquidity cannot be excluded if "rfqt.nativeExclusivelyRFQT" is set');
|
||||
if (nativeExclusivelyRFQ === true && !sourceFilters.isAllowed(ERC20BridgeSource.Native)) {
|
||||
throw new Error('Native liquidity cannot be excluded if "rfqt.nativeExclusivelyRFQ" is set');
|
||||
}
|
||||
|
||||
// If an API key was provided, but the key is not whitelisted, raise a warning and disable RFQ
|
||||
|
@ -227,19 +227,19 @@ export type SwapQuoteOrdersBreakdown = Partial<
|
||||
>;
|
||||
|
||||
/**
|
||||
* nativeExclusivelyRFQT: if set to `true`, Swap quote will exclude Open Orderbook liquidity.
|
||||
* nativeExclusivelyRFQ: if set to `true`, Swap quote will exclude Open Orderbook liquidity.
|
||||
* If set to `true` and `ERC20BridgeSource.Native` is part of the `excludedSources`
|
||||
* array in `SwapQuoteRequestOpts`, an Error will be raised.
|
||||
*/
|
||||
export interface RfqtRequestOpts {
|
||||
export interface RfqRequestOpts {
|
||||
takerAddress: string;
|
||||
txOrigin: string;
|
||||
apiKey: string;
|
||||
intentOnFilling: boolean;
|
||||
isIndicative?: boolean;
|
||||
makerEndpointMaxResponseTimeMs?: number;
|
||||
nativeExclusivelyRFQT?: boolean;
|
||||
altRfqtAssetOfferings?: AltRfqtMakerAssetOfferings;
|
||||
nativeExclusivelyRFQ?: boolean;
|
||||
altRfqAssetOfferings?: AltRfqMakerAssetOfferings;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,14 +247,14 @@ export interface RfqtRequestOpts {
|
||||
*/
|
||||
export interface SwapQuoteRequestOpts extends GetMarketOrdersOpts {
|
||||
gasPrice?: BigNumber;
|
||||
rfqt?: RfqtRequestOpts;
|
||||
rfqt?: RfqRequestOpts;
|
||||
}
|
||||
|
||||
/**
|
||||
* A mapping from RFQ-T quote provider URLs to the trading pairs they support.
|
||||
* A mapping from RFQ-T/M quote provider URLs to the trading pairs they support.
|
||||
* The value type represents an array of supported asset pairs, with each array element encoded as a 2-element array of token addresses.
|
||||
*/
|
||||
export interface RfqtMakerAssetOfferings {
|
||||
export interface RfqMakerAssetOfferings {
|
||||
[endpoint: string]: Array<[string, string]>;
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ export interface AltOffering {
|
||||
baseAssetDecimals: number;
|
||||
quoteAssetDecimals: number;
|
||||
}
|
||||
export interface AltRfqtMakerAssetOfferings {
|
||||
export interface AltRfqMakerAssetOfferings {
|
||||
[endpoint: string]: AltOffering[];
|
||||
}
|
||||
export enum RfqPairType {
|
||||
@ -279,13 +279,13 @@ export interface TypedMakerUrl {
|
||||
|
||||
export type LogFunction = (obj: object, msg?: string, ...args: any[]) => void;
|
||||
|
||||
export interface RfqtFirmQuoteValidator {
|
||||
export interface RfqFirmQuoteValidator {
|
||||
getRfqtTakerFillableAmountsAsync(quotes: RfqOrder[]): Promise<BigNumber[]>;
|
||||
}
|
||||
|
||||
export interface SwapQuoterRfqtOpts {
|
||||
export interface SwapQuoterRfqOpts {
|
||||
takerApiKeyWhitelist: string[];
|
||||
makerAssetOfferings: RfqtMakerAssetOfferings;
|
||||
makerAssetOfferings: RfqMakerAssetOfferings;
|
||||
txOriginBlacklist: Set<string>;
|
||||
altRfqCreds?: {
|
||||
altRfqApiKey: string;
|
||||
@ -314,7 +314,7 @@ export interface SwapQuoterOpts extends OrderPrunerOpts {
|
||||
samplerGasLimit?: number;
|
||||
multiBridgeAddress?: string;
|
||||
ethGasStationUrl?: string;
|
||||
rfqt?: SwapQuoterRfqtOpts;
|
||||
rfqt?: SwapQuoterRfqOpts;
|
||||
samplerOverrides?: SamplerOverrides;
|
||||
tokenAdjacencyGraph?: TokenAdjacencyGraph;
|
||||
liquidityProviderRegistry?: LiquidityProviderRegistry;
|
||||
@ -360,9 +360,9 @@ export enum OrderPrunerPermittedFeeTypes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a mocked RFQT maker responses.
|
||||
* Represents a mocked RFQ-T/M maker responses.
|
||||
*/
|
||||
export interface MockedRfqtQuoteResponse {
|
||||
export interface MockedRfqQuoteResponse {
|
||||
endpoint: string;
|
||||
requestApiKey: string;
|
||||
requestParams: TakerRequestQueryParams;
|
||||
@ -372,9 +372,9 @@ export interface MockedRfqtQuoteResponse {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a mocked RFQT maker responses.
|
||||
* Represents a mocked RFQ-T/M alternative maker responses.
|
||||
*/
|
||||
export interface AltMockedRfqtQuoteResponse {
|
||||
export interface AltMockedRfqQuoteResponse {
|
||||
endpoint: string;
|
||||
mmApiKey: string;
|
||||
requestData: AltQuoteRequestData;
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
AltQuoteModel,
|
||||
AltQuoteRequestData,
|
||||
AltQuoteSide,
|
||||
AltRfqtMakerAssetOfferings,
|
||||
AltRfqMakerAssetOfferings,
|
||||
} from '../types';
|
||||
|
||||
function getAltMarketInfo(
|
||||
@ -119,13 +119,13 @@ export async function returnQuoteFromAltMMAsync<ResponseT>(
|
||||
makerToken: string,
|
||||
takerToken: string,
|
||||
maxResponseTimeMs: number,
|
||||
altRfqtAssetOfferings: AltRfqtMakerAssetOfferings,
|
||||
altRfqAssetOfferings: AltRfqMakerAssetOfferings,
|
||||
takerRequestQueryParams: TakerRequestQueryParams,
|
||||
axiosInstance: AxiosInstance,
|
||||
cancelToken: CancelToken,
|
||||
): Promise<{ data: ResponseT; status: number }> {
|
||||
const altPair = getAltMarketInfo(
|
||||
altRfqtAssetOfferings[url],
|
||||
altRfqAssetOfferings[url],
|
||||
takerRequestQueryParams.buyTokenAddress,
|
||||
takerRequestQueryParams.sellTokenAddress,
|
||||
);
|
||||
|
@ -7,7 +7,7 @@ import { V4RFQIndicativeQuote } from '@0x/quote-server';
|
||||
import { MarketOperation } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
|
||||
import { NativeOrderWithFillableAmounts, RfqtFirmQuoteValidator, RfqtRequestOpts } from '../../types';
|
||||
import { NativeOrderWithFillableAmounts, RfqFirmQuoteValidator, RfqRequestOpts } from '../../types';
|
||||
import { QuoteRequestor } from '../../utils/quote_requestor';
|
||||
import { QuoteReport } from '../quote_report_generator';
|
||||
|
||||
@ -267,9 +267,9 @@ export type OptimizedMarketOrder =
|
||||
| OptimizedMarketOrderBase<NativeLimitOrderFillData>
|
||||
| OptimizedMarketOrderBase<NativeRfqOrderFillData>;
|
||||
|
||||
export interface GetMarketOrdersRfqtOpts extends RfqtRequestOpts {
|
||||
export interface GetMarketOrdersRfqOpts extends RfqRequestOpts {
|
||||
quoteRequestor?: QuoteRequestor;
|
||||
firmQuoteValidator?: RfqtFirmQuoteValidator;
|
||||
firmQuoteValidator?: RfqFirmQuoteValidator;
|
||||
}
|
||||
|
||||
export type FeeEstimate = (fillData: FillData) => number | BigNumber;
|
||||
@ -343,7 +343,7 @@ export interface GetMarketOrdersOpts {
|
||||
/**
|
||||
* Options for RFQT such as takerAddress, intent on filling
|
||||
*/
|
||||
rfqt?: GetMarketOrdersRfqtOpts;
|
||||
rfqt?: GetMarketOrdersRfqOpts;
|
||||
/**
|
||||
* Whether to generate a quote report
|
||||
*/
|
||||
|
@ -7,12 +7,12 @@ import axios, { AxiosInstance } from 'axios';
|
||||
import { constants } from '../constants';
|
||||
import {
|
||||
AltQuoteModel,
|
||||
AltRfqtMakerAssetOfferings,
|
||||
AltRfqMakerAssetOfferings,
|
||||
LogFunction,
|
||||
MarketOperation,
|
||||
RfqPairType,
|
||||
RfqtMakerAssetOfferings,
|
||||
RfqtRequestOpts,
|
||||
RfqMakerAssetOfferings,
|
||||
RfqRequestOpts,
|
||||
SignedNativeOrder,
|
||||
TypedMakerUrl,
|
||||
} from '../types';
|
||||
@ -125,7 +125,7 @@ export class QuoteRequestor {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly _rfqtAssetOfferings: RfqtMakerAssetOfferings,
|
||||
private readonly _rfqtAssetOfferings: RfqMakerAssetOfferings,
|
||||
private readonly _quoteRequestorHttpClient: AxiosInstance,
|
||||
private readonly _altRfqCreds?: { altRfqApiKey: string; altRfqProfile: string },
|
||||
private readonly _warningLogger: LogFunction = constants.DEFAULT_WARNING_LOGGER,
|
||||
@ -141,9 +141,9 @@ export class QuoteRequestor {
|
||||
assetFillAmount: BigNumber,
|
||||
marketOperation: MarketOperation,
|
||||
comparisonPrice: BigNumber | undefined,
|
||||
options: RfqtRequestOpts,
|
||||
options: RfqRequestOpts,
|
||||
): Promise<SignedNativeOrder[]> {
|
||||
const _opts: RfqtRequestOpts = { ...constants.DEFAULT_RFQT_REQUEST_OPTS, ...options };
|
||||
const _opts: RfqRequestOpts = { ...constants.DEFAULT_RFQT_REQUEST_OPTS, ...options };
|
||||
if (!_opts.txOrigin || [undefined, '', '0x', NULL_ADDRESS].includes(_opts.txOrigin)) {
|
||||
throw new Error('RFQ-T firm quotes require the presence of a tx origin');
|
||||
}
|
||||
@ -222,9 +222,9 @@ export class QuoteRequestor {
|
||||
assetFillAmount: BigNumber,
|
||||
marketOperation: MarketOperation,
|
||||
comparisonPrice: BigNumber | undefined,
|
||||
options: RfqtRequestOpts,
|
||||
options: RfqRequestOpts,
|
||||
): Promise<V4RFQIndicativeQuote[]> {
|
||||
const _opts: RfqtRequestOpts = { ...constants.DEFAULT_RFQT_REQUEST_OPTS, ...options };
|
||||
const _opts: RfqRequestOpts = { ...constants.DEFAULT_RFQT_REQUEST_OPTS, ...options };
|
||||
// Originally a takerAddress was required for indicative quotes, but
|
||||
// now we've eliminated that requirement. @0x/quote-server, however,
|
||||
// is still coded to expect a takerAddress. So if the client didn't
|
||||
@ -317,7 +317,7 @@ export class QuoteRequestor {
|
||||
typedMakerUrl: TypedMakerUrl,
|
||||
makerToken: string,
|
||||
takerToken: string,
|
||||
altMakerAssetOfferings: AltRfqtMakerAssetOfferings | undefined,
|
||||
altMakerAssetOfferings: AltRfqMakerAssetOfferings | undefined,
|
||||
): boolean {
|
||||
if (typedMakerUrl.pairType === RfqPairType.Standard) {
|
||||
for (const assetPair of this._rfqtAssetOfferings[typedMakerUrl.url]) {
|
||||
@ -353,7 +353,7 @@ export class QuoteRequestor {
|
||||
assetFillAmount: BigNumber,
|
||||
marketOperation: MarketOperation,
|
||||
comparisonPrice: BigNumber | undefined,
|
||||
options: RfqtRequestOpts,
|
||||
options: RfqRequestOpts,
|
||||
quoteType: 'firm' | 'indicative',
|
||||
): Promise<Array<RfqQuote<ResponseT>>> {
|
||||
const requestParams = QuoteRequestor.makeQueryParameters(
|
||||
@ -382,8 +382,8 @@ export class QuoteRequestor {
|
||||
return { pairType: RfqPairType.Standard, url: mm };
|
||||
},
|
||||
);
|
||||
const altUrls = options.altRfqtAssetOfferings
|
||||
? Object.keys(options.altRfqtAssetOfferings).map(
|
||||
const altUrls = options.altRfqAssetOfferings
|
||||
? Object.keys(options.altRfqAssetOfferings).map(
|
||||
(mm: string): TypedMakerUrl => {
|
||||
return { pairType: RfqPairType.Alt, url: mm };
|
||||
},
|
||||
@ -410,7 +410,7 @@ export class QuoteRequestor {
|
||||
if (isBlacklisted) {
|
||||
this._infoLogger({ rfqtMakerInteraction: { ...partialLogEntry } });
|
||||
return;
|
||||
} else if (!this._makerSupportsPair(typedMakerUrl, makerToken, takerToken, options.altRfqtAssetOfferings)) {
|
||||
} else if (!this._makerSupportsPair(typedMakerUrl, makerToken, takerToken, options.altRfqAssetOfferings)) {
|
||||
return;
|
||||
} else {
|
||||
// make request to MM
|
||||
@ -452,7 +452,7 @@ export class QuoteRequestor {
|
||||
makerToken,
|
||||
takerToken,
|
||||
timeoutMs,
|
||||
options.altRfqtAssetOfferings || {},
|
||||
options.altRfqAssetOfferings || {},
|
||||
requestParams,
|
||||
this._quoteRequestorHttpClient,
|
||||
cancelTokenSource.token,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import AxiosMockAdapter from 'axios-mock-adapter';
|
||||
|
||||
import { MockedRfqtQuoteResponse } from '../types';
|
||||
import { MockedRfqQuoteResponse } from '../types';
|
||||
|
||||
export enum RfqtQuoteEndpoint {
|
||||
Indicative = 'price',
|
||||
@ -18,7 +18,7 @@ export const rfqtMocker = {
|
||||
* requests to RFQ-t providers
|
||||
*/
|
||||
withMockedRfqtQuotes: async (
|
||||
mockedResponses: MockedRfqtQuoteResponse[],
|
||||
mockedResponses: MockedRfqQuoteResponse[],
|
||||
quoteType: RfqtQuoteEndpoint,
|
||||
afterResponseCallback: () => Promise<void>,
|
||||
axiosClient: AxiosInstance = axios,
|
||||
|
@ -14,7 +14,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
|
||||
import { MarketOperation, QuoteRequestor, RfqtRequestOpts, SignedNativeOrder } from '../src';
|
||||
import { MarketOperation, QuoteRequestor, RfqRequestOpts, SignedNativeOrder } from '../src';
|
||||
import { NativeOrderWithFillableAmounts } from '../src/types';
|
||||
import { MarketOperationUtils } from '../src/utils/market_operation_utils/';
|
||||
import { BalancerPoolsCache } from '../src/utils/market_operation_utils/balancer_utils';
|
||||
@ -714,7 +714,7 @@ describe('MarketOperationUtils tests', () => {
|
||||
_assetFillAmount: BigNumber,
|
||||
_marketOperation: MarketOperation,
|
||||
comparisonPrice: BigNumber | undefined,
|
||||
_options: RfqtRequestOpts,
|
||||
_options: RfqRequestOpts,
|
||||
) => {
|
||||
requestedComparisonPrice = comparisonPrice;
|
||||
},
|
||||
|
@ -12,13 +12,13 @@ import 'mocha';
|
||||
|
||||
import { constants, KEEP_ALIVE_TTL } from '../src/constants';
|
||||
import {
|
||||
AltMockedRfqtQuoteResponse,
|
||||
AltMockedRfqQuoteResponse,
|
||||
AltQuoteModel,
|
||||
AltQuoteRequestData,
|
||||
AltQuoteSide,
|
||||
AltRfqtMakerAssetOfferings,
|
||||
AltRfqMakerAssetOfferings,
|
||||
MarketOperation,
|
||||
MockedRfqtQuoteResponse,
|
||||
MockedRfqQuoteResponse,
|
||||
} from '../src/types';
|
||||
import { NULL_ADDRESS } from '../src/utils/market_operation_utils/constants';
|
||||
import { QuoteRequestor } from '../src/utils/quote_requestor';
|
||||
@ -50,7 +50,7 @@ describe('QuoteRequestor', async () => {
|
||||
const [makerToken, takerToken, otherToken1] = tokenUtils.getDummyERC20TokenAddresses();
|
||||
const validSignature = { v: 28, r: '0x', s: '0x', signatureType: SignatureType.EthSign };
|
||||
|
||||
const altRfqtAssetOfferings: AltRfqtMakerAssetOfferings = {
|
||||
const altRfqAssetOfferings: AltRfqMakerAssetOfferings = {
|
||||
'https://132.0.0.1': [
|
||||
{
|
||||
id: 'XYZ-123',
|
||||
@ -70,8 +70,8 @@ describe('QuoteRequestor', async () => {
|
||||
|
||||
// Set up RFQT responses
|
||||
// tslint:disable-next-line:array-type
|
||||
const mockedRequests: MockedRfqtQuoteResponse[] = [];
|
||||
const altMockedRequests: AltMockedRfqtQuoteResponse[] = [];
|
||||
const mockedRequests: MockedRfqQuoteResponse[] = [];
|
||||
const altMockedRequests: AltMockedRfqQuoteResponse[] = [];
|
||||
|
||||
const expectedParams: TakerRequestQueryParams = {
|
||||
sellTokenAddress: takerToken,
|
||||
@ -237,7 +237,7 @@ describe('QuoteRequestor', async () => {
|
||||
takerAddress,
|
||||
txOrigin: takerAddress,
|
||||
intentOnFilling: true,
|
||||
altRfqtAssetOfferings,
|
||||
altRfqAssetOfferings,
|
||||
},
|
||||
);
|
||||
expect(resp).to.deep.eq([
|
||||
@ -269,7 +269,7 @@ describe('QuoteRequestor', async () => {
|
||||
|
||||
// Set up RFQT responses
|
||||
// tslint:disable-next-line:array-type
|
||||
const mockedRequests: MockedRfqtQuoteResponse[] = [];
|
||||
const mockedRequests: MockedRfqQuoteResponse[] = [];
|
||||
const expectedParams: TakerRequestQueryParams = {
|
||||
sellTokenAddress: takerToken,
|
||||
buyTokenAddress: makerToken,
|
||||
@ -375,7 +375,7 @@ describe('QuoteRequestor', async () => {
|
||||
|
||||
// Set up RFQT responses
|
||||
// tslint:disable-next-line:array-type
|
||||
const mockedRequests: MockedRfqtQuoteResponse[] = [];
|
||||
const mockedRequests: MockedRfqQuoteResponse[] = [];
|
||||
const expectedParams: TakerRequestQueryParams = {
|
||||
sellTokenAddress: takerToken,
|
||||
buyTokenAddress: makerToken,
|
||||
@ -459,7 +459,7 @@ describe('QuoteRequestor', async () => {
|
||||
|
||||
// Set up RFQT responses
|
||||
// tslint:disable-next-line:array-type
|
||||
const mockedRequests: MockedRfqtQuoteResponse[] = [];
|
||||
const mockedRequests: MockedRfqQuoteResponse[] = [];
|
||||
const expectedParams: TakerRequestQueryParams = {
|
||||
sellTokenAddress: takerToken,
|
||||
buyTokenAddress: makerToken,
|
||||
@ -523,7 +523,7 @@ describe('QuoteRequestor', async () => {
|
||||
const quoteToken = takerToken;
|
||||
|
||||
// Set up RFQT responses
|
||||
const altMockedRequests: AltMockedRfqtQuoteResponse[] = [];
|
||||
const altMockedRequests: AltMockedRfqQuoteResponse[] = [];
|
||||
const altScenarios: Array<{
|
||||
successfulQuote: V4RFQIndicativeQuote;
|
||||
requestedMakerToken: string;
|
||||
@ -737,7 +737,7 @@ describe('QuoteRequestor', async () => {
|
||||
takerAddress,
|
||||
txOrigin,
|
||||
intentOnFilling: true,
|
||||
altRfqtAssetOfferings,
|
||||
altRfqAssetOfferings,
|
||||
},
|
||||
);
|
||||
// hack to get the expiry right, since it's dependent on the current timestamp
|
||||
|
@ -4,7 +4,7 @@ import AxiosMockAdapter from 'axios-mock-adapter';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { InsufficientAssetLiquidityError } from '../../src/errors';
|
||||
import { AltMockedRfqtQuoteResponse, MockedRfqtQuoteResponse } from '../../src/types';
|
||||
import { AltMockedRfqQuoteResponse, MockedRfqQuoteResponse } from '../../src/types';
|
||||
|
||||
export enum RfqtQuoteEndpoint {
|
||||
Indicative = 'price',
|
||||
@ -37,8 +37,8 @@ export const testHelpers = {
|
||||
* requests to RFQ-t providers
|
||||
*/
|
||||
withMockedRfqtQuotes: async (
|
||||
standardMockedResponses: MockedRfqtQuoteResponse[],
|
||||
altMockedResponses: AltMockedRfqtQuoteResponse[],
|
||||
standardMockedResponses: MockedRfqQuoteResponse[],
|
||||
altMockedResponses: AltMockedRfqQuoteResponse[],
|
||||
quoteType: RfqtQuoteEndpoint,
|
||||
afterResponseCallback: () => Promise<void>,
|
||||
axiosClient: AxiosInstance = axios,
|
||||
|
Loading…
x
Reference in New Issue
Block a user