Skip to content

feat(nut04/05): add method_name to [Mint|Melt]MethodSetting#374

Open
robwoodgate wants to merge 6 commits into
cashubtc:mainfrom
robwoodgate:mint-melt-method-name
Open

feat(nut04/05): add method_name to [Mint|Melt]MethodSetting#374
robwoodgate wants to merge 6 commits into
cashubtc:mainfrom
robwoodgate:mint-melt-method-name

Conversation

@robwoodgate

@robwoodgate robwoodgate commented May 22, 2026

Copy link
Copy Markdown
Collaborator

This PR adds an optional method_name param to the NUT-04 MintMethodSetting, and NUT-05 MeltMethodSetting.

The motivation is to make it easy for wallets to support custom payment methods in their UI.

Comment thread 04.md Outdated
Comment thread 05.md Outdated
@Kelbie

Kelbie commented May 22, 2026

Copy link
Copy Markdown

Does it make sense to add localization here or is that too much? If wallets have language configuration we could pick the relevant one for the user.

@robwoodgate

Copy link
Copy Markdown
Collaborator Author

Does it make sense to add localization here or is that too much? If wallets have language configuration we could pick the relevant one for the user.

I think too much for an info setting - could run to hundreds of entries. Wallet should make a policy decision to translate / ignore / decide their own names.

@thesimplekid

thesimplekid commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

I do not think we should localization for the reason Rob stated. However, should we give each method specified in the nut a name (bolt11, bolt12, onchain) so that mints all use the same one and then wallets can display this however they want. I think it would be confusing if cdk names bolt11 "lighting" for example and nutshell calls it "bolt11", wallets would then have to map these two to the same thing.

@KvngMikey

Copy link
Copy Markdown
Contributor

I do not think we should localization for the reason Rob stated. However, should we give each method specified in the nut a name (bolt11, bolt12, onchain) so that mints all use the same one and then wallets can display this however they want. I think it would be confusing if cdk names bolt11 "lighting" for example and nutshell calls it "bolt11", wallets would then have to map these two to the same thing.

i'm thinking we can do:

Bolt 11 -> Lightning
Bolt 12 -> Offers
onchain -> OnChain

so cdk and nutshell are compliant to these.

@thesimplekid

Copy link
Copy Markdown
Collaborator

I do not think we should localization for the reason Rob stated. However, should we give each method specified in the nut a name (bolt11, bolt12, onchain) so that mints all use the same one and then wallets can display this however they want. I think it would be confusing if cdk names bolt11 "lighting" for example and nutshell calls it "bolt11", wallets would then have to map these two to the same thing.

i'm thinking we can do:

Bolt 11 -> Lightning Bolt 12 -> Offers onchain -> OnChain

so cdk and nutshell are compliant to these.

Why not just bolt11, bolt12, and onchain, wallets can decide to call it something else on the user facing side if they want but don't think we need to add other naming to the spec?

@KvngMikey

Copy link
Copy Markdown
Contributor

Why not just bolt11, bolt12, and onchain, wallets can decide to call it something else on the user facing side if they want but don't think we need to add other naming to the spec?

that works also, just thought we wanted something extra.

@robwoodgate

Copy link
Copy Markdown
Collaborator Author

should we give each method specified in the nut a name (bolt11, bolt12, onchain) so that mints all use the same one and then wallets can display this however they want. I think it would be confusing if cdk names bolt11 "lighting" for example and nutshell calls it "bolt11", wallets would then have to map these two to the same thing.

Yes - wallets need predictable strings for translation, but rather than update all the first class nut methods (23/25/30), I added a one liner default rule.

@robwoodgate

Copy link
Copy Markdown
Collaborator Author

While we are here, anticipating custom methods, we should specify the allowed characters for method.

Cashu-TS only allows "a-z0-9-_" (base64url safe), so I used that as the template.

robwoodgate added a commit to cashubtc/cashu-ts that referenced this pull request Jun 26, 2026
# NUT cashubtc/nuts#374

Fiollows on from PR #672

## Summary

When a mint omits `method_name` (null or absent) in its NUT-04/05 method
settings, derive a human-readable default from `method`: replace `_`/`-`
with spaces and title-case each word (`bolt11` → `Bolt11`, `apple-pay` →
`Apple Pay`). Previously such entries were coerced to `null`.

`MintInfo.normalizeSwapMethods` now populates `method_name` during
normalization, so consumers reading the normalized response get a usable
name for every well-formed method. Malformed entries
(missing/empty/non-string `method`) still resolve to `null` rather than
producing a bogus name.

## Motivation

cashubtc/nuts#374 defines a deterministic fallback for `method_name`
when unspecified, letting wallets rely on predictable strings instead of
requiring every mint to name each method explicitly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants