To use the `lndk-cli` to pay a BOLT 12 offer, follow these instructions:
- To install lndk-cli:
`cargo install --bin=lndk-cli --path .`
- With the above command, `lndk-cli` will be installed to `~/.cargo/bin`. So make sure `~/.cargo/bin` is on your PATH so we can properly run `lndk-cli`.
- Run `lndk-cli -h` to make sure it's working. You'll see output similar to:
decode-offer Decodes a bech32-encoded offer string into a BOLT 12 offer
decode-invoice Decodes a bech32-encoded invoice string into a BOLT 12 invoice
pay-offer PayOffer pays a BOLT 12 offer, provided as a 'lno'-prefaced offer string
get-invoice GetInvoice fetch a BOLT 12 invoice, which will be returned as a hex-encoded string. It fetches the invoice from a BOLT 12 offer, provided as a 'lno'-prefaced offer string
pay-invoice PayInvoice pays a hex-encoded BOLT12 invoice
help Print this message or the help of the given subcommand(s)
-n, --network <NETWORK> Global variables [default: regtest]
-m, --macaroon-path <MACAROON_PATH>
--macaroon-hex <MACAROON_HEX> A hex-encoded macaroon string to pass in directly to the cli
--cert-pem <CERT_PEM> This option is for passing a pem-encoded TLS certificate string to establish a connection with the LNDK server. If this isn't set, the cli will look for the TLS file in the default location (~.lndk)
- The client must pass in this data via gRPC metadata. You can find an example of this in the [Rust client](https://github.com/lndk-org/lndk/blob/master/src/cli.rs) used to connect `lndk-cli` to the server.
Rather than use the admin.macaroon with unrestricted permission to an LND node, we can bake a macaroon using lncli with much more specific permissions for better security. Note also that the macaroon required for [starting up a LNDK instance](https://github.com/lndk-org/lndk?tab=readme-ov-file#custom-macaroon) requires different permissions than when making a payment.
When using `pay-offer`, you can generate a macaroon which will give LNDK only the specific grpc endpoints it needs to hit:
When `LNDK` is started up, self-signed TLS credentials are automatically generated and stored in `~/.lndk`. If you're running `lndk-cli` locally, it'll know where to find the certificate file it needs to establish a secure connection with the LNDK server.
To run `lndk-cli` on a remote machine, users need to copy the `tls-cert.pem` file to the corresponding LNDK data directory (`~/.lndk`) on the machine where `lndk-cli` is being run.