Skip to content

Commit

Permalink
NUT-4/NUT-5: Method-unit pair is object with settings (#82)
Browse files Browse the repository at this point in the history
* NUT-4/NUT-5: Method-unit pair is object with settings

* clarify min_amount and max_amount
  • Loading branch information
callebtc committed Mar 20, 2024
1 parent b4e487a commit d18c6df
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 8 deletions.
30 changes: 27 additions & 3 deletions 04.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,37 @@ The settings for this nut indicate the supported method-unit pairs for minting a
{
"4": {
"methods": [
["bolt11", "sat"]
<MintMethodSetting>,
...
],
"disabled": false
"disabled": <bool>
}
}
```
Here, `methods` is an array of arrays with `[method, unit]` pairs. `disabled` indicates whether this minting is disabled and the mint only allows melting ecash.

`MintMethodSetting` indicates supported `method` and `unit` pairs and additional settings of the mint. `disabled` indicates whether this minting is disabled.

`MintMethodSetting` is of the form:
```json
{
"method": <str>,
"unit": <str>,
"min_amount": <int|null>,
"max_amount": <int|null>
}
```
`min_amount` and `max_amount` indicate the minimum and maximum amount for an operation of this method-unit pair.

Example `MintMethodSetting`:

```json
{
"method": "bolt11",
"unit": "sat",
"min_amount": 0,
"max_amount": 10000
}
```

[00]: 00.md
[01]: 01.md
Expand Down
31 changes: 28 additions & 3 deletions 05.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,39 @@ Response of `Bob`:
The settings for this nut indicate the supported method-unit pairs for melting. They are part of the info response of the mint ([NUT-06][06]) which in this case reads
```json
{
"5": {
"4": {
"methods": [
["bolt11", "sat"]
<MeltMethodSetting>,
...
],
"disabled": <bool>
}
}
```
Here, `methods` is an array of arrays with `[method, unit]` pairs.

`MeltMethodSetting` indicates supported `method` and `unit` pairs and additional settings of the mint. `disabled` indicates whether this melting is disabled.

`MeltMethodSetting` is of the form:
```json
{
"method": <str>,
"unit": <str>,
"min_amount": <int|null>,
"max_amount": <int|null>
}
```
`min_amount` and `max_amount` indicate the minimum and maximum amount for an operation of this method-unit pair.

Example `MeltMethodSetting`:

```json
{
"method": "bolt11",
"unit": "sat",
"min_amount": 100,
"max_amount": 10000
}
```

[00]: 00.md
[01]: 01.md
Expand Down
15 changes: 13 additions & 2 deletions 06.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ With the mint's response being of the form `GetInfoResponse`:
"nuts": {
"4": {
"methods": [
["bolt11", "sat"]
{
"method": "bolt11",
"unit": "sat",
"min_amount": 0,
"max_amount": 10000
}
],
"disabled": false
},
"5": {
"methods": [
["bolt11", "sat"]
{
"method": "bolt11",
"unit": "sat",
"min_amount": 100,
"max_amount": 10000
},
"disabled": false
]
},
"7": {"supported": true},
Expand Down

0 comments on commit d18c6df

Please sign in to comment.