diff --git a/.github/docs/Application_configurations.md b/.github/docs/Application_configurations.md
index eb7e1f1c..753305bd 100644
--- a/.github/docs/Application_configurations.md
+++ b/.github/docs/Application_configurations.md
@@ -66,4 +66,5 @@ RTL_CONFIG_PATH (Path for the folder containing 'RTL-Config.json' file, Required
BITCOIND_CONFIG_PATH (Full path of the bitcoind.conf file including the file name, Optional)
CHANNEL_BACKUP_PATH (Folder location for saving the channel backup files, valid for LND implementation only, Required if ln implementation=LND else Optional)
ENABLE_OFFERS (Boolean flag to enable the offers feature on core lighning, default false, optional)
+ENABLE_PEERSWAP (Boolean flag to enable the peerswap feature on core lighning, default false, optional)
LN_API_PASSWORD (Password for Eclair implementation if the eclair.conf path is not available, Required if ln implementation=ECL && config path is undefined)
diff --git a/backend/controllers/shared/RTLConf.js b/backend/controllers/shared/RTLConf.js
index 1b693853..c42dd329 100644
--- a/backend/controllers/shared/RTLConf.js
+++ b/backend/controllers/shared/RTLConf.js
@@ -108,6 +108,7 @@ export const getRTLConfig = (req, res, next) => {
settings.swapServerUrl = node.swap_server_url;
settings.boltzServerUrl = node.boltz_server_url;
settings.enableOffers = node.enable_offers;
+ settings.enablePeerswap = node.enable_peerswap;
settings.channelBackupPath = node.channel_backup_path;
settings.currencyUnit = node.currency_unit;
nodesArr.push({
@@ -311,7 +312,7 @@ export const updateServiceSettings = (req, res, next) => {
const RTLConfFile = common.rtl_conf_file_path + sep + 'RTL-Config.json';
const config = JSON.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
const selectedNode = common.findNode(req.session.selectedNode.index);
- config.nodes.find((node) => {
+ config.nodes.forEach((node) => {
if (node.index === req.session.selectedNode.index) {
switch (req.body.service) {
case 'LOOP':
@@ -346,6 +347,10 @@ export const updateServiceSettings = (req, res, next) => {
node.Settings.enableOffers = req.body.settings.enableOffers;
selectedNode.enable_offers = req.body.settings.enableOffers;
break;
+ case 'PEERSWAP':
+ node.Settings.enablePeerswap = req.body.settings.enablePeerswap;
+ selectedNode.enable_peerswap = req.body.settings.enablePeerswap;
+ break;
default:
break;
}
diff --git a/backend/models/config.model.js b/backend/models/config.model.js
index 3191329f..f1911ec6 100644
--- a/backend/models/config.model.js
+++ b/backend/models/config.model.js
@@ -1,5 +1,5 @@
export class CommonSelectedNode {
- constructor(options, ln_server_url, macaroon_path, ln_api_password, swap_server_url, boltz_server_url, config_path, rtl_conf_file_path, swap_macaroon_path, boltz_macaroon_path, bitcoind_config_path, channel_backup_path, log_level, log_file, index, ln_node, ln_implementation, user_persona, theme_mode, theme_color, fiat_conversion, currency_unit, ln_version, api_version, enable_offers) {
+ constructor(options, ln_server_url, macaroon_path, ln_api_password, swap_server_url, boltz_server_url, config_path, rtl_conf_file_path, swap_macaroon_path, boltz_macaroon_path, bitcoind_config_path, channel_backup_path, log_level, log_file, index, ln_node, ln_implementation, user_persona, theme_mode, theme_color, fiat_conversion, currency_unit, ln_version, api_version, enable_offers, enable_peerswap) {
this.options = options;
this.ln_server_url = ln_server_url;
this.macaroon_path = macaroon_path;
@@ -25,6 +25,7 @@ export class CommonSelectedNode {
this.ln_version = ln_version;
this.api_version = api_version;
this.enable_offers = enable_offers;
+ this.enable_peerswap = enable_peerswap;
}
}
export class AuthenticationConfiguration {
@@ -35,7 +36,7 @@ export class AuthenticationConfiguration {
}
}
export class NodeSettingsConfiguration {
- constructor(userPersona, themeMode, themeColor, fiatConversion, currencyUnit, bitcoindConfigPath, logLevel, lnServerUrl, swapServerUrl, boltzServerUrl, channelBackupPath, enableOffers) {
+ constructor(userPersona, themeMode, themeColor, fiatConversion, currencyUnit, bitcoindConfigPath, logLevel, lnServerUrl, swapServerUrl, boltzServerUrl, channelBackupPath, enableOffers, enablePeerswap) {
this.userPersona = userPersona;
this.themeMode = themeMode;
this.themeColor = themeColor;
@@ -48,6 +49,7 @@ export class NodeSettingsConfiguration {
this.boltzServerUrl = boltzServerUrl;
this.channelBackupPath = channelBackupPath;
this.enableOffers = enableOffers;
+ this.enablePeerswap = enablePeerswap;
}
}
export class LogJSONObj {
diff --git a/backend/utils/config.js b/backend/utils/config.js
index d06d40f9..3bbe8822 100644
--- a/backend/utils/config.js
+++ b/backend/utils/config.js
@@ -241,6 +241,7 @@ export class ConfigService {
this.common.nodes[idx].boltz_macaroon_path = '';
}
this.common.nodes[idx].enable_offers = process.env.ENABLE_OFFERS ? process.env.ENABLE_OFFERS : (node.Settings.enableOffers) ? node.Settings.enableOffers : false;
+ this.common.nodes[idx].enable_peerswap = process.env.ENABLE_PEERSWAP ? process.env.ENABLE_PEERSWAP : (node.Settings.enablePeerswap) ? node.Settings.enablePeerswap : false;
this.common.nodes[idx].bitcoind_config_path = process.env.BITCOIND_CONFIG_PATH ? process.env.BITCOIND_CONFIG_PATH : (node.Settings.bitcoindConfigPath) ? node.Settings.bitcoindConfigPath : '';
this.common.nodes[idx].channel_backup_path = process.env.CHANNEL_BACKUP_PATH ? process.env.CHANNEL_BACKUP_PATH : (node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : this.common.rtl_conf_file_path + sep + 'channels-backup' + sep + 'node-' + node.index;
try {
diff --git a/server/controllers/shared/RTLConf.ts b/server/controllers/shared/RTLConf.ts
index 4dca8407..db0e3fd2 100644
--- a/server/controllers/shared/RTLConf.ts
+++ b/server/controllers/shared/RTLConf.ts
@@ -109,6 +109,7 @@ export const getRTLConfig = (req, res, next) => {
settings.swapServerUrl = node.swap_server_url;
settings.boltzServerUrl = node.boltz_server_url;
settings.enableOffers = node.enable_offers;
+ settings.enablePeerswap = node.enable_peerswap;
settings.channelBackupPath = node.channel_backup_path;
settings.currencyUnit = node.currency_unit;
nodesArr.push({
@@ -306,7 +307,7 @@ export const updateServiceSettings = (req, res, next) => {
const RTLConfFile = common.rtl_conf_file_path + sep + 'RTL-Config.json';
const config = JSON.parse(fs.readFileSync(RTLConfFile, 'utf-8'));
const selectedNode = common.findNode(req.session.selectedNode.index);
- config.nodes.find((node) => {
+ config.nodes.forEach((node) => {
if (node.index === req.session.selectedNode.index) {
switch (req.body.service) {
case 'LOOP':
@@ -342,6 +343,11 @@ export const updateServiceSettings = (req, res, next) => {
selectedNode.enable_offers = req.body.settings.enableOffers;
break;
+ case 'PEERSWAP':
+ node.Settings.enablePeerswap = req.body.settings.enablePeerswap;
+ selectedNode.enable_peerswap = req.body.settings.enablePeerswap;
+ break;
+
default:
break;
}
diff --git a/server/models/config.model.ts b/server/models/config.model.ts
index 45cb15e9..c166eb09 100644
--- a/server/models/config.model.ts
+++ b/server/models/config.model.ts
@@ -25,7 +25,8 @@ export class CommonSelectedNode {
public currency_unit?: string,
public ln_version?: string,
public api_version?: string,
- public enable_offers?: boolean
+ public enable_offers?: boolean,
+ public enable_peerswap?: boolean
) { }
}
@@ -54,7 +55,8 @@ export class NodeSettingsConfiguration {
public swapServerUrl?: string,
public boltzServerUrl?: string,
public channelBackupPath?: string,
- public enableOffers?: boolean
+ public enableOffers?: boolean,
+ public enablePeerswap?: boolean
) { }
}
diff --git a/server/utils/config.ts b/server/utils/config.ts
index fe0d3f2b..cb2c3e3d 100644
--- a/server/utils/config.ts
+++ b/server/utils/config.ts
@@ -226,6 +226,7 @@ export class ConfigService {
this.common.nodes[idx].boltz_macaroon_path = '';
}
this.common.nodes[idx].enable_offers = process.env.ENABLE_OFFERS ? process.env.ENABLE_OFFERS : (node.Settings.enableOffers) ? node.Settings.enableOffers : false;
+ this.common.nodes[idx].enable_peerswap = process.env.ENABLE_PEERSWAP ? process.env.ENABLE_PEERSWAP : (node.Settings.enablePeerswap) ? node.Settings.enablePeerswap : false;
this.common.nodes[idx].bitcoind_config_path = process.env.BITCOIND_CONFIG_PATH ? process.env.BITCOIND_CONFIG_PATH : (node.Settings.bitcoindConfigPath) ? node.Settings.bitcoindConfigPath : '';
this.common.nodes[idx].channel_backup_path = process.env.CHANNEL_BACKUP_PATH ? process.env.CHANNEL_BACKUP_PATH : (node.Settings.channelBackupPath) ? node.Settings.channelBackupPath : this.common.rtl_conf_file_path + sep + 'channels-backup' + sep + 'node-' + node.index;
try {
diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
index d6098db1..c377bce6 100644
--- a/src/app/app.routing.ts
+++ b/src/app/app.routing.ts
@@ -11,15 +11,21 @@ import { NodeSettingsComponent } from './shared/components/node-config/node-sett
import { ServicesSettingsComponent } from './shared/components/node-config/services-settings/services-settings.component';
import { LoopServiceSettingsComponent } from './shared/components/node-config/services-settings/loop-service-settings/loop-service-settings.component';
import { BoltzServiceSettingsComponent } from './shared/components/node-config/services-settings/boltz-service-settings/boltz-service-settings.component';
-import { ServicesComponent } from './shared/components/services/services.component';
-import { LoopComponent } from './shared/components/services/loop/loop.component';
-import { BoltzRootComponent } from './shared/components/services/boltz/boltz-root.component';
+import { LNServicesComponent } from './shared/components/ln-services/ln-services.component';
+import { LoopComponent } from './shared/components/ln-services/loop/loop.component';
+import { BoltzRootComponent } from './shared/components/ln-services/boltz/boltz-root.component';
import { HelpComponent } from './shared/components/help/help.component';
import { LoginComponent } from './shared/components/login/login.component';
import { NotFoundComponent } from './shared/components/not-found/not-found.component';
import { ErrorComponent } from './shared/components/error/error.component';
import { AuthGuard } from './shared/services/auth.guard';
import { ExperimentalSettingsComponent } from './shared/components/node-config/experimental-settings/experimental-settings.component';
+import { PeerswapComponent } from './shared/components/ln-services/peerswap/peerswap.component';
+import { PeerswapServiceSettingsComponent } from './shared/components/node-config/services-settings/peerswap-service-settings/peerswap-service-settings.component';
+import { SwapPeersComponent } from './shared/components/ln-services/peerswap/swap-peers/swap-peers.component';
+import { PeerswapsOutComponent } from './shared/components/ln-services/peerswap/swaps-out/swaps-out.component';
+import { PeerswapsInComponent } from './shared/components/ln-services/peerswap/swaps-in/swaps-in.component';
+import { PeerswapsCancelledComponent } from './shared/components/ln-services/peerswap/swaps-cancelled/swaps-cancelled.component';
export const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'login' },
@@ -42,7 +48,8 @@ export const routes: Routes = [
path: 'services', component: ServicesSettingsComponent, canActivate: [AuthGuard], children: [
{ path: '', pathMatch: 'full', redirectTo: 'loop' },
{ path: 'loop', component: LoopServiceSettingsComponent, canActivate: [AuthGuard] },
- { path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard] }
+ { path: 'boltz', component: BoltzServiceSettingsComponent, canActivate: [AuthGuard] },
+ { path: 'peerswap', component: PeerswapServiceSettingsComponent, canActivate: [AuthGuard] }
]
},
{ path: 'experimental', component: ExperimentalSettingsComponent, canActivate: [AuthGuard] },
@@ -50,12 +57,21 @@ export const routes: Routes = [
]
},
{
- path: 'services', component: ServicesComponent, canActivate: [AuthGuard], children: [
+ path: 'services', component: LNServicesComponent, canActivate: [AuthGuard], children: [
{ path: '', pathMatch: 'full', redirectTo: 'loop' },
{ path: 'loop', pathMatch: 'full', redirectTo: 'loop/loopout' },
{ path: 'loop/:selTab', component: LoopComponent },
{ path: 'boltz', pathMatch: 'full', redirectTo: 'boltz/swapout' },
- { path: 'boltz/:selTab', component: BoltzRootComponent }
+ { path: 'boltz/:selTab', component: BoltzRootComponent },
+ {
+ path: 'peerswap', component: PeerswapComponent, canActivate: [AuthGuard], children: [
+ { path: '', pathMatch: 'full', redirectTo: 'peers' },
+ { path: 'peers', component: SwapPeersComponent, canActivate: [AuthGuard] },
+ { path: 'psout', component: PeerswapsOutComponent, canActivate: [AuthGuard] },
+ { path: 'psin', component: PeerswapsInComponent, canActivate: [AuthGuard] },
+ { path: 'pscancelled', component: PeerswapsCancelledComponent, canActivate: [AuthGuard] }
+ ]
+ },
]
},
{ path: 'help', component: HelpComponent },
diff --git a/src/app/cln/store/cln.state.ts b/src/app/cln/store/cln.state.ts
index 6cb36265..ddd05b0d 100644
--- a/src/app/cln/store/cln.state.ts
+++ b/src/app/cln/store/cln.state.ts
@@ -45,7 +45,7 @@ export const initCLNState: CLNState = {
FetchOffers: { status: APICallStatusEnum.UN_INITIATED },
FetchOfferBookmarks: { status: APICallStatusEnum.UN_INITIATED }
},
- nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, selCurrencyUnit: 'USD', fiatConversion: false, channelBackupPath: '', currencyUnits: [], enableOffers: false },
+ nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, selCurrencyUnit: 'USD', fiatConversion: false, channelBackupPath: '', currencyUnits: [], enableOffers: false, enablePeerswap: false },
information: {},
fees: {},
feeRatesPerKB: {},
diff --git a/src/app/shared/components/ln-services/peerswap/peerswap.component.html b/src/app/shared/components/ln-services/peerswap/peerswap.component.html
new file mode 100755
index 00000000..afc58b70
--- /dev/null
+++ b/src/app/shared/components/ln-services/peerswap/peerswap.component.html
@@ -0,0 +1,16 @@
+