diff --git a/index.html b/index.html index f95a004..323edc3 100644 --- a/index.html +++ b/index.html @@ -158,7 +158,9 @@ @@ -256,7 +259,7 @@
- +
diff --git a/js/coin.js b/js/coin.js index 5dd56fa..a314dc8 100644 --- a/js/coin.js +++ b/js/coin.js @@ -1033,7 +1033,6 @@ var self = this; this.listUnspent(address, function(data){ var s = coinjs.script(); - var pubkeyScript = s.pubkeyHash(address); var value = 0; var total = 0; var x = {}; diff --git a/js/coinbin.js b/js/coinbin.js index 7db57ac..c9c693c 100644 --- a/js/coinbin.js +++ b/js/coinbin.js @@ -37,11 +37,17 @@ $(document).ready(function() { $("#walletKeys .walletSegWitRS").addClass("hidden"); if($("#walletSegwit").is(":checked")){ - var sw = coinjs.segwitAddress(pubkey); - address = sw.address; + if($("#walletSegwitBech32").is(":checked")){ + var sw = coinjs.bech32Address(pubkey); + address = sw.address; + } else { + + var sw = coinjs.segwitAddress(pubkey); + address = sw.address; + } $("#walletKeys .walletSegWitRS").removeClass("hidden"); - $("#walletKeys .walletSegWitRS input:text").val(sw.redeemscript); + $("#walletKeys .walletSegWitRS input:text").val(sw.redeemscript); } $("#walletAddress").html(address); @@ -94,9 +100,25 @@ $(document).ready(function() { $("#openLoginStatus").html("").hide(); }); + $("#walletSegwit").click(function(){ + if($(this).is(":checked")){ + $(".walletSegwitType").attr('disabled',false); + } else { + $(".walletSegwitType").attr('disabled',true); + } + }); + $("#walletToSegWit").click(function(){ $("#walletToBtn").html('SegWit '); $("#walletSegwit")[0].checked = true; + $("#walletSegwitp2sh")[0].checked = true; + $("#openBtn").click(); + }); + + $("#walletToSegWitBech32").click(function(){ + $("#walletToBtn").html('Bech32 '); + $("#walletSegwit")[0].checked = true; + $("#walletSegwitBech32")[0].checked = true; $("#openBtn").click(); }); @@ -106,7 +128,6 @@ $(document).ready(function() { $("#openBtn").click(); }); - $("#walletShowKeys").click(function(){ $("#walletKeys").removeClass("hidden"); $("#walletSpend").removeClass("hidden").addClass("hidden"); @@ -142,7 +163,11 @@ $(document).ready(function() { var script = false; if($("#walletSegwit").is(":checked")){ - var sw = coinjs.segwitAddress($("#walletKeys .pubkey").val()); + if($("#walletSegwitBech32").is(":checked")){ + var sw = coinjs.bech32Address($("#walletKeys .pubkey").val()); + } else { + var sw = coinjs.segwitAddress($("#walletKeys .pubkey").val()); + } script = sw.redeemscript; } @@ -699,24 +724,24 @@ $(document).ready(function() { $.each($("#walletSpendTo .output"), function(i,o){ var addr = $('.addressTo',o); var ad = coinjs.addressDecode(addr.val()); - if (ad.version == coinjs.multisig){ // p2sh - $("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1); - $("#fees .txo_p2sh").trigger('input'); - } else { // p2pkh + if (ad.version == coinjs.pub){ // p2pkh $("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1); $("#fees .txo_p2pkh").trigger('input'); + } else { // p2psh + $("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1); + $("#fees .txo_p2sh").trigger('input'); } }); if(($("#developerDonation").val()*1)>0){ var addr = coinjs.developer; var ad = coinjs.addressDecode(addr); - if (ad.version == coinjs.multisig){ // p2sh + if (ad.version == coinjs.pub){ // p2pkh + $("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1); + $("#fees .txo_p2pkh").trigger('input'); + } else { // p2psh $("#fees .txo_p2sh").val(($("#fees .txo_p2sh").val()*1)+1); $("#fees .txo_p2sh").trigger('input'); - } else { // p2pkh - $("#fees .txo_p2pkh").val(($("#fees .txo_p2pkh").val()*1)+1); - $("#fees .txo_p2pkh").trigger('input'); } } diff --git a/sha1sum b/sha1sum index a0b0718..6fd8b72 100644 --- a/sha1sum +++ b/sha1sum @@ -1,9 +1,9 @@ ----- Version 1.4 2018.05.27 --- +---- Version 1.4 2018.06.11 --- 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js 3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js 253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js -dda26795fcd22541612067d44cf72ecae62f092b ./js/coinbin.js -eec3c5f1c5f69a34205613f6bf62ff9cc5a8d07a ./js/coin.js +988f99187ab356bc5d12b61572f463e1785c15c2 ./js/coinbin.js +9b12eedab976f201ae5ee084701a038eebea5c9c ./js/coin.js 988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js @@ -31,4 +31,4 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf c024021c71cba503979a859d23cbf7a88b570d82 ./README.md -208b64a1ef61aaceec82f06515e4f7cf046793f6 ./index.html +26552aac02a06e88b419539f93032de8a25e1edd ./index.html