Upgrade to cashu-ts v4 and drop unused deps.
Adapt amount handling for v4 Amount objects, replace axios/uuid with fetch and crypto.randomUUID, and remove dead helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+3
-3
@@ -30,7 +30,7 @@ const cashu = require('../components/cashu');
|
||||
* $ref: '#/components/responses/InternalServerError'
|
||||
*/
|
||||
router.post('/decode', async (req, res) => {
|
||||
const { token } = req.body;
|
||||
const { token } = req.body ?? {};
|
||||
|
||||
if (!token) {
|
||||
return res.status(400).json({
|
||||
@@ -48,8 +48,8 @@ router.post('/decode', async (req, res) => {
|
||||
}
|
||||
|
||||
const decoded = await cashu.parseToken(token);
|
||||
const mintUrl = await cashu.getTokenMintUrl(token);
|
||||
|
||||
const mintUrl = decoded.mint;
|
||||
|
||||
let spent = false;
|
||||
try {
|
||||
const spendabilityCheck = await cashu.checkTokenSpendable(token);
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ const lightning = require('../components/lightning');
|
||||
* $ref: '#/components/responses/TooManyRequests'
|
||||
*/
|
||||
router.post('/validate-address', async (req, res) => {
|
||||
const { lightningAddress } = req.body;
|
||||
const { lightningAddress } = req.body ?? {};
|
||||
|
||||
if (!lightningAddress) {
|
||||
return res.status(400).json({
|
||||
|
||||
@@ -74,7 +74,7 @@ const redemption = require('../components/redemption');
|
||||
* $ref: '#/components/responses/InternalServerError'
|
||||
*/
|
||||
router.post('/redeem', async (req, res) => {
|
||||
const { token, lightningAddress } = req.body;
|
||||
const { token, lightningAddress } = req.body ?? {};
|
||||
|
||||
const validation = await redemption.validateRedemptionRequest(token, lightningAddress);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user