var showPrivKey = true;
var showQr = false;
var litecoinUseLtub = true;
+ var isDefaultBip44ChangeValue = true;
var entropyTypeAutoDetect = true;
var entropyChangeTimeoutEvent = null;
DOM.bip44accountXprv = $("#bip44 .account-xprv");
DOM.bip44accountXpub = $("#bip44 .account-xpub");
DOM.bip44change = $("#bip44 .change");
+ DOM.defaultBip44ChangeValue = $("#bip44 .default-bip44-change-value");
DOM.bip49unavailable = $("#bip49 .unavailable");
DOM.bip49available = $("#bip49 .available");
DOM.bip49path = $("#bip49-path");
DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged);
DOM.bip32path.on("input", calcForDerivationPath);
DOM.bip44account.on("input", calcForDerivationPath);
+ DOM.bip44change.on("input", modifiedDefaultBip44ChangeValue);
DOM.bip44change.on("input", calcForDerivationPath);
+ DOM.defaultBip44ChangeValue.on("click", resetDefaultBip44ChangeValue);
DOM.bip49account.on("input", calcForDerivationPath);
DOM.bip49change.on("input", calcForDerivationPath);
DOM.bip84account.on("input", calcForDerivationPath);
var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
var account = parseIntNoNaN(DOM.bip44account.val(), 0);
- var change = parseIntNoNaN(DOM.bip44change.val(), 0);
- var path = "m/";
- path += purpose + "'/";
- path += coin + "'/";
- path += account + "'/";
- path += change;
+ var change = parseIntNoNaN(DOM.bip44change.val(), "");
+ var path = "m";
+ path += "/" + purpose + "'";
+ path += "/" + coin + "'";
+ path += "/" + account + "'";
+ if (change !== "") {
+ path += "/" + change;
+ }
DOM.bip44path.val(path);
var derivationPath = DOM.bip44path.val();
console.log("Using derivation path from BIP44 tab: " + derivationPath);
address = libs.ethUtil.addHexPrefix(checksumAddress);
pubkey = libs.ethUtil.addHexPrefix(pubkey);
if (hasPrivkey) {
- privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
+ privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer(32));
}
}
//TRX is different
address = libs.bchaddrSlp.toSlpAddress(address);
}
}
+
+ // ZooBC address format may vary
+ if (networks[DOM.network.val()].name == "ZBC - ZooBlockchain") {
+
+ var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
+ var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
+ var path = "m/";
+ path += purpose + "'/";
+ path += coin + "'/" + index + "'";
+ var result = libs.zoobcUtil.getKeypair(path, seed);
+
+ let publicKey = result.pubKey.slice(1, 33);
+ let privateKey = result.key;
+
+ privkey = privateKey.toString('hex');
+ pubkey = publicKey.toString('hex');
+
+ indexText = path;
+ address = libs.zoobcUtil.getZBCAddress(publicKey, 'ZBC');
+ }
+
// Segwit addresses are different
if (isSegwit) {
if (!segwitAvailable) {
privkey = FIObufferToPrivate(keyPair.d.toBuffer(32));
}
+ if (networks[DOM.network.val()].name == "ATOM - Cosmos Hub") {
+ address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer());
+ pubkey = CosmosBufferToPublic(keyPair.getPublicKeyBuffer());
+ privkey = keyPair.d.toBuffer().toString("base64");
+ }
+
//Groestlcoin Addresses are different
if(isGRS()) {
return DOM.bip141tab.hasClass("active");
}
+ function setBip44ChangeValue() {
+ if (isDefaultBip44ChangeValue) {
+ if (networkIsEthereum()) {
+ DOM.bip44change.val("");
+ } else {
+ DOM.bip44change.val(0);
+ }
+ }
+ }
+
+ function modifiedDefaultBip44ChangeValue() {
+ isDefaultBip44ChangeValue = false;
+ }
+
+ function resetDefaultBip44ChangeValue() {
+ isDefaultBip44ChangeValue = true;
+ setBip44ChangeValue();
+ }
+
function setHdCoin(coinValue) {
DOM.bip44coin.val(coinValue);
DOM.bip49coin.val(coinValue);
DOM.bip84coin.val(coinValue);
+ setBip44ChangeValue();
}
function showSegwitAvailable() {
setHdCoin(357);
},
},
+ {
+ name: "ATOM - Cosmos Hub",
+ onSelect: function() {
+ network = libs.bitcoin.networks.bitcoin;
+ setHdCoin(118);
+ },
+ },
{
name: "AUR - Auroracoin",
onSelect: function() {
setHdCoin(4);
},
},
+ {
+ name: "RITO - Ritocoin",
+ onSelect: function() {
+ network = libs.bitcoin.networks.ritocoin;
+ setHdCoin(19169);
+ },
+ },
{
name: "RVR - RevolutionVR",
onSelect: function() {