11import { AccountGroupId } from '@metamask/account-api' ;
22import type { Transaction } from '@metamask/keyring-api' ;
33import type { MultichainTransactionsControllerState } from '@metamask/multichain-transactions-controller' ;
4+ import { MultichainNetworks } from '../../shared/constants/multichain/networks' ;
45import type { MetaMaskReduxState as _MetaMaskReduxState } from '../store/store' ;
56import { generateTokenCacheKey } from '../helpers/utils/token-scan' ;
67import type { AccountTreeState } from './multichain-accounts/account-tree.types' ;
@@ -18,8 +19,6 @@ jest.mock('./multichain-accounts/account-tree', () => {
1819 } ;
1920} ) ;
2021
21- const SOLANA_MAINNET = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' ;
22-
2322type NonEvmTransactionsMap =
2423 MultichainTransactionsControllerState [ 'nonEvmTransactions' ] ;
2524
@@ -46,7 +45,7 @@ function buildState(
4645 metamask : {
4746 nonEvmTransactions : nonEvmTransactions as NonEvmTransactionsMap ,
4847 enabledNetworkMap : {
49- solana : { [ SOLANA_MAINNET ] : true } ,
48+ solana : { [ MultichainNetworks . SOLANA ] : true } ,
5049 } ,
5150 tokenScanCache : tokenScanCache ?? { } ,
5251 } ,
@@ -57,25 +56,25 @@ describe('selectNonEvmTransactionsForActivity', () => {
5756 it ( 'filters malicious non-EVM token transactions' , ( ) => {
5857 const maliciousTx = {
5958 id : 'bad-tx' ,
60- chain : SOLANA_MAINNET ,
59+ chain : MultichainNetworks . SOLANA ,
6160 from : [
6261 {
6362 asset : {
6463 fungible : true ,
65- type : `${ SOLANA_MAINNET } /token:BadMint111` ,
64+ type : `${ MultichainNetworks . SOLANA } /token:BadMint111` ,
6665 } ,
6766 } ,
6867 ] ,
6968 to : [ ] ,
7069 } as unknown as Transaction ;
7170 const benignTx = {
7271 id : 'good-tx' ,
73- chain : SOLANA_MAINNET ,
72+ chain : MultichainNetworks . SOLANA ,
7473 from : [
7574 {
7675 asset : {
7776 fungible : true ,
78- type : `${ SOLANA_MAINNET } /token:GoodMint222` ,
77+ type : `${ MultichainNetworks . SOLANA } /token:GoodMint222` ,
7978 } ,
8079 } ,
8180 ] ,
@@ -85,15 +84,15 @@ describe('selectNonEvmTransactionsForActivity', () => {
8584 const state = buildState (
8685 {
8786 'acc-1' : {
88- [ SOLANA_MAINNET ] : {
87+ [ MultichainNetworks . SOLANA ] : {
8988 transactions : [ maliciousTx , benignTx ] ,
9089 next : null ,
9190 lastUpdated : 0 ,
9291 } ,
9392 } ,
9493 } ,
9594 {
96- [ generateTokenCacheKey ( SOLANA_MAINNET , 'BadMint111' ) ] : {
95+ [ generateTokenCacheKey ( MultichainNetworks . SOLANA , 'BadMint111' ) ] : {
9796 data : {
9897 // eslint-disable-next-line @typescript-eslint/naming-convention
9998 result_type : 'Malicious' ,
@@ -104,48 +103,4 @@ describe('selectNonEvmTransactionsForActivity', () => {
104103
105104 expect ( selectNonEvmTransactionsForActivity ( state ) ) . toEqual ( [ benignTx ] ) ;
106105 } ) ;
107-
108- it ( 'keeps native-only and uncached token transactions visible' , ( ) => {
109- const nativeOnlyTx = {
110- id : 'native-tx' ,
111- chain : SOLANA_MAINNET ,
112- from : [
113- {
114- asset : {
115- fungible : true ,
116- type : `${ SOLANA_MAINNET } /slip44:501` ,
117- } ,
118- } ,
119- ] ,
120- to : [ ] ,
121- } as unknown as Transaction ;
122- const uncachedTokenTx = {
123- id : 'uncached-token-tx' ,
124- chain : SOLANA_MAINNET ,
125- from : [
126- {
127- asset : {
128- fungible : true ,
129- type : `${ SOLANA_MAINNET } /token:UnknownMint333` ,
130- } ,
131- } ,
132- ] ,
133- to : [ ] ,
134- } as unknown as Transaction ;
135-
136- const state = buildState ( {
137- 'acc-1' : {
138- [ SOLANA_MAINNET ] : {
139- transactions : [ nativeOnlyTx , uncachedTokenTx ] ,
140- next : null ,
141- lastUpdated : 0 ,
142- } ,
143- } ,
144- } ) ;
145-
146- expect ( selectNonEvmTransactionsForActivity ( state ) ) . toEqual ( [
147- nativeOnlyTx ,
148- uncachedTokenTx ,
149- ] ) ;
150- } ) ;
151106} ) ;
0 commit comments