File tree Expand file tree Collapse file tree 2 files changed +25
-18
lines changed
packages/checkout/widgets-lib/src/widgets/sale/components Expand file tree Collapse file tree 2 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,19 @@ export function FundingRouteMenuItem({
5252 if ( ! cryptoFiatState . conversions ) {
5353 return ;
5454 }
55-
56- setFeesUsd ( fundingRouteFees ( fundingRoute , cryptoFiatState . conversions ) ) ;
57- setUsdBalance (
58- calculateCryptoToFiat (
59- firstFundingStep . fundingItem . userBalance . formattedBalance ,
60- firstFundingStep . fundingItem . token . symbol ,
61- cryptoFiatState . conversions ,
62- ) ,
63- ) ;
55+ try {
56+ setFeesUsd ( fundingRouteFees ( fundingRoute , cryptoFiatState . conversions ) ) ;
57+ setUsdBalance (
58+ calculateCryptoToFiat (
59+ firstFundingStep . fundingItem . userBalance . formattedBalance ,
60+ firstFundingStep . fundingItem . token . symbol ,
61+ cryptoFiatState . conversions ,
62+ ) ,
63+ ) ;
64+ } catch {
65+ setFeesUsd ( undefined ) ;
66+ setUsdBalance ( undefined ) ;
67+ }
6468 } , [ cryptoFiatState , fundingRoute ] ) ;
6569
6670 const networkLabel = ( ) => (
Original file line number Diff line number Diff line change @@ -26,22 +26,25 @@ export function PurchaseMenuItem({ fundingRoute }: PurchaseMenuItemProps) {
2626 if ( ! cryptoFiatState . conversions ) {
2727 return ;
2828 }
29-
30- setUsdPurchaseAmount (
31- calculateCryptoToFiat (
32- firstFundingStep . fundingItem . fundsRequired . formattedAmount ,
33- firstFundingStep . fundingItem . token . symbol ,
34- cryptoFiatState . conversions ,
35- ) ,
36- ) ;
29+ try {
30+ setUsdPurchaseAmount (
31+ calculateCryptoToFiat (
32+ firstFundingStep . fundingItem . fundsRequired . formattedAmount ,
33+ firstFundingStep . fundingItem . token . symbol ,
34+ cryptoFiatState . conversions ,
35+ ) ,
36+ ) ;
37+ } catch {
38+ setUsdPurchaseAmount ( undefined ) ;
39+ }
3740 } , [ cryptoFiatState , fundingRoute ] ) ;
3841
3942 return (
4043 < MenuItem
4144 emphasized
4245 testId = "funding-route-purchase-item"
4346 size = "medium"
44- key = { firstItem . name }
47+ key = { firstItem ? .name }
4548 >
4649 < MenuItem . FramedImage
4750 imageUrl = { firstItem ?. image }
You can’t perform that action at this time.
0 commit comments