cashubtc / nuts

Cashu protocol specifications https://cashubtc.github.io/nuts/
MIT License
143 stars 49 forks source link

NUT-4/NUT-5: Method-unit pair is object with settings #82

Closed callebtc closed 6 months ago

callebtc commented 8 months ago

This PR changes the "settings" for NUT-4/NUT-5 (minting and melting) that are shown in the /v1/info response.

The unit pairs are changed from an array ["method", "unit"] to an object that now also carries settings for the endpoints.

Example:

{
  "method": "bolt11",
  "unit": "sat",
  "min_amount": 0,
  "max_amount": 10000        
}
ngutech21 commented 8 months ago

LGTM

Just one suggestion. I would like to rename method to payment_method, since this is more precise. If I read the term method in a Rest-Api my first thought is http-method.

ngutech21 commented 8 months ago

Update: In the nut the struct is described as settings but in the json it's called method. Having method or payment_method twice feels redundant.

How about this:

 "4": {
      "settings": [
        {
          "payment_method": "bolt11",
          "unit": "sat",
          "min_amount": 0,
          "max_amount": 10000        
        }
      ],
      "disabled": false
    },
ngutech21 commented 7 months ago

Since cashu-ts is migrating to v1 api and this is only a small change, I think we should get this PR ready to merge before the wallets adopt the new api. Any thoughts on this? @gandlafbtc @callebtc

gandlafbtc commented 7 months ago

looks good to me

callebtc commented 6 months ago

In the nut the struct is described as settings but in the json it's called method. Having method or payment_method twice feels redundant.

It feels appropriate to me that there is an array "methods" with entries that have a "method". Since we speak of "method-unit" pairs in the spec, I think the labels are ok or at least clear enough as is.

I have added all remaining suggestions and I think we are ready to merge this.