Sjors / libwally-swift

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

PSBT support #19

Closed Sjors closed 4 years ago

Sjors commented 4 years ago

Adds PSBT support. Usage:

var psbt = try! PSBT(".... base64 ...") // or use Data()
psbt.complete // false
let privKey = Key("5...")! // WIF
psbt.sign(privKey)
psbt.complete // true
psbt.transaction.description // "02...00" (raw transaction)

More examples are in the test file.

It uses the libwally-core master branch which contains a PSBT bug fix (https://github.com/ElementsProject/libwally-core/pull/160) and two helper functions (https://github.com/ElementsProject/libwally-core/pull/163 and https://github.com/ElementsProject/libwally-core/pull/162). We can switch back to a release tag later.

To test:

git submodule update
 ./build-libwally.sh -sc

Change detection is somewhat experimental.