Skip to content

Commit 0d40500

Browse files
committed
added melting
1 parent 9efbdab commit 0d40500

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

docs/02-Guides/melting.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Melting Proofs
6+
7+
**Melting** is the reverse of [minting](minting.md). It involves paying [Proofs](https://github.com/cashubtc/nuts/blob/main/00.md#proof) back to the mint to settle an external Lightning invoice. This process consists of three steps:
8+
9+
1. Request a melt quote for the invoice.
10+
2. Submit the required Proofs (including a fee reserve, if applicable).
11+
3. Confirm whether the invoice was paid and collect any change.
12+
13+
:::warning
14+
Mints only refund overpaid fees. To ensure your inputs match the required amount, use `CashuWallet.send()` beforehand to swap Proofs as needed.
15+
:::
16+
17+
```ts
18+
const quote = await wallet.createMeltQuote(mintQuote.request);
19+
const fee = quote.fee_reserve;
20+
21+
const {keep, send} = await wallet.send(10, proofs});
22+
23+
const response = await wallet.meltProofs(quote, send);
24+
```
25+
26+
## Fee Reserve and Change
27+
28+
Mints may include a fee reserve to cover anticipated Lightning fees. The `cashu-ts` library automatically appends [blank outputs](https://github.com/cashubtc/nuts/blob/main/08.md) to the melt request and mints new Proofs if change is returned.
29+
30+
## Options
31+
32+
`meltProofs` accepts a range of options to control the shape of the minted Proofs. Check out the [API Reference](https://github.com/cashubtc/cashu-ts/blob/main/src/CashuWallet.ts) for more information

docs/02-Guides/minting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 1
44

55
# Minting Proofs
66

7-
**Minting** is the operation of making a Lightning payment to the mint to receive some [Proofs](https://github.com/cashubtc/nuts/blob/main/00.md#proof) in return.
7+
**Minting** is the process of creating new [Proofs](https://github.com/cashubtc/nuts/blob/main/00.md#proof) by paying a lightning invoice issued by the mint.
88
This is a three step process:
99

1010
1. Request the mint quote for amount `x`

0 commit comments

Comments
 (0)