add note about using a short-lived event to keep track of minting quote IDs

This commit is contained in:
pablof7z 2024-09-28 18:40:15 -05:00
parent fcc3256579
commit a4c02d1ab2

17
60.md
View File

@ -184,5 +184,22 @@ Her client:
}
```
## Redeeming a quote (optional)
When creating a quote at a mint, an event can be used to keep the state of the quote ID, which will be used to check when the quote has been paid. These events should be created with an expiration tag [[NIP-40]] matching the expiration of the bolt11 received from the mint; this signals to relays when they can safely discard these events.
Application developers are encouraged to use local state when possible and only publish this event when it makes sense in the context of their application.
```jsonc
{
"kind": 7374,
"content": nip44_encrypt("quote-id"),
"tags": [
[ "expiration", "<expiration-timestamp>" ],
[ "mint", "<mint-url>" ],
[ "a", "37375:<pubkey>:my-wallet" ]
]
}
```
## Appendix 1: Validating proofs
Clients can optionally validate proofs to make sure they are not working from an old state; this logic is left up to particular implementations to decide when and why to do it, but if some proofs are checked and deemed to have been spent, the client should delete the token and roll over any unspent proof.