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/cln/liquidity-ads/liquidity-ads-list/liquidity-ads-list.componen...

171 lines
11 KiB
HTML

<div fxLayout="row" fxLayoutAlign="start center" class="page-title-container">
<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">
<mat-card>
<mat-card-content class="padding-gap-large">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch">
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #formAsk="ngForm">
<div fxFlex="100" fxLayout="row" class="alert alert-warn">
<fa-icon [icon]="faExclamationTriangle" class="mr-1 alert-icon"></fa-icon>
<span>Ads should be supplemented with additional research of the node, before buying liquidity.</span>
</div>
<div fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start stretch" class="page-sub-title-container mt-1">
<div fxFlex="30">
<span class="page-title">
Liquidity Ask
<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">
<input autoFocus matInput placeholder="Channel Amount (Sats)" name="channelAmount" [(ngModel)]="channelAmount" (keyup)="onCalculateOpeningFee()" tabindex="1" type="number" step="10000" required>
<mat-error *ngIf="!channelAmount">Channel amount is required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="34">
<input matInput placeholder="Channel Opening Fee Rate (Sats/vByte)" name="channel_opening_feeRate" [(ngModel)]="channel_opening_feeRate" (keyup)="onCalculateOpeningFee()" type="number" step="10" tabindex="2" required>
<mat-error *ngIf="!channel_opening_feeRate">Channel opening fee rate is required.</mat-error>
</mat-form-field>
</div>
</form>
<!-- <mat-divider [inset]="true" class="my-2"></mat-divider>
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #formFilter="ngForm">
<div fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign.gt-sm="space-between center" fxLayoutAlign="start start" class="page-sub-title-container mt-1">
<div fxFlex="30">
<span class="page-title">
Nodes Advertising Liquidity
<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">
<input matInput placeholder="Node Capacity (Sats)" name="node_capacity" [(ngModel)]="node_capacity" (keyup)="onFilter()" tabindex="5" type="number" min="0" step="1000">
<mat-error *ngIf="!node_capacity">Node capacity is required.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="34">
<input matInput placeholder="Channel Count" name="channel_count" [(ngModel)]="channel_count" (keyup)="onFilter()" type="number" step="1" min="0" tabindex="6">
</mat-form-field>
</div>
</form> -->
<div fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign.gt-xs="start center" fxLayoutAlign="start stretch" class="page-sub-title-container mt-2">
<div fxFlex="70">
<fa-icon [icon]="faUsers" class="page-title-img mr-1"></fa-icon>
<span class="page-title">Liquidity Providing Peers</span>
</div>
<div fxFlex.gt-xs="30" fxLayoutAlign.gt-xs="space-between center" fxLayout="row" fxLayoutAlign="space-between stretch">
<mat-form-field fxFlex="49">
<mat-select placeholder="Filter By" tabindex="1" [(ngModel)]="selFilterBy" (selectionChange)="selFilter=''; applyFilter()" name="filterBy">
<mat-option *ngFor="let column of ['all'].concat(displayedColumns.slice(0, -1))" [value]="column">{{getLabel(column)}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="49">
<input matInput [(ngModel)]="selFilter" (input)="applyFilter()" (keyup)="applyFilter()" name="filter" placeholder="Filter">
</mat-form-field>
</div>
</div>
<div [perfectScrollbar] fxLayout="column" fxFlex="100" class="table-container">
<mat-progress-bar *ngIf="apiCallStatus.status === apiCallStatusEnum.INITIATED" mode="indeterminate"></mat-progress-bar>
<table mat-table #table [dataSource]="liquidityNodes" matSort [ngClass]="{'error-border': errorMessage !== ''}">
<ng-container matColumnDef="alias">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Alias</th>
<td mat-cell *matCellDef="let lqNode">
<div class="ellipsis-parent" [ngStyle]="{'width': (screenSize === screenSizeEnum.XS) ? '10rem' : colWidth}">
<span fxLayout="row" fxLayoutAlign="start center" class="ellipsis-child">
{{lqNode?.alias}}
<mat-chip-list class="ml-half" aria-label="Address Types">
<mat-chip *ngFor="let addrType of lqNode.address_types" color="primary" selected>
{{addrType === 'tor' ? 'Tor' : addrType === 'ipv' ? 'Clearnet' : addrType}}
</mat-chip>
</mat-chip-list>
</span>
</div>
</td>
</ng-container>
<ng-container matColumnDef="nodeid">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Node ID</th>
<td mat-cell *matCellDef="let lqNode">
<div class="ellipsis-parent" [ngStyle]="{'width': (screenSize === screenSizeEnum.XS) ? '10rem' : colWidth}">
<span class="ellipsis-child">{{lqNode?.nodeid}}</span>
</div>
</td>
</ng-container>
<ng-container matColumnDef="last_timestamp">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last Announcement At</th>
<td mat-cell *matCellDef="let lqNode">{{((lqNode?.last_timestamp * 1000) | date:'dd/MMM/y HH:mm') || '-'}}</td>
</ng-container>
<ng-container matColumnDef="compact_lease">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Compact Lease</th>
<td mat-cell *matCellDef="let lqNode">{{ lqNode?.option_will_fund?.compact_lease }}</td>
</ng-container>
<!-- <ng-container matColumnDef="capacity_channels">
<th mat-header-cell *matHeaderCellDef> Capacity/Channels</th>
<td mat-cell *matCellDef="let lqNode">
{{lqNode?.node_capacity/100000000 | number:'1.0-2'}} BTC / {{lqNode?.channel_count | number:'1.0-0'}}
</td>
</ng-container> -->
<ng-container matColumnDef="lease_fee">
<th mat-header-cell *matHeaderCellDef> Lease Fee</th>
<td mat-cell *matCellDef="let lqNode">
{{lqNode?.option_will_fund?.lease_fee_base_msat/1000 | number:'1.0-0'}} Sats + {{(lqNode?.option_will_fund?.lease_fee_basis/100) | number:'1.2-2'}}%
</td>
</ng-container>
<ng-container matColumnDef="routing_fee">
<th mat-header-cell *matHeaderCellDef> Routing Fee</th>
<td mat-cell *matCellDef="let lqNode">
{{lqNode?.option_will_fund?.channel_fee_max_base_msat/1000 | number:'1.0-0'}} Sats + {{lqNode?.option_will_fund?.channel_fee_max_proportional_thousandths * 1000 | number:'1.0-0'}} ppm
</td>
</ng-container>
<ng-container matColumnDef="channel_opening_fee">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before">Channel Opening Fee (Sats)</th>
<td mat-cell *matCellDef="let lqNode">
<span fxLayoutAlign="end center">
{{lqNode.channel_opening_fee | number:'1.0-0'}}
</span>
</td>
</ng-container>
<ng-container matColumnDef="funding_weight">
<th mat-header-cell *matHeaderCellDef mat-sort-header arrowPosition="before">Funding Weight</th>
<td mat-cell *matCellDef="let lqNode">
<span fxLayoutAlign="end center">
{{lqNode?.option_will_fund?.funding_weight | number:'1.0-0'}}
</span>
</td>
</ng-container>
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef>
<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)="onDownloadCSV()">Download CSV</mat-option>
</mat-select>
</div>
</th>
<td mat-cell *matCellDef="let lqNode" fxLayoutAlign="end center">
<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)="onViewLeaseInfo(lqNode)">View Info</mat-option>
<mat-option (click)="onOpenChannel(lqNode)">Open Channel</mat-option>
<mat-option (click)="viewLeaseOn(lqNode, 'LN')">View on Lnrouter</mat-option>
<mat-option (click)="viewLeaseOn(lqNode, 'AM')">View on Amboss</mat-option>
</mat-select>
</div>
</td>
</ng-container>
<ng-container matColumnDef="no_lqNode">
<td mat-footer-cell *matFooterCellDef colspan="4">
<p *ngIf="(!liquidityNodes?.data || liquidityNodes?.data?.length<1) && apiCallStatus.status === apiCallStatusEnum.COMPLETED">No node with liquidity.</p>
<p *ngIf="(!liquidityNodes?.data || liquidityNodes?.data?.length<1) && apiCallStatus.status === apiCallStatusEnum.INITIATED">Getting nodes with liquidity...</p>
<p *ngIf="(!liquidityNodes?.data || liquidityNodes?.data?.length<1) && apiCallStatus.status === apiCallStatusEnum.ERROR">{{errorMessage}}</p>
</td>
</ng-container>
<tr mat-footer-row *matFooterRowDef="['no_lqNode']" [ngClass]="{'display-none': liquidityNodes?.data && liquidityNodes?.data?.length>0}"></tr>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<mat-paginator [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions" [showFirstLastButtons]="screenSize === screenSizeEnum.XS ? false : true" class="mb-1"></mat-paginator>
</div>
</mat-card-content>
</mat-card>
</div>