Cashu playground
Run cashu-ts flows and see what actually changes. Choose a flow, run it against a test mint, and compare the request, response, wallet state, and cashu-ts code. Test shortcuts are labelled where they appear.
1. Choose a flow Use the recipe cards below. Create wallet is the clean first run.
2. Press run The timeline shows each request and response.
3. Copy the code The code panel shows the cashu-ts calls and the state your app owns.
Create wallet Create a wallet object and load mint metadata. Storage is your app’s job. Open Mint token Create a BOLT11 quote, use the test mint auto-fill, then mint and store real test proofs. Open Send token Select proofs, swap for sender change and receiver proofs, then encode the token. Open Receive token Mint a fresh token in the background, receive it live, then store receiver proofs. Open Melt token / pay invoice Mint wallet proofs, create a payable test invoice, melt live, and store returned change. Selected
The same calls as the live run. Add your own storage where shown.
import { Wallet } from '@cashu/cashu-ts'
const mintUrl = "https://nofee.testnut.cashu.space"
const invoice = "lnbc120n1pdemomeltinvoicepp5cashutoolsdemo"
const wallet = new Wallet(mintUrl)
await wallet.loadMint()
const proofs = await loadSpendableProofs()
const meltQuote = await wallet.createMeltQuoteBolt11(invoice)
const amountToSend = meltQuote.amount.add(meltQuote.fee_reserve)
const { keep: proofsToKeep, send: proofsToSend } = await wallet.ops
.send(amountToSend, proofs)
.includeFees(true) // sender covers the receiver's future spend fee
.run()
const meltResponse = await wallet.meltProofsBolt11(meltQuote, proofsToSend)
await replaceProofs({ remove: proofs, add: [...proofsToKeep, ...meltResponse.change] }) // your app persistence function
Mint-shaped example EXAMPLE
POST /v1/melt/quote/bolt11
Deterministic example that matches the mint’s real response shape.
A melt starts by asking the mint for the invoice amount and fee reserve before spending proofs.
Request
{
"request": "lnbc120n1pdemomeltinvoicepp5cashutoolsdemo",
"unit": "sat"
} Quote basics
{
"quote": "melt_quote_demo_12",
"amount": 12,
"fee_reserve": 2,
"state": "UNPAID"
} Invoice carried through quote
{
"request": "lnbc120n1pdemomeltinvoicepp5cashutoolsdemo"
} Step 2
Select proofs to cover amount + reserve Local cashu-ts logic EXAMPLE
LOCAL wallet.selectProofsToSend()
Computed locally by cashu-ts / your app — not an HTTP call to the mint.
Unlike a plain send, proof selection has to cover the invoice amount plus the mint fee reserve.
Invoice + reserve target
{
"amount": 12,
"feeReserve": 2,
"target": 14
} Available proofs in wallet
[
{
"amount": 8,
"id": "009a1f293253e41e"
},
{
"amount": 8,
"id": "009a1f293253e41e"
},
{
"amount": 4,
"id": "009a1f293253e41e"
},
{
"amount": 1,
"id": "009a1f293253e41e"
}
] Selected proofs to melt
[
{
"amount": 8,
"id": "009a1f293253e41e"
},
{
"amount": 8,
"id": "009a1f293253e41e"
}
] Untouched proofs that remain local
[
{
"amount": 4,
"id": "009a1f293253e41e"
},
{
"amount": 1,
"id": "009a1f293253e41e"
}
] Step 3
Prepare change outputs Local cashu-ts logic EXAMPLE
LOCAL wallet.createMeltChangeProofs()
Computed locally by cashu-ts / your app — not an HTTP call to the mint.
If the fee reserve was too high, the unused sats come back as change proofs.
Request
{
"selectedTotal": 16,
"amount": 12,
"feeReserve": 2,
"actualFeePaid": 1
} Reserved vs actual fee
{
"feeReserve": 2,
"actualFeePaid": 1,
"unusedReserveReturned": 1
} Change outputs returned to wallet
[
2,
1
] Step 4
Complete melt and settle invoice Mint · runs on execute READY
POST /v1/melt/bolt11
Preview values for now. Press Run to replace them with the real response.
When run with the default invoice, the API creates a payable test invoice and settles it live through the payer mint.
Inputs: proofs consumed for payment
[
{
"amount": 8,
"id": "009a1f293253e41e"
},
{
"amount": 8,
"id": "009a1f293253e41e"
}
] Requested change outputs
[
2,
1
] Paid quote result
{
"paid": true,
"payment_preimage": "demo-preimage-12",
"invoice": "lnbc120n1pdemomeltinvoicepp5cashutoolsdemo",
"amount": 12,
"feeReserve": 2,
"actualFeePaid": 1,
"totalSpent": 13,
"quote": "melt_quote_demo_12"
} Change proofs returned
[
{
"amount": 2,
"id": "009a1f293253e41e",
"secret": "demo-melt-change-1",
"C": "02meltchange1"
},
{
"amount": 1,
"id": "009a1f293253e41e",
"secret": "demo-melt-change-2",
"C": "02meltchange2"
}
] Quote amount + reserve
12 sat + 2 sat The wallet budgets invoice amount plus fee reserve before melting. Selected proofs
8 sat + 8 sat These proofs are consumed to fund the invoice payment path. Returned change
2 sat + 1 sat 3 sat comes back after fee reconciliation. Payment result
Invoice paid Spent 13 sat total; fee used 1 sat. Before summary
{
"balance": 21,
"amount": 12,
"feeReserve": 2,
"consumed": [
8,
8
],
"preimagePresent": false
} After summary
{
"balance": 8,
"amount": 12,
"feeReserve": 2,
"consumed": [
8,
8
],
"returnedChange": [
2,
1
],
"paid": true,
"totalSpent": 13,
"preimagePresent": true
}