Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/services/quotes/source-lists/local-source-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export class LocalSourceList implements IQuoteSourceList {
): Promise<QuoteTransaction> {
const source = this.sources[sourceId];

if (!source) throw new SourceNotFoundError(sourceId);
if (!source) return Promise.reject(new SourceNotFoundError(sourceId));

// Check config is valid
const config = { ...sourceConfig?.global, ...sourceConfig?.custom?.[sourceId as SourceWithConfigId] };
if (!source.isConfigAndContextValidForTxBuilding(config)) {
throw new SourceInvalidConfigOrContextError(sourceId);
return Promise.reject(new SourceInvalidConfigOrContextError(sourceId));
}

// Map request to source request
Expand All @@ -82,19 +82,19 @@ export class LocalSourceList implements IQuoteSourceList {

private async getQuote(request: SourceListQuoteRequest, sourceId: SourceId): Promise<SourceListQuoteResponse> {
if (!(sourceId in this.sources)) {
throw new SourceNotFoundError(sourceId);
return Promise.reject(new SourceNotFoundError(sourceId));
}

// Map request to source request
const sourceRequest = mapQuoteRequestToSourceRequest(request);

// Find and wrap source
const source = this.getSourceForRequest(request, sourceId);
const source = await this.getSourceForRequest(request, sourceId);

// Check config is valid
const config = { ...request.sourceConfig?.global, ...request.sourceConfig?.custom?.[sourceId as SourceWithConfigId] };
if (!source.isConfigAndContextValidForQuoting(config)) {
throw new SourceInvalidConfigOrContextError(sourceId);
return Promise.reject(new SourceInvalidConfigOrContextError(sourceId));
}

// Ask for quote
Expand All @@ -115,7 +115,7 @@ export class LocalSourceList implements IQuoteSourceList {
if (request.estimateBuyOrdersWithSellOnlySources) {
source = buyToSellOrderWrapper(source);
} else {
throw new SourceNoBuyOrdersError(sourceId);
return Promise.reject(new SourceNoBuyOrdersError(sourceId));
}
}
// Cast so that even if the source doesn't support it, everything else types ok
Expand Down