Skip to content

Commit

Permalink
ZEUS-2748: ZEUS Pay: don't allow users to create accounts w/o LSP chan
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Jan 21, 2025
1 parent 1ba1ca0 commit 3a205bb
Show file tree
Hide file tree
Showing 19 changed files with 178 additions and 170 deletions.
2 changes: 1 addition & 1 deletion backends/CLNRest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export default class CLNRest {
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
supportsBumpFee = () => false;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => false;
supportsSimpleTaprootChannels = () => false;
supportsCustomPreimages = () => false;
Expand Down
2 changes: 1 addition & 1 deletion backends/CLightningREST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export default class CLightningREST extends LND {
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
supportsBumpFee = () => false;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => false;
supportsSimpleTaprootChannels = () => false;
supportsCustomPreimages = () => false;
Expand Down
2 changes: 1 addition & 1 deletion backends/Eclair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ export default class Eclair {
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
supportsBumpFee = () => false;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => false;
supportsSimpleTaprootChannels = () => false;
supportsCustomPreimages = () => false;
Expand Down
2 changes: 1 addition & 1 deletion backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default class EmbeddedLND extends LND {
supportsAddressTypeSelection = () => true;
supportsTaproot = () => this.supports('v0.15.0');
supportsBumpFee = () => true;
supportsLSPs = () => true;
supportsFlowLSP = () => true;
supportsNetworkInfo = () => true;
supportsSimpleTaprootChannels = () => this.supports('v0.17.0');
supportsCustomPreimages = () => true;
Expand Down
2 changes: 1 addition & 1 deletion backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ export default class LND {
supportsAddressTypeSelection = () => true;
supportsTaproot = () => this.supports('v0.15.0');
supportsBumpFee = () => true;
supportsLSPs = () => true;
supportsFlowLSP = () => true;
supportsNetworkInfo = () => true;
supportsSimpleTaprootChannels = () => this.supports('v0.17.0');
supportsCustomPreimages = () => true;
Expand Down
2 changes: 1 addition & 1 deletion backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ export default class LightningNodeConnect {
supportsAddressTypeSelection = () => true;
supportsTaproot = () => this.supports('v0.15.0');
supportsBumpFee = () => true;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => true;
supportsSimpleTaprootChannels = () => this.supports('v0.17.0');
supportsCustomPreimages = () => true;
Expand Down
2 changes: 1 addition & 1 deletion backends/LndHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default class LndHub extends LND {
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
supportsBumpFee = () => false;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => false;
supportsSimpleTaprootChannels = () => false;
supportsCustomPreimages = () => false;
Expand Down
2 changes: 1 addition & 1 deletion backends/Spark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export default class Spark {
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
supportsBumpFee = () => false;
supportsLSPs = () => false;
supportsFlowLSP = () => false;
supportsNetworkInfo = () => false;
supportsSimpleTaprootChannels = () => false;
supportsCustomPreimages = () => false;
Expand Down
7 changes: 4 additions & 3 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1158,10 +1158,11 @@
"views.Settings.LightningAddress.generatingPreimages": "Generating preimages",
"views.Settings.LightningAddress.ChangeAddress": "Change address",
"views.Settings.LightningAddress.nostrKeys.changeWarning": "Warning: changing your Nostr keys will delete your pending payments. Please redeem your pending payments before submitting new keys.",
"views.Settings.LightningAddress.explainer1": "To get started with a lightning address you must first have a lightning channel and inbound liquidity.",
"views.Settings.LightningAddress.explainer2": "The easiest way to do so is to purchase a 0-conf channel from our LSP, OLYMPUS by ZEUS. Just generate an invoice and pay yourself from another lightning wallet.",
"views.Settings.LightningAddress.explainer3": "For best results, open up a channel with our node, OLYMPUS by ZEUS.",
"views.Settings.LightningAddress.explainer1": "To get started with a lightning address you must first have a lightning channel from the ZEUS LSP with inbound liquidity.",
"views.Settings.LightningAddress.explainer2": "The easiest way to do so is to purchase a 0-conf channel. Just generate an invoice and pay yourself from another lightning wallet.",
"views.Settings.LightningAddress.explainer3": "Purchasing a standard channel will require you to wait for several on-chain confirmation before your channel is useable.",
"views.Settings.LightningAddress.get0ConfChan": "Get 0-conf channel",
"views.Settings.LightningAddress.getStandardChan": "Get standard channel",
"views.Settings.LightningAddress.generateNew": "Generate new pre-images",
"views.Settings.LightningAddressSettings.title": "Lightning address settings",
"views.Settings.LightningAddressSettings.automaticallyAccept": "Automatically accept payments on startup",
Expand Down
4 changes: 2 additions & 2 deletions stores/InvoicesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default class InvoicesStore {
if (customPreimage) req.preimage = customPreimage;

if (
BackendUtils.supportsLSPs() &&
BackendUtils.supportsFlowLSP() &&
this.settingsStore.settings?.enableLSP &&
value &&
value !== '0' &&
Expand Down Expand Up @@ -356,7 +356,7 @@ export default class InvoicesStore {

let jit_bolt11: string = '';
if (
BackendUtils.supportsLSPs() &&
BackendUtils.supportsFlowLSP() &&
this.settingsStore.settings?.enableLSP &&
value !== '0' &&
!noLsp
Expand Down
6 changes: 3 additions & 3 deletions stores/NodeInfoStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class NodeInfoStore {
};

@action
public lspNotConfigured = () => {
public flowLspNotConfigured = () => {
const { implementation, certVerification } = this.settingsStore;

const scidAlias =
Expand All @@ -145,15 +145,15 @@ export default class NodeInfoStore {
const zeroConfConfig = zeroConf && scidAlias;

const restIsConfigured = certVerification && zeroConfConfig;
const lspNotConfigured =
const flowLspNotConfigured =
implementation === 'lnd'
? !restIsConfigured
: implementation === 'embedded-lnd'
? false
: true;

return {
lspNotConfigured,
flowLspNotConfigured,
restIsConfigured,
zeroConfConfig,
zeroConf,
Expand Down
2 changes: 1 addition & 1 deletion utils/BackendUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class BackendUtils {
this.call('supportsAddressTypeSelection');
supportsTaproot = () => this.call('supportsTaproot');
supportsBumpFee = () => this.call('supportsBumpFee');
supportsLSPs = () => this.call('supportsLSPs');
supportsFlowLSP = () => this.call('supportsFlowLSP');
supportsNetworkInfo = () => this.call('supportsNetworkInfo');
supportsSimpleTaprootChannels = () =>
this.call('supportsSimpleTaprootChannels');
Expand Down
24 changes: 12 additions & 12 deletions views/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ interface ReceiveState {
needInbound: boolean;
enableLSP: boolean;
lspIsActive: boolean;
lspNotConfigured: boolean;
flowLspNotConfigured: boolean;
routeHintMode: RouteHintMode;
selectedRouteHintChannels?: Channel[];
hideRightHeaderComponent?: boolean;
Expand Down Expand Up @@ -204,7 +204,7 @@ export default class Receive extends React.Component<
needInbound: false,
enableLSP: true,
lspIsActive: false,
lspNotConfigured: true,
flowLspNotConfigured: true,
routeHintMode: RouteHintMode.Automatic,
selectedRouteHintChannels: undefined
};
Expand Down Expand Up @@ -234,7 +234,7 @@ export default class Receive extends React.Component<
status();
}

const { lspNotConfigured } = NodeInfoStore.lspNotConfigured();
const { flowLspNotConfigured } = NodeInfoStore.flowLspNotConfigured();

const newExpirySeconds = settings?.invoices?.expirySeconds || '3600';

Expand Down Expand Up @@ -274,9 +274,9 @@ export default class Receive extends React.Component<
enableLSP: settings?.enableLSP,
lspIsActive:
settings?.enableLSP &&
BackendUtils.supportsLSPs() &&
!lspNotConfigured,
lspNotConfigured
BackendUtils.supportsFlowLSP() &&
!flowLspNotConfigured,
flowLspNotConfigured
});

const lnOnly =
Expand Down Expand Up @@ -1121,7 +1121,7 @@ export default class Receive extends React.Component<
needInbound,
enableLSP,
lspIsActive,
lspNotConfigured,
flowLspNotConfigured,
routeHintMode,
selectedRouteHintChannels,
blindedPaths,
Expand Down Expand Up @@ -2079,8 +2079,8 @@ export default class Receive extends React.Component<
!creatingInvoice &&
route.params?.selectedIndex !== 2 && (
<>
{BackendUtils.supportsLSPs() &&
!lspNotConfigured && (
{BackendUtils.supportsFlowLSP() &&
!flowLspNotConfigured && (
<View
style={{
flexDirection:
Expand Down Expand Up @@ -2142,8 +2142,8 @@ export default class Receive extends React.Component<
!enableLSP,
lspIsActive:
!enableLSP &&
BackendUtils.supportsLSPs() &&
!lspNotConfigured
BackendUtils.supportsFlowLSP() &&
!flowLspNotConfigured
}
);
await updateSettings(
Expand All @@ -2159,7 +2159,7 @@ export default class Receive extends React.Component<
)}

{(!enableLSP ||
lspNotConfigured) && (
flowLspNotConfigured) && (
<>
<Text
style={{
Expand Down
8 changes: 4 additions & 4 deletions views/Settings/LSP.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export default class LSP extends React.Component<LSPProps, LSPState> {

const isTestNet = nodeInfo?.isTestNet;

const { lspNotConfigured, zeroConfConfig, scidAlias, zeroConf } =
NodeInfoStore.lspNotConfigured();
const { flowLspNotConfigured, zeroConfConfig, scidAlias, zeroConf } =
NodeInfoStore.flowLspNotConfigured();

const showReset: boolean =
!enableLSP ||
Expand All @@ -96,7 +96,7 @@ export default class LSP extends React.Component<LSPProps, LSPState> {
navigation={navigation}
/>
<View style={{ flex: 1 }}>
{lspNotConfigured ? (
{flowLspNotConfigured ? (
<>
<ListItem containerStyle={styles.listItem}>
<Text style={{ color: themeColor('text') }}>
Expand Down Expand Up @@ -348,7 +348,7 @@ export default class LSP extends React.Component<LSPProps, LSPState> {
</>
)}
</View>
{!lspNotConfigured && (
{!flowLspNotConfigured && (
<View style={{ marginBottom: 15 }}>
<FlatList
data={[
Expand Down
6 changes: 3 additions & 3 deletions views/Settings/LSPS1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ export default class LSPS1 extends React.Component<LSPS1Props, LSPS1State> {
{ element: twelveMoButton }
];

const { lspNotConfigured } = NodeInfoStore.lspNotConfigured();
const { flowLspNotConfigured } = NodeInfoStore.flowLspNotConfigured();

const flowServiceAvailable =
SettingsStore.settings?.enableLSP &&
BackendUtils.supportsLSPs() &&
!lspNotConfigured;
BackendUtils.supportsFlowLSP() &&
!flowLspNotConfigured;

const isOlympus = LSPStore.isOlympus();

Expand Down
Loading

0 comments on commit 3a205bb

Please sign in to comment.