diff --git a/js/coinbin.js b/js/coinbin.js index 0faef17..9b9c0bb 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -510,8 +510,7 @@ $(document).ready(function() { /* redeem from button code */ $("#redeemFromBtn").click(function(){ - var string = $("#redeemFrom").val(); - var redeem = redeemingFrom(string); + var redeem = redeemingFrom($("#redeemFrom").val()); $("#redeemFromStatus, #redeemFromAddress").addClass('hidden'); @@ -533,11 +532,11 @@ $(document).ready(function() { var host = $(this).attr('rel'); if(host=='blockr.io_bitcoinmainnet'){ - listUnspentBlockrio_BitcoinMainnet(redeem.addr); + listUnspentBlockrio_BitcoinMainnet(redeem); } else if(host=='chain.so_litecoin'){ - listUnspentChainso_Litecoin(redeem.addr); + listUnspentChainso_Litecoin(redeem); } else { - listUnspentDefault(redeem.addr); + listUnspentDefault(redeem); } }); @@ -593,16 +592,16 @@ $(document).ready(function() { } /* default function to retreive unspent outputs*/ - function listUnspentDefault(addr){ + function listUnspentDefault(redeem){ var tx = coinjs.transaction(); - tx.listUnspent(addr, function(data){ - if(addr) { - $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+addr+''); + tx.listUnspent(redeem.addr, function(data){ + if(redeem.addr) { + $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+redeem.addr+''); $.each($(data).find("unspent").children(), function(i,o){ var tx = $(o).find("tx_hash").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); addOutput(tx, n, script, amount); @@ -615,22 +614,22 @@ $(document).ready(function() { } /* retrieve unspent data from blockrio for mainnet */ - function listUnspentBlockrio_BitcoinMainnet(addr){ + function listUnspentBlockrio_BitcoinMainnet(redeem){ $.ajax ({ 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", error: function(data) { $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs!'); }, success: function(data) { if((data.status && data.data) && data.status=='success'){ - $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+addr+''); + $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+redeem.addr+''); for(var i in data.data.unspent){ var o = data.data.unspent[i]; var tx = o.tx; var n = o.n; - var script = o.script; + var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script; var amount = o.amount; addOutput(tx, n, script, amount); } @@ -646,10 +645,10 @@ $(document).ready(function() { } /* retrieve unspent data from blockrio for litecoin */ - function listUnspentChainso_Litecoin(addr){ + function listUnspentChainso_Litecoin(redeem){ $.ajax ({ 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", error: function(data) { $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs!'); @@ -657,12 +656,12 @@ $(document).ready(function() { success: function(data) { console.log(data); if((data.status && data.data) && data.status=='success'){ - $("#redeemFromAddress").removeClass('hidden').html(' Retrieved unspent inputs from address '+addr+''); + $("#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; var n = o.output_no; - var script = o.script_hex; + var script = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex; var amount = o.value; addOutput(tx, n, script, amount); } diff --git a/sha1sum b/sha1sum index fb879e7..74993f2 100644 --- a/sha1sum +++ b/sha1sum @@ -1,4 +1,4 @@ ----- Version 1.2 2015.07.27 ---- +---- Version 1.2 2015.08.14 ---- e6810907c901e6bd34a28735a68850936f0823b8 ./js/ellipticcurve.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js @@ -11,7 +11,7 @@ ad038e1f39646b68ae666324ed4c2882a8c42474 ./js/qrcode.js 64eb4ea5c882f8bce3e1885bf00728455f1c2f4c ./js/ripemd160.js 114089ef2a3feb6d4db4f9cabcb186d7750d5884 ./js/sha512.js 8c2654113866b4a57fec302665ca2187a3eb7614 ./js/coin.js -e544bb942aeb35a18a4cd7e0b440e6bba7a8e04f ./js/coinbin.js +4b24ab93c1cb7068d5396d0794b2818c6a889daa ./js/coinbin.js ae49e56999d82802727455f0ba83b63acd90a22b ./js/jquery-1.9.1.min.js 5f570018ed044eafd464f7e0ab1783b966224055 ./LICENCE ed29315e0ffb3f14382431f2724235bf67f44eb3 ./css/bootstrap.min.css @@ -24,5 +24,5 @@ ca35b697d99cae4d1b60f2d60fcd37771987eb07 ./fonts/glyphicons-halflings-regular.w de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.svg 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf -fe8d57914bb036ab94e86ec35b2671eeb6d20d0d ./README.md -f8d50a5ea3a06edacf2948f150221e027f1c1253 ./index.html +0f5262c7910512cdcf38a6004129154be77ff2ee ./README.md +0ed7525c0504e2cb967f9fb0f9708fe6a345bfa6 ./index.html