Skip to content

Refactor: replace VoucherManager by voucher service from sdk #390

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

1yam
Copy link
Member

@1yam 1yam commented Aug 5, 2025

This PR remove voucher logic from CLI to go to SDK.
And replace call from the voucher manager to client.voucher...

Related ClickUp, GitHub or Jira tickets : ALEPH-542

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests

Changes

This pull request refactors how voucher-related functionality is accessed in the codebase. The main change is the removal of the local VoucherManager implementation and the switch to using voucher methods provided by the upstream aleph-sdk-python package. This results in cleaner code and reduces maintenance overhead by delegating voucher logic to the SDK. The dependency on aleph-sdk-python is also updated to a specific branch that includes the necessary voucher features.

Dependency and SDK integration:

  • Updated the aleph-sdk-python dependency in pyproject.toml to point to a specific GitHub branch (1yam-voucher-service) that provides the required voucher functionality.
  • Removed the local VoucherManager class and all related voucher logic from src/aleph_client/voucher.py, fully delegating voucher operations to the SDK.

Codebase refactoring and simplification:

  • Replaced all usages of VoucherManager in src/aleph_client/commands/account.py and src/aleph_client/commands/instance/__init__.py with the new AuthenticatedAlephHttpClient SDK client and its voucher methods, such as get_vouchers and fetch_vouchers_by_chain. [1] [2] [3] [4] [5]
  • Cleaned up imports to remove references to the now-deleted VoucherManager. [1] [2]

These changes streamline voucher handling, leverage upstream improvements, and reduce duplicated logic in the codebase.

How to test

  • Create instancee using NFT
  • aleph account vouchers

Notes

Depends on : aleph-im/aleph-sdk-python#225

Copy link

github-actions bot commented Aug 5, 2025

Failed to retrieve llama text: POST 500: {"error": "500: Unhandled error during initialisation"}

@nesitor
Copy link
Member

nesitor commented Aug 6, 2025

Seems that tests are failing here, but also will be good to add unit tests ensuring that proper methods are called from the SDK.

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