Skip to content

Commit f408c9b

Browse files
committed
Add the posibility to specify hardened indicies on HD wallets.
1 parent bd82cfd commit f408c9b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

js/coinbin.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,15 +1701,23 @@ $(document).ready(function() {
17011701

17021702
function deriveHDaddress() {
17031703
var hd = coinjs.hd($("#verifyHDaddress .hdKey").html());
1704-
var index_start = $("#verifyHDaddress .derivation_index_start").val()*1;
1705-
var index_end = $("#verifyHDaddress .derivation_index_end").val()*1;
1704+
var index_start = $("#verifyHDaddress .derivation_index_start").val();
1705+
if ((index_start.length > 1) && (index_start[index_start.length - 1] == '\'')) {
1706+
var use_private_index = '\'';
1707+
index_start = index_start.replace(/[']/, "") * 1;
1708+
} else {
1709+
var use_private_index = '';
1710+
index_start = index_start.replace(/[']/, "") * 1;
1711+
}
1712+
var index_end = $("#verifyHDaddress .derivation_index_end").val().replace(/[']/, "") * 1;
1713+
$("#verifyHDaddress .derivation_index_end").val(index_end + use_private_index);
17061714
var html = '';
17071715
$("#verifyHDaddress .derived_data table tbody").html("");
17081716
for(var i=index_start;i<=index_end;i++){
17091717
if($("#hdpathtype option:selected").val()=='simple'){
17101718
var derived = hd.derive(i);
17111719
} else {
1712-
var derived = hd.derive_path(($("#hdpath input").val().replace(/\/+$/, ""))+'/'+i);
1720+
var derived = hd.derive_path(($("#hdpath input").val().replace(/\/+$/, ""))+'/'+i+use_private_index);
17131721
}
17141722
html += '<tr>';
17151723
html += '<td>'+i+'</td>';

0 commit comments

Comments
 (0)