code was missing for the segwit feature from the #wallet section
This commit is contained in:
parent
4a4f302fe6
commit
ecb18acb0f
4 changed files with 21 additions and 12 deletions
|
@ -5,8 +5,8 @@
|
|||
<title>Bitcoin Wallet by Coinb.in</title>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||
<meta name="keywords" content="bitcoin, wallet, multisig, multisignature, address, browser, javascript, js, broadcast, transaction, verify, decode" />
|
||||
<meta name="description" content="A Bitcoin Wallet written in Javascript. Supports Multisig, Custom Transactions, nLockTime and more!" />
|
||||
<meta name="keywords" content="bitcoin, wallet, multisig, multisignature, address, browser, segwit, javascript, js, broadcast, transaction, verify, decode" />
|
||||
<meta name="description" content="A Bitcoin Wallet written in Javascript. Supports Multisig, SegWit, Custom Transactions, nLockTime and more!" />
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
|
14
js/coin.js
14
js/coin.js
|
@ -876,7 +876,7 @@
|
|||
}
|
||||
|
||||
/* add unspent to transaction */
|
||||
r.addUnspent = function(address, callback, script){
|
||||
r.addUnspent = function(address, callback, script, segwit){
|
||||
var self = this;
|
||||
this.listUnspent(address, function(data){
|
||||
var s = coinjs.script();
|
||||
|
@ -902,8 +902,18 @@
|
|||
var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue;
|
||||
var scr = script || u.getElementsByTagName("script")[0].childNodes[0].nodeValue;
|
||||
|
||||
self.addinput(txhash, n, scr);
|
||||
if(segwit){
|
||||
/* this is a small hack to include the value with the redeemscript to make the signing procedure smoother.
|
||||
It is not standard and removed during the signing procedure. */
|
||||
|
||||
s = coinjs.script();
|
||||
s.writeBytes(Crypto.util.hexToBytes(script));
|
||||
s.writeOp(0);
|
||||
s.writeBytes(coinjs.numToBytes(u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1, 8));
|
||||
scr = Crypto.util.bytesToHex(s.buffer);
|
||||
}
|
||||
|
||||
self.addinput(txhash, n, scr);
|
||||
value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;
|
||||
total++;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ $(document).ready(function() {
|
|||
var script = false;
|
||||
if($("#walletSegwit").is(":checked")){
|
||||
var sw = coinjs.segwitAddress($("#walletKeys .pubkey").val());
|
||||
scrip = sw.redeemscript;
|
||||
script = sw.redeemscript;
|
||||
}
|
||||
|
||||
tx.addUnspent($("#walletAddress").html(), function(data){
|
||||
|
@ -148,7 +148,7 @@ $(document).ready(function() {
|
|||
// and finally broadcast!
|
||||
tx2.broadcast(function(data){
|
||||
if($(data).find("result").text()=="1"){
|
||||
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-success').html("txid: "+$(data).find("txid").text());
|
||||
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-success').html('txid: <a href="https://coinb.in/tx/'+$(data).find("txid").text()+'" target="_blank">'+$(data).find("txid").text()+'</a>');
|
||||
} else {
|
||||
$("#walletSendConfirmStatus").removeClass('hidden').addClass('alert-danger').html(unescape($(data).find("response").text()).replace(/\+/g,' '));
|
||||
$("#walletSendFailTransaction").removeClass('hidden');
|
||||
|
@ -167,7 +167,7 @@ $(document).ready(function() {
|
|||
|
||||
$("#walletLoader").addClass("hidden");
|
||||
|
||||
}, script);
|
||||
}, script, script);
|
||||
});
|
||||
|
||||
$("#walletSendBtn").click(function(){
|
||||
|
@ -1262,7 +1262,6 @@ $(document).ready(function() {
|
|||
var tx = coinjs.transaction();
|
||||
try {
|
||||
var decode = tx.deserialize($("#verifyScript").val());
|
||||
// console.log(decode);
|
||||
$("#verifyTransactionData .transactionVersion").html(decode['version']);
|
||||
$("#verifyTransactionData .transactionSize").html(decode.size()+' <i>bytes</i>');
|
||||
$("#verifyTransactionData .transactionLockTime").html(decode['lock_time']);
|
||||
|
|
8
sha1sum
8
sha1sum
|
@ -1,9 +1,9 @@
|
|||
---- Version 1.3 2017.09.16 ----
|
||||
---- Version 1.3 2017.09.20 ----
|
||||
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
|
||||
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
|
||||
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
|
||||
618db47822494e730a8fa93cfab985332872b93e ./js/coinbin.js
|
||||
b2b1b00455dd2d1f168dc68b6efdbb1de817b5d0 ./js/coin.js
|
||||
3ac0e33ea28610e6f784658efcd88802bdd18119 ./js/coinbin.js
|
||||
466bd554f3466c477cd13bb355a4df343749b8b9 ./js/coin.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
|
||||
d8a324a13501cd5705dc26b945fc8088f00907ae ./README.md
|
||||
cc101e4b9718116bb767f7cbd04cab816ca32b66 ./index.html
|
||||
45bb7cbfe003039b3e527ecc38a18786de55a843 ./index.html
|
||||
|
|
Loading…
Reference in a new issue