mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Update cmc generation script (#2143)
This commit is contained in:
parent
7b60179237
commit
5a9e2a8622
1
.github/workflows/daily_update.yml
vendored
1
.github/workflows/daily_update.yml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
|||
npm run resize
|
||||
npm run format:all
|
||||
npm run gen:list
|
||||
npm run map:cmc
|
||||
- name: Run test
|
||||
run: npm t
|
||||
- name: Commit changes if any
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"description": "Assets consumed by Trust Wallet",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"pre-test": "",
|
||||
"test": "npm run cleanup && jest",
|
||||
"pre-test": "npm run cleanup",
|
||||
"test": "npm run pre-test && jest",
|
||||
"cleanup": "find ./.. -iname '.DS_Store' -type f -delete",
|
||||
"update:bep2": "npm run cleanup && node ./script/updateBEP2",
|
||||
"checksum": "npm run cleanup && ts-node ./script/erc20_to_checksum",
|
||||
|
|
|
@ -443,6 +443,12 @@
|
|||
"type": "coin",
|
||||
"id": 1008
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xa83aF809975619477Af73B179e05e04A1CcEA953",
|
||||
"id": 1022
|
||||
},
|
||||
{
|
||||
"coin": 355,
|
||||
"type": "coin",
|
||||
|
@ -848,12 +854,6 @@
|
|||
"token_id": "0x960b236A07cf122663c4303350609A66A7B288C0",
|
||||
"id": 1680
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xcCeD5B8288086BE8c38E23567e684C3740be4D48",
|
||||
"id": 1683
|
||||
},
|
||||
{
|
||||
"coin": 2301,
|
||||
"type": "coin",
|
||||
|
@ -1637,12 +1637,6 @@
|
|||
"type": "coin",
|
||||
"id": 2062
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x30ceCB5461A449A90081F5a5F55db4e048397BAB",
|
||||
"id": 2063
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -3149,9 +3143,8 @@
|
|||
"id": 2529
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xD0352a019e9AB9d757776F532377aAEbd36Fd541",
|
||||
"coin": 288,
|
||||
"type": "coin",
|
||||
"id": 2530
|
||||
},
|
||||
{
|
||||
|
@ -3730,12 +3723,6 @@
|
|||
"token_id": "0xbCdfE338D55c061C084D81fD793Ded00A27F226D",
|
||||
"id": 2679
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xE34e1944E776f39B9252790a0527eBDa647aE668",
|
||||
"id": 2680
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -3979,12 +3966,6 @@
|
|||
"token_id": "0x8713d26637CF49e1b6B4a7Ce57106AaBc9325343",
|
||||
"id": 2735
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x6ea6531b603F270d23d9EDd2d8279135DC5D6773",
|
||||
"id": 2736
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -4173,6 +4154,12 @@
|
|||
"token_id": "0x5Cf04716BA20127F1E2297AdDCf4B5035000c9eb",
|
||||
"id": 2780
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x588047365dF5BA589F923604AAC23d673555c623",
|
||||
"id": 2825
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -4596,12 +4583,6 @@
|
|||
"token_id": "0xF8e06E4e4A80287FDCa5b02dcCecAa9D0954840F",
|
||||
"id": 2929
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x5DBAC24e98E2a4f43ADC0DC82Af403fca063Ce2c",
|
||||
"id": 2931
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -4932,12 +4913,6 @@
|
|||
"type": "coin",
|
||||
"id": 3023
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x0E69D0A2bbB30aBcB7e5CfEA0E4FDe19C00A8d47",
|
||||
"id": 3026
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -6824,12 +6799,6 @@
|
|||
"token_id": "0xE99A894a69d7c2e3C92E61B64C505A6a57d2bC07",
|
||||
"id": 3695
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xFe1D71498DA3261844eC14325bdbc93c0F7579f0",
|
||||
"id": 3697
|
||||
},
|
||||
{
|
||||
"coin": 7825267,
|
||||
"type": "coin",
|
||||
|
@ -6845,12 +6814,6 @@
|
|||
"type": "coin",
|
||||
"id": 3704
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xF3e70642c28f3F707408c56624c2F30eA9F9FcE3",
|
||||
"id": 3706
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -7352,7 +7315,7 @@
|
|||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x57652Fc91f522f9EFF0b38CDF1D51f5FB5764215",
|
||||
"token_id": "0x4257D9C82767D0Bf1E53e14CdEE1e9CE50eBdc3b",
|
||||
"id": 3827
|
||||
},
|
||||
{
|
||||
|
@ -7457,9 +7420,8 @@
|
|||
"id": 3853
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xBE6ac6B50F577205c9D107f37b6E205aA6ACC5D4",
|
||||
"coin": 5555,
|
||||
"type": "coin",
|
||||
"id": 3854
|
||||
},
|
||||
{
|
||||
|
@ -8014,12 +7976,6 @@
|
|||
"type": "coin",
|
||||
"id": 3997
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x42566cFEFC853c232117EbA4413e45782a72715d",
|
||||
"id": 3998
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -8249,6 +8205,12 @@
|
|||
"token_id": "0x8515cD0f00aD81996d24b9A9C35121a3b759D6Cd",
|
||||
"id": 4069
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xDB13025b219dB5e4529f48b65Ff009a26B6Ae733",
|
||||
"id": 4071
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -8785,6 +8747,11 @@
|
|||
"token_id": "0x01C0987E88F778DF6640787226bc96354E1a9766",
|
||||
"id": 4262
|
||||
},
|
||||
{
|
||||
"coin": 19169,
|
||||
"type": "coin",
|
||||
"id": 4264
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -8868,12 +8835,6 @@
|
|||
"token_id": "0xdfbc9050F5B01DF53512DCC39B4f2B2BBaCD517A",
|
||||
"id": 4287
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xdfbc9050F5B01DF53512DCC39B4f2B2BBaCD517A",
|
||||
"id": 4287
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -8922,6 +8883,12 @@
|
|||
"token_id": "0x2730d6FdC86C95a74253BefFaA8306B40feDecbb",
|
||||
"id": 4307
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x9388F54FA978Aa9e24395a8b69033304ECcea4df",
|
||||
"id": 4325
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9272,6 +9239,12 @@
|
|||
"token_id": "0x31274db8b609Df99E5988ee527071643b5160Fc3",
|
||||
"id": 4714
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xa00a4d5786a6E955e9539d01D78Bf68f3271C050",
|
||||
"id": 4746
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9383,6 +9356,12 @@
|
|||
"token_id": "0x58959E0C71080434f237bD42d07Cd84B74CeF438",
|
||||
"id": 4806
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x9669890e48f330ACD88b78D63E1A6b3482652CD9",
|
||||
"id": 4808
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9751,12 +9730,6 @@
|
|||
"token_id": "0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39",
|
||||
"id": 5015
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xEb70bbf15Fd1c0542896A80f2aF90C8FD40a9ec5",
|
||||
"id": 5016
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9792,12 +9765,6 @@
|
|||
"type": "coin",
|
||||
"id": 5034
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x38A0df9a08d18dc06CD91Fc7Ec94a0AcdF28D994",
|
||||
"id": 5037
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9825,7 +9792,7 @@
|
|||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x83cAEECace9Ec5c322c93743B2B370ED58951F5c",
|
||||
"token_id": "0xB020eD54651831878E5C967e0953A900786178f9",
|
||||
"id": 5050
|
||||
},
|
||||
{
|
||||
|
@ -9930,6 +9897,12 @@
|
|||
"token_id": "0x0d2BB9D68dD4451A09ec94C05E20Bd395022bd8e",
|
||||
"id": 5087
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x7F969C4D388Ca0AE39A4FdDB1A6f89878CA2fBf8",
|
||||
"id": 5090
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9984,6 +9957,11 @@
|
|||
"token_id": "0xa90C43e0d6c92b8e6171a829beB38Be28a0Ad073",
|
||||
"id": 5124
|
||||
},
|
||||
{
|
||||
"coin": 1027,
|
||||
"type": "coin",
|
||||
"id": 5125
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -9998,8 +9976,8 @@
|
|||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x4AFAdB32b8fdB334cF9f20AFb476A06c1F5b111A",
|
||||
"id": 5133
|
||||
"token_id": "0xAb418c5A8a85f9cC0fbA1802a57a30Bf7dB34d7C",
|
||||
"id": 5152
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
|
@ -10153,12 +10131,6 @@
|
|||
"token_id": "0x19fFfd124CD9089E21026d10dA97f8cD6B442Bff",
|
||||
"id": 5247
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x4F34adfff48CEB4Af2f3b2253CdFdcC99c9053F4",
|
||||
"id": 5248
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10177,12 +10149,6 @@
|
|||
"token_id": "0xd9af2d11d788da0097076f4Eb21bd1C5533743D9",
|
||||
"id": 5255
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xf51EBf9a26DbC02B13F8B3a9110dac47a4d62D78",
|
||||
"id": 5258
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10250,14 +10216,14 @@
|
|||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x026f8D523D49F36db657e012C96488465d8d88f9",
|
||||
"id": 5289
|
||||
"token_id": "0xBFc1502EBC37475B940CED8F036B91018a73C8F6",
|
||||
"id": 5288
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x3212b29E33587A00FB1C83346f5dBFA69A458923",
|
||||
"id": 5292
|
||||
"token_id": "0x026f8D523D49F36db657e012C96488465d8d88f9",
|
||||
"id": 5289
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
|
@ -10468,36 +10434,6 @@
|
|||
"token_id": "TYM9eM22SCynRc5YaMxE2PX1kwv7H2rXAu",
|
||||
"id": 5407
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x27c1bA4F85b8dC1c150157816623A6Ce80b7F187",
|
||||
"id": 5412
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x94FC5934cF5970E944a67de806eEB5a4b493c6E6",
|
||||
"id": 5413
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xeaD7F3ae4e0Bb0D8785852Cc37CC9d0B5e75c06a",
|
||||
"id": 5414
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x3d3dd61b0F9A558759a21dA42166042B114E12D5",
|
||||
"id": 5415
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x9205C049C231DdA51bAce0ba569f047E3E1e9979",
|
||||
"id": 5418
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10593,42 +10529,12 @@
|
|||
"token_id": "TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT",
|
||||
"id": 5446
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x108D27F9c4b2A98C025c94c76Ca78c6Ce6C7A4eB",
|
||||
"id": 5448
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xbB97e381F1d1e94ffa2A5844F6875e6146981009",
|
||||
"id": 5450
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x59aF0356cdeBd1fa23Ae5dADfF9170BbFC31278c",
|
||||
"id": 5457
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xBe68b4645Ab798ED4dB88192a444898ff4FDa5Ae",
|
||||
"id": 5458
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xCe49c3c92b33a1653F34811a9d7e34502bF12B89",
|
||||
"id": 5459
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x6e13A9e4AE3d0678E511Fb6d2ad531fcF0e247bf",
|
||||
"id": 5460
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10647,12 +10553,6 @@
|
|||
"token_id": "0xbc41d05287498DEc58129560De6bd1b8d4E3aC1d",
|
||||
"id": 5463
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x8AF17a6396c8f315f6b6DBC6AA686C85f9b3E554",
|
||||
"id": 5464
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10665,24 +10565,12 @@
|
|||
"token_id": "0xa9fC65Da36064cE545e87690e06f5de10C52C690",
|
||||
"id": 5466
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x4C133E081dFB5858e39ccA74E69bf603d409e57A",
|
||||
"id": 5467
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x42726d074BBa68Ccc15200442B72Afa2D495A783",
|
||||
"id": 5468
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xd7E1e4530D95717506633E58437f056A49c1FABB",
|
||||
"id": 5469
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10707,6 +10595,12 @@
|
|||
"token_id": "0x4E12EB8e506Ccd1427F6b8F7faa3e88fB698EB28",
|
||||
"id": 5486
|
||||
},
|
||||
{
|
||||
"coin": 195,
|
||||
"type": "token",
|
||||
"token_id": "TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9",
|
||||
"id": 5488
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
|
@ -10723,5 +10617,100 @@
|
|||
"coin": 51,
|
||||
"type": "coin",
|
||||
"id": 5511
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x58002A6B6E659A16dE9F02F529B10536E307b0d9",
|
||||
"id": 5513
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xcD62b1C403fa761BAadFC74C525ce2B51780b184",
|
||||
"id": 5523
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x627e2Ee3dbDA546e168eaAFF25A2C5212E4A95a0",
|
||||
"id": 5534
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xCaBeC58a571979f9fE825885fcb8F7A93892eaB0",
|
||||
"id": 5546
|
||||
},
|
||||
{
|
||||
"coin": 297,
|
||||
"type": "coin",
|
||||
"id": 5548
|
||||
},
|
||||
{
|
||||
"coin": 195,
|
||||
"type": "token",
|
||||
"token_id": "TTcrrfqhaMs5Y3pE7jnSk8j8g3J3t52GVC",
|
||||
"id": 5563
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xcDd0A6B15B49A9eb3Ce011CCE22FAc2ccf09ecE6",
|
||||
"id": 5564
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC",
|
||||
"id": 5566
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xCa208BfD69ae6D2667f1FCbE681BAe12767c0078",
|
||||
"id": 5572
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xEe059F0ca1507e4E20C689b20CFf71B5E924f7bd",
|
||||
"id": 5577
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xE48972fCd82a274411c01834e2f031D4377Fa2c0",
|
||||
"id": 5587
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x147faF8De9d8D8DAAE129B187F0D02D819126750",
|
||||
"id": 5590
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0xC7e43A1c8E118aA2965F5EAbe0e718D83DB7A63C",
|
||||
"id": 5594
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x646b41183bB0d18c01f75f630688D613A5774dC7",
|
||||
"id": 5597
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x89Fb927240750c1B15d4743cd58440fc5f14A11C",
|
||||
"id": 5600
|
||||
},
|
||||
{
|
||||
"coin": 60,
|
||||
"type": "token",
|
||||
"token_id": "0x0Ae055097C6d159879521C384F1D2123D1f195e6",
|
||||
"id": 5601
|
||||
}
|
||||
]
|
|
@ -26,8 +26,6 @@ import { CoinType } from "@trustwallet/types";
|
|||
|
||||
const CMC_PRO_API_KEY = `df781835-e5f4-4448-8b0a-fe31402ab3af` // Free Basic Plan api key is enough to run script
|
||||
const CMC_LATEST_BASE_URL = `https://pro-api.coinmarketcap.com/v1/global-metrics/quotes/latest?`
|
||||
const CONTRACTS_PATH = path.join(__dirname, 'mapping.json')
|
||||
const wstream = fs.createWriteStream(CONTRACTS_PATH)
|
||||
const typeToken = TickerType.Token
|
||||
const typeCoin = TickerType.Coin
|
||||
const mappedChainsBlacklistAssets = {} // {ethereum: {<0x...>: ""},}
|
||||
|
@ -35,7 +33,6 @@ const mappedChainsWhitelistAssets = {} // {ethereum: {<0x...>: ""},}
|
|||
|
||||
const custom: mapTiker[] = [
|
||||
{"coin": 60, "type": typeToken, "token_id": "0x6758B7d441a9739b98552B373703d8d3d14f9e62", "id": 2548}, // POA ERC20 on Foundation (POA20)
|
||||
// {"coin": 0, "type": typeCoin, "id": 825}, // Tether (OMNI)
|
||||
{"coin": 60, "type": typeToken, "token_id": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "id": 825}, // Tether (ERC20)
|
||||
{"coin": 195, "type": typeToken, "token_id": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "id": 825}, // Tether (TRC20)
|
||||
{"coin": 1023, "type": typeCoin, "id": 3945}, // Harmony ONE mainnet
|
||||
|
@ -47,9 +44,7 @@ const custom: mapTiker[] = [
|
|||
{"coin": 818, "type": typeToken, "token_id": "0x0000000000000000000000000000456E65726779", "id": 3012}, // VeThor Token (VTHO)
|
||||
{"coin": 459, "type": typeCoin, "id": 4846}, // KAVA coin
|
||||
{"coin": 60, "type": typeToken, "token_id": "0xFA1a856Cfa3409CFa145Fa4e20Eb270dF3EB21ab", "id": 2405}, // IOST (ERC20)
|
||||
//
|
||||
{"coin": 60, "type": typeToken, "token_id": "0x2fe39f22EAC6d3c1C86DD9D143640EbB94609FCE", "id": 4929}, // JDC Coin (ERC20)
|
||||
{"coin": 60, "type": typeToken, "token_id": "0xdfbc9050F5B01DF53512DCC39B4f2B2BBaCD517A", "id": 4287}, // new Jobchain (JOB)
|
||||
{"coin": 60, "type": typeToken, "token_id": "0x5Cf04716BA20127F1E2297AdDCf4B5035000c9eb", "id": 2780}, // NKN (NKN)
|
||||
{"coin": 714, "type": typeToken, "token_id": "CHZ-ECD", "id": 4066}, // Chiliz (BEP-2)
|
||||
{"coin": 60, "type": typeToken, "token_id": "0xdF1D6405df92d981a2fB3ce68F6A03baC6C0E41F", "id": 3816}, // VERA (VRA)
|
||||
|
@ -61,11 +56,6 @@ const custom: mapTiker[] = [
|
|||
// {"coin": 60, "type": typeToken, "token_id": "XXX", "id": XXX}, // XXX (XXX)
|
||||
]
|
||||
|
||||
const permanentRemove = [
|
||||
"0x17280DA053596E097604839C61A2eF5efb7d493f", // old Jobchain (JOB)
|
||||
"0x85e076361cc813A908Ff672F9BAd1541474402b2", // old Telcoin (TEL)
|
||||
]
|
||||
|
||||
const allContracts: mapTiker[] = [] // Temp storage for mapped assets
|
||||
let bip44Constants = {}
|
||||
let bnbOwnerToSymbol = {} // e.g: bnb1tawge8u97slduhhtumm03l4xl4c46dwv5m9yzk: WISH-2D5
|
||||
|
@ -73,32 +63,23 @@ let bnbOriginalSymbolToSymbol = {} // e.g: WISH: WISH-2D5
|
|||
|
||||
run()
|
||||
async function run() {
|
||||
await initState()
|
||||
try {
|
||||
const totalCrypto = await getTotalActiveCryptocurrencies()
|
||||
await setBinanceTokens()
|
||||
await Promise.all([initState(), setBinanceTokens()])
|
||||
const [totalCrypto, coins] = await Promise.all([getTotalActiveCryptocurrencies(), getTickers()])
|
||||
// setBIP44Constants()
|
||||
log(`Found ${totalCrypto} on CMC`, chalk.yellowBright)
|
||||
const maxLimit = 200
|
||||
// for (let start = 1; start < totalCrypto; start += maxLimit) {
|
||||
// const coins = await getTickers({start, limit: maxLimit})
|
||||
const coins = await getTickers()
|
||||
// log(`Processgin range ${start} - ${start + maxLimit} of ${totalCrypto}`, chalk.yellow)
|
||||
await BluebirbPromise.mapSeries(coins, processCoin)
|
||||
// }
|
||||
|
||||
addCustom()
|
||||
printContracts()
|
||||
|
||||
} catch (error) {
|
||||
log(`Error at the end ${error.message}`)
|
||||
wstream.write(`}`)
|
||||
}
|
||||
}
|
||||
|
||||
async function processCoin(coin) {
|
||||
const { id, symbol, name, platform } = coin
|
||||
const platformType: PlatformType = platform == null ? "" : platform.name
|
||||
|
||||
log(`${symbol}:${platformType}`)
|
||||
// await BluebirbPromise.mapSeries(types, async type => {
|
||||
switch (platformType) {
|
||||
|
@ -107,7 +88,7 @@ async function processCoin(coin) {
|
|||
if (platform.token_address) {
|
||||
try {
|
||||
const checksum = toChecksum(platform.token_address)
|
||||
if (permanentRemove.indexOf(checksum) == -1) {
|
||||
if (!isAddressInBlackList("ethereum", checksum)) {
|
||||
log(`Added ${checksum}`)
|
||||
addToContractsList({
|
||||
coin: 60,
|
||||
|
@ -116,7 +97,7 @@ async function processCoin(coin) {
|
|||
id
|
||||
})
|
||||
}
|
||||
await getImageIfMissing(getChainName(CoinType.ethereum), checksum, id)
|
||||
// await getImageIfMissing(getChainName(CoinType.ethereum), checksum, id)
|
||||
} catch (error) {
|
||||
console.log(`Etheruem platform error`, error)
|
||||
break
|
||||
|
@ -206,13 +187,10 @@ async function mapChainsAssetsLists() {
|
|||
Object.assign(mappedChainsWhitelistAssets, {[chain]: {}})
|
||||
Object.assign(mappedChainsBlacklistAssets, {[chain]: {}})
|
||||
|
||||
const whiteList = getChainWhitelist(chain)
|
||||
const blackList = getChainBlacklist(chain)
|
||||
|
||||
whiteList.forEach(addr => {
|
||||
getChainWhitelist(chain).forEach(addr => {
|
||||
Object.assign(mappedChainsWhitelistAssets[chain], {[addr]: ""})
|
||||
})
|
||||
blackList.forEach(addr => {
|
||||
getChainBlacklist(chain).forEach(addr => {
|
||||
Object.assign(mappedChainsBlacklistAssets[chain], {[addr]: ""})
|
||||
})
|
||||
})
|
||||
|
@ -241,6 +219,8 @@ function printContracts() {
|
|||
if (a.token_id < b.token_id) return -1
|
||||
if (a.token_id > b.token_id) return 1
|
||||
})
|
||||
|
||||
const wstream = fs.createWriteStream(path.join(__dirname, 'mapping.json'))
|
||||
wstream.write(JSON.stringify(sortedById, null, 4))
|
||||
}
|
||||
|
||||
|
@ -306,13 +286,13 @@ async function fetchImage(url: string) {
|
|||
}
|
||||
|
||||
function exit(code?: number) {
|
||||
printContracts()
|
||||
process.exit(code ?? 1)
|
||||
}
|
||||
|
||||
function getTotalActiveCryptocurrencies() {
|
||||
const url = `${CMC_LATEST_BASE_URL}CMC_PRO_API_KEY=${CMC_PRO_API_KEY}`
|
||||
return axios.get(url).then((res) => res.data.data.active_cryptocurrencies)
|
||||
return axios.get(`${CMC_LATEST_BASE_URL}CMC_PRO_API_KEY=${CMC_PRO_API_KEY}`).then((res) => res.data.data.active_cryptocurrencies).catch(e => {
|
||||
throw `Error getTotalActiveCryptocurrencies ${e.message}`
|
||||
})
|
||||
}
|
||||
|
||||
async function setBinanceTokens () {
|
||||
|
@ -337,12 +317,8 @@ function readBEP2() {
|
|||
}
|
||||
|
||||
async function getTickers() {
|
||||
try {
|
||||
const url = `https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?&limit=3500&CMC_PRO_API_KEY=${CMC_PRO_API_KEY}`
|
||||
return await axios.get(url).then(res => res.data.data)
|
||||
} catch (error) {
|
||||
log(`Error gettin tickers ${error.message}`)
|
||||
}
|
||||
return axios.get(url).then(res => res.data.data).catch(e => {throw `Error getTickers ${e.message}`})
|
||||
}
|
||||
|
||||
function log(string, cb?) {
|
||||
|
@ -351,7 +327,7 @@ function log(string, cb?) {
|
|||
} else {
|
||||
console.log(string)
|
||||
}
|
||||
const saveToLogs = fs.createWriteStream(path.join(__dirname, '.syncTokensLog.txt')) // Uncomment to store script run logs in disk
|
||||
const saveToLogs = fs.createWriteStream(path.join(__dirname, '.syncTokensLog.txt'))
|
||||
saveToLogs.write(`${string}\n`)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,14 +35,9 @@ import {
|
|||
rootDirAllowedFiles,
|
||||
stakingChains,
|
||||
} from "./helpers"
|
||||
import { ValidatorModel } from "./models";
|
||||
import { ValidatorModel, mapTiker, TickerType } from "./models";
|
||||
import { getHandle } from "../../script/gen_info";
|
||||
|
||||
enum TickerType {
|
||||
Token = "token",
|
||||
Coin = "coin"
|
||||
}
|
||||
|
||||
describe("Check repository root dir", () => {
|
||||
const dirActualFiles = readDirSync(".")
|
||||
test("Root should contains only predefined files", () => {
|
||||
|
@ -70,7 +65,7 @@ describe(`Test "blockchains" folder`, () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe(`Asset folder should contain only predifind list of filees`, () => {
|
||||
describe(`Asset folder should contain only predefined list of filees`, () => {
|
||||
readDirSync(chainsFolderPath).forEach(chain => {
|
||||
const assetsPath = getChainAssetsPath(chain)
|
||||
|
||||
|
@ -279,7 +274,7 @@ function testTerraValidatorsAddress(assets: string[]) {
|
|||
}
|
||||
|
||||
describe("Test Coinmarketcap mapping", () => {
|
||||
const cmcMap = JSON.parse(readFileSync("./pricing/coinmarketcap/mapping.json"))
|
||||
const cmcMap: mapTiker[] = JSON.parse(readFileSync("./pricing/coinmarketcap/mapping.json"))
|
||||
|
||||
test("Must have items", () => {
|
||||
expect(cmcMap.length, `CMC map must have items`).toBeGreaterThan(0)
|
||||
|
@ -345,24 +340,50 @@ describe("Test Coinmarketcap mapping", () => {
|
|||
});
|
||||
|
||||
test(`"token_id" should be in correct format`, async () => {
|
||||
const tokenSymbols = await getBinanceBEP2Symbols()
|
||||
const bep2Symbols = await getBinanceBEP2Symbols()
|
||||
|
||||
cmcMap.forEach(el => {
|
||||
const {coin, token_id, type, id} = el
|
||||
switch (coin) {
|
||||
case 60 && type === TickerType.Token:
|
||||
case 60:
|
||||
if (type === TickerType.Token) {
|
||||
expect(isChecksum(token_id), `"token_id" ${token_id} with id ${id} must be in checksum`).toBe(true)
|
||||
break;
|
||||
case 195 && type === TickerType.Token:
|
||||
}
|
||||
case 195:
|
||||
if (type === TickerType.Token) {
|
||||
expect(isTRC10(token_id) || isTRC20(token_id), `"token_id" ${token_id} with id ${id} must be in TRC10 or TRC20`).toBe(true)
|
||||
break;
|
||||
case 714 && type === TickerType.Token:
|
||||
expect(tokenSymbols.indexOf(token_id), `"token_id" ${token_id} with id ${id} must be BEP2 symbol`).toBe(true)
|
||||
}
|
||||
case 714:
|
||||
if (type === TickerType.Token) {
|
||||
expect(bep2Symbols.indexOf(token_id), `"token_id" ${token_id} with id ${id} must be BEP2 symbol`).toBeGreaterThan(0)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test(`"token_id" shoud be unique`, () => {
|
||||
const mappedList = cmcMap.reduce((acm, val) => {
|
||||
if (val.hasOwnProperty("token_id")) {
|
||||
if (acm.hasOwnProperty(val.token_id)) {
|
||||
acm[val.token_id] == ++acm[val.token_id]
|
||||
} else {
|
||||
acm[val.token_id] = 0
|
||||
}
|
||||
}
|
||||
return acm
|
||||
}, {})
|
||||
|
||||
cmcMap.forEach(el => {
|
||||
if (el.hasOwnProperty("token_id")) {
|
||||
expect(mappedList[el.token_id], `CMC map ticker with "token_id" ${el.token_id} shoud be unique`).toBeLessThanOrEqual(0)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("Test blacklist and whitelist", () => {
|
||||
|
@ -421,4 +442,3 @@ describe("Test helper functions", () => {
|
|||
})
|
||||
})
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user