@@ -19,6 +19,7 @@ import {
19
19
NetworksTicker ,
20
20
NFT_API_BASE_URL ,
21
21
InfuraNetworkType ,
22
+ convertHexToDecimal ,
22
23
} from '@metamask/controller-utils' ;
23
24
import type { InternalAccount } from '@metamask/keyring-internal-api' ;
24
25
import type {
@@ -1239,6 +1240,7 @@ describe('NftController', () => {
1239
1240
image : 'testERC721Image' ,
1240
1241
name : 'testERC721Name' ,
1241
1242
standard : ERC721 ,
1243
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
1242
1244
} ,
1243
1245
] ,
1244
1246
} ,
@@ -1348,6 +1350,7 @@ describe('NftController', () => {
1348
1350
image : 'testERC721Image' ,
1349
1351
name : 'testERC721Name' ,
1350
1352
standard : ERC721 ,
1353
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
1351
1354
} ,
1352
1355
] ,
1353
1356
} ,
@@ -1408,6 +1411,7 @@ describe('NftController', () => {
1408
1411
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1409
1412
) . toStrictEqual ( {
1410
1413
address : '0x01' ,
1414
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1411
1415
description : 'description' ,
1412
1416
image : 'image' ,
1413
1417
name : 'name' ,
@@ -1539,6 +1543,7 @@ describe('NftController', () => {
1539
1543
nftController . state . allNfts [ firstAddress ] [ ChainId . mainnet ] [ 0 ] ,
1540
1544
) . toStrictEqual ( {
1541
1545
address : '0x01' ,
1546
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1542
1547
description : 'description' ,
1543
1548
image : 'url' ,
1544
1549
name : 'name' ,
@@ -1569,6 +1574,7 @@ describe('NftController', () => {
1569
1574
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1570
1575
) . toStrictEqual ( {
1571
1576
address : '0x01' ,
1577
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1572
1578
description : 'description' ,
1573
1579
image : 'image' ,
1574
1580
name : 'name' ,
@@ -1592,6 +1598,7 @@ describe('NftController', () => {
1592
1598
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1593
1599
) . toStrictEqual ( {
1594
1600
address : '0x01' ,
1601
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1595
1602
description : 'description' ,
1596
1603
image : 'image-updated' ,
1597
1604
name : 'name' ,
@@ -1621,6 +1628,7 @@ describe('NftController', () => {
1621
1628
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1622
1629
) . toStrictEqual ( {
1623
1630
address : '0x01' ,
1631
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1624
1632
description : 'description' ,
1625
1633
image : 'image' ,
1626
1634
name : 'name' ,
@@ -1649,6 +1657,7 @@ describe('NftController', () => {
1649
1657
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1650
1658
) . toStrictEqual ( {
1651
1659
address : '0x01' ,
1660
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1652
1661
description : 'description' ,
1653
1662
image : 'image' ,
1654
1663
name : 'name' ,
@@ -1693,6 +1702,7 @@ describe('NftController', () => {
1693
1702
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1694
1703
) . toStrictEqual ( {
1695
1704
address : '0x01' ,
1705
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1696
1706
description : 'description' ,
1697
1707
image : 'image' ,
1698
1708
name : 'name' ,
@@ -1730,6 +1740,7 @@ describe('NftController', () => {
1730
1740
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1731
1741
) . toStrictEqual ( {
1732
1742
address : '0x01' ,
1743
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1733
1744
description : 'description' ,
1734
1745
image : 'image' ,
1735
1746
name : 'name' ,
@@ -1838,6 +1849,7 @@ describe('NftController', () => {
1838
1849
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1839
1850
) . toStrictEqual ( {
1840
1851
address : '0x01' ,
1852
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1841
1853
description : 'Description' ,
1842
1854
image : 'url' ,
1843
1855
name : 'Name' ,
@@ -1909,6 +1921,7 @@ describe('NftController', () => {
1909
1921
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1910
1922
) . toStrictEqual ( {
1911
1923
address : ERC721_KUDOSADDRESS ,
1924
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
1912
1925
image : 'url' ,
1913
1926
name : 'Kudos Name (directly from tokenURI)' ,
1914
1927
description : 'Kudos Description (directly from tokenURI)' ,
@@ -1998,6 +2011,7 @@ describe('NftController', () => {
1998
2011
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
1999
2012
) . toStrictEqual ( {
2000
2013
address : ERC721_KUDOSADDRESS ,
2014
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2001
2015
image : 'url' ,
2002
2016
name : 'Kudos Name (directly from tokenURI)' ,
2003
2017
description : 'Kudos Description (directly from tokenURI)' ,
@@ -2063,6 +2077,7 @@ describe('NftController', () => {
2063
2077
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
2064
2078
) . toStrictEqual ( {
2065
2079
address : ERC1155_NFT_ADDRESS ,
2080
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2066
2081
image : 'image (directly from tokenURI)' ,
2067
2082
name : 'name (directly from tokenURI)' ,
2068
2083
description : 'description (directly from tokenURI)' ,
@@ -2109,6 +2124,7 @@ describe('NftController', () => {
2109
2124
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
2110
2125
) . toStrictEqual ( {
2111
2126
address : ERC721_KUDOSADDRESS ,
2127
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2112
2128
image : 'Kudos Image (directly from tokenURI)' ,
2113
2129
name : 'Kudos Name (directly from tokenURI)' ,
2114
2130
description : 'Kudos Description (directly from tokenURI)' ,
@@ -2147,6 +2163,7 @@ describe('NftController', () => {
2147
2163
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
2148
2164
) . toStrictEqual ( {
2149
2165
address : ERC721_KUDOSADDRESS ,
2166
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2150
2167
image : testTokenUriEncoded ,
2151
2168
name : null ,
2152
2169
description : null ,
@@ -2188,6 +2205,7 @@ describe('NftController', () => {
2188
2205
] [ 0 ] ,
2189
2206
) . toStrictEqual ( {
2190
2207
address : '0x01' ,
2208
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
2191
2209
description : 'description' ,
2192
2210
image : 'url' ,
2193
2211
name : 'name' ,
@@ -2239,6 +2257,7 @@ describe('NftController', () => {
2239
2257
[ ChainId . mainnet ] : [
2240
2258
{
2241
2259
address : '0x01234abcdefg' ,
2260
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2242
2261
description : 'description' ,
2243
2262
image : 'url' ,
2244
2263
name : 'name' ,
@@ -2303,6 +2322,7 @@ describe('NftController', () => {
2303
2322
[ GOERLI . chainId ] : [
2304
2323
{
2305
2324
address : '0x01234abcdefg' ,
2325
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
2306
2326
description : 'description' ,
2307
2327
image : 'url' ,
2308
2328
name : 'name' ,
@@ -2396,6 +2416,7 @@ describe('NftController', () => {
2396
2416
) . toStrictEqual ( [
2397
2417
{
2398
2418
address : ERC721_KUDOSADDRESS ,
2419
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2399
2420
description : 'Kudos Description' ,
2400
2421
image : 'Kudos image (from proxy API)' ,
2401
2422
name : 'Kudos Name' ,
@@ -2518,6 +2539,7 @@ describe('NftController', () => {
2518
2539
) . toStrictEqual ( [
2519
2540
{
2520
2541
address : ERC721_KUDOSADDRESS ,
2542
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2521
2543
description : 'Kudos Description' ,
2522
2544
image : 'Kudos image (from proxy API)' ,
2523
2545
name : 'Kudos Name' ,
@@ -2698,6 +2720,7 @@ describe('NftController', () => {
2698
2720
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
2699
2721
) . toStrictEqual ( {
2700
2722
address : ERC721_DEPRESSIONIST_ADDRESS ,
2723
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2701
2724
tokenId : '36' ,
2702
2725
image : 'image' ,
2703
2726
name : 'name' ,
@@ -2724,6 +2747,7 @@ describe('NftController', () => {
2724
2747
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
2725
2748
) . toStrictEqual ( {
2726
2749
address : ERC721_NFT_ADDRESS ,
2750
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2727
2751
image : null ,
2728
2752
name : null ,
2729
2753
description : null ,
@@ -2810,6 +2834,7 @@ describe('NftController', () => {
2810
2834
) . toStrictEqual ( [
2811
2835
{
2812
2836
address : '0x01' ,
2837
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
2813
2838
description : 'test-description-1' ,
2814
2839
image : 'test-image-1' ,
2815
2840
name : 'test-name-1' ,
@@ -2826,6 +2851,7 @@ describe('NftController', () => {
2826
2851
) . toStrictEqual ( [
2827
2852
{
2828
2853
address : '0x02' ,
2854
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
2829
2855
description : 'test-description-2' ,
2830
2856
image : 'test-image-2' ,
2831
2857
name : 'test-name-2' ,
@@ -2840,6 +2866,7 @@ describe('NftController', () => {
2840
2866
expect ( nftController . state . allNfts [ OWNER_ADDRESS ] [ '0xa' ] ) . toStrictEqual ( [
2841
2867
{
2842
2868
address : '0x03' ,
2869
+ chainId : convertHexToDecimal ( '0xa' ) ,
2843
2870
description : 'test-description-3' ,
2844
2871
image : 'test-image-3' ,
2845
2872
name : 'test-name-3' ,
@@ -2926,6 +2953,7 @@ describe('NftController', () => {
2926
2953
expect ( nftController . state . allNfts [ userAddress ] [ '0x1' ] ) . toStrictEqual ( [
2927
2954
{
2928
2955
address : '0x01' ,
2956
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
2929
2957
description : 'test-description-1' ,
2930
2958
image : 'test-image-1' ,
2931
2959
name : 'test-name-1' ,
@@ -2941,6 +2969,7 @@ describe('NftController', () => {
2941
2969
) . toStrictEqual ( [
2942
2970
{
2943
2971
address : '0x02' ,
2972
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
2944
2973
description : 'test-description-2' ,
2945
2974
image : 'test-image-2' ,
2946
2975
name : 'test-name-2' ,
@@ -2956,6 +2985,7 @@ describe('NftController', () => {
2956
2985
) . toStrictEqual ( [
2957
2986
{
2958
2987
address : '0x03' ,
2988
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
2959
2989
description : 'test-description-3' ,
2960
2990
image : 'test-image-3' ,
2961
2991
name : 'test-name-3' ,
@@ -3050,6 +3080,7 @@ describe('NftController', () => {
3050
3080
nftController . state . allNfts [ firstAccount . address ] [ ChainId . mainnet ] [ 0 ] ,
3051
3081
) . toStrictEqual ( {
3052
3082
address : '0x01' ,
3083
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
3053
3084
description : 'description' ,
3054
3085
image : 'url' ,
3055
3086
name : 'name' ,
@@ -3142,6 +3173,7 @@ describe('NftController', () => {
3142
3173
nftController . state . allNfts [ firstAccount . address ] [ SEPOLIA . chainId ] [ 0 ] ,
3143
3174
) . toStrictEqual ( {
3144
3175
address : '0x01' ,
3176
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
3145
3177
description : 'description' ,
3146
3178
image : 'url' ,
3147
3179
name : 'name' ,
@@ -3155,6 +3187,7 @@ describe('NftController', () => {
3155
3187
nftController . state . allNfts [ secondAccount . address ] [ GOERLI . chainId ] [ 0 ] ,
3156
3188
) . toStrictEqual ( {
3157
3189
address : '0x02' ,
3190
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
3158
3191
description : 'description' ,
3159
3192
image : 'url' ,
3160
3193
name : 'name' ,
@@ -3210,6 +3243,7 @@ describe('NftController', () => {
3210
3243
nftController . state . allNfts [ firstAddress ] [ SEPOLIA . chainId ] [ 0 ] ,
3211
3244
) . toStrictEqual ( {
3212
3245
address : '0x01' ,
3246
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
3213
3247
description : 'description' ,
3214
3248
image : 'url' ,
3215
3249
name : 'name' ,
@@ -3223,6 +3257,7 @@ describe('NftController', () => {
3223
3257
nftController . state . allNfts [ secondAddress ] [ GOERLI . chainId ] [ 0 ] ,
3224
3258
) . toStrictEqual ( {
3225
3259
address : '0x02' ,
3260
+ chainId : convertHexToDecimal ( ChainId . goerli ) ,
3226
3261
description : 'description' ,
3227
3262
image : 'url' ,
3228
3263
name : 'name' ,
@@ -3345,6 +3380,7 @@ describe('NftController', () => {
3345
3380
nftController . state . allNfts [ firstAccount . address ] [ ChainId . mainnet ] [ 0 ] ,
3346
3381
) . toStrictEqual ( {
3347
3382
address : '0x02' ,
3383
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
3348
3384
description : 'description' ,
3349
3385
image : 'url' ,
3350
3386
name : 'name' ,
@@ -3384,6 +3420,7 @@ describe('NftController', () => {
3384
3420
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ SEPOLIA . chainId ] [ 0 ] ,
3385
3421
) . toStrictEqual ( {
3386
3422
address : '0x02' ,
3423
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
3387
3424
description : 'description' ,
3388
3425
image : 'url' ,
3389
3426
name : 'name' ,
@@ -3436,6 +3473,7 @@ describe('NftController', () => {
3436
3473
nftController . state . allNfts [ userAddress1 ] [ SEPOLIA . chainId ] [ 0 ] ,
3437
3474
) . toStrictEqual ( {
3438
3475
address : '0x01' ,
3476
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
3439
3477
description : 'description' ,
3440
3478
image : 'image' ,
3441
3479
name : 'name' ,
@@ -3638,6 +3676,7 @@ describe('NftController', () => {
3638
3676
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ ChainId . mainnet ] [ 0 ] ,
3639
3677
) . toStrictEqual ( {
3640
3678
address : ERC1155_NFT_ADDRESS ,
3679
+ chainId : convertHexToDecimal ( ChainId . mainnet ) ,
3641
3680
name : null ,
3642
3681
description : null ,
3643
3682
image : null ,
@@ -4622,6 +4661,7 @@ describe('NftController', () => {
4622
4661
nftController . state . allNfts [ OWNER_ACCOUNT . address ] [ SEPOLIA . chainId ] [ 0 ] ,
4623
4662
) . toStrictEqual ( {
4624
4663
address : '0xtest' ,
4664
+ chainId : convertHexToDecimal ( ChainId . sepolia ) ,
4625
4665
description : 'description' ,
4626
4666
favorite : false ,
4627
4667
image : 'image.png' ,
0 commit comments