Local Rebalance

Local Rebalance
pull/266/head
Shahana Farooqui 4 years ago
parent 4390b85e02
commit 2aca390f43

@ -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.f7c06745bf334a7d04f3.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.4085c5e71c7e96383c54.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

@ -160,7 +160,7 @@ exports.postTransactions = (req, res, next) => {
if (req.body.feeLimit) { options.form.fee_limit = req.body.feeLimit; }
if (req.body.outgoingChannel) { options.form.outgoing_chan_id = req.body.outgoingChannel; }
if (req.body.allowSelfPayment) { options.form.allow_self_payment = req.body.allowSelfPayment; }
if (req.body.lastHopPubkey) { options.form.last_hop_pubkey = req.body.lastHopPubkey; }
if (req.body.lastHopPubkey) { options.form.last_hop_pubkey = Buffer.from(req.body.lastHopPubkey, 'hex').toString('base64'); }
options.form = JSON.stringify(options.form);
logger.info({fileName: 'Channels', msg: 'Send Payment Options: ' + options.form});
request.post(options).then((body) => {

@ -16,7 +16,7 @@ import { GetInfo, GetInfoChain, Fees, Balance, NetworkInfo, Payment, GraphNode,
import { InvoiceInformationComponent } from '../../shared/components/data-modal/invoice-information-lnd/invoice-information.component';
import { OpenChannelComponent } from '../../shared/components/data-modal/open-channel-lnd/open-channel.component';
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CurrencyUnitEnum, AlertTypeEnum, FEE_LIMIT_TYPES } from '../../shared/services/consts-enums-functions';
import { CurrencyUnitEnum, AlertTypeEnum, FEE_LIMIT_TYPES, PAGE_SIZE } from '../../shared/services/consts-enums-functions';
import * as RTLActions from '../../store/rtl.actions';
import * as fromRTLReducer from '../../store/rtl.reducers';
@ -687,6 +687,9 @@ export class LNDEffects implements OnDestroy {
this.store.dispatch(new RTLActions.FetchAllChannels());
this.store.dispatch(new RTLActions.FetchBalance('channels'));
this.store.dispatch(new RTLActions.FetchPayments());
if (action.payload.allowSelfPayment) {
this.store.dispatch(new RTLActions.FetchInvoices({ num_max_invoices: PAGE_SIZE, reversed: true }));
}
return {
type: RTLActions.SET_DECODED_PAYMENT,
payload: {}

@ -39,11 +39,11 @@
</div>
</div>
<div fxLayout="row" fxLayoutAlign="end center">
<button *ngIf="(!showQRField || showQRField == '') && (showCopyName === '')" fxFlex="20" fxLayoutAlign="center center" tabindex="1" autoFocus mat-flat-button color="primary" type="submit" [mat-dialog-close]="false" default>OK</button>
<button *ngIf="showCopyName !== ''" fxFlex="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showCopyName !== ''" fxFlex="30" fxLayoutAlign="center center" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showCopyField" (copied)="onCopyField($event)">Copy {{showCopyName}}</button>
<button *ngIf="showQRField !== ''" fxFlex="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" class="mr-2" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showQRField !== ''" fxFlex="30" fxLayoutAlign="center center" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showQRField" (copied)="onCopyField($event)">Copy {{showQRName}}</button>
<button *ngIf="(!showQRField || showQRField == '') && (showCopyName === '')" fxFlex="30" fxFlex.gt-sm="20" fxLayoutAlign="center center" tabindex="1" autoFocus mat-flat-button color="primary" type="submit" [mat-dialog-close]="false" default>OK</button>
<button *ngIf="showCopyName !== ''" fxFlex="30" fxFlex.gt-sm="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showCopyName !== ''" fxFlex="30" fxFlex.gt-sm="30" fxLayoutAlign="center center" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showCopyField" (copied)="onCopyField($event)">Copy {{showCopyName}}</button>
<button *ngIf="showQRField !== ''" fxFlex="30" fxFlex.gt-sm="20" class="mr-2" fxLayoutAlign="center center" tabindex="1" class="mr-2" mat-stroked-button color="primary" type="button" [mat-dialog-close]="false" default>Close</button>
<button *ngIf="showQRField !== ''" fxFlex="30" fxFlex.gt-sm="30" fxLayoutAlign="center center" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="showQRField" (copied)="onCopyField($event)">Copy {{showQRName}}</button>
</div>
</div>
</mat-card-content>

@ -2,28 +2,28 @@
<div fxFlex="100" class="padding-gap-large">
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
<div fxFlex="95" fxLayoutAlign="start start"><span class="page-title">Channel Rebalance</span></div>
<button tabindex="8" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
<button tabindex="7" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
</mat-card-header>
<mat-card-content class="mt-5px">
<p fxLayoutAlign="start center" class="pb-1">Rebalancing for Channel: {{selChannel.chan_id}}</p>
<form fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" #form="ngForm">
<div fxLayout="row" fxFlex="100" fxLayoutAlign="space-between stretch">
<form fxLayout="column" fxLayout.gt-sm="row wrap" fxLayoutAlign="space-between stretch" #form="ngForm">
<div fxLayout="column" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign="space-between stretch">
<mat-form-field fxFlex="30">
<input matInput [(ngModel)]="rebalanceAmount" (change)="filterActiveChannels()" placeholder="Amount" type="number" step="100" min="1" tabindex="1" required name="amount" #amount="ngModel" max="{{selChannel?.local_balance}}">
<input autoFocus matInput [(ngModel)]="rebalanceAmount" (change)="filterActiveChannels()" placeholder="Amount" type="number" step="100" min="1" tabindex="1" required name="amount" #amount="ngModel" max="{{selChannel?.local_balance}}">
<mat-hint>(Local Bal: {{selChannel?.local_balance}}, Remaining: {{selChannel?.local_balance - ((rebalanceAmount) ? rebalanceAmount : 0)}})</mat-hint>
<span matSuffix>Sats</span>
<mat-error *ngIf="!rebalanceAmount">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.max">Amount must be less than or equal to {{selChannel?.local_balance}}.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="30" fxLayoutAlign="start end">
<mat-select tabindex="7" [(value)]="selRebalancePeer" placeholder="Rebalancing Channel">
<mat-select tabindex="2" [(value)]="selRebalancePeer" placeholder="Rebalancing Channel">
<mat-option *ngFor="let activeChannel of activeChannels" [value]="activeChannel">
{{activeChannel.remote_alias || activeChannel.chan_id}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="15" fxLayoutAlign="start end">
<mat-select tabindex="5" [(value)]="selFeeLimitType" Placeholder="Fee Limits">
<mat-select tabindex="3" [(value)]="selFeeLimitType" Placeholder="Fee Limits">
<mat-option *ngFor="let feeLimitType of feeLimitTypes" [value]="feeLimitType">
{{feeLimitType.name}}
</mat-option>
@ -31,16 +31,14 @@
</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="6" #feeLmt="ngModel" [disabled]="selFeeLimitType === feeLimitTypes[0]">
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>
</mat-form-field>
</div>
<div class="mt-2" fxLayout="row" fxLayoutAlign="end center" fxFlex="100">
<div fxLayout="row" fxLayoutAlign="space-between stretch" fxFlex="30">
<button fxFlex="48" fxLayoutAlign="center center" mat-stroked-button color="primary" tabindex="8" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxLayoutAlign="center center" mat-flat-button color="primary" (click)="onRebalance()" tabindex="9">Rebalance</button>
</div>
<button fxFlex="48" fxFlex.gt-sm="20" fxLayoutAlign="center center" mat-stroked-button class="mr-2" color="primary" tabindex="5" type="reset" (click)="resetData()">Clear Field</button>
<button fxFlex="48" fxFlex.gt-sm="20" fxLayoutAlign="center center" mat-flat-button color="primary" (click)="onRebalance()" tabindex="6">Rebalance</button>
</div>
</form>
</mat-card-content>

@ -20,7 +20,7 @@ import * as RTLActions from '../../../../store/rtl.actions';
})
export class ChannelRebalanceComponent implements OnInit, OnDestroy {
public selChannel: Channel = {};
public rebalanceAmount = 100;
public rebalanceAmount = 0;
public selRebalancePeer: Channel = {};
public activeChannels = [];
public feeLimit = null;
@ -61,7 +61,7 @@ export class ChannelRebalanceComponent implements OnInit, OnDestroy {
}
resetData() {
this.rebalanceAmount = 100;
this.rebalanceAmount = 0;
this.feeLimit = null;
this.selFeeLimitType = FEE_LIMIT_TYPES[0];
}

@ -37,9 +37,9 @@
</div>
</div>
<div fxLayout="row" fxLayoutAlign="end center">
<button autoFocus mat-stroked-button color="primary" fxFlex="20" type="reset" fxLayoutAlign="center center" class="mr-2" (click)="onClose(false)" tabindex="2" default>{{noBtnText}}</button>
<button *ngIf="flgShowInput" mat-flat-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="submit" tabindex="3" (click)="onClose(getInputs)">{{yesBtnText}}</button>
<button *ngIf="!flgShowInput" mat-flat-button color="primary" fxLayoutAlign="center center" fxFlex="25" type="submit" tabindex="4" (click)="onClose(true)">{{yesBtnText}}</button>
<button autoFocus mat-stroked-button color="primary" fxFlex="48" fxFlex.gt-sm="20" type="reset" fxLayoutAlign="center center" class="mr-2" (click)="onClose(false)" tabindex="2" default>{{noBtnText}}</button>
<button *ngIf="flgShowInput" mat-flat-button color="primary" fxLayoutAlign="center center" fxFlex="48" fxFlex.gt-sm="25" type="submit" tabindex="3" (click)="onClose(getInputs)">{{yesBtnText}}</button>
<button *ngIf="!flgShowInput" mat-flat-button color="primary" fxLayoutAlign="center center" fxFlex="48" fxFlex.gt-sm="25" type="submit" tabindex="4" (click)="onClose(true)">{{yesBtnText}}</button>
</div>
</form>
</mat-card-content>

Loading…
Cancel
Save