One is that if we want to claim locked ecash by melting to another mint, cashu-ts does not currently support unlocking in the melt operation so if the lightning payment fails, then we already had swapped to unlock and the original proofs are now spent.
Fixed by claiming the swapped proofs and prompting the user to add the source mint
The other issue was with a discrepancy in exchange rates between mints, and my getCrossMinttQuotes function was exceeding its max attempts to find valid mint/melt quotes to melt all the proofs.
Fixed by subtracting the difference in quotes rather than amountToMint = amountToMint - meltQuote.fee_reserve - 1;
There were two issues here.
One is that if we want to claim locked ecash by melting to another mint, cashu-ts does not currently support unlocking in the melt operation so if the lightning payment fails, then we already had swapped to unlock and the original proofs are now spent.
The other issue was with a discrepancy in exchange rates between mints, and my
getCrossMinttQuotes
function was exceeding its max attempts to find valid mint/melt quotes to melt all the proofs.amountToMint = amountToMint - meltQuote.fee_reserve - 1;