Resolves a name like `alice@example.com` to a BOLT 12 offer over DoH
and pays it. DNSSEC is validated locally, as required by BIP-353.
Self-resolution only for now; peer-based resolution via BLIP-32 will
follow. Exposes a `PayHumanReadableAddress` gRPC endpoint and a
`lndk-cli pay-hrn` command.
Validate that offer_amount is non-zero when parsing bolt12 offers,
rejecting malformed offers early per the BOLT 12 specification. Also
update CLI help text to note the amount requirement.
Closes#251.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change all CreateOffer command arguments to use long-form flags (--amount,
--description, --issuer, --expiry, --quantity) instead of positional
arguments. This is needed otherwise you cannot for example create an
offer with a quantity of Some(0), without having to specify all the
other arguments because they were positional.
Replace LndStatus variants with String in OfferError and LndError enums, updating all error handling to extract message from LndStatus before converting to String. This simplifies error handling and provides cleaner error messages to users.
Extracted duplicated gRPC channel creation, client authentication, and metadata handling code into reusable functions to reduce code duplication and improve error handling.
Split lndk_offers.rs into a proper module structure with separate files:
- handler: Defines entry point to get and pay bolt12 invoices and
pay offers (does both). Also actions whenever a offer
related onion message arrives to lndk.
- lnd_requests: Defines parsing and request to the LND node. Previously
some were were bounded to the lndk_offer. Now they are
separated and mostly use traits for easy mocking.
- client_impls: Defines client traits to be used on requests. Also adds
mocks to them exposed for use in other parts of the
module.
- parse: General bolt12 offers parsing methods.
- mod: General module, exposes Errors and different modules.
This separation improves maintainability and code organization while keeping
the same behavior.
This commit introduces a parameter in the RPC to allow users to modify
the timeout when receiving an invoice from the offer creator.
Additionally, it adds a configuration parameter for the server to set
up a default value if no parameter is used.
The default timeout value is also decreased from 100 seconds to 20
seconds.
This updates the CLI to connect to the LNDK gRPC server in order to make API
calls. We add the necessary macaroon metadata to each request. In addition,
we remove the cert and address flag options because we no longer require
passing in an LND certificate and address to connect to LND.
This commit Arc-ifies the reference to OffersHandler, which is necessary
because once we set up the grpc server, we'll need a second thread-safe
reference to it.