Skip to content

Commit

Permalink
Create Offer call signature fix
Browse files Browse the repository at this point in the history
Create Offer call signature fix
  • Loading branch information
ShahanaFarooqui committed Feb 21, 2023
1 parent bf4b7fd commit d6c959d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cl-rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ server.listen(PORT, BIND, function() {

//Start the docserver
docserver.listen(DOCPORT, BIND, function() {
global.logger.warn('--- cl-rest doc server is ready and listening on ' + BIND + ':' + PORT + ' ---');
global.logger.warn('--- cl-rest doc server is ready and listening on ' + BIND + ':' + DOCPORT + ' ---');
})

exports.closeServer = function(){
Expand Down
43 changes: 24 additions & 19 deletions controllers/offers.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,34 @@ exports.offer = (req,res) => {
var qty_min = (req.body.quantity_min) ? req.body.quantity_min : null;

//Call the fundchannel command with the pub key and amount specified
var offerData = {};

if (!(global.version && isVersionCompatible(global.version, '22.11.1'))) {
offerData = {amount:amnt, description:desc, vendor:issuer, label:lbl,
quantity_min:qty_min, quantity_max:qty_max, absolute_expiry:abs_expry,
recurrence:rcrnc, recurrence_base:rcrnc_base, recurrence_paywindow:rcrnc_wndw,
recurrence_limit:rcrnc_lmt, single_use:sngl_use};
ln.offer(
amount=amnt, description=desc, vendor=issuer, label=lbl,
quantity_min=qty_min, quantity_max=qty_max, absolute_expiry=abs_expry,
recurrence=rcrnc, recurrence_base=rcrnc_base, recurrence_paywindow=rcrnc_wndw,
recurrence_limit=rcrnc_lmt, single_use=sngl_use
).then(data => {
global.logger.log('offer creation success');
res.status(201).json(data);
}).catch(err => {
global.logger.warn(err);
res.status(500).json({error: err});
});
} else {
offerData = {amount:amnt, description:desc, issuer:issuer, label:lbl,
quantity_max:qty_max, absolute_expiry:abs_expry,
recurrence:rcrnc, recurrence_base:rcrnc_base, recurrence_paywindow:rcrnc_wndw,
recurrence_limit:rcrnc_lmt, single_use:sngl_use};
ln.offer(
amount=amnt, description=desc, issuer=issuer, label=lbl,
quantity_max=qty_max, absolute_expiry=abs_expry,
recurrence=rcrnc, recurrence_base=rcrnc_base, recurrence_paywindow=rcrnc_wndw,
recurrence_limit=rcrnc_lmt, single_use=sngl_use
).then(data => {
global.logger.log('offer creation success');
res.status(201).json(data);
}).catch(err => {
global.logger.warn(err);
res.status(500).json({error: err});
});
}

global.logger.warn(offerData);

ln.offer(offerData).then(data => {
global.logger.log('offer creation success');
res.status(201).json(data);
}).catch(err => {
global.logger.warn(err);
res.status(500).json({error: err});
});
ln.removeListener('error', connFailed);
}

Expand Down

0 comments on commit d6c959d

Please sign in to comment.