diff --git a/app/src/api/cln.ts b/app/src/api/cln.ts index 526d55a1..118d752c 100644 --- a/app/src/api/cln.ts +++ b/app/src/api/cln.ts @@ -86,6 +86,11 @@ export async function create_channel( return await clnCmd("AddChannel", tag, { pubkey, amount, satsperbyte }); } -export async function add_peer(tag: string, pubkey: string, host: string) { - return await clnCmd("AddPeer", tag, { pubkey, host }); +export async function add_peer( + tag: string, + pubkey: string, + host: string, + alias?: string +) { + return await clnCmd("AddPeer", tag, { pubkey, host, alias }); } diff --git a/app/src/api/lnd.ts b/app/src/api/lnd.ts index 224cc824..5037eb2c 100644 --- a/app/src/api/lnd.ts +++ b/app/src/api/lnd.ts @@ -59,8 +59,13 @@ export async function list_channels(tag: string) { return await lndCmd("ListChannels", tag); } -export async function add_peer(tag: string, pubkey: string, host: string) { - return await lndCmd("AddPeer", tag, { pubkey, host }); +export async function add_peer( + tag: string, + pubkey: string, + host: string, + alias?: string +) { + return await lndCmd("AddPeer", tag, { pubkey, host, alias }); } export async function list_peers(tag: string) { diff --git a/app/src/lnd/Peers.svelte b/app/src/lnd/Peers.svelte index d074a689..6860165f 100644 --- a/app/src/lnd/Peers.svelte +++ b/app/src/lnd/Peers.svelte @@ -47,11 +47,12 @@ let error_notification = false; let error_message = false; let isUpdate = false; + let peerAlias = ""; async function addPeer() { message = ""; if (type === "Cln") { - const peer = await CLN.add_peer(tag, pubkey, host); + const peer = await CLN.add_peer(tag, pubkey, host, peerAlias); show_notification = true; if (typeof peer === "string") { @@ -69,6 +70,8 @@ if (peer) { pubkey = ""; host = ""; + peerAlias = ""; + await handleGetLightningPeers(); const peersData = await CLN.list_peers(tag); const thepeers = await parseClnListPeerRes(peersData); peersStore.update((peer) => { @@ -77,11 +80,12 @@ createdPeerForOnboarding.update(() => true); } } else { - if (await add_peer(tag, pubkey, host)) { + if (await add_peer(tag, pubkey, host, peerAlias)) { show_notification = true; pubkey = ""; host = ""; - + peerAlias = ""; + await handleGetLightningPeers(); setTimeout(async () => { const peersData = await list_peers(tag); peersStore.update((ps) => { @@ -217,6 +221,12 @@ bind:value={host} />
+ +