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

Wallet: determine valid amounts from mint's keys response #684

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NonsoAmadi10
Copy link

What does this PR do?

Changes Made

  1. Modified the mint method in the Wallet class to use allowed amounts from the mint instead of hardcoding 2^n denominations.
  2. Added a get_allowed_amounts method to fetch supported denominations from the current keyset.
  3. Updated the test_mint_amounts_wrong_order test to expect the new error message for unsupported denominations.

Background Context

The previous implementation assumed that mints would always use powers of 2 for token denominations. However, the Cashu protocol allows mints to use any denomination structure they prefer. This change makes the wallet more flexible and compliant with the protocol, enabling it to work with a wider range of mint configurations.

Testing

The existing test suite has been updated to reflect these changes. The test_mint_amounts_wrong_order test now checks for the correct error message when attempting to mint unsupported denominations.

- Update `mint` method to use allowed amounts from the mint
- Add `get_allowed_amounts` method to fetch supported denominations
- Modify `test_mint_amounts_wrong_order` to expect new error message
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.

Wallet: determine valid amounts from mint's keys response
2 participants