Skip to content

Commit 65972fe

Browse files
Add fallback for usePaymentMethods hook on getOwnedTokens failure
Co-authored-by: gregfromstl <[email protected]>
1 parent b2b8426 commit 65972fe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.changeset/fallback-native-balance.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Add fallback mechanism to usePaymentMethods hook for getOwnedTokens failures
6+
7+
When getOwnedTokens batches fail in the usePaymentMethods hook, the system now falls back to getting native token balances for each chain using getWalletBalance. This ensures users can still access their native tokens as payment methods even when the insight API is experiencing issues, providing a more resilient user experience.
8+
9+
The fallback mechanism:
10+
- Catches getOwnedTokens failures and logs warnings
11+
- Falls back to native balance fetching using getWalletBalance for each chain
12+
- Transforms results to match the expected format
13+
- Continues normal processing flow seamlessly

0 commit comments

Comments
 (0)