minor bug fix from previous commit

This commit is contained in:
OutCast3k 2015-08-14 22:09:51 +00:00
parent a1c3c60244
commit 8e0742d64c
2 changed files with 21 additions and 22 deletions

View file

@ -510,8 +510,7 @@ $(document).ready(function() {
/* redeem from button code */ /* redeem from button code */
$("#redeemFromBtn").click(function(){ $("#redeemFromBtn").click(function(){
var string = $("#redeemFrom").val(); var redeem = redeemingFrom($("#redeemFrom").val());
var redeem = redeemingFrom(string);
$("#redeemFromStatus, #redeemFromAddress").addClass('hidden'); $("#redeemFromStatus, #redeemFromAddress").addClass('hidden');
@ -533,11 +532,11 @@ $(document).ready(function() {
var host = $(this).attr('rel'); var host = $(this).attr('rel');
if(host=='blockr.io_bitcoinmainnet'){ if(host=='blockr.io_bitcoinmainnet'){
listUnspentBlockrio_BitcoinMainnet(redeem.addr); listUnspentBlockrio_BitcoinMainnet(redeem);
} else if(host=='chain.so_litecoin'){ } else if(host=='chain.so_litecoin'){
listUnspentChainso_Litecoin(redeem.addr); listUnspentChainso_Litecoin(redeem);
} else { } else {
listUnspentDefault(redeem.addr); listUnspentDefault(redeem);
} }
}); });
@ -593,16 +592,16 @@ $(document).ready(function() {
} }
/* default function to retreive unspent outputs*/ /* default function to retreive unspent outputs*/
function listUnspentDefault(addr){ function listUnspentDefault(redeem){
var tx = coinjs.transaction(); var tx = coinjs.transaction();
tx.listUnspent(addr, function(data){ tx.listUnspent(redeem.addr, function(data){
if(addr) { if(redeem.addr) {
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+addr+'" target="_blank">'+addr+'</a>'); $("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
$.each($(data).find("unspent").children(), function(i,o){ $.each($(data).find("unspent").children(), function(i,o){
var tx = $(o).find("tx_hash").text(); var tx = $(o).find("tx_hash").text();
var n = $(o).find("tx_output_n").text(); var n = $(o).find("tx_output_n").text();
var script = (addr.isMultisig==true) ? $("#inputs .txIdScript:last").val(string) :$(o).find("script").text(); var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : $(o).find("script").text();
var amount = (($(o).find("value").text()*1)/100000000).toFixed(8); var amount = (($(o).find("value").text()*1)/100000000).toFixed(8);
addOutput(tx, n, script, amount); addOutput(tx, n, script, amount);
@ -615,22 +614,22 @@ $(document).ready(function() {
} }
/* retrieve unspent data from blockrio for mainnet */ /* retrieve unspent data from blockrio for mainnet */
function listUnspentBlockrio_BitcoinMainnet(addr){ function listUnspentBlockrio_BitcoinMainnet(redeem){
$.ajax ({ $.ajax ({
type: "POST", type: "POST",
url: "https://btc.blockr.io/api/v1/address/unspent/"+addr, url: "https://btc.blockr.io/api/v1/address/unspent/"+redeem.addr,
dataType: "json", dataType: "json",
error: function(data) { error: function(data) {
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!'); $("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!');
}, },
success: function(data) { success: function(data) {
if((data.status && data.data) && data.status=='success'){ if((data.status && data.data) && data.status=='success'){
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+addr+'" target="_blank">'+addr+'</a>'); $("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
for(var i in data.data.unspent){ for(var i in data.data.unspent){
var o = data.data.unspent[i]; var o = data.data.unspent[i];
var tx = o.tx; var tx = o.tx;
var n = o.n; var n = o.n;
var script = o.script; var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script;
var amount = o.amount; var amount = o.amount;
addOutput(tx, n, script, amount); addOutput(tx, n, script, amount);
} }
@ -646,10 +645,10 @@ $(document).ready(function() {
} }
/* retrieve unspent data from blockrio for litecoin */ /* retrieve unspent data from blockrio for litecoin */
function listUnspentChainso_Litecoin(addr){ function listUnspentChainso_Litecoin(redeem){
$.ajax ({ $.ajax ({
type: "GET", type: "GET",
url: "https://chain.so/api/v2/get_tx_unspent/ltc/"+addr, url: "https://chain.so/api/v2/get_tx_unspent/ltc/"+redeem.addr,
dataType: "json", dataType: "json",
error: function(data) { error: function(data) {
$("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!'); $("#redeemFromStatus").removeClass('hidden').html('<span class="glyphicon glyphicon-exclamation-sign"></span> Unexpected error, unable to retrieve unspent outputs!');
@ -657,12 +656,12 @@ $(document).ready(function() {
success: function(data) { success: function(data) {
console.log(data); console.log(data);
if((data.status && data.data) && data.status=='success'){ if((data.status && data.data) && data.status=='success'){
$("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+addr+'" target="_blank">'+addr+'</a>'); $("#redeemFromAddress").removeClass('hidden').html('<span class="glyphicon glyphicon-info-sign"></span> Retrieved unspent inputs from address <a href="https://btc.blockr.io/address/info/'+redeem.addr+'" target="_blank">'+redeem.addr+'</a>');
for(var i in data.data.txs){ for(var i in data.data.txs){
var o = data.data.txs[i]; var o = data.data.txs[i];
var tx = o.txid; var tx = o.txid;
var n = o.output_no; var n = o.output_no;
var script = o.script_hex; var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex;
var amount = o.value; var amount = o.value;
addOutput(tx, n, script, amount); addOutput(tx, n, script, amount);
} }

View file

@ -1,4 +1,4 @@
---- Version 1.2 2015.07.27 ---- ---- Version 1.2 2015.08.14 ----
e6810907c901e6bd34a28735a68850936f0823b8 ./js/ellipticcurve.js e6810907c901e6bd34a28735a68850936f0823b8 ./js/ellipticcurve.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
@ -11,7 +11,7 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js
64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js 64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js
114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js 114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js
8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js 8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js
e544bb942aeb35a18a4cd7e0b440e6bba7a8e04f ./js/coinbin.js 4b24ab93c1cb7068d5396d0794b2818c6a889daa ./js/coinbin.js
ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js
5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE 5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE
ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css
@ -24,5 +24,5 @@ ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.w
de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
fe8d57914bb036ab94e86ec35b2671eeb6d20d0d ./README.md 0f5262c7910512cdcf38a6004129154be77ff2ee ./README.md
f8d50a5ea3a06edacf2948f150221e027f1c1253 ./index.html 0ed7525c0504e2cb967f9fb0f9708fe6a345bfa6 ./index.html