Skip to content

Commit

Permalink
fixup! Implement
Browse files Browse the repository at this point in the history
Co-authored-by: Jon-edge <[email protected]>
  • Loading branch information
swansontec and Jon-edge authored Oct 17, 2023
1 parent 0452b1c commit 8e0422c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/account/account-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,19 +626,20 @@ export function makeAccountApi(ai: ApiInput, accountId: string): EdgeAccount {
opts?: EdgeSwapRequestOptions
): Promise<EdgeSwapQuote> {
const [quote, ...rest] = await fetchSwapQuotes(
const [bestQuote, ...otherQuotes] = await fetchSwapQuotes(
ai,
accountId,
request,
opts
)

// Close unused quotes:
for (const quote of rest) quote.close().catch(() => undefined)
for (const otherQuote of otherQuotes)
otherQuote.close().catch(() => undefined)

// Return the front quote:
if (quote == null) throw new Error('No swap providers enabled')
return quote
},
if (bestQuote == null) throw new Error('No swap providers enabled')
return bestQuote

async fetchSwapQuotes(
request: EdgeSwapRequest,
Expand Down

0 comments on commit 8e0422c

Please sign in to comment.