BitGo / bitgo-utxo-lib

UTXO coins functions implemented in pure JavaScript
83 stars 142 forks source link

Add tests for networks, describe bugs #65

Closed OttoAllmendinger closed 4 years ago

OttoAllmendinger commented 4 years ago

See individual commits

00d19ce src/coins.js: add getMainnet/getTestnet

These methods are useful when grouping tests

3e22726 src/coins.js: add isDash to isValidNetwork

99c7060 src/coins.js: isValidCoin -> isValidNetwork

The function takes network as an argument after all.

Add deprecation notice for old func.

b75742a src/networks.js: add tests

Make sure values are distinct unless explicitly grouped.

This method uncovered bug BG-16466.

Issue: BG-16465

06f0b92 src/networks.js: define coin network names

We need to describe some more relationships between networks. For instance, it is very useful to define getMainnet(network) and getTestnet(network).

These methods would fit well in coins.js and can be implemented using object equality on the constants defined in network.js. However, importing network.js from coins.js would lead to a circular import.

This change allows using coin.js to contain utility methods for network.js without having circular import problems.

OttoAllmendinger commented 4 years ago

I'm wondering whether it would be useful to have a ticket to track the deprecation of isValidCoin and its replacement with isValidNetwork.

It is a bit of a cosmetic issue so I decided it is not worth the backlog spam