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:
Michilis
2026-07-23 03:46:59 +00:00
co-authored by Cursor
parent bd18271957
commit 449a8dda0d
9 changed files with 696 additions and 1197 deletions
+3 -3
View File
@@ -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
View File
@@ -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({
+1 -1
View File
@@ -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);