Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhigang1992 committed Dec 11, 2024
1 parent ef577a2 commit 267859b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/alexSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ export class AlexSDK {
* @returns {Promise<AMMRoute>} - A promise that resolves to an AMMRoute object, representing the best route for the swap.
*/
async getRoute(from: Currency, to: Currency): Promise<AMMRoute> {
return (await this.getAllPossibleRoutes(from, to))[0];
const allPossibleRoutes = await this.getAllPossibleRoutes(from, to);
if (allPossibleRoutes.length === 0) {
throw new Error("Can't find route");
}
return allPossibleRoutes[0];
}

/**
Expand Down

0 comments on commit 267859b

Please sign in to comment.