listpeerchannels and withdraw fixes

clnrest-migration
ShahanaFarooqui 6 months ago
parent 43b1612e77
commit 8e9e6fabe0

@ -17,6 +17,7 @@ export const listPeerChannels = (req, res, next) => {
return Promise.all(body.channels?.map((channel) => {
channel.to_us_msat = common.removeMSat(channel.to_us_msat);
channel.total_msat = common.removeMSat(channel.total_msat);
channel.to_them_msat = channel.total_msat - channel.to_us_msat;
channel.last_tx_fee_msat = common.removeMSat(channel.last_tx_fee_msat);
channel.funding.local_funds_msat = common.removeMSat(channel.funding.local_funds_msat);
channel.funding.remote_funds_msat = common.removeMSat(channel.funding.remote_funds_msat);
@ -133,6 +134,11 @@ export const funderUpdatePolicy = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Funder Update Body', data: options.body });
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Funder Policy Received', data: body });
body.min_their_funding_msat = common.removeMSat(body.min_their_funding_msat);
body.max_their_funding_msat = common.removeMSat(body.max_their_funding_msat);
body.per_channel_min_msat = common.removeMSat(body.per_channel_min_msat);
body.per_channel_max_msat = common.removeMSat(body.per_channel_max_msat);
body.reserve_tank_msat = common.removeMSat(body.reserve_tank_msat);
body.channel_fee_max_base_msat = common.removeMSat(body.channel_fee_max_base_msat);
body.lease_fee_base_msat = common.removeMSat(body.lease_fee_base_msat);
res.status(200).json(body);

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:"1437bbfbfc0a540b",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:"649839951b94fd32",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))})()})();

@ -17,6 +17,7 @@ export const listPeerChannels = (req, res, next) => {
return Promise.all(body.channels?.map((channel) => {
channel.to_us_msat = common.removeMSat(channel.to_us_msat);
channel.total_msat = common.removeMSat(channel.total_msat);
channel.to_them_msat = channel.total_msat - channel.to_us_msat;
channel.last_tx_fee_msat = common.removeMSat(channel.last_tx_fee_msat);
channel.funding.local_funds_msat = common.removeMSat(channel.funding.local_funds_msat);
channel.funding.remote_funds_msat = common.removeMSat(channel.funding.remote_funds_msat);
@ -128,6 +129,11 @@ export const funderUpdatePolicy = (req, res, next) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'DEBUG', fileName: 'Channels', msg: 'Funder Update Body', data: options.body });
request.post(options).then((body) => {
logger.log({ selectedNode: req.session.selectedNode, level: 'INFO', fileName: 'Channels', msg: 'Funder Policy Received', data: body });
body.min_their_funding_msat = common.removeMSat(body.min_their_funding_msat);
body.max_their_funding_msat = common.removeMSat(body.max_their_funding_msat);
body.per_channel_min_msat = common.removeMSat(body.per_channel_min_msat);
body.per_channel_max_msat = common.removeMSat(body.per_channel_max_msat);
body.reserve_tank_msat = common.removeMSat(body.reserve_tank_msat);
body.channel_fee_max_base_msat = common.removeMSat(body.channel_fee_max_base_msat);
body.lease_fee_base_msat = common.removeMSat(body.lease_fee_base_msat);
res.status(200).json(body);

@ -10,15 +10,15 @@
<form *ngIf="!sweepAll; else sweepAllBlock;" #form="ngForm" fxLayout="row wrap"fxLayoutAlign="space-between start" fxFlex="100" class="overflow-x-hidden" (submit)="onSendFunds()" (reset)="resetData()">
<mat-form-field fxLayout="column" fxFlex="55">
<mat-label>Bitcoin Address</mat-label>
<input #address="ngModel" matInput autoFocus tabindex="1" name="address" required [(ngModel)]="transaction.address">
<mat-error *ngIf="!transaction.address">Bitcoin address is required.</mat-error>
<input #address="ngModel" matInput autoFocus tabindex="1" name="address" required [(ngModel)]="transaction.destination">
<mat-error *ngIf="!transaction.destination">Bitcoin address is required.</mat-error>
</mat-form-field>
<mat-form-field fxLayout="column" fxFlex="30">
<mat-label>Amount</mat-label>
<input #amount="ngModel" matInput name="amount" tabindex="2" required [type]="flgUseAllBalance ? 'text' : 'number'" [step]="100" [min]="0" [disabled]="flgUseAllBalance" [(ngModel)]="transaction.satoshis">
<input #amount="ngModel" matInput name="amount" tabindex="2" required [type]="flgUseAllBalance ? 'text' : 'number'" [step]="100" [min]="0" [disabled]="flgUseAllBalance" [(ngModel)]="transaction.satoshi">
<mat-hint *ngIf="flgUseAllBalance">Amount replaced by UTXO balance</mat-hint>
<span matSuffix>{{selAmountUnit}} </span>
<mat-error *ngIf="!transaction.satoshis">{{amountError}}</mat-error>
<mat-error *ngIf="!transaction.satoshi">{{amountError}}</mat-error>
</mat-form-field>
<mat-form-field fxLayout="column" fxFlex="10" fxLayoutAlign="start end">
<mat-select tabindex="3" required name="amountUnit" [value]="selAmountUnit" [disabled]="flgUseAllBalance" (selectionChange)="onAmountUnitChange($event)">

@ -181,7 +181,7 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
onSendFunds(): boolean | void {
this.sendFundError = '';
if (this.flgUseAllBalance) {
this.transaction.satoshis = 'all';
this.transaction.satoshi = 'all';
}
if (this.selUTXOs.length && this.selUTXOs.length > 0) {
this.transaction.utxos = [];
@ -195,14 +195,14 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
) {
return true;
}
this.transaction.satoshis = 'all';
this.transaction.address = this.sendFundFormGroup.controls.transactionAddress.value;
this.transaction.satoshi = 'all';
this.transaction.destination = this.sendFundFormGroup.controls.transactionAddress.value;
if (this.sendFundFormGroup.controls.flgMinConf.value) {
delete this.transaction.feeRate;
delete this.transaction.feerate;
this.transaction.minconf = this.sendFundFormGroup.controls.flgMinConf.value ? this.sendFundFormGroup.controls.minConfValue.value : null;
} else {
delete this.transaction.minconf;
this.transaction.feeRate = (this.sendFundFormGroup.controls.selFeeRate.value === 'customperkb' &&
this.transaction.feerate = (this.sendFundFormGroup.controls.selFeeRate.value === 'customperkb' &&
!this.sendFundFormGroup.controls.flgMinConf.value && this.sendFundFormGroup.controls.customFeeRate.value) ?
((this.sendFundFormGroup.controls.customFeeRate.value * 1000) + 'perkb') : this.sendFundFormGroup.controls.selFeeRate.value;
}
@ -210,23 +210,23 @@ 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;
if ((!this.transaction.address || this.transaction.address === '') ||
((!this.transaction.satoshis || +this.transaction.satoshis <= 0)) ||
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)) ||
(this.selFeeRate === 'customperkb' && !this.flgMinConf && !this.customFeeRate)) {
return true;
}
if (this.transaction.satoshis && this.transaction.satoshis !== 'all' && this.selAmountUnit !== CurrencyUnitEnum.SATS) {
this.commonService.convertCurrency(+this.transaction.satoshis, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, CurrencyUnitEnum.SATS, this.amountUnits[2], this.fiatConversion).
if (this.transaction.satoshi && this.transaction.satoshi !== 'all' && this.selAmountUnit !== CurrencyUnitEnum.SATS) {
this.commonService.convertCurrency(+this.transaction.satoshi, this.selAmountUnit === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : this.selAmountUnit, CurrencyUnitEnum.SATS, this.amountUnits[2], this.fiatConversion).
pipe(takeUntil(this.unSubs[5])).
subscribe({
next: (data) => {
this.transaction.satoshis = data[CurrencyUnitEnum.SATS];
this.transaction.satoshi = data[CurrencyUnitEnum.SATS];
this.selAmountUnit = CurrencyUnitEnum.SATS;
this.store.dispatch(setChannelTransaction({ payload: this.transaction }));
}, error: (err) => {
this.transaction.satoshis = null;
this.transaction.satoshi = null;
this.selAmountUnit = CurrencyUnitEnum.SATS;
this.amountError = 'Conversion Error: ' + err;
}
@ -287,17 +287,17 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
}
} else {
this.totalSelectedUTXOAmount = null;
this.transaction.satoshis = null;
this.transaction.satoshi = null;
this.flgUseAllBalance = false;
}
}
onUTXOAllBalanceChange() {
if (this.flgUseAllBalance) {
this.transaction.satoshis = this.totalSelectedUTXOAmount;
this.transaction.satoshi = this.totalSelectedUTXOAmount;
this.selAmountUnit = CURRENCY_UNITS[0];
} else {
this.transaction.satoshis = null;
this.transaction.satoshi = null;
}
}
@ -305,15 +305,15 @@ export class CLNOnChainSendModalComponent implements OnInit, OnDestroy {
const self = this;
const prevSelectedUnit = (this.selAmountUnit === this.amountUnits[2]) ? CurrencyUnitEnum.OTHER : this.selAmountUnit;
let currSelectedUnit = event.value === this.amountUnits[2] ? CurrencyUnitEnum.OTHER : event.value;
if (this.transaction.satoshis && this.selAmountUnit !== event.value) {
this.commonService.convertCurrency(+this.transaction.satoshis, prevSelectedUnit, currSelectedUnit, this.amountUnits[2], this.fiatConversion).
if (this.transaction.satoshi && this.selAmountUnit !== event.value) {
this.commonService.convertCurrency(+this.transaction.satoshi, prevSelectedUnit, currSelectedUnit, this.amountUnits[2], this.fiatConversion).
pipe(takeUntil(this.unSubs[6])).
subscribe({
next: (data) => {
this.selAmountUnit = event.value;
self.transaction.satoshis = self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])?.replace(/,/g, '');
self.transaction.satoshi = self.decimalPipe.transform(data[currSelectedUnit], self.currencyUnitFormats[currSelectedUnit])?.replace(/,/g, '');
}, error: (err) => {
self.transaction.satoshis = null;
self.transaction.satoshi = null;
this.amountError = 'Conversion Error: ' + err;
this.selAmountUnit = prevSelectedUnit;
currSelectedUnit = prevSelectedUnit;

@ -1,6 +1,6 @@
.mat-column-is_dust {
max-width: 2.2rem;
width: 2.2rem;
max-width: 3rem;
width: 3rem;
text-overflow: unset;
}

@ -258,8 +258,6 @@ export class CLNEffects implements OnDestroy {
this.store.dispatch(updateCLNAPICallStatus({ payload: { action: 'FetchChannels', status: APICallStatusEnum.COMPLETED } }));
const sortedChannels = { activeChannels: <Channel[]>[], pendingChannels: <Channel[]>[], inactiveChannels: <Channel[]>[] };
channels.forEach((channel) => {
if (channel.id) { channel.peer_id = channel.id; }
if (channel.connected) { channel.peer_connected = channel.connected; }
if (channel.state === 'CHANNELD_NORMAL') {
if (channel.peer_connected) {
sortedChannels.activeChannels.push(channel);

@ -114,7 +114,7 @@ export interface ListInvoices {
}
export interface OnChain {
destination?: string;
destination: string;
satoshi?: string;
feerate?: string;
minconf?: number;

Loading…
Cancel
Save