CoinTool v0.0.2 - Cryptocurrency Conversion + UI Localization
utopian-io·@justyy·
0.000 HBDCoinTool v0.0.2 - Cryptocurrency Conversion + UI Localization
## Introduction CoinTools is A Chrome Extension that has a few useful tools and graphs for [Cryptocurrency](https://helloacm.com/php-function-to-get-exchange-rate-between-cryptocurrency-btc-ltc-eth-to-fiat-currency/). ## Previous Contributions - [v0.0.1 Introduction to CoinTools! A Cryptocurrency Chrome Extension](https://helloacm.com/introduction-to-cointools-a-cryptocurrency-chrome-extension/) ## Technology Stacks Javascript that runs in Chrome. ## Github https://github.com/DoctorLai/CoinTools ## Chrome Webstore It is available online at Chrome Webstore: https://chrome.google.com/webstore/detail/coin-tools/fmglcggbdcbkpkfapngjobfeakehpcgj ## v0.0.2 Feature Along with bug fixes and code refactoring, [this version has the following features](https://helloacm.com/cointool-v0-0-2-cryptocurrency-conversion-ui-localization/): 1. Any two cryptocurrency conversions 2. UI [Localisation](https://helloacm.com/chrome-extension-to-switch-between-simplified-chinese-and-traditional-chinese-automatically/) with Simplified Chinese. ## Commits **[Here](https://github.com/DoctorLai/CoinTools/commit/a291dbb59c5d20b50a5ca078bbeb939e1b9a04e2)** ## Roadmap of CoinTools 1. real-time graphs 2. search cryptocurrency 3. historical data ## Screenshots You can now select Simplified Chinese from the setting tab.  UI will be updated to Chinese immediately once you click Save.  You can enter each line any two crytocurrency separated by a space.  And when APP is loaded, it will call coinmarkcap API to convert, for example:  ## Javascript Async and Await to Convert from one coin to another ``` // ajax calling API const getPriceOfUSD = (coin) => { return new Promise((resolve, reject) => { let api = "https://api.coinmarketcap.com/v1/ticker/" + coin + '/'; fetch(api, {mode: 'cors'}).then(validateResponse).then(readResponseAsJSON).then(function(result) { resolve(result[0].price_usd); }); }); } // ajax get conversion const getConversion = async(coin1, coin2) => { let api1 = getPriceOfUSD(coin1); let api2 = getPriceOfUSD(coin2); return await api1 / await api2; } // conversion const processConversion = (s) => { let arr = s.trim().split("\n"); for (let i = 0; i < arr.length; i ++) { let pair = arr[i].split(" "); if (pair.length == 2) { let a = pair[0].trim().toLowerCase(); let b = pair[1].trim().toLowerCase(); var pat = /^[a-zA-Z\-]+$/; if (pat.test(a) && pat.test(b)) { let dom = $('div#conversion_results'); let dom_id = "convert_" + a.replace("-", "") + "_" + b.replace("-", ""); dom.append('<div id="' + dom_id + '"> </div>'); getConversion(a, b).then(x => { $('div#' + dom_id).html("<h4>1 " + a.toUpperCase() + " = <span class=yellow>" + x + "</span> " + b.toUpperCase() + "</h4>"); }); } } } } ``` # License [MIT](https://github.com/DoctorLai/CoinTools/blob/master/LICENSE) # Contribution Welcome Github: https://github.com/DoctorLai/CoinTools/ 1. Fork it! 2. Create your feature branch: `git checkout -b my-new-feature` 3. Commit your changes: `git commit -am 'Add some feature'` 4. Push to the branch: `git push origin my-new-feature` 5. Submit a pull request. # Chrome Webstore Install the [CoinTools](https://chrome.google.com/webstore/detail/coin-tools/fmglcggbdcbkpkfapngjobfeakehpcgj) Now! <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@justyy/cointool-v0-0-2-cryptocurrency-conversion-ui-localization">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
👍 liangfengyouren, victorialuxx, oldman28, jjay, vandadream, ivysrono, mkt, helo, cryptonewsly, lilypang22, rainyapril, deepthinking, aaronstar, robinlee, ayanamoon, dongfengman, jianan, linda65, moobear, tinna, shentrading, zasilla, fishcc, anxin, cnsteem, serenazz, ety001, gogoabc, yuxuan, shengjian, woolfe19861008, fishaa, lebin, prch, aai, blockd, daxiang, cha0s0000, vincenthan, fanso, kangnajiang, foodielifestyle, yedda, al2ping, nean, geass, twinsnicole, dailyfortune, superbing, dailystats, happyukgo, dailychina, justyy, sv67216721, weisheng167388, nileelily, wangwenjing, winniex, tensaix2j, luneknight, archiles, ericsim, ericsim1991, ericsim1989, moonvoid, rosatravels, shenchensucc, frankintaiwan, xuran, historylover, boontjie, chann, jassennessaj, rivalhw, ace108, susanli3769, tdre, waiyee422, susanlo, cifer, manuel78, stabilowl, meixia, ian027, codingdefined, utopian-io, baicai, cryptoexplorer7, magicmonk, myjourney, altherion, stefanski, ghafari, antone, mangoanddaddy, xiaoshancun, deevo,