aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-08-16 14:27:56 -0700
committerAdam Soltys <[email protected]>2024-08-16 14:27:56 -0700
commitf8cfd7e189c62c6325a126df1dda3b24cb1bbc36 (patch)
tree08d12f40589b3675ddb0453d586b83a79ac68691 /routes
parente17a531ce983a3e2fcc233a606b9b3678e22266a (diff)
downloadcoinos-server-f8cfd7e189c62c6325a126df1dda3b24cb1bbc36.tar.gz
coinos-server-f8cfd7e189c62c6325a126df1dda3b24cb1bbc36.zip
transfer ecash
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)
+ }
+ }
+}