few minor changes, plus the wallet now enables rbf by default

This commit is contained in:
OutCast3k 2018-01-06 16:11:20 +00:00
parent ed7d5d6411
commit c3b1a47199
4 changed files with 25 additions and 9 deletions

View file

@ -159,6 +159,11 @@
<p class="checkbox"> <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>
</p> </p>
<label>Enable Replace by Fee (RBF)</label>
<p class="checkbox">
<label><input type="checkbox" id="walletRBF" class="checkbox-inline" checked> Enable RBF on all transactions, allowing the user to manually bump the transaction later if required. <span class="text-muted"><i>(recommended)</i></span></label></label>
</p>
</div> </div>
</div> </div>
<div id="openLoginStatus" class="alert alert-danger hidden"></div> <div id="openLoginStatus" class="alert alert-danger hidden"></div>
@ -1077,7 +1082,10 @@
<div class="hidden verifyData" id="verifyPubKey"> <div class="hidden verifyData" id="verifyPubKey">
<h4>Public key</h4> <h4>Public key</h4>
<p><span style="float:right"><a href="" target="_blank" class="verifyLink" title="Link to this page"><span class="glyphicon glyphicon-link"></span></a></span>The above public key has been encoded to its address</p> <p><span style="float:right"><a href="" target="_blank" class="verifyLink" title="Link to this page"><span class="glyphicon glyphicon-link"></span></a></span>The above public key has been encoded to its address</p>
<p><b>Address</b>: <input type="text" class="form-control address" readonly></p> <p><b>Address</b>:<span class="text-muted">(Legacy)</span>: <input type="text" class="form-control address" readonly></p>
<br>
<p><b>Segwit Address</b>: <input type="text" class="form-control addressSegWit" readonly></p>
<p><b>Segwit Redeem Script</b>: <input type="text" class="form-control addressSegWitRedeemScript" readonly></p>
</div> </div>
<div class="hidden verifyData" id="verifyHDaddress"> <div class="hidden verifyData" id="verifyHDaddress">

View file

@ -882,7 +882,7 @@
} }
/* add unspent to transaction */ /* add unspent to transaction */
r.addUnspent = function(address, callback, script, segwit){ r.addUnspent = function(address, callback, script, segwit, sequence){
var self = this; var self = this;
this.listUnspent(address, function(data){ this.listUnspent(address, function(data){
var s = coinjs.script(); var s = coinjs.script();
@ -919,7 +919,8 @@
scr = Crypto.util.bytesToHex(s.buffer); scr = Crypto.util.bytesToHex(s.buffer);
} }
self.addinput(txhash, n, scr); var seq = sequence || false;
self.addinput(txhash, n, scr, seq);
value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1; value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;
total++; total++;
} }

View file

@ -146,6 +146,11 @@ $(document).ready(function() {
script = sw.redeemscript; script = sw.redeemscript;
} }
var sequence = false;
if($("#walletRBF").is(":checked")){
sequence = 0xffffffff-2;
}
tx.addUnspent($("#walletAddress").html(), function(data){ tx.addUnspent($("#walletAddress").html(), function(data){
var dvalue = (data.value/100000000).toFixed(8) * 1; var dvalue = (data.value/100000000).toFixed(8) * 1;
@ -186,7 +191,7 @@ $(document).ready(function() {
$("#walletLoader").addClass("hidden"); $("#walletLoader").addClass("hidden");
}, script, script); }, script, script, sequence);
}); });
$("#walletSendBtn").click(function(){ $("#walletSendBtn").click(function(){
@ -1471,6 +1476,9 @@ $(document).ready(function() {
if(pubkey.length==66 || pubkey.length==130){ if(pubkey.length==66 || pubkey.length==130){
try { try {
$("#verifyPubKey .address").val(coinjs.pubkey2address(pubkey)); $("#verifyPubKey .address").val(coinjs.pubkey2address(pubkey));
var sw = coinjs.segwitAddress(pubkey);
$("#verifyPubKey .addressSegWit").val(sw.address);
$("#verifyPubKey .addressSegWitRedeemScript").val(sw.redeemscript);
$("#verifyPubKey").removeClass("hidden"); $("#verifyPubKey").removeClass("hidden");
$(".verifyLink").attr('href','?verify='+$("#verifyScript").val()); $(".verifyLink").attr('href','?verify='+$("#verifyScript").val());
return true; return true;

View file

@ -1,9 +1,9 @@
---- Version 1.3 2018.01.04 --- ---- Version 1.3 2018.01.06 ---
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js 77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js 3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js 253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
c23f25f218ed8a05376c2f7d98d7056ee9738c74 ./js/coinbin.js de4506d9cfb7b524d1ab86db8833b07f9aac44a6 ./js/coinbin.js
31fbebf65d9cae8f26761cb057c4fb1b97339d08 ./js/coin.js cb2843fe530d575cc29b83f9761a2920259fc8a7 ./js/coin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js 988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js 9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js
f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js f7c09f2f5a721371e7d478050119f7e2d58e3ef9 ./js/crypto-sha256-hmac.js
@ -31,5 +31,4 @@ de51a8494180a6db074af2dee2383f0a363c5b08 ./fonts/glyphicons-halflings-regular.s
278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff 278e49a86e634da6f2a02f3b47dd9d2a8f26210f ./fonts/glyphicons-halflings-regular.woff
44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf 44bc1850f570972267b169ae18f1cb06b611ffa2 ./fonts/glyphicons-halflings-regular.ttf
d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
4cd31f66eafbf86e98def4db6ff1b13ba5dcf01a ./index.html a75a6c24108b8ad126d815e8a83316d17e0f1899 ./index.html