From 96a16a9fd09fdc66ca4305bf148e76ad3e440646 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Wed, 12 Feb 2025 16:33:56 -0300 Subject: [PATCH] feat: create GET '/api/v1/ditto/cashu/mints' endpoint --- src/config.ts | 4 ++++ src/controllers/api/cashu.ts | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/config.ts b/src/config.ts index cdd88705..4a79a1a0 100644 --- a/src/config.ts +++ b/src/config.ts @@ -295,6 +295,10 @@ class Conf { static get preferredLanguages(): LanguageCode[] | undefined { return Deno.env.get('DITTO_LANGUAGES')?.split(',')?.filter(ISO6391.validate); } + /** Mints to be displayed in the UI when the user decides to create a wallet.*/ + static get cashuMints(): string[] { + return Deno.env.get('CASHU_MINTS')?.split(',') ?? []; + } /** Translation provider used to translate posts. */ static get translationProvider(): string | undefined { return Deno.env.get('TRANSLATION_PROVIDER'); diff --git a/src/controllers/api/cashu.ts b/src/controllers/api/cashu.ts index 2db03318..0a8d45b5 100644 --- a/src/controllers/api/cashu.ts +++ b/src/controllers/api/cashu.ts @@ -165,4 +165,11 @@ app.get('/wallet', requireNip44Signer, swapNutzapsMiddleware, async (c) => { return c.json(walletEntity, 200); }); +/** Get mints set by the CASHU_MINTS environment variable. */ +app.get('/mints', (c) => { + const mints = Conf.cashuMints; + + return c.json({ mints }, 200); +}); + export default app;