Added custom_records to metadata field of list_transactions #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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"]