getAlby / nostr-wallet-connect

Nostr Wallet Connect (NIP-47) application to allow apps to connect to your node
https://nwc.getalby.com
Apache License 2.0
101 stars 29 forks source link

Added custom_records to metadata field of list_transactions #251

Open ericpp opened 4 months ago

ericpp commented 4 months ago

This PR adds custom records from invoices/payments to the metadata field of the list_transactions response. Based on the comments in the code, this seems to be where it was intended to be added, but I can move it to its own field if desired.

This addition would be useful to any application that sends and receives boostagrams as that data is stored in the custom records of each payment/invoice.

The code follows the Alby API convention of base64 encoding the values of each custom record. I moved the existing Alby metadata to an alby key in the new metadata structure. I'm not sure what metadata is being returned by the Alby API as all of mine are empty and it's not well documented in the docs: https://guides.getalby.com/developer-guide/v/alby-wallet-api/reference/api-reference/invoices#get-incoming-invoice-history .

If accepted, I wonder if we shouldn't also add a separate param in list_transactions to conditionally request metadata rather than sending it by default to save space. Users would need to request custom_records be returned by adding a "metadata": ["custom_records"] parameter or have a list, e.g. "metadata": ["custom_records", "alby"]

rolznz commented 1 month ago

Hi @ericpp, very sorry for the long delay, we're just getting around to this. I've added a PR in the extension to actually read this: https://github.com/getAlby/lightning-browser-extension/pull/3172

We will add this to Alby Hub first (https://github.com/getAlby/nostr-wallet-connect-next) as this is the new version of our NWC app which we will onboard Alby users to so they can run their own nodes. It also currently supports the LND connector: https://github.com/getAlby/hub/issues/60

Regarding the Alby (shared node) custom records, this is still relevant, but needs to be moved to the nwc.getalby.com Alby fork. There hasn't been much demand for it yet and we will need to review the priority for this one since we are trying to migrate Alby users to run their own node.

ericpp commented 1 month ago

Thanks @rolznz . I think this addition will be very helpful for podcast apps that want to use NWC to connect to wallets.