Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Phoenixd (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
bumi authored May 29, 2024
1 parent 6b15b38 commit 5b32563
Show file tree
Hide file tree
Showing 9 changed files with 519 additions and 29 deletions.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ func (api *API) GetInfo(ctx context.Context) (*models.InfoResponse, error) {

nodeInfo, err := api.svc.lnClient.GetInfo(ctx)
if err != nil {
api.svc.Logger.WithError(err).Error("Failed to get alby user identifier")
api.svc.Logger.WithError(err).Error("Failed to get nodeInfo")
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SidebarHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function SidebarHint() {
}

// User has no channels yet
if (channels?.length === 0) {
if ((info?.backendType === "LDK" || info?.backendType === "GREENLIGHT") && channels?.length === 0) {
return (
<SidebarHintCard
icon={Zap}
Expand All @@ -89,7 +89,7 @@ function SidebarHint() {
);
}

if (info?.showBackupReminder) {
if (info?.backendType === "LDK" && info?.showBackupReminder) {
return (
<SidebarHintCard
icon={ShieldAlert}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/layouts/SettingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export default function SettingsLayout() {
<MenuItem to="/settings/change-unlock-password">
Unlock Password
</MenuItem>
<MenuItem to="/settings/key-backup">Key Backup</MenuItem>
{ (info?.backendType === "LDK" || info?.backendType === "BREEZ" || info?.backendType === "GREENLIGHT") && (
<MenuItem to="/settings/key-backup">Key Backup</MenuItem>
)}
{info?.backendType === "LDK" && (
<MenuItem to="/settings/node-backup">Node Backup</MenuItem>
)}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/screens/setup/SetupNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function SetupNode() {
<SelectItem value="BREEZ">Breez</SelectItem>
<SelectItem value="GREENLIGHT">Greenlight</SelectItem>
<SelectItem value="LND">LND</SelectItem>
<SelectItem value="PHOENIX">Phoenix</SelectItem>
</SelectContent>
</Select>
{backendType === "BREEZ" && <BreezForm handleSubmit={handleSubmit} />}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/screens/setup/SetupPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export function SetupPassword() {
return;
}

// Pre-configured LND
if (info?.backendType === "LND") {
// Pre-configured nodes that do not need a mnemonic
if (info?.backendType === "LND" || info?.backendType === "PHOENIX") {
// NOTE: LND flow does not setup a mnemonic
navigate(`/setup/finish`);
return;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const NIP_47_SIGN_MESSAGE_METHOD = "sign_message";

export const NIP_47_NOTIFICATIONS_PERMISSION = "notifications";

export type BackendType = "LND" | "BREEZ" | "GREENLIGHT" | "LDK";
export type BackendType = "LND" | "BREEZ" | "GREENLIGHT" | "LDK" | "PHOENIX";

export type RequestMethodType =
| "pay_invoice"
Expand Down
47 changes: 25 additions & 22 deletions models/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,34 @@ const (
GreenlightBackendType = "GREENLIGHT"
LDKBackendType = "LDK"
BreezBackendType = "BREEZ"
PhoenixBackendType = "PHOENIX"
)

type AppConfig struct {
Relay string `envconfig:"RELAY" default:"wss://relay.getalby.com/v1"`
LNBackendType string `envconfig:"LN_BACKEND_TYPE"`
LNDAddress string `envconfig:"LND_ADDRESS"`
LNDCertFile string `envconfig:"LND_CERT_FILE"`
LNDMacaroonFile string `envconfig:"LND_MACAROON_FILE"`
Workdir string `envconfig:"WORK_DIR"`
Port string `envconfig:"PORT" default:"8080"`
DatabaseUri string `envconfig:"DATABASE_URI" default:"nwc.db"`
CookieSecret string `envconfig:"COOKIE_SECRET"`
LogLevel string `envconfig:"LOG_LEVEL"`
LDKNetwork string `envconfig:"LDK_NETWORK" default:"bitcoin"`
LDKEsploraServer string `envconfig:"LDK_ESPLORA_SERVER" default:"https://electrs.albylabs.com"`
LDKGossipSource string `envconfig:"LDK_GOSSIP_SOURCE" default:"https://rapidsync.lightningdevkit.org/snapshot"`
LDKLogLevel string `envconfig:"LDK_LOG_LEVEL"`
MempoolApi string `envconfig:"MEMPOOL_API" default:"https://mempool.space/api"`
AlbyAPIURL string `envconfig:"ALBY_API_URL" default:"https://api.getalby.com"`
AlbyClientId string `envconfig:"ALBY_OAUTH_CLIENT_ID" default:"J2PbXS1yOf"`
AlbyClientSecret string `envconfig:"ALBY_OAUTH_CLIENT_SECRET" default:"rABK2n16IWjLTZ9M1uKU"`
AlbyOAuthAuthUrl string `envconfig:"ALBY_OAUTH_AUTH_URL" default:"https://getalby.com/oauth"`
BaseUrl string `envconfig:"BASE_URL" default:"http://localhost:8080"`
FrontendUrl string `envconfig:"FRONTEND_URL"`
LogEvents bool `envconfig:"LOG_EVENTS" default:"false"`
Relay string `envconfig:"RELAY" default:"wss://relay.getalby.com/v1"`
LNBackendType string `envconfig:"LN_BACKEND_TYPE"`
LNDAddress string `envconfig:"LND_ADDRESS"`
LNDCertFile string `envconfig:"LND_CERT_FILE"`
LNDMacaroonFile string `envconfig:"LND_MACAROON_FILE"`
Workdir string `envconfig:"WORK_DIR"`
Port string `envconfig:"PORT" default:"8080"`
DatabaseUri string `envconfig:"DATABASE_URI" default:"nwc.db"`
CookieSecret string `envconfig:"COOKIE_SECRET"`
LogLevel string `envconfig:"LOG_LEVEL"`
LDKNetwork string `envconfig:"LDK_NETWORK" default:"bitcoin"`
LDKEsploraServer string `envconfig:"LDK_ESPLORA_SERVER" default:"https://electrs.albylabs.com"`
LDKGossipSource string `envconfig:"LDK_GOSSIP_SOURCE" default:"https://rapidsync.lightningdevkit.org/snapshot"`
LDKLogLevel string `envconfig:"LDK_LOG_LEVEL"`
MempoolApi string `envconfig:"MEMPOOL_API" default:"https://mempool.space/api"`
AlbyAPIURL string `envconfig:"ALBY_API_URL" default:"https://api.getalby.com"`
AlbyClientId string `envconfig:"ALBY_OAUTH_CLIENT_ID" default:"J2PbXS1yOf"`
AlbyClientSecret string `envconfig:"ALBY_OAUTH_CLIENT_SECRET" default:"rABK2n16IWjLTZ9M1uKU"`
AlbyOAuthAuthUrl string `envconfig:"ALBY_OAUTH_AUTH_URL" default:"https://getalby.com/oauth"`
BaseUrl string `envconfig:"BASE_URL" default:"http://localhost:8080"`
FrontendUrl string `envconfig:"FRONTEND_URL"`
LogEvents bool `envconfig:"LOG_EVENTS" default:"false"`
PhoenixdAddress string `envconfig:"PHOENIXD_ADDRESS" default:"http://127.0.0.1:9740"`
PhoenixdAuthorization string `envconfig:"PHOENIXD_AUTHORIZATION"`
}

func (c *AppConfig) IsDefaultClientId() bool {
Expand Down
Loading

0 comments on commit 5b32563

Please sign in to comment.