SteemTools v0.0.8 Update: Witness Lookup


Introduction to SteemTools

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

SteemTools Open Source

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

Previous Versions

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:

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

Witness

Get witness details.

steemtools-witness-lookup SteemTools v0.0.8 Update: Witness Lookup chrome browser javascript SteemIt

steemtools-witness-lookup

If None-witness ID is entered, it will display “Not a Witness Account”.

Get Steemit Witness in Javascript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// 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('');
    }        
});   
// 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

Chrome Webstore

Install the SteemTools Chrome Extension Now!

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.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
1281 words
Last Post: The Discord Witness Command and API
Next Post: Turtle Programming v0.0.9: Add SetX, SetY, Square and Rect!

The Permanent URL is: SteemTools v0.0.8 Update: Witness Lookup

Leave a Reply