breez / breez-sdk-greenlight

MIT License
244 stars 43 forks source link

SDK-Common: Add BIP21 URI parsing for Liquid #1058

Closed hydra-yse closed 3 months ago

hydra-yse commented 3 months ago

Necessary for breez/breez-sdk-liquid#405.

Ideally, we could create a fork of the bip21 crate and add the liquid logic there, but that approach requires quite some time and may not necessarily be merged by the author. Instead, I added a rudimentary BIP21 parser, taking inspiration from Boltz client's crate, so that our parse method can now support all the necessary types.

hydra-yse commented 3 months ago

A couple of notes CC @erdemyerebasmaz:

  1. I read your comment about allocations. Currently the deserializer performs a lot of that as I avoided using lifetime specifiers in the trait implementation like the bip21 crate does. Do you think it's worth adding it in this PR so we avoid re-allocating strings for every field in LiquidURI, or should it be addressed in the future?

  2. I'm having problems with bindings generations behind feature flags. We should investigate that together

erdemyerebasmaz commented 3 months ago

@roeierez Hold off merging as my last refactoring change has errors.

erdemyerebasmaz commented 3 months ago

@roeierez Hold off merging as my last refactoring change has errors.

  • refactor: Use pattern matching on elements_address.params to set network 5e8c034

@roeierez Removed these changes as AddressData cannot be used in pattern matching. One of it's fields bech32::Hrp does not derive PartialEq.