From 7079ac4715e85067a984e6781537a5df21e618b8 Mon Sep 17 00:00:00 2001 From: Antonio Viggiano Date: Mon, 19 Mar 2018 18:10:40 -0300 Subject: [PATCH] Add script to generate list of supported coins npm run table --- README.md | 299 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 9 +- src/table.js | 42 ++++++++ 3 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 src/table.js diff --git a/README.md b/README.md index 6efea416..ada26941 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,305 @@ You can then build with npm run build +## Supported coins + + +| symbol | name | black | color | icon | white | +| -------- | --------------------------- | ----- | ----- | ---- | ----- | +| act | Achain | yes | yes | yes | yes | +| ada | Cardano | yes | yes | yes | yes | +| adx | AdEx | yes | yes | yes | yes | +| ae | Aeternity | yes | yes | yes | yes | +| agi | SingularityNET | yes | yes | yes | yes | +| agrs | ? | yes | yes | yes | yes | +| aion | Aion | yes | yes | yes | yes | +| amb | Ambrosus | yes | yes | yes | yes | +| amp | Synereo | yes | yes | yes | yes | +| ant | Aragon | yes | yes | yes | yes | +| appc | AppCoins | yes | yes | yes | yes | +| ardr | Ardor | yes | yes | yes | yes | +| ark | Ark | yes | yes | yes | yes | +| arn | Aeron | yes | yes | yes | yes | +| ast | AirSwap | yes | yes | yes | yes | +| atm | ATMChain | yes | yes | yes | yes | +| bat | Basic Attention Token | yes | yes | yes | yes | +| bay | BitBay | yes | yes | yes | yes | +| bcc | BitConnect | yes | yes | yes | yes | +| bcd | Bitcoin Diamond | yes | yes | yes | yes | +| bch | Bitcoin Cash | yes | yes | yes | yes | +| bcn | Bytecoin | yes | yes | yes | yes | +| bco | BridgeCoin | yes | yes | yes | yes | +| bcpt | BlockMason Credit Protocol | yes | yes | yes | yes | +| bdl | Bitdeal | yes | yes | yes | yes | +| bela | Bela | yes | yes | yes | yes | +| bix | Bibox Token | yes | yes | yes | yes | +| blcn | ? | yes | yes | yes | yes | +| blk | BlackCoin | yes | yes | yes | yes | +| block | Blocknet | yes | yes | yes | yes | +| blz | Bluzelle | yes | yes | yes | yes | +| bnb | Binance Coin | yes | yes | yes | yes | +| bnt | Bancor | yes | yes | yes | yes | +| bnty | Bounty0x | yes | yes | yes | yes | +| bpt | Blockport | yes | yes | yes | yes | +| bq | bitqy | yes | yes | yes | yes | +| bqx | ? | yes | yes | yes | yes | +| brd | Bread | yes | yes | yes | yes | +| btc | Bitcoin | yes | yes | yes | yes | +| btcd | BitcoinDark | yes | yes | yes | yes | +| btcp | Bitcoin Private | yes | yes | yes | yes | +| btcz | BitcoinZ | yes | yes | yes | yes | +| btg | Bitcoin Gold | yes | yes | yes | yes | +| btm | Bytom | yes | yes | yes | yes | +| bts | BitShares | yes | yes | yes | yes | +| btx | Bitcore | yes | yes | yes | yes | +| burst | Burst | yes | yes | yes | yes | +| cdn | Canada eCoin | yes | yes | yes | yes | +| cdt | Blox | yes | yes | yes | yes | +| clam | Clams | yes | yes | yes | yes | +| cloak | CloakCoin | yes | yes | yes | yes | +| cmt | CyberMiles | yes | yes | yes | yes | +| cnd | Cindicator | yes | yes | yes | yes | +| cnx | Cryptonex | yes | yes | yes | yes | +| cny | ? | yes | yes | yes | yes | +| cob | Cobinhood | yes | yes | yes | yes | +| cred | Verify | yes | yes | yes | yes | +| crpt | Crypterium | yes | yes | yes | yes | +| cvc | Civic | yes | yes | yes | yes | +| dash | Dash | yes | yes | yes | yes | +| dat | Datum | yes | yes | yes | yes | +| data | Streamr DATAcoin | yes | yes | yes | yes | +| dbc | DeepBrain Chain | yes | yes | yes | yes | +| dcn | Dentacoin | yes | yes | yes | yes | +| dcr | Decred | yes | yes | yes | yes | +| dent | Dent | yes | yes | yes | yes | +| dew | DEW | yes | yes | yes | yes | +| dgb | DigiByte | yes | yes | yes | yes | +| dgd | DigixDAO | yes | yes | yes | yes | +| dlt | Agrello | yes | yes | yes | yes | +| dnt | district0x | yes | yes | yes | yes | +| doge | Dogecoin | yes | yes | yes | yes | +| drgn | Dragonchain | yes | yes | yes | yes | +| dta | DATA | yes | yes | yes | yes | +| dtr | Dynamic Trading Rights | yes | yes | yes | yes | +| ebst | eBoost | yes | yes | yes | yes | +| edg | Edgeless | yes | yes | yes | yes | +| edo | Eidoo | yes | yes | yes | yes | +| edoge | ? | yes | yes | yes | yes | +| elf | aelf | yes | yes | yes | yes | +| elix | Elixir | yes | yes | yes | yes | +| ella | Ellaism | yes | yes | yes | yes | +| emc | Emercoin | yes | yes | yes | yes | +| emc2 | Einsteinium | yes | yes | yes | yes | +| eng | Enigma | yes | yes | yes | yes | +| enj | Enjin Coin | yes | yes | yes | yes | +| eos | EOS | yes | yes | yes | yes | +| equa | ? | yes | yes | yes | yes | +| etc | Ethereum Classic | yes | yes | yes | yes | +| eth | Ethereum | yes | yes | yes | yes | +| ethos | Ethos | yes | yes | yes | yes | +| etn | Electroneum | yes | yes | yes | yes | +| etp | Metaverse ETP | yes | yes | yes | yes | +| eur | ? | yes | yes | yes | yes | +| evx | Everex | yes | yes | yes | yes | +| exmo | ? | yes | yes | yes | yes | +| exp | Expanse | yes | yes | yes | yes | +| fair | FairCoin | yes | yes | yes | yes | +| fct | Factom | yes | yes | yes | yes | +| fil | Filecoin [Futures] | yes | yes | yes | yes | +| fldc | FoldingCoin | yes | yes | yes | yes | +| flo | FlorinCoin | yes | yes | yes | yes | +| ftc | Feathercoin | yes | yes | yes | yes | +| fuel | Etherparty | yes | yes | yes | yes | +| fun | FunFair | yes | yes | yes | yes | +| game | GameCredits | yes | yes | yes | yes | +| gas | Gas | yes | yes | yes | yes | +| gbp | ? | yes | yes | yes | yes | +| gbx | GoByte | yes | yes | yes | yes | +| gbyte | Byteball Bytes | yes | yes | yes | yes | +| gno | Gnosis | yes | yes | yes | yes | +| gnt | Golem | yes | yes | yes | yes | +| grc | GridCoin | yes | yes | yes | yes | +| grs | Groestlcoin | yes | yes | yes | yes | +| gto | Gifto | yes | yes | yes | yes | +| gup | Matchpool | yes | yes | yes | yes | +| gvt | Genesis Vision | yes | yes | yes | yes | +| gxs | GXChain | yes | yes | yes | yes | +| hpb | High Performance Blockchain | yes | yes | yes | yes | +| hsr | Hshare | yes | yes | yes | yes | +| html | HTMLCOIN | yes | yes | yes | yes | +| huc | HunterCoin | yes | yes | yes | yes | +| hush | Hush | yes | yes | yes | yes | +| icn | Iconomi | yes | yes | yes | yes | +| icx | ICON | yes | yes | yes | yes | +| ignis | Ignis | yes | yes | yes | yes | +| ink | Ink | yes | yes | yes | yes | +| ins | INS Ecosystem | yes | yes | yes | yes | +| ion | ION | yes | yes | yes | yes | +| iop | Internet of People | yes | yes | yes | yes | +| iost | IOStoken | yes | yes | yes | yes | +| iot | ? | yes | yes | yes | yes | +| jnt | Jibrel Network | yes | yes | yes | yes | +| jpy | ? | yes | yes | yes | yes | +| kcs | KuCoin Shares | yes | yes | yes | yes | +| kin | Kin | yes | yes | yes | yes | +| kmd | Komodo | yes | yes | yes | yes | +| knc | Kyber Network | yes | yes | yes | yes | +| krb | Karbo | yes | yes | yes | yes | +| lbc | LBRY Credits | yes | yes | yes | yes | +| lend | ETHLend | yes | yes | yes | yes | +| link | ChainLink | yes | yes | yes | yes | +| lkk | Lykke | yes | yes | yes | yes | +| lrc | Loopring | yes | yes | yes | yes | +| lsk | Lisk | yes | yes | yes | yes | +| ltc | Litecoin | yes | yes | yes | yes | +| lun | Lunyr | yes | yes | yes | yes | +| maid | MaidSafeCoin | yes | yes | yes | yes | +| mana | Decentraland | yes | yes | yes | yes | +| mcap | MCAP | yes | yes | yes | yes | +| mco | Monaco | yes | yes | yes | yes | +| mds | MediShares | yes | yes | yes | yes | +| med | MediBloc | yes | yes | yes | yes | +| miota | IOTA | yes | yes | yes | yes | +| mkr | Maker | yes | yes | yes | yes | +| mln | Melon | yes | yes | yes | yes | +| mnx | MinexCoin | yes | yes | yes | yes | +| mona | MonaCoin | yes | yes | yes | yes | +| mth | Monetha | yes | yes | yes | yes | +| mtl | Metal | yes | yes | yes | yes | +| music | Musicoin | yes | yes | yes | yes | +| nano | Nano | yes | yes | yes | yes | +| nas | Nebulas | yes | yes | yes | yes | +| nav | NavCoin | yes | yes | yes | yes | +| ndz | ? | yes | yes | yes | yes | +| nebl | Neblio | yes | yes | yes | yes | +| neo | NEO | yes | yes | yes | yes | +| neos | NeosCoin | yes | yes | yes | yes | +| ngc | NAGA | yes | yes | yes | yes | +| nlc2 | NoLimitCoin | yes | yes | yes | yes | +| nlg | Gulden | yes | yes | yes | yes | +| nmc | Namecoin | yes | yes | yes | yes | +| nuls | Nuls | yes | yes | yes | yes | +| nxs | Nexus | yes | yes | yes | yes | +| nxt | Nxt | yes | yes | yes | yes | +| oax | OAX | yes | yes | yes | yes | +| omg | OmiseGO | yes | yes | yes | yes | +| omni | Omni | yes | yes | yes | yes | +| ost | Simple Token | yes | yes | yes | yes | +| ox | OX Fina | yes | yes | yes | yes | +| pac | ? | yes | yes | yes | yes | +| part | Particl | yes | yes | yes | yes | +| pasl | Pascal Lite | yes | yes | yes | yes | +| pay | TenX | yes | yes | yes | yes | +| pink | PinkCoin | yes | yes | yes | yes | +| pirl | Pirl | yes | yes | yes | yes | +| pivx | PIVX | yes | yes | yes | yes | +| plr | Pillar | yes | yes | yes | yes | +| poe | Po.et | yes | yes | yes | yes | +| poly | Polymath | yes | yes | yes | yes | +| pot | PotCoin | yes | yes | yes | yes | +| powr | Power Ledger | yes | yes | yes | yes | +| ppc | Peercoin | yes | yes | yes | yes | +| ppp | PayPie | yes | yes | yes | yes | +| ppt | Populous | yes | yes | yes | yes | +| prl | Oyster | yes | yes | yes | yes | +| pura | Pura | yes | yes | yes | yes | +| qash | QASH | yes | yes | yes | yes | +| qiwi | ? | yes | yes | yes | yes | +| qlc | QLINK | yes | yes | yes | yes | +| qrl | Quantum Resistant Ledger | yes | yes | yes | yes | +| qsp | Quantstamp | yes | yes | yes | yes | +| qtum | Qtum | yes | yes | yes | yes | +| r | Revain | yes | yes | yes | yes | +| rads | Radium | yes | yes | yes | yes | +| rcn | Ripio Credit Network | yes | yes | yes | yes | +| rdd | ReddCoin | yes | yes | yes | yes | +| rdn | Raiden Network Token | yes | yes | yes | yes | +| rep | Augur | yes | yes | yes | yes | +| req | Request Network | yes | yes | yes | yes | +| rhoc | RChain | yes | yes | yes | yes | +| ric | Riecoin | yes | yes | yes | yes | +| rise | Rise | yes | yes | yes | yes | +| rlc | iExec RLC | yes | yes | yes | yes | +| rpx | Red Pulse | yes | yes | yes | yes | +| rub | ? | yes | yes | yes | yes | +| salt | SALT | yes | yes | yes | yes | +| san | Santiment Network Token | yes | yes | yes | yes | +| sbd | Steem Dollars | yes | yes | yes | yes | +| sberbank | ? | yes | yes | yes | yes | +| sc | Siacoin | yes | yes | yes | yes | +| sky | Skycoin | yes | yes | yes | yes | +| sls | SaluS | yes | yes | yes | yes | +| smart | SmartCash | yes | yes | yes | yes | +| sngls | SingularDTV | yes | yes | yes | yes | +| snt | Status | yes | yes | yes | yes | +| sonm | ? | yes | yes | yes | yes | +| spank | SpankChain | yes | yes | yes | yes | +| sphtx | SophiaTX | yes | yes | yes | yes | +| srn | SIRIN LABS Token | yes | yes | yes | yes | +| start | Startcoin | yes | yes | yes | yes | +| steem | Steem | yes | yes | yes | yes | +| storj | Storj | yes | yes | yes | yes | +| storm | Storm | yes | yes | yes | yes | +| strat | Stratis | yes | yes | yes | yes | +| sub | Substratum | yes | yes | yes | yes | +| sys | Syscoin | yes | yes | yes | yes | +| taas | TaaS | yes | yes | yes | yes | +| tau | Lamden | yes | yes | yes | yes | +| tel | Telcoin | yes | yes | yes | yes | +| theta | Theta Token | yes | yes | yes | yes | +| tix | Blocktix | yes | yes | yes | yes | +| tkn | TokenCard | yes | yes | yes | yes | +| tnb | Time New Bank | yes | yes | yes | yes | +| tnc | Trinity Network Credit | yes | yes | yes | yes | +| tnt | Tierion | yes | yes | yes | yes | +| trig | Triggers | yes | yes | yes | yes | +| trx | TRON | yes | yes | yes | yes | +| tzc | TrezarCoin | yes | yes | yes | yes | +| ubq | Ubiq | yes | yes | yes | yes | +| unity | SuperNET | yes | yes | yes | yes | +| usd | ? | yes | yes | yes | yes | +| usdt | Tether | yes | yes | yes | yes | +| utk | UTRUST | yes | yes | yes | yes | +| ven | VeChain | yes | yes | yes | yes | +| veri | Veritaseum | yes | yes | yes | yes | +| via | Viacoin | yes | yes | yes | yes | +| vibe | VIBE | yes | yes | yes | yes | +| vivo | VIVO | yes | yes | yes | yes | +| vrc | VeriCoin | yes | yes | yes | yes | +| vtc | Vertcoin | yes | yes | yes | yes | +| wabi | WaBi | yes | yes | yes | yes | +| waves | Waves | yes | yes | yes | yes | +| wax | WAX | yes | yes | yes | yes | +| wgr | Wagerr | yes | yes | yes | yes | +| wings | Wings | yes | yes | yes | yes | +| wpr | WePower | yes | yes | yes | yes | +| wtc | Waltonchain | yes | yes | yes | yes | +| xas | Asch | yes | yes | yes | yes | +| xbc | Bitcoin Plus | yes | yes | yes | yes | +| xby | XTRABYTES | yes | yes | yes | yes | +| xcp | Counterparty | yes | yes | yes | yes | +| xdn | DigitalNote | yes | yes | yes | yes | +| xem | NEM | yes | yes | yes | yes | +| xlm | Stellar | yes | yes | yes | yes | +| xmg | Magi | yes | yes | yes | yes | +| xmr | Monero | yes | yes | yes | yes | +| xmy | Myriad | yes | yes | yes | yes | +| xp | Experience Points | yes | yes | yes | yes | +| xpa | XPA | yes | yes | yes | yes | +| xpm | Primecoin | yes | yes | yes | yes | +| xrp | Ripple | yes | yes | yes | yes | +| xtz | Tezos (Pre-Launch) | yes | yes | yes | yes | +| xuc | Exchange Union | yes | yes | yes | yes | +| xvc | Vcash | yes | yes | yes | yes | +| xvg | Verge | yes | yes | yes | yes | +| xzc | ZCoin | yes | yes | yes | yes | +| yoyow | YOYOW | yes | yes | yes | yes | +| zcl | ZClassic | yes | yes | yes | yes | +| zec | Zcash | yes | yes | yes | yes | +| zen | ZenCash | yes | yes | yes | yes | +| zil | Zilliqa | yes | yes | yes | yes | +| zrx | 0x | yes | yes | yes | yes | + ## Donate diff --git a/package.json b/package.json index d52c02e1..08e7291d 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,8 @@ "svgstore": "npm run svgstore:black && npm run svgstore:color && npm run svgstore:icon && npm run svgstore:white", "clean": "rimraf build && rimraf dist", "build": "npm run minify-images && npm run imacss && npm run svgstore", - "prebuild": "npm run clean" + "prebuild": "npm run clean", + "table": "node src/table.js" }, "repository": { "type": "git", @@ -75,7 +76,13 @@ "concat": "^1.0.3", "imacss": "^1.0.0", "imagemin-cli": "^3.0.0", + "lodash": "^4.17.5", + "markdown-table": "^1.1.1", "mkdirp": "^0.5.1", + "node-dir": "^0.1.17", + "path": "^0.12.7", + "recursive-readdir": "^2.2.2", + "request": "^2.85.0", "rimraf": "^2.6.2", "svgstore-cli": "^1.3.1" } diff --git a/src/table.js b/src/table.js new file mode 100644 index 00000000..8468b532 --- /dev/null +++ b/src/table.js @@ -0,0 +1,42 @@ +const fs = require('fs') +const _ = require('lodash') +const async = require('async') +const path = require('path') +const request = require('request') +const recursive = require('recursive-readdir') +const markdownTable = require('markdown-table') + +const url = 'https://api.coinmarketcap.com/v1/ticker/?limit=0' + +async.autoInject({ + files: (cb) => recursive(path.join(__dirname, '../svg/'), cb), + crypto: (cb) => request(url, (err, res, body) => cb(err, body)), + table: (files, crypto, cb) => { + const coins = JSON.parse(crypto) + const headers = {} + const table = _.chain(files) + .map(file => { + const pathArray = file.split(path.sep) + const folder = pathArray[pathArray.length - 2] + headers[folder] = true + const fileName = path.basename(file, '.svg') + const coin = coins.find(coin => coin.symbol.toLowerCase() === fileName) + return { + symbol: fileName, + name: coin ? coin.name : '?', + [folder]: 'yes' + } + }) + .groupBy(e => e.symbol) + .reduce((a, b) => [...a, b.reduce((m, n) => Object.assign({}, m, n))], []) + .value() + const header = ['symbol', 'name', ...Object.keys(headers)] + const tableOfArrays = table.map((coin) => header.map(h => coin[h])) + const markdown = markdownTable([header, ...tableOfArrays]) + + const readmePath = path.join(__dirname, '../README.md') + const readme = fs.readFileSync(readmePath, 'utf-8') + const updatedReadme = readme.replace(/[^\0]*?/, `\n${markdown}\n`) + fs.writeFile(readmePath, updatedReadme, cb) + } +}) \ No newline at end of file