Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support keysend in lightning meta tag #1223

Merged
merged 4 commits into from
Aug 2, 2022
Merged

Conversation

bumi
Copy link
Collaborator

@bumi bumi commented Aug 1, 2022

Describe the changes you have made in this PR

This adds support for keysend payments with the lightning meta tag.
I also think that the meta tag should follow a similar naming and usage as the podcast:value tag.

the meta tag can now define:

  • method: lnurl or keysend
  • address: the recipient (lnurl/lightning address or node key)
  • customKey/customValue: custom record for keysend

ToDo:

Link this PR to an issue

#792

Type of change (Remove other not matching type)

  • feat: New feature (non-breaking change which adds functionality)

How has this been tested?

example meta tag:

<meta name="lightning" content="method=keysend; address=030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3; customKey=696969; customValue=3wQCCrfOAMYNzOh1sL05" />

Checklist

  • My code follows the style guidelines of this project and performed a self-review of my own code
  • New and existing tests pass locally with my changes
  • I checked if I need to make corresponding changes to the documentation (and made those changes if needed)

@bumi
Copy link
Collaborator Author

bumi commented Aug 1, 2022

@github-actions
Copy link

github-actions bot commented Aug 1, 2022

Build files:

@im-adithya
Copy link
Member

How do I do this in proper TS: https://github.com/getAlby/lightning-browser-extension/pull/1223/files#diff-cdee507dd9e4243d8b288907c7c1d3924972f7c47c0a08b5c3d16fe079efad30R16

Not quite sure, but this can be one way to avoid errors:

  const obj: Record<string, string>= {};
           ------------------------
  tokens.forEach((t) => {
    const kv = t.split("=").map((e) => e.trim());
    obj[kv[0]] = kv[1];
  });
  return obj as unknown as Battery;
             -----------

@escapedcat
Copy link
Contributor

return obj as unknown as Battery;

I guess this would be a ok workaround for now till we took care of how to handle transforming URL-params into matching types later.

@bumi
Copy link
Collaborator Author

bumi commented Aug 1, 2022

I guess this would be a ok workaround for now till we took care of how to handle transforming URL-params into matching types later.

those are actually unrelated of the URL-params.
this data is just loaded and used in the Home screen to show the "Send sats" button.

@bumi bumi merged commit de007af into master Aug 2, 2022
@bumi bumi deleted the feature/keysend-meta-tag branch August 2, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants