File tree Expand file tree Collapse file tree 12 files changed +30
-21
lines changed
account-tree-controller/src/backup-and-sync/utils
multichain-account-service/src/providers
seedless-onboarding-controller
subscription-controller/src
transaction-controller/src/utils Expand file tree Collapse file tree 12 files changed +30
-21
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export const getLocalGroupForEntropyWallet = (
4141 const walletId = toMultichainAccountWalletId ( entropySourceId ) ;
4242 const wallet = context . controller . state . accountTree . wallets [ walletId ] ;
4343
44- if ( wallet ? .type !== AccountWalletType . Entropy ) {
44+ if ( ! wallet || wallet . type !== AccountWalletType . Entropy ) {
4545 backupAndSyncLogger (
4646 `Wallet ${ walletId } not found or is not an entropy wallet` ,
4747 ) ;
@@ -65,7 +65,7 @@ export function getLocalGroupsForEntropyWallet(
6565 walletId : AccountWalletId ,
6666) : AccountGroupMultichainAccountObject [ ] {
6767 const wallet = context . controller . state . accountTree . wallets [ walletId ] ;
68- if ( wallet ? .type !== AccountWalletType . Entropy ) {
68+ if ( ! wallet || wallet . type !== AccountWalletType . Entropy ) {
6969 backupAndSyncLogger (
7070 `Wallet ${ walletId } not found or is not an entropy wallet` ,
7171 ) ;
Original file line number Diff line number Diff line change @@ -180,8 +180,9 @@ export class DeFiPositionsController extends StaticIntervalPollingController()<
180180 const selectedAddress = this . #getSelectedEvmAdress( ) ;
181181
182182 if (
183- selectedAddress ?. toLowerCase ( ) !==
184- transactionMeta . txParams . from . toLowerCase ( )
183+ ! selectedAddress ||
184+ selectedAddress . toLowerCase ( ) !==
185+ transactionMeta . txParams . from . toLowerCase ( )
185186 ) {
186187 return ;
187188 }
Original file line number Diff line number Diff line change @@ -1025,7 +1025,8 @@ export class TokenBalancesController extends StaticIntervalPollingController<{
10251025 const stakingContractAddress =
10261026 STAKING_CONTRACT_ADDRESS_BY_CHAINID [ balance . chainId ] ;
10271027 return (
1028- stakingContractAddress ?. toLowerCase ( ) === balance . token . toLowerCase ( )
1028+ stakingContractAddress &&
1029+ stakingContractAddress . toLowerCase ( ) === balance . token . toLowerCase ( )
10291030 ) ;
10301031 } ) ;
10311032
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ export class TokenListController extends StaticIntervalPollingController<TokenLi
251251 const prevData = this . #previousTokensChainsCache[ chainId ] ;
252252
253253 // Chain is new or timestamp changed (indicating data update)
254- if ( prevData ? .timestamp !== newData . timestamp ) {
254+ if ( ! prevData || prevData . timestamp !== newData . timestamp ) {
255255 this . #changedChainsToPersist. add ( chainId ) ;
256256 }
257257 }
Original file line number Diff line number Diff line change 1- const NodeEnvironment = require ( 'jest-environment-node' ) . default ;
1+ const { TestEnvironment } = require ( 'jest-environment-node' ) ;
22
33/**
44 * KeyringController depends on @noble/hashes, which as of 1.3.2 relies on the
55 * Web Crypto API in Node and browsers.
66 */
7- class CustomTestEnvironment extends NodeEnvironment {
7+ class CustomTestEnvironment extends TestEnvironment {
88 async setup ( ) {
99 await super . setup ( ) ;
1010 if ( typeof this . global . crypto === 'undefined' ) {
Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ export abstract class SnapAccountProvider extends BaseBip44AccountProvider {
159159 ) : Promise < void > {
160160 await this . withSnap ( async ( { keyring } ) => {
161161 const localSnapAccounts = accounts . filter (
162- ( account ) => account . metadata . snap ?. id === this . snapId ,
162+ ( account ) =>
163+ account . metadata . snap && account . metadata . snap . id === this . snapId ,
163164 ) ;
164165 const snapAccounts = new Set (
165166 ( await this . #client. listAccounts ( ) ) . map ( ( account ) => account . id ) ,
Original file line number Diff line number Diff line change @@ -2701,7 +2701,10 @@ export class NetworkController extends BaseController<
27012701 ) ;
27022702 }
27032703
2704- if ( networkFields . chainId !== existingNetworkConfiguration ?. chainId ) {
2704+ if (
2705+ existingNetworkConfiguration === null ||
2706+ networkFields . chainId !== existingNetworkConfiguration . chainId
2707+ ) {
27052708 const existingNetworkConfigurationViaChainId =
27062709 this . state . networkConfigurationsByChainId [ networkFields . chainId ] ;
27072710 if ( existingNetworkConfigurationViaChainId !== undefined ) {
Original file line number Diff line number Diff line change @@ -763,7 +763,8 @@ export class RampsController extends BaseController<
763763 for ( const key of keys ) {
764764 const entry = requests [ key ] ;
765765 if (
766- entry ?. status === RequestStatus . SUCCESS &&
766+ entry &&
767+ entry . status === RequestStatus . SUCCESS &&
767768 isCacheExpired ( entry , ttl )
768769 ) {
769770 delete requests [ key ] ;
Original file line number Diff line number Diff line change 1- const NodeEnvironment = require ( 'jest-environment-node' ) . default ;
1+ const { TestEnvironment } = require ( 'jest-environment-node' ) ;
22
33/**
44 * SeedlessOnboardingController depends on @noble/hashes, which as of 1.7.1 relies on the
55 * Web Crypto API in Node and browsers.
66 */
7- class CustomTestEnvironment extends NodeEnvironment {
7+ class CustomTestEnvironment extends TestEnvironment {
88 async setup ( ) {
99 await super . setup ( ) ;
1010 if ( typeof this . global . crypto === 'undefined' ) {
Original file line number Diff line number Diff line change @@ -1041,7 +1041,8 @@ export class SubscriptionController extends StaticIntervalPollingController()<
10411041 value : CachedLastSelectedPaymentMethod | undefined ,
10421042 ) : asserts value is Required < CachedLastSelectedPaymentMethod > {
10431043 if (
1044- value ?. type !== PAYMENT_TYPES . byCrypto ||
1044+ ! value ||
1045+ value . type !== PAYMENT_TYPES . byCrypto ||
10451046 ! value . paymentTokenAddress ||
10461047 ! value . paymentTokenSymbol
10471048 ) {
You can’t perform that action at this time.
0 commit comments