Sjors / libwally-swift

Swift wrapper for LibWally, a collection of useful primitives for cryptocurrency wallets
MIT License
40 stars 18 forks source link

Multisig address derivation #17

Closed Sjors closed 4 years ago

Sjors commented 4 years ago

~Depends on #18 (because it introduces Swift 5.1 behavior when handling an optional enum)~

This adds the ability to generate a multisig address for a set of public keys ([HDKey]) and a threshold (e.g. 2 of 2).

It adds a scriptPubKey initializer to Address, which uses a new witnessProgram property on ScriptPubKey. This should be expanded to handle different types of ScriptType (maybe in a different PR). See also #7.

It adds a multisig initializer to ScriptPubKey which uses wally_scriptpubkey_multisig_from_bytes internally: https://wally.readthedocs.io/en/release_0.7.5/script/#c.wally_scriptpubkey_multisig_from_bytes

Sjors commented 4 years ago

Rebased and fixed some conflicts with #22