diff --git a/index.html b/index.html index 31d0a76..60309d6 100644 --- a/index.html +++ b/index.html @@ -1006,6 +1006,7 @@ + diff --git a/js/coinbin.js b/js/coinbin.js index 7a150b9..9f7be7e 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -966,6 +966,35 @@ $(document).ready(function() { }); } + // broadcast transaction via blockcypher.com (mainnet) + function rawSubmitblockcypher_BitcoinMainnet(thisbtn){ + $(thisbtn).val('Please wait, loading...').attr('disabled',true); + $.ajax ({ + type: "POST", + url: "https://api.blockcypher.com/v1/btc/main/txs/push", + data: JSON.stringify({"tx":$("#rawTransaction").val()}), + error: function(data) { + var obj = $.parseJSON(data.responseText); + var r = ' '; + r += (obj.error) ? obj.error : ''; + r = (r!='') ? r : ' Failed to broadcast'; // build response + $("#rawTransactionStatus").addClass('alert-danger').removeClass('alert-success').removeClass("hidden").html(r).prepend(''); + }, + success: function(data) { + var obj = $.parseJSON(data.responseText); + if(obj.hash){ + $("#rawTransactionStatus").addClass('alert-success').removeClass('alert-danger').removeClass("hidden").html(' Txid: '+obj.hash); + } 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 blockr.io for litecoin function rawSubmitBlockrio_litecoin(thisbtn){ $(thisbtn).val('Please wait, loading...').attr('disabled',true); @@ -1451,6 +1480,10 @@ $(document).ready(function() { $("#rawSubmitBtn").click(function(){ rawSubmitChainso_BitcoinMainnet(this); }); + } else if(host=="blockcypher_bitcoinmainnet"){ + $("#rawSubmitBtn").click(function(){ + rawSubmitblockcypher_BitcoinMainnet(this); + }); } else { $("#rawSubmitBtn").click(function(){ rawSubmitDefault(this); // revert to default diff --git a/sha1sum b/sha1sum index d14fb5c..4f13db2 100644 --- a/sha1sum +++ b/sha1sum @@ -3,7 +3,7 @@ 3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js 253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js ca3f654f247fef67de2cf6e01c3aa80db1812e5d ./js/coin.js -664ee79f35a73b754725c52c14257cc781a9ef50 ./js/coinbin.js +d109119cae40e0fb7d1c95d01069ce81d19b45ec ./coinbin.js 988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js @@ -30,4 +30,4 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf 48ff08f459ff55ae54e594b4ae307d1d8e6f74b3 ./README.md -000c945b6fae0e7450a9bad857094374eb4e2db2 ./index.html +05bc991db2105acda4333792582f5350012a0129 ./index.html