-
Notifications
You must be signed in to change notification settings - Fork 31
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 #228 from jimwjl666/feature/micro-node
feat:add micro-node
- Loading branch information
Showing
7 changed files
with
131 additions
and
9 deletions.
There are no files selected for viewing
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,23 @@ | ||
import { customElement } from 'lit/decorators.js'; | ||
import { nwcIcon } from '../icons/connectors/lnfiIcon'; | ||
import { ConnectorElement } from './ConnectorElement'; | ||
import store from '../../state/store'; | ||
|
||
export const lnfiConnectorTitle = 'Micro node connect'; | ||
|
||
@customElement('bc-lnfi-nwc-connector') | ||
export class LnfiNWCConnector extends ConnectorElement { | ||
constructor() { | ||
super('nwc.generic', lnfiConnectorTitle, '#ffffff', nwcIcon); | ||
} | ||
|
||
protected async _onClick() { | ||
store.getState().pushRoute('/lnfi'); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'bc-lnfi-nwc-connector': LnfiNWCConnector; | ||
} | ||
} |
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,16 @@ | ||
import { svg } from 'lit'; | ||
|
||
// WARNING: if replacing this icon make sure to: | ||
// - set class="w-10 h-10" | ||
|
||
export const nwcIcon = svg`<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M40 17.5H34.4V23.1H40V17.5Z" fill="#041011"/> | ||
<path d="M16.7 0V5.6L27.8 8.9L22.2 0H16.7Z" fill="#041011"/> | ||
<path d="M29.4 35H35L36.7 25L29.4 29.4V35Z" fill="#041011"/> | ||
<path d="M35 5H29.4V10.6L36.1 16.1L35 5Z" fill="#041011"/> | ||
<path d="M16.7 40H22.2L27.8 29.4L16.7 34.4V40Z" fill="#041011"/> | ||
<path d="M5 29.4V35H10.6L22.2 26.7L5 29.4Z" fill="#041011"/> | ||
<path d="M18.9 18.6L5.6 17.5H0V23.1H5.6L18.9 18.6Z" fill="#041011"/> | ||
<path d="M10.6 5H5V10.6L21.1 12.8L10.6 5Z" fill="#041011"/> | ||
</svg> | ||
`; |
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,77 @@ | ||
import { customElement, state } from 'lit/decorators.js'; | ||
import { BitcoinConnectElement } from '../BitcoinConnectElement'; | ||
import { withTwind } from '../twind/withTwind'; | ||
import { html } from 'lit'; | ||
import '../internal/bci-button'; | ||
import { classes } from '../css/classes'; | ||
import store from '../../state/store'; | ||
import { genericConnectorTitle } from '../connectors/bc-generic-nwc-connector'; | ||
|
||
@customElement('bc-lnfi') | ||
export class LnfiNWCPage extends withTwind()(BitcoinConnectElement) { | ||
@state() | ||
private _nwcUrl = ''; | ||
|
||
override render() { | ||
return html`<div class="w-full"> | ||
<bc-navbar class="flex w-full" heading="Micro node Wallet Connect"> | ||
</bc-navbar> | ||
<div class="font-sans text-sm w-full"> | ||
<div class="px-8 pt-4 w-full"> | ||
<div class="mb-2 ${classes['text-neutral-secondary']}"> | ||
1. Add a new | ||
<a | ||
href="https://doc.nostrassets.com/micronode-early-access/micronode-connect-mnc" | ||
target="_blank" | ||
class="font-bold" | ||
>Wallet Connection | ||
</a> | ||
from | ||
<span class="${classes['text-neutral-tertiary']}" | ||
>MicroNode => Generate NWC</span | ||
> | ||
and copy the connection string. | ||
</div> | ||
<div class="mb-1 ${classes['text-neutral-secondary']}"> | ||
2. Paste the connection string below: | ||
</div> | ||
<input | ||
value=${this._nwcUrl} | ||
@change=${this.nwcUrlChanged} | ||
placeholder="nostr+walletconnect://..." | ||
type="password" | ||
class="w-full mb-8 rounded-lg p-2 border-1 ${classes[ | ||
'border-neutral-secondary' | ||
]}" | ||
/> | ||
<bci-button @click=${this.onConnect}> | ||
<span class="${classes['text-brand-mixed']}">Connect</span> | ||
</bci-button> | ||
</div> | ||
</div> | ||
</div>`; | ||
} | ||
|
||
private nwcUrlChanged(event: { target: HTMLInputElement }) { | ||
this._nwcUrl = event.target.value; | ||
} | ||
private async onConnect() { | ||
if (!this._nwcUrl) { | ||
store.getState().setError('Please enter a URL'); | ||
return; | ||
} | ||
|
||
await store.getState().connect({ | ||
nwcUrl: this._nwcUrl, | ||
connectorName: genericConnectorTitle, | ||
connectorType: 'nwc.generic', | ||
}); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'bc-lnfi': LnfiNWCPage; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import {ExtensionConnector} from './ExtensionConnector'; | ||
import {LnbitsConnector} from './LnbitsConnector'; | ||
import {LNCConnector} from './LNCConnector'; | ||
import {NWCConnector} from './NWCConnector'; | ||
import { ExtensionConnector } from './ExtensionConnector'; | ||
import { LnbitsConnector } from './LnbitsConnector'; | ||
import { LNCConnector } from './LNCConnector'; | ||
import { NWCConnector } from './NWCConnector'; | ||
|
||
export const connectors = { | ||
'extension.generic': ExtensionConnector, | ||
'nwc.alby': NWCConnector, | ||
'nwc.generic': NWCConnector, | ||
'nwc.mutiny': NWCConnector, | ||
'nwc.umbrel': NWCConnector, | ||
'nwc.lnfi': NWCConnector, | ||
lnbits: LnbitsConnector, | ||
lnc: LNCConnector, | ||
}; |