mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
add networks without ticker trait (#14607)
* add networks without ticker trait
This commit is contained in:
parent
eee4cc3100
commit
ae4efef43e
@ -558,6 +558,15 @@ export default class MetaMetricsController {
|
||||
[TRAITS.NETWORKS_ADDED]: metamaskState.frequentRpcListDetail.map(
|
||||
(rpc) => rpc.chainId,
|
||||
),
|
||||
[TRAITS.NETWORKS_WITHOUT_TICKER]: metamaskState.frequentRpcListDetail.reduce(
|
||||
(networkList, currentNetwork) => {
|
||||
if (!currentNetwork.ticker) {
|
||||
networkList.push(currentNetwork.chainId);
|
||||
}
|
||||
return networkList;
|
||||
},
|
||||
[],
|
||||
),
|
||||
[TRAITS.NFT_AUTODETECTION_ENABLED]: metamaskState.useCollectibleDetection,
|
||||
[TRAITS.NUMBER_OF_ACCOUNTS]: Object.values(metamaskState.identities)
|
||||
.length,
|
||||
|
@ -9,8 +9,10 @@ import {
|
||||
} from '../../../shared/constants/metametrics';
|
||||
import waitUntilCalled from '../../../test/lib/wait-until-called';
|
||||
import {
|
||||
ETH_SYMBOL,
|
||||
MAINNET_CHAIN_ID,
|
||||
ROPSTEN_CHAIN_ID,
|
||||
TEST_ETH_SYMBOL,
|
||||
} from '../../../shared/constants/network';
|
||||
import MetaMetricsController from './metametrics';
|
||||
import { NETWORK_EVENTS } from './network';
|
||||
@ -673,8 +675,9 @@ describe('MetaMetricsController', function () {
|
||||
},
|
||||
allTokens: MOCK_ALL_TOKENS,
|
||||
frequentRpcListDetail: [
|
||||
{ chainId: MAINNET_CHAIN_ID },
|
||||
{ chainId: ROPSTEN_CHAIN_ID },
|
||||
{ chainId: MAINNET_CHAIN_ID, ticker: ETH_SYMBOL },
|
||||
{ chainId: ROPSTEN_CHAIN_ID, ticker: TEST_ETH_SYMBOL },
|
||||
{ chainId: '0xaf' },
|
||||
],
|
||||
identities: [{}, {}],
|
||||
ledgerTransportType: 'web-hid',
|
||||
@ -688,7 +691,8 @@ describe('MetaMetricsController', function () {
|
||||
assert.deepEqual(traits, {
|
||||
[TRAITS.ADDRESS_BOOK_ENTRIES]: 3,
|
||||
[TRAITS.LEDGER_CONNECTION_TYPE]: 'web-hid',
|
||||
[TRAITS.NETWORKS_ADDED]: [MAINNET_CHAIN_ID, ROPSTEN_CHAIN_ID],
|
||||
[TRAITS.NETWORKS_ADDED]: [MAINNET_CHAIN_ID, ROPSTEN_CHAIN_ID, '0xaf'],
|
||||
[TRAITS.NETWORKS_WITHOUT_TICKER]: ['0xaf'],
|
||||
[TRAITS.NFT_AUTODETECTION_ENABLED]: false,
|
||||
[TRAITS.NUMBER_OF_ACCOUNTS]: 2,
|
||||
[TRAITS.NUMBER_OF_NFT_COLLECTIONS]: 3,
|
||||
|
@ -164,6 +164,9 @@
|
||||
* trait
|
||||
* @property {'networks_added'} NETWORKS_ADDED - when user modifies networks
|
||||
* we identify the networks_added trait
|
||||
* @property {'networks_without_ticker'} NETWORKS_WITHOUT_TICKER - when user
|
||||
* modifies networks we identify the networks_without_ticker trait for
|
||||
* networks without a ticker.
|
||||
* @property {'nft_autodetection_enabled'} NFT_AUTODETECTION_ENABLED - when Autodetect NFTs
|
||||
* feature is toggled we identify the nft_autodetection_enabled trait
|
||||
* @property {'number_of_accounts'} NUMBER_OF_ACCOUNTS - when identities
|
||||
@ -191,6 +194,7 @@ export const TRAITS = {
|
||||
ADDRESS_BOOK_ENTRIES: 'address_book_entries',
|
||||
LEDGER_CONNECTION_TYPE: 'ledger_connection_type',
|
||||
NETWORKS_ADDED: 'networks_added',
|
||||
NETWORKS_WITHOUT_TICKER: 'networks_without_ticker',
|
||||
NFT_AUTODETECTION_ENABLED: 'nft_autodetection_enabled',
|
||||
NUMBER_OF_ACCOUNTS: 'number_of_accounts',
|
||||
NUMBER_OF_NFT_COLLECTIONS: 'number_of_nft_collections',
|
||||
@ -210,6 +214,9 @@ export const TRAITS = {
|
||||
* type of ledger connection set by user preference.
|
||||
* @property {Array<string>} [networks_added] - An array consisting of chainIds
|
||||
* that indicate the networks a user has added to their MetaMask.
|
||||
* @property {Array<string>} [networks_without_ticker] - An array consisting of
|
||||
* chainIds that indicate the networks added by the user that do not have a
|
||||
* ticker.
|
||||
* @property {number} [nft_autodetection_enabled] - does the user have the
|
||||
* use collection/nft detection enabled?
|
||||
* @property {number} [number_of_accounts] - A number representing the number
|
||||
|
Loading…
Reference in New Issue
Block a user