mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 09:50:36 +01:00
Home Fee Rates
Home Fee Rates
This commit is contained in:
parent
4003ea0805
commit
c671f9d751
File diff suppressed because one or more lines are too long
1
angular/6.411079f3303825bbd77e.js
Normal file
1
angular/6.411079f3303825bbd77e.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -9,5 +9,5 @@
|
||||
<link rel="stylesheet" href="styles.13a9674cdbdfd014a4cf.css"></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script src="runtime.1a88617b9203e8425f30.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.e4a9c079a5c8979cc8a1.js"></script></body>
|
||||
<script src="runtime.3096ec57d9439bc5d703.js"></script><script src="polyfills-es5.763f4f23e8aee5ec234d.js" nomodule></script><script src="polyfills.e59b6f9dc696bd89cf7f.js"></script><script src="main.264978b883129045db62.js"></script></body>
|
||||
</html>
|
||||
|
1
angular/main.264978b883129045db62.js
Normal file
1
angular/main.264978b883129045db62.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],f=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"5d20dbfb50eaa379bb80",6:"3d0de3786487442c9432",7:"3d047437a6897df1a06b"}[e]+".js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(f);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var f=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var f=0;f<i.length;f++)r(i[f]);var l=c;t()}([]);
|
||||
!function(e){function r(r){for(var n,a,i=r[0],f=r[1],c=r[2],p=0,s=[];p<i.length;p++)o[a=i[p]]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(l&&l(r);s.length;)s.shift()();return u.push.apply(u,c||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++)0!==o[t[i]]&&(n=!1);n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={0:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({}[e]||e)+"."+{1:"5d20dbfb50eaa379bb80",6:"411079f3303825bbd77e",7:"a75ff00ea1e0f0d0a1c8"}[e]+".js"}(e);var f=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(c);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",f.name="ChunkLoadError",f.type=n,f.request=u,t[1](f)}o[e]=void 0}};var c=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,(function(r){return e[r]}).bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackJsonp=window.webpackJsonp||[],f=i.push.bind(i);i.push=r,i=i.slice();for(var c=0;c<i.length;c++)r(i[c]);var l=f;t()}([]);
|
@ -59,15 +59,13 @@ exports.listChannel = (req, res, next) => {
|
||||
|
||||
exports.feeRates = (req, res, next) => {
|
||||
options = common.getOptions();
|
||||
options.url = common.getSelLNServerUrl() + '/peer/listPeers';
|
||||
options.url = common.getSelLNServerUrl() + '/network/feeRates/' + req.params.feeRateStyle;
|
||||
request(options).then(function (body) {
|
||||
let peers = (undefined !== body) ? common.sortDescByKey(body, 'alias') : [];
|
||||
logger.info({fileName: 'Peers', msg: 'Peers with Alias: ' + JSON.stringify(peers)});
|
||||
res.status(200).json(peers);
|
||||
res.status(200).json(body);
|
||||
})
|
||||
.catch((err) => {
|
||||
return res.status(500).json({
|
||||
message: "Peers Fetch Failed!",
|
||||
message: "Fee Rates Failed!",
|
||||
error: err.error
|
||||
});
|
||||
});
|
||||
|
@ -6,6 +6,6 @@ const authCheck = require("../authCheck");
|
||||
router.get("/getRoute/:destPubkey/:amount", authCheck, NetworkController.getRoute);
|
||||
router.get("/listNode/:id", authCheck, NetworkController.listNode);
|
||||
router.get("/listChannel/:channelShortId", authCheck, NetworkController.listChannel);
|
||||
router.get("/feeRates", authCheck, NetworkController.feeRates);
|
||||
router.get("/feeRates/:feeRateStyle", authCheck, NetworkController.feeRates);
|
||||
|
||||
module.exports = router;
|
||||
|
@ -33,6 +33,8 @@ export class CLRootComponent implements OnInit, OnDestroy {
|
||||
this.store.dispatch(new RTLActions.FetchFeesCL());
|
||||
this.store.dispatch(new RTLActions.FetchBalanceCL());
|
||||
this.store.dispatch(new RTLActions.FetchLocalRemoteBalanceCL());
|
||||
this.store.dispatch(new RTLActions.FetchFeeRatesCL('perkw'));
|
||||
this.store.dispatch(new RTLActions.FetchFeeRatesCL('perkb'));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -6,6 +6,7 @@ import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import { CLRootComponent } from './cl-root.component';
|
||||
import { CLHomeComponent } from './home/home.component';
|
||||
import { CLFeeRatesComponent } from './home/fee-rates/fee-rates.component';
|
||||
import { CLChannelsComponent } from './channels/channels.component';
|
||||
import { CLInvoicesComponent } from './invoices/invoices.component';
|
||||
import { CLLookupsComponent } from './lookups/lookups.component';
|
||||
@ -39,7 +40,8 @@ import { CLUnlockedGuard } from '../shared/services/auth.guard';
|
||||
CLQueryRoutesComponent,
|
||||
CLPaymentsComponent,
|
||||
CLPeersComponent,
|
||||
CLForwardingHistoryComponent
|
||||
CLForwardingHistoryComponent,
|
||||
CLFeeRatesComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: LoggerService, useClass: ConsoleLoggerService },
|
||||
|
69
src/app/clightning/home/fee-rates/fee-rates.component.html
Normal file
69
src/app/clightning/home/fee-rates/fee-rates.component.html
Normal file
@ -0,0 +1,69 @@
|
||||
<mat-card [ngClass]="{'custom-card error-border': flgLoading==='error','custom-card': true}">
|
||||
<mat-card-header class="bg-primary" fxLayoutAlign="center center">
|
||||
<mat-card-title class="m-0 pt-2">
|
||||
<h5>Per {{feeRateStyle}} Fee Rates</h5>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div fxLayout="column" class="pl-4">
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Urgent</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{perkbw?.urgent}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Normal</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{perkbw?.normal}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Slow</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{perkbw?.slow}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Min Acceptable</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{perkbw?.min_acceptable}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Max Acceptable</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{perkbw?.max_acceptable}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Opening Channel</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{feeRates?.onchain_fee_estimates?.opening_channel_satoshis}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Mutual Close</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{feeRates?.onchain_fee_estimates?.mutual_close_satoshis}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
<mat-list class="fee-rate-list" fxFlex="100" fxLayoutAlign="start start">
|
||||
<mat-list-item fxFlex="55" fxLayoutAlign="start start">Unilateral Close</mat-list-item>
|
||||
<mat-list-item fxFlex="25" fxLayoutAlign="start start">
|
||||
<p class="mat-button-text">{{feeRates?.onchain_fee_estimates?.unilateral_close_satoshis}}</p>
|
||||
</mat-list-item>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
</div>
|
||||
<mat-progress-bar *ngIf="flgLoading===true" mode="indeterminate" class="mt-minus-5"></mat-progress-bar>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
@ -0,0 +1,3 @@
|
||||
.fee-rate-list .mat-list-item {
|
||||
height: 44px;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FeeRatesComponent } from './fee-rates.component';
|
||||
|
||||
describe('FeeRatesComponent', () => {
|
||||
let component: FeeRatesComponent;
|
||||
let fixture: ComponentFixture<FeeRatesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FeeRatesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FeeRatesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
28
src/app/clightning/home/fee-rates/fee-rates.component.ts
Normal file
28
src/app/clightning/home/fee-rates/fee-rates.component.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Component, AfterContentChecked, Input } from '@angular/core';
|
||||
|
||||
import { FeeRatesCL, FeeRatePerObj, feeRateStyle } from '../../../shared/models/clModels';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cl-fee-rates',
|
||||
templateUrl: './fee-rates.component.html',
|
||||
styleUrls: ['./fee-rates.component.scss']
|
||||
})
|
||||
export class CLFeeRatesComponent implements AfterContentChecked {
|
||||
@Input() feeRateStyle: string;
|
||||
@Input() feeRates: FeeRatesCL;
|
||||
@Input() flgLoading: Boolean | 'error';
|
||||
perkbw: FeeRatePerObj = {};
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
ngAfterContentChecked() {
|
||||
if (this.feeRateStyle === feeRateStyle.KB) {
|
||||
this.perkbw = this.feeRates.perkb;
|
||||
} else if (this.feeRateStyle === feeRateStyle.KW) {
|
||||
this.perkbw = this.feeRates.perkw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -115,15 +115,20 @@
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list>
|
||||
</div>
|
||||
<mat-progress-bar *ngIf="flgLoading[6]===true" mode="indeterminate" class="mt-minus-5"></mat-progress-bar>
|
||||
<mat-progress-bar *ngIf="flgLoading[0]===true" mode="indeterminate" class="mt-minus-5"></mat-progress-bar>
|
||||
<mat-divider></mat-divider>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="column" fxLayout.gt-sm="row wrap">
|
||||
<div fxFlex="25" class="padding-gap"></div>
|
||||
<div fxFlex="50" class="padding-gap">
|
||||
<div fxFlex="20" class="padding-gap">
|
||||
<rtl-cl-fee-rates [flgLoading]="flgLoading[4]" [feeRates]="feeRatesPerKB" [feeRateStyle]="'KB'"></rtl-cl-fee-rates>
|
||||
</div>
|
||||
<div fxFlex="20" class="padding-gap">
|
||||
<rtl-cl-fee-rates [flgLoading]="flgLoading[4]" [feeRates]="feeRatesPerKW" [feeRateStyle]="'KW'"></rtl-cl-fee-rates>
|
||||
</div>
|
||||
<div fxFlex="60" class="padding-gap">
|
||||
<mat-card [ngClass]="{'custom-card error-border': flgLoading[3]==='error','custom-card': true}">
|
||||
<mat-card-header class="bg-primary" fxLayoutAlign="center center">
|
||||
<mat-card-title class="m-0 pt-2">
|
||||
|
@ -4,7 +4,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL } from '../../shared/models/clModels';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, FeeRatesCL } from '../../shared/models/clModels';
|
||||
import { SelNodeChild } from '../../shared/models/RTLconfig';
|
||||
|
||||
import * as fromRTLReducer from '../../store/rtl.reducers';
|
||||
@ -20,7 +20,8 @@ export class CLHomeComponent implements OnInit, OnDestroy {
|
||||
public information: GetInfoCL = {};
|
||||
public totalBalance: BalanceCL = {};
|
||||
public lrBalance: LocalRemoteBalanceCL = {};
|
||||
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true];
|
||||
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true];
|
||||
|
||||
private unsub: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
|
||||
public position = 'below';
|
||||
barPadding = 0;
|
||||
@ -30,6 +31,8 @@ export class CLHomeComponent implements OnInit, OnDestroy {
|
||||
view = [];
|
||||
yAxisLabel = 'Balance';
|
||||
colorScheme = {domain: ['#FF0000']};
|
||||
feeRatesPerKB: FeeRatesCL = {};
|
||||
feeRatesPerKW: FeeRatesCL = {};
|
||||
|
||||
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>) {
|
||||
switch (true) {
|
||||
@ -70,9 +73,13 @@ export class CLHomeComponent implements OnInit, OnDestroy {
|
||||
if (effectsErr.action === 'FetchLocalRemoteBalanceCL') {
|
||||
this.flgLoading[3] = 'error';
|
||||
}
|
||||
if (effectsErr.action === 'FetchFeeRatesCL') {
|
||||
this.flgLoading[4] = 'error';
|
||||
}
|
||||
});
|
||||
this.selNode = rtlStore.nodeSettings;
|
||||
this.information = rtlStore.information
|
||||
|
||||
if (this.flgLoading[0] !== 'error') {
|
||||
this.flgLoading[0] = (undefined !== this.information.id) ? false : true;
|
||||
}
|
||||
@ -94,6 +101,12 @@ export class CLHomeComponent implements OnInit, OnDestroy {
|
||||
this.flgLoading[3] = ('' !== this.lrBalance) ? false : true;
|
||||
}
|
||||
|
||||
this.feeRatesPerKB = rtlStore.feeRatesPerKB;
|
||||
this.feeRatesPerKW = rtlStore.feeRatesPerKW;
|
||||
if (this.flgLoading[4] !== 'error') {
|
||||
this.flgLoading[4] = (undefined !== this.feeRatesPerKB && undefined !== this.feeRatesPerKW) ? false : true;
|
||||
}
|
||||
|
||||
this.logger.info(rtlStore);
|
||||
});
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { map, mergeMap, catchError, withLatestFrom } from 'rxjs/operators';
|
||||
|
||||
import { environment, API_URL } from '../../../environments/environment';
|
||||
import { LoggerService } from '../../shared/services/logger.service';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, PaymentCL } from '../../shared/models/clModels';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, PaymentCL, FeeRatesCL } from '../../shared/models/clModels';
|
||||
|
||||
import * as fromRTLReducer from '../../store/rtl.reducers';
|
||||
import * as RTLActions from '../../store/rtl.actions';
|
||||
@ -90,6 +90,25 @@ export class CLEffects implements OnDestroy {
|
||||
}
|
||||
));
|
||||
|
||||
@Effect()
|
||||
fetchFeeRatesCL = this.actions$.pipe(
|
||||
ofType(RTLActions.FETCH_FEE_RATES_CL),
|
||||
mergeMap((action: RTLActions.FetchFeeRatesCL) => {
|
||||
this.store.dispatch(new RTLActions.ClearEffectErrorCl('FetchFeeRatesCL'));
|
||||
return this.httpClient.get<FeeRatesCL>(this.CHILD_API_URL + environment.NETWORK_API + '/feeRates/' + action.payload);
|
||||
}),
|
||||
map((feeRates) => {
|
||||
this.logger.info(feeRates);
|
||||
return {
|
||||
type: RTLActions.SET_FEE_RATES_CL,
|
||||
payload: (undefined !== feeRates) ? feeRates : {}
|
||||
};
|
||||
}),
|
||||
catchError((err: any) => {
|
||||
return this.handleErrorWithoutAlert('FetchFeeRatesCL', err);
|
||||
}
|
||||
));
|
||||
|
||||
@Effect()
|
||||
fetchBalanceCL = this.actions$.pipe(
|
||||
ofType(RTLActions.FETCH_BALANCE_CL),
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SelNodeChild } from '../../shared/models/RTLconfig';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, AddressTypeCL, PeerCL, PaymentCL, ChannelCL } from '../../shared/models/clModels';
|
||||
import { GetInfoCL, FeesCL, BalanceCL, LocalRemoteBalanceCL, AddressTypeCL, PeerCL, PaymentCL, ChannelCL, FeeRatesCL } from '../../shared/models/clModels';
|
||||
import { ErrorPayload } from '../../shared/models/errorPayload';
|
||||
import * as RTLActions from '../../store/rtl.actions';
|
||||
|
||||
@ -8,6 +8,8 @@ export interface CLState {
|
||||
nodeSettings: SelNodeChild;
|
||||
information: GetInfoCL;
|
||||
fees: FeesCL;
|
||||
feeRatesPerKB: FeeRatesCL;
|
||||
feeRatesPerKW: FeeRatesCL;
|
||||
balance: BalanceCL;
|
||||
localRemoteBalance: LocalRemoteBalanceCL;
|
||||
peers: PeerCL[];
|
||||
@ -21,6 +23,8 @@ export const initCLState: CLState = {
|
||||
nodeSettings: { channelBackupPath: '', satsToBTC: false },
|
||||
information: {},
|
||||
fees: {},
|
||||
feeRatesPerKB: {},
|
||||
feeRatesPerKW: {},
|
||||
balance: {},
|
||||
localRemoteBalance: {},
|
||||
peers: [],
|
||||
@ -66,6 +70,22 @@ export function CLReducer(state = initCLState, action: RTLActions.RTLActions) {
|
||||
...state,
|
||||
fees: action.payload
|
||||
};
|
||||
case RTLActions.SET_FEE_RATES_CL:
|
||||
if(action.payload.perkb) {
|
||||
return {
|
||||
...state,
|
||||
feeRatesPerKB: action.payload
|
||||
};
|
||||
} else if (action.payload.perkw) {
|
||||
return {
|
||||
...state,
|
||||
feeRatesPerKW: action.payload
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
...state
|
||||
}
|
||||
}
|
||||
case RTLActions.SET_BALANCE_CL:
|
||||
return {
|
||||
...state,
|
||||
|
@ -1,3 +1,8 @@
|
||||
export enum feeRateStyle {
|
||||
KB = 'KB',
|
||||
KW = 'KW'
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
type?: string;
|
||||
address?: string;
|
||||
@ -208,3 +213,21 @@ export interface LookupNodeCL {
|
||||
global_features?: string;
|
||||
addresses?: Address[];
|
||||
}
|
||||
|
||||
export interface FeeRatesCL {
|
||||
perkb?: FeeRatePerObj,
|
||||
perkw?: FeeRatePerObj,
|
||||
onchain_fee_estimates?: {
|
||||
opening_channel_satoshis?: number;
|
||||
mutual_close_satoshis?: number;
|
||||
unilateral_close_satoshis?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export interface FeeRatePerObj {
|
||||
urgent?: number;
|
||||
normal?: number;
|
||||
slow?: number;
|
||||
min_acceptable?: number;
|
||||
max_acceptable?: number;
|
||||
}
|
@ -3,7 +3,7 @@ import { Action } from '@ngrx/store';
|
||||
|
||||
import { ErrorPayload } from '../shared/models/errorPayload';
|
||||
import { RTLConfiguration, Settings, LightningNode, GetInfoRoot, SelNodeChild } from '../shared/models/RTLconfig';
|
||||
import { GetInfoCL, FeesCL, AddressTypeCL, PeerCL, PaymentCL, PayRequestCL, QueryRoutesCL, ChannelCL } from '../shared/models/clModels';
|
||||
import { GetInfoCL, FeesCL, AddressTypeCL, PeerCL, PaymentCL, PayRequestCL, QueryRoutesCL, ChannelCL, FeeRatesCL } from '../shared/models/clModels';
|
||||
import {
|
||||
GetInfo, Peer, Balance, NetworkInfo, Fees, Channel, Invoice, ListInvoices, Payment, GraphNode, AddressType,
|
||||
PayRequest, ChannelsTransaction, PendingChannels, ClosedChannel, Transaction, SwitchReq, SwitchRes, QueryRoutes
|
||||
@ -102,6 +102,8 @@ export const FETCH_INFO_CL = 'FETCH_INFO_CL';
|
||||
export const SET_INFO_CL = 'SET_INFO_CL';
|
||||
export const FETCH_FEES_CL = 'FETCH_FEES_CL';
|
||||
export const SET_FEES_CL = 'SET_FEES_CL';
|
||||
export const FETCH_FEE_RATES_CL = 'FETCH_FEE_RATES_CL';
|
||||
export const SET_FEE_RATES_CL = 'SET_FEE_RATES_CL';
|
||||
export const FETCH_BALANCE_CL = 'FETCH_BALANCE_CL';
|
||||
export const SET_BALANCE_CL = 'SET_BALANCE_CL';
|
||||
export const FETCH_LOCAL_REMOTE_BALANCE_CL = 'FETCH_LOCAL_REMOTE_BALANCE_CL';
|
||||
@ -564,6 +566,16 @@ export class SetFeesCL implements Action {
|
||||
constructor(public payload: FeesCL) {}
|
||||
}
|
||||
|
||||
export class FetchFeeRatesCL implements Action {
|
||||
readonly type = FETCH_FEE_RATES_CL;
|
||||
constructor(public payload: string) {} //feeRateStyle
|
||||
}
|
||||
|
||||
export class SetFeeRatesCL implements Action {
|
||||
readonly type = SET_FEE_RATES_CL;
|
||||
constructor(public payload: FeeRatesCL) {}
|
||||
}
|
||||
|
||||
export class FetchBalanceCL implements Action {
|
||||
readonly type = FETCH_BALANCE_CL;
|
||||
}
|
||||
@ -727,7 +739,7 @@ export type RTLActions =
|
||||
GenSeed | GenSeedResponse | InitWallet | InitWalletResponse | UnlockWallet |
|
||||
FetchConfig | ShowConfig | PeerLookup | ChannelLookup | InvoiceLookup | SetLookup |
|
||||
IsAuthorized | IsAuthorizedRes | Signin | Signout | InitAppData |
|
||||
FetchInfoCL | SetInfoCL | FetchFeesCL | SetFeesCL |
|
||||
FetchInfoCL | SetInfoCL | FetchFeesCL | SetFeesCL | FetchFeeRatesCL | SetFeeRatesCL |
|
||||
FetchBalanceCL | SetBalanceCL | FetchLocalRemoteBalanceCL | SetLocalRemoteBalanceCL |
|
||||
GetNewAddressCL | SetNewAddressCL |
|
||||
FetchPeersCL | SetPeersCL | AddPeerCL | DetachPeerCL | SaveNewPeerCL | RemovePeerCL |
|
||||
|
Loading…
Reference in New Issue
Block a user