mirror of
https://github.com/alexgo-io/alex-sdk.git
synced 2026-01-12 14:25:02 +08:00
fix: unit test
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user