Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
v1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
salil-naik committed Dec 9, 2022
1 parent 0f1e5c4 commit bee9d69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@socket.tech/socket-v2-sdk",
"version": "1.21.2",
"version": "1.21.3",
"module": "lib/src/index.js",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
Expand Down
4 changes: 3 additions & 1 deletion src/baseSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ export abstract class BaseSocket {
*/
async getBestQuote(params: QuoteParams, preferences?: QuotePreferences) {
const allRoutes = await this.getAllQuotes(params, preferences);
// API returns the 'sort by time' in descending order of service time, hence reversing the order
// To be removed once API response is fixed
if (preferences?.sort === SortOptions.Time) {
return allRoutes ? allRoutes[allRoutes.length - 1] : null;
return allRoutes ? allRoutes.reverse()[0] : null;
} else return allRoutes ? allRoutes[0] : null;
}

Expand Down

0 comments on commit bee9d69

Please sign in to comment.