Liquidity Ads Page Incomplete

Liquidity Ads Page Incomplete
pull/1032/head
Shahana Farooqui 2 years ago committed by ShahanaFarooqui
parent 346e414181
commit 3795851acf

@ -73,9 +73,13 @@ export const listNodes = (req, res, next) => {
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + (req.query !== {} ? (JSON.stringify(req.query).replace('{', '?').replace('}', '').replace(/:/g, '=').replace(/,/g, '&').replace(/"/g, '')) : '');
request(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Network', msg: 'List Nodes Finished', data: body });
body.forEach((node) => {
body.forEach((node, i) => {
node.option_will_fund.lease_fee_base_msat = (node.option_will_fund && node.option_will_fund.lease_fee_base_msat && typeof node.option_will_fund.lease_fee_base_msat === 'string' && node.option_will_fund.lease_fee_base_msat.includes('msat')) ? node.option_will_fund.lease_fee_base_msat.replace('msat', '') : node.option_will_fund.lease_fee_base_msat;
node.option_will_fund.channel_fee_max_base_msat = (node.option_will_fund && node.option_will_fund.channel_fee_max_base_msat && typeof node.option_will_fund.channel_fee_max_base_msat === 'string' && node.option_will_fund.channel_fee_max_base_msat.includes('msat')) ? node.option_will_fund.channel_fee_max_base_msat.replace('msat', '') : node.option_will_fund.channel_fee_max_base_msat;
// TO BE REMOVED
node.channelCount = +(Math.random() * 10).toFixed(0);
node.nodeCapacity = +(Math.random() * 1000000).toFixed(0);
// TO BE REMOVED
return node;
});
res.status(200).json(body);

@ -68,9 +68,13 @@ export const listNodes = (req, res, next) => {
options.url = req.session.selectedNode.ln_server_url + '/v1/network/listNodes' + (req.query !== {} ? (JSON.stringify(req.query).replace('{', '?').replace('}', '').replace(/:/g, '=').replace(/,/g, '&').replace(/"/g, '')) : '');
request(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Network', msg: 'List Nodes Finished', data: body });
body.forEach((node) => {
body.forEach((node, i) => {
node.option_will_fund.lease_fee_base_msat = (node.option_will_fund && node.option_will_fund.lease_fee_base_msat && typeof node.option_will_fund.lease_fee_base_msat === 'string' && node.option_will_fund.lease_fee_base_msat.includes('msat')) ? node.option_will_fund.lease_fee_base_msat.replace('msat', '') : node.option_will_fund.lease_fee_base_msat;
node.option_will_fund.channel_fee_max_base_msat = (node.option_will_fund && node.option_will_fund.channel_fee_max_base_msat && typeof node.option_will_fund.channel_fee_max_base_msat === 'string' && node.option_will_fund.channel_fee_max_base_msat.includes('msat')) ? node.option_will_fund.channel_fee_max_base_msat.replace('msat', '') : node.option_will_fund.channel_fee_max_base_msat;
// TO BE REMOVED
node.channelCount = +(Math.random() * 10).toFixed(0);
node.nodeCapacity = +(Math.random() * 1000000).toFixed(0);
// TO BE REMOVED
return node;
});
res.status(200).json(body);

@ -1,5 +1,5 @@
<div fxLayout="row" fxLayoutAlign="start center" class="page-title-container">
<fa-icon [icon]="faWater" class="page-title-img mr-1"></fa-icon>
<fa-icon [icon]="faBullhorn" class="page-title-img mr-1"></fa-icon>
<span class="page-title">Liquidity Ads</span>
</div>
<div fxLayout="column" class="padding-gap-x">
@ -15,7 +15,7 @@
<div fxFlex="30">
<span class="page-title">
Liquidity Ask
<mat-icon matTooltip="Tooltip for Liquidity Ask" matTooltipPosition="above" class="info-icon info-icon-primary">info_outline</mat-icon>
<mat-icon [matTooltip]="askTooltipMsg" matTooltipPosition="above" matTooltipClass="pre-wrap" class="info-icon info-icon-primary">info_outline</mat-icon>
</span>
</div>
<mat-form-field fxFlex="34">
@ -38,7 +38,7 @@
<div fxFlex="30">
<span class="page-title">
Nodes Advertising Liquidity
<mat-icon matTooltip="Tooltip for Nodes Advertising Liquidity" matTooltipPosition="above" class="info-icon info-icon-primary">info_outline</mat-icon>
<mat-icon [matTooltip]="nodesTooltipMsg" matTooltipPosition="above" matTooltipClass="pre-wrap" class="info-icon info-icon-primary">info_outline</mat-icon>
</span>
</div>
<mat-form-field fxFlex="34">
@ -102,7 +102,7 @@
<div class="bordered-box table-actions-select" fxLayoutAlign="center center">
<mat-select placeholder="Actions" tabindex="1" class="mr-0">
<mat-select-trigger></mat-select-trigger>
<mat-option (click)="onNodeClick(lqNode)">View Info</mat-option>
<mat-option (click)="onViewLeaseInfo(lqNode)">View Lease Info</mat-option>
<mat-option (click)="onOpenChannel(lqNode)">Open Channel</mat-option>
</mat-select>
</div>

@ -1,17 +1,21 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { MatTableDataSource } from '@angular/material/table';
import { MatSort } from '@angular/material/sort';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { faWater, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { faBullhorn, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { DataService } from '../../shared/services/data.service';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import { APICallStatusEnum, getPaginatorLabel, PAGE_SIZE, PAGE_SIZE_OPTIONS, ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { AlertTypeEnum, APICallStatusEnum, DataTypeEnum, getPaginatorLabel, PAGE_SIZE, PAGE_SIZE_OPTIONS, ScreenSizeEnum } from '../../shared/services/consts-enums-functions';
import { LookupNode } from '../../shared/models/clnModels';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { openConfirmation } from '../../store/rtl.actions';
import { RTLState } from '../../store/rtl.state';
import { RTLEffects } from '../../store/rtl.effects';
@Component({
selector: 'rtl-cln-liquidity-ads',
@ -25,13 +29,15 @@ export class CLNLiquidityAdsComponent implements OnInit, OnDestroy {
@ViewChild(MatSort, { static: false }) sort: MatSort | undefined;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator | undefined;
public askTooltipMsg = '';
public nodesTooltipMsg = '';
public displayedColumns: any[] = [];
public faWater = faWater;
public faBullhorn = faBullhorn;
public faExclamationTriangle = faExclamationTriangle;
public channelAmount = 0;
public channelOpeningFeeRate = 0;
public nodeCapacity = 0;
public channelCount = 0;
public nodeCapacity = 500000;
public channelCount = 5;
public liquidityNodesData: LookupNode[] = [];
public liquidityNodes: any;
public flgSticky = false;
@ -44,7 +50,10 @@ export class CLNLiquidityAdsComponent implements OnInit, OnDestroy {
public apiCallStatusEnum = APICallStatusEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private dataService: DataService, private commonService: CommonService) {
constructor(private logger: LoggerService, private store: Store<RTLState>, private dataService: DataService, private commonService: CommonService, private rtlEffects: RTLEffects) {
this.askTooltipMsg = 'Specify the liquidity requirements for your node: \n 1. Channel Amount - Amount in Sats you need for the channel opened to your node \n 2. Channel opening fee rate - Rate in Sats/vByte that you are willing to pay to open the channel to you';
this.nodesTooltipMsg = 'These are the nodes which are advertising their liquidity offering on the network.\nYou should pay attention to the following aspects to evaluate each node offer: \n- The total bitcoin deployed on the node, the more the better\n';
this.nodesTooltipMsg = this.nodesTooltipMsg + '- The number of channels open on the node, the more the better\n- The channel open fee which the node will charge from you\n- The routing fee which the node will charge on the payments, the lesser the better\n- The reliability of the node, ideally uptime. Refer to the information being provided by the node explorers';
this.screenSize = this.commonService.getScreenSize();
if (this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -83,23 +92,60 @@ export class CLNLiquidityAdsComponent implements OnInit, OnDestroy {
onFilter() {
this.logger.info(this.nodeCapacity);
this.logger.info(this.channelCount);
// this.liquidityNodes.filter = this.nodeCapacity + ' ' + this.channelCount;
this.liquidityNodes.filter = this.nodeCapacity + ' ' + this.channelCount;
}
loadLiqNodesTable(liqNodes: LookupNode[]) {
this.liquidityNodes = new MatTableDataSource<LookupNode>([...liqNodes]);
this.liquidityNodes.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.liquidityNodes.sort = this.sort;
this.liquidityNodes.filterPredicate = (node: LookupNode, fltr: string) => JSON.stringify(node).toLowerCase().includes(fltr);
this.liquidityNodes.filterPredicate = (node: LookupNode, fltr: string) => {
console.warn(node.channelCount);
console.warn(node.nodeCapacity);
console.warn(node.channelCount >= this.channelCount && node.nodeCapacity >= this.nodeCapacity);
return node.channelCount >= this.channelCount && node.nodeCapacity >= this.nodeCapacity;
}
this.liquidityNodes.paginator = this.paginator;
this.onFilter();
}
onOpenChannel(lqNode: LookupNode) {
}
onNodeClick(lqNode: LookupNode) {
}
onViewLeaseInfo(lqNode: LookupNode) {
const addArr = lqNode.addresses.reduce((acc, curr) => {
if (curr.address.length > 40) { curr.address = curr.address.substring(0, 39) + '...'; }
return acc.concat(JSON.stringify(curr).replace('{', '').replace('}', '').replace(/:/g, ': ').replace(/,/g, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').replace(/"/g, ''));
}, []);
const reorderedLQNode = [
[{ key: 'alias', value: lqNode.alias, title: 'Node Alias', width: 50, type: DataTypeEnum.STRING },
{ key: 'last_timestamp', value: lqNode.last_timestamp, title: 'Last Timestamp', width: 50, type: DataTypeEnum.DATE_TIME }],
[{ key: 'nodeid', value: lqNode.nodeid, title: 'Node ID', width: 100, type: DataTypeEnum.STRING }],
[{ key: 'base_fee', value: (lqNode.option_will_fund.lease_fee_base_msat / 1000), title: 'Lease Base Fee (Sats)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'fee_basis', value: lqNode.option_will_fund.lease_fee_basis, title: 'Lease Base Basis (bps)', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'lease_fee_rate', value: '-000', title: 'Lease Fee Rate (ppm)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'funding_rate', value: lqNode.option_will_fund.funding_weight, title: 'Channel Open Funding Rate', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'channel_max_base', value: (lqNode.option_will_fund.channel_fee_max_base_msat / 1000), title: 'Max Channel Routing Base Fee (Sats)', width: 50, type: DataTypeEnum.NUMBER },
{ key: 'channel_max_rate', value: lqNode.option_will_fund.channel_fee_max_proportional_thousandths, title: 'Max Channel Routing Fee Rate (ppm)', width: 50, type: DataTypeEnum.NUMBER }],
[{ key: 'address', value: addArr, title: 'Address', width: 100, type: DataTypeEnum.ARRAY }]
];
this.store.dispatch(openConfirmation({
payload: {
data: {
type: AlertTypeEnum.CONFIRM,
alertTitle: 'Lease Information',
noBtnText: 'Close',
yesBtnText: 'Open Channel',
message: reorderedLQNode
}
}
}));
this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[1])).subscribe((confirmRes) => {
if (confirmRes) {
console.warn('Open Channel Modal');
}
});
}
onDownloadCSV() {

@ -1,6 +1,6 @@
import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil, take } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { faHistory } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';

@ -339,6 +339,8 @@ export interface LookupNode {
color?: string;
last_timestamp?: number;
features?: string;
channelCount?: number;
nodeCapacity?: number;
addresses?: Address[];
option_will_fund?: {
lease_fee_base_msat?: number;

@ -1,4 +1,4 @@
import { faTachometerAlt, faLink, faBolt, faExchangeAlt, faUsers, faMapSigns, faQuestion, faSearch, faChartBar, faTools, faProjectDiagram, faDownload, faServer, faPercentage, faInfinity, faUserCheck, faLayerGroup, faAd, faWater } from '@fortawesome/free-solid-svg-icons';
import { faTachometerAlt, faLink, faBolt, faExchangeAlt, faUsers, faMapSigns, faQuestion, faSearch, faChartBar, faTools, faProjectDiagram, faDownload, faServer, faPercentage, faInfinity, faUserCheck, faLayerGroup, faBullhorn } from '@fortawesome/free-solid-svg-icons';
import { UserPersonaEnum } from '../services/consts-enums-functions';
export class MenuChildNode {
@ -54,7 +54,7 @@ export const MENU_DATA: MenuRootNode = {
{
id: 3, parentId: 0, name: 'Lightning', iconType: 'FA', icon: faBolt, link: '/cln/connections', userPersona: UserPersonaEnum.ALL, children: [
{ id: 31, parentId: 3, name: 'Peers/Channels', iconType: 'FA', icon: faUsers, link: '/cln/connections', userPersona: UserPersonaEnum.ALL },
{ id: 32, parentId: 3, name: 'Liquidity Ads', iconType: 'FA', icon: faWater, link: '/cln/liquidityads', userPersona: UserPersonaEnum.ALL },
{ id: 32, parentId: 3, name: 'Liquidity Ads', iconType: 'FA', icon: faBullhorn, link: '/cln/liquidityads', userPersona: UserPersonaEnum.ALL },
{ id: 33, parentId: 3, name: 'Transactions', iconType: 'FA', icon: faExchangeAlt, link: '/cln/transactions', userPersona: UserPersonaEnum.ALL },
{ id: 34, parentId: 3, name: 'Routing', iconType: 'FA', icon: faMapSigns, link: '/cln/routing', userPersona: UserPersonaEnum.ALL },
{ id: 35, parentId: 3, name: 'Reports', iconType: 'FA', icon: faChartBar, link: '/cln/reports', userPersona: UserPersonaEnum.ALL },

Loading…
Cancel
Save