Compare commits

...

10 Commits
0.2.7 ... 0.2.8

Author SHA1 Message Date
Ian Coleman
0f6b34d68b Release v0.2.8 2017-10-31 13:34:53 +11:00
Ian Coleman
2a01f39de7 Add P2WPKH-nested-in-P2SH to litecoin 2017-10-31 11:48:51 +11:00
Ian Coleman
93c3ef4757 Use correct prefixes for xprv/xpub with segwit 2017-10-31 11:44:42 +11:00
Ian Coleman
fe8f2d140d Allow BitPay address format for bitcoin cash 2017-10-31 10:35:52 +11:00
Ian Coleman
0cca6e893a Add test for nubits network 2017-10-10 12:04:27 +11:00
iancoleman
f2a1a8e67f Merge pull request #123 from alkley/master
Add nubits
2017-10-10 11:48:33 +11:00
alkley
8dd28f2cff Add nubits 2017-10-09 15:34:39 +02:00
iancoleman
4b1e5c340f Merge pull request #122 from dimitris-t/patch-1
Update changelog.md
2017-10-05 09:59:25 +11:00
Dimitris Tsapakidis
2be42f9dba Update changelog.md
Fixed markdown typo.
2017-10-04 19:22:49 +03:00
Ian Coleman
4aa771eb68 Add test for fujicoin 2017-10-03 14:40:56 +11:00
6 changed files with 430 additions and 16 deletions

View File

@@ -118,7 +118,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.2.7</p>
<p class="version">v0.2.8</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -579,6 +579,16 @@
<div class="col-md-12">
<h2>Derived Addresses</h2>
<p>Note these addreses are derived from the BIP32 Extended Key</p>
</div>
<div class="col-md-12 use-bitpay-addresses-container hidden">
<div class="checkbox">
<label>
<input type="checkbox" class="use-bitpay-addresses">
<span>Use BitPay-style addresses for Bitcoin Cash (ie starting with 'C' instead of '1')</span>
</label>
</div>
</div>
<div class="col-md-12">
<table class="table table-striped">
<thead>
<th>
@@ -22400,6 +22410,61 @@ bitcoinjs.bitcoin.networks.fujicoin = {
scriptHash: 0x10,
wif: 0xa4
};
bitcoinjs.bitcoin.networks.nubits = {
messagePrefix: '\x18Nu Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x19,
scriptHash: 0x1a,
wif: 0x96,
};
bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x1c,
scriptHash: 0x28,
wif: 0x80
};
bitcoinjs.bitcoin.networks.bitcoinBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
},
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80
};
bitcoinjs.bitcoin.networks.testnetBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
bitcoinjs.bitcoin.networks.litecoinBip49 = {
messagePrefix: '\x19Litecoin Signed Message:\n',
bip32: {
public: 0x01b26ef6,
private: 0x01b26792
},
pubKeyHash: 0x30,
scriptHash: 0x32,
wif: 0xb0
};
</script>
<script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
@@ -45988,6 +46053,8 @@ window.Entropy = new (function() {
DOM.generatedStrength = $(".generate-container .strength");
DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh");
DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container");
DOM.useBitpayAddresses = $(".use-bitpay-addresses");
DOM.addresses = $(".addresses");
DOM.rowsToAdd = $(".rows-to-add");
DOM.more = $(".more");
@@ -46022,7 +46089,7 @@ window.Entropy = new (function() {
DOM.bip44change.on("input", calcForDerivationPath);
DOM.bip49account.on("input", calcForDerivationPath);
DOM.bip49change.on("input", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", tabChanged);
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
@@ -46030,6 +46097,7 @@ window.Entropy = new (function() {
DOM.publicKeyToggle.on("click", togglePublicKeys);
DOM.privateKeyToggle.on("click", togglePrivateKeys);
DOM.languages.on("click", languageChanged);
DOM.useBitpayAddresses.on("change", useBitpayAddressesChange);
setQrEvents(DOM.showQrEls);
disableForms();
hidePending();
@@ -46044,6 +46112,7 @@ window.Entropy = new (function() {
clearDerivedKeys();
clearAddressesList();
DOM.litecoinLtubContainer.addClass("hidden");
DOM.useBitpayAddressesContainer.addClass("hidden");
var networkIndex = e.target.value;
var network = networks[networkIndex];
network.onSelect();
@@ -46123,6 +46192,35 @@ window.Entropy = new (function() {
calcForDerivationPath();
}
function tabChanged() {
showPending();
adjustNetworkForBip49();
var phrase = DOM.phrase.val();
if (phrase != "") {
// Calculate and display for mnemonic
var errorText = findPhraseErrors(phrase);
if (errorText) {
showValidationError(errorText);
return;
}
// Calculate and display
var passphrase = DOM.passphrase.val();
calcBip32RootKeyFromSeed(phrase, passphrase);
}
else {
// Calculate and display for root key
var rootKeyBase58 = DOM.rootKey.val();
var errorText = validateRootKey(rootKeyBase58);
if (errorText) {
showValidationError(errorText);
return;
}
// Calculate and display
calcBip32RootKeyFromBase58(rootKeyBase58);
}
calcForDerivationPath();
}
function delayedEntropyChanged() {
hideValidationError();
showPending();
@@ -46260,6 +46358,11 @@ window.Entropy = new (function() {
}, 50);
}
function useBitpayAddressesChange() {
setBitcoinCashNetworkValues();
phraseChanged();
}
function toggleIndexes() {
showIndex = !showIndex;
$("td.index span").toggleClass("invisible");
@@ -46548,12 +46651,16 @@ window.Entropy = new (function() {
})());
}
function P2wpkhNestedInP2shSelected() {
return bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
}
function TableRow(index, isLast) {
var self = this;
this.shouldGenerate = true;
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
var isP2wpkhNestedInP2sh = bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
var isP2wpkhNestedInP2sh = P2wpkhNestedInP2shSelected();
var p2wpkhNestedInP2shAvailable = networkHasBip49();
function init() {
@@ -47120,12 +47227,55 @@ window.Entropy = new (function() {
DOM.useP2wpkhNestedInP2sh.prop("checked", false);
}
function useBitpayAddresses() {
return !(DOM.useBitpayAddresses.prop("checked"));
}
function setBitcoinCashNetworkValues() {
if (useBitpayAddresses()) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else {
network = bitcoinjs.bitcoin.networks.bitcoinCashBitbpay;
}
}
function adjustNetworkForBip49() {
// If bip49 is selected the xpub/xprv prefixes need to be adjusted
// to avoid accidentally importing BIP49 xpub to BIP44 watch only
// wallet.
// See https://github.com/iancoleman/bip39/issues/125
if (P2wpkhNestedInP2shSelected()) {
if (network == bitcoinjs.bitcoin.networks.bitcoin) {
network = bitcoinjs.bitcoin.networks.bitcoinBip49;
}
else if (network == bitcoinjs.bitcoin.networks.testnet) {
network = bitcoinjs.bitcoin.networks.testnetBip49;
}
else if (network == bitcoinjs.bitcoin.networks.litecoin) {
network = bitcoinjs.bitcoin.networks.litecoinBip49;
}
}
else {
if (network == bitcoinjs.bitcoin.networks.bitcoinBip49) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else if (network == bitcoinjs.bitcoin.networks.testnetBip49) {
network = bitcoinjs.bitcoin.networks.testnet;
}
else if (network == bitcoinjs.bitcoin.networks.litecoinBip49) {
network = bitcoinjs.bitcoin.networks.litecoin;
}
}
}
var networks = [
{
name: "BCH - Bitcoin Cash",
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
DOM.useBitpayAddressesContainer.removeClass("hidden");
setBitcoinCashNetworkValues();
setHdCoin(145);
},
},
@@ -47219,7 +47369,7 @@ window.Entropy = new (function() {
},
{
name: "LTC - Litecoin",
p2wpkhNestedInP2shAvailable: false,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
@@ -47299,6 +47449,14 @@ window.Entropy = new (function() {
setHdCoin(111);
},
},
{
name: "USNBT - NuBits",
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.nubits;
setHdCoin(12);
},
},
{
name: "VIA - Viacoin",
p2wpkhNestedInP2shAvailable: false,

View File

@@ -1,4 +1,11 @@
#0.2.7
# 0.2.8
* Enable segwit for Litecoin
* BitPay-style addresses for Bitcoin Cash
* Use new xpub/xprv prefixes for Segwit BIP49
* Add nubits network
# 0.2.7
* Add Fujicoin
* List alternative tools

View File

@@ -114,7 +114,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.2.7</p>
<p class="version">v0.2.8</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -575,6 +575,16 @@
<div class="col-md-12">
<h2>Derived Addresses</h2>
<p>Note these addreses are derived from the BIP32 Extended Key</p>
</div>
<div class="col-md-12 use-bitpay-addresses-container hidden">
<div class="checkbox">
<label>
<input type="checkbox" class="use-bitpay-addresses">
<span>Use BitPay-style addresses for Bitcoin Cash (ie starting with 'C' instead of '1')</span>
</label>
</div>
</div>
<div class="col-md-12">
<table class="table table-striped">
<thead>
<th>

View File

@@ -239,3 +239,58 @@ bitcoinjs.bitcoin.networks.fujicoin = {
scriptHash: 0x10,
wif: 0xa4
};
bitcoinjs.bitcoin.networks.nubits = {
messagePrefix: '\x18Nu Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x19,
scriptHash: 0x1a,
wif: 0x96,
};
bitcoinjs.bitcoin.networks.bitcoinCashBitbpay = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x1c,
scriptHash: 0x28,
wif: 0x80
};
bitcoinjs.bitcoin.networks.bitcoinBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x049d7cb2,
private: 0x049d7878
},
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80
};
bitcoinjs.bitcoin.networks.testnetBip49 = {
messagePrefix: '\x18Bitcoin Signed Message:\n',
bip32: {
public: 0x044a5262,
private: 0x044a4e28
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef
};
bitcoinjs.bitcoin.networks.litecoinBip49 = {
messagePrefix: '\x19Litecoin Signed Message:\n',
bip32: {
public: 0x01b26ef6,
private: 0x01b26792
},
pubKeyHash: 0x30,
scriptHash: 0x32,
wif: 0xb0
};

View File

@@ -75,6 +75,8 @@
DOM.generatedStrength = $(".generate-container .strength");
DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh");
DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container");
DOM.useBitpayAddresses = $(".use-bitpay-addresses");
DOM.addresses = $(".addresses");
DOM.rowsToAdd = $(".rows-to-add");
DOM.more = $(".more");
@@ -109,7 +111,7 @@
DOM.bip44change.on("input", calcForDerivationPath);
DOM.bip49account.on("input", calcForDerivationPath);
DOM.bip49change.on("input", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", tabChanged);
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
@@ -117,6 +119,7 @@
DOM.publicKeyToggle.on("click", togglePublicKeys);
DOM.privateKeyToggle.on("click", togglePrivateKeys);
DOM.languages.on("click", languageChanged);
DOM.useBitpayAddresses.on("change", useBitpayAddressesChange);
setQrEvents(DOM.showQrEls);
disableForms();
hidePending();
@@ -131,6 +134,7 @@
clearDerivedKeys();
clearAddressesList();
DOM.litecoinLtubContainer.addClass("hidden");
DOM.useBitpayAddressesContainer.addClass("hidden");
var networkIndex = e.target.value;
var network = networks[networkIndex];
network.onSelect();
@@ -210,6 +214,35 @@
calcForDerivationPath();
}
function tabChanged() {
showPending();
adjustNetworkForBip49();
var phrase = DOM.phrase.val();
if (phrase != "") {
// Calculate and display for mnemonic
var errorText = findPhraseErrors(phrase);
if (errorText) {
showValidationError(errorText);
return;
}
// Calculate and display
var passphrase = DOM.passphrase.val();
calcBip32RootKeyFromSeed(phrase, passphrase);
}
else {
// Calculate and display for root key
var rootKeyBase58 = DOM.rootKey.val();
var errorText = validateRootKey(rootKeyBase58);
if (errorText) {
showValidationError(errorText);
return;
}
// Calculate and display
calcBip32RootKeyFromBase58(rootKeyBase58);
}
calcForDerivationPath();
}
function delayedEntropyChanged() {
hideValidationError();
showPending();
@@ -347,6 +380,11 @@
}, 50);
}
function useBitpayAddressesChange() {
setBitcoinCashNetworkValues();
phraseChanged();
}
function toggleIndexes() {
showIndex = !showIndex;
$("td.index span").toggleClass("invisible");
@@ -635,12 +673,16 @@
})());
}
function P2wpkhNestedInP2shSelected() {
return bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
}
function TableRow(index, isLast) {
var self = this;
this.shouldGenerate = true;
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
var isP2wpkhNestedInP2sh = bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
var isP2wpkhNestedInP2sh = P2wpkhNestedInP2shSelected();
var p2wpkhNestedInP2shAvailable = networkHasBip49();
function init() {
@@ -1207,12 +1249,55 @@
DOM.useP2wpkhNestedInP2sh.prop("checked", false);
}
function useBitpayAddresses() {
return !(DOM.useBitpayAddresses.prop("checked"));
}
function setBitcoinCashNetworkValues() {
if (useBitpayAddresses()) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else {
network = bitcoinjs.bitcoin.networks.bitcoinCashBitbpay;
}
}
function adjustNetworkForBip49() {
// If bip49 is selected the xpub/xprv prefixes need to be adjusted
// to avoid accidentally importing BIP49 xpub to BIP44 watch only
// wallet.
// See https://github.com/iancoleman/bip39/issues/125
if (P2wpkhNestedInP2shSelected()) {
if (network == bitcoinjs.bitcoin.networks.bitcoin) {
network = bitcoinjs.bitcoin.networks.bitcoinBip49;
}
else if (network == bitcoinjs.bitcoin.networks.testnet) {
network = bitcoinjs.bitcoin.networks.testnetBip49;
}
else if (network == bitcoinjs.bitcoin.networks.litecoin) {
network = bitcoinjs.bitcoin.networks.litecoinBip49;
}
}
else {
if (network == bitcoinjs.bitcoin.networks.bitcoinBip49) {
network = bitcoinjs.bitcoin.networks.bitcoin;
}
else if (network == bitcoinjs.bitcoin.networks.testnetBip49) {
network = bitcoinjs.bitcoin.networks.testnet;
}
else if (network == bitcoinjs.bitcoin.networks.litecoinBip49) {
network = bitcoinjs.bitcoin.networks.litecoin;
}
}
}
var networks = [
{
name: "BCH - Bitcoin Cash",
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
DOM.useBitpayAddressesContainer.removeClass("hidden");
setBitcoinCashNetworkValues();
setHdCoin(145);
},
},
@@ -1306,7 +1391,7 @@
},
{
name: "LTC - Litecoin",
p2wpkhNestedInP2shAvailable: false,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
@@ -1386,6 +1471,14 @@
setHdCoin(111);
},
},
{
name: "USNBT - NuBits",
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.nubits;
setHdCoin(12);
},
},
{
name: "VIA - Viacoin",
p2wpkhNestedInP2shAvailable: false,

101
tests.js
View File

@@ -1022,6 +1022,66 @@ page.open(url, function(status) {
});
},
// Network can be set to fujicoin
function() {
page.open(url, function(status) {
// set the phrase and coin
var expected = "FgiaLpG7C99DyR4WnPxXedRVHXSfKzUDhF";
page.evaluate(function() {
$(".phrase").val("abandon abandon ability");
$(".phrase").trigger("input");
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "FJC - Fujicoin";
}).prop("selected", true);
$(".network").trigger("change");
});
// check the address is generated correctly
waitForGenerate(function() {
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("Fujicoin address is incorrect");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},
// Network can be set to nubits
function() {
page.open(url, function(status) {
// set the phrase and coin
var expected = "BLxkabXuZSJSdesLD7KxZdqovd4YwyBTU6";
page.evaluate(function() {
$(".phrase").val("abandon abandon ability");
$(".phrase").trigger("input");
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "USNBT - NuBits";
}).prop("selected", true);
$(".network").trigger("change");
});
// check the address is generated correctly
waitForGenerate(function() {
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("NuBits address is incorrect");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},
// BIP39 seed is set from phrase
function() {
page.open(url, function(status) {
@@ -3630,7 +3690,7 @@ page.open(url, function(status) {
});
waitForFeedback(function() {
// Check feedback is correct
var expected = "No root key";
var expected = "Invalid root key";
var actual = page.evaluate(function() {
return $(".feedback").text();
});
@@ -3937,7 +3997,7 @@ page.open(url, function(status) {
function() {
page.open(url, function(status) {
// set the phrase
var expected = "xprvA1hukYsW7QfX9CVsaDAKde4eryajKa4DKWb6m9YjSnqkiZHrahFwwTJfEQTwBQ5kptWT5pZMkkusT1oK8dc1efQ8VFfq4SLSPAWd7Cpt423";
var expected = "yprvALYB4DYRG6CzzVgzQZwwqjAA2wjBGC3iEd7KYYScpoDdmf75qMRWZWxoFcRXBJjgEXdFqJ9vDRGRLJQsrL22Su5jMbNFeM9vetaGVqy9Qy2";
page.evaluate(function() {
$("#bip49-tab a").click();
$(".phrase").val("abandon abandon ability").trigger("input");
@@ -3962,7 +4022,7 @@ page.open(url, function(status) {
function() {
page.open(url, function(status) {
// set the phrase
var expected = "xpub6EhGA4QPwnDpMgaLgEhKzn1PR1RDj2n4gjWhZXxM18NjbMd18EaCVFd95gkLARJaBD2rXAYJED2gdkUbGn1KkrSzCKR554AdABUELoainnt";
var expected = "ypub6ZXXTj5K6TmJCymTWbUxCs6tayZffemZbr2vLvrEP8kceTSENtjm7KHH6thvAKxVar9fGe8rgsPEX369zURLZ68b4f7Vexz7RuXsjQ69YDt";
page.evaluate(function() {
$("#bip49-tab a").click();
$(".phrase").val("abandon abandon ability").trigger("input");
@@ -4051,7 +4111,7 @@ page.open(url, function(status) {
function() {
page.open(url, function(status) {
// set the phrase
var expected = "xprv9y3uhgQbfQZbj3o98nfgLDwGGuCJjUn7GKArSAZXjKgMjSdYHjQmTyf78s22g6jsGrxXvHB6HJeFyvFSPkuYZajeTGMZVXV6aNLWw2fagCn";
var expected = "yprvAHtB1M5Wp675aLzFy9TJYK2mSsLkg6mcBRh5DZTR7L4EnYSmYPaL63KFA4ycg1PngW5LfkmejxzosCs17TKZMpRFKc3z5SJar6QAKaFcaZL";
page.evaluate(function() {
$("#bip49-tab a").click();
$(".phrase").val("abandon abandon ability");
@@ -4077,7 +4137,7 @@ page.open(url, function(status) {
function() {
page.open(url, function(status) {
// set the phrase
var expected = "xpub6C3G7BwVVn7twXscEpCghMszpw2o8wVxdY6TEYy9HfDLcExgqGj21myazAiq6HSmW2F1cBiFqJa3D1cqcDpSh8pbZF5x4iqpd4PyJvd3gjB";
var expected = "ypub6WsXQrcQeTfNnq4j5AzJuSyVzuBF5ZVTYecg1ws2ffbDfLmv5vtadqdj1NgR6C6gufMpMfJpHxvb6JEQKvETVNWCRanNedfJtnTchZiJtsL";
page.evaluate(function() {
$("#bip49-tab a").click();
$(".phrase").val("abandon abandon ability");
@@ -4344,6 +4404,37 @@ page.open(url, function(status) {
});
},
// Bitcoin Cash address can be set to use bitpay format
function() {
page.open(url, function(status) {
// set the phrase and coin and address format
var expected = "CZnpA9HPmvhuhLLPWJP8rNDpLUYXy1LXFk";
page.evaluate(function() {
$(".use-bitpay-addresses").prop("checked", true);
$(".phrase").val("abandon abandon ability");
$(".phrase").trigger("input");
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "BCH - Bitcoin Cash";
}).prop("selected", true);
$(".network").trigger("change");
});
// check the address is generated correctly
waitForGenerate(function() {
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("Bitcoin Cash address is incorrect");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},
// If you wish to add more tests, do so here...
// Here is a blank test template