diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-09-01 12:27:38 +1000 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-09-01 12:28:27 +1000 |
commit | 88311463c74f022177a21c5d88f8928dc8007d8b (patch) | |
tree | fd1273a0074f4c12387335af29d58e8fc6e91faf /tests.js | |
parent | cd7c8327b110ee2fc2010d1e88f5009f859cd981 (diff) | |
download | BIP39-88311463c74f022177a21c5d88f8928dc8007d8b.tar.gz BIP39-88311463c74f022177a21c5d88f8928dc8007d8b.tar.zst BIP39-88311463c74f022177a21c5d88f8928dc8007d8b.zip |
Allow P2WPKH nested in P2SH addresses on BIP32 tab
Diffstat (limited to 'tests.js')
-rw-r--r-- | tests.js | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -4267,6 +4267,45 @@ page.open(url, function(status) { | |||
4267 | }); | 4267 | }); |
4268 | }, | 4268 | }, |
4269 | 4269 | ||
4270 | // BIP32 tab can use P2WPKH Nested In P2SH | ||
4271 | // github issue 91 part 2 | ||
4272 | // https://github.com/iancoleman/bip39/issues/91 | ||
4273 | // generate new addresses from xpub? | ||
4274 | function() { | ||
4275 | page.open(url, function(status) { | ||
4276 | // set the xpub and coin and select bip32 tab with p2wpkh addresses | ||
4277 | page.evaluate(function() { | ||
4278 | // use p2wpkh addresses | ||
4279 | $(".p2wpkh-nested-in-p2sh").prop("checked", true); | ||
4280 | // use bip32 tab | ||
4281 | $("#bip32-tab a").click(); | ||
4282 | // use testnet | ||
4283 | $(".network option[selected]").removeAttr("selected"); | ||
4284 | $(".network option").filter(function() { | ||
4285 | return $(this).html() == "BTC - Bitcoin Testnet"; | ||
4286 | }).prop("selected", true); | ||
4287 | $(".network").trigger("change"); | ||
4288 | // Set root xpub to BIP49 official test vector account 0 | ||
4289 | $(".root-key").val("tpubDD7tXK8KeQ3YY83yWq755fHY2JW8Ha8Q765tknUM5rSvjPcGWfUppDFMpQ1ScziKfW3ZNtZvAD7M3u7bSs7HofjTD3KP3YxPK7X6hwV8Rk2"); | ||
4290 | $(".root-key").trigger("input"); | ||
4291 | }); | ||
4292 | // check the address is generated correctly | ||
4293 | waitForGenerate(function() { | ||
4294 | var expected = "2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2"; | ||
4295 | var actual = page.evaluate(function() { | ||
4296 | return $(".address:first").text(); | ||
4297 | }); | ||
4298 | if (actual != expected) { | ||
4299 | console.log("BIP32 tab cannot generate P2WPKH Nested In P2SH addresses"); | ||
4300 | console.log("Expected: " + expected); | ||
4301 | console.log("Actual: " + actual); | ||
4302 | fail(); | ||
4303 | } | ||
4304 | next(); | ||
4305 | }); | ||
4306 | }); | ||
4307 | }, | ||
4308 | |||
4270 | // If you wish to add more tests, do so here... | 4309 | // If you wish to add more tests, do so here... |
4271 | 4310 | ||
4272 | // Here is a blank test template | 4311 | // Here is a blank test template |