SteemTools v0.0.8 Update: Witness Lookup

in #utopian-io8 years ago (edited)

SteemTools

SteemTools is a Chrome Extension that aims to provide useful tools and data for SteemIt Users.

Github

https://github.com/DoctorLai/SteemTools/

Previous Contributions

Technology Stack

Javascript that runs in the Chrome Browser (Chrome Extension)

Chrome Webstore

It is online, and you can install SteemTools via:
https://chrome.google.com/webstore/detail/steem-tools/emjfpeecopppojbhkigjjmcahbfahhbn

If you are using Firefox, you can still install this Extension by Chrome Extension Foxified.

New Features of SteemTools v0.0.8

Commit here. This version has the following changes:

  1. Fix Reputation Bug Error (see https://github.com/steemit/steem-js/pull/345)
  2. Add Witness Lookup
  3. Save Source code in the Steem-Js Console.

Witness

Get witness details.
image.png

None-witness ID is entered.
image.png

Get Steemit Witness in Javascript

// find witness information
// search a id when press Enter
textPressEnterButtonClick($('input#witness_id'), $('button#witness_btn'));
$('button#witness_btn').click(function() {        
    let id = prepareId($('input#witness_id').val());
    let server = getServer();        
    server = server || default_server;
    $('div#witness_div').html('<img src="images/loading.gif"/>');
    if (validId(id)) {
        // disable the button while API is not finished yet.
        $('button#witness_id').attr("disabled", true);
        $.ajax({ 
            dataType: "json",
            url: "https://" + server + "/api/steemit/witness/?cached&id="+id,
            cache: false,
            success: function (response) {
                let result = response;
                if (result && result.length > 0) {
                    let s = '<h4>Witness Details for ' + getSteemUrl(id) + '</h4>';
                    s += '<table id="dvlist_witness">';
                    s += '<thead><tr><th style="width:30%">Key</th><th>Value</th></tr></thead><tbody>';
                    s += "<tr><td>signing_key</td><td><pre>" + result[0]['signing_key'] + "</pre></td></tr>";

                    const addKeyValue = (result, x) => {
                        return "<tr><td>" + x + "</td><td>" + result[0][x] + "</td></tr>";
                    }

                    s += addKeyValue(result, "total_missed");
                    s += addKeyValue(result, "last_confirmed_block_num");
                    s += addKeyValue(result, "running_version");
                    s += "<tr><td>witness_post</td><td><a target=_blank href='" + result[0]['url'] + "'>" + result[0]['url'] + "</a></td></tr>";
                    s += addKeyValue(result, "votes");
                    s += addKeyValue(result, "votes_count");
                    s += addKeyValue(result, "last_aslot");
                    s += addKeyValue(result, "hardfork_version_vote");
                    s += addKeyValue(result, "hardfork_time_vote");
                    s += addKeyValue(result, "created");
                    s += addKeyValue(result, "account_creation_fee");
                    s += addKeyValue(result, "account_creation_fee_symbol");
                    s += addKeyValue(result, "maximum_block_size");
                    s += addKeyValue(result, "sbd_interest_rate");
                    s += addKeyValue(result, "sbd_exchange_rate_base");
                    s += addKeyValue(result, "sbd_exchange_rate_base_symbol");
                    s += addKeyValue(result, "sbd_exchange_rate_quote");                        
                    s += addKeyValue(result, "sbd_exchange_rate_quote_symbol");                        
                    s += addKeyValue(result, "last_sbd_exchange_update");                        
                    
                    s += '</tbody>';
                    s += '</table>';
                    $('div#witness_div').html(s);
                    sorttable.makeSortable(document.getElementById("dvlist_witness"));
                } else {
                    $('div#witness_div').html("<font color=blue>It could be any of these: (1) Not a Witness Account (2) Invalid ID (3) API or SteemSQL server failed. Contact <a rel=nofollow target=_blank href='https://steemit.com/@justyy/'>@justyy</a> if you are not sure. Thanks!</font>");
                }          
            },
            error: function(request, status, error) {
                $('div#witness_div').html('<font color=red>API/SteemSQL Server (' + server + error + ') is currently offline. Please try again later!' + request.responseText + '</font>');
            },          
            complete: function(data) {
                // re-enable the button
                $('button#witness_btn').attr("disabled", false);
            }
        });
    } else {
        alert('Not a Valid Steem ID.');
        $('div#witness_div').html('');
    }        
});   

Roadmap of Steem Tools

License

MIT

Contribution Welcome

Github: https://github.com/DoctorLai/SteemTools/

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request.

Chrome Webstore

Install the SteemTools Chrome Extension Now!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Nice and informative post

Thank you for the contribution. It has been approved.

You can contact us on Discord.

[utopian-moderator]

Coin Marketplace

STEEM 0.12
TRX 0.34
JST 0.032
BTC 121613.28
ETH 4346.82
USDT 1.00
SBD 0.78