-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ocknamo/feature/adopt-lightning-address
Feature/adopt lightning address
- Loading branch information
Showing
10 changed files
with
4,116 additions
and
590 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script lang="ts"> | ||
import Dialog, { Content, Actions } from '@smui/dialog'; | ||
import Button, { Label } from '@smui/button'; | ||
import QrCode from 'svelte-qrcode'; | ||
export let canceled = false; | ||
export let nip5Name: string | null = null; | ||
export let nip5: string | null = null; | ||
export let lightningAddressUrl: string | null = null; | ||
$: lightningAddress = lightningAddressUrl | ||
? lightningAddressUrl.replace('lnurlp://', '') | ||
: ''; | ||
</script> | ||
|
||
<Dialog | ||
open | ||
scrimClickAction="" | ||
escapeKeyAction="" | ||
aria-labelledby="redirect notify" | ||
aria-describedby="Which URLs to redirect to. Information about who created the URL." | ||
> | ||
<Content id="redirect-to"> | ||
<!-- XXXX: Depending on the environment, 'lnurlp://' could not be used. Fix me if you can. e.g. Pixel 6 --> | ||
<QrCode value={'lightning://' + lightningAddress}></QrCode> | ||
|
||
<p class="redirect-url"> | ||
<span style="font-weight: 600">Tip to: </span>{lightningAddress ?? '???'} | ||
</p> | ||
<span style="font-weight: 600">Who made this link? :</span> | ||
<br /> | ||
→ | ||
<a | ||
href={`https://nostter.app/${nip5Name}@${nip5}`} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{nip5Name ?? ''}@{nip5 ?? '???'} | ||
</a> | ||
</Content> | ||
<div style="display: flex; justify-content: center"></div> | ||
<Actions> | ||
<a href={lightningAddressUrl} target="_blank" rel="noopener noreferrer"> | ||
<Button style="background-color:orange;margin-right:1em;min-width:80px"> | ||
<Label>⚡Tip!</Label> | ||
</Button> | ||
</a> | ||
<Button on:click={() => (canceled = true)}> | ||
<Label>Cancel</Label> | ||
</Button> | ||
</Actions> | ||
</Dialog> | ||
|
||
<style> | ||
.redirect-url { | ||
overflow-wrap: break-word; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { isValidLnAddress } from './is-valid-lnaddress'; | ||
|
||
describe('isValidLnAddress', () => { | ||
it('shoud return true with valid lightning address', () => { | ||
expect(isValidLnAddress('jhondoe@ocknamo.com')).toBe(true); | ||
expect(isValidLnAddress('s14pes@getalby.com')).toBe(true); | ||
}); | ||
|
||
it('shoud return true with invalid address', () => { | ||
expect(isValidLnAddress('@jhondoe@ocknamo.com')).toBe(false); | ||
expect(isValidLnAddress('s14pes@getalby#.com')).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.