From c3ff644b22c9f1542107a25e3cb9b9908365c94f Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 5 Oct 2022 22:30:37 +0200 Subject: [PATCH] check fee via GET /checkfee --- docs/specs/cashu_client_spec.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/specs/cashu_client_spec.md b/docs/specs/cashu_client_spec.md index fc65024..24f6968 100644 --- a/docs/specs/cashu_client_spec.md +++ b/docs/specs/cashu_client_spec.md @@ -103,12 +103,13 @@ Here we describe how `Alice` checks with the mint whether the tokens she sent `C - If `` is `False`, `Alice` removes the proof [NOTE: consistent name?] from her list of spendable proofs. ## 6 - Pay a Lightning invoice -Here we describe how `Alice` can request from `Bob` to make a Lightning payment for her and burn an appropriate amount of tokens in return. `Alice` wants to pay a bolt11 invoice with the amount ``. She has to add a predefined fee to the request to account for the possible Lightning fees which results in a request with tokens with the total amount of ``. [NOTE: there is no way to do this dynamically as for now. We simply include a amount-dependent fee with the request and the mint essentially keeps the difference if it can find a cheaper-than-expected route. The mint refuses to pay the invoice if the fees included are not high-enough.] +Here we describe how `Alice` can request from `Bob` to make a Lightning payment for her and burn an appropriate amount of tokens in return. `Alice` wants to pay a bolt11 invoice with the amount ``. She has to add a fee to the request to account for the possible Lightning fees which results in a request with tokens with the total amount of ``. - `Alice` wants to pay the bolt11 invoice ``. -- `Alice` calculates the fees for the Lightning payments upfront with the function `max(, * *)` with `` currently being `4` Satoshis and `` being `0.01` (or 1% of ``). `Alice` then adds this fee to `` and rounds it up to the next higher integer which results in ``. -- `Alice` now performs the same set of instructions as in Step 3.1 and 3.2 and splits her spendable tokens into a set `` that she keeps and and a set `` that she can send for making the Lightning payment. -- `Alice` constructs the JSON `MeltRequest` of the form `{"proofs" : , "amount" : , "invoice" : }` [NOTE: Maybe use notation List[Proof] everywhere. Used MeltRequest here, maybe define each payload at the beginning of each section.] +- `Alice` asks `Bob` for the Lightning fee via `GET /checkfee` with the body being the json `{pr : }` +- `Alice` receives the `CheckFeeResponse` in the form of the json `{"fee" : }` resulting in ` = + `. +- `Alice` now performs the same set of instructions as in Step 3.1 and 3.2 and splits her spendable tokens into a set `` that she keeps and and a set `` with a sum of at least `` that she can send for making the Lightning payment. +- `Alice` constructs the JSON `MeltRequest` of the form `{"proofs" : , "invoice" : }` [NOTE: Maybe use notation List[Proof] everywhere. Used MeltRequest here, maybe define each payload at the beginning of each section.] - `Alice` requests a payment from `Bob` via the endpoint `POST /melt` with the JSON as the body of the request. - `Alice` receives a JSON of the form `{"paid" : }` with `` being `True` if the payment was successful and `False` otherwise. - If ` == True`, `Alice` removes `` from her database of spendable tokens [NOTE: called it tokens again]