]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Merge branch 'master' into feat/rsk-network
authoriancoleman <1281387+iancoleman@users.noreply.github.com>
Sun, 10 May 2020 23:05:32 +0000 (09:05 +1000)
committerGitHub <noreply@github.com>
Sun, 10 May 2020 23:05:32 +0000 (09:05 +1000)
1  2 
src/js/bitcoinjs-extensions.js
src/js/index.js

Simple merge
diff --cc src/js/index.js
index fa9836a8d1031c03f45897f4e653cc02ab438f2d,e8072e4df2780d3b7b5911ab2b73ae274d45206f..43c69552d24336e6a906f1bb19382de6bfac1da4
                      }
                  }
  
 +                // RSK values are different
 +                if (networkIsRsk()) {
 +                    var pubkeyBuffer = keyPair.getPublicKeyBuffer();
 +                    var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
 +                    var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
 +                    var hexAddress = addressBuffer.toString('hex');
 +                    // Use chainId based on selected network
 +                    // Ref: https://developers.rsk.co/rsk/architecture/account-based/#chainid
 +                    var chainId;
 +                    var rskNetworkName = networks[DOM.network.val()].name;
 +                    switch (rskNetworkName) {
 +                        case "R-BTC - RSK":
 +                            chainId = 30;
 +                            break;
 +                        case "tR-BTC - RSK Testnet":
 +                            chainId = 31;
 +                            break;
 +                        default:
 +                            chainId = null;
 +                    }
 +                    var checksumAddress = toChecksumAddressForRsk(hexAddress, chainId);
 +                    address = libs.ethUtil.addHexPrefix(checksumAddress);
 +                    pubkey = libs.ethUtil.addHexPrefix(pubkey);
 +                    if (hasPrivkey) {
 +                        privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
 +                    }
 +                }
 +
+                 // Handshake values are different
+                 if (networks[DOM.network.val()].name == "HNS - Handshake") {
+                     var ring = libs.handshake.KeyRing.fromPublic(keyPair.getPublicKeyBuffer())
+                     address = ring.getAddress().toString();
+                 }
++
                  // Stellar is different
                  if (networks[DOM.network.val()].name == "XLM - Stellar") {
                      var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);