CoinTools Update: Adding Cryptocompare Source + Context Shortcut

in #utopian-io6 years ago (edited)

Introduction to CoinTools

CoinTools is a powerful, lightweight Chrome Extension for Cryptocurrency fans! It can be installed via Chrome Webstore:

https://chrome.google.com/webstore/detail/coin-tools/fmglcggbdcbkpkfapngjobfeakehpcgj

For Opera browsers, the workaround is to first install Chrome Extension Gadget.

And similarly for Firefox, you can install Chrome Store Foxified before you install CoinTools .

New Features of CoinTools v0.0.15.1

This commit adds the following features:

  1. Adding Cryptocompare API as a backup source so that it is more robust and supports less popular fiats such as NGN.
  2. Add Context Shortcuts for a few useful Cryptocurrency websites.

Screenshots of CoinTools v0.0.15.1

Single Fiat Command to Local Currency
image.png

History Graph from Cryptocompare
image.png

Context Shortcuts
image.png

Robust Cryptocompare

In this version, we have added the cryptocompare source, which is returned as a Javascript Promise.

// getting conversion from cryptocompare
const getPriceCC = (a, b) => {
    a = a.toUpperCase();
    b = b.toUpperCase();
    let api = "https://min-api.cryptocompare.com/data/price?fsym=" + a + "&tsyms=" + b;
    return new Promise((resolve, reject) => {
        fetch(api, {mode: 'cors'})
        .then(validateResponse)
        .then(readResponseAsJSON)
        .then(function(result) {
            if (result[b]) {
                resolve(result[b]);
            } else {
                reject("invalid pairs: " + a + ", " + b);
            }
        }).catch(function(error) {
            logit(get_text("request_failed", "Request failed") + ': ' + api + ": " + error);
            reject(error);
        });
    });    
}

For example, when coinmarketcap fails, the tool will go to cryptocompare:

// ajax calling API to return the price of USD for coin
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) {
            if (result[0].price_usd) {
                resolve(result[0].price_usd);
            } else {
                getPriceCC(coin, 'USD').then((res) => {
                    resolve(res);
                }).catch(function(error) {
                    reject(error);
                });
            }
        }).catch(function(error) {
            getPriceCC(coin, 'USD').then((res) => {
                resolve(res);
            }).catch(function(error) {
                logit(get_text("request_failed", "Request failed") + ': ' + api + ": " + error);
                reject(error);
            });            
        });
    });
}

Technology

Javascript that runs in the Chrome Browser (ES6)

Contribution

Fully Opensource: https://github.com/DoctorLai/CoinTools
Submit a PR or a issue if you found a bug.


Support me and my work as a witness by

  1. voting me here, or
  2. voting me as a proxy

Some of my contributions: SteemIt Tools, Bots, APIs and Tutorial



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

This is amazing @justyy. Can I get the detailed explanation of all the features of this extension?

Also, can I have a list of extensions you have created till date, especially related to Crypto or Steem? :-)

It would be great to have all the guns in my arsenal :-D

  1. At https://github.com/DoctorLai/CoinTools
  2. https://helloacm.com/tools/steemit/

Features

  • Show Rates from Cryptocurrency to Fiat.
  • Show Rates from Cryptocurrency to Cryptocurrency.
  • Show Rates from Fiat to Fiat.
  • Concurrency/Fiat Converter
  • Historic Data Rate
  • News Feed
  • Ranking Table with Search
  • Total Market Cap Charts
  • Top Cryptocurrency Pairs in Exchange.
  • UI Language Localizations (more than 10 languages)

I am pleased to know that steem are handled at Huobi of Chinese exchange.

yes, that is indeed a great news, which may be the reasons that steem price go up.

Looking forward to showing the K line on your CoinTools . :D

I probably need to spend some time understanding the K lines.

Hey @justyy! Thank you for the great work you've done!

We're already looking forward to your next contribution!

Fully Decentralized Rewards

We hope you will take the time to share your expertise and knowledge by rating contributions made by others on Utopian.io to help us reward the best contributions together.

Utopian Witness!

Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

Want to chat? Join us on Discord https://discord.me/utopian-io

Hi, I've added french translation to the project via a pull request on GitHub a few days ago and I can't find any trace of what I've done. Did you view it?

Hello, currently I don't see any pending PR so no idea what you have done so far.

I'm still learning the magic of GitHub. I guess my first contribution was lost. I added a new pull request, the right way this time :D

thanks, merged. there are some syntax errors, but that shouldn't be a big problem.

You're welcome, happy to help.

Coin Marketplace

STEEM 0.20
TRX 0.15
JST 0.030
BTC 65353.52
ETH 2654.64
USDT 1.00
SBD 2.84