From 21ecedaa4806f948df007cbb064f2e777e058227 Mon Sep 17 00:00:00 2001 From: OutCast3k Date: Sun, 11 Sep 2016 18:40:18 +0000 Subject: [PATCH] added full carboncoin support --- index.html | 4 +++- js/coinbin.js | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++- sha1sum | 6 ++--- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 1a97b9a..df6daed 100644 --- a/index.html +++ b/index.html @@ -971,7 +971,7 @@ - + @@ -1032,6 +1032,7 @@ + @@ -1048,6 +1049,7 @@ + diff --git a/js/coinbin.js b/js/coinbin.js index ddde353..a6cd29b 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -679,12 +679,16 @@ $(document).ready(function() { $("#redeemFromBtn").html("Please wait, loading...").attr('disabled',true); var host = $(this).attr('rel'); + + if(host=='blockr.io_bitcoinmainnet'){ listUnspentBlockrio_BitcoinMainnet(redeem); } else if(host=='chain.so_litecoin'){ listUnspentChainso_Litecoin(redeem); } else if(host=='chain.so_dogecoin'){ listUnspentChainso_Dogecoin(redeem); + } else if(host=='cryptoid.info_carboncoin'){ + listUnspentCryptoidinfo_Carboncoin(redeem); } else { listUnspentDefault(redeem); } @@ -872,6 +876,56 @@ $(document).ready(function() { } + /* retrieve unspent data from chain.so for carboncoin */ + function listUnspentCryptoidinfo_Carboncoin(redeem) { + + $.ajax ({ + type: "POST", + url: "https://coinb.in/api/", + data: 'uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=carboncoin&request=listunspent&address='+redeem.addr, + dataType: "xml", + error: function() { + $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs!'); + }, + success: function(data) { + if($(data).find("result").text()==1){ + $("#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 = (redeem.isMultisig==true) ? $("#redeemFrom").val() : o.script_hex; + var amount = (($(o).find("value").text()*1)/100000000).toFixed(8); + addOutput(tx, n, script, amount); + }); + } else { + $("#redeemFromStatus").removeClass('hidden').html(' Unexpected error, unable to retrieve unspent outputs.'); + } + }, + complete: function(data, status) { + $("#redeemFromBtn").html("Load").attr('disabled',false); + totalInputAmount(); + } + }); + + + /* $.ajax ({ + type: "POST", + url: 'https://coinb.in/api/', + dataType: 'xml', + error: function(data) { + }, + success: function(data) { + }, + complete: function(data, status) { + $("#redeemFromBtn").html("Load").attr('disabled',false); + totalInputAmount(); + } + }); + + */ + + } + /* retrieve unspent data from chain.so for dogecoin */ function listUnspentChainso_Dogecoin(redeem){ $.ajax ({ @@ -969,10 +1023,14 @@ $(document).ready(function() { // broadcast transaction vai coinbin (default) function rawSubmitDefault(btn){ var thisbtn = btn; + } + + // broadcast transaction via cryptoid + function rawSubmitcryptoid_Carboncoin(thisbtn) { $(thisbtn).val('Please wait, loading...').attr('disabled',true); $.ajax ({ type: "POST", - url: coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=bitcoin&request=sendrawtransaction', + url: coinjs.host+'?uid='+coinjs.uid+'&key='+coinjs.key+'&setmodule=carboncoin&request=sendrawtransaction', data: {'rawtx':$("#rawTransaction").val()}, dataType: "xml", error: function(data) { @@ -1612,6 +1670,10 @@ $(document).ready(function() { $("#rawSubmitBtn").click(function(){ rawSubmitblockcypher_BitcoinMainnet(this); }); + } else if(host=="cryptoid.info_carboncoin"){ + $("#rawSubmitBtn").click(function(){ + rawSubmitcryptoid_Carboncoin(this); + }); } else { $("#rawSubmitBtn").click(function(){ rawSubmitDefault(this); // revert to default diff --git a/sha1sum b/sha1sum index 374a888..d2313b8 100644 --- a/sha1sum +++ b/sha1sum @@ -1,8 +1,8 @@ ----- Version 1.2 2016.09.06 ---- +---- Version 1.2 2016.09.11 ---- 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js 3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js 253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js -4d5125c65432bfebfd1fa2d0dca0af1d037bc7e9 ./js/coinbin.js +b4389c2eed22172cbe762a44fa0081d1a7bb2da8 ./js/coinbin.js b9af8c7b34429b0513972107d9b22b84e9d4fc8a ./js/coin.js 988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js @@ -30,4 +30,4 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf b4d3a33913a0877684909f7edf8b79bf9192b0a7 ./README.md -e4dd0465f6b4de21d0ac6f81deaa7872479ef705 ./index.html +e4f5289b5d3d626405bb071560e58d53622208b5 ./index.html