aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/ecash.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/routes/ecash.js b/routes/ecash.js
new file mode 100644
index 00000000..6ca570bf
--- /dev/null
+++ b/routes/ecash.js
@@ -0,0 +1,18 @@
+import { CashuMint, CashuWallet, MintQuoteState } from '@cashu/cashu-ts';
+
+export default {
+ async mint({ body }, res) {
+ const mintUrl = 'http://mint:3338'; // the mint URL
+ const mint = new CashuMint(mintUrl);
+ const wallet = new CashuWallet(mint);
+ const mintQuote = await wallet.createMintQuote(64);
+ console.log(mintQuote)
+ // pay the invoice here before you continue...
+ const mintQuoteChecked = await wallet.checkMintQuote(mintQuote.quote);
+ console.log(mintQuoteChecked)
+ if (mintQuoteChecked.state == MintQuoteState.PAID) {
+ const { proofs } = await wallet.mintTokens(64, mintQuote.quote);
+ console.log(proofs)
+ }
+ }
+}