Skip to content

Commit 45ba811

Browse files
authored
[SDK] Fix: Sort payment quotes in ascending order (#7819)
1 parent 7c458ea commit 45ba811

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/dirty-roses-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Sort payment quotes in ascending order

packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ export function usePaymentMethods(options: {
112112
.sort((a, b) => {
113113
return (
114114
Number.parseFloat(
115-
toTokens(b.quote.originAmount, b.originToken.decimals),
115+
toTokens(a.quote.originAmount, a.originToken.decimals),
116116
) *
117-
(b.originToken.prices.USD || 1) -
117+
(a.originToken.prices.USD || 1) -
118118
Number.parseFloat(
119-
toTokens(a.quote.originAmount, a.originToken.decimals),
119+
toTokens(b.quote.originAmount, b.originToken.decimals),
120120
) *
121-
(a.originToken.prices.USD || 1)
121+
(b.originToken.prices.USD || 1)
122122
);
123123
});
124124

0 commit comments

Comments
 (0)