mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-10-31 09:20:27 +00:00
Offers Update #1206
This commit is contained in:
parent
ffdcd2c78b
commit
56e5558bf7
@ -104,8 +104,8 @@ export const postPayment = (req, res, next) => {
|
||||
if (req.body.paymentType === 'OFFER') {
|
||||
if (req.body.saveToDB && req.body.bolt12) {
|
||||
const offerToUpdate = { bolt12: req.body.bolt12, amountMSat: (req.body.zeroAmtOffer ? 0 : req.body.amount), title: req.body.title, lastUpdatedAt: new Date(Date.now()).getTime() };
|
||||
if (req.body.vendor) {
|
||||
offerToUpdate['vendor'] = req.body.vendor;
|
||||
if (req.body.issuer) {
|
||||
offerToUpdate['issuer'] = req.body.issuer;
|
||||
}
|
||||
if (req.body.description) {
|
||||
offerToUpdate['description'] = req.body.description;
|
||||
|
@ -3,15 +3,15 @@ export var OfferFieldsEnum;
|
||||
OfferFieldsEnum["BOLT12"] = "bolt12";
|
||||
OfferFieldsEnum["AMOUNTMSAT"] = "amountMSat";
|
||||
OfferFieldsEnum["TITLE"] = "title";
|
||||
OfferFieldsEnum["VENDOR"] = "vendor";
|
||||
OfferFieldsEnum["ISSUER"] = "issuer";
|
||||
OfferFieldsEnum["DESCRIPTION"] = "description";
|
||||
})(OfferFieldsEnum || (OfferFieldsEnum = {}));
|
||||
export class Offer {
|
||||
constructor(bolt12, amountMSat, title, vendor, description, lastUpdatedAt) {
|
||||
constructor(bolt12, amountMSat, title, issuer, description, lastUpdatedAt) {
|
||||
this.bolt12 = bolt12;
|
||||
this.amountMSat = amountMSat;
|
||||
this.title = title;
|
||||
this.vendor = vendor;
|
||||
this.issuer = issuer;
|
||||
this.description = description;
|
||||
this.lastUpdatedAt = lastUpdatedAt;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ export class CommonService {
|
||||
};
|
||||
this.handleError = (errRes, fileName, errMsg, selectedNode) => {
|
||||
let err = JSON.parse(JSON.stringify(errRes));
|
||||
if (Object.keys(err.error).length === 0 && errRes.error && (errRes.error.stack || errRes.error.message)) {
|
||||
if (err && err.error && Object.keys(err.error).length === 0 && errRes.error && (errRes.error.stack || errRes.error.message)) {
|
||||
errRes.error = errRes.error.stack || errRes.error.message;
|
||||
err = JSON.parse(JSON.stringify(errRes));
|
||||
}
|
||||
|
1
frontend/564.4c2c9e355320b551.js
Normal file
1
frontend/564.4c2c9e355320b551.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
@ -13,6 +13,6 @@
|
||||
<style>html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:100%}@media only screen and (max-width: 56.25em){html{font-size:90%}}@media only screen and (max-width: 37.5em){html{font-size:80%}}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}</style><link rel="stylesheet" href="styles.c7a6e1a24b7a5469.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.c7a6e1a24b7a5469.css"></noscript></head>
|
||||
<body>
|
||||
<rtl-app></rtl-app>
|
||||
<script src="runtime.865dd8ddb1f98109.js" type="module"></script><script src="polyfills.9720483e1820202a.js" type="module"></script><script src="main.e9d7a82157c70703.js" type="module"></script>
|
||||
<script src="runtime.506a8bb36453c288.js" type="module"></script><script src="polyfills.9720483e1820202a.js" type="module"></script><script src="main.aa41d1048b5cf1a6.js" type="module"></script>
|
||||
|
||||
</body></html>
|
1
frontend/main.aa41d1048b5cf1a6.js
Normal file
1
frontend/main.aa41d1048b5cf1a6.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 @@
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.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=(o,t,i,f)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,f]=e[n],c=!0,d=0;d<t.length;d++)(!1&f||a>=f)&&Object.keys(r.O).every(b=>r.O[b](t[d]))?t.splice(d--,1):(c=!1,f<a&&(a=f));if(c){e.splice(n--,1);var u=i();void 0!==u&&(o=u)}}return o}f=f||0;for(var n=e.length;n>0&&e[n-1][2]>f;n--)e[n]=e[n-1];e[n]=[t,i,f]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{258:"74bd2ac767e7a584",267:"8f996ec2b4b156e0",564:"f4d4e152dc4f0a63",636:"0bd12e29e4623b7e"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,f,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==f)for(var d=document.getElementsByTagName("script"),u=0;u<d.length;u++){var l=d[u];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==o+f){a=l;break}}a||(c=!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",o+f),a.src=r.tu(t)),e[t]=[i];var s=(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(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&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:o=>o},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,f)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)f.push(n[2]);else if(666!=i){var a=new Promise((l,s)=>n=e[i]=[l,s]);f.push(n[2]=a);var c=r.p+r.u(i),d=new Error;r.l(c,l=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;d.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",d.name="ChunkLoadError",d.type=s,d.request=p,n[1](d)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,f)=>{var d,u,[n,a,c]=f,l=0;if(n.some(p=>0!==e[p])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(c)var s=c(r)}for(i&&i(f);l<n.length;l++)r.o(e,u=n[l])&&e[u]&&e[u][0](),e[u]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var o=m[e];if(void 0!==o)return o.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=(o,t,i,d)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,i,d]=e[n],c=!0,f=0;f<t.length;f++)(!1&d||a>=d)&&Object.keys(r.O).every(b=>r.O[b](t[f]))?t.splice(f--,1):(c=!1,d<a&&(a=d));if(c){e.splice(n--,1);var u=i();void 0!==u&&(o=u)}}return o}d=d||0;for(var n=e.length;n>0&&e[n-1][2]>d;n--)e[n]=e[n-1];e[n]=[t,i,d]},r.d=(e,o)=>{for(var t in o)r.o(o,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((o,t)=>(r.f[t](e,o),o),[])),r.u=e=>e+"."+{258:"74bd2ac767e7a584",267:"8f996ec2b4b156e0",564:"4c2c9e355320b551",636:"0bd12e29e4623b7e"}[e]+".js",r.miniCssF=e=>{},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={},o="RTLApp:";r.l=(t,i,d,n)=>{if(e[t])e[t].push(i);else{var a,c;if(void 0!==d)for(var f=document.getElementsByTagName("script"),u=0;u<f.length;u++){var l=f[u];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==o+d){a=l;break}}a||(c=!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",o+d),a.src=r.tu(t)),e[t]=[i];var s=(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(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&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:o=>o},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,d)=>{var n=r.o(e,i)?e[i]:void 0;if(0!==n)if(n)d.push(n[2]);else if(666!=i){var a=new Promise((l,s)=>n=e[i]=[l,s]);d.push(n[2]=a);var c=r.p+r.u(i),f=new Error;r.l(c,l=>{if(r.o(e,i)&&(0!==(n=e[i])&&(e[i]=void 0),n)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;f.message="Loading chunk "+i+" failed.\n("+s+": "+p+")",f.name="ChunkLoadError",f.type=s,f.request=p,n[1](f)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var o=(i,d)=>{var f,u,[n,a,c]=d,l=0;if(n.some(p=>0!==e[p])){for(f in a)r.o(a,f)&&(r.m[f]=a[f]);if(c)var s=c(r)}for(i&&i(d);l<n.length;l++)r.o(e,u=n[l])&&e[u]&&e[u][0](),e[u]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})()})();
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtl",
|
||||
"version": "0.13.5-beta",
|
||||
"version": "0.13.6-beta",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rtl",
|
||||
"version": "0.13.5-beta",
|
||||
"version": "0.13.6-beta",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
@ -92,7 +92,7 @@ export const postPayment = (req, res, next) => {
|
||||
if (req.body.paymentType === 'OFFER') {
|
||||
if (req.body.saveToDB && req.body.bolt12) {
|
||||
const offerToUpdate: Offer = { bolt12: req.body.bolt12, amountMSat: (req.body.zeroAmtOffer ? 0 : req.body.amount), title: req.body.title, lastUpdatedAt: new Date(Date.now()).getTime() };
|
||||
if (req.body.vendor) { offerToUpdate['vendor'] = req.body.vendor; }
|
||||
if (req.body.issuer) { offerToUpdate['issuer'] = req.body.issuer; }
|
||||
if (req.body.description) { offerToUpdate['description'] = req.body.description; }
|
||||
// eslint-disable-next-line arrow-body-style
|
||||
return databaseService.validateDocument(CollectionsEnum.OFFERS, offerToUpdate).then((validated) => {
|
||||
|
@ -2,7 +2,7 @@ export enum OfferFieldsEnum {
|
||||
BOLT12 = 'bolt12',
|
||||
AMOUNTMSAT = 'amountMSat',
|
||||
TITLE = 'title',
|
||||
VENDOR = 'vendor',
|
||||
ISSUER = 'issuer',
|
||||
DESCRIPTION = 'description'
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ export class Offer {
|
||||
public bolt12: string,
|
||||
public amountMSat: number,
|
||||
public title: string,
|
||||
public vendor?: string,
|
||||
public issuer?: string,
|
||||
public description?: string,
|
||||
public lastUpdatedAt?: number
|
||||
) { }
|
||||
|
@ -238,7 +238,7 @@ export class CommonService {
|
||||
|
||||
public handleError = (errRes, fileName, errMsg, selectedNode: CommonSelectedNode) => {
|
||||
let err = JSON.parse(JSON.stringify(errRes));
|
||||
if (Object.keys(err.error).length === 0 && errRes.error && (errRes.error.stack || errRes.error.message)) {
|
||||
if (err && err.error && Object.keys(err.error).length === 0 && errRes.error && (errRes.error.stack || errRes.error.message)) {
|
||||
errRes.error = errRes.error.stack || errRes.error.message;
|
||||
err = JSON.parse(JSON.stringify(errRes));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ export const fetchOffers = createAction(CLNActions.FETCH_OFFERS_CLN);
|
||||
|
||||
export const setOffers = createAction(CLNActions.SET_OFFERS_CLN, props<{ payload: Offer[] }>());
|
||||
|
||||
export const saveNewOffer = createAction(CLNActions.SAVE_NEW_OFFER_CLN, props<{ payload: { amount: string, description: string, vendor: string } }>());
|
||||
export const saveNewOffer = createAction(CLNActions.SAVE_NEW_OFFER_CLN, props<{ payload: { amount: string, description: string, issuer: string } }>());
|
||||
|
||||
export const addOffer = createAction(CLNActions.ADD_OFFER_CLN, props<{ payload: Offer }>());
|
||||
|
||||
|
@ -752,11 +752,11 @@ export class CLNEffects implements OnDestroy {
|
||||
|
||||
saveNewOfferCL = createEffect(() => this.actions.pipe(
|
||||
ofType(CLNActions.SAVE_NEW_OFFER_CLN),
|
||||
mergeMap((action: { type: string, payload: { amount: string, description: string, vendor: string } }) => {
|
||||
mergeMap((action: { type: string, payload: { amount: string, description: string, issuer: string } }) => {
|
||||
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.CREATE_OFFER }));
|
||||
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewOffer', status: APICallStatusEnum.INITIATED } }));
|
||||
return this.httpClient.post(this.CHILD_API_URL + API_END_POINTS.OFFERS_API, {
|
||||
amount: action.payload.amount, description: action.payload.description, vendor: action.payload.vendor
|
||||
amount: action.payload.amount, description: action.payload.description, issuer: action.payload.issuer
|
||||
}).pipe(map((postRes: Offer) => {
|
||||
this.logger.info(postRes);
|
||||
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'SaveNewOffer', status: APICallStatusEnum.COMPLETED } }));
|
||||
|
@ -199,7 +199,7 @@ export const CLNReducer = createReducer(initCLNState,
|
||||
updatedOffer.amountMSat = payload.amountMSat;
|
||||
updatedOffer.lastUpdatedAt = payload.lastUpdatedAt;
|
||||
updatedOffer.description = payload.description;
|
||||
updatedOffer.vendor = payload.vendor;
|
||||
updatedOffer.issuer = payload.issuer;
|
||||
newOfferBMs.splice(offerBMExistsIdx, 1, updatedOffer);
|
||||
}
|
||||
return {
|
||||
|
@ -20,8 +20,8 @@
|
||||
<mat-hint>{{offerValueHint}}</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxLayout="column" fxFlex="58" fxLayoutAlign="start end">
|
||||
<mat-label>Vendor</mat-label>
|
||||
<input matInput tabindex="3" name="vendor" [(ngModel)]="vendor">
|
||||
<mat-label>Issuer</mat-label>
|
||||
<input matInput tabindex="3" name="issuer" [(ngModel)]="issuer">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="offerError !== ''" fxFlex="100" class="alert alert-danger mt-1">
|
||||
|
@ -28,7 +28,7 @@ export class CLNCreateOfferComponent implements OnInit, OnDestroy {
|
||||
public selNode: SelNodeChild | null = {};
|
||||
public description = '';
|
||||
public offerValue: number | null;
|
||||
public vendor = '';
|
||||
public issuer = '';
|
||||
public offerValueHint = '';
|
||||
public information: GetInfo = {};
|
||||
public pageSize = PAGE_SIZE;
|
||||
@ -44,7 +44,7 @@ export class CLNCreateOfferComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
this.store.select(clnNodeInformation).pipe(takeUntil(this.unSubs[1])).subscribe((nodeInfo: GetInfo) => {
|
||||
this.information = nodeInfo;
|
||||
this.vendor = this.information.alias!;
|
||||
this.issuer = this.information.alias!;
|
||||
});
|
||||
this.actions.pipe(
|
||||
takeUntil(this.unSubs[2]),
|
||||
@ -63,13 +63,13 @@ export class CLNCreateOfferComponent implements OnInit, OnDestroy {
|
||||
|
||||
onAddOffer() {
|
||||
this.offerError = '';
|
||||
const offerAmt = !this.offerValue ? 'any' : this.offerValue + 'sats';
|
||||
this.store.dispatch(saveNewOffer({ payload: { amount: offerAmt, description: this.description, vendor: this.vendor } }));
|
||||
const offerAmt = !this.offerValue ? 'any' : (this.offerValue * 1000).toString();
|
||||
this.store.dispatch(saveNewOffer({ payload: { amount: offerAmt, description: this.description, issuer: this.issuer } }));
|
||||
}
|
||||
|
||||
resetData() {
|
||||
this.description = '';
|
||||
this.vendor = this.information.alias!;
|
||||
this.issuer = this.information.alias!;
|
||||
this.offerValue = null;
|
||||
this.offerValueHint = '';
|
||||
this.offerError = '';
|
||||
|
@ -46,6 +46,10 @@
|
||||
<th *matHeaderCellDef mat-header-cell mat-sort-header>Vendor</th>
|
||||
<td *matCellDef="let offersbookmark" mat-cell>{{offersbookmark.vendor}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="issuer">
|
||||
<th *matHeaderCellDef mat-header-cell mat-sort-header>Issuer</th>
|
||||
<td *matCellDef="let offersbookmark" mat-cell>{{offersbookmark.issuer}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="bolt12">
|
||||
<th *matHeaderCellDef mat-header-cell mat-sort-header>Invoice</th>
|
||||
<td *matCellDef="let offersbookmark" mat-cell>
|
||||
|
@ -22,13 +22,13 @@
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested (Sats)</h4>
|
||||
<span class="foreground-secondary-text">
|
||||
{{ !offerDecoded?.amount_msat || offerDecoded?.amount === 0 ? 'Open Offer' : ((offerDecoded?.amount / 1000) | number) }}
|
||||
{{ !offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount === 0 ? 'Open Offer' : ((offerDecoded?.offer_amount / 1000) | number) }}
|
||||
</span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Active</h4>
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Valid</h4>
|
||||
<span class="foreground-secondary-text">
|
||||
{{!offer?.active ? 'N/K' : offer?.active ? 'Active' : 'Inactive'}}
|
||||
{{ !offerDecoded?.valid ? 'N/K' : offerDecoded?.valid ? 'Yes' : 'No' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -37,15 +37,15 @@
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Description</h4>
|
||||
<span class="foreground-secondary-text">
|
||||
{{offerDecoded?.description}}
|
||||
{{offerDecoded?.offer_description}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Offer Request</h4>
|
||||
<span class="foreground-secondary-text">{{offer?.bolt12}}</span>
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Offer Node ID</h4>
|
||||
<span class="foreground-secondary-text">{{offerDecoded?.offer_node_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showAdvanced">
|
||||
@ -64,11 +64,18 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider *ngIf="offerDecoded?.vendor || offerDecoded?.issuer" class="w-100 my-1"></mat-divider>
|
||||
<div *ngIf="offerDecoded?.vendor || offerDecoded?.issuer" fxLayout="row">
|
||||
<mat-divider *ngIf="offerDecoded?.issuer" class="w-100 my-1"></mat-divider>
|
||||
<div *ngIf="offerDecoded?.issuer" fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Vendor</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{offerDecoded?.vendor || offerDecoded?.issuer}}</span>
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Issuer</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{offerDecoded?.offer_issuer}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider *ngIf="offer.label" class="w-100 my-1"></mat-divider>
|
||||
<div *ngIf="offer.label" fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Label</h4>
|
||||
<span class="foreground-secondary-text">{{ offer.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
|
@ -12,9 +12,8 @@ import { CommonService } from '../../../../shared/services/common.service';
|
||||
import { CLNOfferInformation } from '../../../../shared/models/alertData';
|
||||
import { ScreenSizeEnum } from '../../../../shared/services/consts-enums-functions';
|
||||
|
||||
import { GetInfo, Offer, OfferRequest } from '../../../../shared/models/clnModels';
|
||||
import { Offer, OfferRequest } from '../../../../shared/models/clnModels';
|
||||
import { RTLState } from '../../../../store/rtl.state';
|
||||
import { clnNodeInformation } from '../../../store/cln.selector';
|
||||
|
||||
@Component({
|
||||
selector: 'rtl-cln-offer-information',
|
||||
@ -47,11 +46,11 @@ export class CLNOfferInformationComponent implements OnInit, OnDestroy {
|
||||
this.dataService.decodePayment(this.offer.bolt12!, true).
|
||||
pipe(takeUntil(this.unSubs[1])).subscribe((decodedOffer: OfferRequest) => {
|
||||
this.offerDecoded = decodedOffer;
|
||||
if (this.offerDecoded.offer_id && !this.offerDecoded.amount_msat) {
|
||||
this.offerDecoded.amount_msat = '0msat';
|
||||
this.offerDecoded.amount = 0;
|
||||
if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) {
|
||||
this.offerDecoded.offer_amount_msat = '0msat';
|
||||
this.offerDecoded.offer_amount = 0;
|
||||
} else {
|
||||
this.offerDecoded.amount = this.offerDecoded.amount ? +this.offerDecoded.amount : this.offerDecoded.amount_msat ? +(this.offerDecoded.amount_msat)?.slice(0, -4) : null;
|
||||
this.offerDecoded.offer_amount = this.offerDecoded.offer_amount ? +this.offerDecoded.offer_amount : this.offerDecoded.offer_amount_msat ? +this.offerDecoded.offer_amount_msat.slice(0, -4) : null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -143,7 +143,8 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
active: selOffer.active,
|
||||
offer_id: selOffer.offer_id,
|
||||
bolt12: selOffer.bolt12,
|
||||
bolt12_unsigned: selOffer.bolt12_unsigned
|
||||
created: selOffer.created,
|
||||
label: selOffer.label
|
||||
};
|
||||
this.store.dispatch(openAlert({
|
||||
payload: {
|
||||
@ -178,11 +179,11 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
onPrintOffer(selOffer: Offer) {
|
||||
this.dataService.decodePayment(selOffer.bolt12!, false).
|
||||
pipe(take(1)).subscribe((offerDecoded: OfferRequest) => {
|
||||
if (offerDecoded.offer_id && !offerDecoded.amount_msat) {
|
||||
offerDecoded.amount_msat = '0msat';
|
||||
offerDecoded.amount = 0;
|
||||
if (offerDecoded.offer_id && !offerDecoded.offer_amount_msat) {
|
||||
offerDecoded.offer_amount_msat = '0msat';
|
||||
offerDecoded.offer_amount = 0;
|
||||
} else {
|
||||
offerDecoded.amount = offerDecoded.amount ? +offerDecoded.amount : offerDecoded.amount_msat ? +offerDecoded.amount_msat.slice(0, -4) : null;
|
||||
offerDecoded.offer_amount = offerDecoded.offer_amount ? +offerDecoded.offer_amount : offerDecoded.offer_amount_msat ? +offerDecoded.offer_amount_msat.slice(0, -4) : null;
|
||||
}
|
||||
const documentDefinition = {
|
||||
pageSize: 'A5',
|
||||
@ -200,7 +201,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
height: 333,
|
||||
absolutePosition: { x: 84, y: 160 }
|
||||
},
|
||||
header: { text: (offerDecoded.vendor || offerDecoded.issuer || ''), alignment: 'center', fontSize: 25, color: '#272727', margin: [0, 20, 0, 0] },
|
||||
header: { text: (offerDecoded.offer_issuer || ''), alignment: 'center', fontSize: 25, color: '#272727', margin: [0, 20, 0, 0] },
|
||||
content: [
|
||||
{
|
||||
svg: '<svg width="249" height="2" viewBox="0 0 249 2" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="0.283203" width="249" height="1" fill="#EAEAEA"/></svg>',
|
||||
@ -208,9 +209,9 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
height: 40,
|
||||
alignment: 'center'
|
||||
},
|
||||
{ text: offerDecoded.description ? offerDecoded.description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' },
|
||||
{ text: offerDecoded.offer_description ? offerDecoded.offer_description.substring(0, 160) : '', alignment: 'center', fontSize: 16, color: '#5C5C5C' },
|
||||
{ qr: selOffer.bolt12, eccLevel: 'M', fit: '227', alignment: 'center', absolutePosition: { x: 7, y: 205 } },
|
||||
{ text: (!offerDecoded?.amount_msat || offerDecoded?.amount === 0 ? 'Open amount' : (this.decimalPipe.transform((offerDecoded.amount || 0) / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } },
|
||||
{ text: (!offerDecoded?.offer_amount_msat || offerDecoded?.offer_amount === 0 ? 'Open amount' : (this.decimalPipe.transform((offerDecoded.offer_amount || 0) / 1000) + ' SATS')), fontSize: 20, bold: false, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 430 } },
|
||||
{ text: 'SCAN TO PAY', fontSize: 22, bold: true, color: 'white', alignment: 'center', absolutePosition: { x: 0, y: 455 } }
|
||||
],
|
||||
footer: {
|
||||
@ -223,7 +224,7 @@ export class CLNOffersTableComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
alignment: 'center'
|
||||
}
|
||||
};
|
||||
pdfMake.createPdf(documentDefinition, null, null, pdfFonts.pdfMake.vfs).download('Offer-' + (offerDecoded && offerDecoded.description ? offerDecoded.description : selOffer.bolt12));
|
||||
pdfMake.createPdf(documentDefinition, null, null, pdfFonts.pdfMake.vfs).download('Offer-' + (offerDecoded && offerDecoded.offer_description ? offerDecoded.offer_description : selOffer.bolt12));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
public offerRequest = '';
|
||||
public offerDecodedHint = '';
|
||||
public offerDescription = '';
|
||||
public offerVendor = '';
|
||||
public offerIssuer = '';
|
||||
public offerTitle = '';
|
||||
public zeroAmtOffer = false;
|
||||
public offerInvoice: OfferInvoice | null = null;
|
||||
@ -235,7 +235,7 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
if (this.offerAmount) {
|
||||
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.OFFER,
|
||||
invoice: this.offerInvoice.invoice, saveToDB: this.flgSaveToDB, bolt12: this.offerRequest, amount: this.offerAmount * 1000,
|
||||
zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, vendor: this.offerVendor, description: this.offerDescription,
|
||||
zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, issuer: this.offerIssuer, description: this.offerDescription,
|
||||
fromDialog: true } }));
|
||||
}
|
||||
}
|
||||
@ -296,10 +296,10 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
this.paymentDecoded.msatoshi = +event.target.value;
|
||||
}
|
||||
if (this.paymentType === PaymentTypes.OFFER) {
|
||||
delete this.offerDecoded.amount;
|
||||
delete this.offerDecoded.amount_msat;
|
||||
this.offerDecoded.amount = +event.target.value * 1000;
|
||||
this.offerDecoded.amount_msat = event.target.value + 'msat';
|
||||
delete this.offerDecoded.offer_amount;
|
||||
delete this.offerDecoded.offer_amount_msat;
|
||||
this.offerDecoded.offer_amount = +event.target.value * 1000;
|
||||
this.offerDecoded.offer_amount_msat = event.target.value + 'msat';
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,31 +311,31 @@ export class CLNLightningSendPaymentsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
setOfferDecodedDetails() {
|
||||
if (this.offerDecoded.offer_id && !this.offerDecoded.amount_msat) {
|
||||
this.offerDecoded.amount_msat = '0msat';
|
||||
this.offerDecoded.amount = 0;
|
||||
if (this.offerDecoded.offer_id && !this.offerDecoded.offer_amount_msat) {
|
||||
this.offerDecoded.offer_amount_msat = '0msat';
|
||||
this.offerDecoded.offer_amount = 0;
|
||||
this.zeroAmtOffer = true;
|
||||
this.offerDescription = this.offerDecoded.description || '';
|
||||
this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : '';
|
||||
this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.description;
|
||||
this.offerDescription = this.offerDecoded.offer_description || '';
|
||||
this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : '';
|
||||
this.offerDecodedHint = 'Zero Amount Offer | Description: ' + this.offerDecoded.offer_description;
|
||||
} else {
|
||||
this.zeroAmtOffer = false;
|
||||
this.offerDecoded.amount = this.offerDecoded.amount ? +this.offerDecoded.amount : this.offerDecoded.amount_msat ? +this.offerDecoded.amount_msat.slice(0, -4) : null;
|
||||
this.offerAmount = this.offerDecoded.amount ? this.offerDecoded.amount / 1000 : 0;
|
||||
this.offerDescription = this.offerDecoded.description || '';
|
||||
this.offerVendor = this.offerDecoded.vendor ? this.offerDecoded.vendor : this.offerDecoded.issuer ? this.offerDecoded.issuer : '';
|
||||
this.offerDecoded.offer_amount = this.offerDecoded.offer_amount ? +this.offerDecoded.offer_amount : this.offerDecoded.offer_amount_msat ? +this.offerDecoded.offer_amount_msat.slice(0, -4) : null;
|
||||
this.offerAmount = this.offerDecoded.offer_amount ? this.offerDecoded.offer_amount / 1000 : 0;
|
||||
this.offerDescription = this.offerDecoded.offer_description || '';
|
||||
this.offerIssuer = this.offerDecoded.offer_issuer ? this.offerDecoded.offer_issuer : '';
|
||||
if (this.selNode && this.selNode.fiatConversion) {
|
||||
this.commonService.convertCurrency(this.offerAmount, CurrencyUnitEnum.SATS, CurrencyUnitEnum.OTHER, (this.selNode.currencyUnits && this.selNode.currencyUnits.length > 2 ? this.selNode.currencyUnits[2] : ''), this.selNode.fiatConversion).
|
||||
pipe(takeUntil(this.unSubs[7])).
|
||||
subscribe({
|
||||
next: (data) => {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats (' + data.symbol + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ') | Description: ' + this.offerDecoded.description;
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats (' + data.symbol + this.decimalPipe.transform((data.OTHER ? data.OTHER : 0), CURRENCY_UNIT_FORMATS.OTHER) + ') | Description: ' + this.offerDecoded.offer_description;
|
||||
}, error: (error) => {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.description + '. Unable to convert currency.';
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description + '. Unable to convert currency.';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.description;
|
||||
this.offerDecodedHint = 'Sending: ' + this.decimalPipe.transform(this.offerAmount) + ' Sats | Description: ' + this.offerDecoded.offer_description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ export class HelpComponent implements OnInit, OnDestroy {
|
||||
' 1. Click on "Create Offer" button.\n' +
|
||||
' 2. Description - Description you want to provide on the offer invoice.\n' +
|
||||
' 3. Amount - Amount for the offer invoice.\n' +
|
||||
' 4. Vendor - Vendor of the offer.\n' +
|
||||
' 4. issuer - issuer of the offer.\n' +
|
||||
'Paid offer bookmarks shows the list of paid offers saved for future payments.\n',
|
||||
link: this.LNPLink + 'transactions/offers',
|
||||
linkCaption: 'Offers',
|
||||
|
@ -96,8 +96,9 @@ export interface Offer {
|
||||
active?: boolean;
|
||||
single_use?: boolean;
|
||||
bolt12?: string;
|
||||
bolt12_unsigned?: string;
|
||||
used?: boolean;
|
||||
created?: boolean;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface OfferBookmark {
|
||||
@ -105,7 +106,7 @@ export interface OfferBookmark {
|
||||
bolt12?: string;
|
||||
amountMSat?: number;
|
||||
title?: string;
|
||||
vendor?: string;
|
||||
issuer?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
@ -210,34 +211,24 @@ interface Recurrence {
|
||||
}
|
||||
|
||||
export interface OfferRequest {
|
||||
offer_id?: string;
|
||||
offer_amount?: number | null;
|
||||
offer_amount_msat?: string;
|
||||
type?: string;
|
||||
valid?: boolean;
|
||||
offer_id?: string;
|
||||
node_id?: string;
|
||||
description?: string;
|
||||
signature?: string;
|
||||
chains?: string[];
|
||||
issuer?: string;
|
||||
currency?: string;
|
||||
minor_unit?: number;
|
||||
amount?: number | null;
|
||||
amount_msat?: string;
|
||||
send_invoice?: boolean;
|
||||
refund_for?: string;
|
||||
vendor?: string;
|
||||
features?: string;
|
||||
absolute_expiry?: string;
|
||||
paths?: Paths[];
|
||||
quantity_min?: number;
|
||||
quantity_max?: number;
|
||||
recurrence?: Recurrence;
|
||||
offer_node_id?: string;
|
||||
offer_description?: string;
|
||||
offer_issuer?: string;
|
||||
offer_chains?: string[];
|
||||
offer_absolute_expiry?: number;
|
||||
offer_quantity_max?: number;
|
||||
}
|
||||
|
||||
interface Changes {
|
||||
description_appended?: string;
|
||||
description?: string;
|
||||
vendor_removed?: string;
|
||||
vendor?: string;
|
||||
issuer_removed?: string;
|
||||
issuer?: string;
|
||||
msat?: string;
|
||||
}
|
||||
|
||||
@ -453,7 +444,7 @@ export interface SendPayment {
|
||||
fromDialog: boolean;
|
||||
paymentType: PaymentTypes;
|
||||
title?: string;
|
||||
vendor?: string;
|
||||
issuer?: string;
|
||||
invoice?: string;
|
||||
description?: string;
|
||||
saveToDB?: boolean;
|
||||
|
@ -12,7 +12,7 @@ export const HOUR_SECONDS = 3600;
|
||||
|
||||
export const DEFAULT_INVOICE_EXPIRY = HOUR_SECONDS * 24 * 7;
|
||||
|
||||
export const VERSION = '0.13.5-beta';
|
||||
export const VERSION = '0.13.6-beta';
|
||||
|
||||
export const API_URL = isDevMode() ? 'http://localhost:3000/rtl/api' : './api';
|
||||
|
||||
@ -846,7 +846,7 @@ export const CLN_PAGE_DEFS: CLNPageDefinitions = {
|
||||
},
|
||||
offer_bookmarks: {
|
||||
maxColumns: 6,
|
||||
allowedColumns: [{ column:'lastUpdatedAt', label: 'Updated At' }, { column:'title' }, { column:'description' }, { column:'vendor' }, { column:'bolt12', label: 'Invoice' },
|
||||
allowedColumns: [{ column:'lastUpdatedAt', label: 'Updated At' }, { column:'title' }, { column:'description' }, { column:'issuer' }, { column:'bolt12', label: 'Invoice' },
|
||||
{ column:'amountMSat', label: 'Amount' }]
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user