bitcoinjs/bitcoinjs-lib — pull request #140 by dcousens (2014-04-17 13:35:23+00:00)
Title: Migrates Address to Stricter API

Depends on #139.

This pull request simplifies the `Address` module so that it conforms to a highly strict subset of its original functionality.
It is primarily a wrapper for a `pubKeyHash` or `scriptHash`; and is limited to that subset.

The following builder functions are supported:
* `Address.fromBase58Check`, and
* `Address.fromPubKey`

With the standard `Address.prototype.toBase58Check` being aliased by `Address.prototype.toString`.

This pull request introduces a slight circular dependency with `ECPubKey`, however the intent is to eventually remove `ECKey.getAddress` to resolve this.

`Script.createOutputScript` had to be modified for these changes to proceed, mostly due to its inability to support non-standard network versions.
The fix implemented for this is not very pretty, but it is a functioning replacement (no extra tests for this have been provided beyond the bitcoin network however, I do intend to do that when I refactor `Transaction`).

Test fixtures for `Address` have also been added in `test/fixtures/address`.
Unlike in other pull requests, I did not make an effort to first check compatibility with the original test vectors for this pull request, and instead migrated to the new test vectors immediately.
This was done because the new API was not immediately compatible with the old, and would have required all new tests anyway.
If requested, I can import the old test vectors for testing with the current test setup, however the current vectors should be more than suitable (verify if unsure).