2018-08-13 10:19:25 +00:00
|
|
|
'use strict';
|
2018-08-13 09:55:05 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const coins = require('coinlist');
|
2019-04-10 11:09:08 +00:00
|
|
|
const getColors = require('get-svg-colors');
|
2018-08-13 09:55:05 +00:00
|
|
|
const alphaSort = require('alpha-sort');
|
2018-08-13 10:19:25 +00:00
|
|
|
const manifest = require('../manifest.json');
|
2018-08-13 09:55:05 +00:00
|
|
|
|
2018-08-17 17:56:28 +00:00
|
|
|
const overrides = new Map([
|
2018-08-31 18:47:19 +00:00
|
|
|
['VRSC', 'VerusCoin'],
|
|
|
|
['GMR', 'Gimmer'],
|
2018-09-11 19:04:08 +00:00
|
|
|
['NEXO', 'Nexo'],
|
2018-09-17 06:53:55 +00:00
|
|
|
['GUSD', 'Gemini dollar'],
|
2018-10-02 07:09:09 +00:00
|
|
|
['CALL', 'Capital'],
|
|
|
|
['BOS', 'BOScoin'],
|
|
|
|
['CIX', 'Cryptonetix'],
|
|
|
|
['COQUI', 'COQUI Cash'],
|
|
|
|
['DEEZ', 'DeezNuts'],
|
2018-10-02 07:28:28 +00:00
|
|
|
['MZC', 'MAZA'],
|
|
|
|
['CVC', 'Civic'],
|
2018-10-07 13:37:35 +00:00
|
|
|
['BTM', 'Bitmark'],
|
2018-10-29 12:50:08 +00:00
|
|
|
['GLXT', 'GLX Token'],
|
|
|
|
['ONG', 'SoMee.Social'],
|
|
|
|
['CC', 'CoinCollect'],
|
2018-11-30 09:50:27 +00:00
|
|
|
['2GIVE', '2Give'],
|
|
|
|
['BOOTY', 'Booty'],
|
2019-01-13 02:41:29 +00:00
|
|
|
['PUNGO', 'Pungo Token'],
|
2018-12-03 03:53:57 +00:00
|
|
|
['X', 'GLX Equity Token'],
|
|
|
|
['AYWA', 'Aywa'],
|
|
|
|
['CHAIN', 'Chainmakers'],
|
2019-01-13 02:47:15 +00:00
|
|
|
['LPT', 'Livepeer Token'],
|
|
|
|
['AUDR', 'AUDRamp'],
|
|
|
|
['BAB', 'Bitcoin Cash ABC'],
|
|
|
|
['BSV', 'BitcoinSV'],
|
|
|
|
['GOLD', 'Dragonereum Gold'],
|
2019-03-19 13:45:17 +00:00
|
|
|
['USDC', 'USD Coin'],
|
|
|
|
['AEUR', 'Augmint Euro Token'],
|
|
|
|
['BCIO', 'Blockchain.io'],
|
|
|
|
['BEAM', 'Beam'],
|
|
|
|
['BTT', 'BitTorrent'],
|
|
|
|
['GRIN', 'Grin'],
|
2019-03-19 13:58:22 +00:00
|
|
|
['ILK', 'Inlock Token'],
|
2019-04-17 04:29:39 +00:00
|
|
|
['BTM', 'Bytom'],
|
|
|
|
['D', 'Denarius']
|
2018-08-17 17:56:28 +00:00
|
|
|
]);
|
|
|
|
|
2018-08-13 09:55:05 +00:00
|
|
|
const icons = manifest.map(icon => {
|
|
|
|
const id = typeof icon === 'string' ? icon : icon.symbol;
|
2019-04-10 11:09:08 +00:00
|
|
|
const fileName = `${id.toLowerCase()}.svg`;
|
|
|
|
const svgPath = path.resolve(__dirname, '../svg/color/', fileName);
|
|
|
|
let color;
|
|
|
|
if (fs.existsSync(svgPath)) {
|
|
|
|
const svg = fs.readFileSync(svgPath, 'utf8');
|
|
|
|
const fillColor = getColors(svg).fills[0];
|
|
|
|
color = fillColor ? fillColor.hex().toUpperCase() : undefined;
|
|
|
|
}
|
2018-08-13 09:55:05 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
symbol: id.toUpperCase(),
|
2019-04-10 11:09:08 +00:00
|
|
|
name: overrides.get(id) || coins.get(id, 'name') || id,
|
|
|
|
color
|
2018-08-13 09:55:05 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2018-08-13 10:19:25 +00:00
|
|
|
icons.sort((a, b) => alphaSort.asc(a.symbol, b.symbol));
|
|
|
|
|
|
|
|
const data = JSON.stringify(icons, null, '\t') + '\n';
|
2018-08-13 09:55:05 +00:00
|
|
|
|
2018-08-13 10:19:25 +00:00
|
|
|
fs.writeFileSync(path.resolve(__dirname, '../manifest.json'), data);
|