Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:add support for amountless in mintinfo and createMeltQuote #230

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

mubarak23
Copy link

Fixes: #225

Description

PR base on cashubtc/nuts#173 for handling amountless when melting quote

Changes

  • add check if mint support amountless
  • add options field for handling amountless in MeltQuotePayload

PR Tasks

  • Open PR
  • run npm run test --> no failing unit tests
  • run npm run format

@@ -94,4 +94,7 @@ export class MintInfo {
get motd() {
return this._mintInfo.motd;
}
get amountless() {
return this._mintInfo.amountless;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mint signals support via the MeltMethodOptions, not on the root level of the InfoReponse. Please check the PR again and make sure to adjust this accordingly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't seem to find MeltMethodOptions , is this something that already exist or we have to create a new one for it @Egge21M

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is there, but it might need some refactoring for this PR. You can find it as GetInfoResponse.nuts.5.methods

const meltQuotePayload: MeltQuotePayload = {
unit: this._unit,
request: invoice
};

if (this._mintInfo?.amountless) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only be adding the amount, if the caller explicitly passes amount. Otherwise this implementation defaults to 0 and mints that support this will throw an error if amount != invoiceAmount.

Also amount passed needs to be in msats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants