shapeshift / hdwallet

A library for interacting with hardware wallets from JS/TS.

Home Page:https://hdwallet.shapeshift.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`BTC(Input|Output)ScriptType` types are redundant

mrnerdhair opened this issue · comments

There's only one type of script type, but we've got two different ones. This makes the API harder to use, the library as a whole less extensible and harder to maintain, and gives people the false impression that script type and address format have something to do with each other.

  • Dry out BTC(Input|Output)ScriptType into a single BTCScriptType enum whose members represent the actual BTC script types.
  • Introduce a new type, BTCAddressFormat, to make specifying a specific script type to orthagonal to specifying how an address should be encoded (e.g. cashaddr vs Bech32 vs Base58Check)
  • Add a function defaultAddressFormatForScriptType() to hdwallet-core which returns the standard Bitcoin Mainnet address format used with each script type.

Fixed by #434.