Skip to content

Conversation

1yam
Copy link
Member

@1yam 1yam commented Aug 4, 2025

Related to ALEPH-542

This pull request introduces a new voucher service for managing and retrieving vouchers across EVM and Solana chains, along with tests for the functionality. The most significant changes include the creation of AuthenticatedVoucher and Vouchers classes, the addition of voucher-related types, configuration updates, and comprehensive unit tests.

Voucher Service Implementation:

  • src/aleph/sdk/client/services/authenticated_voucher.py: Added the AuthenticatedVoucher class, which extends Vouchers. It allows retrieval of vouchers without explicitly passing an address by using the account address as a fallback. This includes methods for fetching vouchers (get_vouchers, get_evm_vouchers, get_solana_vouchers) and resolving addresses.
  • src/aleph/sdk/client/services/voucher.py: Introduced the Vouchers class for fetching voucher data from EVM and Solana chains. It includes utilities for resolving addresses, fetching metadata, and retrieving vouchers by chain.

Voucher Types and Configuration:

  • src/aleph/sdk/types.py: Added Voucher, VoucherMetadata, and VoucherAttribute types to represent voucher data and metadata. These types encapsulate attributes like name, description, external URL, image, and traits.
  • src/aleph/sdk/conf.py: Added configuration settings for voucher metadata URLs, Solana registry URLs, and the voucher sender address. These settings are used by the voucher services to interact with external resources.

Unit Tests:

  • tests/unit/services/test_authenticated_voucher.py: Added tests for the AuthenticatedVoucher class, verifying address resolution logic and voucher retrieval for both EVM and Solana chains. Tests ensure fallback mechanisms work correctly when no address is provided.
  • tests/unit/services/test_voucher.py: Added tests for the Vouchers class, covering metadata fetching, voucher retrieval by chain, and chain detection logic for both EVM and Solana addresses.

Copy link
Member

@nesitor nesitor left a comment

Choose a reason for hiding this comment

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

The are some things to change on tests and also one or 2 needed on the code.

@1yam 1yam force-pushed the 1yam-voucher-service branch from 28567be to 5c4d9ec Compare September 16, 2025 09:34
nesitor
nesitor previously approved these changes Sep 18, 2025
@nesitor nesitor merged commit bdc8019 into main Sep 18, 2025
38 checks passed
@nesitor nesitor deleted the 1yam-voucher-service branch September 18, 2025 15:09
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