only set Last Look parameter if it's explicitly set (#200)

* only set Last Look parameter if it's explicitly set

* remove expoectation of having isLastLook
This commit is contained in:
Daniel Pyrathon 2021-04-14 16:38:55 -07:00 committed by GitHub
parent 9ce73931f7
commit a019bb913d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -83,7 +83,7 @@ export class QuoteRequestor {
sellTokenAddress: string, // taker token sellTokenAddress: string, // taker token
assetFillAmount: BigNumber, assetFillAmount: BigNumber,
comparisonPrice?: BigNumber, comparisonPrice?: BigNumber,
isLastLook: boolean = false, isLastLook?: boolean | undefined,
): TakerRequestQueryParams { ): TakerRequestQueryParams {
const { buyAmountBaseUnits, sellAmountBaseUnits } = const { buyAmountBaseUnits, sellAmountBaseUnits } =
marketOperation === MarketOperation.Buy marketOperation === MarketOperation.Buy
@ -111,9 +111,11 @@ export class QuoteRequestor {
buyTokenAddress, buyTokenAddress,
sellTokenAddress, sellTokenAddress,
comparisonPrice: comparisonPrice === undefined ? undefined : comparisonPrice.toString(), comparisonPrice: comparisonPrice === undefined ? undefined : comparisonPrice.toString(),
isLastLook: isLastLook.toString(),
protocolVersion: '4', protocolVersion: '4',
}; };
if (isLastLook) {
requestParamsWithBigNumbers.isLastLook = isLastLook.toString();
}
// convert BigNumbers to strings // convert BigNumbers to strings
// so they are digestible by axios // so they are digestible by axios

View File

@ -272,7 +272,6 @@ describe('QuoteRequestor', async () => {
comparisonPrice: undefined, comparisonPrice: undefined,
takerAddress, takerAddress,
txOrigin, txOrigin,
isLastLook: 'false',
protocolVersion: '4', protocolVersion: '4',
}; };
const mockedDefaults = { const mockedDefaults = {
@ -579,7 +578,6 @@ describe('QuoteRequestor', async () => {
comparisonPrice: undefined, comparisonPrice: undefined,
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
isLastLook: 'false',
protocolVersion: '4', protocolVersion: '4',
}; };
const mockedDefaults = { const mockedDefaults = {
@ -688,7 +686,6 @@ describe('QuoteRequestor', async () => {
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
protocolVersion: '4', protocolVersion: '4',
isLastLook: 'false',
}; };
const mockedDefaults = { const mockedDefaults = {
requestApiKey: apiKey, requestApiKey: apiKey,
@ -773,7 +770,6 @@ describe('QuoteRequestor', async () => {
comparisonPrice: undefined, comparisonPrice: undefined,
takerAddress, takerAddress,
txOrigin: takerAddress, txOrigin: takerAddress,
isLastLook: 'false',
protocolVersion: '4', protocolVersion: '4',
}; };
// Successful response // Successful response