Feature: Voucher implémentations #368
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On aleph-client we never really handle Vouchers we only accept it as args and trust the input,
now we want to be able to fetch Vouchers to ensure user have it .
Related ClickUp, GitHub or Jira tickets : ALEPH-458 (This feature is missing for this tickets)
Self proofreading checklist
Changes
This pull request introduces a new
VoucherManagerclass and associated functionality to manage and display voucher information within thealeph_client. It enhances thebalancecommand to show voucher details, adds a newvoucherscommand for detailed voucher information, and integrates voucher handling into the instance creation process. Additionally, a newvoucher.pyfile implements the core logic for fetching and processing vouchers.Voucher Management Integration:
VoucherManagerClass: Addedvoucher.pyto handle voucher-related operations, including fetching metadata, Solana vouchers, and EVM vouchers. The class provides methods likeget_all,fetch_vouchers_by_chain, andfetch_metadata. (src/aleph_client/voucher.py)Voucher,VoucherMetadata, andVoucherAttributemodels using Pydantic for structured data representation. (src/aleph_client/voucher.py)Command Enhancements:
balanceCommand Update: Enhanced thebalancecommand to display basic voucher information by integratingVoucherManager. (src/aleph_client/commands/account.py) [1] [2]vouchersCommand: Added a new command to display detailed voucher information, including attributes and descriptions, in a formatted table using therichlibrary. (src/aleph_client/commands/account.py)Instance Creation Updates:
VoucherManagerinto the instance creation process to handle NFT-based voucher payments, including chain-specific voucher fetching. (src/aleph_client/commands/instance/__init__.py)Dependencies and Imports:
VoucherManagerandrichlibrary components in the relevant files. (src/aleph_client/commands/account.py,src/aleph_client/commands/instance/__init__.py) [1] [2] [3]How to test
To be tested :
Account with chain {
AVAXSOLBASE}Create instance with nft payment method
Print screen / video
aleph account balancealeph account balance --address Boy5zDxzcX63bsACiavM4R2hyXSMiWZZA5D7uTp2BQ4naleph account vouchersaleph account vouchers --address 6VJFTyxctk7UAYsqjiqQK7BVvfRYZwJ5BgtPnyjqjGNnNotes
The Voucher Class should be move to the sdk in the future