Browse Source

Atomic Explorer some API calls made active

master
Satinder Grewal 8 years ago
parent
commit
b9a795eed1
  1. 52
      assets/scripts/atomicexplorer.js
  2. 14
      index.html

52
assets/scripts/atomicexplorer.js

@ -19,7 +19,57 @@ var AtomicExplorer = function() {
var handleExplorer = function() { var handleExplorer = function() {
$('#atomic_explorer_getcoinpeers_btn').click(function() { $('#atomic_explorer_getcoinpeers_btn').click(function() {
console.log("button pushed in atomic explorer") console.log("button pushed in atomic explorer");
var atomic_explorer_select_coin_val = $("select[id='atomic_explorer_select_coin_options']").val();
var atomic_explorer_select_command_val = $("select[id='atomic_explorer_select_command_options']").val();
var atomic_explorer_input_data_val = $("#atomic_explorer_input_data").val();
console.log(atomic_explorer_select_coin_val);
console.log(atomic_explorer_select_command_val);
console.log(atomic_explorer_input_data_val);
if (atomic_explorer_select_command_val === 'getbalance') {
ExplorerInputData = {"coin":atomic_explorer_select_coin_val,"method":"getbalance","params":[atomic_explorer_input_data_val]}
console.log(ExplorerInputData);
}
if (atomic_explorer_select_command_val === 'listunspent') {
ExplorerInputData = {"coin":atomic_explorer_select_coin_val,"method":"listunspent","params":[1, 9999999, [atomic_explorer_input_data_val]]}
console.log(ExplorerInputData);
}
if (atomic_explorer_select_command_val === 'txid') {
ExplorerInputData = {"coin":atomic_explorer_select_coin_val,"method":"getrawtransaction","params":[atomic_explorer_input_data_val]}
console.log(ExplorerInputData);
}if (atomic_explorer_select_command_val === 'gettransaction') {
ExplorerInputData = {"coin":atomic_explorer_select_coin_val,"agent":"bitcoinrpc","method":"gettransaction","txid":atomic_explorer_input_data_val}
console.log(ExplorerInputData);
}
$.ajax({
type: 'POST',
data: JSON.stringify(ExplorerInputData),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
console.log(data);
if (atomic_explorer_select_command_val === 'txid') {
$("#atomic-explorer-commands-output").html(data);
} else {
var ExplorerOutputData = JSON.parse(data);
console.log(ExplorerOutputData);
$("#atomic-explorer-commands-output").html(JSON.stringify(ExplorerOutputData, null, '\t'));
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
}
});
/*$.ajax({ /*$.ajax({
type: 'GET', type: 'GET',

14
index.html

@ -613,7 +613,7 @@
<div class="col-sm-4 col-xs-12"> <div class="col-sm-4 col-xs-12">
<div class="form-group"> <div class="form-group">
<select class="form-control form-material" id="atomic_explorer_select_coin_options"> <select class="form-control form-material" id="atomic_explorer_select_coin_options">
<option>-Select Coin-</option> <option value="">-Select Coin-</option>
<option value="BTC">Bitcoin</option> <option value="BTC">Bitcoin</option>
<option value="BTCD">BitcoinDark</option> <option value="BTCD">BitcoinDark</option>
<option value="LTC">Litecoin</option> <option value="LTC">Litecoin</option>
@ -633,7 +633,7 @@
</div> </div>
<div class="col-sm-4 col-xs-12" style="text-align: center;"> <div class="col-sm-4 col-xs-12" style="text-align: center;">
<select class="form-control form-material" id="atomic_explorer_select_command_options"> <select class="form-control form-material" id="atomic_explorer_select_command_options">
<option>-Select Command-</option> <option value="">-Select Command-</option>
<option value="getbalance">Get Balance</option> <option value="getbalance">Get Balance</option>
<option value="listunspent">List Unspent</option> <option value="listunspent">List Unspent</option>
<option value="txid">Transaction ID</option> <option value="txid">Transaction ID</option>
@ -643,6 +643,9 @@
</select> </select>
</div> </div>
<div class="col-sm-4 col-xs-12" style="text-align: center;"> <div class="col-sm-4 col-xs-12" style="text-align: center;">
<input type="text" class="form-control" id="atomic_explorer_input_data" name="atomic_explorer_input_data" placeholder="addr, txid, blockash etc.">
</div>
<div class="col-sm-12 col-xs-12" style="text-align: center;">
<button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-dismiss="modal" id="atomic_explorer_getcoinpeers_btn">Submit</button> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-dismiss="modal" id="atomic_explorer_getcoinpeers_btn">Submit</button>
</div> </div>
</div> </div>
@ -651,10 +654,13 @@
</div> </div>
<div class="col-xlg-4 col-md-12"> <div class="col-xlg-4 col-md-12">
<!-- Atomic Explorer tab --> <!-- Atomic Explorer tab -->
<div class="panel panel-bordered"> <div class="panel">
<div class="panel-heading">
<h3 class="panel-title">Raw Output</h3>
</div>
<div class="panel-body"> <div class="panel-body">
<div class="tab-content"> <div class="tab-content">
<div id="atomic-explorer-commands-output"></div> <pre id="atomic-explorer-commands-output"></pre>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save