feat: create GET '/api/v1/ditto/cashu/mints' endpoint

This commit is contained in:
P. Reis 2025-02-13 13:23:47 -03:00
parent 795c83ee88
commit 3418871a70
2 changed files with 14 additions and 6 deletions

View file

@ -283,3 +283,16 @@ Deno.test('GET /wallet must be successful', {
balance: 100, balance: 100,
}); });
}); });
Deno.test('GET /mints must be successful', {}, async () => {
const app = new Hono<AppEnv>().route('/', cashuApp);
const response = await app.request('/mints', {
method: 'GET',
});
const body = await response.json();
assertEquals(response.status, 200);
assertEquals(body, { mints: [] });
});

View file

@ -19,12 +19,6 @@ type Wallet = z.infer<typeof walletSchema>;
const app = new Hono().use('*', storeMiddleware, signerMiddleware); const app = new Hono().use('*', storeMiddleware, signerMiddleware);
// CASHU_MINTS = ['https://mint.cashu.io/1', 'https://mint.cashu.io/2', 'https://mint.cashu.io/3']
// Mint: https://github.com/cashubtc/nuts/blob/main/06.md
// app.get('/mints') -> Mint[]
// app.delete('/wallet') -> 204 // app.delete('/wallet') -> 204
// app.post(swapMiddleware, '/nutzap'); // app.post(swapMiddleware, '/nutzap');
@ -167,6 +161,7 @@ app.get('/wallet', requireNip44Signer, swapNutzapsMiddleware, async (c) => {
/** Get mints set by the CASHU_MINTS environment variable. */ /** Get mints set by the CASHU_MINTS environment variable. */
app.get('/mints', (c) => { app.get('/mints', (c) => {
// TODO: Return full Mint information: https://github.com/cashubtc/nuts/blob/main/06.md
const mints = Conf.cashuMints; const mints = Conf.cashuMints;
return c.json({ mints }, 200); return c.json({ mints }, 200);