Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitespace in coinbin.js #2

Merged
merged 1 commit into from
Feb 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions js/coinbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $(document).ready(function() {
address = sw.address;

$("#walletKeys .walletSegWitRS").removeClass("hidden");
$("#walletKeys .walletSegWitRS input:text").val(sw.redeemscript);
$("#walletKeys .walletSegWitRS input:text").val(sw.redeemscript);
}

$("#walletAddress").html(address);
Expand Down Expand Up @@ -163,7 +163,7 @@ $(document).ready(function() {
}

// clone the transaction with out using coinjs.clone() function as it gives us trouble
var tx2 = coinjs.transaction();
var tx2 = coinjs.transaction();
var txunspent = tx2.deserialize(tx.serialize());

// then sign
Expand Down Expand Up @@ -226,7 +226,7 @@ $(document).ready(function() {
if((!isNaN($(amount).val())) && $(amount).val()>0){
$(amount).parent().removeClass('has-error');
} else {
$(amount).parent().addClass('has-error');
$(amount).parent().addClass('has-error');
}

if(coinjs.addressDecode($(address).val())){
Expand Down Expand Up @@ -448,7 +448,7 @@ $(document).ready(function() {
$('#timeLockedDateTimePicker').datetimepicker({
format: "MM/DD/YYYY HH:mm",
});

$('#timeLockedRbTypeBox input').change(function(){
if ($('#timeLockedRbTypeDate').is(':checked')){
$('#timeLockedDateTimePicker').show();
Expand Down Expand Up @@ -640,7 +640,7 @@ $(document).ready(function() {


if(!$("#recipients .row, #inputs .row").hasClass('has-error')){

$("#transactionCreate textarea").val(tx.serialize());
$("#transactionCreate .txSize").html(tx.size());

Expand Down Expand Up @@ -680,7 +680,7 @@ $(document).ready(function() {
var tx = coinjs.transaction();
tx.listUnspent($("#walletAddress").html(), function(data){
var inputs = $(data).find("unspent").children().length;
if($("#walletSegwit").is(":checked")){
if($("#walletSegwit").is(":checked")){
$("#fees .txi_segwit").val(inputs);
$("#fees .txi_segwit").trigger('input');
} else {
Expand All @@ -696,7 +696,7 @@ $(document).ready(function() {
$("#fees .txo_p2sh").trigger('input');
} else { // p2pkh
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
$("#fees .txo_p2pkh").trigger('input');
$("#fees .txo_p2pkh").trigger('input');
}
});

Expand All @@ -708,7 +708,7 @@ $(document).ready(function() {
$("#fees .txo_p2sh").trigger('input');
} else { // p2pkh
$("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1);
$("#fees .txo_p2pkh").trigger('input');
$("#fees .txo_p2pkh").trigger('input');
}
}

Expand Down Expand Up @@ -959,7 +959,7 @@ $(document).ready(function() {
}
}

/* default function to retreive unspent outputs*/
/* default function to retreive unspent outputs*/
function listUnspentDefault(redeem){
var tx = coinjs.transaction();
tx.listUnspent(redeem.addr, function(data){
Expand Down Expand Up @@ -1018,7 +1018,7 @@ $(document).ready(function() {

/* retrieve unspent data from chain.so for carboncoin */
function listUnspentCryptoidinfo_Carboncoin(redeem) {

$.ajax ({
type: "POST",
url: "https://coinb.in/api/",
Expand Down Expand Up @@ -1143,8 +1143,8 @@ $(document).ready(function() {
});

// broadcast transaction vai coinbin (default)
function rawSubmitDefault(btn){
var thisbtn = btn;
function rawSubmitDefault(btn){
var thisbtn = btn;
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
$.ajax ({
type: "POST",
Expand All @@ -1165,7 +1165,7 @@ $(document).ready(function() {
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
$(thisbtn).val('Submit').attr('disabled',false);
}
});
}
Expand All @@ -1192,13 +1192,13 @@ $(document).ready(function() {
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
$(thisbtn).val('Submit').attr('disabled',false);
}
});
}

// broadcast transaction via chain.so (mainnet)
function rawSubmitChainso_BitcoinMainnet(thisbtn){
function rawSubmitChainso_BitcoinMainnet(thisbtn){
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
$.ajax ({
type: "POST",
Expand All @@ -1209,25 +1209,25 @@ $(document).ready(function() {
var obj = $.parseJSON(data.responseText);
var r = ' ';
r += (obj.data.tx_hex) ? obj.data.tx_hex : '';
r = (r!='') ? r : ' Failed to broadcast'; // build response
r = (r!='') ? r : ' Failed to broadcast'; // build response
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
},
success: function(data) {
if(data.status && data.data.txid){
$("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' Txid: '+data.data.txid);
} else {
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(' Unexpected error, please try again').prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
}
}
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
$(thisbtn).val('Submit').attr('disabled',false);
}
});
}

// broadcast transaction via blockcypher.com (mainnet)
function rawSubmitblockcypher_BitcoinMainnet(thisbtn){
function rawSubmitblockcypher_BitcoinMainnet(thisbtn){
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
$.ajax ({
type: "POST",
Expand All @@ -1237,7 +1237,7 @@ $(document).ready(function() {
var obj = $.parseJSON(data.responseText);
var r = ' ';
r += (obj.error) ? obj.error : '';
r = (r!='') ? r : ' Failed to broadcast'; // build response
r = (r!='') ? r : ' Failed to broadcast'; // build response
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
},
success: function(data) {
Expand All @@ -1249,14 +1249,14 @@ $(document).ready(function() {
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
$(thisbtn).val('Submit').attr('disabled',false);
}
});
}


// broadcast transaction via chain.so for dogecoin
function rawSubmitchainso_dogecoin(thisbtn){
function rawSubmitchainso_dogecoin(thisbtn){
$(thisbtn).val('Please wait, loading...').attr('disabled',true);
$.ajax ({
type: "POST",
Expand All @@ -1267,7 +1267,7 @@ $(document).ready(function() {
var obj = $.parseJSON(data.responseText);
var r = ' ';
r += (obj.data.tx_hex) ? ' '+obj.data.tx_hex : '';
r = (r!='') ? r : ' Failed to broadcast'; // build response
r = (r!='') ? r : ' Failed to broadcast'; // build response
$("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend('<span class="glyphicon glyphicon-exclamation-sign"></span>');
// console.error(JSON.stringify(data, null, 4));
},
Expand All @@ -1281,7 +1281,7 @@ $(document).ready(function() {
},
complete: function(data, status) {
$("#rawTransactionStatus").fadeOut().fadeIn();
$(thisbtn).val('Submit').attr('disabled',false);
$(thisbtn).val('Submit').attr('disabled',false);
}
});
}
Expand Down Expand Up @@ -1700,7 +1700,7 @@ $(document).ready(function() {
$("#coinjs_multisig").val('0x'+(coinjs.multisig).toString(16));

$("#coinjs_hdpub").val('0x'+(coinjs.hdkey.pub).toString(16));
$("#coinjs_hdprv").val('0x'+(coinjs.hdkey.prv).toString(16));
$("#coinjs_hdprv").val('0x'+(coinjs.hdkey.prv).toString(16));

$("#settingsBtn").click(function(){

Expand Down Expand Up @@ -1728,9 +1728,9 @@ $(document).ready(function() {
configureBroadcast();
configureGetUnspentTx();

$("#statusSettings").addClass("alert-success").removeClass("hidden").html("<span class=\"glyphicon glyphicon-ok\"></span> Settings updates successfully").fadeOut().fadeIn();
$("#statusSettings").addClass("alert-success").removeClass("hidden").html("<span class=\"glyphicon glyphicon-ok\"></span> Settings updates successfully").fadeOut().fadeIn();
} else {
$("#statusSettings").addClass("alert-danger").removeClass("hidden").html("There is an error with one or more of your settings");
$("#statusSettings").addClass("alert-danger").removeClass("hidden").html("There is an error with one or more of your settings");
}
});

Expand All @@ -1741,15 +1741,15 @@ $(document).ready(function() {
// deal with broadcasting settings
if(o[5]=="false"){
$("#coinjs_broadcast, #rawTransaction, #rawSubmitBtn, #openBtn").attr('disabled',true);
$("#coinjs_broadcast").val("coinb.in");
$("#coinjs_broadcast").val("coinb.in");
} else {
$("#coinjs_broadcast").val(o[5]);
$("#coinjs_broadcast, #rawTransaction, #rawSubmitBtn, #openBtn").attr('disabled',false);
}

// deal with unspent output settings
if(o[6]=="false"){
$("#coinjs_utxo, #redeemFrom, #redeemFromBtn, #openBtn, .qrcodeScanner").attr('disabled',true);
$("#coinjs_utxo, #redeemFrom, #redeemFromBtn, #openBtn, .qrcodeScanner").attr('disabled',true);
$("#coinjs_utxo").val("coinb.in");
} else {
$("#coinjs_utxo").val(o[6]);
Expand Down Expand Up @@ -1914,7 +1914,7 @@ $(document).ready(function() {
$("#fees .segwit .inputno").html(($("#fees .segwit .inputno").html()*1)+1);
$("#fees .txi_segwit").val(($("#fees .txi_segwit").val()*1)+1);
$("#fees .segwit .bytes").html(($("#fees .segwit .bytes").html()*1)+size);

} else if(script.type == 'multisig'){
var s = coinjs.script();
var rs = s.decodeRedeemScript(script.script);
Expand Down Expand Up @@ -1957,7 +1957,7 @@ $(document).ready(function() {
$("#fees .txoutputs .p2sh .outputno").html(($("#fees .txoutputs .p2sh .outputno").html()*1)+1);
$("#fees .txoutputs .p2sh .bytes").html(($("#fees .txoutputs .p2sh .bytes").html()*1)+32);
$("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1);
}
}
}

feeStats();
Expand All @@ -1975,7 +1975,7 @@ $(document).ready(function() {
inputsTotal += ($(o).html()*1);
inputsBytes += ($(".bytes",$(o).parent()).html()*1);
});

$("#fees .txinputs .txsize").html(inputsBytes.toFixed(0));
$("#fees .txinputs .txtotal").html(inputsTotal.toFixed(0));

Expand All @@ -1985,7 +1985,7 @@ $(document).ready(function() {
outputsTotal += ($(o).html()*1);
outputsBytes += ($(".bytes",$(o).parent()).html()*1);
});

$("#fees .txoutputs .txsize").html(outputsBytes.toFixed(0));
$("#fees .txoutputs .txtotal").html(outputsTotal.toFixed(0));

Expand Down