@@ -378,22 +378,22 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
378
378
const memorizedAccountList = useMemo ( ( ) => {
379
379
return buildAccountList ( key , defaultAltCurrency . isoCode , rates , dispatch , {
380
380
filterByHideWallet : true ,
381
- } ) . filter ( ( { chains} ) => IsEVMChain ( chains [ 0 ] ) ) ;
381
+ } ) . filter ( ( { chains} ) => IsEVMChain ( chains [ 0 ] ) ) || { } ;
382
382
} , [ dispatch , key , defaultAltCurrency . isoCode , rates ] ) ;
383
383
384
384
const accountItem = memorizedAccountList . find (
385
385
a => a . receiveAddress === selectedAccountAddress ,
386
386
) ! ;
387
- const totalBalance = accountItem . fiatBalanceFormat ;
387
+ const totalBalance = accountItem ? .fiatBalanceFormat ;
388
388
const hasMultipleAccounts = memorizedAccountList . length > 1 ;
389
389
390
390
const accounts = useAppSelector (
391
- ( { SHOP } ) => SHOP . billPayAccounts [ accountItem . wallets [ 0 ] . network ] ,
391
+ ( { SHOP } ) => SHOP . billPayAccounts [ accountItem ? .wallets [ 0 ] ? .network ] ,
392
392
) ;
393
393
394
394
const keyOptions : Array < Option > = [ ] ;
395
395
const hasAllChains =
396
- accountItem . chains . length === Object . keys ( BitpaySupportedEvmCoins ) . length ;
396
+ accountItem ? .chains ? .length === Object . keys ( BitpaySupportedEvmCoins ) . length ;
397
397
if ( ! hasAllChains ) {
398
398
keyOptions . push ( {
399
399
img : < Icons . Wallet width = "15" height = "15" /> ,
@@ -415,7 +415,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
415
415
options : {
416
416
network,
417
417
password,
418
- account : accountItem . accountNumber ,
418
+ account : accountItem ? .accountNumber ,
419
419
customAccount : true ,
420
420
} ,
421
421
} ) ,
@@ -438,7 +438,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
438
438
await sleep ( 500 ) ;
439
439
navigation . navigate ( 'AccountSettings' , {
440
440
key,
441
- selectedAccountAddress : accountItem . receiveAddress ,
441
+ selectedAccountAddress : accountItem ? .receiveAddress ,
442
442
context : 'accountDetails' ,
443
443
} ) ;
444
444
} ,
@@ -546,7 +546,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
546
546
const updateWalletStatusAndProfileBalance = async ( ) => {
547
547
await startUpdateAllWalletStatusForKey ( {
548
548
key,
549
- accountAddress : accountItem . receiveAddress ,
549
+ accountAddress : accountItem ? .receiveAddress ,
550
550
force : true ,
551
551
} ) ;
552
552
dispatch ( updatePortfolioBalance ) ;
@@ -615,7 +615,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
615
615
if ( memorizedAssetsByChainList ?. [ 0 ] . chains ?. [ 0 ] ) {
616
616
navigation . navigate ( 'AddCustomToken' , {
617
617
key,
618
- selectedAccountAddress : accountItem . receiveAddress ,
618
+ selectedAccountAddress : accountItem ? .receiveAddress ,
619
619
selectedChain : memorizedAssetsByChainList [ 0 ] . chains [ 0 ] ,
620
620
} ) ;
621
621
}
@@ -691,7 +691,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
691
691
onPress = { ( ) =>
692
692
navigation . navigate ( 'AccountSettings' , {
693
693
key,
694
- selectedAccountAddress : accountItem . receiveAddress ,
694
+ selectedAccountAddress : accountItem ? .receiveAddress ,
695
695
context : 'accountDetails' ,
696
696
} )
697
697
} >
@@ -1039,7 +1039,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1039
1039
? await debouncedLoadHistory ( true )
1040
1040
: await startUpdateAllWalletStatusForKey ( {
1041
1041
key,
1042
- accountAddress : accountItem . receiveAddress ,
1042
+ accountAddress : accountItem ? .receiveAddress ,
1043
1043
force : true ,
1044
1044
createTokenWalletWithFunds : true ,
1045
1045
} ) ;
@@ -1080,7 +1080,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1080
1080
const copyToClipboard = ( ) => {
1081
1081
haptic ( 'impactLight' ) ;
1082
1082
if ( ! copied ) {
1083
- Clipboard . setString ( accountItem . receiveAddress ) ;
1083
+ Clipboard . setString ( accountItem ? .receiveAddress ) ;
1084
1084
setCopied ( true ) ;
1085
1085
}
1086
1086
} ;
@@ -1120,7 +1120,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1120
1120
activeOpacity = { ActiveOpacity }
1121
1121
style = { { alignSelf : 'center' , width : 'auto' , height : 25 } } >
1122
1122
< Badge style = { { marginTop : 3 } } >
1123
- { formatCryptoAddress ( accountItem . receiveAddress ) }
1123
+ { formatCryptoAddress ( accountItem ? .receiveAddress ) }
1124
1124
</ Badge >
1125
1125
< CopyToClipboardContainer >
1126
1126
{ ! copied ? < CopySvg width = { 10 } /> : < CopiedSvg width = { 10 } /> }
@@ -1182,12 +1182,12 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1182
1182
cta : ( ) => {
1183
1183
navigation . navigate ( 'GlobalSelect' , {
1184
1184
context : 'send' ,
1185
- selectedAccountAddress : accountItem . receiveAddress ,
1185
+ selectedAccountAddress : accountItem ? .receiveAddress ,
1186
1186
} ) ;
1187
1187
} ,
1188
1188
} }
1189
1189
/>
1190
- { Number ( accountItem . fiatLockedBalanceFormat ) > 0 ? (
1190
+ { Number ( accountItem ? .fiatLockedBalanceFormat ) > 0 ? (
1191
1191
< LockedBalanceContainer onPress = { ( ) => { } } >
1192
1192
< View >
1193
1193
< Description numberOfLines = { 1 } ellipsizeMode = { 'tail' } >
@@ -1197,7 +1197,7 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1197
1197
1198
1198
< TailContainer >
1199
1199
< Value >
1200
- { accountItem . fiatLockedBalanceFormat } { ' ' }
1200
+ { accountItem ? .fiatLockedBalanceFormat } { ' ' }
1201
1201
{ formatCurrencyAbbreviation (
1202
1202
key . wallets [ 1 ] . currencyAbbreviation ,
1203
1203
) }
@@ -1325,11 +1325,11 @@ const AccountDetails: React.FC<AccountDetailsScreenProps> = ({route}) => {
1325
1325
< AccountDropdownOptionsContainer >
1326
1326
{ Object . values ( memorizedAccountList ) . map ( _accountItem => (
1327
1327
< DropdownOption
1328
- key = { _accountItem . id }
1329
- optionId = { _accountItem . id }
1330
- optionName = { _accountItem . accountName }
1331
- wallets = { _accountItem . wallets }
1332
- totalBalance = { _accountItem . fiatBalance }
1328
+ key = { _accountItem ? .id }
1329
+ optionId = { _accountItem ? .id }
1330
+ optionName = { _accountItem ? .accountName }
1331
+ wallets = { _accountItem ? .wallets }
1332
+ totalBalance = { _accountItem ? .fiatBalance }
1333
1333
onPress = { ( accountId : string ) => {
1334
1334
setShowAccountDropdown ( false ) ;
1335
1335
const selectedAccountItem = memorizedAccountList . find (
0 commit comments