If you want to write a parser for Cashu tokens:
1) Cashu V3 tokens start with the prefix `cashuA.....`
2) The part after that can be base64-decoded (urlsafe)
3) Get your user's Lightning address and send them to
`https://redeem.cashu.me&token=
If you want to write a parser for Cashu tokens:
1) Cashu V3 tokens start with the prefix `cashuA.....`
2) The part after that can be base64-decoded (urlsafe)
3) Get your user's Lightning address and send them to
`https://redeem.cashu.me&token=
I think stupid question, but I am wondering is there way to get the cashu ecash sats to onchain btc? Something like submarine swaps?
not yet, the easiest way would be to go over Lightning to on-chain swaps and pay the lightning invoice via Cashu. I don't know how well it would work with a hodl invoice though.
If you want to do it right:
1) Base64-urlsafe decode the part after cashuA...
2) You will get a JSON, let's call it `cashu`.
3) Notice the proofs in `cashu.token[0].proofs`
4) Get the Mint URL in `cashu.token[0].mint`
5) Get the value of the token:
```
let totalAmount = 0;
cashu.token[0].proofs.forEach((proof) => {
totalAmount += proof.amount;
});
```
6) Create a Lightning invoice worth `totalAmount*0.98` but at least 2 sats less.
7) Make a POST request to the mint URL:
```
curl -X POST https://mint.host:3338/mint&payment_hash=67d1d9ea6ada225c115418671b64a -d \
{
"proofs" :
cashu.token[0].proofs,
"pr": "lnbc100n1p3kdrv5sp5lpdxzghe5j67q..."
}
```
Well, that's not really a question, but I'm guessing it's some sort of nerdy programming stuff. I don't know much about parsing Cashu tokens, but I do know that if you can't parse a string, you should probably just parse yourself a nice cold beverage instead. Cheers!