File tree 2 files changed +18
-1
lines changed
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ respect supportedTokens prop in PayEmbed
Original file line number Diff line number Diff line change 1
1
import { useQueryClient } from "@tanstack/react-query" ;
2
2
import { useCallback , useMemo , useState } from "react" ;
3
3
import type { Chain } from "../../../../../../chains/types.js" ;
4
+ import { getCachedChain } from "../../../../../../chains/utils.js" ;
4
5
import type { ThirdwebClient } from "../../../../../../client/client.js" ;
5
6
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../constants/addresses.js" ;
6
7
import type { BuyWithCryptoStatus } from "../../../../../../pay/buyWithCrypto/getStatus.js" ;
@@ -112,10 +113,21 @@ export default function BuyScreen(props: BuyScreenProps) {
112
113
return < LoadingScreen /> ;
113
114
}
114
115
116
+ const supportedDestinations = props . supportedTokens
117
+ ? Object . entries ( props . supportedTokens ) . map ( ( [ chainId , tokens ] ) => ( {
118
+ chain : getCachedChain ( Number . parseInt ( chainId ) ) ,
119
+ tokens : tokens . map ( ( t ) => ( {
120
+ ...t ,
121
+ buyWithCryptoEnabled : true ,
122
+ buyWithFiatEnabled : true ,
123
+ } ) ) ,
124
+ } ) )
125
+ : supportedDestinationsQuery . data ;
126
+
115
127
return (
116
128
< BuyScreenContent
117
129
{ ...props }
118
- supportedDestinations = { supportedDestinationsQuery . data }
130
+ supportedDestinations = { supportedDestinations }
119
131
/>
120
132
) ;
121
133
}
You can’t perform that action at this time.
0 commit comments