added a bech32 address to the #wallet section of coinb.in

This commit is contained in:
OutCast3k 2018-06-11 16:23:18 +00:00
parent 734e6b2eeb
commit 5a65a77bd2
4 changed files with 47 additions and 20 deletions

View file

@ -158,7 +158,9 @@
<div class="hidden optionsAdvanced">
<label>Segregated Witness Address</label>
<p class="checkbox">
<label><input type="checkbox" id="walletSegwit" class="checkbox-inline" checked> Use a segwit address instead of a regular address. <span class="text-muted"><i>(recommended)</i></span></label></label>
<label><input type="checkbox" id="walletSegwit" class="checkbox-inline" checked> Use a segwit address instead of a regular address. <span class="text-muted"><i>(recommended)</i></span></label></label> <br>
<label><input type="radio" id="walletSegwitp2sh" class="walletSegwitType" name="walletSegWitType" value="p2sh" checked> p2sh address</label> <br>
<label><input type="radio" id="walletSegwitBech32" class="walletSegwitType" name="walletSegWitType" value="bech32"> bech32 address</label>
</p>
<label>Enable Replace by Fee (RBF)</label>
@ -188,6 +190,7 @@
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" id="walletToBtn">SegWit <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="javascript:;" id="walletToSegWit">SegWit</a></li>
<li><a href="javascript:;" id="walletToSegWitBech32">SegWit/Bech32</a></li>
<li><a href="javascript:;" id="walletToLegacy">Legacy</a></li>
</ul>
</div>
@ -256,7 +259,7 @@
<div class="row">
<div class="col-xs-6">
<label><abbr title="the amount to pay in network miner fee">Transaction Fee</abbr>&nbsp;&nbsp;<a href="javascript:;" id="feesestwallet"><span class="glyphicon glyphicon-question-sign"></span></a></label>
<input type="text" class="form-control" value="0.0004" id="txFee">
<input type="text" class="form-control" value="0.00004000" id="txFee">
</div>
<div class="col-xs-5">
<label><abbr title="the amount to donate to coinb.in">Donation</abbr></label>

View file

@ -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 = {};

View file

@ -37,8 +37,14 @@ $(document).ready(function() {
$("#walletKeys .walletSegWitRS").addClass("hidden");
if($("#walletSegwit").is(":checked")){
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);
@ -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 <span class="caret"></span>');
$("#walletSegwit")[0].checked = true;
$("#walletSegwitp2sh")[0].checked = true;
$("#openBtn").click();
});
$("#walletToSegWitBech32").click(function(){
$("#walletToBtn").html('Bech32 <span class="caret"></span>');
$("#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")){
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
$("#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');
}
}

View file

@ -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