Skip to content

Commit ed4f310

Browse files
committed
fix: fall back to selectEvmAddress when the account group has no EVM account
1 parent e9169d6 commit ed4f310

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

app/selectors/transactionController.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jest.mock('./multichainAccounts/accountTreeController', () => ({
3434
}) => state.groupEvmAccount ?? null,
3535
}));
3636

37+
jest.mock('./accountsController', () => ({
38+
selectEvmAddress: (state: { fallbackEvmAddress?: string }) =>
39+
state.fallbackEvmAddress,
40+
}));
41+
3742
describe('TransactionController Selectors', () => {
3843
describe('selectTransactions', () => {
3944
it('returns transactions from TransactionController state', () => {

app/selectors/transactionController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
selectPendingSmartTransactionsBySender,
66
selectPendingSmartTransactionsForSelectedAccountGroup,
77
} from './smartTransactionsController';
8+
import { selectEvmAddress } from './accountsController';
89
import { selectSelectedAccountGroupEvmInternalAccount } from './multichainAccounts/accountTreeController';
910
import {
1011
TransactionMeta,
@@ -220,15 +221,17 @@ export const selectLocalTransactions = createDeepEqualSelector(
220221
selectNonReplacedTransactions,
221222
selectPendingSmartTransactionsForSelectedAccountGroup,
222223
selectSelectedAccountGroupEvmInternalAccount,
224+
selectEvmAddress,
223225
selectRequiredTransactionIds,
224226
],
225227
(
226228
nonReplacedTransactions,
227229
pendingSmartTransactions,
228230
groupEvmAccount,
231+
fallbackEvmAddress,
229232
requiredTransactionIds,
230233
) => {
231-
const activeEvmAddress = groupEvmAccount?.address;
234+
const activeEvmAddress = groupEvmAccount?.address ?? fallbackEvmAddress;
232235

233236
const transactions = nonReplacedTransactions.filter((transaction) => {
234237
if (requiredTransactionIds.has(transaction.id)) {

0 commit comments

Comments
 (0)