aboutsummaryrefslogtreecommitdiff
path: root/tests/spec
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2019-12-16 13:08:28 +1100
committerIan Coleman <ian@iancoleman.io>2019-12-16 13:27:15 +1100
commit5c203fab6ac25fc76e2b805b7709d9b06ccdd995 (patch)
treec95d6897e6e6a32be1adf8abc82986f3471d4397 /tests/spec
parent40d542ba58008762c71a304df03ef8c987cb6db5 (diff)
downloadBIP39-5c203fab6ac25fc76e2b805b7709d9b06ccdd995.tar.gz
BIP39-5c203fab6ac25fc76e2b805b7709d9b06ccdd995.tar.zst
BIP39-5c203fab6ac25fc76e2b805b7709d9b06ccdd995.zip
Add P2WSH and P2WSH-P2SH for bitcoin and testnet
Address generation still to come.
Diffstat (limited to 'tests/spec')
-rw-r--r--tests/spec/tests.js96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index af8944c..fc71353 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -3694,6 +3694,102 @@ it('Can generate BIP141 addresses with P2WPKH-in-P2SH semanitcs', function(done)
3694 }); 3694 });
3695}); 3695});
3696 3696
3697it('Can generate BIP141 addresses with P2WSH semanitcs', function(done) {
3698 driver.findElement(By.css('#bip141-tab a'))
3699 .click();
3700 // Choose P2WSH
3701 driver.executeScript(function() {
3702 $(".bip141-semantics option[selected]").removeAttr("selected");
3703 $(".bip141-semantics option").filter(function(i,e) {
3704 return $(e).html() == "P2WSH";
3705 }).prop("selected", true);
3706 $(".bip141-semantics").trigger("change");
3707 });
3708 driver.findElement(By.css(".phrase"))
3709 .sendKeys("abandon abandon ability");
3710 driver.sleep(generateDelay).then(function() {
3711 driver.findElement(By.css("#root-key"))
3712 .getAttribute("value")
3713 .then(function(rootKey) {
3714 expect(rootKey).toBe("ZprvAhadJRUYsNge9uHspaggavxU1BUQ8QwfT4Z9UGq5sKF2mSt1mVy8EckLAaoBdmLHyP5eYDJ3LxtmzMNnLg2MRFe7QN2ueF4NCH4s5PrCDR6");
3715 // TODO check first address
3716 done();
3717 })
3718 });
3719});
3720
3721it('Can generate BIP141 addresses with P2WSH-in-P2SH semanitcs', function(done) {
3722 driver.findElement(By.css('#bip141-tab a'))
3723 .click();
3724 // Choose P2WSH-in-P2SH
3725 driver.executeScript(function() {
3726 $(".bip141-semantics option[selected]").removeAttr("selected");
3727 $(".bip141-semantics option").filter(function(i,e) {
3728 return $(e).html() == "P2WSH nested in P2SH";
3729 }).prop("selected", true);
3730 $(".bip141-semantics").trigger("change");
3731 });
3732 driver.findElement(By.css(".phrase"))
3733 .sendKeys("abandon abandon ability");
3734 driver.sleep(generateDelay).then(function() {
3735 driver.findElement(By.css("#root-key"))
3736 .getAttribute("value")
3737 .then(function(rootKey) {
3738 expect(rootKey).toBe("YprvANkMzkodih9AJc6kzDu4NqrxqDKxBnxAXx2vgswCVJs9iM4nWqoZcZ6C9NqbdrgNZjxqnjhUtJYE74mDcycLd1xWY2LV4LEsvZ1DgqxuAKe");
3739 // TODO check first address
3740 done();
3741 })
3742 });
3743});
3744
3745it('Uses Vprv for bitcoin testnet p2wsh', function(done) {
3746 selectNetwork("BTC - Bitcoin Testnet");
3747 driver.findElement(By.css('#bip141-tab a'))
3748 .click()
3749 // Choose P2WSH
3750 driver.executeScript(function() {
3751 $(".bip141-semantics option[selected]").removeAttr("selected");
3752 $(".bip141-semantics option").filter(function(i,e) {
3753 return $(e).html() == "P2WSH";
3754 }).prop("selected", true);
3755 $(".bip141-semantics").trigger("change");
3756 });
3757 driver.findElement(By.css('.phrase'))
3758 .sendKeys('abandon abandon ability');
3759 driver.sleep(generateDelay).then(function() {
3760 driver.findElement(By.css('.root-key'))
3761 .getAttribute("value")
3762 .then(function(path) {
3763 expect(path).toBe("Vprv16YtLrHXxePM5ja5hXQbiJs5JKDAc4WcaXo5rZcrVMU6bMhUg1oY7fpPku3i819gvMcHvq1h8aELDsyfCEs19vj1Q3iDHRrESWyJConkoT1");
3764 done();
3765 })
3766 });
3767});
3768
3769it('Uses Uprv for bitcoin testnet p2wsh-in-p2sh', function(done) {
3770 selectNetwork("BTC - Bitcoin Testnet");
3771 driver.findElement(By.css('#bip141-tab a'))
3772 .click()
3773 // Choose P2WSH-in-P2SH
3774 driver.executeScript(function() {
3775 $(".bip141-semantics option[selected]").removeAttr("selected");
3776 $(".bip141-semantics option").filter(function(i,e) {
3777 return $(e).html() == "P2WSH nested in P2SH";
3778 }).prop("selected", true);
3779 $(".bip141-semantics").trigger("change");
3780 });
3781 driver.findElement(By.css('.phrase'))
3782 .sendKeys('abandon abandon ability');
3783 driver.sleep(generateDelay).then(function() {
3784 driver.findElement(By.css('.root-key'))
3785 .getAttribute("value")
3786 .then(function(path) {
3787 expect(path).toBe("Uprv95RJn67y7xyEuRLHenkZYVUx9LkARJzAsVx3ZJMeyHMdVwosWD9K8JTe4Z1FeE4gwBVcnqKF3f82ZvJxkBxHS5E74fYnigxvqeke8ZV3Fp2");
3788 done();
3789 })
3790 });
3791});
3792
3697it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) { 3793it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) {
3698 // This result tested against bitcoinjs-lib test spec for segwit address 3794 // This result tested against bitcoinjs-lib test spec for segwit address
3699 // using the first private key of this mnemonic and default path m/0 3795 // using the first private key of this mnemonic and default path m/0