From c7a0fda7e546a98670a3894b47dba43978e96cd1 Mon Sep 17 00:00:00 2001 From: Wowee0 Date: Fri, 19 Apr 2019 10:40:59 -0500 Subject: [PATCH 1/3] re-enabled Litecoin --- index.html | 2 ++ js/coinbin.js | 47 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 323edc3..6d3f3f0 100644 --- a/index.html +++ b/index.html @@ -1334,6 +1334,7 @@

Select which network you'd like to use for key pair generation.

diff --git a/js/coinbin.js b/js/coinbin.js index 01b0cce..f9c67a6 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -1037,11 +1037,13 @@ $(document).ready(function() { $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+redeem.addr+''); for(var i in data.data.txs){ var o = data.data.txs[i]; - var tx = ((o.txid).match(/.{1,2}/g).reverse()).join("")+''; - var n = o.output_no; - var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex; - var amount = o.value; - addOutput(tx, n, script, amount); + var tx = ((""+o.txid).match(/.{1,2}/g).reverse()).join("")+''; + if(tx.match(/^[a-f0-9]+$/)){ + var n = o.output_no; + var script = (redeem.redeemscript==true) ? redeem.decodedRs : o.script_hex; + var amount = o.value; + addOutput(tx, n, script, amount); + } } } else { $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs.'); @@ -1294,6 +1296,37 @@ $(document).ready(function() { } + // broadcast transaction via chain.so for litecoin + function rawSubmitchainso_litecoin(thisbtn){ + $(thisbtn).val('Please wait, loading...').attr('disabled',true); + $.ajax ({ + type: "POST", + url: "https://chain.so/api/v2/send_tx/LTC", + data: {"tx_hex":$("#rawTransaction").val()}, + dataType: "json", + error: function(data) { + var obj = $.parseJSON(data.responseText); + var r = ' '; + r += (obj.data.tx_hex) ? ' '+obj.data.tx_hex : ''; + r = (r!='') ? r : ' Failed to broadcast'; // build response + $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend(''); + // console.error(JSON.stringify(data, null, 4)); + }, + success: function(data) { + // console.info(JSON.stringify(data, null, 4)); + if((data.status && data.data) && data.status=='success'){ + $("#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(''); + } + }, + complete: function(data, status) { + $("#rawTransactionStatus").fadeOut().fadeIn(); + $(thisbtn).val('Submit').attr('disabled',false); + } + }); + } + // broadcast transaction via chain.so for dogecoin function rawSubmitchainso_dogecoin(thisbtn){ $(thisbtn).val('Please wait, loading...').attr('disabled',true); @@ -1823,6 +1856,10 @@ $(document).ready(function() { $("#rawSubmitBtn").click(function(){ rawSubmitChainso_BitcoinMainnet(this); }); + } else if(host=="chain.so_litecoin"){ + $("#rawSubmitBtn").click(function(){ + rawSubmitchainso_litecoin(this); + }); } else if(host=="chain.so_dogecoin"){ $("#rawSubmitBtn").click(function(){ rawSubmitchainso_dogecoin(this); From 10aa011c6e2210d9657ce034b35fadd9f7a3aada Mon Sep 17 00:00:00 2001 From: Wowee0 Date: Sat, 20 Apr 2019 23:28:40 -0500 Subject: [PATCH 2/3] LTC SegWit (pre-bech32) address version changed from 5 to 50 (i.e. 3-addresses changed to M-addresses) --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 6d3f3f0..ab06dd5 100644 --- a/index.html +++ b/index.html @@ -1334,7 +1334,7 @@

Select which network you'd like to use for key pair generation.