Rebalance Fee Limit

Rebalance Fee Limit
pull/266/head
Shahana Farooqui 4 years ago
parent 2aca390f43
commit dfd18ad00e

@ -12,5 +12,5 @@
<link rel="stylesheet" href="styles.23454e9b918d9205be46.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.ca35635f4650e0b0d1dd.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.4085c5e71c7e96383c54.js" defer></script></body>
<script src="runtime.ca35635f4650e0b0d1dd.js" defer></script><script src="polyfills-es5.37b2eeccc22c1df73ce7.js" nomodule defer></script><script src="polyfills.f1c3d2a0bcdfc4e93ca8.js" defer></script><script src="main.2ae66b0e43879c92baaa.js" defer></script></body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -681,7 +681,7 @@ export class LNDEffects implements OnDestroy {
} else {
let msg = 'Payment Sent Successfully.';
if(sendRes.payment_route && sendRes.payment_route.total_fees_msat) {
msg = 'Payment sent successfully with the total fee (mSat) ' + sendRes.payment_route.total_fees_msat + '.';
msg = 'Payment sent successfully with the total fee ' + sendRes.payment_route.total_fees_msat + ' (mSats).';
}
this.store.dispatch(new RTLActions.OpenSnackBar(msg));
this.store.dispatch(new RTLActions.FetchAllChannels());

@ -23,17 +23,15 @@
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="15" fxLayoutAlign="start end">
<mat-select tabindex="3" [(value)]="selFeeLimitType" Placeholder="Fee Limits">
<mat-select tabindex="3" [(value)]="selFeeLimitType" Placeholder="Fee Limits" required>
<mat-option *ngFor="let feeLimitType of feeLimitTypes" [value]="feeLimitType">
{{feeLimitType.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="20">
<input matInput [(ngModel)]="feeLimit" [placeholder]="selFeeLimitType.placeholder" type="number" name="feeLimit"
step="1" min="0" required tabindex="4" #feeLmt="ngModel" [disabled]="selFeeLimitType === feeLimitTypes[0]">
<mat-error *ngIf="selFeeLimitType !== feeLimitTypes[0] && !feeLimit">{{selFeeLimitType.placeholder}} is
required.</mat-error>
<input matInput [(ngModel)]="feeLimit" [placeholder]="selFeeLimitType.placeholder" type="number" name="feeLimit" step="1" min="0" required tabindex="4" #feeLmt="ngModel">
<mat-error *ngIf="!feeLimit">{{selFeeLimitType.placeholder}} is required.</mat-error>
</mat-form-field>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="end center" fxFlex="100">

@ -1,4 +1,4 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { Component, OnInit, Inject, OnDestroy, ViewChild } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { Subject } from 'rxjs';
import { takeUntil, filter } from 'rxjs/operators';
@ -19,19 +19,19 @@ import * as RTLActions from '../../../../store/rtl.actions';
styleUrls: ['./channel-rebalance.component.scss']
})
export class ChannelRebalanceComponent implements OnInit, OnDestroy {
@ViewChild('form', { static: false }) form: any;
public selChannel: Channel = {};
public rebalanceAmount = 0;
public rebalanceAmount = null;
public selRebalancePeer: Channel = {};
public activeChannels = [];
public feeLimit = null;
public selFeeLimitType = FEE_LIMIT_TYPES[0];
public feeLimitTypes = FEE_LIMIT_TYPES;
public selFeeLimitType = FEE_LIMIT_TYPES[1];
public feeLimitTypes = FEE_LIMIT_TYPES.splice(1);
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<ChannelRebalanceComponent>, @Inject(MAT_DIALOG_DATA) public data: ChannelRebalanceInformation, private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) { }
ngOnInit() {
console.warn(this.data);
this.selChannel = this.data.channel;
this.store.select('lnd')
.pipe(takeUntil(this.unSubs[0]))
@ -42,6 +42,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
}
onRebalance() {
if (!this.rebalanceAmount || this.rebalanceAmount <= 0 || this.rebalanceAmount > this.selChannel.local_balance || !this.feeLimit || !this.selRebalancePeer) { return true; }
this.store.dispatch(new RTLActions.OpenSpinner('Creating Invoice to Rebalance...'));
this.store.dispatch(new RTLActions.SaveNewInvoice({
memo: 'Local-Rebalance-' + this.rebalanceAmount + '-Sats', invoiceValue: this.rebalanceAmount, private: false, expiry: 3600, pageSize: PAGE_SIZE, openModal: false
@ -61,9 +62,9 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
}
resetData() {
this.rebalanceAmount = 0;
this.feeLimit = null;
this.selFeeLimitType = FEE_LIMIT_TYPES[0];
this.form.resetForm();
this.selFeeLimitType = this.feeLimitTypes[0];
this.selRebalancePeer = null;
}
onClose() {

Loading…
Cancel
Save