You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RTL/src/app/shared/components/help/help.component.ts

142 lines
7.0 KiB
TypeScript

4 years ago
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
4 years ago
import { HelpTopic, LightningNode } from '../../models/RTLconfig';
import { SessionService } from '../../services/session.service';
4 years ago
import * as fromRTLReducer from '../../../store/rtl.reducers';
@Component({
selector: 'rtl-help',
templateUrl: './help.component.html',
styleUrls: ['./help.component.scss']
})
4 years ago
export class HelpComponent implements OnInit, OnDestroy {
public helpTopics: Array<HelpTopic> = [];
public faQuestion = faQuestion;
4 years ago
public selNode: LightningNode;
public LNPLink = '/lnd/';
public flgLoggedIn = false;
private unSubs = [new Subject(), new Subject(), new Subject(), new Subject()];
4 years ago
constructor(private store: Store<fromRTLReducer.RTLState>, private sessionService: SessionService) {
this.helpTopics.push(new HelpTopic({
question: 'Getting started',
answer: 'Funding your node is the first step to get started.\n' +
'Go to the "On-chain" page of the app:\n' +
'1. Generate a new address on the "Recieve" tab.\n'+
'2. Send funds to the address.\n' +
'3. Wait for the balance to be confirmed on-chain before proceeding further.\n' +
'3. Connecting with network peers and opening channels is next.\n',
link: 'onchain',
linkCaption: 'On-Chain page'
}));
this.helpTopics.push(new HelpTopic({
question: 'Connect with peers',
answer: 'Connect with network peers to open channels with them.\n' +
'Go to "Peer/Channels" page under the "Lightning" menu :\n' +
'1. Get the peer pubkey and host address in the pubkey@ip:port format.\n' +
'2. On the "Peers" enter the peer address and connect.\n' +
'3. Once the peer is connected, you can open channel with the peer.\n'+
'4. A variety of actions can be performed on the connected peers page for each peer:\n'+
' a. View Info - View the peer details.\n' +
' b. Open Channel - Open channel with the peer.\n' +
' c. Disconnect - Disconnect from the peer.\n',
link: 'peerschannels',
linkCaption: 'Peers/Channels page'
}));
this.helpTopics.push(new HelpTopic({
question: 'Opening Channels',
answer: 'Open channels with a connected network peer.\n' +
'Go to "Peer/Channels" page under the "Lightning" menu:\n' +
'1. On the "Channels" section, select the alias of the connected peer from the drop-down\n' +
'2. Specify the amount to commit to the channel and click on "Open Channel".\n' +
'3. There are a variety of options available while opening a channel. \n' +
' a. Private Channel - When this option is selected, a private channel is opened with the peer. \n' +
' b. Priority (advanced option) - Specify either Target confirmation Block or Fee in Sat/Byte. \n' +
' c. Spend Unconfirmd Output (advanced option) - Allow channels to be opened with unconfirmed UTXOs.\n' +
'4. Track the pending open channels under the "Pending" tab . \n' +
'5. Wait for the channel to be confirmed. Only a confimed channel can be used for payments or routing. \n',
link: 'peerschannels',
linkCaption: 'Peers/Channels page'}));
this.helpTopics.push(new HelpTopic({
question: 'Channel Management',
answer: 'Channel maintenance and balance score.\n' +
'Go to "Peer/Channels" page under the "Lightning" menu:\n' +
'1. A variety of actions can be perfomed on the open channels under the "Open" tab, with the "Actions" button:\n' +
' a. View Info - View the channel details.\n' +
' b. View Remote Fee - View the fee policy on the channel of the remote peer.\n' +
' c. Update Fee Policy - Modify the fee policy on the channel.\n' +
' d. Close Channel - Close the channel.\n' +
'2. Balance Score is balancedness metric score for the channel:\n' +
' a. It helps measure how balanced the remote and local balance on a channel is.\n' +
' b. A perfectly balanced channel has a score of one, where a completely lopsided one has a score of zero.\n' +
' c. The formular for calculating the score is "1 - abs((local bal - remote bal)/total bal)".\n',
link: 'peerschannels',
linkCaption: 'Peers/Channels page'
}));
this.helpTopics.push(new HelpTopic({
question: 'Lightning Transactions - Payments',
answer: 'Sending Payments from your node.\n' +
'Go to "Transactions" page under the "Lightning" menu :\n' +
'Payments - Payments tab is for making payments via your node\n' +
' 1. Input a non-expired lightning invoice (Bolt11 format) in the "Payment request" field and click on "Send Payment" to send.\n' +
' 2. Advanced option # 1 - Specify a limit on the routing fee you are willing to pay for the payment.\n' +
' 3. Advanced option # 2 - Specify the outgoing channel through which you want the payment to go out.\n',
link: 'transactions',
linkCaption: 'Transactions page'
}));
this.helpTopics.push(new HelpTopic({
question: 'Lightning Transactions - Invoices',
answer: 'Receiving Payments on your node.\n' +
'Go to "Transactions" page under the "Lightning" menu :\n' +
'Invoices - Invoices tab is for receiving payments on your node.\n' +
' 1. Memo - Description you want to provide on the invoice.\n' +
' 2. Expiry - The time period, after which the invoice will be invalid.\n' +
' 3. Private Routing Hints - Generate an invoice with routing hints for private channels.\n',
link: 'transactions',
linkCaption: 'Transactions page'
}));
this.helpTopics.push(new HelpTopic({
question: 'Lightning Transactions - Query Route',
answer: 'Querying Payment Routes.\n' +
'Go to "Transactions" page under the "Lightning" menu :\n' +
'Query Routes - Query Routes tab is for querying a potential path to a node and a routing fee estimate for a payment amount.\n'+
' 1. Destination Pubkey - Pubkey of the node, you want to send the payment to.\n' +
' 2. Amount - Amount in Sats, which you want to send to the node.\n',
link: 'transactions',
linkCaption: 'Transactions page'
}));
}
ngOnInit() {
4 years ago
this.store.select('root')
.pipe(takeUntil(this.unSubs[0]))
.subscribe(rtlStore => {
this.selNode = rtlStore.selNode;
if(this.selNode.lnImplementation.toUpperCase() === 'CLT') {
this.LNPLink = '/cl/';
} else {
this.LNPLink = '/lnd/';
}
});
this.sessionService.watchSession()
.pipe(takeUntil(this.unSubs[1]))
.subscribe(session => {
this.flgLoggedIn = (session.token) ? true : false;
});
if (this.sessionService.getItem('token')) { this.flgLoggedIn = true; }
}
4 years ago
ngOnDestroy() {
this.unSubs.forEach(completeSub => {
completeSub.next();
completeSub.complete();
});
}
}