Connect and Fund fixes

clnrest-migration
ShahanaFarooqui 6 months ago
parent d31f1b3c70
commit 88fba97826

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],s=!0,l=0;l<t.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(s=!1,o<a&&(a=o));if(s){e.splice(n--,1);var d=i();void 0!==d&&(f=d)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{125:"e77d478f0dec10a6",456:"16212571f65d0b5f",570:"a719a189ca60c55b",758:"2801e2da6f8bba94"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,s;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==f+o){a=u;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var c=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((u,c)=>n=e[i]=[u,c]);o.push(n[2]=a);var s=r.p+r.u(i),l=new Error;r.l(s,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+c+": "+p+")",l.name="ChunkLoadError",l.type=c,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var l,d,[n,a,s]=o,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(s)var c=s(r)}for(i&&i(o);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();
(()=>{"use strict";var e,v={},m={};function r(e){var f=m[e];if(void 0!==f)return f.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(f,t,i,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,o]=e[n],s=!0,l=0;l<t.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[l]))?t.splice(l--,1):(s=!1,o<a&&(a=o));if(s){e.splice(n--,1);var d=i();void 0!==d&&(f=d)}}return f}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,i,o]},r.d=(e,f)=>{for(var t in f)r.o(f,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:f[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((f,t)=>(r.f[t](e,f),f),[])),r.u=e=>e+"."+{125:"ba49e9cd82f7c7d1",456:"16212571f65d0b5f",570:"a719a189ca60c55b",758:"2801e2da6f8bba94"}[e]+".js",r.miniCssF=e=>{},r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),(()=>{var e={},f="RTLApp:";r.l=(t,i,o,n)=>{if(e[t])e[t].push(i);else{var a,s;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==f+o){a=u;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",f+o),a.src=r.tu(t)),e[t]=[i];var c=(g,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(y=>y(b)),g)return g(b)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=c.bind(null,a.onerror),a.onload=c.bind(null,a.onload),s&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:f=>f},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(i,o)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=i){var a=new Promise((u,c)=>n=e[i]=[u,c]);o.push(n[2]=a);var s=r.p+r.u(i),l=new Error;r.l(s,u=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var c=u&&("load"===u.type?"missing":u.type),p=u&&u.target&&u.target.src;l.message="Loading chunk "+i+" failed.\n("+c+": "+p+")",l.name="ChunkLoadError",l.type=c,l.request=p,n[1](l)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var f=(i,o)=>{var l,d,[n,a,s]=o,u=0;if(n.some(p=>0!==e[p])){for(l in a)r.o(a,l)&&(r.m[l]=a[l]);if(s)var c=s(r)}for(i&&i(o);u<n.length;u++)r.o(e,d=n[u])&&e[d]&&e[d][0](),e[d]=0;return r.O(c)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(f.bind(null,0)),t.push=f.bind(null,t.push.bind(t))})()})();

@ -9,72 +9,72 @@
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Short Channel ID</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.short_channel_id}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.short_channel_id}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Active</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.active ? 'True' : 'False'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.active ? 'True' : 'False'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Last Update</h4>
<span class="foreground-secondary-text">{{(lookupResult[0]?.last_update * 1000) | date:'dd/MMM/y HH:mm'}}</span>
<span class="foreground-secondary-text">{{(lookupResult.channels[0]?.last_update * 1000) | date:'dd/MMM/y HH:mm'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Amount (Sats)</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.amount_msat / 1000 | number:'1.0-0'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.amount_msat / 1000 | number:'1.0-0'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Base Fee (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.base_fee_millisatoshi | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.base_fee_millisatoshi | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Fee/Millionth</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.fee_per_millionth | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.fee_per_millionth | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Channel Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.channel_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.channel_flags | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Delay</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.delay | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.delay | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Max Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.htlc_maximum_msat | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.htlc_maximum_msat | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Min Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.htlc_minimum_msat | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.htlc_minimum_msat | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Message Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.message_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.message_flags | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Public</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.public ? 'Yes' : 'No'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.public ? 'Yes' : 'No'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Source</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.source}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.source}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Destination</h4>
<span class="foreground-secondary-text">{{lookupResult[0]?.destination}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[0]?.destination}}</span>
</div>
</div>
<div fxLayout="column" fxFlex="49" fxLayoutAlign="start stretch" class="mt-1 bordered-box padding-gap-large">
@ -85,72 +85,72 @@
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Short Channel ID</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.short_channel_id}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.short_channel_id}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Active</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.active ? 'True' : 'False'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.active ? 'True' : 'False'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Last Update</h4>
<span class="foreground-secondary-text">{{(lookupResult[1]?.last_update * 1000) | date:'dd/MMM/y HH:mm'}}</span>
<span class="foreground-secondary-text">{{(lookupResult.channels[1]?.last_update * 1000) | date:'dd/MMM/y HH:mm'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Amount (Sats)</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.amount_msat / 1000 | number:'1.0-0'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.amount_msat / 1000 | number:'1.0-0'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Base Fee (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.base_fee_millisatoshi | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.base_fee_millisatoshi | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Fee/Millionth</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.fee_per_millionth | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.fee_per_millionth | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Channel Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.channel_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.channel_flags | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Delay</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.delay | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.delay | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Max Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.htlc_maximum_msat | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.htlc_maximum_msat | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Min Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.htlc_minimum_msat | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.htlc_minimum_msat | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Message Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.message_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.message_flags | number}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Public</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.public ? 'Yes' : 'No'}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.public ? 'Yes' : 'No'}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Source</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.source}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.source}}</span>
</div>
<mat-divider class="my-1" />
<div fxLayout="column">
<h4 class="font-bold-500">Destination</h4>
<span class="foreground-secondary-text">{{lookupResult[1]?.destination}}</span>
<span class="foreground-secondary-text">{{lookupResult.channels[1]?.destination}}</span>
</div>
</div>
</div>

@ -3,7 +3,7 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { ChannelEdge, GetInfo } from '../../../../shared/models/clnModels';
import { GetInfo, ChannelEdge } from '../../../../shared/models/clnModels';
import { RTLState } from '../../../../store/rtl.state';
import { clnNodeInformation } from '../../../store/cln.selector';
@ -14,7 +14,7 @@ import { clnNodeInformation } from '../../../store/cln.selector';
})
export class CLNChannelLookupComponent implements OnInit {
@Input() lookupResult: ChannelEdge[] = [];
@Input() lookupResult: ChannelEdge = {};
public node1_match = false;
public node2_match = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
@ -24,10 +24,10 @@ export class CLNChannelLookupComponent implements OnInit {
ngOnInit() {
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[0])).
subscribe((nodeInfo: GetInfo) => {
if (this.lookupResult.length > 0 && this.lookupResult[0].source === nodeInfo.id) {
if (this.lookupResult.channels && this.lookupResult.channels.length > 0 && this.lookupResult.channels[0].source === nodeInfo.id) {
this.node1_match = true;
}
if (this.lookupResult.length > 1 && this.lookupResult[1].source === nodeInfo.id) {
if (this.lookupResult.channels && this.lookupResult.channels.length > 1 && this.lookupResult.channels[1].source === nodeInfo.id) {
this.node2_match = true;
}
});

@ -25,7 +25,7 @@
</div>
<div fxLayout="row" fxFlex="100" fxLayoutAlign="start center" [ngSwitch]="selectedFieldId">
<span *ngSwitchCase="0" fxFlex="100"><div *ngIf="nodeLookupValue.nodeid !== ''; else errorBlock"><rtl-cln-node-lookup [lookupResult]="nodeLookupValue" /></div></span>
<span *ngSwitchCase="1" fxFlex="100"><div *ngIf="channelLookupValue.length>0; else errorBlock"><rtl-cln-channel-lookup [lookupResult]="channelLookupValue" /></div></span>
<span *ngSwitchCase="1" fxFlex="100"><div *ngIf="channelLookupValue.channels && channelLookupValue.channels.length>0; else errorBlock"><rtl-cln-channel-lookup [lookupResult]="channelLookupValue" /></div></span>
<span *ngSwitchDefault> fxFlex="100"<h3>Error! Unable to find details!</h3></span>
</div>
</div>

@ -54,7 +54,7 @@ export class CLNLookupsComponent implements OnInit, OnDestroy {
this.nodeLookupValue = typeof resLookup.payload[0] !== 'object' ? { nodeid: '' } : JSON.parse(JSON.stringify(resLookup.payload[0]));
break;
case 1:
this.channelLookupValue = typeof resLookup.payload.channels !== 'object' ? [] : JSON.parse(JSON.stringify(resLookup.payload.channels));
this.channelLookupValue = resLookup.payload.channels && typeof resLookup.payload.channels !== 'object' ? { channels: [] } : JSON.parse(JSON.stringify(resLookup.payload));
break;
default:
break;

@ -75,7 +75,7 @@ export class CLNOpenLiquidityChannelComponent implements OnInit, OnDestroy {
if (!this.node || !this.node.option_will_fund || !this.requestedAmount || !this.feeRate || !this.localAmount || this.localAmount < 20000) {
return true;
}
const newChannel = { peerId: this.node.nodeid || '', satoshis: this.localAmount.toString(), feeRate: this.feeRate + 'perkb', requestAmount: this.requestedAmount.toString(), compactLease: this.node.option_will_fund.compact_lease, announce: true };
const newChannel = { peerId: this.node.nodeid || '', amount: this.localAmount.toString(), feeRate: this.feeRate + 'perkb', requestAmount: this.requestedAmount.toString(), compactLease: this.node.option_will_fund.compact_lease, announce: true };
this.store.dispatch(saveNewChannel({ payload: newChannel }));
}

@ -27,7 +27,7 @@
</mat-form-field>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch">
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayoutAlign.gt-sm="space-between center" fxLayout.gt-sm="row wrap">
<div fxFlex="48" fxLayoutAlign="space-between end">
<div fxFlex="48" fxLayoutAlign="space-between start">
<mat-form-field fxLayout="column" fxLayoutAlign="start center" [fxFlex]="selFeeRate === 'customperkb' && !flgMinConf ? '48' : '100'">
<mat-label>Fee Rate</mat-label>
<mat-select tabindex="4" [disabled]="flgMinConf" [(value)]="selFeeRate" (selectionChange)="customFeeRate=null">
@ -118,7 +118,7 @@
<mat-error *ngIf="sendFundFormGroup.controls.transactionAddress.errors?.required">Bitcoin address is required.</mat-error>
</mat-form-field>
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxLayout.gt-sm="row wrap" fxFlex="100" fxLayoutAlign.gt-sm="space-between center">
<div fxFlex="48" fxLayoutAlign="space-between end">
<div fxFlex="48" fxLayoutAlign="space-between start">
<mat-form-field fxLayout="column" fxLayoutAlign="start center" [fxFlex]="sendFundFormGroup.controls.selFeeRate.value === 'customperkb' && !sendFundFormGroup.controls.flgMinConf.value ? '48' : '100'">
<mat-label>Fee Rate</mat-label>
<mat-select tabindex="4" formControlName="selFeeRate">

@ -210,7 +210,7 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
this.store.dispatch(setChannelTransaction({ payload: this.transaction }));
} else {
this.transaction.minconf = this.flgMinConf ? this.minConfValue : null;
this.transaction['feeRate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate !== '' ? this.selFeeRate : null;
this.transaction['feerate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate !== '' ? this.selFeeRate : null;
if ((!this.transaction.destination || this.transaction.destination === '') ||
((!this.transaction.satoshi || +this.transaction.satoshi <= 0)) ||
(this.flgMinConf && (!this.transaction.minconf || this.transaction.minconf <= 0)) ||

@ -7,7 +7,7 @@ import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Channel, GetInfo, ChannelEdge, Balance } from '../../../../../shared/models/clnModels';
import { Channel, GetInfo, ChannelEdge, Balance, LookupChannelEdge } from '../../../../../shared/models/clnModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, DataTypeEnum, ScreenSizeEnum, FEE_RATE_TYPES, APICallStatusEnum, UI_MESSAGES, CLN_DEFAULT_PAGE_SETTINGS, SortOrderEnum, CLN_PAGE_DEFS } from '../../../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../../../shared/services/logger.service';
@ -121,15 +121,15 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
onViewRemotePolicy(selChannel: Channel) {
this.store.dispatch(channelLookup({ payload: { uiMessage: UI_MESSAGES.GET_REMOTE_POLICY, shortChannelID: selChannel.short_channel_id || '', showError: true } }));
this.clnEffects.setLookupCL.pipe(take(1)).subscribe((resLookup: ChannelEdge[]): boolean | void => {
if (resLookup.length === 0) {
this.clnEffects.setLookupCL.pipe(take(1)).subscribe((resLookup: ChannelEdge): boolean | void => {
if (resLookup.channels && resLookup.channels.length === 0) {
return false;
}
let remoteNode: ChannelEdge = {};
if (resLookup[0].source !== this.information.id) {
remoteNode = resLookup[0];
let remoteNode: LookupChannelEdge = {};
if (resLookup.channels[0].source !== this.information.id) {
remoteNode = resLookup.channels[0];
} else {
remoteNode = resLookup[1];
remoteNode = resLookup.channels[1];
}
const reorderedChannelPolicy = [
[{ key: 'base_fee_millisatoshi', value: remoteNode.base_fee_millisatoshi, title: 'Base Fees (mSats)', width: 34, type: DataTypeEnum.NUMBER },
@ -178,17 +178,17 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
this.store.dispatch(updateChannel({ payload: { baseFeeMsat: base_fee, feeRate: fee_rate, channelId: 'all' } }));
this.store.dispatch(updateChannel({ payload: { feebase: base_fee, feeppm: fee_rate, id: 'all' } }));
}
});
} else {
this.myChanPolicy = { fee_base_msat: 0, fee_rate_milli_msat: 0 };
this.store.dispatch(channelLookup({ payload: { uiMessage: UI_MESSAGES.GET_CHAN_POLICY, shortChannelID: channelToUpdate.short_channel_id, showError: false } }));
this.clnEffects.setLookupCL.pipe(take(1)).subscribe((resLookup: ChannelEdge[]) => {
if (resLookup.length > 0 && resLookup[0].source === this.information.id) {
this.myChanPolicy = { fee_base_msat: resLookup[0].base_fee_millisatoshi, fee_rate_milli_msat: resLookup[0].fee_per_millionth };
} else if (resLookup.length > 1 && resLookup[1].source === this.information.id) {
this.myChanPolicy = { fee_base_msat: resLookup[1].base_fee_millisatoshi, fee_rate_milli_msat: resLookup[1].fee_per_millionth };
this.clnEffects.setLookupCL.pipe(take(1)).subscribe((resLookup: ChannelEdge) => {
if (resLookup.channels && resLookup.channels.length > 0 && resLookup.channels[0].source === this.information.id) {
this.myChanPolicy = { fee_base_msat: resLookup.channels[0].base_fee_millisatoshi, fee_rate_milli_msat: resLookup.channels[0].fee_per_millionth };
} else if (resLookup.channels.length > 1 && resLookup.channels[1].source === this.information.id) {
this.myChanPolicy = { fee_base_msat: resLookup.channels[1].base_fee_millisatoshi, fee_rate_milli_msat: resLookup.channels[1].fee_per_millionth };
} else {
this.myChanPolicy = { fee_base_msat: 0, fee_rate_milli_msat: 0 };
}
@ -223,7 +223,7 @@ export class CLNChannelOpenTableComponent implements OnInit, AfterViewInit, OnDe
if (confirmRes) {
const base_fee = confirmRes[0].inputValue;
const fee_rate = confirmRes[1].inputValue;
this.store.dispatch(updateChannel({ payload: { baseFeeMsat: base_fee, feeRate: fee_rate, channelId: channelToUpdate.channel_id } }));
this.store.dispatch(updateChannel({ payload: { feebase: base_fee, feeppm: fee_rate, id: channelToUpdate.channel_id } }));
}
});
}

@ -30,8 +30,8 @@
<mat-error *ngIf="amount.errors?.required || !fundingAmount">Amount is required.</mat-error>
<mat-error *ngIf="amount.errors?.max">Amount must be less than or equal to {{totalBalance}}.</mat-error>
</mat-form-field>
<div fxFlex="25" fxLayoutAlign="start center">
<mat-slide-toggle tabindex="2" color="primary" name="isPrivate" [(ngModel)]="isPrivate">Private Channel</mat-slide-toggle>
<div fxLayout="column" fxFlex="25" fxLayoutAlign="center start">
<mat-slide-toggle fxLayout="column" fxLayoutAlign="center start" tabindex="2" color="primary" name="isPrivate" [(ngModel)]="isPrivate">Private Channel</mat-slide-toggle>
</div>
</div>
<mat-expansion-panel class="flat-expansion-panel mt-2" expanded="false" (closed)="onAdvancedPanelToggle(true)" (opened)="onAdvancedPanelToggle(false)">

@ -188,8 +188,8 @@ export class CLNOpenChannelComponent implements OnInit, OnDestroy {
if ((!this.peer && !this.selectedPubkey) || (!this.fundingAmount || ((this.totalBalance - this.fundingAmount) < 0) || (this.flgMinConf && !this.minConfValue)) || (this.selFeeRate === 'customperkb' && !this.flgMinConf && !this.customFeeRate)) {
return true;
}
const newChannel = { peerId: ((!this.peer || !this.peer.id) ? this.selectedPubkey : this.peer.id), satoshis: (this.flgUseAllBalance) ? 'all' : this.fundingAmount.toString(), announce: !this.isPrivate, minconf: this.flgMinConf ? this.minConfValue : null };
newChannel['feeRate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate;
const newChannel = { peerId: ((!this.peer || !this.peer.id) ? this.selectedPubkey : this.peer.id), amount: (this.flgUseAllBalance) ? 'all' : this.fundingAmount.toString(), announce: !this.isPrivate, minconf: this.flgMinConf ? this.minConfValue : null };
newChannel['feerate'] = (this.selFeeRate === 'customperkb' && !this.flgMinConf && this.customFeeRate) ? (this.customFeeRate * 1000) + 'perkb' : this.selFeeRate;
if (this.selUTXOs.length && this.selUTXOs.length > 0) {
newChannel['utxos'] = [];
this.selUTXOs.forEach((utxo: UTXO) => newChannel['utxos'].push(utxo.txid + ':' + utxo.output));

@ -143,7 +143,7 @@ export class CLNConnectPeerComponent implements OnInit, OnDestroy {
this.channelConnectionError = '';
this.store.dispatch(saveNewChannel({
payload: {
peerId: this.newlyAddedPeer?.id!, satoshis: this.channelFormGroup.controls.fundingAmount.value, announce: !this.channelFormGroup.controls.isPrivate.value,
peerId: this.newlyAddedPeer?.id!, amount: this.channelFormGroup.controls.fundingAmount.value, announce: !this.channelFormGroup.controls.isPrivate.value,
feeRate: (this.channelFormGroup.controls.selFeeRate.value === 'customperkb' && !this.channelFormGroup.controls.flgMinConf.value && this.channelFormGroup.controls.customFeeRate.value) ? ((this.channelFormGroup.controls.customFeeRate.value * 1000) + 'perkb') : this.channelFormGroup.controls.selFeeRate.value,
minconf: this.channelFormGroup.controls.flgMinConf.value ? this.channelFormGroup.controls.minConfValue.value : null
}

@ -9,7 +9,7 @@ import { faUsers } from '@fortawesome/free-solid-svg-icons';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Peer, GetInfo, Balance } from '../../../shared/models/clnModels';
import { Peer, GetInfo, Balance, UTXO, LocalRemoteBalance } from '../../../shared/models/clnModels';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, AlertTypeEnum, ScreenSizeEnum, APICallStatusEnum, CLNActions, SortOrderEnum, CLN_DEFAULT_PAGE_SETTINGS, CLN_PAGE_DEFS } from '../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
import { LoggerService } from '../../../shared/services/logger.service';
@ -21,7 +21,7 @@ import { RTLEffects } from '../../../store/rtl.effects';
import { RTLState } from '../../../store/rtl.state';
import { openAlert, openConfirmation } from '../../../store/rtl.actions';
import { detachPeer } from '../../store/cln.actions';
import { clnPageSettings, nodeInfoAndBalance, peers } from '../../store/cln.selector';
import { clnPageSettings, nodeInfoAndBalance, peers, utxoBalances } from '../../store/cln.selector';
import { ColumnDefinition, PageSettings, TableSetting } from '../../../shared/models/pageSettings';
import { CamelCaseWithReplacePipe } from '../../../shared/pipes/app.pipe';
import { MAT_SELECT_CONFIG } from '@angular/material/select';
@ -50,6 +50,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public peerAddress: string | null = '';
public peersData: Peer[] = [];
public peers: any = new MatTableDataSource([]);
public utxos: UTXO[] = [];
public information: GetInfo = {};
public availableBalance = 0;
public pageSize = PAGE_SIZE;
@ -104,9 +105,13 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.logger.info(peersSeletor);
});
this.store.select(utxoBalances).pipe(takeUntil(this.unSubs[3])).
subscribe((utxoBalancesSeletor: { utxos: UTXO[], balance: Balance, localRemoteBalance: LocalRemoteBalance, apiCallStatus: ApiCallStatusPayload }) => {
this.utxos = this.commonService.sortAscByKey(utxoBalancesSeletor.utxos?.filter((utxo) => utxo.status === 'confirmed'), 'value');
});
this.actions.
pipe(
takeUntil(this.unSubs[3]),
takeUntil(this.unSubs[4]),
filter((action) => action.type === CLNActions.SET_PEERS_CLN)
).subscribe((setPeers: any) => {
this.peerAddress = null;
@ -157,7 +162,8 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
const peerToAddChannelMessage = {
peer: peerToAddChannel,
information: this.information,
balance: this.availableBalance
balance: this.availableBalance,
utxos: this.utxos
};
this.store.dispatch(openAlert({
payload: {
@ -185,7 +191,7 @@ export class CLNPeersComponent implements OnInit, AfterViewInit, OnDestroy {
}
}));
this.rtlEffects.closeConfirm.
pipe(takeUntil(this.unSubs[4])).
pipe(takeUntil(this.unSubs[5])).
subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(detachPeer({ payload: { id: peerToDetach.id!, force: false } }));

@ -284,7 +284,7 @@ export class CLNEffects implements OnDestroy {
mergeMap((action: { type: string, payload: SaveChannel }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.OPEN_CHANNEL }));
this.store.dispatch(updateCLNAPICallStatus({ payload: { action: 'SaveNewChannel', status: APICallStatusEnum.INITIATED } }));
const newPayload = { id: action.payload.peerId, satoshis: action.payload.satoshis, feeRate: action.payload.feeRate, announce: action.payload.announce };
const newPayload = { id: action.payload.peerId, amount: action.payload.amount, feerate: action.payload.feeRate, announce: action.payload.announce };
if (action.payload.minconf) { newPayload['minconf'] = action.payload.minconf; }
if (action.payload.utxos) { newPayload['utxos'] = action.payload.utxos; }
if (action.payload.requestAmount) { newPayload['request_amt'] = action.payload.requestAmount; }
@ -313,13 +313,10 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.UPDATE_CHANNEL_CLN),
mergeMap((action: { type: string, payload: UpdateChannel }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.UPDATE_CHAN_POLICY }));
return this.httpClient.post(
this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/setChannelFee',
{ id: action.payload.channelId, base: action.payload.baseFeeMsat, ppm: action.payload.feeRate }
).pipe(map((postRes: any) => {
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/setChannelFee', action.payload).pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.UPDATE_CHAN_POLICY }));
if (action.payload.channelId === 'all') {
if (action.payload.id === 'all') {
this.store.dispatch(openSnackBar({ payload: { message: 'All Channels Updated Successfully. Fee policy updates may take some time to reflect on the channel.', duration: 5000 } }));
} else {
this.store.dispatch(openSnackBar({ payload: { message: 'Channel Updated Successfully. Fee policy updates may take some time to reflect on the channel.', duration: 5000 } }));
@ -339,7 +336,7 @@ export class CLNEffects implements OnDestroy {
ofType(CLNActions.CLOSE_CHANNEL_CLN),
mergeMap((action: { type: string, payload: CloseChannel }) => {
this.store.dispatch(openSpinner({ payload: (action.payload.force ? UI_MESSAGES.FORCE_CLOSE_CHANNEL : UI_MESSAGES.CLOSE_CHANNEL) }));
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/close', { id: action.payload.channelId, unilaterlaltimeout: action.payload.force ? 1 : null }).
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.CHANNELS_API + '/close', { id: action.payload.channelId, unilateraltimeout: action.payload.force ? 1 : null }).
pipe(
map((postRes: any) => {
this.logger.info(postRes);

@ -148,7 +148,7 @@ export const CLNReducer = createReducer(initCLNState,
const modifiedInvoices = state.invoices;
modifiedInvoices.invoices = modifiedInvoices.invoices?.map((invoice) => {
if (invoice.label === payload.label) {
invoice.amount_received_msat = +payload.msat.substring(0, payload.msat.length - 4);
invoice.amount_received_msat = payload.msat;
invoice.payment_preimage = payload.preimage;
invoice.status = 'paid';
}

@ -108,7 +108,7 @@ export interface OfferBookmark {
}
export interface InvoicePaymentNotification {
msat?: string;
msat?: number;
preimage?: string;
label?: string;
}
@ -325,7 +325,7 @@ export interface Channel {
balancedness?: number; // Between 0-1-0
}
export interface ChannelEdge {
export interface LookupChannelEdge {
active?: boolean;
amount_msat?: string;
base_fee_millisatoshi?: number;
@ -343,6 +343,10 @@ export interface ChannelEdge {
source?: string;
}
export interface ChannelEdge {
channels?: LookupChannelEdge[];
}
export interface LookupNode {
nodeid?: string;
alias?: string;
@ -418,7 +422,7 @@ export interface RoutingPeer {
export interface SaveChannel {
peerId: string;
satoshis: string;
amount: string;
announce?: boolean;
feeRate?: string;
minconf?: number | null;
@ -440,9 +444,9 @@ export interface DetachPeer {
}
export interface UpdateChannel {
channelId: string;
baseFeeMsat: number;
feeRate: number;
id: string;
feebase: number;
feeppm: number;
}
export interface CloseChannel {

Loading…
Cancel
Save