Don't throw when RFQ-T client isn't whitelisted

Addresses review comments
https://github.com/0xProject/0x-monorepo/pull/2541#discussion_r405964457
and
https://github.com/0xProject/0x-monorepo/pull/2541#discussion_r406040453
This commit is contained in:
F. Eugene Aumson
2020-04-09 13:50:36 -04:00
parent 70add44fc1
commit 5f4778c852

View File

@@ -532,10 +532,12 @@ export class SwapQuoter {
const orderPromises: Array<Promise<SignedOrder[]>> = [ const orderPromises: Array<Promise<SignedOrder[]>> = [
this._getSignedOrdersAsync(makerAssetData, takerAssetData), this._getSignedOrdersAsync(makerAssetData, takerAssetData),
]; ];
if (options.rfqt && options.rfqt.intentOnFilling && options.apiKey) { if (
if (!this._rfqtTakerApiKeyWhitelist.includes(options.apiKey)) { options.rfqt &&
throw new Error('API key not permissioned for RFQ-T'); options.rfqt.intentOnFilling &&
} options.apiKey &&
this._rfqtTakerApiKeyWhitelist.includes(options.apiKey)
) {
if (!options.rfqt.takerAddress || options.rfqt.takerAddress === constants.NULL_ADDRESS) { if (!options.rfqt.takerAddress || options.rfqt.takerAddress === constants.NULL_ADDRESS) {
throw new Error('RFQ-T requests must specify a taker address'); throw new Error('RFQ-T requests must specify a taker address');
} }