LtbLightning / bdk-flutter

Bitcoin Development Kit - Flutter Package
MIT License
60 stars 27 forks source link

Consider having different factory methods for create wallet #21

Open BitcoinZavior opened 1 year ago

BitcoinZavior commented 1 year ago
    Yes, currently the createWallet is somewhat confusing as it does not enforce passing correct arguments. For instance, we can pass both mnemonic and descriptor or neither of them. These will be caught at compile time or run time but still it is a little confusing.

I would suggest to create different factory constructors like createWalletFromMnemonic, createWalletFromDescriptor for creating from descriptor only, createWalletFromPathDescriptor for creating from both descriptor and changeDescriptor etc. This way the API will be lot less confusing and we can avoid so many runtime errors.

Originally posted by @MrUnfunny in https://github.com/LtbLightning/bdk-flutter/issues/17#issuecomment-1265408870