X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Findex.js;h=057d7093402b8f7d47359608a0903add76f06f22;hb=d0889ab9dee263494bcf50dc6c5a25a249c8ffe1;hp=86997333d7756030635db050753937ab0ace3718;hpb=7a11300336844b822a8f3ec4f85586b79c5954f4;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/src/js/index.js b/src/js/index.js index 8699733..057d709 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -929,17 +929,13 @@ pubkey = ethUtil.addHexPrefix(pubkey); } if ((networks[DOM.network.val()].name == "NAS - Nebulas")) { - var NasAccount = require("nebulas").Account; + var NasAccount = require("nebulas-account"); var privKeyBuffer = keyPair.d.toBuffer(32); - // privkey = privKeyBuffer.toString('hex'); - console.log(privkey); - var nasAccount = NasAccount.NewAccount(privKeyBuffer); - // var addressBuffer = ethUtil.privateToAddress(privKeyBuffer); - // var hexAddress = addressBuffer.toString('hex'); - // var checksumAddress = ethUtil.toChecksumAddress(hexAddress); - address = nasAccount.getAddressString(); - privkey = nasAccount.getPrivateKeyString(); - pubkey = nasAccount.getPublicKeyString(); + var nebulasAccount = new NasAccount(); + nebulasAccount.setPrivateKey(privKeyBuffer); + address = nebulasAccount.getAddressString(); + privkey = nebulasAccount.getPrivateKeyString(); + pubkey = nebulasAccount.getPublicKeyString(); } // Ripple values are different if (networks[DOM.network.val()].name == "XRP - Ripple") { @@ -956,6 +952,13 @@ address = bchaddr.toBitpayAddress(address); } } + // Bitcoin Cash address format may vary + if (networks[DOM.network.val()].name == "SLP - Simple Ledger Protocol") { + var bchAddrType = DOM.bitcoinCashAddressType.filter(":checked").val(); + if (bchAddrType == "cashaddr") { + address = bchaddr.toSlpAddress(address); + } + } // Segwit addresses are different if (isSegwit) { if (!segwitAvailable) { @@ -1722,7 +1725,7 @@ network = bitcoinjs.bitcoin.networks.blocknode; setHdCoin(2941); }, - }, + }, { name: "tBND - Blocknode Testnet", onSelect: function() { @@ -2490,6 +2493,13 @@ setHdCoin(111); }, }, + { + name: "SLP - Simple Ledger Protocol", + onSelect: function() { + DOM.bitcoinCashAddressTypeContainer.removeClass("hidden"); + setHdCoin(245); + }, + }, { name: "SLR - Solarcoin", onSelect: function() {